Verify an mDL in-person/offline
Verify an ISO/IEC 18013-5 mDL over BlueTooth Low Energy
1. Scanning Documents
Verify mdocs
@Composable
fun MdocReaderView(
) {
val context = LocalContext.current
var reader: IsoMdlReader? = null
var scanProcessState by remember {
mutableStateOf(State.SCANNING)
}
var result by remember {
mutableStateOf<Map<String, Map<String, MDocItem>>?>(null)
}
fun elementMapToList(elements: Map<String, Map<String, Boolean>>): List<String> {
val elementList = listOf(elements.values.map { it.keys.toList() })
return elementList.flatten().flatten()
}
fun onRead(content: String) {
scanProcessState = State.TRANSMITTING
checkAndRequestBluetoothPermissions(
context,
getPermissions().toTypedArray(),
launcherMultiplePermissions
)
val bluetooth = getBluetoothManager(context)
GlobalScope.launch {
reader = IsoMdlReader(
// Your BleSessionStateDelegate implementation. See the next code block!
<bleCallback>,
// The scanned value
content,
// Define the items you want to query by namespace, attribute_name
// and intent to retain:
<defaultElements>,
// 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.
<trustAnchorCerts>,
// the Bluetooth manager
<bluetooth>,
// The local app context
context
)
}
}
fun back() {
navController.navigate(
Screen.HomeScreen.route.replace("{tab}", "verifier")
) {
popUpTo(0)
}
}
val elementsList = elementMapToList(defaultElements)
when (scanProcessState) {
// Manage the UI based on the ProcessState here.
}BLESessionStateDelegate
Last updated
Was this helpful?