V3 keystore
This example demonstrates how to encrypt and decrypt keystore V3.
Import the Web3 class from the @kaiachain/web3js-ext package.
Set up the provider and define a web3 instance using the provider.
Encrypted key and password information are declared.
You can also create a key with the web3.eth.accounts.create().encrypt() function.
Decrypt account from the encryptedKey with the password.
You can check address and privateKey of the account.
Encrypt the account with another password2. And it will make another encryptedKey2.
Re-decrypt the account2 from encryptedKey2 with password2 and check if the address and privateKey of the account2 are same with the info of the account from encryptedKey.
Because the account2 is same to account and already exists in the wallet, so we need to delete existing account with the web3.eth.accounts.wallet.remove() function before re-decrypting account2.
Execute the main function.