@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.
@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.
IDKitWidget
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.
IDKitWidget
component:
useIDKit
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
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.
verifyCloudProof
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.
ISuccessResult
IErrorState
IVerifyResult
onError
callback. IDKit will display an error to the user and call the onError
callback with an IErrorState
object when the modal is closed.
@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.
.init()
and .update()
methods take the same parameters as the React package’s IDKitWidget component. See above for more details..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()
method reinitializes the widget with new parameters. It can only be called after the .init()
method.
.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.
IDKitSession
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)
IDKitSession.getURI()
string | null
- The session URI or null if no active session
IDKitSession.pollStatus()
SessionStatus
object
IDKitSession.destroy()
void
IDKitSession.isActive
boolean
advanced
prop of the IDKitWidget
component.
app_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
.