Skip to content

Commit

Permalink
fix #98; removed secureAreaIdentifier from EudiWallet.getDefaultCreat…
Browse files Browse the repository at this point in the history
…eDocumentSettings extension; in DefaultKeyUnlockData check if keyInfo is AndroidKeystoreKeyInfo before creating AndroidKeystoreKeyUnlockData
  • Loading branch information
vkanellopoulos committed Nov 21, 2024
1 parent c54f576 commit 5de2417
Show file tree
Hide file tree
Showing 11 changed files with 375 additions and 91 deletions.
1 change: 1 addition & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@
| [eu.europa.ec.eudi.wallet.issue.openid4vci](wallet-core/eu.europa.ec.eudi.wallet.issue.openid4vci/index.md) |
| [eu.europa.ec.eudi.wallet.logging](wallet-core/eu.europa.ec.eudi.wallet.logging/index.md) |
| [eu.europa.ec.eudi.wallet.presentation](wallet-core/eu.europa.ec.eudi.wallet.presentation/index.md) |
| [eu.europa.ec.eudi.wallet.securearea](wallet-core/eu.europa.ec.eudi.wallet.securearea/index.md) |
| [eu.europa.ec.eudi.wallet.transfer.openId4vp](wallet-core/eu.europa.ec.eudi.wallet.transfer.openId4vp/index.md) |
| [eu.europa.ec.eudi.wallet.util](wallet-core/eu.europa.ec.eudi.wallet.util/index.md) |
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
@get:[JvmName](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.jvm/-jvm-name/index.html)(name =
"getDefaultKeyUnlockData")

val Document.[DefaultKeyUnlockData](-default-key-unlock-data.md): AndroidKeystoreKeyUnlockData
@get:[JvmStatic](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.jvm/-jvm-static/index.html)

val Document.[DefaultKeyUnlockData](-default-key-unlock-data.md): AndroidKeystoreKeyUnlockData?

Returns the default AndroidKeystoreKeyUnlockData for the Document instance. The default key unlock
data is based on the Document.keyAlias.
Expand All @@ -18,11 +20,18 @@ the Document instance

#### Return

the default AndroidKeystoreKeyUnlockData for the Document instance
the default AndroidKeystoreKeyUnlockData for the Document instance if document requires user
authentication

#### See also

| |
|------------------------------|
| AndroidKeystoreKeyUnlockData |
| Document |

#### Throws

| | |
|------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------|
| [IllegalStateException](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-illegal-state-exception/index.html) | if the Document is not managed by AndroidKeystoreSecureArea |
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,24 @@

@[JvmOverloads](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.jvm/-jvm-overloads/index.html)

@[JvmStatic](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.jvm/-jvm-static/index.html)

fun [EudiWallet](../../eu.europa.ec.eudi.wallet/-eudi-wallet/index.md).[getDefaultCreateDocumentSettings](get-default-create-document-settings.md)(
secureAreaIdentifier: [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)? =
null,
attestationChallenge: [ByteArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html)? =
null, configure: AndroidKeystoreCreateKeySettings.Builder.()
-> [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)? = null):
CreateDocumentSettings

Returns the default CreateDocumentSettings for
the [EudiWallet](../../eu.europa.ec.eudi.wallet/-eudi-wallet/index.md) instance. The default
settings are based on the EudiWalletConfig and the first available AndroidKeystoreSecureArea
implementation. The [attestationChallenge](get-default-create-document-settings.md) is generated
using
settings are based on
the [EudiWalletConfig](../../eu.europa.ec.eudi.wallet/-eudi-wallet-config/index.md) and the first
available AndroidKeystoreSecureArea implementation.
The [attestationChallenge](get-default-create-document-settings.md) is generated using
a [SecureRandom](https://developer.android.com/reference/kotlin/java/security/SecureRandom.html)
instance. The [configure](get-default-create-document-settings.md) lambda can be used to further
customize the AndroidKeystoreCreateKeySettings.
If [secureAreaIdentifier](get-default-create-document-settings.md) is not provided, the first
available AndroidKeystoreSecureArea implementation is used.
customize the AndroidKeystoreCreateKeySettings. The first available AndroidKeystoreSecureArea
implementation is used.

#### Receiver

Expand All @@ -36,11 +36,10 @@ the [EudiWallet](../../eu.europa.ec.eudi.wallet/-eudi-wallet/index.md) instance

androidJvm

| | |
|----------------------|-------------------------------------------------------------------------------------|
| secureAreaIdentifier | the AndroidKeystoreSecureArea.identifier where the document's keys should be stored |
| attestationChallenge | the attestation challenge to use when creating the keys |
| configure | a lambda to further customize the AndroidKeystoreCreateKeySettings |
| | |
|----------------------|--------------------------------------------------------------------|
| attestationChallenge | the attestation challenge to use when creating the keys |
| configure | a lambda to further customize the AndroidKeystoreCreateKeySettings |

#### See also

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
# getDefaultKeyUnlockData

[androidJvm]\

@[JvmName](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.jvm/-jvm-name/index.html)(name =
"getDefaultKeyUnlockData")

@[JvmStatic](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.jvm/-jvm-static/index.html)

fun [EudiWallet](../../eu.europa.ec.eudi.wallet/-eudi-wallet/index.md).[getDefaultKeyUnlockData](get-default-key-unlock-data.md)(
documentId: DocumentId): AndroidKeystoreKeyUnlockData?

Expand All @@ -15,8 +21,8 @@ the [EudiWallet](../../eu.europa.ec.eudi.wallet/-eudi-wallet/index.md) instance

#### Return

the default AndroidKeystoreKeyUnlockData for the given DocumentId or null if the document is not
found
the default AndroidKeystoreKeyUnlockData for the given DocumentId or null if the document requires
no user authentication

#### Parameters

Expand All @@ -32,3 +38,10 @@ androidJvm
|------------------------------|
| AndroidKeystoreKeyUnlockData |
| Document |

#### Throws

| | |
|---------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------|
| [IllegalStateException](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-illegal-state-exception/index.html) | if the Document is not managed by AndroidKeystoreSecureArea |
| [NoSuchElementException](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-no-such-element-exception/index.html) | if the document is not found by the DocumentId |
Loading

0 comments on commit 5de2417

Please sign in to comment.