Search guides and the APICtrl K
  1. API reference
  2. Plugin model

license.h

Dependency-free offline licence verification.

#include <sonore/license.h>
On this page

Design notes

The Sonorie server signs a licence KEY ("SNRE1-") and a device TOKEN ("SNRA1-") with a 2048-bit RSA key; the plugin embeds the public key and the product code and verifies BOTH offline (embedded key, local .lic, no network on the audio or the UI path). This header provides the four pieces that takes -- SHA-256, base64, big-integer modular exponentiation and the blob layout -- from scratch, because the SDK has no framework to borrow them from.

The scheme is RAW modular exponentiation, which is what the original build used and therefore what the server already signs. Kept deliberately: changing it would invalidate every key and token minted so far, and a signature made server-side has to verify here byte for byte (src/lib/license/rsa-core.ts, format.ts):

verify(msg) : SHA256(msg) == sig ^ e mod n

where SHA256(msg) is the 32-byte digest read as a big-endian integer, e/n are the public exponent/modulus (hex, from the embedded "e_hex,n_hex" key), and sig is the hex signature carried inside the base64 licence blob.

Layout MUST match src/lib/license/format.ts:

KEY   "SNRE1-" + base64({lid,iat,sig}),  signs  "<product>:<lid>:<emailLower>:<iat>"
TOKEN "SNRA1-" + base64({lid,mid,exp,sig}), signs "SNRA1:<product>:<lid>:<midLower>:<exp>"

Types 2

A plain, well-known implementation; the digest is the 32-byte big-endian hash.

No comment on this one in the header yet; the source says the rest.

Functions 9

↑↓ to move↵ to openEvery public name in the headers, and every guide