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-clientConfigure your keys
Keys are scoped to a single project. Start with the test key; swap in the live key for production.
.env.localbash
# .env.localZKAUTH_API_KEY=zka_test_your_test_key_hereZKAUTH_BASE_URL=https://api.zkauth.devKeep keys server-side. Never ship a key in client-side bundles. For browser flows (OPAQUE, passkeys), proxy requests through your backend. See Authentication.
Initialize
lib/zkauth.tsts
import { ZKAuthSDK } from 'zkauth-client'
export const zkauth = new ZKAuthSDK({ apiKey: process.env.ZKAUTH_API_KEY!, baseUrl: process.env.ZKAUTH_BASE_URL,})Without the SDK
Every operation is a plain HTTPS request with an x-api-key header. A quick check that your key works:
bash
curl https://api.zkauth.dev/api/v1/client/me \ -H "x-api-key: zka_test_your_test_key_here"See the full contract in the API reference.