Verify and Use JWT
The SDK provides a method to analyze the type of JWT token (JWT/JWS). If JWS will do the corresponding post-verification parsing, both the JWT and JWS token strings will finally convert to JWT.
JWT provides a variety of methods to obtain JWT elements for user reference.
Example
Usage
The method is provided by DID Document and gets JWSParser object. document provides key to verify the token.
Use this method to destroy the JWSParser object after using it.
This method parses JWT Token, or a token without a signature. If it's successful, the JWT object will be returned; otherwise, an error will be reported.
This method generates a parser to parse the token according to the owner of the Key that comes with the token and obtains JWT object.
This method parses the token according to the parser provided by the user to obtain JWT object.
Use this method to destroy JWT object after using it.
This method can get the contents of each element in the header in JWT. SDK also provide methods to directly obtain basic attribute, such as JWT_GetAlgorithm,JWT_GetKeyId. See API documentation for details.
This method can get the content of each element in claims in JWT, and the content is returned as a string. Some contents are not strings, and SDK provides APIs of different return types, JWT_ GetClaimAsJson, JWT_ GetClaimAsInteger, JWT_ GetClaimAsBoolean.
For some basic attributes in claim, SDK also provides corresponding methods, such as JWT_GetIssuer and JWT_GetSubject. See API documentation for details.
Last updated