getSignedCookie function
Implementation
Future<String?> getSignedCookie(
Context c,
String secret,
String key,
) async {
final raw = getCookies(c)[key];
if (raw == null) return null;
// Signature is the segment after the last '.', so values may contain dots.
final dot = raw.lastIndexOf('.');
if (dot <= 0) return null;
final value = raw.substring(0, dot);
final sig = raw.substring(dot + 1);
if (sig != _sign(value, secret)) return null;
return value;
}