Skip to content

Commit

Permalink
fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
chaitanyapotti committed Oct 12, 2023
1 parent 334a861 commit fff113c
Show file tree
Hide file tree
Showing 13 changed files with 98 additions and 61 deletions.
4 changes: 2 additions & 2 deletions Assets/Plugins/Web3AuthSDK/Samples/Web3AuthSample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ void Start()
{"CUSTOM_VERIFIER", loginConfigItem}
}
*/
clientId = "BG4pe3aBso5SjVbpotFQGnXVHgxhgOxnqnNBKyjfEJ3izFvIVWUaMIzoCrAfYag8O6t6a6AOvdLcS4JR2sQMjR4",
clientId = "BPi5PB_UiIZ-cPz1GtV5i1I2iOSOHuimiXBI0e-Oe_u6X3oVAbCiAZOTEBtTXw4tsluTITPqA8zMsfxIKMjiqNQ",
buildEnv = BuildEnv.PRODUCTION,
redirectUrl = new Uri("torusapp://com.torus.Web3AuthUnity/auth"),
network = Web3Auth.Network.SAPPHIRE_DEVNET
network = Web3Auth.Network.SAPPHIRE_MAINNET
});
web3Auth.onLogin += onLogin;
web3Auth.onLogout += onLogout;
Expand Down
6 changes: 3 additions & 3 deletions Assets/Plugins/Web3AuthSDK/Samples/Web3AuthSample.unity
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ RenderSettings:
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0.44657844, g: 0.49641222, b: 0.57481676, a: 1}
m_IndirectSpecularColor: {r: 0.4439372, g: 0.49315345, b: 0.5721989, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
Expand Down Expand Up @@ -896,9 +896,9 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 3eab2a0bf902d6e4b9c2e968ad89f528, type: 3}
m_Name:
m_EditorClassIdentifier:
clientId: BG4pe3aBso5SjVbpotFQGnXVHgxhgOxnqnNBKyjfEJ3izFvIVWUaMIzoCrAfYag8O6t6a6AOvdLcS4JR2sQMjR4
clientId: BPi5PB_UiIZ-cPz1GtV5i1I2iOSOHuimiXBI0e-Oe_u6X3oVAbCiAZOTEBtTXw4tsluTITPqA8zMsfxIKMjiqNQ
redirectUri: torusapp://com.torus.Web3AuthUnity/auth
network: 1
network: 5
--- !u!1 &529774071
GameObject:
m_ObjectHideFlags: 0
Expand Down
8 changes: 4 additions & 4 deletions Assets/Plugins/Web3AuthSDK/Types/MfaSetting.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.Collections.Generic;

#nullable enable
public class MfaSetting
{
public bool enable { get; set; }
Expand All @@ -9,8 +9,8 @@ public class MfaSetting
// Constructor
public MfaSetting(bool enable, int? priority, bool? mandatory)
{
enable = enable;
priority = priority;
mandatory = mandatory;
this.enable = enable;
this.priority = priority;
this.mandatory = mandatory;
}
}
11 changes: 11 additions & 0 deletions Assets/Plugins/Web3AuthSDK/Types/MfaSetting.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions Assets/Plugins/Web3AuthSDK/Types/MfaSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ public MfaSettings(
MfaSetting socialBackupFactor = null,
MfaSetting passwordFactor = null)
{
deviceShareFactor = deviceShareFactor;
backUpShareFactor = backUpShareFactor;
socialBackupFactor = socialBackupFactor;
passwordFactor = passwordFactor;
this.deviceShareFactor = deviceShareFactor;
this.backUpShareFactor = backUpShareFactor;
this.socialBackupFactor = socialBackupFactor;
this.passwordFactor = passwordFactor;
}
}
11 changes: 11 additions & 0 deletions Assets/Plugins/Web3AuthSDK/Types/MfaSettings.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Assets/Plugins/Web3AuthSDK/Types/Web3AuthOptions.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
#nullable enable

