<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[JWT & Auth Notes]]></title><description><![CDATA[JWT & Auth Notes]]></description><link>https://jwt-auth-notes.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Fri, 04 Dec 2026 22:48:36 GMT</lastBuildDate><atom:link href="https://jwt-auth-notes.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[How to Verify an Online JWT Secret Generator Is Actually Client-Side]]></title><description><![CDATA[A three-check DevTools test that tells you whether a JWT secret generator really creates the key in your browser, or quietly sends it to a server.]]></description><link>https://jwt-auth-notes.hashnode.dev/how-to-verify-an-online-jwt-secret-generator-is-actually-client-side</link><guid isPermaLink="true">https://jwt-auth-notes.hashnode.dev/how-to-verify-an-online-jwt-secret-generator-is-actually-client-side</guid><category><![CDATA[webdev]]></category><category><![CDATA[privacy]]></category><category><![CDATA[devtools]]></category><category><![CDATA[JWT]]></category><category><![CDATA[Security]]></category><dc:creator><![CDATA[Gary Yan]]></dc:creator><pubDate>Sun, 29 Nov 2026 19:54:34 GMT</pubDate><content:encoded><![CDATA[<p>"Online" describes how a page reaches you, not where the key is created. That distinction is the entire security question, and the padlock in the address bar does not answer it.</p>
<p>A JWT signing secret is not a password you can reset. Anyone who has it can mint a token for any user, with any claims, and your services will accept it. So when a page offers to make one, only one thing matters: were the bytes produced on your device, or on a server that now has a copy? A page can look professional, load over a valid certificate, and still generate the key in a request handler and log it.</p>
<p>Three checks settle it, and the main one takes a minute in DevTools.</p>
<h2>The three properties that decide the answer</h2>
<table>
<thead>
<tr>
<th>Property</th>
<th>What to look for</th>
<th>Why it matters</th>
</tr>
</thead>
<tbody><tr>
<td>Generated in the browser</td>
<td>The Generate button runs JavaScript on your device</td>
<td>If the key arrives in a response, the server has it</td>
</tr>
<tr>
<td>Cryptographically secure source</td>
<td><code>crypto.getRandomValues</code>, never <code>Math.random</code>, a timestamp or a counter</td>
<td>Predictable output is not a secret</td>
</tr>
<tr>
<td>Nothing sends the key anywhere</td>
<td>No request body, URL or analytics event contains the value</td>
<td>"Client-side" plus an upload is still a leak</td>
</tr>
</tbody></table>
<p>A page can pass one and fail another: <code>Math.random</code> gives weak bytes, and a Web Crypto generator that posts its result to "telemetry" leaks the key. Check all three.</p>
<h2>The one-minute DevTools test</h2>
<p><strong>Step 1 — open the Network panel.</strong> Press F12 (Cmd+Option+I on a Mac), switch to Network, tick "Preserve log", and clear the list.</p>
<p><strong>Step 2 — generate a key and look for it.</strong> Show the key and copy its first 12 characters into a scratch note. Click Generate (or Regenerate) two or three times. In a correct generator the list stays empty, or shows nothing but a page view and static files.</p>
<p>If a request does appear, open it, go to the Payload or Request tab, and search for those 12 characters. A match anywhere — URL, headers, body — means the key left your device. No match, no upload: that is the whole test.</p>
<p><strong>Step 3 — prove the randomness and the offline behaviour.</strong> Press Cmd+Option+F (Ctrl+Shift+F on Windows) to search all loaded files for <code>getRandomValues</code>. You should land in the generator's own script; if the only random call is <code>Math.random</code>, close the tab. Then switch throttling to Offline and press Regenerate: a fresh key that still appears cannot have come from a server.</p>
<p>This is the code you are looking for:</p>
<pre><code class="language-js">// client-side key generation, 32 bytes for HS256
const bytes = crypto.getRandomValues(new Uint8Array(32));
// 32 bytes -&gt; 64 hex chars, 43 unpadded Base64URL chars
</code></pre>
<p>Two results are easy to misread. Requests on page load — document, CSS, JS, a page-view ping — belong to loading the page, so clear the list after it settles. A page-view analytics request is not automatically a problem either: analytics that record the page, referrer and coarse device details never see the key. The only question is whether the key itself appears in a payload.</p>
<p>If the list stays empty and the key still changes in Offline mode, the bytes came from your device. If a payload contains your 12 characters, the key was uploaded and should not be used. If <code>Math.random</code> is the only random source in the source, the generator is weak even though nothing left the page.</p>
<h2>HTTPS does not answer this question</h2>
<p>HTTPS encrypts the connection to the server, and it is still necessary: without it, someone on the same Wi-Fi could modify the JavaScript before it runs. But it says nothing about what the server does after a request arrives. If the key is generated server-side, TLS does not stop that server from keeping a copy. The same trap applies to randomness: a page can load over a valid certificate and still seed its generator with <code>Date.now()</code>. Judge the code and the traffic, not the padlock.</p>
<h2>The leaks the website cannot prevent</h2>
<p>Even a perfect client-side generator hands the value to your machine. Extensions that can read page data can see the key and the clicks around it, so use a profile with no unfamiliar extensions. Clipboard managers and screen recorders can capture the value after you copy it, and shared machines keep clipboard and browser history. Generate on a machine you control, never paste a production key into chat, and clear the clipboard afterwards.</p>
<h2>When a browser generator is fine, and when it is not</h2>
<p>For local development, test fixtures, staging and short-lived demo keys, a browser generator that passes these checks is adequate: the risk is where the value has been, and a key that never left your laptop has not been anywhere.</p>
<p>For production, generate where the secret will live. On a server or build machine, OpenSSL is already there:</p>
<pre><code class="language-bash"># 32 random bytes for HS256, hex (64 characters)
openssl rand -hex 32

# 64 random bytes for HS512, Base64URL without padding
openssl rand -base64 64 | tr '+/' '-_' | tr -d '='
</code></pre>
<p>Then put the value in a secret manager or the platform's encrypted environment store, not in a file next to the code. A cloud KMS goes further and can keep the key material inside an HSM.</p>
<h2>The short version</h2>
<p>Run any generator through the test once: generate, search the requests for the key, confirm <code>getRandomValues</code> in the source, regenerate offline. If all four behave, the key was created on your device; if any fails, close the tab.</p>
<p>The longer walkthrough, including what a server-side generator looks like in the Network panel, is at <a href="https://jwtsecretkeygenerator.org/is-online-jwt-secret-generator-safe/">Is an online JWT secret generator safe?</a>. The generator used for the examples is at <a href="https://jwtsecretkeygenerator.org/">jwtsecretkeygenerator.org</a>: it runs <code>crypto.getRandomValues</code> in the page and shows Hex, Base64 and Base64URL lengths next to the RFC 7518 minimums.</p>
]]></content:encoded></item></channel></rss>