Menu

Why returning {"valid": true} for desktop license checks is broken (and how signed leases fix it)
📰

Why returning {"valid": true} for desktop license checks is broken (and how signed leases fix it)

DEV Community: javascript·Velopre·3 days ago
#BvRf6Dc4
#devtojavascript#devto#dev#server#signature
Reading 0:00
15s threshold

If you're shipping a paid desktop app (Electron, Tauri, .NET, Python, etc), please avoid doing basic HTTP checks like this:

const res = await fetch ( "https://api.myapp.com/verify?key=" + key ) ; const data = await res . json ( ) ; if ( data . valid ) unlockApp ( ) ;

Enter fullscreen mode

Exit fullscreen mode

I see this all the time, and it takes about 30 seconds to bypass. Anyone can just:

Map your licensing domain to 127.0.0.1 in their local hosts file

Run a 5-line local server that returns {"valid": true} to any request

Unlock the app permanently

On top of that, if a paying user gets on a flight or has spotty WiFi, the request fails and your app locks them out.

The real fix isn't heavy DRM or code obfuscation. It's just asymmetric cryptography.

Instead of sending back plain JSON, your server signs the activation payload (machine identifier, license key, expiration date/lease, and a random nonce) using an Ed25519 private key.

Your desktop app only ships with the Public Key.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.