Skip to content

Commit

Permalink
Merge pull request #59 from Web3Auth/bump-session-manager-sdk
Browse files Browse the repository at this point in the history
bump library deps
  • Loading branch information
chaitanyapotti authored Jul 18, 2023
2 parents 3ee92e9 + a73fcc2 commit a632470
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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.3'
implementation 'com.github.Web3Auth:session-manager-android:0.0.5'

// Test
testImplementation 'junit:junit:4.+'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,18 +82,20 @@ object KeyStoreManagerUtils {
fun decryptData(key: String): String? {
var result: String? = null
try {
val sharedPreferenceIds = sharedPreferences.all
sharedPreferenceIds.forEach {
if (it.key.contains(key)) {
result = sharedPreferences.getString(it.key, "")
if (this::sharedPreferences.isInitialized) {
val sharedPreferenceIds = sharedPreferences.all
sharedPreferenceIds.forEach {
if (it.key.contains(key)) {
result = sharedPreferences.getString(it.key, "")
}
}
if (result == null) return null
val encryptedPairData = result?.let { getEncryptedDataPair(it) }
val cipher = Cipher.getInstance(TRANSFORMATION)
val keySpec = IvParameterSpec(encryptedPairData?.first)
cipher.init(Cipher.DECRYPT_MODE, getKey(), keySpec)
return cipher.doFinal(encryptedPairData?.second).toString(UTF_8)
}
if (result == null) return null
val encryptedPairData = result?.let { getEncryptedDataPair(it) }
val cipher = Cipher.getInstance(TRANSFORMATION)
val keySpec = IvParameterSpec(encryptedPairData?.first)
cipher.init(Cipher.DECRYPT_MODE, getKey(), keySpec)
return cipher.doFinal(encryptedPairData?.second).toString(UTF_8)
} catch (ex: Exception) {
ex.printStackTrace()
}
Expand Down

0 comments on commit a632470

Please sign in to comment.