fromSeckeySync method

Ed25519Keypair fromSeckeySync(
  1. Uint8List seckey
)

Creates a keypair from a seckey byte array.

This method should only be used to recreate a keypair from a previously generated seckey. Generating keypairs from a random seed should be done using the fromSeedSync method.

Throws an AssertionError if the seckey is invalid. Creates a keypair from a seckey byte array.

This method should only be used to recreate a keypair from a previously generated seckey. Generating keypairs from a random seed should be done using the fromSeedSync method.

Throws an AssertionError if the seckey is invalid.

Implementation

// Future<Ed25519Keypair> fromSeckey(final Uint8List seckey) =>
//     compute(fromSeckeySync, seckey);

/// {@template NaClKeypair.fromseckeySync}
/// Creates a keypair from a [seckey] byte array.
///
/// This method should only be used to recreate a keypair from a previously generated [seckey].
/// Generating keypairs from a random seed should be done using the [fromSeedSync] method.
///
/// Throws an [AssertionError] if the [seckey] is invalid.
/// {@endtemplate}
Ed25519Keypair fromSeckeySync(final Uint8List seckey) {
  if (seckey.length != seckeyLength)
    throw Exception('Invalid secret key length ${seckey.length}.');
  final Uint8List pubkey = seckey.sublist(seckey.length - pubkeyLength);
  return Ed25519Keypair(pubkey: pubkey, seckey: seckey);
}