Offline Verification
Verify licenses locally in air-gapped or high-security offline environments using asymmetric cryptography.
Keymint signs offline licenses with Ed25519. Your app verifies the .lic file locally against your public key, with no network call. One signing key covers every product in your workspace, so always check the product ID as well as the machine code.
Verify with an SDK
Each SDK verifies the file and checks the signature, product, machine and expiry. Copy your public key PEM from Developer → Public keys; it is safe to ship in your app. Bundle every trusted key (Copy all trusted keys) so a key rotation never breaks your app.
import { readFileSync } from 'fs';
import { KeyMint, verifyOfflineLicense } from 'keymint';
const license = verifyOfflineLicense(readFileSync('license.lic', 'utf8'), {
publicKeys: [PUBLIC_KEY_PEM],
productId: 'prod_123',
machineCode: KeyMint.getOrCreateInstallationId(),
});An invalid file raises an offline license error whose code says why: expired, wrong_product, wrong_machine, bad_signature, unknown_key, unsupported_algorithm, wrong_type or malformed. Requires Node 1.7.0, Python 2.7.0, Go v1.8.0 or C# 1.7.0.
Issue the Offline License
Offline signing is available on every plan, including Free. It needs a signing key: create one under Developer → Public keys first.
Generate a signed license file from the Keymint Dashboard:
- Go to Licenses and click the license key to open its page.
- Under Devices, choose the Create offline license tab.
- Enter the target device's machine code (the
hostIdthe app reports, for example the SDK's installation ID) and, optionally, a TTL (time to live). The TTL is required when the license itself never expires. - Download the generated
.licfile.
Or sign from your own backend with POST /key/sign (SDK: signKey / sign_key / SignKey). It needs an admin API key or a key with the license:sign grant, so never call it from the shipped app. Pass the machine code as hostId and an optional ttl in seconds (60 seconds to 10 years). See Sign License.
Every offline license expires. The expiry is the requested TTL, or the license's own expiry when no TTL is given; it never goes past the license's expiry, the product's maximum offline lifetime (if set), or 10 years. Signing uses one of the license's device activations, and that device keeps its slot until the file expires. Blocking the key online doesn't revoke a file already issued, so keep TTLs short when that matters. While your Keymint workspace is in its billing continuity period or restricted, signing returns 402.
The downloaded file is JSON. Its signedKey field is the Ed25519-signed JWT, and keyId/publicKeyFingerprint identify the trusted public key to use for verification:
{
"signedDate": "2026-06-21T12:00:00.000Z",
"signedKey": "eyJhbGciOiJFZERTQSIsImtpZCI6IkFiQzEyM1h5WiJ9...",
"keyId": "AbC123XyZ",
"publicKeyFingerprint": "AbC123XyZ"
}Without an SDK
Verify the token yourself with any Ed25519 JWT library. This example uses jose.
Step 1: Bundle Trusted Public Keys
Map trusted key IDs to their public keys within your application.
import { importSPKI } from 'jose';
const trustedKeys = new Map<string, string>([
['AbC123XyZ', '-----BEGIN PUBLIC KEY-----\nMCowBQYDK2VwAyEAr7Z8s2Z...\n-----END PUBLIC KEY-----']
]);Step 2: Parse and Verify the License
Extract the Key ID from the token header, retrieve the matching public key, and verify the signature and claims using jose.
import { importSPKI, jwtVerify, decodeProtectedHeader } from 'jose';
import * as fs from 'fs';
export async function verifyLicense(licensePath: string, productId: string, machineCode: string) {
const { signedKey } = JSON.parse(fs.readFileSync(licensePath, 'utf8'));
// 1. Extract Key ID from the JWT header
const { kid } = decodeProtectedHeader(signedKey);
if (!kid) throw new Error('Invalid token header: missing kid');
// 2. Fetch the corresponding public key
const pem = trustedKeys.get(kid);
if (!pem) throw new Error('Untrusted signature key ID');
const publicKey = await importSPKI(pem, 'EdDSA');
// 3. Verify signature and standard claims
const { payload } = await jwtVerify(signedKey, publicKey, {
algorithms: ['EdDSA']
});
// 4. Validate license type, product and hardware bounds. One signing key
// covers every product in your workspace, so the product check is required.
if (payload.type !== 'offline') throw new Error('Not an offline license');
if (payload.productId !== productId) throw new Error('Product mismatch');
if (payload.machineCode !== machineCode) throw new Error('Hardware mismatch');
return payload;
}Security Best Practices
- Embed Every Trusted Key: Bundle the signing key and any pending key so a staged rotation never breaks verification.
- Check the Machine and Product: Every file is bound to one machine code and one product. Always compare both, along with the expiry.
- Pin the Algorithm: Accept only
EdDSA(Ed25519) signatures; reject any otheralg, such asHS256ornone. - Guard Against Clock Rollback: An offline app can't tell if the clock was set back. Store the latest time you trusted and verify against the later of that and the system clock (the SDKs take a
nowoption).