Pike v8.1 release 6

Method Web.decode_jwt()


Method decode_jwt

mapping(string:string|int) decode_jwt(Crypto.Sign.State|Crypto.MAC.State|array(Crypto.Sign|Crypto.MAC.State) sign, string(7bit) jwt)

Description

Decode a JSON Web Token (JWT).

Parameter sign

The asymetric public or MAC key(s) to validate the jwt against.

Parameter jwt

A JWT as eg returned by encode_jwt().

Returns

Returns 0 (zero) on validation failure (this includes validation of expiry times).

Returns a mapping of the claims for the token on success. See RFC 7519 section 4.

Note

The time check of the "nbf" value has a hard coded 60 second grace time (as allowed by RFC 7519 section 4.1.5).

See also

encode_jwt(), RFC 7519 section 4