Skip to content

Commit

Permalink
comment logs
Browse files Browse the repository at this point in the history
  • Loading branch information
chaitanyapotti committed Oct 26, 2023
1 parent e107199 commit 6ee36d8
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 33 deletions.
52 changes: 26 additions & 26 deletions Assets/Plugins/Web3AuthSDK/Api/Web3AuthApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,18 @@ public IEnumerator authorizeSession(string key, Action<StoreApiResponse> callbac
//var request = UnityWebRequest.Get(requestURL);
WWWForm data = new WWWForm();
data.AddField("key", key);

var request = UnityWebRequest.Post($"{baseAddress}/store/get", data);

yield return request.SendWebRequest();
Debug.Log("baseAddress =>" + baseAddress);
Debug.Log("key =>" + key);
//Debug.Log("request URL =>"+ requestURL);
Debug.Log("request.isNetworkError =>" + request.isNetworkError);
Debug.Log("request.isHttpError =>" + request.isHttpError);
Debug.Log("request.isHttpError =>" + request.error);
Debug.Log("request.result =>" + request.result);
Debug.Log("request.downloadHandler.text =>" + request.downloadHandler.text);
// Debug.Log("baseAddress =>" + baseAddress);
// Debug.Log("key =>" + key);
// //Debug.Log("request URL =>"+ requestURL);
// Debug.Log("request.isNetworkError =>" + request.isNetworkError);
// Debug.Log("request.isHttpError =>" + request.isHttpError);
// Debug.Log("request.isHttpError =>" + request.error);
// Debug.Log("request.result =>" + request.result);
// Debug.Log("request.downloadHandler.text =>" + request.downloadHandler.text);
if (request.result == UnityWebRequest.Result.Success)
{
string result = request.downloadHandler.text;
Expand All @@ -51,7 +51,7 @@ public IEnumerator logout(LogoutApiRequest logoutApiRequest, Action<JObject> cal
data.AddField("data", logoutApiRequest.data);
data.AddField("signature", logoutApiRequest.signature);
data.AddField("timeout", logoutApiRequest.timeout.ToString());
Debug.Log("key during logout session =>" + logoutApiRequest.key);
// Debug.Log("key during logout session =>" + logoutApiRequest.key);

var request = UnityWebRequest.Post($"{baseAddress}/store/set", data);
yield return request.SendWebRequest();
Expand All @@ -66,22 +66,22 @@ public IEnumerator logout(LogoutApiRequest logoutApiRequest, Action<JObject> cal
}

public IEnumerator createSession(LogoutApiRequest logoutApiRequest, Action<JObject> callback)
{
WWWForm data = new WWWForm();
data.AddField("key", logoutApiRequest.key);
data.AddField("data", logoutApiRequest.data);
data.AddField("signature", logoutApiRequest.signature);
data.AddField("timeout", logoutApiRequest.timeout.ToString());
Debug.Log("key during create session =>" + logoutApiRequest.key);
var request = UnityWebRequest.Post($"{baseAddress}/store/set", data);
yield return request.SendWebRequest();
{
WWWForm data = new WWWForm();
data.AddField("key", logoutApiRequest.key);
data.AddField("data", logoutApiRequest.data);
data.AddField("signature", logoutApiRequest.signature);
data.AddField("timeout", logoutApiRequest.timeout.ToString());
// Debug.Log("key during create session =>" + logoutApiRequest.key);
var request = UnityWebRequest.Post($"{baseAddress}/store/set", data);
yield return request.SendWebRequest();

if (request.result == UnityWebRequest.Result.Success)
{
string result = request.downloadHandler.text;
callback(Newtonsoft.Json.JsonConvert.DeserializeObject<JObject>(result));
}
else
callback(null);
if (request.result == UnityWebRequest.Result.Success)
{
string result = request.downloadHandler.text;
callback(Newtonsoft.Json.JsonConvert.DeserializeObject<JObject>(result));
}
else
callback(null);
}
}
14 changes: 7 additions & 7 deletions Assets/Plugins/Web3AuthSDK/Web3Auth.cs
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ public void setResultUrl(Uri uri)
this.Enqueue(() => KeyStoreManagerUtils.savePreferenceData(KeyStoreManagerUtils.SESSION_ID, sessionId));

//call authorize session API
Debug.Log("publickey after successful redirection from web. =>" + sessionId);
// Debug.Log("publickey after successful redirection from web. =>" + sessionId);
this.Enqueue(() => authorizeSession(sessionId));

#if !UNITY_EDITOR && UNITY_WEBGL
Expand Down Expand Up @@ -360,17 +360,16 @@ private void authorizeSession(string newSessionId)
if (string.IsNullOrEmpty(newSessionId))
{
sessionId = KeyStoreManagerUtils.getPreferencesData(KeyStoreManagerUtils.SESSION_ID);
Debug.Log("sessionId during authorizeSession in if part =>" + sessionId);
// Debug.Log("sessionId during authorizeSession in if part =>" + sessionId);
}
else
{
sessionId = newSessionId;
Debug.Log("sessionId during authorizeSession in else part =>" + sessionId);
// Debug.Log("sessionId during authorizeSession in else part =>" + sessionId);
}

if (!string.IsNullOrEmpty(sessionId))
{ Debug.Log("sessionId during authorizeSession =>" + sessionId);
Debug.Log("public key during authorizeSession =>" + KeyStoreManagerUtils.getPubKey(sessionId));
{
var pubKey = KeyStoreManagerUtils.getPubKey(sessionId);
StartCoroutine(Web3AuthApi.getInstance().authorizeSession(pubKey, (response =>
{
Expand Down Expand Up @@ -484,7 +483,7 @@ private async Task<string> createSession(string data, long sessionTime)
{
TaskCompletionSource<string> createSessionResponse = new TaskCompletionSource<string>();
var newSessionKey = KeyStoreManagerUtils.generateRandomSessionKey();
Debug.Log("newSessionKey =>" + newSessionKey);
// Debug.Log("newSessionKey =>" + newSessionKey);
var ephemKey = KeyStoreManagerUtils.getPubKey(newSessionKey);
var ivKey = KeyStoreManagerUtils.generateRandomBytes();

Expand Down Expand Up @@ -518,7 +517,8 @@ private async Task<string> createSession(string data, long sessionTime)
if (result != null)
{
try
{ Debug.Log("newSessionKey before saving into keystore =>" + newSessionKey);
{
// Debug.Log("newSessionKey before saving into keystore =>" + newSessionKey);
this.Enqueue(() => KeyStoreManagerUtils.savePreferenceData(KeyStoreManagerUtils.SESSION_ID, newSessionKey));
createSessionResponse.SetResult(newSessionKey);
}
Expand Down

0 comments on commit 6ee36d8

Please sign in to comment.