generateKeyPair method

  1. @override
Future<RelayAuthKeyPair> generateKeyPair([
  1. Uint8List? seed
])
override

Implementation

@override
Future<RelayAuthKeyPair> generateKeyPair([Uint8List? seed]) async {
  ed.PrivateKey privateKey;
  ed.PublicKey publicKey;
  if (seed == null) {
    final keyPair = ed.generateKey();
    privateKey = keyPair.privateKey;
    publicKey = keyPair.publicKey;
  } else {
    privateKey = ed.newKeyFromSeed(seed);
    publicKey = ed.public(privateKey);
  }

  return RelayAuthKeyPair(
    Uint8List.fromList(privateKey.bytes),
    Uint8List.fromList(publicKey.bytes),
  );
}