SDK · LIORITH REGISTRY
Configure SDK
Environment variables, API route setup, and allowed domain configuration.
Environment variables
LIORITH_REGISTRY_SITE_IDrequiredLIORITH_REGISTRY_KEYrequiredLIORITH_REGISTRY_URLoptional.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 domainlocalhost:3000Local developmentpreview.example.comStaging / previewRequests from hosts not in this list return host_mismatch. See Response Codes for the full list of possible results.