File tree Expand file tree Collapse file tree 4 files changed +12
-33
lines changed
Expand file tree Collapse file tree 4 files changed +12
-33
lines changed Original file line number Diff line number Diff line change 33 package =" com.web3auth.core" >
44
55 <uses-permission android : name =" android.permission.INTERNET" />
6-
7- <application
8- android : name =" .Web3AuthApp" />
9-
106 <queries >
117 <intent >
128 <action android : name =" android.support.customtabs.action.CustomTabsService" />
Original file line number Diff line number Diff line change @@ -54,11 +54,6 @@ class Web3Auth(web3AuthOptions: Web3AuthOptions) {
5454 private var web3AuthOption = web3AuthOptions
5555
5656 init {
57- // initiate keyStore
58- if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .M ) {
59- initiateKeyStoreManager()
60- }
61-
6257 // Build init params
6358 val initParams = mutableMapOf (
6459 " clientId" to web3AuthOptions.clientId,
@@ -74,11 +69,15 @@ class Web3Auth(web3AuthOptions: Web3AuthOptions) {
7469 this .initParams = initParams
7570 this .context = web3AuthOptions.context
7671
72+ KeyStoreManagerUtils .initializePreferences(context.applicationContext)
73+
74+ // initiate keyStore
75+ initiateKeyStoreManager()
76+
7777 // authorize session
7878 authorizeSession()
7979 }
8080
81- @RequiresApi(Build .VERSION_CODES .M )
8281 private fun initiateKeyStoreManager () {
8382 KeyStoreManagerUtils .getKeyGenerator()
8483 }
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 11package com.web3auth.core.keystore
22
3+ import android.content.Context
34import android.security.keystore.KeyGenParameterSpec
45import android.security.keystore.KeyProperties
56import androidx.security.crypto.EncryptedSharedPreferences
67import androidx.security.crypto.MasterKeys
7- import com.web3auth.core.Web3AuthApp
88import org.bouncycastle.asn1.ASN1EncodableVector
99import org.bouncycastle.asn1.ASN1Integer
1010import org.bouncycastle.asn1.DERSequence
@@ -33,14 +33,16 @@ object KeyStoreManagerUtils {
3333 private lateinit var encryptedPairData: Pair <ByteArray , ByteArray >
3434
3535 private val masterKeyAlias = MasterKeys .getOrCreate(MasterKeys .AES256_GCM_SPEC )
36- private val sharedPreferences = Web3AuthApp .getContext()?.let {
37- EncryptedSharedPreferences .create(
36+ private lateinit var sharedPreferences: EncryptedSharedPreferences
37+
38+ fun initializePreferences (context : Context ) {
39+ sharedPreferences = EncryptedSharedPreferences .create(
3840 " Web3Auth" ,
3941 masterKeyAlias,
40- it ,
42+ context ,
4143 EncryptedSharedPreferences .PrefKeyEncryptionScheme .AES256_SIV ,
4244 EncryptedSharedPreferences .PrefValueEncryptionScheme .AES256_GCM
43- )
45+ ) as EncryptedSharedPreferences
4446 }
4547
4648 /* *
You can’t perform that action at this time.
0 commit comments