Skip to content

Types

X511Config

Configuration object passed to x511().

ts
interface X511Config {
  domain: string
  basePath?: string
  providers: ('self' | 'zkpassport')[]
  disclousures: {
    minAge: number
  }
}

Fields

FieldTypeRequiredDefaultDescription
domainstringYes-Public base URL of the server, e.g. 'https://example.com'. No trailing slash. Used to build provider callback URLs and QR code links.
basePathstringNo'/'Route prefix for X511's internal endpoints (/sse, /verify/self, /verify/zk).
providers('self' | 'zkpassport')[]Yes-Which providers are shown on the verification page.
disclousures.minAgenumberYes-Minimum age the user must prove (e.g. 18). Passed to provider SDKs.

VerificationState

Union type returned by gate.verified(req).

ts
type VerificationState =
  | {
      type: 'pending'
      config: X511Config
      sessionId: string
      providersPayload: ProvidersPayload
    }
  | { type: 'verified' }

Variants

{ type: 'pending' }

The request does not have a valid access token. Includes everything the verification page needs:

FieldTypeDescription
configX511ConfigThe resolved configuration (with basePath defaulted)
sessionIdstringUUID for this session, used by SSE and provider callbacks
providersPayloadProvidersPayloadProvider-specific data for rendering the page

{ type: 'verified' }

The request carries a valid session_id + access_token pair. The session is consumed immediately - re-using the same token will not succeed.


ProvidersPayload

Per-provider data embedded in the 511 HTML page.

ts
type ProvidersPayload = Partial<{
  self: { link: string }
  zkpassport: { domain: string }
}>

Fields

FieldTypeDescription
self.linkstringUniversal link for the Self mobile app (encodes the ZK proof request). Used to generate the QR code on the client.
zkpassport.domainstringServer domain passed to the ZKPassport SDK running in the browser. The SDK uses this to build its own QR code client-side.

Only the keys for enabled providers are present. For example, if providers: ['self'], then ProvidersPayload will only have the self key.