unsignValue function

String? unsignValue(
  1. String input,
  2. String secret
)

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;
}