encryptWithKey method
Provided some binary data and a EncryptionKey (key type dependant on the encryption scheme being used) Return an EncryptionResult
Implementation
Future<EncryptionResult> encryptWithKey(
List<int> data, EncryptionKey key) async {
assert(key is KeyPair, 'RSA encryption requires a `KeyPair`');
final KeyPair keyPair = key as KeyPair;
assert(keyPair.publicKey != null, 'Public key is required for encryption');
return _encryptWithPublicKey(keyPair.publicKey!, data);
}