decryptToken method

  1. @override
FutureOr<String> decryptToken(
  1. AccessToken token
)
override

Implementation

@override
FutureOr<String> decryptToken(AccessToken token) async {
  var header = <String, dynamic>{"alg": "HS256", "typ": "JWT"};
  var payload = token.toMap();

  var base64Payload = base64Url.encode(utf8.encode(json.encode(payload)));

  var base64Header = base64Url.encode(utf8.encode(json.encode(header)));

  ///
  var cT = "$base64Header.$base64Payload";

  ///
  var hash = await crypto.calculateSha256Mac(utf8.encode(cT));

  return "$cT.${base64Url.encode(hash)}";
}