Method Web.encode_jwt()
- Method
encode_jwt
string(7bit)
encode_jwt(Crypto.Sign.State
|Crypto.MAC.State
sign
,mapping
(string
:string
|int
)claims
)- Description
Encode a JSON Web Token (JWT). Automatically adds the optional "issued at" timestamp and JWD ID (using UUID v4).
- Parameter
sign
The asymetric private or MAC key to use for signing the result.
- Parameter
claims
The set of claims for the token. See RFC 7519 section 4.
- Returns
Returns
0
(zero) on encoding failure (usually thatsign
doesn't support JWS.Returns a corresponding JWT on success.
- Note
The claim
"iat"
(RFC 7519 section 4.1.6 is added unconditionally, and the claim"jti"
(RFC 7519 section 4.1.7) is added if not already present.- See also