Verify an mDL in-person/offline
Verify an ISO/IEC 18013-5 mDL over BlueTooth Low Energy
1. Scanning Documents
Verify mdocs
import SpruceIDMobileSdk
// An Example View for Verification of Mdocs
public struct VerifyMDocView: View {
@Binding var path: NavigationPath
@State private var scanned: String?
public var body: some View {
if scanned == nil {
QRCodeScanner(
title: "Scan QR Code",
subtitle: "Looking...",
onRead: { code in
self.scanned = code
},
onCancel: onCancel,
titleFont: .customFont(font: .inter, style: .bold, size: .h0),
subtitleFont: .customFont(font: .inter, style: .bold, size: .h4),
cancelButtonFont: .customFont(font: .inter, style: .medium, size: .h3),
readerColor: .white
)
} else {
// Define an MdocReaderView and initiate it when the code is scanned
MDocReaderView(
// Set the scanned value
uri: scanned!,
// Define the items you want to query by namespace, attribute_name
// and intent to retain:
requestedItems: ["org.iso.18013.5.1": ["given_name": true]],
// Enter an array of issuer certificates that you accept (e.g. a list of US states).
// These issuer certificates should follow the IACA profile as defined in ISO/IEC 18013-5 Annex B.
trustAnchorRegistry: [<issuer_cert>],
onCancel: onCancel,
path: $path
)
}
}
func onCancel() {
// Define what to do when a user cancels the scan
self.scanned = nil
path.removeLast()
}
}
MdocReaderView
Last updated
Was this helpful?