The Risk of Pasting JWT Secrets Online
JWT (RFC 7519) authentication relies on HMAC secret keys or private keys. Entering production secrets into third-party web debuggers exposes your backend to credential theft and unauthorized token forging. Lucentool computes HMAC signatures entirely offline.
HS256 HMAC-SHA256 Architecture
- Data Concatenation:
Base64Url(Header) + "." + Base64Url(Payload) - HMAC Signature: Calculated using the SHA-256 hash algorithm and your secret key over the concatenated payload.
- Base64URL Encoding: Strips trailing padding
=, replaces+with-, and/with_, ensuring safe transmission across HTTP headers and URL query strings.
What happens in the page
Signing goes through the browser's Web Crypto API rather than a bundled library. base64UrlEncode() produces standard Base64 and then rewrites it into the URL-safe alphabet — plus becomes minus, slash becomes underscore, padding is stripped — because a JWT has to survive being placed in a header or a query string. signToken() concatenates the encoded header and payload, imports your secret as an HMAC key with crypto.subtle.importKey and signs the result, and verifyToken() repeats the computation over the token you paste and compares the two signatures. base64UrlEncodeBuffer() exists because the signature is bytes, not text.
Where it breaks down
Only the HMAC family is implemented — HS256, HS384 and HS512. Asymmetric signing needs a private key import and a different algorithm parameter, which this page does not do, so an RS256 or ES256 token cannot be produced here. The secret lives in the form field and in memory, never in storage, so a reload loses it. Web Crypto is only exposed in a secure context, which means opening the file directly from disk fails with a clear message rather than silently misbehaving.
Privacy: no data leaves this tab
The secret is typed into a form field and used for one HMAC operation in memory. Nothing is written to storage, no request is made, and clearing the field removes the only copy the page ever had.
Frequently asked questions
Can it produce an RS256 token?
No. Asymmetric algorithms need a private key and a different Web Crypto call; this page deliberately stays with HMAC so the secret never has to be pasted as a key file.
Why does it refuse to run locally?
Web Crypto requires HTTPS or localhost. Opened as a file:// URL, crypto.subtle is undefined, and the page tells you instead of failing quietly.
Should I paste a production secret?
No. Use a throwaway value for testing. Nothing is stored, but anything you paste also lands in your clipboard history and screenshots.