Session Management
Manage verification session lifecycle, state, and timeouts.
Session Lifecycle
Each verification begins with creating a session, which progresses through several states:
| State | Description |
|---|---|
created | Session created, ready to display QR or start NFC/BLE |
waitingForEngagement | Waiting for holder to respond (scan QR, tap NFC, connect BLE) |
processingEngagement | Processing the holder's device engagement |
readingDevice | Reading data from the holder's device |
verifying | Validating credentials with Owl Eyes API |
completed | Verification finished successfully |
failed | Verification failed (see error for details) |
cancelled | Session was cancelled by the app |
Session Properties
The MDLSession object provides access to session information and state:
Observing Session State (SwiftUI)
Since MDLSession conforms to ObservableObject, you can observe state changes directly in SwiftUI:
Observing State with Combine
Use Combine publishers for more control over state observation:
Session Timeouts
Sessions have a configurable timeout. After expiration, the session can no longer accept responses.
Configure Timeout
Display Remaining Time
Cancelling Sessions
Cancel a session when the user navigates away or wants to start over:
Refreshing Session State
If needed, you can refresh the session state from the server:
Delegate Pattern (UIKit)
For UIKit apps or when you prefer delegation over Combine, implement the MDLVerifierDelegate:
Best Practices
1. Handle Actor Isolation
The SDK uses @MainActor for UI safety. Ensure UI updates happen on the main actor:
2. Clean Up Resources
Next Steps
- Error Handling – Handle errors gracefully
- Verification Channels – Learn about QR, NFC, and BLE options