Password protection
Check wallet recovery state
Copy
Ask AI
var state = await DynamicSDK.Instance.Wallets.Waas.GetWalletRecoveryState(wallet);
bool isPasswordProtected = state.IsPasswordEncrypted;
Set password on a wallet
Set a password on a wallet that doesn’t have one:Copy
Ask AI
await DynamicSDK.Instance.Wallets.Waas.SetPassword(wallet, "new_password");
Unlock a password-protected wallet
Copy
Ask AI
await DynamicSDK.Instance.Wallets.Waas.UnlockWallet(wallet, "password");
Update password
Copy
Ask AI
await DynamicSDK.Instance.Wallets.Waas.UpdatePassword(
wallet,
"old_password",
"new_password"
);
Complete example
Copy
Ask AI
using DynamicSDK.Core;
using UnityEngine;
using System.Linq;
public class EmbeddedWalletManager : MonoBehaviour
{
private BaseWallet _wallet;
private void Start()
{
_wallet = DynamicSDK.Instance.Wallets.UserWallets.FirstOrDefault();
}
public async void CheckPasswordStatus()
{
if (_wallet == null)
{
Debug.LogError("No wallet available");
return;
}
try
{
var state = await DynamicSDK.Instance.Wallets.Waas.GetWalletRecoveryState(_wallet);
if (state.IsPasswordEncrypted)
{
Debug.Log("Wallet is password protected");
}
else
{
Debug.Log("Wallet is not password protected");
}
}
catch (System.Exception ex)
{
Debug.LogError($"Failed to check password status: {ex.Message}");
}
}
public async void SetWalletPassword(string password)
{
if (_wallet == null)
{
Debug.LogError("No wallet available");
return;
}
try
{
await DynamicSDK.Instance.Wallets.Waas.SetPassword(_wallet, password);
Debug.Log("Password set successfully!");
}
catch (System.Exception ex)
{
Debug.LogError($"Failed to set password: {ex.Message}");
}
}
public async void UnlockWallet(string password)
{
if (_wallet == null)
{
Debug.LogError("No wallet available");
return;
}
try
{
await DynamicSDK.Instance.Wallets.Waas.UnlockWallet(_wallet, password);
Debug.Log("Wallet unlocked successfully!");
}
catch (System.Exception ex)
{
Debug.LogError($"Failed to unlock wallet: {ex.Message}");
}
}
public async void ChangePassword(string oldPassword, string newPassword)
{
if (_wallet == null)
{
Debug.LogError("No wallet available");
return;
}
try
{
await DynamicSDK.Instance.Wallets.Waas.UpdatePassword(
_wallet,
oldPassword,
newPassword
);
Debug.Log("Password updated successfully!");
}
catch (System.Exception ex)
{
Debug.LogError($"Failed to update password: {ex.Message}");
}
}
}
Next steps
- Wallet Creation - Learn about wallet management
- Delegated Access - Server-side signing