JWT
JWT module for BoxLang providing complete JWS signing, JWE encryption, and a fluent token builder with RFC 7518 / RFC 7519 compliance.
The bx-jwt module is a production-ready BoxLang library for creating, signing, verifying, encrypting, and decrypting JSON Web Tokens (JWT/JWE). It implements:
JWS (JSON Web Signature) β signed tokens using HMAC, RSA, or EC keys
JWE (JSON Web Encryption) β encrypted tokens using RSA or symmetric keys
RFC 7518 β JSON Web Algorithms
RFC 7519 β JSON Web Token
π Key Features
π HMAC Signing β HS256, HS384, HS512 with RFC 7518 minimum key length enforcement
π RSA Signing β RS256, RS384, RS512
π EC Signing β ES256 (P-256), ES384 (P-384), ES512 (P-521)
π JWE Encryption β RSA-OAEP-256, direct symmetric (
dir) with A256GCMποΈ Named Key Registry β register keys by name in module config; reference by name in BIFs
ποΈ Fluent Builder β
jwtNew()returns a chainable builder for elegant token creationβ»οΈ Token Refresh β
jwtRefresh()re-issues tokens with fresh time claimsπ Decode Without Verify β
jwtDecode()to inspect headers/claims before choosing a keyβ Boolean Validation β
jwtValidate()returns true/false without throwingπ§ Key Generation β
jwtGenerateSecret()andjwtGenerateKeyPair()helpersβ±οΈ Clock Skew β configurable tolerance for
exp/nbfvalidationπ Default Claims β auto-inject
iss,aud,exp,iat,jtifrom module settingsπ«
alg:noneProtection β unconditionally rejects unsigned tokensπ Algorithm Allowlist β restrict permitted algorithms via module settings
π¦ Installation
π― Registered BIFs
This module registers the following Built-In Functions (BIFs):
jwtGenerateSecret()
Generates a cryptographically random Base64 HMAC secret (default: 256)
β‘ Quick Start
Sign & Verify (HMAC)
Sign & Verify (RSA)
Fluent Builder
Encrypt & Decrypt (JWE)
π Usage Guides
Signing (JWS) β HMAC, RSA, and EC signing patterns
Encryption (JWE) β RSA-OAEP and symmetric encryption
Key Management β the named key registry and runtime keys
Fluent Builder β
jwtNew()chainable API walkthroughKey Rotation β
kid-based rotation patternsSecurity Best Practices β allowlists, key sizes, clock skew
Configuration β full ModuleConfig settings reference
π Reference
Built-In Functions β one page per BIF
Fluent API (JwtBuilder) β chainable methods reference
Algorithms β supported JWS/JWE algorithm tables
β Requirements
BoxLang Runtime 1.0.0+
π License
Licensed under the BoxLang Plus Subscription License.
Last updated
Was this helpful?
