Dev.to Security 🔐 Cybersecurity 👁 0 📖 4 min read

My extension's license keys were forgeable by anyone who read the bundle — so I switched to Ed25519-signed keys

I build browser extensions as a solo dev. One of them, Highlighter for Edge, has an optional Pro tier: a one-time ¥19.90 purchase on Afdian, and the license key is sent to the buyer in an order private message. The key i

I build browser extensions as a solo dev. One of them, Highlighter for Edge, has an optional Pro tier: a one-time ¥19.90 purchase on Afdian, and the license key is sent to the buyer in an order private message. The key is verified on the user's own device, offline. No account, no server, no in-app purchase.

For context: my six extensions have made zero sales so far. This licensing work is infrastructure before revenue, not a response to abuse. But the design flaw was real, and a reader spotted it before any buyer did.

The flaw: a shared secret in a public package

My first key scheme used a shared secret embedded in the extension bundle. Anyone who opened the store package could read it — and mint keys. The scheme still checked keys offline and it still worked, but "anyone who can read the bundle can forge a key" is not a licensing system, it's a honor system with extra steps.

A reader, keyharbor, pointed this out in a comment on my launch retrospective, along with two other suggestions. The fix is what this post is about.

The fix: signed keys (shipped in v0.4.4)

Each new key is a small payload plus an Ed25519 signature:

HLX1.<base64url(canonical JSON)>.<base64url(64-byte signature)>

The payload is {"v":1,"product":"highlighter","tier":"pro","order":"<Afdian order id>"}. The signature covers the exact UTF-8 bytes of the canonical JSON string. The verifier decodes the middle segment and verifies those bytes — it never re-serializes, so the issuer and the verifier cannot drift apart.

The private key never leaves the machine that issues keys. It lives in one gitignored file with mode 0600, and it is never committed, never shipped, never printed. The extension carries only the 32-byte public key. Verification runs on WebCrypto Ed25519 (Chrome/Edge 137+), confirmed live in the real side panel context. Still no network, no account, no host permission.

What this fixes: forging. A reader of the public store package can no longer mint new keys. What it does not fix: sharing. An already-issued key can still be passed around. That is what the second half of the design is for.

Revocation: a blocklist of order ids (shipped in v0.4.5)

Because the payload carries the Afdian order id, a leaked key can be traced to its order — and revoked by that order id. The extension ships a list of blocked order ids with each release. If an order is on the list, activation is rejected (the side panel shows the reason, "revoked"), and a stored key from that order stops licensing Pro and leaves a tombstone so the panel can explain why.

The trade-off is documented, not hidden: revocation propagates only through extension updates. There is no faster channel while verification stays fully offline, so a shared key keeps working until its holder updates. The list is currently empty — no revocations yet — and an id goes on it only from a confirmed leak, refund, or chargeback, never on suspicion alone.

What did not change

Keys issued under the old scheme still work; no new ones are issued. Keys bought through Gumroad earlier still work through Gumroad's own online re-check (about every 30 days). Losing the private key would mean no new signed keys can be issued — keys already issued would keep verifying against the embedded public key.

Verification, not vibes

  • Unit/self tests: signed-key suite 36/0, license suite 35/0, Pro suite 26/0.
  • Real-browser checks: 12/12 for v0.4.4 (a production-signed key activates through the side panel UI, survives reload, a tampered key is rejected, old keys still activate, no Gumroad permission requested) and 14/14 for v0.4.5 (blocked-order activation rejected, stored key deactivates with a tombstone).
  • Both versions are built and waiting: the pending Edge update (v0.4.2) has to be decided first, then v0.4.5 goes in as the next update.

Total cost of the change: $0 and no server. The whole thing was about a day's work, most of it tests and real-browser verification.

The part that matters most

None of this started with me. It started with a reader leaving a specific, actionable comment — "sign the keys, keep the private key off the machine, put the order id in the payload so you can trace leaks" — and with me actually doing it within a day and writing back what shipped. That loop is the only distribution channel that has produced anything real for these extensions so far: five readers, five concrete changes, all shipped.

If you run a small paid extension with offline keys, check what your key is actually made of. If the answer is "a secret baked into the bundle," you have the same flaw I had.

Links: my extensions hub — https://alapha888.github.io/muse-plugins/ · the retrospective that started the thread — https://dev.to/alapha888/two-weeks-after-launching-six-edge-extensions-3-installs-0-sales-and-what-the-dashboards-4ml4

📰 Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.