Ed25519Keypair constructor

Ed25519Keypair([
  1. Uint8List? secretKey
])

Create a new Ed25519 keypair instance. Generate random keypair if no Ed25519Keypair is provided.

Implementation

Ed25519Keypair([Uint8List? secretKey]) {
  if (secretKey != null) {
    final privateKey = ed25519.PrivateKey(secretKey);
    final publicKey = ed25519.PublicKey(privateKey.bytes.sublist(32));
    _signingKeypair = ed25519.KeyPair(privateKey, publicKey);
  } else {
    _signingKeypair = ed25519.generateKey();
  }
}