IDKit is open source and accepts contributions! Head over to GitHub and submit a pull request.
@worldcoin/idkit
, @worldcoin/idkit-standalone
, and @worldcoin/idkit-core
. The @worldcoin/idkit
package is the main package that should be used with the React JS framework. The @worldcoin/idkit-standalone
package is a standalone package that can be used in vanilla JavaScript applications. The @worldcoin/idkit-core
package is a core functionality package that is used by the other two packages, and should be used only when creating a new IDKit package.
IDKit (React)
The@worldcoin/idkit
package is the main package that should be used with the React framework or any other framework that supports React components, such as Next.JS.
Components
IDKitWidget
The IDKitWidget
component is the main component that renders the World ID widget. It should be mounted in your React app and passed the relevant parameters. Accepts a function as a child that receives an open
function to open the widget.
Parameters
The following parameters can be passed as props to theIDKitWidget
component:
Hooks
useIDKit
The useIDKit
hook allows you to programmatically open the IDKit widget without mounting any buttons on screen. Note that you still need to mount the component for this to work.
useSession
The useSession
hook provides a React-friendly way to handle World ID verification sessions with full control over the UI. It automatically manages session creation and polling for verification updates.
Functions
verifyCloudProof
The verifyCloudProof
function is used to verify a proof returned from the user’s identity wallet (e.g. World App) against the Developer Portal API. This function is useful for verifying proofs on the server side.
Types
ISuccessResult
IErrorState
IVerifyResult
Error Handling
An error in IDKit will generally be returned as the input to theonError
callback. IDKit will display an error to the user and call the onError
callback with an IErrorState
object when the modal is closed.
View the Errors Reference for assistance when troubleshooting.
IDKit Standalone
The@worldcoin/idkit-standalone
package is intended for vanilla JS applications. It is a standalone package that acts as a wrapper around the @worldcoin/idkit
package.
Methods
The
.init()
and .update()
methods take the same parameters as the React package’s IDKitWidget component. See above for more details..init()
The.init()
method is the main initialization method used for vanilla JS apps. It should be called to start up IDKit and configure the widget.
.update()
The.update()
method reinitializes the widget with new parameters. It can only be called after the .init()
method.
.open()
The.open()
method is used to open the widget. It can only be called after the .init()
method, typically in response to a button click.
This method returns a Promise object that will resolve when the onSuccess
callback is called, or reject when the onError
callback is called.
Session API
IDKitSession
The IDKitSession
object provides a session-based approach to World ID verification with full control over the verification flow. Unlike the widget approach, this gives you complete control over UI and state management.
IDKitSession.create(config)
Creates a new World ID verification session. If a session already exists, it will be destroyed and replaced.
Returns: Promise that resolves when session is created
IDKitSession.getURI()
Gets the current session URI for QR code generation.
Returns: string | null
- The session URI or null if no active session
IDKitSession.pollStatus()
Polls for verification updates and returns current session status.
Returns: Promise with SessionStatus
object
IDKitSession.destroy()
Destroys the current session and cleans up resources.
Returns: void
IDKitSession.isActive
Property that returns whether there’s an active session.
Returns: boolean
Advanced configuration
This section outlines advanced configuration options that may be unstable or subject to change. These options are passed as a JSON object to theadvanced
prop of the IDKitWidget
component.
Self-Hosted Applications
Self-hosted applications bypass the Worldcoin Developer Portal entirely. The proof returned can not be verified by the Developer Portal API. Instead, you must verify the proof on-chain or with a custom prover service. When using self-hosted mode, noapp_id
is required, and any value passed to IDKit will be ignored. The action
you set must have sufficient uniqueness to avoid collisions with other applications. We recommend using a prefix that includes your application name, e.g. your_app_name_vote_1
.