Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
using System;
using UnityEngine.Scripting;

namespace Sequence.EmbeddedWallet
{
[Serializable]
[Preserve]
public class Account
{
public string email;
public string id;
public IdentityType identityType;
public string issuer;
public Address wallet; // This is not returned from the API - instead, we set it to the wallet address we are federating against when making the request

[Preserve]
public Account(string id, string type, string issuer, string email)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -605,8 +605,9 @@ public async Task ConnectToWaaSAsGuest()
await connector.ConnectToWaaSViaGuest();
}

private void StoreWalletSecurely(string waasWalletAddress, string email)
internal void StoreWalletSecurely(string waasWalletAddress, string email)
{
if (!_storeSessionWallet || !SecureStorageFactory.IsSupportedPlatform()) return;
ISecureStorage secureStorage = SecureStorageFactory.CreateSecureStorage();
byte[] privateKeyBytes = new byte[32];
_sessionWallet.privKey.WriteToSpan(privateKeyBytes);
Expand All @@ -620,6 +621,7 @@ public async Task FederateAccount(IntentDataFederateAccount federateAccount, Log
{
IntentResponseAccountFederated federateAccountResponse = await _intentSender.SendIntent<IntentResponseAccountFederated, IntentDataFederateAccount>(federateAccount, IntentType.FederateAccount);
Account account = federateAccountResponse.account;
account.wallet = new Address(federateAccount.wallet);
string responseEmail = account.email;
if (responseEmail != email.ToLower())
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,16 @@ public SequenceWallet(Address address, string sessionId, IIntentSender intentSen
SessionId = sessionId;
_builderApiKey = SequenceConfig.GetConfig(SequenceService.WaaS).BuilderAPIKey;
_email = email;

OnAccountFederated += account =>
{
if (String.Equals(account.wallet, address, StringComparison.CurrentCultureIgnoreCase))
{
_email = account.email;

SequenceLogin.GetInstance().StoreWalletSecurely(_address, _email);
}
};
}

public Address GetWalletAddress()
Expand Down
2 changes: 1 addition & 1 deletion Packages/Sequence-Unity/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "xyz.0xsequence.waas-unity",
"version": "4.0.3",
"version": "4.0.4",
"displayName": "Sequence Embedded Wallet SDK",
"description": "A Unity SDK for Sequence APIs",
"unity": "2021.3",
Expand Down