ZKAuth
Get started

Get started

Installation

Use the published JavaScript client, or skip the dependency and call the HTTPS API directly. Both speak to the same engine and the same project-scoped keys.

Requirements

  • Node.js 18 or newer (for the JavaScript client).
  • A ZKAuth project and its API keys. Create one here.

Install the client

The zkauth-client package wraps the zero-knowledge proof handshake so you call register and login like any other API.

bash
npm install zkauth-client# pnpm add zkauth-client# yarn add zkauth-client

Configure your keys

Keys are scoped to a single project. Start with the test key; swap in the live key for production.

.env.localbash
# server-only runtime configZKAuth project key = zka_test_...ZKAuth API base URL = https://api.zkauth.dev

Keep keys server-side

Never ship a key in client-side bundles. For browser-hosted flows, use hosted proxy mode or proxy requests through your own backend. See SDK reference.

Initialize from trusted server code

lib/zkauth.tsts
import { ZKAuthSDK } from 'zkauth-client'
export const zkauth = new ZKAuthSDK({  apiKey: loadServerOnlyProjectKey(),  baseUrl: loadServerOnlyApiBaseUrl(),})

Initialize for hosted browser flows

Use hosted proxy mode when browser code needs to call ZKAuth-hosted routes without receiving a project API key.

browser-auth.tsts
import { ZKAuthSDK } from 'zkauth-client'
export const zkauth = new ZKAuthSDK({  hostedProxy: {    projectSlug: 'your-project-slug',    clientId: 'your_public_client_id',  },})

Without the SDK

Every operation is a plain HTTPS request with an x-api-key header. A quick check that your key works:

bash
API_KEY_HEADER="x-api-key: $ZKAUTH_API_KEY"curl https://api.zkauth.dev/api/v1/client/me \  --header "$API_KEY_HEADER"

See the full contract in the API reference.