Liorith/Registry
SDK · LIORITH REGISTRY

Configure SDK

Environment variables, API route setup, and allowed domain configuration.

Environment variables

LIORITH_REGISTRY_SITE_IDrequired
Site ID from the admin panel (e.g. site_my-website).
LIORITH_REGISTRY_KEYrequired
Secret signing key from the admin panel. Never commit this to version control.
LIORITH_REGISTRY_URLoptional
Registry base URL override. Defaults to https://registry.liorith.net.

.env.local

.env.local
LIORITH_REGISTRY_SITE_ID=site_my-website
LIORITH_REGISTRY_KEY=your-secret-key-from-admin
# LIORITH_REGISTRY_URL=https://registry.liorith.net

API route (Next.js)

Add this route to your Next.js app. When the user visits it, the server signs a proof and redirects them to the registry verification page.

src/app/api/verify-me/route.ts
import { type NextRequest } from 'next/server';
import { signProof, proofToUrl } from 'liorith-registry-sdk';

export const runtime = 'nodejs';
export const dynamic = 'force-dynamic';

export async function GET(req: NextRequest) {
  const siteId = process.env.LIORITH_REGISTRY_SITE_ID!;
  const key    = process.env.LIORITH_REGISTRY_KEY!;

  // X-Forwarded-Host from proxy takes priority over Host header
  const host = req.headers.get('x-forwarded-host')
            ?? req.headers.get('host')
            ?? req.nextUrl.hostname;

  const params = signProof(siteId, host, key);
  return Response.redirect(proofToUrl(params));
}

Allowed domains

The host value in the proof must be listed in the site's allowed_domains in the registry. Configure this in the admin panel under Sites → Edit.

example.comProduction domain
localhost:3000Local development
preview.example.comStaging / preview

Requests from hosts not in this list return host_mismatch. See Response Codes for the full list of possible results.