MDLProvider

Configure the React mDL context provider for your application.

Overview

MDLProvider is a React context provider that initializes the mDL SDK and makes it available to all child components. Wrap your application (or the part that needs verification) with this provider.

Basic Setup

App.tsxtsx
Loading...

Provider Props

PropTypeDefaultDescription
apiKeystringRequiredYour Owl Eyes API key
environment'sandbox' | 'production''sandbox'API environment
trustAnchorSourceTrustAnchorSource'aamva_vical'Trust anchor source
timeoutnumber30000Default timeout (ms)
onInitialized() => void-Called when SDK is ready
onError(error) => void-Called on initialization error
childrenReactNodeRequiredChild components

Full Configuration

App.tsxtsx
Loading...

Trust Anchor Sources

Configure the trust anchor source based on your deployment region:

trust-anchors.tsxtsx
Loading...

Accessing Provider Context

Use the useMDL hook to access the SDK context:

VerificationStatus.tsxtsx
Loading...

Context Values

PropertyTypeDescription
isInitializedbooleanWhether SDK is ready
isInitializingbooleanWhether SDK is initializing
errorError | nullInitialization error if any
verifierOwlEyesMDL | nullSDK instance (for advanced use)
configMDLConfigCurrent configuration

Environment Variables

Store your API key securely in environment variables:

.env.localbash
Loading...
usage.tsxtsx
Loading...
Security Note: The API key is exposed to the client. Use environment-specific keys and enable domain restrictions in your Owl Eyes dashboard.

Next.js App Router

For Next.js App Router, create a client component wrapper:

Next.js App Routertsx
Loading...