decryptString method

Future<String> decryptString(
  1. String encryptedText
)

Decrypts a string.

Convenience method for string decryption. Expects Base64-encoded input and returns UTF-8 decoded text.

Implementation

Future<String> decryptString(String encryptedText) async {
  // Decode from Base64 to get the encrypted bytes
  final encryptedBytes = base64Decode(encryptedText);
  final decrypted = await decrypt(encryptedBytes);
  // Decode UTF-8 to get original text
  return utf8.decode(decrypted);
}