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

OptionTypeDescription
requestedClaimsClaimSet | string[]Claims to request
purposestringVerification purpose
mode'in_person' | 'online'Verification mode
timeoutnumberSession timeout (ms)
autoStartbooleanAuto-start on mount
qrCodeOptionsQRCodeOptionsQR code settings
onSuccess(result) => voidSuccess callback
onError(error) => voidError callback
onStatusChange(status) => voidStatus change callback

Return Values

PropertyTypeDescription
startVerification() => Promise<void>Start verification
cancel() => Promise<void>Cancel current session
reset() => voidReset to idle state
statusSessionStatusCurrent status
sessionMDLSession | nullActive session
qrCodeDatastring | nullQR code data URL
resultVerificationResult | nullVerification result
errorError | nullError if any
isVerifyingbooleanIs actively verifying
isCompletedbooleanIs completed
isErrorbooleanHas 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...