Signing (JWS)
Sign and verify JWTs with HMAC, RSA, and EC keys.
HMAC
// Generate an RFC 7518–compliant 256-bit secret
secret = jwtGenerateSecret( 256 );
token = jwtCreate( { sub: "user-123", iss: "my-api" }, secret, "HS256" );
payload = jwtVerify( token, secret, "HS256" );RSA
keys = jwtGenerateKeyPair( "RS256" ); // 2048-bit RSA pair
token = jwtCreate( { sub: "user-123" }, keys.privateKey, "RS256" );
payload = jwtVerify( token, keys.publicKey, "RS256" );EC (Elliptic Curve)
Verifying with Claim Assertions
Verify vs Validate vs Decode
BIF
Returns
Throws on failure
Use when…
Refreshing Tokens
Related
Last updated
Was this helpful?
