Skip to main content
Use @worldcoin/idkit when you want React-native ergonomics on top of @worldcoin/idkit-core.

Install

Choose your API

  • Widgets: quickest integration, built-in modal and state handling
  • Hooks: headless control for custom UI and flow orchestration

Controlled widgets

Request widget

Widget callbacks

  • onSuccess is required for IDKitRequestWidget and IDKitSessionWidget.
  • handleVerify is optional and only available on widgets. Use it to verify the proof in your backend before success is emitted.
  • If handleVerify throws/rejects, the widget enters an error state, emits onError("failed_by_host_app"), and does not call onSuccess.
  • onError is optional.

Headless hooks

useIDKitRequest

Hook result fields:
  • open()
  • reset()
  • isAwaitingUserConnection
  • isAwaitingUserConfirmation
  • isSuccess
  • isError
  • connectorURI
  • result
  • errorCode
  • getDebugReport()

Invite-code mode

For invite-code flows, use IDKitInviteCodeRequestWidget (controlled) or useIDKitInviteCodeRequest (headless). Config matches IDKitRequestWidget / useIDKitRequest — invite-code mode adds no new required fields. See Invite-code mode for when to use it.
useIDKitInviteCodeRequest result fields (sibling of useIDKitRequest’s):
  • open()
  • reset()
  • isAwaitingUserConnection
  • isAwaitingUserConfirmation
  • isSuccess
  • isError
  • connectorURI
  • codeExpiresAt
  • result
  • errorCode
  • getDebugReport()

Migrating from QR / connect-URL

Swap the component and preset. Props, callbacks, and backend verification stay the same. The headless equivalent is useIDKitInviteCodeRequest in place of useIDKitRequest.

Session flows

Session verification uses IDKitSessionWidget (controlled) or useIDKitSession (headless); onSuccess returns an IDKitResultSession. Both share the request flows’ widget callbacks and hook-result fields — including onError(errorCode, debugReport?) and getDebugReport().

Presets

React hooks/widgets take preset directly in config.

Localization and UX notes

  • Widgets support language="en" | "es" | "th"
  • Widgets default to autoClose={true} after success

Backend utilities

For RP signature generation in React/Next.js apps, use the pure JS subpath:
See RP Signatures for the full algorithm and test vectors.