Skip to content

Commit fff113c

Browse files
fix bugs
1 parent 334a861 commit fff113c

File tree

13 files changed

+98
-61
lines changed

13 files changed

+98
-61
lines changed

Assets/Plugins/Web3AuthSDK/Samples/Web3AuthSample.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,10 @@ void Start()
7272
{"CUSTOM_VERIFIER", loginConfigItem}
7373
}
7474
*/
75-
clientId = "BG4pe3aBso5SjVbpotFQGnXVHgxhgOxnqnNBKyjfEJ3izFvIVWUaMIzoCrAfYag8O6t6a6AOvdLcS4JR2sQMjR4",
75+
clientId = "BPi5PB_UiIZ-cPz1GtV5i1I2iOSOHuimiXBI0e-Oe_u6X3oVAbCiAZOTEBtTXw4tsluTITPqA8zMsfxIKMjiqNQ",
7676
buildEnv = BuildEnv.PRODUCTION,
7777
redirectUrl = new Uri("torusapp://com.torus.Web3AuthUnity/auth"),
78-
network = Web3Auth.Network.SAPPHIRE_DEVNET
78+
network = Web3Auth.Network.SAPPHIRE_MAINNET
7979
});
8080
web3Auth.onLogin += onLogin;
8181
web3Auth.onLogout += onLogout;

Assets/Plugins/Web3AuthSDK/Samples/Web3AuthSample.unity

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ RenderSettings:
3838
m_ReflectionIntensity: 1
3939
m_CustomReflection: {fileID: 0}
4040
m_Sun: {fileID: 0}
41-
m_IndirectSpecularColor: {r: 0.44657844, g: 0.49641222, b: 0.57481676, a: 1}
41+
m_IndirectSpecularColor: {r: 0.4439372, g: 0.49315345, b: 0.5721989, a: 1}
4242
m_UseRadianceAmbientProbe: 0
4343
--- !u!157 &3
4444
LightmapSettings:
@@ -896,9 +896,9 @@ MonoBehaviour:
896896
m_Script: {fileID: 11500000, guid: 3eab2a0bf902d6e4b9c2e968ad89f528, type: 3}
897897
m_Name:
898898
m_EditorClassIdentifier:
899-
clientId: BG4pe3aBso5SjVbpotFQGnXVHgxhgOxnqnNBKyjfEJ3izFvIVWUaMIzoCrAfYag8O6t6a6AOvdLcS4JR2sQMjR4
899+
clientId: BPi5PB_UiIZ-cPz1GtV5i1I2iOSOHuimiXBI0e-Oe_u6X3oVAbCiAZOTEBtTXw4tsluTITPqA8zMsfxIKMjiqNQ
900900
redirectUri: torusapp://com.torus.Web3AuthUnity/auth
901-
network: 1
901+
network: 5
902902
--- !u!1 &529774071
903903
GameObject:
904904
m_ObjectHideFlags: 0
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
using System.Collections.Generic;
2-
2+
#nullable enable
33
public class MfaSetting
44
{
55
public bool enable { get; set; }
@@ -9,8 +9,8 @@ public class MfaSetting
99
// Constructor
1010
public MfaSetting(bool enable, int? priority, bool? mandatory)
1111
{
12-
enable = enable;
13-
priority = priority;
14-
mandatory = mandatory;
12+
this.enable = enable;
13+
this.priority = priority;
14+
this.mandatory = mandatory;
1515
}
1616
}

Assets/Plugins/Web3AuthSDK/Types/MfaSetting.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/MfaSettings.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ public MfaSettings(
3636
MfaSetting socialBackupFactor = null,
3737
MfaSetting passwordFactor = null)
3838
{
39-
deviceShareFactor = deviceShareFactor;
40-
backUpShareFactor = backUpShareFactor;
41-
socialBackupFactor = socialBackupFactor;
42-
passwordFactor = passwordFactor;
39+
this.deviceShareFactor = deviceShareFactor;
40+
this.backUpShareFactor = backUpShareFactor;
41+
this.socialBackupFactor = socialBackupFactor;
42+
this.passwordFactor = passwordFactor;
4343
}
4444
}

Assets/Plugins/Web3AuthSDK/Types/MfaSettings.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: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Collections.Generic;
3+
#nullable enable
34

