decrypt static method

String decrypt(
  1. String encryptedValue
)

decrypt any data

Implementation

static String decrypt(String encryptedValue) {
  final key = _generateKey(host, clientId);
  final encryptedBytes = base64.decode(encryptedValue);
  final iv = Uint8List.fromList(encryptedBytes.sublist(0, 16));
  final ciphertext = Uint8List.fromList(encryptedBytes.sublist(16));
  Uint8List cipherText = _processBlocks(
    encrypt: false,
    params: castle.ParametersWithIV(castle.KeyParameter(key), iv),
    input: ciphertext,
  );
  String decrypted = utf8.decode(cipherText);
  // debugPrint("decrypted: $decrypted");
  return decrypted.replaceAll("\u0000", "");
}