cookie method

  1. @override
String? cookie(
  1. String key, {
  2. bool decrypt = true,
})
override

get cookie value from header. An encrypted cookie that was changed, or made with another key, gives null.

req.cookie('authKey');

Implementation

@override
String? cookie(String key, {bool decrypt = true}) {
  if (_cookies[key] == null) return null;
  if (!decrypt) return _cookies[key];
  try {
    return AESEncryptor.decode(_cookies[key], Dox().config.appKey);
  } on DecryptException {
    return null;
  }
}