newKeyPair method

  1. @override
Future<SimpleKeyPair> newKeyPair()

Generates a new KeyPair for this algorithm.

Implementation

@override
Future<SimpleKeyPair> newKeyPair() async {
  if (!kIsWeb) {
    if (isSupportedPlatform) {
      final result = await invokeMethod('Ed25519.newKeyPair', {});
      return SimpleKeyPairData(
        result['privateKey'] as Uint8List,
        publicKey: SimplePublicKey(
          result['publicKey'] as Uint8List,
          type: KeyPairType.x25519,
        ),
        type: KeyPairType.x25519,
      );
    }
  }
  return fallback.newKeyPair();
}