Menu

How to check a license key in your Mac app offline
📰

How to check a license key in your Mac app offline

DEV Community: swift·Fortifie·about 5 hours ago
#SJWqpvn8
#devtoswift#devto#dev#license#signature
Reading 0:00
15s threshold

Short answer: Sign each license on your server with Ed25519, then verify it in the app with CryptoKit and the matching public key. Honest customers stay unlocked offline, because the check does not need a network call. Verify the signature and the expiry at launch and again where the paid feature runs, not in a single isLicensed() flag.

Why a signed license beats a shared serial

A shared serial list, or a secret compiled into the app, can be copied out of the binary. Anyone who has that secret can invent keys your app will accept, or share one serial widely. AI tools make that read faster than it used to be.

A signed license works the other way around. Your server holds a private key and signs a small payload: the customer's email, the product name, and an expiry. The app ships the public key and uses it to verify the signature. The public key cannot issue a new license.

The license string

Sign the raw payload bytes.…

Continue reading — create a free account

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