On this page
Quickstart
This guide takes you from an empty account to software that checks its license. It takes about ten minutes. The examples use a desktop antivirus; substitute your own product.
-
Create an account. Sign up free. The Free plan needs no card and covers up to 50 active clients.
-
Create an application. In the console, open LaaSio and add an application, for example Antivirus.
-
Add a license. Add a license to the application, for example name
av-realtime, display name Real-time Protection, typePaid. -
Optionally add a limit. For example
devices, applying toav-realtime. -
Create a SKU. For example code
AV-ANNUAL-25: grantsav-realtime, lasts 366 days,devices= 25. -
Assign it to a client. Add a client with ID
PC-123and give it the SKU. In production your store does this after a sale with the provisioning API. -
Copy your public values. In LaaSio → Settings, copy your organization ID (
lzo_…) and public key. Both are safe to build into your software. -
Check the license from your software. Call the lookup and verify each entry’s signature. The Develop tab in the console shows the same examples with your values already filled in.
// Node.js 18+ (built-in fetch and Ed25519), save as licenses.mjsimport { createPublicKey, verify } from "node:crypto";const LAASIO_URL = "https://laasio.functual.com";const ORG_ID = "lzo_YOUR_ORG_ID";// Your organization's public key, wrapped in the standard 12-byte Ed25519 header Node expectsconst PUBLIC_KEY = createPublicKey({key: Buffer.concat([Buffer.from("302a300506032b6570032100", "hex"), Buffer.from("YOUR_PUBLIC_KEY_BASE64", "base64")]),format: "der",type: "spki",});// Keys sorted at every level; JSON.stringify adds no whitespace and leaves "/" and Unicode as-isfunction canonical(value) {if (Array.isArray(value)) return value.map(canonical);if (value && typeof value === "object") {return Object.fromEntries(Object.keys(value).sort().map((k) => [k, canonical(value[k])]));}return value;}/** Return the client's licenses whose signature is valid. */export async function getLicenses(clientId) {const url = `${LAASIO_URL}/api/v1/lookup?${new URLSearchParams({ org: ORG_ID, client: clientId })}`;const response = await fetch(url, { headers: { Accept: "application/json" } });if (!response.ok) throw new Error(`LaaSio ${response.status}`);const { data } = await response.json();return data.filter(({ key, ...signed }) =>signed.clientId === clientId &&verify(null, Buffer.from(JSON.stringify(canonical(signed))), PUBLIC_KEY, Buffer.from(key, "base64")));}/** A license is active from its start until its end (end null = never expires). */export function isActive(license, now = new Date()) {return new Date(license.start) <= now && (license.end === null || now < new Date(license.end));}const licenses = await getLicenses("PC-123");for (const license of licenses.filter((l) => isActive(l))) {console.log(license.name, license.type, license.limits);}# pip install requests cryptographyimport base64import jsonfrom datetime import datetime, timezoneimport requestsfrom cryptography.exceptions import InvalidSignaturefrom cryptography.hazmat.primitives.asymmetric.ed25519 import Ed25519PublicKeyLAASIO_URL = "https://laasio.functual.com"ORG_ID = "lzo_YOUR_ORG_ID"PUBLIC_KEY = Ed25519PublicKey.from_public_bytes(base64.b64decode("YOUR_PUBLIC_KEY_BASE64"))def canonical(entry):# Keys sorted at every level, no whitespace, "/" and Unicode unescapedreturn json.dumps(entry, sort_keys=True, separators=(",", ":"), ensure_ascii=False).encode()def get_licenses(client_id):"""Return the client's licenses whose signature is valid."""response = requests.get(f"{LAASIO_URL}/api/v1/lookup",params={"org": ORG_ID, "client": client_id},headers={"Accept": "application/json"},timeout=10,)response.raise_for_status()licenses = []for entry in response.json()["data"]:signed = {k: v for k, v in entry.items() if k != "key"}try:PUBLIC_KEY.verify(base64.b64decode(entry["key"]), canonical(signed))except InvalidSignature:continueif entry["clientId"] == client_id:licenses.append(entry)return licensesdef is_active(license):"""A license is active from its start until its end (end None = never expires)."""now = datetime.now(timezone.utc)start = datetime.fromisoformat(license["start"].replace("Z", "+00:00"))end = license["end"] and datetime.fromisoformat(license["end"].replace("Z", "+00:00"))return start <= now and (end is None or now < end)for license in get_licenses("PC-123"):if is_active(license):print(license["name"], license["type"], license["limits"])// .NET 8+ with NSec for Ed25519: dotnet add package NSec.Cryptography// (on .NET 8 add --version 24.4.0; newer NSec versions need .NET 9+)using System.Net.Http.Json;using System.Text;using System.Text.Encodings.Web;using System.Text.Json;using System.Text.Json.Nodes;using NSec.Cryptography;foreach (var license in await Laasio.GetLicensesAsync("PC-123")){if (Laasio.IsActive(license))Console.WriteLine($"{license["name"]} {license["type"]} {license["limits"]!.ToJsonString()}");}public static class Laasio{const string LaasioUrl = "https://laasio.functual.com";const string OrgId = "lzo_YOUR_ORG_ID";static readonly PublicKey Key = PublicKey.Import(SignatureAlgorithm.Ed25519,Convert.FromBase64String("YOUR_PUBLIC_KEY_BASE64"), KeyBlobFormat.RawPublicKey);static readonly HttpClient Http = new();// No whitespace, and "/" and Unicode left unescapedstatic readonly JsonSerializerOptions Canonical = new() { Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping };/// <summary>Return the client's licenses whose signature is valid.</summary>public static async Task<List<JsonObject>> GetLicensesAsync(string clientId){var url = $"{LaasioUrl}/api/v1/lookup?org={Uri.EscapeDataString(OrgId)}&client={Uri.EscapeDataString(clientId)}";var response = await Http.GetFromJsonAsync<JsonObject>(url) ?? throw new Exception("Empty LaaSio response");var licenses = new List<JsonObject>();foreach (var node in response["data"]!.AsArray()){var entry = node!.AsObject();var signature = Convert.FromBase64String((string)entry["key"]!);var signed = Encoding.UTF8.GetBytes(Sorted(entry, skip: "key")!.ToJsonString(Canonical));if ((string?)entry["clientId"] == clientId && SignatureAlgorithm.Ed25519.Verify(Key, signed, signature))licenses.Add(entry);}return licenses;}/// <summary>A license is active from its start until its end (end null = never expires).</summary>public static bool IsActive(JsonObject license){var now = DateTimeOffset.UtcNow;var start = DateTimeOffset.Parse((string)license["start"]!);var end = license["end"] is null ? (DateTimeOffset?)null : DateTimeOffset.Parse((string)license["end"]!);return start <= now && (end is null || now < end);}// Copy of a JSON value with object keys sorted (ordinal) at every levelstatic JsonNode? Sorted(JsonNode? node, string? skip = null) => node switch{JsonObject o => new JsonObject(o.Where(p => p.Key != skip).OrderBy(p => p.Key, StringComparer.Ordinal).Select(p => KeyValuePair.Create(p.Key, Sorted(p.Value)))),JsonArray a => new JsonArray(a.Select(n => Sorted(n)).ToArray()),_ => node?.DeepClone(),};}package mainimport ("bytes""crypto/ed25519""encoding/base64""encoding/json""fmt""net/http""net/url""time")const (laasioURL = "https://laasio.functual.com"orgID = "lzo_YOUR_ORG_ID"publicKey = "YOUR_PUBLIC_KEY_BASE64")type License struct {ClientID string `json:"clientId"`Name string `json:"name"`DisplayName string `json:"displayName"`Type string `json:"type"`Start time.Time `json:"start"`End *time.Time `json:"end"` // nil = never expiresLimits map[string]*int64 `json:"limits"` // nil = not setIssued time.Time `json:"issued"`}// Active reports whether the license is in force: from its start until its end.func (l License) Active(now time.Time) bool {return !now.Before(l.Start) && (l.End == nil || now.Before(*l.End))}// canonical encodes an entry the way it is signed. Go sorts map keys; HTML escaping is turned off// so "<", ">" and "&" stay as-is, and the encoder's trailing newline is dropped.func canonical(entry map[string]any) []byte {var buf bytes.Bufferenc := json.NewEncoder(&buf)enc.SetEscapeHTML(false)enc.Encode(entry)return bytes.TrimRight(buf.Bytes(), "\n")}// GetLicenses returns the client's licenses whose signature is valid.func GetLicenses(clientID string) ([]License, error) {pub, err := base64.StdEncoding.DecodeString(publicKey)if err != nil {return nil, err}req, _ := http.NewRequest("GET", laasioURL+"/api/v1/lookup?"+url.Values{"org": {orgID}, "client": {clientID}}.Encode(), nil)req.Header.Set("Accept", "application/json")resp, err := http.DefaultClient.Do(req)if err != nil {return nil, err}defer resp.Body.Close()if resp.StatusCode != http.StatusOK {return nil, fmt.Errorf("LaaSio %d", resp.StatusCode)}var body struct {Data []json.RawMessage `json:"data"`}if err := json.NewDecoder(resp.Body).Decode(&body); err != nil {return nil, err}var licenses []Licensefor _, raw := range body.Data {var entry map[string]anydec := json.NewDecoder(bytes.NewReader(raw))dec.UseNumber() // keep numbers exactly as sentif err := dec.Decode(&entry); err != nil {continue}key, _ := entry["key"].(string)signature, err := base64.StdEncoding.DecodeString(key)delete(entry, "key")if err != nil || !ed25519.Verify(pub, canonical(entry), signature) {continue}var license Licenseif json.Unmarshal(raw, &license) == nil && license.ClientID == clientID {licenses = append(licenses, license)}}return licenses, nil}func main() {licenses, err := GetLicenses("PC-123")if err != nil {panic(err)}for _, l := range licenses {if !l.Active(time.Now()) {continue}devices := "not set"if d := l.Limits["devices"]; d != nil {devices = fmt.Sprint(*d)}fmt.Println(l.Name, l.Type, "devices:", devices)}}<?php// PHP 8+ (sodium is built in)const LAASIO_URL = "https://laasio.functual.com";const ORG_ID = "lzo_YOUR_ORG_ID";const PUBLIC_KEY = "YOUR_PUBLIC_KEY_BASE64";/** Copy of an entry with keys sorted at every level. */function canonical(array $value): array{ksort($value, SORT_STRING);return array_map(fn ($v) => is_array($v) ? canonical($v) : $v, $value);}/** Return the client's licenses whose signature is valid. */function getLicenses(string $clientId): array{$url = LAASIO_URL . "/api/v1/lookup?" . http_build_query(["org" => ORG_ID, "client" => $clientId]);$body = file_get_contents($url, false, stream_context_create(["http" => ["header" => "Accept: application/json\r\n", "timeout" => 10],]));if ($body === false) {throw new RuntimeException("LaaSio lookup failed");}$licenses = [];foreach (json_decode($body, true)["data"] as $entry) {$signature = base64_decode($entry["key"]);unset($entry["key"]);// json_decode(..., true) turns an empty limits object into []; restore the object that was signedif ($entry["limits"] === []) {$entry["limits"] = new stdClass();}$signed = json_encode(canonical($entry), JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);if ($entry["clientId"] === $clientId&& sodium_crypto_sign_verify_detached($signature, $signed, base64_decode(PUBLIC_KEY))) {$licenses[] = $entry;}}return $licenses;}/** A license is active from its start until its end (end null = never expires). */function isActive(array $license): bool{$now = new DateTimeImmutable();return new DateTimeImmutable($license["start"]) <= $now&& ($license["end"] === null || $now < new DateTimeImmutable($license["end"]));}foreach (getLicenses("PC-123") as $license) {if (isActive($license)) {echo $license["name"], " ", $license["type"], " ", json_encode($license["limits"]), "\n";}}Running it prints the client’s active licenses, for example
av-realtime Paid { devices: 25 }.
Next steps
Section titled “Next steps”- Understand every field in the answer: Check licenses from your app.
- Learn exactly what is signed: Verify signatures.
- License every install automatically on first run, as a trial or a regular license: Auto-provisioning.
- Connect your store: Provision after a sale.