Ajuna.NetWallet
implements the basic functionality to create an account, and encrypt it on a device based filesystem.
It also:
- Supports mnemonic, AES, SR25519 and ED25519 encryption.
- Encodes and decodes substrate-based address formats in ss58.
Ajuna.NetWallet
ideally extends Ajuna.NetApi which is the basic framework for accessing and handling JSON-RPC connections and handling all standard RPC calls exposed by the rpc.methods()
of every substrate node.
// Check name validity
var wallet = new Wallet();
wallet.IsValidWalletName("1234"); // false
wallet.IsValidWalletName("wal_let"); // true
// Check password validity
wallet.IsValidPassword("1BCDefg"); // false
wallet.IsValidPassword("ABCDefg1"); // true
// Declare name, password and mnemonic
var walletName = "mnemonic_wallet";
var walletPassword = "aA1234dd"
var walletMnemonic = "tornado glad segment lift squirrel top ball soldier joy sudden edit advice";
var wallet = new Wallet();
// KeyType.Sr25519 and KeyType.Ed25519 can be both used.
wallet.Create(walletPassword, , KeyType.Sr25519, Mnemonic.BIP39Wordlist.English , walletName);
// Confirm that wallet was successfully created
var isCreated = wallet.IsCreated;
// We will load the wallet that we created in the example above
var walletToUnlock = new Wallet();
// Load wallet
walletToUnlock.Load("mnemonic_wallet");
// Unlock wallet with password
walletToUnlock.Unlock("aA1234dd");
// Confirm that wallet is unlocked
var isUnlocked = walletToUnlock.IsUnlocked;