Mbox Viewer Pro opens and searches MBOX mail archives. There’s a Mac version, a Windows version and, as of a few days ago, a Linux version. Anyone who buys a license uses it on all three: the lifetime license covers three devices and the annual one two, mixed however the customer likes. A Mac at home, a Windows laptop at work and a Linux server all count the same.
For that to work, the three apps have to reach the same conclusion from the same license. Here’s how we set it up.
One server, three languages
The licensing server is a Cloudflare Worker, the same one for all our apps. On activation it returns a token signed with Ed25519, which the app checks offline with the public key it ships with. The token says which app it is, which plan, which device it was activated on, when it expires and how many devices the license allows.
Each app is built with what’s natural on its system: SwiftUI on the Mac, WinUI on Windows and Rust with GTK on Linux. So there isn’t one SDK but three:
- Swift for macOS: keeps the token in the Keychain and uses the Mac’s identifier (
IOPlatformUUID). - C# for Windows (.NET 8): keeps the token encrypted with DPAPI and uses the registry’s
MachineGuid. It has no dependencies; it verifies Ed25519 itself, following RFC 8032. - Rust for Linux: keeps the token in
~/.local/share/<App>/, readable only by the user, and uses/etc/machine-id. It speaks HTTPS through rustls, so it doesn’t depend on each distribution’s OpenSSL.
In all three, the device identifier never leaves as is: what’s sent is a hash combined with the app’s identifier. Neither the server nor anyone reading it can tell which machine it is.
The same test vectors for everyone
Three implementations of the same thing are three ways to get it wrong. An SDK that accepts a token another one rejects means a customer who sees “Pro” on the Mac and “invalid license” on Windows.
To avoid that, nobody writes the test cases by hand. A server command generates a file of real tokens signed by the server’s own code: good ones, expired ones, for another app, for another device, with a tampered signature, with odd fields. Next to each token is what the SDK has to say about it. All three SDKs run that same file in their tests, and another command warns when the file no longer matches the server.
When the server changes something in the token, the file is regenerated and all three SDKs fail until they read it the same way. That’s how every new feature has gone in: the license’s devices, the check cadence and the major-version limit.
What Linux taught us
The Rust SDK came last and uncovered the most. When you build something for the third time, you see what you took for granted the first two times.
- “2 of 3 devices”. The Linux app wanted to tell customers how many devices they had left before activating another one. The token didn’t carry that. Now it brings the license’s devices and how many are in use, and all three apps show it.
- Testing and production don’t mix. During development, a test build saved a token from the test environment and the released version found it later. Now everything the SDK stores carries its environment, and anything from another environment is ignored.
- The clock can lie. An expired subscription “comes back to life” if someone sets the computer’s clock back. The SDKs remember the latest time they’ve seen and, if someone deletes that, ask for an online check before staying on Pro.
- Offline, you still have to ask nicely. Mbox asks for a free sign-up every so often, and some Linux machines go days without a connection. The SDK remembers when it last asked and doesn’t insist too early.
- Signatures that can be tweaked. In Rust we added tests with modified signatures that some Ed25519 implementations accept. The SDK rejects them.
The first four also made it into Swift and C#, with new versions and the same vectors.
For the customer, a single license
From the outside, none of this shows. The customer buys on the website, gets a key by email and types it into whichever app is in front of them. If one day they swap the work Windows laptop for a Mac, they free the old device from the portal or from the app itself and activate the new one with the same key.
Inside, the server doesn’t know or care whether an activation comes from Mac, Windows or Linux. It counts devices, not systems.
For other makers
If you sell software for more than one system, this is the part that’s hardest and least visible: making the same license behave the same everywhere, including with a clock set back, a machine with no network or a test build that slips through.
The Swift, C# and Rust SDKs already run in production in our apps, and the PHP one for WordPress is in testing. With OwnLicense we want to offer them to other makers, along with the HTTP API, which works from any other language. If you’re interested, see how it works or join the waitlist.