Get started
Installation
Install the published 2.0 beta for hosted integrations and evaluation. Proof V2 research requires explicit matching development artifacts, or you can call non-proof HTTPS operations directly.
Requirements
- Node.js 22 or newer for the checked-out JavaScript beta.
- A ZKAuth project and its API keys. Create one here.
Scaffold the hosted handoff
The published zkauth-cli@0.1.2 package detects Next.js, React/Vite, Express, and Hono applications. Its default init path creates a server-side hosted handoff with state validation and does not enable experimental password proofs.
npm install --global zkauth-clizkauth init --dry-run --jsonzkauth init --yesReview the dry run before writing files. Proof V2 scaffolding is available only through the explicit --experimental-proof-v2flag.
Install the client
The published zkauth-client@2.0.0-beta.5 package wraps the Proof V2 handshake. Proof V2 requires explicit development artifacts and remains outside the production-approved path.
npm install zkauth-client@betaConfigure your keys
Keys are scoped to a single project. Start with the test key; swap in the live key for production.
# server-only runtime configZKAUTH_API_KEY=zka_test_...ZKAUTH_BASE_URL=https://api.zkauth.devKeep keys server-side
Hosted/passkey golden path
This is the production-oriented browser boundary. It uses only a public project slug and client ID; the hosted proxy keeps the project key on its server side. The SDK calls real WebAuthn helper routes, while your UI performs credential conversion and your application owns its session.
import { ZKAuthSDK } from 'zkauth-client'
export const zkauth = new ZKAuthSDK({ hostedProxy: { baseUrl: 'https://zkauth.dev', projectSlug: 'your-project-slug', clientId: 'your_public_client_id', },})
const options = await zkauth.webAuthnAuthenticationOptions({ userId })// Run navigator.credentials.get(...) with converted options in browser UI.const login = await zkauth.webAuthnAuthenticationVerify({ userId, response: credentialResponse, deviceInfo,})Proof V2 Lab golden path
Use this only from trusted Node code with a matching development engine. The beta requires explicit Auth V2 artifact URLs and preloads only bounded public artifact bytes. Zero-contribution development keys are not production artifacts.
import { preloadProofArtifacts, ZKAuthSDK } from 'zkauth-client'
const proofLabArtifacts = { wasm: process.env.AUTH_V2_WASM_URL!, zkey: process.env.AUTH_V2_ZKEY_URL!,}
export const zkauth = new ZKAuthSDK({ apiKey: process.env.ZKAUTH_API_KEY!, baseUrl: process.env.ZKAUTH_BASE_URL ?? 'http://127.0.0.1:3000', experimentalProofV2Artifacts: proofLabArtifacts,})
await preloadProofArtifacts(proofLabArtifacts)await zkauth.register({ email, password, deviceInfo })// Complete email verification before login.await zkauth.login({ email, password, deviceInfo })Without the SDK
Every operation is a plain HTTPS request with an x-api-key header. A quick check that your key works:
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.