You can also manage a wallet using JSON wallets that are securely encrypted and stored on the disk. This makes it easier to manage multiple wallets, especially for testing purposes.
You can create a random wallet and, at the same time, encrypt and store it. Then, later, you can recover the wallet if you know the master password:
const walletManager = new WalletManager();
const password = '0b540281-f87b-49ca-be37-2264c7f260f7';
const wallet = Wallet.generate();
await walletManager.unlock(password);
If you have already created a wallet Manager using a mnemonic phrase or a private key, you can also encrypt it and save it to disk:
await walletManager.lock();