generateKeyPair function
Implementation
Future<KeyPair> generateKeyPair() async {
try {
final keyOptions = KeyOptions()
..algorithm = Algorithm.RSA
..rsaBits = 2048;
final keyPair =
await OpenPGP.generate(options: Options()..keyOptions = keyOptions);
keyPair.privateKey = removeVersionFromPublicKey(keyPair.privateKey);
keyPair.publicKey = removeVersionFromPublicKey(keyPair.publicKey);
return keyPair;
} catch (error) {
print(error);
throw Exception(error);
}
}