Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Groundwork to get issuance work in Koltin Multiplatform. #816

Merged
merged 1 commit into from
Dec 18, 2024

Conversation

sorotokin
Copy link
Contributor

@sorotokin sorotokin commented Dec 13, 2024

Combination of project restructuring and change in protocols that allows US to support iOS wallet app (through Kotlin Multiplatform).

  • converted identity-flow (which is our RPC mechanism) to KMP
  • split off cross-platform interface portion from identity-issuance into identity-issuance-api so our wallet server RPC interface is available in KMP
  • created DeviceCheck APIs in identity project as abstraction level that allows us to express attestations/assertions in cross-platform way
  • tweaked RPC APIs to take new DeviceCheck objects
  • added ability to connect to the Wallet Server in our KMP sample.testapp

Note: this tweaks the wallet server protocol in incompatible way.

Another note: iOS attestations/assertions are generated and sent to the server, but not yet validated.

Manually tested.

Copy link
Contributor

@davidz25 davidz25 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great - some questions/comments inline - but think it's self-contained enough to be landed so we can keep iterating on it.

* Configuration for a specific secure area [SecureArea] to use.
*/
@CborSerializable
sealed class SecureAreaConfiguration(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this limit us to SecureAreas defined in this library? I guess only if you want to use the applyConfiguration() methods, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With current implementation, it does limit us, but we can always define an open-ended variant that would have some basic fields + Map<String, DataItem> as an extension point.

@@ -68,7 +83,26 @@ kotlin {
}
}

val javasharedMain by creating {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we call it javaSharedMain (capital S)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -0,0 +1,46 @@
package com.android.identity.device
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file should be called DeviceCheck.android.kt and the iOS one should be called DeviceCheck.ios.kt (not all files in the project currently follow this convention)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

println("Server: $server")
}
},
content = { Text("Test issuance") }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we call this WalletServerTest instead of IssuanceTest? I mean, as I understand it we're testing the ability to connect to a wallet server... which includes proving to the wallet server that the client is in good standing

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am planning to actually finish the issuance path in the test later

generatedAt = Clock.System.now(),
androidKeystoreAttestKeyAvailable = true,
androidKeystoreStrongBoxAvailable = true,
androidIsEmulator = false
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add expect val isEmulator: Boolean to com.android.identity.testapp.Platform and have it be true if on Android emulator or iOS simulator?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


expect fun platformSecureArea(): SecureArea

expect fun platformKeySetting(clientId: String): CreateKeySettings
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just add this to the existing Platform.kt file in com.android.identity.testapp package?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

* Generates statements validating device/OS/app integrity. Details of these
* statements are inherently platform-specific.
*/
expect object DeviceCheck {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this can only be implemented on iOS and Android should we introduce a uiMain sourceSet? That way we avoid a dummy DeviceCheck.jvm.kt file and like also DeviceAttestationJvm.kt...

(I'm already contemplating doing this for other things, see the mp-nfc-engagement branch...)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or maybe a better name is mobileOsMain (naming is hard, news at 11)

@sorotokin sorotokin force-pushed the ios-attestation branch 4 times, most recently from 431225c to 71841fa Compare December 18, 2024 05:16
@sorotokin sorotokin merged commit b42a116 into main Dec 18, 2024
5 checks passed
@sorotokin sorotokin deleted the ios-attestation branch December 18, 2024 07:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants