From ba2ac6bceb0759e736da0b83afb08b5d61c3190e Mon Sep 17 00:00:00 2001 From: Gaurav Goel Date: Thu, 20 Jul 2023 19:47:15 +0530 Subject: [PATCH] update session-manager-android sdk and proguard rules for bouncycastle library Signed-off-by: Gaurav Goel --- core/build.gradle | 2 +- core/proguard-rules.pro | 3 +++ .../com/web3auth/core/keystore/KeyStoreManagerUtils.kt | 8 +++++--- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/core/build.gradle b/core/build.gradle index d2d0fc9..21d747a 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -68,7 +68,7 @@ dependencies { implementation 'org.web3j:core:4.8.8-android' //session-manager-sdk - implementation 'com.github.Web3Auth:session-manager-android:0.0.6' + implementation 'com.github.Web3Auth:session-manager-android:0.0.8' // Test testImplementation 'junit:junit:4.+' diff --git a/core/proguard-rules.pro b/core/proguard-rules.pro index 188122c..e5b2f96 100644 --- a/core/proguard-rules.pro +++ b/core/proguard-rules.pro @@ -13,6 +13,9 @@ # OkHttp platform used only on JVM and when Conscrypt dependency is available. -dontwarn okhttp3.internal.platform.ConscryptPlatform -keep class okhttp3.Headers { *; } +-keep class org.bouncycastle.jcajce.provider.** { *; } +-keep class org.bouncycastle.jce.provider.** { *; } +-keep class com.web3auth.session_manager_android.** #### GSON # Prevent proguard from stripping interface information from TypeAdapterFactory, diff --git a/core/src/main/java/com/web3auth/core/keystore/KeyStoreManagerUtils.kt b/core/src/main/java/com/web3auth/core/keystore/KeyStoreManagerUtils.kt index ffa1c42..fe54069 100644 --- a/core/src/main/java/com/web3auth/core/keystore/KeyStoreManagerUtils.kt +++ b/core/src/main/java/com/web3auth/core/keystore/KeyStoreManagerUtils.kt @@ -59,9 +59,11 @@ object KeyStoreManagerUtils { * Method to encrypt data with key */ fun encryptData(key: String, data: String) { - sharedPreferences.edit().putString(key, data)?.apply() - encryptedPairData = getEncryptedDataPair(data) - encryptedPairData.second.toString(UTF_8) + if (this::sharedPreferences.isInitialized) { + sharedPreferences.edit().putString(key, data)?.apply() + encryptedPairData = getEncryptedDataPair(data) + encryptedPairData.second.toString(UTF_8) + } } /**