@worldcoin/idkit-standalone
v2.2.5
Published
The identity SDK. Privacy-preserving identity and proof of personhood with World ID.
Readme
IDKit Standalone
World ID verification for vanilla HTML/JavaScript applications. This package provides two integration patterns: IDKit Widget and Session API.
Installation
npm install @worldcoin/idkit-standaloneIntegration Patterns
IDKit Widget (Modal-based)
A pre-built modal component for quick integration. Best for standard verification flows where you need minimal setup.
Features:
- Ready-to-use modal interface
- Built-in QR code generation
- Automatic state management
- Minimal configuration required
Use when:
- You need quick integration
- Standard modal verification is acceptable
- You don't need custom UI design
- You prefer minimal code maintenance
Session API (Custom flow)
A low-level API that gives you full control over the verification flow. Best for custom UIs and embedded experiences.
Features:
- Complete UI control
- Custom verification flows
- Manual state management
- QR code URI generation
Use when:
- You need custom UI/UX design
- Building mobile-first responsive experiences
- You want to embed verification in complex flows
- You need full control over the user journey
Comparison
| Factor | IDKit Widget | Session API | | ---------------------- | ------------ | ------------ | | Speed to integrate | Very fast | More setup | | UI customization | Limited | Full control | | Mobile responsive | Standard | Custom | | QR code styling | Fixed | Your design | | User flow control | Pre-defined | Custom flows | | Complex layouts | Modal only | Embedded | | Maintenance | Low | More code |
IDKit Widget API
Global Object: window.IDKit
Methods:
IDKit.init(config)- Initialize the widgetIDKit.open()- Open verification modalIDKit.close()- Close verification modalIDKit.update(config)- Update configuration
Properties:
IDKit.isInitialized- Whether widget is initialized
Session API
Global Object: window.IDKitSession
Methods:
IDKitSession.create(config)- Create verification sessionIDKitSession.pollStatus()- Poll for verification updatesIDKitSession.getURI()- Get session URI for QR codeIDKitSession.destroy()- Destroy session and cleanup
Properties:
IDKitSession.isActive- Whether there's an active session
Session States
awaiting_connection- Waiting for user to scan QR codeawaiting_app- User scanned, waiting for verification in World Appconfirmed- Verification completed successfullyfailed- Verification failed
Examples
See examples/with-html/ directory for working implementations of both patterns.
