ID Kit
Integrating on Mobile
All of the mobile SDKs follow the same logic:
- Initiate a session
- Redirect the user using the session url
- Poll the session
- Verify the proof in your Backend
Choose the SDK you want to use:
Initiating a Session
Initiating a session
const session = await new Session().create('app_id', 'your-action', {
bridge_url: undefined, // Optional: URL to a custom bridge
verification_level: VerificationLevel.Orb, // Optional: Minimum verification level
})
Redirect user
Use the session url to redirect the user to the World App.
You can add a return_to
query param to the session url, to redirect the user back to your app. Make sure you
handle the deeplink correctly when the user get's redirect back to the app.
Session url
const sessionUrl = session.sessionURI
Poll session status
Poll session status
const checkStatus = async () => {
const status = await session.status()
if (status.state === VerificationState.Confirmed) {
console.log('Verification successful:', status.result)
} else if (status.state === VerificationState.Failed) {
console.log('Verification failed:', status.errorCode)
}
}
// Poll every second
setTimeout(checkStatus, 1000)
Verify the proof
If the session was successful, you will get the proof result:
Result
{
"merkle_root": "0x1f38b57f3bdf96f05ea62fa68814871bf0ca8ce4dbe073d8497d5a6b0a53e5e0",
"nullifier_hash": "0x0339861e70a9bdb6b01a88c7534a3332db915d3d06511b79a5724221a6958fbe",
"proof": "0x063942fd7ea1616f17787d2e3374c1826ebcd2d41d2394...",
"verification_level": "orb"
}
Retrieving a successful proof doesn't mean the user is verified you need to validate this proof in a backend server.
Depending on your needs you can verify the proof: