From 033a466b8f5ec89d36cf43d93e40a5e721628f61 Mon Sep 17 00:00:00 2001 From: Jakob Heher Date: Tue, 29 Oct 2024 10:07:43 +0100 Subject: [PATCH] all platform signing provider signers should be attestable --- .../asitplus/signum/supreme/os/AndroidKeyStoreProvider.kt | 2 +- .../at/asitplus/signum/supreme/os/SigningProvider.kt | 8 +++++--- .../at/asitplus/signum/supreme/os/IosKeychainProvider.kt | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/supreme/src/androidMain/kotlin/at/asitplus/signum/supreme/os/AndroidKeyStoreProvider.kt b/supreme/src/androidMain/kotlin/at/asitplus/signum/supreme/os/AndroidKeyStoreProvider.kt index c50173fd..77237e19 100644 --- a/supreme/src/androidMain/kotlin/at/asitplus/signum/supreme/os/AndroidKeyStoreProvider.kt +++ b/supreme/src/androidMain/kotlin/at/asitplus/signum/supreme/os/AndroidKeyStoreProvider.kt @@ -291,7 +291,7 @@ sealed class AndroidKeystoreSigner private constructor( val keyInfo: KeyInfo, private val config: AndroidSignerConfiguration, final override val attestation: AndroidKeystoreAttestation? -) : PlatformSigningProviderSigner, SignerI.Attestable { +) : PlatformSigningProviderSigner { final override val mayRequireUserUnlock: Boolean get() = this.needsAuthentication diff --git a/supreme/src/commonMain/kotlin/at/asitplus/signum/supreme/os/SigningProvider.kt b/supreme/src/commonMain/kotlin/at/asitplus/signum/supreme/os/SigningProvider.kt index 6172c2f1..b0107997 100644 --- a/supreme/src/commonMain/kotlin/at/asitplus/signum/supreme/os/SigningProvider.kt +++ b/supreme/src/commonMain/kotlin/at/asitplus/signum/supreme/os/SigningProvider.kt @@ -2,6 +2,7 @@ package at.asitplus.signum.supreme.os import at.asitplus.KmmResult import at.asitplus.catching +import at.asitplus.signum.indispensable.Attestation import at.asitplus.signum.indispensable.Digest import at.asitplus.signum.indispensable.RSAPadding import at.asitplus.signum.supreme.SignatureResult @@ -139,8 +140,9 @@ open class PlatformSigningProviderSignerSigningConfigurationBase internal constr open val unlockPrompt = childOrDefault(::UnlockPromptConfiguration) } -interface PlatformSigningProviderSigner - : Signer.WithAlias { +interface PlatformSigningProviderSigner + + : Signer.WithAlias, Signer.Attestable { suspend fun trySetupUninterruptedSigning(configure: DSLConfigureFn = null) : KmmResult = KmmResult.success(Unit) override suspend fun trySetupUninterruptedSigning() = trySetupUninterruptedSigning(null) @@ -160,7 +162,7 @@ internal expect fun getPlatformSigningProvider(configure: DSLConfigureFn, +interface PlatformSigningProviderI, out SignerConfigT: PlatformSignerConfigurationBase, out KeyConfigT: PlatformSigningKeyConfigurationBase<*>> : SigningProviderI { diff --git a/supreme/src/iosMain/kotlin/at/asitplus/signum/supreme/os/IosKeychainProvider.kt b/supreme/src/iosMain/kotlin/at/asitplus/signum/supreme/os/IosKeychainProvider.kt index d03b5a23..a23b910d 100644 --- a/supreme/src/iosMain/kotlin/at/asitplus/signum/supreme/os/IosKeychainProvider.kt +++ b/supreme/src/iosMain/kotlin/at/asitplus/signum/supreme/os/IosKeychainProvider.kt @@ -179,7 +179,7 @@ typealias IosSignerSigningConfiguration = PlatformSigningProviderSignerSigningCo sealed class IosSigner(final override val alias: String, private val metadata: IosKeyMetadata, private val signerConfig: IosSignerConfiguration) - : PlatformSigningProviderSigner, Signer.Attestable { + : PlatformSigningProviderSigner { override val mayRequireUserUnlock get() = needsAuthentication val needsAuthentication get() = metadata.needsUnlock