decryptAsymmetricString function

String decryptAsymmetricString(
  1. String encryptedBase64,
  2. String hexPrivateKey
)

Implementation

String decryptAsymmetricString(String encryptedBase64, String hexPrivateKey) {
  final encryptedBytes = base64.decode(encryptedBase64);

  final privKeyBytes = hex.decode(hexPrivateKey);
  final privKey = PrivateKey(privKeyBytes);

  final unsealedBox = SealedBox(privKey);

  final decrypted = unsealedBox.decrypt(encryptedBytes);
  return utf8.decode(decrypted);
}