public class Web3AuthOptions {
public string clientId { get; set; }
Expand Down
3 changes: 1 addition & 2 deletions Assets/Plugins/Web3AuthSDK/Types/WhiteLabelData.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System.Collections.Generic;
using Newtonsoft.Json;

#nullable enable
public class WhiteLabelData {
public string? appName { get; set; }
public string? logoLight { get; set; }
Expand Down
64 changes: 37 additions & 27 deletions Assets/Plugins/Web3AuthSDK/Web3Auth.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public enum ChainNamespace
EIP155, SOLANA
}

public enum BuildEnv
public enum BuildEnv
{
PRODUCTION, STAGING, TESTING
}
Expand Down Expand Up @@ -246,7 +246,7 @@ private async void request(string path, LoginParams loginParams = null, Dictiona
this.initParams["redirectUrl"] = Utils.GetCurrentURL();
#endif

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

string loginId = await createSession(JsonConvert.SerializeObject(paramMap, Newtonsoft.Json.Formatting.None,
string loginId = await createSession(JsonConvert.SerializeObject(paramMap, Formatting.None,
new JsonSerializerSettings
{
NullValueHandling = NullValueHandling.Ignore
}), 600);
{
NullValueHandling = NullValueHandling.Ignore
}), 600);

if(!string.IsNullOrEmpty(loginId)) {
if (!string.IsNullOrEmpty(loginId))
{
var loginIdObject = new Dictionary<string, string>
{
{ "loginId", loginId }
};
string hash = Convert.ToBase64String(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(loginIdObject, Newtonsoft.Json.Formatting.None,
new JsonSerializerSettings
{
NullValueHandling = NullValueHandling.Ignore
})));

UriBuilder uriBuilder = new UriBuilder(this.web3AuthOptions.sdkUrl);
uriBuilder.Path = path;
uriBuilder.Fragment = "b64Params=" + hash;

Utils.LaunchUrl(uriBuilder.ToString(), this.initParams["redirectUrl"].ToString(), gameObject.name);
} else {
throw new Exception("Some went wrong. Please try again later.");
string hash = Convert.ToBase64String(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(loginIdObject, Formatting.None,
new JsonSerializerSettings
{
NullValueHandling = NullValueHandling.Ignore
})));

UriBuilder uriBuilder = new UriBuilder(this.web3AuthOptions.sdkUrl);
uriBuilder.Path = path;
uriBuilder.Fragment = "b64Params=" + hash;

Utils.LaunchUrl(uriBuilder.ToString(), this.initParams["redirectUrl"].ToString(), gameObject.name);
}
else
{
throw new Exception("Some went wrong. Please try again later.");
}
}

