-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add multiplatform BLE stack for ISO/IEC 18013-5:2021 proximity.
This adds new multiplatform API to the identity-mdoc library for ISO/IEC 18013-5:2021 proximity presentations. It works on both Android and iOS and both operating systems share a lot of common code. Also add support two new pages - "ISO mdoc Proximity Sharing" and "ISO mdoc Proximity Reading" - to the multi-platform test app. This only includes QR engagement, NFC engagement will be added in a future change. These two pages represent feature complete mDL and mDL reader functionality and are designed to work with other implementations as well as with itself. Also introduce `rememberBluetoothPermissionState` composable function and `BluetoothPermissionState` object which can be used to obtain the required permissions on BLE on both Android and iOS. Also devise a new multi-testing framework for automatically testing a number of mDL presentations between two devices. This is available in a new "ISO mdc Multi-Device Testing" page in the test app and the way it works is that the 1st device offers a QR code that the 2nd device scans. This sets up a TCP/IP control plane used for initiating tests, including sharing `DeviceEngagement`. This helps ensure the code is robust and well-tested both for happy paths and with all the various termination options available in the standard. Also modify existing L2CAP support so it follows the latest draft of the upcoming second edition of ISO 18013-5:2021. In particular, this means framing the `SessionData` / `SessionEstablishment` packets sent over the L2CAP socket. Modify `ScanQrCodeDialog` and `ShowQrCodeDialog` so they are easy to extend. Include portrait ans signature images in sample data in identity-doctypes. Test: Manually tested against wallet app and well-known readers. Signed-off-by: David Zeuthen <[email protected]>
- Loading branch information
Showing
75 changed files
with
7,014 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
...kotlin/com/android/identity/appsupport/ui/permissions/BluetoothPermissionState.android.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.android.identity.appsupport.ui.permissions | ||
|
||
import android.Manifest | ||
import androidx.compose.runtime.Composable | ||
import com.google.accompanist.permissions.ExperimentalPermissionsApi | ||
import com.google.accompanist.permissions.MultiplePermissionsState | ||
import com.google.accompanist.permissions.rememberMultiplePermissionsState | ||
|
||
@OptIn(ExperimentalPermissionsApi::class) | ||
private class AccompanistBluetoothPermissionState( | ||
val multiplePermissionsState: MultiplePermissionsState | ||
) : BluetoothPermissionState { | ||
|
||
override val isGranted: Boolean | ||
get() = multiplePermissionsState.allPermissionsGranted | ||
|
||
override fun launchPermissionRequest() { | ||
multiplePermissionsState.launchMultiplePermissionRequest() | ||
} | ||
} | ||
|
||
@OptIn(ExperimentalPermissionsApi::class) | ||
@Composable | ||
actual fun rememberBluetoothPermissionState(): BluetoothPermissionState { | ||
return AccompanistBluetoothPermissionState( | ||
rememberMultiplePermissionsState( | ||
listOf( | ||
Manifest.permission.BLUETOOTH_SCAN, | ||
Manifest.permission.BLUETOOTH_CONNECT, | ||
Manifest.permission.BLUETOOTH_ADVERTISE, | ||
) | ||
) | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
...monMain/kotlin/com/android/identity/appsupport/ui/permissions/BluetoothPermissionState.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.android.identity.appsupport.ui.permissions | ||
|
||
import androidx.compose.runtime.Composable | ||
|
||
interface BluetoothPermissionState { | ||
|
||
val isGranted: Boolean | ||
|
||
fun launchPermissionRequest() | ||
} | ||
|
||
@Composable | ||
expect fun rememberBluetoothPermissionState(): BluetoothPermissionState |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.