Skip to content

Commit 1b1bb60

Browse files
committed
feat: manageMFA added.
Signed-off-by: Gaurav Goel <[email protected]>
1 parent 137c2ab commit 1b1bb60

File tree

5 files changed

+30
-4
lines changed

5 files changed

+30
-4
lines changed

Assets/Plugins/Web3AuthSDK/Samples/Web3AuthSample.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ void Start()
104104
web3Auth.onLogout += onLogout;
105105
web3Auth.onMFASetup += onMFASetup;
106106
web3Auth.onSignResponse += onSignResponse;
107+
web3Auth.onManageMFA += onManageMFA;
107108

108109
emailAddressField.gameObject.SetActive(false);
109110
logoutButton.gameObject.SetActive(false);
@@ -161,6 +162,10 @@ private void onSignResponse(SignResponse signResponse)
161162
Debug.Log("Retrieved SignResponse: " + signResponse);
162163
}
163164

165+
private void onManageMFA(bool response) {
166+
Debug.Log("Manage MFA: " + response);
167+
}
168+
164169
private void onVerifierDropDownChange(int selectedIndex)
165170
{
166171
if (verifierList[selectedIndex].loginProvider == Provider.EMAIL_PASSWORDLESS)
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
public class RedirectResponse
2+
{
3+
public string actionType;
4+
}

Assets/Plugins/Web3AuthSDK/Types/RedirectResponse.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/Plugins/Web3AuthSDK/Types/Web3AuthOptions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ public string walletSdkUrl {
4343
public string dashboardUrl {
4444
get {
4545
if (buildEnv == Web3Auth.BuildEnv.STAGING)
46-
return "https://staging-account.web3auth.io/wallet/account";
46+
return "https://staging-account.web3auth.io/v9/wallet/account";
4747
else if (buildEnv == Web3Auth.BuildEnv.TESTING)
4848
return "https://develop-account.web3auth.io/wallet/account";
4949
else
50-
return "https://account.web3auth.io/wallet/account";
50+
return "https://account.web3auth.io/v9/wallet/account";
5151
}
5252
set { }
5353
}

Assets/Plugins/Web3AuthSDK/Web3Auth.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ public enum Language
4747
public event Action<Web3AuthResponse> onLogin;
4848
public event Action onLogout;
4949
public event Action<bool> onMFASetup;
50+
public event Action<bool> onManageMFA;
5051
public event Action<SignResponse> onSignResponse;
5152

5253
private static SignResponse signResponse = null;
@@ -286,7 +287,7 @@ private async void processRequest(string path, LoginParams loginParams = null)
286287
//Debug.Log("loginParams.redirectUrl: =>" + loginParams.redirectUrl);
287288
var sessionId = KeyStoreManagerUtils.generateRandomSessionKey();
288289
if(path == "manage_mfa") {
289-
loginParams.dappUrl = this.initParams["dashboardUrl"].ToString();
290+
loginParams.dappUrl = this.initParams["redirectUrl"].ToString();
290291
loginParams.redirectUrl = new Uri(this.initParams["dashboardUrl"].ToString());
291292
this.initParams["redirectUrl"] = new Uri(this.initParams["dashboardUrl"].ToString());
292293
var loginIdObject = new Dictionary<string, string>
@@ -441,7 +442,12 @@ public void setResultUrl(Uri uri)
441442
string decodedString = decodeBase64Params(b64Params);
442443
if (decodedString.Contains("actionType"))
443444
{
444-
return;
445+
RedirectResponse response = JsonUtility.FromJson<RedirectResponse>(decodedString);
446+
if (response.actionType == "manage_mfa")
447+
{
448+
this.Enqueue(() => this.onManageMFA?.Invoke(true));
449+
return;
450+
}
445451
}
446452
if(isRequestResponse) {
447453
try

0 commit comments

Comments
 (0)