Hooks
React hooks for building custom mDL verification interfaces.
useMDLVerification
The primary hook for mDL verification. Manages the complete verification lifecycle including session creation, QR code generation, and result handling.
useMDLVerification.tsxtsx
Loading...
Options
| Option | Type | Description |
|---|---|---|
requestedClaims | ClaimSet | string[] | Claims to request |
purpose | string | Verification purpose |
mode | 'in_person' | 'online' | Verification mode |
timeout | number | Session timeout (ms) |
autoStart | boolean | Auto-start on mount |
qrCodeOptions | QRCodeOptions | QR code settings |
onSuccess | (result) => void | Success callback |
onError | (error) => void | Error callback |
onStatusChange | (status) => void | Status change callback |
Return Values
| Property | Type | Description |
|---|---|---|
startVerification | () => Promise<void> | Start verification |
cancel | () => Promise<void> | Cancel current session |
reset | () => void | Reset to idle state |
status | SessionStatus | Current status |
session | MDLSession | null | Active session |
qrCodeData | string | null | QR code data URL |
result | VerificationResult | null | Verification result |
error | Error | null | Error if any |
isVerifying | boolean | Is actively verifying |
isCompleted | boolean | Is completed |
isError | boolean | Has error |
useMDLSession
Lower-level hook for manual session management. Use this when you need fine-grained control over the session lifecycle.
useMDLSession.tsxtsx
Loading...
useMDL
Access the MDL context and SDK instance directly. Useful for advanced scenarios or accessing the underlying SDK.
useMDL.tsxtsx
Loading...
useMDLResult
Hook for processing and formatting verification results.
useMDLResult.tsxtsx
Loading...
Custom Hook Example
Build your own custom hooks using the provided primitives:
useAgeVerification.tsxtsx
Loading...