diff --git a/Assets/Plugins/Web3AuthSDK/Keystore/KeyStoreManagerUtils.cs b/Assets/Plugins/Web3AuthSDK/Keystore/KeyStoreManagerUtils.cs index f7bf3dc..7db3419 100644 --- a/Assets/Plugins/Web3AuthSDK/Keystore/KeyStoreManagerUtils.cs +++ b/Assets/Plugins/Web3AuthSDK/Keystore/KeyStoreManagerUtils.cs @@ -44,6 +44,11 @@ public static void deletePreferencesData(string key) SecurePlayerPrefs.DeleteKey(key); } + public static void clearPreferencesData() + { + SecurePlayerPrefs.DeleteAll(); + } + public static string getECDSASignature(string privateKey, string data){ var curve = SecNamedCurves.GetByName("secp256k1"); var domain = new ECDomainParameters(curve.Curve, curve.G, curve.N, curve.H); diff --git a/Assets/Plugins/Web3AuthSDK/Web3Auth.cs b/Assets/Plugins/Web3AuthSDK/Web3Auth.cs index c7b704a..ede7a01 100644 --- a/Assets/Plugins/Web3AuthSDK/Web3Auth.cs +++ b/Assets/Plugins/Web3AuthSDK/Web3Auth.cs @@ -242,10 +242,28 @@ public void setResultUrl(Uri uri) if (!string.IsNullOrEmpty(this.web3AuthResponse.sessionId)) this.Enqueue(() => KeyStoreManagerUtils.savePreferenceData(KeyStoreManagerUtils.SESSION_ID, this.web3AuthResponse.sessionId) ); + + if (!string.IsNullOrEmpty(web3AuthResponse.userInfo?.dappShare)) + { + KeyStoreManagerUtils.savePreferenceData( + web3AuthResponse.userInfo?.verifier, web3AuthResponse.userInfo?.dappShare + ); + } } public void login(LoginParams loginParams) { + if (web3AuthOptions.loginConfig != null) + { + var loginConfigItem = web3AuthOptions.loginConfig?.Values.First(); + var share = KeyStoreManagerUtils.getPreferencesData(loginConfigItem?.verifier); + + if (!string.IsNullOrEmpty(share)) + { + loginParams.dappShare = share; + } + } + request("login", loginParams); } @@ -366,12 +384,10 @@ private void sessionTimeOutAPI() ); - //if (result != null) - //{ - // //Delete local storage - // var loginConfigItem = web3AuthOptions.loginConfig.Values.First(); - // KeyStoreManagerUtils.deletePreferencesData(loginConfigItem.verifier); - //} + if (result != null) + { + KeyStoreManagerUtils.clearPreferencesData(); + } } }