From 081e69fccef05836594b1833cbc49ea870dd6b25 Mon Sep 17 00:00:00 2001 From: Maximilian Haupt Date: Thu, 11 Dec 2025 15:50:56 +0100 Subject: [PATCH 1/2] Make sure the key store alias is globally unique If a user has installed multiple apps with this SDK, Android will throw an exception when the second app tries to use the same key pair alias. This will crash our SDK and the App. This commit makes sure the key is unique by including the property id in the string. --- lib/src/main/java/de/contentpass/lib/ContentPass.kt | 2 +- lib/src/main/java/de/contentpass/lib/KeyStore.kt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/src/main/java/de/contentpass/lib/ContentPass.kt b/lib/src/main/java/de/contentpass/lib/ContentPass.kt index 2719b42..1735f69 100644 --- a/lib/src/main/java/de/contentpass/lib/ContentPass.kt +++ b/lib/src/main/java/de/contentpass/lib/ContentPass.kt @@ -112,7 +112,7 @@ class ContentPass internal constructor( fun build(): ContentPass { configuration = grabConfiguration() val authorizer = Authorizer(configuration!!, context!!) - val store = TokenStore(context!!, KeyStore(context!!)) + val store = TokenStore(context!!, KeyStore(context!!, configuration!!.propertyId)) return ContentPass(authorizer, store, configuration!!) } diff --git a/lib/src/main/java/de/contentpass/lib/KeyStore.kt b/lib/src/main/java/de/contentpass/lib/KeyStore.kt index e4bae5d..6c86a07 100644 --- a/lib/src/main/java/de/contentpass/lib/KeyStore.kt +++ b/lib/src/main/java/de/contentpass/lib/KeyStore.kt @@ -18,9 +18,9 @@ import javax.crypto.spec.SecretKeySpec import javax.security.auth.x500.X500Principal import java.security.KeyStore as VendorKeyStore -internal class KeyStore(private val context: Context) { +internal class KeyStore(private val context: Context, private val propertyId: String) { private val keystoreName = "AndroidKeyStore" - private val keyPairAlias = "de.contentpass.KeyPair" + private val keyPairAlias = "de.contentpass.KeyPair.$propertyId" private val privateKey: PrivateKey private val publicKey: PublicKey private val keystore = VendorKeyStore.getInstance(keystoreName) From 71b187a2fcc11c533a7885be98aa8468ed219f47 Mon Sep 17 00:00:00 2001 From: Maximilian Haupt Date: Thu, 11 Dec 2025 15:52:19 +0100 Subject: [PATCH 2/2] Bump version to 2.2.2 --- README.md | 2 +- lib/build.gradle.kts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a9c7417..5a93e51 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ Our SDK is available on Maven Central. ```groovy -implementation 'de.contentpass:contentpass-android:2.2.1' +implementation 'de.contentpass:contentpass-android:2.2.2' ``` Add this to your app's `build.gradle` file's `dependencies` element. diff --git a/lib/build.gradle.kts b/lib/build.gradle.kts index d018348..c3899fe 100644 --- a/lib/build.gradle.kts +++ b/lib/build.gradle.kts @@ -58,7 +58,7 @@ kapt { extra.apply{ set("PUBLISH_GROUP_ID", "de.contentpass") set("PUBLISH_ARTIFACT_ID", "contentpass-android") - set("PUBLISH_VERSION", "2.2.1") + set("PUBLISH_VERSION", "2.2.2") } apply("${rootProject.projectDir}/scripts/publish-module.gradle")