Skip to content

API reference

Base URL: https://api.soverenia.com — the same API is also reachable via https://www.soverenia.com (the www host proxies /v1/* and /mcp*), which is what the SDK and CLIs use by default. All verdict endpoints require an API key. Create one in the dashboard after signing in — the raw key (sov_…) is shown only once; only its SHA-256 hash is stored.

1. Authentication & anti-replay

Which credentials each route group expects:

Route group Auth
POST /v1/*, GET /mcp/tools, POST /mcp/call Authorization: Bearer sov_… plus anti-replay headers (below)
POST /mcp, GET /mcp (SSE), GET /health Authorization: Bearer sov_… only — no anti-replay headers
GET /api/status, POST /api/demo/check_package, GET /.well-known/soverenia-keys.json public — no auth (per-IP rate limited)

For the routes in the first row, every request must carry:

Authorization: Bearer sov_…
X-Sovereignia-Timestamp: <unix epoch in milliseconds, max 5 minutes old>
X-Sovereignia-Nonce: <unique uuid per request, single use>
Content-Type: application/json
  • X-Sovereignia-Timestamp — request time in milliseconds; missing/stale (> 5 min, either direction) → 401 REPLAY_DETECTED.
  • X-Sovereignia-Nonce — must be unique per key; a reused nonce → 401 REPLAY_DETECTED.
  • POST /mcp (streamable HTTP for desktop clients) and GET /health are Bearer-only: desktop clients cannot send per-request nonces, so the replay headers are not required there (per-key rate limits still apply).
  • OAuth 2.1 access tokens (see OAuth 2.1 for POST /mcp) are accepted on all API routes as Bearer credentials and, being short-lived (1 h), skip the replay check.
  • Request body limit: 10 kB on all routes except POST /v1/check_sbom (5 MB) — larger bodies get HTTP 413.
  • CORS is restricted to *.soverenia.{com,eu,cz} origins and localhost.

The SDK (HttpMcpTransport in @soverenia/agent-guard) sends the anti-replay headers automatically on every call.

2. Endpoints

POST /v1/check_package

Verdict for a single package.

{
  "purl": "pkg:npm/lodash",
  "version": "4.17.21",
  "policy": "balanced",
  "install_source": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
  "lockfile_integrity": "sha512-…",
  "dist_integrity": "sha512-…",
  "metadata": { "homepage": "https://lodash.com", "repository": "https://github.com/lodash/lodash" }
}
  • purl — package URL, one of the 15 supported ecosystems: pkg:npm/…, pkg:pypi/…, pkg:maven/…, pkg:golang/…, pkg:cargo/…, pkg:nuget/…, pkg:gem/…, pkg:composer/…, pkg:hex/…, pkg:pub/…, pkg:conda/…, pkg:cocoapods/…, pkg:apk/…, pkg:deb/…, pkg:rpm/… (required)
  • version — exact version (required; missing purl/version → HTTP 400 INVALID_PURL)
  • policy — optional, "strict" | "balanced" | "quiet" (default balanced), see the policy ladder below
  • install_source, lockfile_integrity, dist_integrity — optional identity inputs (registry source URL, lockfile integrity hash, registry dist.integrity) that feed the S1/S10 identity signals
  • metadata — optional registry metadata (homepage, repository, license, publishedAt, …). If you omit it, the server fetches it from the official registry itself (npm / PyPI, 24 h cache) so identity signals S7/S8/S11 still fire — values you send always take precedence. Disable server-side enrichment with server configuration.

Response 200:

{
  "schema_version": "1.5.0",
  "authoritative": {
    "verdict": "SAFE | UPGRADE | AVOID",
    "authority": "soverenia-engine",
    "rule_id": "…",
    "rule_version": "…",
    "policy": "balanced",
    "evaluated_at": "2026-11-17T20:00:00Z",
    "package": { "purl": "pkg:npm/lodash@4.17.21", "version": "4.17.21", "ecosystem": "npm" },
    "upgrade_to": "4.17.21",
    "evidence": [
      { "rule_id": "RULE-003", "matched_source_ids": ["CVE-2026-1234"], "explanation": "CISA KEV entry with fixed version 4.17.21 → upgrade to 4.17.21" }
    ]
  },
  "signature": "ed25519:…base64…",
  "key_id": "…",
  "signature_alg": "Ed25519",
  "local_context": { "local_relevance": "unknown", "ai_summary": null },
  "sources": [],
  "attributions": [],
  "identity_risk": { "score": 0, "signals": [{ "id": "S1", "triggered": false }] },
  "error": null
}

authoritative is the signed, frozen block — the verdict is computed by deterministic, versioned rules (0 LLM calls in the verdict path). local_context is the only part a client may fill in (e.g. local_relevance: "reachable" | "unreachable" from your own codebase analysis); it never changes the verdict. identity_risk (score + signals S1–S11) is engine-produced and covered by the signature.

evidence[] (inside the signed block) is the human-readable proof of why the verdict fired: the rule id, the matched source ids from sources[], a deterministic explanation, and — for UPGRADE since schema 1.3.0 — upgrade_to_also_fixes (the further advisories the target version fixes beyond the triggering ones).

upgrade_to (present when verdict is UPGRADE) is the ecosystem-aware max of all fixed versions that are strictly newer than your requested version — across every fixable advisory, not just the ones that triggered the rule (rules v1.7.0), so the target version cannot still contain a known vulnerability (example: high fixed in 4.19.2 + XSS fixed only in 4.20.0 ⇒ upgrade_to is 4.20.0). The additional advisories the target fixes beyond the triggering ones (evidence[].matched_source_ids) are listed in evidence[].upgrade_to_also_fixes. Advisories already fixed in your version (fixed ≤ your version) never influence the verdict, so upgrade_to is always a real upgrade, never a downgrade.

Policy ladder

The three policies are threshold presets (since rules v1.7.0). Malware, known-exploited vulnerabilities and identity rules always apply in every policy, on top of the thresholds:

Rule strict balanced (default) quiet
Malware match (RULE-001) AVOID AVOID AVOID
Known-exploited, no fix (RULE-002) AVOID AVOID AVOID
Known-exploited, fix > your version (RULE-003) UPGRADE UPGRADE UPGRADE
All advisories already fixed in your version (RULE-006) SAFE SAFE SAFE

Thresholds for plain advisories (RULE-004, plus RULE-008 in balanced):

strict balanced (default) quiet
AVOID when no fix and severity ≥ medium (CVSS ≥ 4.0; unknown score also AVOID) high (CVSS ≥ 7.0 or EPSS ≥ 0.5) critical (CVSS ≥ 9.0)
UPGRADE when fix > your version and severity ≥ any (low+) high (CVSS ≥ 7.0 or EPSS ≥ 0.5), or ≥ 2 medium (CVSS 4.0–6.9) with a fix (RULE-008 medium-accumulation) critical (CVSS ≥ 9.0); other fixes are informational only in evidence[].explanation
Low (< 4.0) without a fix SAFE, with a warning in the explanation SAFE SAFE

Consequences of v1.7.0/1.7.1: quiet never signs off SAFE on a critical advisory — without a fix it returns AVOID, with a fix above your version it returns UPGRADE (RULE-004). In strict, a low (< 4.0) advisory without a fix is SAFE with a warning in the explanation (previously AVOID). An advisory without a CVSS score keeps the pre-1.7.0 behavior: in strict a no-fix advisory with unknown score is still AVOID (missing data must not yield SAFE); in balanced/quiet it does not escalate on CVSS alone (EPSS thresholds still apply).

Error semantics (PACKAGE_NOT_FOUND vs VERSION_NOT_FOUND)

Both come back as HTTP 200 with an error block (see Errors):

  • PACKAGE_NOT_FOUND — no records for this purl in any ingested feed and the official registry doesn't know the package either. The package is unknown to us; this is not the same as SAFE (check the name in the registry — typosquat? — or use the Enterprise CI gate for private packages). If the package exists in the registry but has no advisory records, you get a normal SAFE verdict instead.
  • VERSION_NOT_FOUND — the package is known, but the requested version is not among its registry-known versions (e.g. lodash@99.0.0, or a dist-tag like "beta"). AVOID takes precedence: a version with a malware/KEV-no-fix verdict is still AVOID, never VERSION_NOT_FOUND. Version existence is checked against the official registry of the ecosystem; where no registry check is available, a package with no advisory records yields PACKAGE_NOT_FOUND (fail-closed).
  • REGISTRY_UNAVAILABLE — the official registry was temporarily unavailable and the version could not be verified, so no SAFE is issued. Not cached; retry shortly.

POST /v1/check_sbom — Pro plan

Bulk verdicts over an SBOM — the CRA-mandated SBOM, security-checked in one call. Body limit for this route is 5 MB (all other routes: 10 kB). Requires the Pro plan or higher — a lower-plan key gets 403 PLAN_REQUIRED:

{ "schema_version": "1.0.0", "authoritative": null, "signature": "000…0",
  "error": { "code": "PLAN_REQUIRED", "message": "This endpoint requires the pro plan or higher (your key plan: free). Upgrade at https://www.soverenia.com/#pricing." } }

Request — sbom as a JSON object, or a JSON string in sbom_text:

{
  "sbom": {
    "bomFormat": "CycloneDX",
    "specVersion": "1.5",
    "components": [
      { "type": "library", "name": "lodash", "version": "4.17.21", "purl": "pkg:npm/lodash@4.17.21" },
      { "type": "library", "name": "jinja2", "version": "3.1.2" }
    ]
  },
  "policy": "balanced",
  "ecosystem": "npm"
}

CycloneDX is detected by specVersion + components[]; SPDX by spdxVersion + packages[] (component version from versionInfo, purl from externalRefs[].referenceType == "purl"):

{
  "sbom": {
    "spdxVersion": "SPDX-2.3",
    "packages": [
      { "name": "lodash", "versionInfo": "4.17.21",
        "externalRefs": [{ "referenceType": "purl", "referenceLocator": "pkg:npm/lodash@4.17.21" }] }
    ]
  },
  "policy": "balanced"
}
{ "sbom_text": "{\"bomFormat\":\"CycloneDX\",\"specVersion\":\"1.5\",\"components\":[ … ]}", "policy": "balanced" }
  • sbom / sbom_text — one of the two is required; anything else → 400 INVALID_SBOM
  • policy — optional, default balanced
  • ecosystem — optional fallback for components without a purl (e.g. "npm" → pkg:npm/<name>); without it such components land in skipped[]

Response 200:

{
  "schema_version": "1.5.0",
  "sbom": { "format": "cyclonedx", "total": 2, "checked": 2, "skipped": [] },
  "policy": "balanced",
  "summary": { "SAFE": 1, "UPGRADE": 0, "AVOID": 1, "error": 0 },
  "verdicts": [
    { "purl": "pkg:npm/lodash@4.17.21", "version": "4.17.21", "verdict": "AVOID", "rule_id": "RULE-002", "rule_version": "1.5.0" },
    { "purl": "pkg:npm/jinja2@3.1.2", "version": "3.1.2", "error": { "code": "UNSUPPORTED_ECOSYSTEM", "message": "…" } }
  ]
}

verdicts[] carries either verdict + rule_id + rule_version (+ upgrade_to for UPGRADE) or an error block per component (a failed component counts into summary.error and does not fail the whole request). Component cap: server-configurable (default 2000); components beyond the cap are reported in skipped[]. Each component is enriched with official-registry metadata (24 h cache, can be disabled in server configuration) exactly like POST /v1/check_package — so a known clean package returns SAFE, a version that does not exist in the registry returns VERSION_NOT_FOUND, and a registry 404 without any feed record returns PACKAGE_NOT_FOUND (never a silent SAFE). Every verdict is also written to the WORM audit log (compliance evidence). The same operation is available as MCP tool check_sbom (Pro-gated there too — a free key gets a JSON-RPC -32000 / isError: true result with PLAN_REQUIRED, see MCP endpoints).

GET /v1/verdict_history — Enterprise plan

Time series of verdicts for one package — the compliance proof "at deploy time T the verdict was SAFE" (CRA / NIS2 evidence). Read from the WORM audit log. Requires the Enterprise plan — lower plans get 403 PLAN_REQUIRED.

GET /v1/verdict_history?purl=pkg:npm/lodash&version=4.17.21&limit=50
  • purl — required (version may be part of the purl as @version or the separate version param); missing/invalid → 400 INVALID_PURL
  • limit — optional, clamped to 1–500 (default 50)

Response 200 — newest first:

{ "schema_version": "1.5.0", "purl": "pkg:npm/lodash@4.17.21", "version": "4.17.21", "count": 2,
  "history": [ { "timestamp": "…", "purl": "pkg:npm/lodash@4.17.21", "version": "4.17.21", "policy": "balanced",
                 "rule_id": "RULE-005", "rule_version": "1.5.0", "verdict": "SAFE", "signature": "…",
                 "sources_hash": "…", "kev_catalog_version": "…" } ] }

MCP endpoints

There are two MCP-over-HTTP surfaces plus the stdio server shipped in @soverenia/agent-guard (which uses GET /mcp/tools + POST /mcp/call under the hood):

  • POST /mcp — standard MCP streamable-HTTP on a single URL (desktop clients, custom connectors). Auth: Bearer only. Stateless JSON responses (Content-Type: application/json); an Mcp-Session-Id header is set on initialize. Supported methods: initialize (echoes your protocolVersion or defaults to 2025-03-26, returns capabilities: {tools: {}}, serverInfo: {name: "soverenia", version: "1.0.0"}), ping, tools/list, tools/call. JSON-RPC batch up to 50 messages — larger batches get 400 with JSON-RPC error -32600; notifications (messages without id) get no response — a request containing only notifications returns 202; unknown methods → -32601. GET /mcp opens an SSE stream (heartbeat every 30 s) for clients that require a GET stream; DELETE /mcp → 405.
  • GET /mcp/tools — tools/list as plain JSON: { "tools": [ … ] }. Auth: Bearer + anti-replay headers.
  • POST /mcp/call — tools/call as plain JSON: body {"name": "check_package", "arguments": {…}}. Auth: Bearer + anti-replay headers. Response wraps the result in MCP content format: { "content": [{ "type": "text", "text": "<json string>" }], "isError": false }. An unknown tool → 400 {"error": "Unknown tool: …"}.

The three tools:

Tool Min plan Input (arguments)
check_package free {purl, version, policy?, install_source?, lockfile_integrity?, dist_integrity?} — same as POST /v1/check_package; result is the full signed response envelope
check_install_plan free {packages: [{purl, version, resolved, integrity?}], policy?} — whole lockfile at once
check_sbom pro {sbom | sbom_text, policy?, ecosystem?} — same as POST /v1/check_sbom

check_install_plan validates the install plan from a lockfile: for every package it checks the resolved URL against the canonical registry of the package's ecosystem (e.g. registry.npmjs.org for npm, pypi.org / files.pythonhosted.org for PyPI — host must equal or be a subdomain of an allowlisted registry) and computes the per-package verdict. Response (inside content[0].text):

{
  "schema_version": "2.1.0",
  "sources": [{ "purl": "pkg:npm/lodash@4.17.21", "resolved": "https://evil.example.com/lodash-4.17.21.tgz", "trusted": false }],
  "verdicts": [ { "…": "full check_package response per package" } ],
  "summary": { "total": 1, "untrusted_sources": 1, "verdict": "AVOID" }
}

summary.verdict is AVOID when any resolved host is untrusted, otherwise "see per-package verdicts".

Plan gating on MCP tools: check_sbom needs Pro. On POST /mcp/call a lower-plan key gets HTTP 200 with isError: true and the PLAN_REQUIRED error body in content[0].text; on POST /mcp the same condition is a JSON-RPC error:

{ "jsonrpc": "2.0", "id": 1, "error": { "code": -32000,
  "message": "tool \"check_sbom\" requires the pro plan or higher (your key plan: free)",
  "data": { "code": "PLAN_REQUIRED", "upgrade_to": "pro" } } }

GET /health

Liveness + per-feed freshness metrics (OSV/GitHub Advisory/EUVD/KEV/NVD/OpenSSF/deps.dev). Requires the API key, no anti-replay headers, and is not counted against the rate limit.

Response 200 (HTTP 503 when degraded — see below):

{
  "status": "ok | degraded",
  "schema_version": "2.0.0",
  "feeds": { "osv": { "status": "ok", "lastSuccessAt": "…", "lastError": null, "consecutiveFailures": 0, "recordsCount": 123 } },
  "alerts": [],
  "collectors_stale": false,
  "collectors_stale_reason": null,
  "kev_catalog_version": "2026-11-22",
  "kev_degraded": false,
  "collectors_mode": "child-process",
  "cache_size": 12345,
  "cache_degraded": false,
  "warmer": { },
  "archive_size": 1700000
}
  • alerts — names of feeds in stale state (empty = all OK)
  • collectors_stale / collectors_stale_reason — true when the collector worker is not running or its metrics file is older than 180 s
  • kev_degraded — true when the CISA KEV catalog is empty (rules run without KEV flags)
  • 503 semantics: once the engine is up, the response is 503 when alerts is non-empty or collectors_stale is true (our monitoring relies on this). kev_degraded is only reported in the body, not via the status code.

Not reachable from the public internet

/health is blocked at the edge: api.soverenia.com/health and www.soverenia.com/health return 404 even with a valid API key. It is used internally only (our own health monitoring). To check availability from outside, call the public GET /api/status or fetch the public JWKS.

GET /api/status — public

Public-safe subset of /health (no internal error texts), used by the status page. No auth; 30 req/min per IP.

{
  "status": "ok | degraded",
  "updated_at": "…",
  "feeds": { "osv": { "status": "ok", "lastSuccessAt": "…", "consecutiveFailures": 0, "records": 123 } },
  "alerts": [],
  "kev_catalog_version": "2026-11-22",
  "kev_degraded": false,
  "cache_degraded": false,
  "archive_records": 1700000,
  "warmer": { },
  "collectors_mode": "child-process"
}

POST /api/demo/check_package — public

Live demo verdict from the real engine, no API key (the try-it box on the landing page). 10 req/min per IP plus a global 300 req/min backstop; policy is whitelisted to strict|balanced|quiet.

POST /api/demo/check_package
{"purl": "pkg:npm/lodash", "version": "4.17.21", "policy": "balanced"}

Response 200: { "demo": true, "note": "…", "response": { …standard check_package envelope… } }. Missing purl/version → 400 INVALID_PURL. Demo calls are never written to the audit log and never populate the cache.

GET /.well-known/soverenia-keys.json — public

JWKS with the Ed25519 signing keys (key rotation: multiple kids with exp; expired keys disappear from the JWKS but old verdicts stay verifiable). No auth.

{ "keys": [ { "kty": "OKP", "crv": "Ed25519", "use": "sig", "alg": "EdDSA", "kid": "key-2026-11", "exp": 1893456000, "pem": "-----BEGIN PUBLIC KEY-----\n…\n-----END PUBLIC KEY-----" } ] }

Verify a verdict locally — see §5.

OAuth 2.1 for POST /mcp

POST /mcp accepts two Bearer credential kinds: the classic sov_… API key and an OAuth 2.1 access token. Desktop clients that support OAuth (e.g. Google Antigravity) use the automatic flow — no key to paste:

  • GET /.well-known/oauth-protected-resource → resource metadata (RFC 8414); the 401 on /mcp carries WWW-Authenticate: Bearer …, resource_metadata="…" so clients discover this automatically
  • GET /.well-known/oauth-authorization-server → AS metadata (issuer https://api.soverenia.com, endpoints, PKCE S256 only)
  • POST /oauth/register → dynamic client registration (public clients only, token_endpoint_auth_method: none)
  • GET /oauth/authorize → PKCE S256 required; consent screen on your existing dashboard session (redirects to /login.html?next=… if not signed in); POST /oauth/authorize with consent=approve|deny completes it
  • POST /oauth/token → authorization_code (with code_verifier) or refresh_token (rotating); access token TTL 1 h, refresh 30 d; only hashes stored
  • POST /oauth/revoke → RFC 7009

Scope: mcp:tools. Both credential kinds map to your account plan for rate limits and are accepted on all API routes (/v1/*, /mcp, /mcp/tools, /mcp/call). Anti-replay headers (X-Sovereignia-Timestamp/-Nonce) are required only for sov_… keys; OAuth access tokens are short-lived bearers (1 h) and skip the replay check.

3. Errors

Two error channels:

  1. Engine-level errors ride as HTTP 200 with an error block in the standard response envelope (authoritative: null, signature all zeros) — the contract keeps one response shape. Codes: INVALID_PURL, UNSUPPORTED_ECOSYSTEM, PACKAGE_NOT_FOUND, VERSION_NOT_FOUND, INTERNAL_ERROR.
  2. HTTP-level errors (auth, plan gating, rate limits, malformed HTTP bodies) use the HTTP status itself, with the same envelope shape where applicable.

HTTP-level errors:

HTTP error.code Meaning
400 INVALID_PURL POST /v1/check_package / verdict_history missing purl or version
400 INVALID_SBOM POST /v1/check_sbom body is not a CycloneDX/SPDX object (or sbom_text is not valid JSON)
400 JSON-RPC -32600 POST /mcp batch larger than 50 messages
401 UNAUTHORIZED missing/invalid API key or OAuth token (WWW-Authenticate header set)
401 REPLAY_DETECTED stale/missing X-Sovereignia-Timestamp (> 5 min) or reused X-Sovereignia-Nonce (sov_… keys on /v1/*, /mcp/tools, /mcp/call)
403 PLAN_REQUIRED plan-gated endpoint with a lower-plan key (message names the required plan)
413 — request body over the route limit (10 kB; 5 MB on /v1/check_sbom)
429 RATE_LIMITED per-key plan limit or per-IP edge limit exceeded — Retry-After header carries the seconds
503 UNAVAILABLE engine still starting (verdict endpoints)
500 INTERNAL_ERROR unexpected engine error

Verdict-level errors (HTTP 200, error.code in the body):

error.code Meaning
INVALID_PURL malformed purl (bad format, missing version, missing type/path separator)
UNSUPPORTED_ECOSYSTEM purl type not in the 15 supported ecosystems (the message lists them)
PACKAGE_NOT_FOUND no records for this purl in any ingested feed and the official registry returns 404 — the package is unknown to us. This is not the same as SAFE: check the name in the registry (typosquat?), or use the Enterprise CI gate for private packages. Response still carries identity_risk.
VERSION_NOT_FOUND package known, but the requested version is not among its known/published versions (e.g. lodash@99.0.0). AVOID/malware verdicts take precedence — a malicious version is AVOID, not this error.
INTERNAL_ERROR engine error

4. Rate limits & plan-gated features

Per API key, per plan (429 RATE_LIMITED + Retry-After when exceeded):

Plan Per minute Per day
free 60 1 000
pro 300 20 000
enterprise 1 000 200 000

Additionally:

  • a per-IP edge limit of 600 req/min applies to all API routes and is shared across all keys used from one IP (anti-abuse backstop; server-configurable);
  • a scraping guard on /v1, /mcp, /api/demo: more than 100 unique purls per minute from one key/IP → throttled to 10 req/min for 10 min;
  • dashboard keys get their plan from the account; env-configured keys (SOVEREENIA_API_KEYS) default to enterprise (override per key via SOVEREENIA_API_KEY_PLANS).

For batch work prefer the MCP tool check_install_plan or POST /v1/check_sbom (one request instead of N).

Feature gating by plan — a lower-plan key gets 403 PLAN_REQUIRED on REST and isError: true / JSON-RPC -32000 with data.code = "PLAN_REQUIRED" on MCP:

Feature free pro enterprise
POST /v1/check_package, MCP check_package / check_install_plan ✅ ✅ ✅
POST /v1/check_sbom, MCP check_sbom (CI gate / SBOM) ❌ ✅ ✅
GET /v1/verdict_history (compliance evidence) ❌ ❌ ✅
Watch mode, org overrides, SSO/SCIM, offline snapshots (roadmap) ❌ ❌ ✅

5. Verifying a verdict (Ed25519)

Every verdict response carries signature ("ed25519:<base64>") and key_id. The signature is Ed25519 over the canonical JSON of the authoritative block — canonical JSON = object keys sorted recursively, no whitespace ({"a":1,"b":[2,3]}), exactly as produced by JSON.stringify on a key-sorted object (see canonicalJson below). Verify against the public JWKS:

  1. GET https://www.soverenia.com/.well-known/soverenia-keys.json, pick the key by kid == key_id (the pem field).
  2. Compute canonicalJson(authoritative), strip the ed25519: prefix, base64-decode signature, verify with Ed25519.
# verify a saved response with curl + openssl (Ed25519 via PEM from the JWKS)
curl -s https://www.soverenia.com/.well-known/soverenia-keys.json | jq -r '.keys[0].pem' > sov-pub.pem
# canonical JSON of authoritative, then:
openssl pkeyutl -verify -pubin -inkey sov-pub.pem -rawin -sigfile <(printf '%s' "$SIG_B64" | base64 -d) -in <(printf '%s' "$CANONICAL_JSON")
// Node.js — no dependencies
import { createPublicKey, verify } from "node:crypto";

function canonicalJson(obj) {
  if (obj === null || typeof obj !== "object") return JSON.stringify(obj);
  if (Array.isArray(obj)) return "[" + obj.map(canonicalJson).join(",") + "]";
  const keys = Object.keys(obj).sort();
  return "{" + keys.map((k) => `${JSON.stringify(k)}:${canonicalJson(obj[k])}`).join(",") + "}";
}

const jwks = await (await fetch("https://www.soverenia.com/.well-known/soverenia-keys.json")).json();
const res = await /* your POST /v1/check_package (or MCP tools/call) response */;
const key = jwks.keys.find((k) => k.kid === res.key_id);
const sig = Buffer.from(res.signature.replace(/^ed25519:/, ""), "base64");
const ok = verify(null, Buffer.from(canonicalJson(res.authoritative)), createPublicKey(key.pem), sig);
console.log(ok); // true — the verdict block is authentic and untampered

The SDK in @soverenia/agent-guard does this for you:

import { AgentGuard, HttpMcpTransport, verifyResponse, fetchJwks } from "@soverenia/agent-guard";
const guard = new AgentGuard(new HttpMcpTransport("https://www.soverenia.com"));
const res = await guard.checkPackage({ purl: "pkg:npm/lodash", version: "4.17.21" });
console.log(await guard.verify(res));                       // true — uses the JWKS internally
console.log(verifyResponse(res, await fetchJwks("https://www.soverenia.com"))); // same, explicit

Error responses (authoritative: null) carry an all-zeros signature and are not verifiable — check error.code instead.