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

Allow instantiating SecureArea.CreateKeySettings object. #409

Merged
merged 1 commit into from
Nov 7, 2023

Conversation

davidz25
Copy link
Contributor

@davidz25 davidz25 commented Nov 6, 2023

In order to support new kinds of SecureArea without app changes, change the SecureArea.CreateKeySettings class so it can be instantiated by apps.

Also stop carrying the SecureArea class name in CreateKeySettings subclasses, instead have users of CreateKeySettings take a separate SecureArea class. Make it explicit that different SecureArea instances can be used by CredentialKey and even for different Authentication Keys.

Introduce the concept of an "identifier" for a SecureArea instead of Credential, Credential.Authentiationkey, and
Credential.PendingAuthenticationKey classes all using the Java class name when persisting on-disk. This paves the way to have multiple SecureArea instances of the same type but with different configuration. We'll need this for CloudSecureArea so an app can have two instances pointing to different providers, for different credentials. Also add "display name" since that is needed for Issue #380.

Unfortunately this breaks the on-disk format but this is going to happen anyway as we're renaming the project and moving all the code to new packages as part of the contribution of the code to the OpenWallet Foundation. In the near future we'll start committing to stable on-disk formats.

Test: All unit tests pass.
Test: Manually tested

Fixes #<issue_number_goes_here>

It's a good idea to open an issue first for discussion.

  • Tests pass
  • Appropriate changes to README are included in PR

@davidz25 davidz25 added the library For issues related to the Identity Credential library label Nov 6, 2023
In order to support new kinds of SecureArea without app changes,
change the SecureArea.CreateKeySettings class so it can be
instantiated by apps.

Also stop carrying the SecureArea class name in CreateKeySettings
subclasses, instead have users of CreateKeySettings take a separate
SecureArea class. Make it explicit that different SecureArea instances
can be used by CredentialKey and even for different Authentication
Keys.

Introduce the concept of an "identifier" for a SecureArea instead
of Credential, Credential.Authentiationkey, and
Credential.PendingAuthenticationKey classes all using the Java class
name when persisting on-disk. This paves the way to have multiple
SecureArea instances of the same type but with different configuration.
We'll need this for CloudSecureArea so an app can have two instances
pointing to different providers, for different credentials. Also
add "display name" since that is needed for Issue #380.

Unfortunately this breaks the on-disk format but this is going
to happen _anyway_ as we're renaming the project and moving all
the code to new packages as part of the contribution of the
code to the OpenWallet Foundation. In the near future we'll start
committing to stable on-disk formats. For now, just update
the directory used for storing data in appholder to a new
location to avoid breaking existing installations.

Test: All unit tests pass.
Test: Manually tested
@davidz25 davidz25 force-pushed the generic-create-key-settings branch from ce80ca0 to ac69dc8 Compare November 7, 2023 13:01
@@ -31,7 +31,12 @@ object PreferencesHelper {
// As per the docs, the credential data contains reference to Keystore aliases so ensure
// this is stored in a location where it's not automatically backed up and restored by
// Android Backup as per https://developer.android.com/guide/topics/data/autobackup
return context.noBackupFilesDir

val storageDir = File(context.noBackupFilesDir, "appholder")
Copy link
Contributor

Choose a reason for hiding this comment

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

What's the reasoning for changing the storage dir here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's because we're breaking the on-disk format. Without this change, the application will load old data and crash. With this change, the app won't crash but it'll no credentials. At this point, such a breaking change is fine (it's just a test app after all) but as the commit message says, in the future we'll commit to stable file formats.

Copy link
Contributor

Choose a reason for hiding this comment

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

gotcha, thanks!

@davidz25 davidz25 merged commit 60fcadc into master Nov 7, 2023
5 checks passed
@davidz25 davidz25 deleted the generic-create-key-settings branch November 7, 2023 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
library For issues related to the Identity Credential library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants