JWT Cryptographic Studio
Generate cryptographically secure signing keys & build, sign, and verify JSON Web Tokens — entirely in-browser using the Web Crypto API. Zero telemetry, zero server requests.
Conforms to NIST & RFC 7519 minimum key length standards.
Code Integration Matrix
1import { SignJWT, jwtVerify } from "jose";
2
3const secret = new TextEncoder().encode(
4 process.env.JWT_SECRET!
5);
6
7// Sign — Edge Runtime compatible
8export async function signToken(payload: object) {
9 return new SignJWT(payload as Record<string, unknown>)
10 .setProtectedHeader({ alg: "HS256" })
11 .setIssuedAt()
12 .setExpirationTime("2h")
13 .sign(secret);
14}
15
16// Verify
17export async function verifyToken(token: string) {
18 const { payload } = await jwtVerify(token, secret, {
19 algorithms: ["HS256"],
20 });
21 return payload;
22}100% Client-Side CSPRNG
Secrets are generated in local volatile RAM via window.crypto.getRandomValues. Never logged, cached, or sent across any network.
Hardware Entropy
Direct OS-backed hardware entropy prevents brute-force hash-cracking dictionary attacks against HMAC verification routines.
RFC 7519 Compliant
Standard Base64URL output guarantees seamless insertion into HTTP Authorization headers, cookies, and microservice configs.
Symmetric vs. Asymmetric Verification
| Algorithm | Key Architecture | Recommended Entropy | Use Case |
|---|---|---|---|
| HS256 / HS512 | Shared Symmetric Secret | 256 – 512 bits | Monolithic backends, internal APIs, NextAuth session tokens |
| RS256 | Asymmetric RSA Keypair | 2048 – 4096 bits | OAuth 2.0 / OIDC Identity Providers, multi-tenant auth |
| ES256 | Elliptic Curve (ECDSA) | P-256 Curve (256 bits) | High-throughput microservices, Apple Sign-In, Passkeys |
Security Best Practices
- Minimum Entropy: Never use human-readable passphrases for HMAC signing keys. Always use at least 256 bits (32 bytes) of random entropy from a CSPRNG.
- Protect from Source Code: Never commit JWT secrets to Git repositories. Inject them dynamically at deploy time using encrypted secret managers (AWS Secrets Manager, Infisical, Doppler).
- Defend Against Algorithm Confusion: Explicitly specify accepted algorithms in your verification parser (e.g. algorithms: ['HS256']) to prevent tokens signed with the "none" algorithm from being accepted.
- Rotate Secrets Periodically: Implement a key rotation strategy with grace periods. Support multiple active keys so that tokens signed with the previous key remain valid until their natural expiry.
Frequently Asked Questions
Are these generated secrets transmitted over the internet?
No. All random entropy generation takes place 100% locally inside your browser using the native Web Crypto API (window.crypto.getRandomValues). Zero server requests are made.
Why is Base64URL encoding preferred over standard Base64?
Base64URL replaces + and / with - and _ and strips trailing padding =. This prevents encoding collisions when passing tokens in HTTP authorization headers, query strings, and cookies.
What is the difference between HS256 and HS512?
HS256 uses the SHA-256 hash algorithm with a minimum of 256 bits, while HS512 uses SHA-512 with a 512-bit key. Both offer collision resistance exceeding practical brute-force attacks.
Can I use this tool for production secrets?
Yes. The entropy is sourced from your OS-level hardware CSPRNG via the Web Crypto API. The generated secrets are cryptographically equivalent to those from OpenSSL or /dev/urandom.
Digitat Security Studio // Zero-Telemetry Architecture // 100% Client-Side