encryptAsync function Null safety
- CryptoRSAPublicKey key,
- Uint8List plaintext
Implementation
Future<Uint8List> encryptAsync(CryptoRSAPublicKey key, Uint8List plaintext) {
Map<String, String> q = {};
q['plaintext'] = base64.encode(plaintext);
q['key'] = key.encode();
return compute(
(Map<String, String> q) => encrypt(
CryptoRSAPublicKey.decode(q['key']!),
base64.decode(q['plaintext']!)),
q)
.then((ciphertext) => ciphertext);
}