jwa = require("jwt")._JWA
The default algorithm is HS256
Table with supported algorithms
_Lookup table to convert algorithms to it's equivalent name to be used in GetCryptoHash
Check the signature by hashing the message with multiple algorithms
param message type: string The payload that was encrypted
param signature type: string The received decoded signature
param key type: string The secret which was used to hash the payload
param algorithms type: table The allowed algorithms
return type: boolean, string If the hashed message matches the signature, returned string is the algorithm used
return type: nil, string When no match is found
jws = require("jwt")._JWS
Compiled regex to split a JWS token
Create a basic table which can be used in jwt.Encode
return type: table
Encode JSON that has header and payload keys
param jwtTable type: table Header and payload of the JWS in a table
param key type: string Secret of the server
param algorithm type: string If given it overrides the alg-value given in the JWS-header
return type: string JWT string
Decodes the given JWS string to a table
param data type: string JWS string
return table Table with data from the decoded JWS
Verify signature of a decoded JWS table
param jwtTable type: table Preferably received from jws.Decode function
param key type: string Secret of the server
param algorithms type: table A Table algorithm strings that are accepted to use
return table Table with JWS parts
Decode the JWS and verify the signature
param data type: string JWS string
param key type: string Secret of the server
param algorithms type: table A Table algorithm strings that are accepted to use
return table Table with data from the decoded JWS
jwt = require("jwt")
Encode JSON that has header and payload keys
param jwtTable type: table Header and payload of the JWT in a table
param key type: string Secret of the server
param algorithm type: string If given it overrides the alg-value given in the JWT-header
return string JWT string
return nil, string When error occurs
Decodes the given JWT string to a table
param data type: string JWT string
return table Table with data from the decoded JWT
return nil, string When error occurs
Verify signature of a decoded JWT table
param jwtTable type: table Preferably received from jwt.Decode function
param key type: string Secret of the server
param algorithms type: table A Table algorithm strings that are accepted to use
return table Table with JWT parts
return nil, string When error occurs
Decode the JWT and verify the signature
param data type: string JWT string
param key type: string Secret of the server
param algorithms type: table A Table algorithm strings that are accepted to use
return type: table Table with data from the decoded JWT
return type: nil, string When error occurs
Set a cookie with a token
param jwtTable type: table Header and payload of the JWT in a table
param key type: string Secret of the server
param algorithm type: string If given it overrides the alg-value given in the JWT-header
param cookieOptions type: table Optional cookie options
return type: boolean True if no error has occurred
return type: nil, string When error occurs
Verify a cookie containing the token
param key type: string Secret of the server
param data type: string Optional verifies given data instead of cookie
param algorithms type: table A Table algorithm strings that are accepted to use
param cookieName type: table Optional custom cookie name
return type: table Table with data from the decoded JWT
return type: nil, string When error occurs
Set an Authorization header with a JWT Bearer token
param jwtTable type: table Header and payload of the JWT in a table
param key type: string Secret of the server
param algorithm type: string If given it overrides the alg-value given in the JWT-header
return type: boolean True if no error has occurred
return type: nil, string When error occurs
Verify the Authorization header containing a JWT Bearer token
param key type: string Secret of the server
param data type: string Optional verifies given data instead of header
param algorithms type: table A Table algorithm strings that are accepted to use
return type: table Table with data from the decoded JWT
return type: nil, string When error occurs
common = require("jwt")._Common
Base64URL is a modification of the main Base64 standard
param str type: string
return type: string
Base64URL is a modification of the main Base64 standard
param str type: string
return type: string
Encode a segment to a base64URL encoded string
param segmentObject type: JsonValue Commonly a table or a string
return type: string Base64URL encoded string
Decode a base64URL encoded string to the original segment
param base64Segment type: string Base64URL encoded string
return type: JsonValue