Present mDL in-person/offline
Present an ISO/IEC 18013-5 mDL over BlueTooth Low Energy
To present an mDL over BLE, you will need to use the following components:
The CredentialStore Component
The IsoMdlPresentation Component
To use these components in your mobile application, we encourage you to define:
A Delegate class that holds the BLESessionState and the ISO mDL SessionManager
This class should implement the BLESessionState protocol.
A View that manages the UI based on the BLESessionState
The View holds an instance of your delegate class.
During the presentation, you will have to manage the BLESessionState. The BLESessionState definition is repeated here to show the stages that the presentation goes through. The View that manages your UI should deal with each one of these listed cases. Again, we have an example to give you some inspiration.
// The different Wallet-side states of an mDL presentation.
public enum BLESessionState {
/// App should display the error message
case error(BleSessionError)
/// App should display the QR code
case engagingQRCode(Data)
/// App should indicate to the user that BLE connection has been made
case connected
/// App should display an interactive page for the user to chose which values to reveal
case selectNamespaces([ItemsRequest])
/// App should display the fact that a certain percentage of data has been sent
/// - Parameters:
/// - 0: The number of chunks sent to far
/// - 1: The total number of chunks to be sent
case uploadProgress(Int, Int)
/// App should display a success message and offer to close the page
case success
}1. Start a Session by generating a QR-Code
In the delegate class, make sure you can call the presentMdocBLE and submitNamespaces methods on the IsoMdlPresentation component.
2. Define your Session Delegate
Now that you have your Delegate to manage the BLESessionSate and your SessionManager, you can define the View that defines what your presentation flow looks like.
3. Define your Mdl Sharing View
You will need a UI component that allows the user to select which fields of the mDL they are willing to share. In our SpruceKit Showcase App, we call that the Credential Selector
That's it! You manage the UI, and SpruceKit takes care of all the nitty gritty underneath.
Last updated
Was this helpful?