encryptAsymmetricBytes function

String encryptAsymmetricBytes(
  1. Uint8List bytesPayload,
  2. String hexPublicKey
)

Implementation

String encryptAsymmetricBytes(Uint8List bytesPayload, String hexPublicKey) {
  final pubKey = PublicKey(hex.decode(hexPublicKey));
  final sealedBox = SealedBox(pubKey);

  final encrypted = sealedBox.encrypt(bytesPayload);
  return base64.encode(encrypted);
}