decrypt static method
The value of the encrypted cookie name, as the browser sent it,
decrypted with the APP_KEY (or one of AppConfig.previousKeys).
A changed cookie, one made with another key, or one made for
another cookie name gives null. req.cookie(name) uses it.
DoxCookie.decrypt('dox_session', rawValue);
Implementation
static String? decrypt(String name, String value) {
AppConfig config = Dox().config;
try {
return AESEncryptor.decode(
value,
config.appKey,
associatedData: name,
purpose: KeyDerivation.cookie,
previousSecrets: config.previousKeys,
);
} on DecryptException {
return null;
}
}