getCookiePayloadAndSignature method
Gets the payload and signature of a given cookie
, WITHOUT
verifying its integrity.
Returns null
if no payload can be found.
Otherwise, returns a list with a length of 2, where
the item at index 0
is the payload, and the item at
index 1
is the signature.
Implementation
List<String>? getCookiePayloadAndSignature(String cookieValue) {
var dot = cookieValue.indexOf('.');
if (dot <= 0) {
return null;
} else if (dot >= cookieValue.length - 1) {
return null;
} else {
var payload = cookieValue.substring(0, dot);
var sig = cookieValue.substring(dot + 1);
return [payload, sig];
}
}