Functions

decode
I

Decodes the provided JWT into the header and payload.

issue
I

Issues a JWT based on the provided configurations.

validate
I

Validates the provided JWT, against the provided configurations.

decode

function decode(string jwt) returns [Header, Payload] | Error
Isolated Function

Decodes the provided JWT into the header and payload.

1[jwt:Header, jwt:Payload] [header, payload] = check jwt:decode(jwt);

Parameters

  • jwt string
  • JWT that needs to be decoded

Return Type

([Header, Payload] | Error)

The jwt:Header and jwt:Payload as a tuple or else a jwt:Error if an error occurred

issue

function issue(IssuerConfig issuerConfig) returns string | Error
Isolated Function

Issues a JWT based on the provided configurations. JWT will be signed (JWS) if crypto:KeyStore information is provided in the jwt:KeyStoreConfig and the jwt:SigningAlgorithm is not jwt:NONE.

1string jwt = check jwt:issue(issuerConfig);

Parameters

Return Type

(string | Error)

JWT as a string or else a jwt:Error if an error occurred

validate

function validate(string jwt, ValidatorConfig validatorConfig) returns Payload | Error
Isolated Function

Validates the provided JWT, against the provided configurations.

1jwt:Payload result = check jwt:validate(jwt, validatorConfig);

Parameters

  • jwt string
  • JWT that needs to be validated

Return Type

(Payload | Error)

jwt:Payload or else a jwt:Error if an error occurred