Expand Down Expand Up @@ -353,10 +356,13 @@ public void logout(Uri redirectUrl = null, string appState = null)
private void authorizeSession(string newSessionId)
{
string sessionId = "";
if(string.IsNullOrEmpty(newSessionId)) {
sessionId = KeyStoreManagerUtils.getPreferencesData(KeyStoreManagerUtils.SESSION_ID);
} else {
sessionId = newSessionId;
if (string.IsNullOrEmpty(newSessionId))
{
sessionId = KeyStoreManagerUtils.getPreferencesData(KeyStoreManagerUtils.SESSION_ID);
}
else
{
sessionId = newSessionId;
}

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

if (!string.IsNullOrEmpty(this.web3AuthResponse.sessionId)) {
if (!string.IsNullOrEmpty(this.web3AuthResponse.sessionId))
{
KeyStoreManagerUtils.savePreferenceData(KeyStoreManagerUtils.SESSION_ID, this.web3AuthResponse.sessionId);
}

Expand Down Expand Up @@ -469,7 +476,8 @@ private void sessionTimeOutAPI()
}
}

private async Task<string> createSession(string data, long sessionTime) {
private async Task<string> createSession(string data, long sessionTime)
{
TaskCompletionSource<string> createSessionResponse = new TaskCompletionSource<string>();
var newSessionKey = KeyStoreManagerUtils.generateRandomSessionKey();
var ephemKey = KeyStoreManagerUtils.getPubKey(newSessionKey);
Expand Down Expand Up @@ -514,7 +522,9 @@ private async Task<string> createSession(string data, long sessionTime) {
createSessionResponse.SetException(new Exception("Something went wrong. Please try again later."));
Debug.LogError(ex.Message);
}
} else {
}
else
{
createSessionResponse.SetException(new Exception("Something went wrong. Please try again later."));
}
}
Expand Down
10 changes: 5 additions & 5 deletions Packages/manifest.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"dependencies": {
"com.unity.ai.navigation": "1.1.4",
"com.unity.collab-proxy": "2.0.5",
"com.unity.ide.rider": "3.0.24",
"com.unity.ide.visualstudio": "2.0.18",
"com.unity.ai.navigation": "1.1.5",
"com.unity.collab-proxy": "2.1.0",
"com.unity.ide.rider": "3.0.25",
"com.unity.ide.visualstudio": "2.0.21",
"com.unity.ide.vscode": "1.2.5",
"com.unity.nuget.newtonsoft-json": "3.2.1",
"com.unity.test-framework": "1.1.33",
"com.unity.textmeshpro": "3.0.6",
"com.unity.timeline": "1.7.4",
"com.unity.timeline": "1.7.5",
"com.unity.ugui": "1.0.0",
"com.unity.modules.ai": "1.0.0",
"com.unity.modules.androidjni": "1.0.0",
Expand Down
10 changes: 5 additions & 5 deletions Packages/packages-lock.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"dependencies": {
"com.unity.ai.navigation": {
"version": "1.1.4",
"version": "1.1.5",
"depth": 0,
"source": "registry",
"dependencies": {
Expand All @@ -10,7 +10,7 @@
"url": "https://packages.unity.com"
},
"com.unity.collab-proxy": {
"version": "2.0.5",
"version": "2.1.0",
"depth": 0,
"source": "registry",
"dependencies": {},
Expand All @@ -24,7 +24,7 @@
"url": "https://packages.unity.com"
},
"com.unity.ide.rider": {
"version": "3.0.24",
"version": "3.0.25",
"depth": 0,
"source": "registry",
"dependencies": {
Expand All @@ -33,7 +33,7 @@
"url": "https://packages.unity.com"
},
"com.unity.ide.visualstudio": {
"version": "2.0.18",
"version": "2.0.21",
"depth": 0,
"source": "registry",
"dependencies": {
Expand Down Expand Up @@ -76,7 +76,7 @@
"url": "https://packages.unity.com"
},
"com.unity.timeline": {
"version": "1.7.4",
"version": "1.7.5",
"depth": 0,
"source": "registry",
"dependencies": {
Expand Down
19 changes: 12 additions & 7 deletions ProjectSettings/ProjectSettings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ PlayerSettings:
hideHomeButton: 0
submitAnalytics: 1
usePlayerLog: 1
dedicatedServerOptimizations: 0
bakeCollisionMeshes: 0
forceSingleInstance: 0
useFlipModelSwapchain: 1
Expand Down Expand Up @@ -125,6 +126,7 @@ PlayerSettings:
switchNVNMaxPublicTextureIDCount: 0
switchNVNMaxPublicSamplerIDCount: 0
switchNVNGraphicsFirmwareMemory: 32
switchMaxWorkerMultiple: 8
stadiaPresentMode: 0
stadiaTargetFramerate: 0
vulkanNumSwapchainBuffers: 3
Expand All @@ -145,6 +147,7 @@ PlayerSettings:
isWsaHolographicRemotingEnabled: 0
enableFrameTimingStats: 0
enableOpenGLProfilerGPURecorders: 1
allowHDRDisplaySupport: 0
useHDRDisplay: 0
hdrBitDepth: 0
m_ColorGamuts: 00000000
Expand All @@ -160,6 +163,7 @@ PlayerSettings:
buildNumber:
Bratwurst: 0
Standalone: 0
VisionOS: 0
iPhone: 0
tvOS: 0
overrideDefaultApplicationIdentifier: 1
Expand All @@ -184,8 +188,8 @@ PlayerSettings:
tvOSSdkVersion: 0
tvOSRequireExtendedGameController: 0
tvOSTargetOSVersionString: 12.0
bratwurstSdkVersion: 0
bratwurstTargetOSVersionString: 16.4
VisionOSSdkVersion: 0
VisionOSTargetOSVersionString: 1.0
uIPrerenderedIcon: 0
uIRequiresPersistentWiFi: 0
uIRequiresFullScreen: 1
Expand Down Expand Up @@ -234,11 +238,11 @@ PlayerSettings:
appleDeveloperTeamID:
iOSManualSigningProvisioningProfileID:
tvOSManualSigningProvisioningProfileID:
bratwurstManualSigningProvisioningProfileID:
VisionOSManualSigningProvisioningProfileID:
iOSManualSigningProvisioningProfileType: 0
tvOSManualSigningProvisioningProfileType: 0
bratwurstManualSigningProvisioningProfileType: 0
appleEnableAutomaticSigning: 0
VisionOSManualSigningProvisioningProfileType: 0
appleEnableAutomaticSigning: 1
iOSRequireARKit: 0
iOSAutomaticallyDetectAndAddCapabilities: 1
appleEnableProMotion: 0
Expand Down Expand Up @@ -515,6 +519,7 @@ PlayerSettings:
switchSocketConcurrencyLimit: 14
switchScreenResolutionBehavior: 2
switchUseCPUProfiler: 0
switchEnableFileSystemTrace: 0
switchUseGOLDLinker: 0
switchLTOSetting: 0
switchApplicationID: 0x01004b9000490000
Expand Down Expand Up @@ -645,7 +650,6 @@ PlayerSettings:
switchSocketBufferEfficiency: 4
switchSocketInitializeEnabled: 1
switchNetworkInterfaceManagerInitializeEnabled: 1
switchPlayerConnectionEnabled: 1
switchUseNewStyleFilepaths: 1
switchUseLegacyFmodPriorities: 0
switchUseMicroSleepForYield: 1
Expand Down Expand Up @@ -756,7 +760,8 @@ PlayerSettings:
webGLMemoryGeometricGrowthCap: 96
webGLPowerPreference: 2
scriptingDefineSymbols: {}
additionalCompilerArguments: {}
additionalCompilerArguments:
iPhone: []
platformArchitecture: {}
scriptingBackend:
Android: 1
Expand Down
4 changes: 2 additions & 2 deletions ProjectSettings/ProjectVersion.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
m_EditorVersion: 2022.3.4f1
m_EditorVersionWithRevision: 2022.3.4f1 (35713cd46cd7)
m_EditorVersion: 2022.3.11f1
m_EditorVersionWithRevision: 2022.3.11f1 (d00248457e15)

0 comments on commit fff113c

Please sign in to comment.