Functions -
jwt
| buildHeaderString |
Builds the header string from the |
| buildPayloadString |
Builds the payload string from the |
| decodeJwt |
Decodes the given JWT string. |
| issueJwt |
Issues a JWT based on the provided header and payload. |
| validateJwt |
Validates the given JWT string. |
Builds the header string from the jwt:JwtHeader record.
string|jwt:Error jwtHeader = buildHeaderString(header);
Parameters
- header JwtHeader
-
JWT header record to be built as a string
-
Return Type
(string | Error) The header string or else a
jwt:Errorif building the string fails
Builds the payload string from the jwt:JwtPayload record.
string|jwt:Error jwtPayload = jwt:buildPayloadString(payload);
Parameters
- payload JwtPayload
-
JWT payload record to be built as a string
-
Return Type
(string | Error) The payload string or else a
jwt:Errorif building the string fails
Decodes the given JWT string.
[jwt:JwtHeader, jwt:JwtPayload]|jwt:Error [header, payload] = jwt:decodeJwt(jwt);
Parameters
- jwt string
-
JWT that needs to be decoded
-
Return Type
([JwtHeader, JwtPayload] | Error) The JWT header and payload tuple or else a
jwt:Errorif token decoding fails
Issues a JWT based on the provided header and payload. JWT will be signed (JWS) if crypto:KeyStore information is
provided in the jwt:JwtKeyStoreConfig and the alg field of the jwt:JwtHeader is not jwt:NONE.
string|jwt:Error jwt = jwt:issueJwt(header, payload, keyStoreConfig);
Parameters
- header JwtHeader
-
JwtHeader object
- payload JwtPayload
-
JwtPayload object
- config JwtKeyStoreConfig?
-
JWT key store config record
-
Return Type
(string | Error) JWT as a
stringor else ajwt:Errorif token validation fails
Validates the given JWT string.
jwt:JwtPayload|jwt:Error result = jwt:validateJwt(jwt, validatorConfig);
Parameters
- jwt string
-
JWT that needs to be validated
- config JwtValidatorConfig
-
JWT validator config record
-
Return Type
(JwtPayload | Error) JWT payload or else a
jwt:Errorif token validation fails