45
public class Web3AuthOptions {
56
public string clientId { get; set; }

Assets/Plugins/Web3AuthSDK/Types/WhiteLabelData.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System.Collections.Generic;
2-
using Newtonsoft.Json;
3-
2+
#nullable enable
43
public class WhiteLabelData {
54
public string? appName { get; set; }
65
public string? logoLight { get; set; }

Assets/Plugins/Web3AuthSDK/Web3Auth.cs

Lines changed: 37 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public enum ChainNamespace
2323
EIP155, SOLANA
2424
}
2525

26-
public enum BuildEnv
26+
public enum BuildEnv
2727
{
2828
PRODUCTION, STAGING, TESTING
2929
}
@@ -246,7 +246,7 @@ private async void request(string path, LoginParams loginParams = null, Dictiona
246246
this.initParams["redirectUrl"] = Utils.GetCurrentURL();
247247
#endif
248248

249-
loginParams.redirectUrl = new Uri(StartLocalWebserver());
249+
loginParams.redirectUrl = loginParams.redirectUrl ?? new Uri(this.initParams["redirectUrl"].ToString());
250250
Dictionary<string, object> paramMap = new Dictionary<string, object>();
251251
paramMap["options"] = this.initParams;
252252
paramMap["params"] = loginParams == null ? (object)new Dictionary<string, object>() : (object)loginParams;
@@ -258,30 +258,33 @@ private async void request(string path, LoginParams loginParams = null, Dictiona
258258
(paramMap["params"] as Dictionary<string, object>)[item.Key] = item.Value;
259259
}
260260

261-
string loginId = await createSession(JsonConvert.SerializeObject(paramMap, Newtonsoft.Json.Formatting.None,
261+
string loginId = await createSession(JsonConvert.SerializeObject(paramMap, Formatting.None,
262262
new JsonSerializerSettings
263-
{
264-
NullValueHandling = NullValueHandling.Ignore
265-
}), 600);
263+
{
264+
NullValueHandling = NullValueHandling.Ignore
265+
}), 600);
266266

267-
if(!string.IsNullOrEmpty(loginId)) {
267+
if (!string.IsNullOrEmpty(loginId))
268+
{
268269
var loginIdObject = new Dictionary<string, string>
269270
{
270271
{ "loginId", loginId }
271272
};
272-
string hash = Convert.ToBase64String(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(loginIdObject, Newtonsoft.Json.Formatting.None,
273-
new JsonSerializerSettings
274-
{
275-
NullValueHandling = NullValueHandling.Ignore
276-
})));
277-
278-
UriBuilder uriBuilder = new UriBuilder(this.web3AuthOptions.sdkUrl);
279-
uriBuilder.Path = path;
280-
uriBuilder.Fragment = "b64Params=" + hash;
281-
282-
Utils.LaunchUrl(uriBuilder.ToString(), this.initParams["redirectUrl"].ToString(), gameObject.name);
283-
} else {
284-
throw new Exception("Some went wrong. Please try again later.");
273+
string hash = Convert.ToBase64String(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(loginIdObject, Formatting.None,
274+
new JsonSerializerSettings
275+
{
276+
NullValueHandling = NullValueHandling.Ignore
277+
})));
278+
279+
UriBuilder uriBuilder = new UriBuilder(this.web3AuthOptions.sdkUrl);
280+
uriBuilder.Path = path;
281+
uriBuilder.Fragment = "b64Params=" + hash;
282+
283+
Utils.LaunchUrl(uriBuilder.ToString(), this.initParams["redirectUrl"].ToString(), gameObject.name);
284+
}
285+
else
286+
{
287+
throw new Exception("Some went wrong. Please try again later.");
285288
}
286289
}
287290

@@ -353,10 +356,13 @@ public void logout(Uri redirectUrl = null, string appState = null)
353356
private void authorizeSession(string newSessionId)
354357
{
355358
string sessionId = "";
356-
if(string.IsNullOrEmpty(newSessionId)) {
357-
sessionId = KeyStoreManagerUtils.getPreferencesData(KeyStoreManagerUtils.SESSION_ID);
358-
} else {
359-
sessionId = newSessionId;
359+
if (string.IsNullOrEmpty(newSessionId))
360+
{
361+
sessionId = KeyStoreManagerUtils.getPreferencesData(KeyStoreManagerUtils.SESSION_ID);
362+
}
363+
else
364+
{
365+
sessionId = newSessionId;
360366
}
361367

362368
if (!string.IsNullOrEmpty(sessionId))
@@ -386,7 +392,8 @@ private void authorizeSession(string newSessionId)
386392
throw new UnKnownException(this.web3AuthResponse.error ?? "Something went wrong");
387393
}
388394

389-
if (!string.IsNullOrEmpty(this.web3AuthResponse.sessionId)) {
395+
if (!string.IsNullOrEmpty(this.web3AuthResponse.sessionId))
396+
{
390397
KeyStoreManagerUtils.savePreferenceData(KeyStoreManagerUtils.SESSION_ID, this.web3AuthResponse.sessionId);
391398
}
392399

@@ -469,7 +476,8 @@ private void sessionTimeOutAPI()
469476
}
470477
}
471478

472-
private async Task<string> createSession(string data, long sessionTime) {
479+
private async Task<string> createSession(string data, long sessionTime)
480+
{
473481
TaskCompletionSource<string> createSessionResponse = new TaskCompletionSource<string>();
474482
var newSessionKey = KeyStoreManagerUtils.generateRandomSessionKey();
475483
var ephemKey = KeyStoreManagerUtils.getPubKey(newSessionKey);
@@ -514,7 +522,9 @@ private async Task<string> createSession(string data, long sessionTime) {
514522
createSessionResponse.SetException(new Exception("Something went wrong. Please try again later."));
515523
Debug.LogError(ex.Message);
516524
}
517-
} else {
525+
}
526+
else
527+
{
518528
createSessionResponse.SetException(new Exception("Something went wrong. Please try again later."));
519529
}
520530
}

Packages/manifest.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
{
22
"dependencies": {
3-
"com.unity.ai.navigation": "1.1.4",
4-
"com.unity.collab-proxy": "2.0.5",
5-
"com.unity.ide.rider": "3.0.24",
6-
"com.unity.ide.visualstudio": "2.0.18",
3+
"com.unity.ai.navigation": "1.1.5",
4+
"com.unity.collab-proxy": "2.1.0",
5+
"com.unity.ide.rider": "3.0.25",
6+
"com.unity.ide.visualstudio": "2.0.21",
77
"com.unity.ide.vscode": "1.2.5",
88
"com.unity.nuget.newtonsoft-json": "3.2.1",
99
"com.unity.test-framework": "1.1.33",
1010
"com.unity.textmeshpro": "3.0.6",
11-
"com.unity.timeline": "1.7.4",
11+
"com.unity.timeline": "1.7.5",
1212
"com.unity.ugui": "1.0.0",
1313
"com.unity.modules.ai": "1.0.0",
1414
"com.unity.modules.androidjni": "1.0.0",

0 commit comments

Comments
 (0)