grDecrypt64Fernet function

String grDecrypt64Fernet({
  1. required String inputBase64,
  2. required GRKey key,
  3. GRIV? iv,
  4. int repeat = 0,
})

Implementation

String grDecrypt64Fernet(
    {required String inputBase64,
    required GRKey key,
    GRIV? iv,
    int repeat = 0}) {
  if (repeat < 0) {
    return "";
  }
  final b64key = GRKey.fromUtf8(base64Url.encode(key.bytes));
  final fernet = Fernet(b64key);
  final decryptor = Encrypter(fernet);
  var decrypted = decryptor.decrypt64(inputBase64);
  if (iv != null) {
    decrypted = decryptor.decrypt64(inputBase64, iv: iv);
  }
  if (repeat == 0) {
    return decrypted;
  }
  return grDecrypt64Fernet(
      inputBase64: decrypted, key: key, iv: iv, repeat: repeat - 1);
}