Crypt class

Encrypt and decrypt with the APP_KEY of the app (AES-256-GCM). Old keys in AppConfig.previousKeys can still decrypt.

String secret = Crypt.encryptString('card-1234');
String card = Crypt.decryptString(secret);

It gives the same text as AESEncryptor.encode(value, appKey).

Constructors

Crypt()

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

decrypt(String encrypted) → dynamic
the value of encrypted made with encrypt. Throws DecryptException when it is not valid, or the text in it is not JSON (it was made with encryptString).
decryptString(String encrypted) → String
the text of encrypted. Throws DecryptException when it was changed or made with another key.
encrypt(Object? value) → String
value as JSON, encrypted. Use it for maps, lists and numbers.
encryptString(String value) → String
value encrypted, as base64 text