Skip to content

Commit

Permalink
Merge branch 'master' of github.com:web3auth/web3auth-unity-sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
chaitanyapotti committed Jul 14, 2023
2 parents adc67f7 + 136763f commit 1391f3e
Show file tree
Hide file tree
Showing 18 changed files with 14 additions and 10 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
24 changes: 14 additions & 10 deletions Assets/Plugins/Web3AuthSDK/Web3Auth.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
using Org.BouncyCastle.Math;
using Newtonsoft.Json.Linq;

public class Web3Auth: MonoBehaviour
public class Web3Auth : MonoBehaviour
{
public enum Network
{
Expand Down Expand Up @@ -86,7 +86,10 @@ public void setOptions(Web3AuthOptions web3AuthOptions)

if (this.web3AuthOptions.loginConfig != null)
this.initParams["loginConfig"] = JsonConvert.SerializeObject(this.web3AuthOptions.loginConfig);


if (this.web3AuthOptions.clientId != null)
this.initParams["clientId"] = this.web3AuthOptions.clientId;

}

private void onDeepLinkActivated(string url)
Expand Down Expand Up @@ -204,7 +207,7 @@ private void IncomingHttpRequest(IAsyncResult result)
}
#endif

private void request(string path, LoginParams loginParams = null, Dictionary<string, object> extraParams = null)
private void request(string path, LoginParams loginParams = null, Dictionary<string, object> extraParams = null)
{
#if UNITY_STANDALONE || UNITY_EDITOR
this.initParams["redirectUrl"] = StartLocalWebserver();
Expand All @@ -216,9 +219,9 @@ private void request(string path, LoginParams loginParams = null, Dictionary<st
paramMap["params"] = loginParams == null ? (object)new Dictionary<string, object>() : (object)loginParams;

if (extraParams != null && extraParams.Count > 0)
foreach(KeyValuePair<string, object> item in extraParams)
foreach (KeyValuePair<string, object> item in extraParams)
{
(paramMap["params"] as Dictionary<string, object>) [item.Key] = item.Value;
(paramMap["params"] as Dictionary<string, object>)[item.Key] = item.Value;
}

string hash = Convert.ToBase64String(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(paramMap, Newtonsoft.Json.Formatting.None,
Expand Down Expand Up @@ -261,7 +264,7 @@ public void setResultUrl(Uri uri)
this.Enqueue(() => this.onLogin?.Invoke(this.web3AuthResponse));

if (!string.IsNullOrEmpty(this.web3AuthResponse.sessionId))
this.Enqueue(() => KeyStoreManagerUtils.savePreferenceData(KeyStoreManagerUtils.SESSION_ID, this.web3AuthResponse.sessionId) );
this.Enqueue(() => KeyStoreManagerUtils.savePreferenceData(KeyStoreManagerUtils.SESSION_ID, this.web3AuthResponse.sessionId));

if (!string.IsNullOrEmpty(web3AuthResponse.userInfo?.dappShare))
{
Expand Down Expand Up @@ -419,15 +422,15 @@ private void sessionTimeOutAPI()
public string getPrivKey()
{
if (web3AuthResponse == null)
return null;
return "";

return web3AuthOptions.useCoreKitKey.Value ? web3AuthResponse.coreKitKey : web3AuthResponse.privKey;
return web3AuthOptions.useCoreKitKey.Value ? web3AuthResponse.coreKitKey : web3AuthResponse.privKey;
}

public string getEd25519PrivKey()
{
if (web3AuthResponse == null)
return null;
return "";

return web3AuthOptions.useCoreKitKey.Value ? web3AuthResponse.coreKitEd25519PrivKey : web3AuthResponse.ed25519PrivKey;
}
Expand Down Expand Up @@ -455,7 +458,8 @@ private void Enqueue(Action action)
{
lock (_executionQueue)
{
_executionQueue.Enqueue(() => {
_executionQueue.Enqueue(() =>
{
StartCoroutine(ActionWrapper(action));
});
}
Expand Down

0 comments on commit 1391f3e

Please sign in to comment.