diff --git a/Assets/Plugins/Web3AuthSDK/Samples/Web3AuthSample.cs b/Assets/Plugins/Web3AuthSDK/Samples/Web3AuthSample.cs index ea22279..f5069c0 100644 --- a/Assets/Plugins/Web3AuthSDK/Samples/Web3AuthSample.cs +++ b/Assets/Plugins/Web3AuthSDK/Samples/Web3AuthSample.cs @@ -94,7 +94,7 @@ void Start() {"CUSTOM_VERIFIER", loginConfigItem} } */ - clientId = "BPi5PB_UiIZ-cPz1GtV5i1I2iOSOHuimiXBI0e-Oe_u6X3oVAbCiAZOTEBtTXw4tsluTITPqA8zMsfxIKMjiqNQ", + clientId = "BFuUqebV5I8Pz5F7a5A2ihW7YVmbv_OHXnHYDv6OltAD5NGr6e-ViNvde3U4BHdn6HvwfkgobhVu4VwC-OSJkik", buildEnv = BuildEnv.TESTING, redirectUrl = new Uri("torusapp://com.torus.Web3AuthUnity/auth"), network = Web3Auth.Network.SAPPHIRE_DEVNET, @@ -103,6 +103,7 @@ void Start() web3Auth.onLogin += onLogin; web3Auth.onLogout += onLogout; web3Auth.onMFASetup += onMFASetup; + web3Auth.onSignResponse += onSignResponse; emailAddressField.gameObject.SetActive(false); logoutButton.gameObject.SetActive(false); @@ -116,7 +117,6 @@ void Start() mfaSetupButton.onClick.AddListener(enableMFA); launchWalletServicesButton.onClick.AddListener(launchWalletServices); signMessageButton.onClick.AddListener(request); - signResponseButton.onClick.AddListener(getSignResponse); verifierDropdown.AddOptions(verifierList.Select(x => x.name).ToList()); verifierDropdown.onValueChanged.AddListener(onVerifierDropDownChange); @@ -155,6 +155,10 @@ private void onMFASetup(bool response) { Debug.Log("MFA Setup: " + response); } + private void onSignResponse(SignResponse signResponse) + { + Debug.Log("Retrieved SignResponse: " + signResponse); + } private void onVerifierDropDownChange(int selectedIndex) { @@ -273,16 +277,4 @@ public string getPublicAddressFromPrivateKey(string privateKeyHex) return publicAddress; } - - public void getSignResponse() { - SignResponse signResponse = Web3Auth.getSignResponse(); - if (signResponse != null) - { - Debug.Log("Retrieved SignResponse: " + signResponse); - } - else - { - Debug.Log("SignResponse is null"); - } - } } diff --git a/Assets/Plugins/Web3AuthSDK/Web3Auth.cs b/Assets/Plugins/Web3AuthSDK/Web3Auth.cs index ca99b81..9255ac3 100644 --- a/Assets/Plugins/Web3AuthSDK/Web3Auth.cs +++ b/Assets/Plugins/Web3AuthSDK/Web3Auth.cs @@ -47,6 +47,7 @@ public enum Language public event Action onLogin; public event Action onLogout; public event Action onMFASetup; + public event Action onSignResponse; private static SignResponse signResponse = null; @@ -55,11 +56,6 @@ public static void setSignResponse(SignResponse _response) signResponse = _response; } - public static SignResponse getSignResponse() - { - return signResponse; - } - [SerializeField] private string clientId; @@ -409,7 +405,7 @@ public void setResultUrl(Uri uri) try { signResponse = JsonUtility.FromJson(decodedString); - setSignResponse(signResponse); + this.Enqueue(() => this.onSignResponse?.Invoke(signResponse)); } catch (Exception e) {