Skip to content

Commit 7981416

Browse files
committed
docs(mobile): document key authorization APIs
1 parent e738b4c commit 7981416

3 files changed

Lines changed: 45 additions & 3 deletions

File tree

waltid-libraries/protocols/waltid-openid4vc-wallet-mobile/src/iosMain/kotlin/id/walt/wallet2/mobile/swiftinterop/WalletSdkBridgeModels.kt

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,12 @@ public enum class WalletBridgeKeyUseAuthorizationPolicy {
8181
BiometricCurrentSet,
8282
}
8383

84-
/** Swift-facing localized operating-system authorization prompt text. */
84+
/**
85+
* Swift-facing localized operating-system authorization prompt text.
86+
*
87+
* @property message Reason shown to the user when authorizing a signing operation.
88+
* @property cancelText Cancellation action text where the platform supports configuring it.
89+
*/
8590
public data class WalletBridgeKeyUseAuthorizationPrompt(
8691
public val message: String = "Please authorize cryptographic signature",
8792
public val cancelText: String = "Cancel",
@@ -253,6 +258,10 @@ public interface WalletBridgeDidStore {
253258
* @property keyId Stable wallet-local key identifier.
254259
* @property keyType Wallet key type name.
255260
* @property algorithm Optional signing algorithm label supplied by Swift.
261+
* @property requestedKeyUseAuthorizationPolicy Policy requested when the key was created.
262+
* @property effectiveKeyUseAuthorizationPolicy Policy enforced by the restored key.
263+
* @property isPlatformBacked Whether the private key is held by a platform key store.
264+
* @property effectiveHardwareBacking Effective hardware backing when reliably determined.
256265
*/
257266
public data class WalletBridgeKeyInfo(
258267
public val keyId: String,
@@ -340,7 +349,19 @@ public interface WalletBridgeKeyGenerator {
340349
public suspend fun generateKey(keyType: MobileWalletKeyType): WalletBridgeStoredKey
341350
}
342351

343-
/** Swift-facing platform key capability result. */
352+
/**
353+
* Swift-facing platform key capability result.
354+
*
355+
* @property platform Mobile platform that evaluated the request.
356+
* @property keyType Requested signing-key type.
357+
* @property keyUseAuthorizationPolicy Requested immutable key-use authorization policy.
358+
* @property supported Whether this exact request can be enforced without fallback.
359+
* @property platformBackingAvailable Whether platform-backed key storage is available.
360+
* @property secureHardwareRequired Whether the request requires secure hardware backing.
361+
* @property secureHardwareAvailable Whether required secure hardware availability is known on this device.
362+
* @property effectiveHardwareBacking Effective backing when it can be determined from platform key information.
363+
* @property failure Stable reason the request is unsupported, or `null` when supported.
364+
*/
344365
public data class WalletBridgeKeyCapability(
345366
public val platform: String,
346367
public val keyType: MobileWalletKeyType,
@@ -607,6 +628,7 @@ public enum class WalletBridgeErrorCategory {
607628
* @property category Coarse failure category.
608629
* @property message Human-readable failure message.
609630
* @property causeClass Kotlin exception class name when available.
631+
* @property keyUseAuthorizationFailure Stable protected-key failure reason when available.
610632
*/
611633
@Serializable
612634
public data class WalletBridgeError(

waltid-libraries/protocols/waltid-openid4vc-wallet-persistence-mobile/src/commonMain/kotlin/id/walt/wallet2/persistence/keys/PlatformKeyModels.kt

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,13 @@ public enum class PlatformKeyPlatform {
1414
Custom,
1515
}
1616

17-
/** Explicit request for creating one mobile wallet signing key. */
17+
/**
18+
* Explicit request for creating one mobile wallet signing key.
19+
*
20+
* @property keyType Type of signing key to create.
21+
* @property keyId Optional platform key identifier. The provider assigns one when omitted.
22+
* @property keyUseAuthorizationPolicy Immutable authorization policy enforced by the created key.
23+
*/
1824
public data class PlatformKeyGenerationRequest(
1925
public val keyType: KeyType,
2026
public val keyId: String? = null,
@@ -26,6 +32,16 @@ public data class PlatformKeyGenerationRequest(
2632
*
2733
* [effectiveHardwareBacking] is populated only when reliable platform key information is available.
2834
* In particular, an Android preference for StrongBox is never reported as effective StrongBox backing.
35+
*
36+
* @property platform Mobile platform that evaluated the request.
37+
* @property keyType Requested signing-key type.
38+
* @property keyUseAuthorizationPolicy Requested immutable key-use authorization policy.
39+
* @property supported Whether the provider can enforce this exact request without fallback.
40+
* @property platformBackingAvailable Whether platform-backed key storage is available.
41+
* @property secureHardwareRequired Whether this request requires secure hardware backing.
42+
* @property secureHardwareAvailable Whether required secure hardware availability is known on this device.
43+
* @property effectiveHardwareBacking Effective backing when it can be determined from platform key information.
44+
* @property failure Stable reason the request is unsupported, or `null` when supported.
2945
*/
3046
public data class PlatformKeyCapability(
3147
public val platform: PlatformKeyPlatform,

waltid-libraries/protocols/waltid-openid4vc-wallet-persistence-mobile/src/commonMain/kotlin/id/walt/wallet2/persistence/stores/PlatformKeyStore.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ public class PlatformKeyStore(
2929
private val queries: WalletPersistenceQueries,
3030
) : WalletKeyStore {
3131

32+
/** This store persists requested and effective key-use authorization metadata. */
3233
override val supportsKeyUseAuthorizationMetadata: Boolean = true
3334

3435
/**
@@ -102,6 +103,9 @@ public class PlatformKeyStore(
102103
return persistKey(key, keyInfo = null)
103104
}
104105

106+
/**
107+
* Persists [key] together with creation-time authorization and backing metadata from [keyInfo].
108+
*/
105109
override suspend fun addKey(key: Key, keyInfo: WalletKeyInfo): String {
106110
return persistKey(key, keyInfo)
107111
}

0 commit comments

Comments
 (0)