generate static method

Ed25519KeyIdentity generate(
  1. Uint8List? seed
)

Implementation

static Ed25519KeyIdentity generate(Uint8List? seed) {
  if (seed != null && seed.length != 32) {
    throw 'Ed25519 Seed needs to be 32 bytes long.';
  }

  Uint8List publicKey;
  Uint8List secretKey;

  var kp = seed == null ? SigningKey.generate() : SigningKey.fromSeed(seed);

  publicKey = kp.publicKey.buffer.asUint8List();
  secretKey = kp.asTypedList;

  return Ed25519KeyIdentity(
    Ed25519PublicKey.fromRaw(publicKey),
    secretKey,
  );
}