encryptAsymmetricString function

String encryptAsymmetricString(
  1. String strPayload,
  2. String hexPublicKey
)

Implementation

String encryptAsymmetricString(String strPayload, String hexPublicKey) {
  final pubKey = PublicKey(hex.decode(hexPublicKey));
  final sealedBox = SealedBox(pubKey);

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