Protecting Electron Apps from Piracy with Keymint
After 8 months of building a screen recording tool for macOS, I had 200 beta users and was ready to launch. The problem: I had no way to charge for it. No license keys, no activation flow, no way to prevent someone from copying the .dmg and sharing it.
I looked at building my own licensing server. A week of research later, I'd need: a database for keys, an activation API, hardware fingerprinting, a management dashboard, a customer portal, and Stripe integration for subscriptions. I'm a solo developer. That's a full-time project on top of my actual product.
What I Built Instead
I used Keymint for the licensing layer and kept my focus on the recording tool. The setup took about 4 hours total: created a product in the dashboard, installed the SDK with npm install keymint, added activation logic to my Electron main process, and created a Stripe webhook handler that issues keys on payment.
The Activation Flow
My Electron app checks for a stored license key on launch. If found, it calls client.activateKey() against Keymint's API with the machine's hardware fingerprint. If the key is valid and the activation count hasn't been exceeded, it returns code: 0 and the app opens. If the user is offline, I cache the last-known-valid state and re-check periodically.
const client = new KeyMint(process.env.KEYMINT_CLIENT_API_KEY!);
const result = await client.activateKey({
productId: 'prod_myrecorder',
licenseKey,
hostId: machineIdSync(),
});
return result.code === 0;What I Didn't Have to Build
- Hardware fingerprinting —
node-machine-idfor thehostId, Keymint handles binding server-side - Activation counting — set
maxActivations: 3and the API enforces it - License revocation — hit
admin.blockKey()and the license stops working on the next check - Customer portal — Keymint provides OTP-based login where customers can reset activations
- Stripe webhook plumbing — I just added my own handler to create licenses on
invoice.paid
The Numbers
| Metric | Before Keymint | After Keymint |
|---|---|---|
| Time to launch licensing | 3-4 weeks (estimated) | 4 hours |
| Revenue from license keys | $0 | $2,400/mo after 3 months |
What I'd Do Differently
- Use a license key profile from the start instead of generating 50 keys manually
- Use outbound webhooks earlier — I now pipe
device.activatedevents to Discord to spot unusual activation patterns - Add a trial mode — time-limited trial keys with
expiryDateset to 14 days before requiring purchase, per our trial design guide
Advice for Other Indie Devs
Don't build a licensing server. It's a solved problem. Platforms like Keymint handle key generation, activation tracking, machine binding, floating seats, offline verification, and customer portals. You wire up an SDK, set a few parameters, and ship. The 4 hours I spent integrating Keymint saved me 3-4 weeks I put into the stuff my customers actually pay for.