Getting Started
Installation
Install X511 with your framework of choice:
bash
npm install hono @hono/node-server x511-tbabash
npm install elysia @elysiajs/node x511-tbaConfiguration
Create an x511 instance with your configuration:
ts
import { x511 } from 'x511-tba'
const { verify, verified } = x511({
domain: 'https://your-app.example.com',
basePath: '/x511',
dev: true,
providers: ['self', 'zkpassport'],
disclousures: {
minAge: 18,
},
})Configuration options
| Option | Type | Required | Description |
|---|---|---|---|
domain | string | Yes | Public base URL of your server (no trailing slash) |
basePath | string | No | Route prefix for internal X511 endpoints. Defaults to '/' |
dev | boolean | No | Enables development mode for provider SDKs. Defaults to false |
providers | ('self' | 'zkpassport')[] | Yes | Which verification providers to offer |
disclousures.minAge | number | Yes | Minimum age the user must prove (e.g. 18) |
Development mode is OFF by default
Provider SDKs run in production mode unless you explicitly set dev: true. For local development and testing, make sure to enable it — otherwise provider verification flows will target production environments and may not work as expected during development.
Minimal Example
For a quick local test with only the Self provider:
ts
import { Hono } from 'hono'
import { serve } from '@hono/node-server'
import { x511, toHono } from 'x511-tba'
const app = new Hono()
const { verify, verified } = x511({
domain: 'https://your-app.example.com',
basePath: '/x511',
dev: true,
providers: ['self'],
disclousures: { minAge: 18 },
})
app.mount('/x511', verify)
app.get('/adults-only', toHono(verified), (c) =>
c.text('Welcome, verified adult!'),
)
serve({ fetch: app.fetch, port: 3000 })ts
import { Elysia } from 'elysia'
import { node } from '@elysiajs/node'
import { x511, toElysia } from 'x511-tba'
const { verify, verified } = x511({
domain: 'https://your-app.example.com',
basePath: '/x511',
dev: true,
providers: ['self'],
disclousures: { minAge: 18 },
})
new Elysia({ adapter: node() })
.mount('/x511', verify)
.use(toElysia(verified))
.get('/adults-only', () => 'Welcome, verified adult!')
.listen(3000)Visit http://localhost:3000/adults-only in a browser - you will see the 511 verification page.