Skip to content

Docs · SDK

SDK

Signing, lookups and badges for JavaScript and TypeScript, plus a command-line tool for setup and debugging.

What it covers

signProofV2(site, host, privateKeyPem) => ProofParamsSigns a proof with Ed25519. Server only.
signProof(site, host, secret) => ProofParamsThe legacy HMAC scheme. Kept for existing integrations.
generateKeyPair() => KeyPairA fresh Ed25519 pair - PKCS8 private key, SPKI public key.
proofToUrl(params, registryBase?) => stringTurns signed parameters into a verification URL.
verifyProof(params, opts?) => Promise<VerifyResult>Sends a proof to the registry and returns the result. Works in Node and the browser.
checkDomain(domain, opts?) => Promise<CheckResult>Domain lookup. No key needed.
badgeUrl / badgeMarkdown(siteId, …) => stringA static SVG badge, and the Markdown to embed it.
mountBadge / mountCheckBadge(el, …, opts?) => cleanupRenders a badge into an element via shadow DOM. Returns a cleanup function that aborts in-flight requests.

Signing versus checking

signProofV2 is the only function that touches a private key, and it must stay on the server. Everything else is safe in a browser - verifyProof and checkDomain only read.

ts
import { signProofV2, proofToUrl, checkDomain } from 'liorith-registry-sdk';

// Server: signiert mit dem Private Key.
const params = signProofV2(siteId, host, privateKeyPem);
const url    = proofToUrl(params);

// Überall: liest nur nach.
const result = await checkDomain('demo.liorith.net');
if (result.status === 'registered') { /* ... */ }
Two badge helpers, two meanings. mountCheckBadge shows registry state - no signature involved. mountBadge takes signed parameters and reflects the actual proof result, including host_mismatch when the badge runs on a domain that is not registered for the site.

Pages