create static method

Future<Ed25519PrivateKey> create(
  1. SimpleKeyPair keyPair, [
  2. Uint8List? privateKeyBytes
])

Creates a private key from a cryptography key pair.

The seed is read from keyPair when privateKeyBytes is not given.

Implementation

static Future<Ed25519PrivateKey> create(crypto.SimpleKeyPair keyPair, [Uint8List? privateKeyBytes]) async {
  final publicKeyObj = await keyPair.extractPublicKey();
  final publicKey = Ed25519PublicKey(publicKeyObj);
  final seed = privateKeyBytes ?? Uint8List.fromList(await keyPair.extractPrivateKeyBytes());
  return Ed25519PrivateKey._(keyPair, publicKey, seed);
}