decode method

Map<String, dynamic> decode(
  1. String name,
  2. String cookieValue
)

Decode a secured string back into session values.

Implementation

Map<String, dynamic> decode(String name, String cookieValue) {
  try {
    final decodedBytes = base64Url.decode(cookieValue);
    final decodedStr = utf8.decode(decodedBytes);

    switch (_mode) {
      case SecurityMode.hmacOnly:
        return _decodeHmacOnly(decodedStr);
      case SecurityMode.aesOnly:
        return _decodeAesOnly(decodedStr);
      case SecurityMode.both:
        return _decodeWithBoth(decodedStr);
    }
  } catch (e) {
    rethrow;
  }
}