unsignValue function
Unsign and decode the given input
with secret
,
returning null
if the signature is invalid.
Implementation
String? unsignValue(String input, String secret) {
var tentativeValue = input.substring(0, input.lastIndexOf('.'));
var expectedInput = signValue(tentativeValue, secret);
final valid = safeCompare(expectedInput, input);
return valid ? tentativeValue : null;
}