newKeyPairFromSeed method

  1. @override
Future<SimpleKeyPair> newKeyPairFromSeed(
  1. List<int> seed
)
override

Generates a new KeyPair that uses the seed bytes.

This will throw UnsupportedError if the algorithm does not support seeds for private key generation.

Implementation

@override
Future<SimpleKeyPair> newKeyPairFromSeed(List<int> seed) async {
  if (seed.length != 32) {
    throw ArgumentError('Seed must have 32 bytes');
  }
  return Future<SimpleKeyPairData>.value(SimpleKeyPairData(
    Uint8List.fromList(seed),
    type: KeyPairType.ed25519,
    publicKey: await _publicKey(seed),
  ));
}