encryptMap static method

String? encryptMap(
  1. Map? data,
  2. String textKey
)

textKey minimum 4 hane olmali

Implementation

static String? encryptMap(Map? data, String textKey) {
  if (data == null) return null;
  final encryptionPassword = _getModifiedPasswordFrom(textKey.safeSubString(0, 4)!);
  final iv = IV.fromUtf8(_getModifiedIvPasswordFrom(textKey));

  final encrypter = Encrypter(
    AES(Key.fromUtf8(encryptionPassword), mode: AESMode.cbc),
  );

  return 'enc001${(encrypter.encrypt(jsonEncode(data), iv: iv).base64)}';
}