decodeJWT method

  1. @override
JWTDecoded decodeJWT(
  1. String encoded
)
override

Implementation

@override
JWTDecoded decodeJWT(String encoded) {
  final List<String> params = encoded.split(JWT_DELIMITER);

  JWTHeader header = JWTHeader.fromJson(decodeJson(params[0]));
  JWTPayload payload = JWTPayload.fromJson(decodeJson(params[1]));
  Uint8List signature = decodeSig(params[2]);
  List<int> data = utf8.encode(params.sublist(0, 2).join(JWT_DELIMITER));

  return JWTDecoded(data, signature, payload, header: header);
}