This page uses machine translation from English, which may contain errors or unclear language. For the most accurate information, please see the original English version. Some content may be in the original English due to frequent updates. Help us improve this page's translation by joining our effort on Crowdin. (Crowdin translation page, Contributing guide)
V4 keystore single
This example demonstrates how to encrypt and decrypt keystore V4 single.
Import the Web3 class from the @kaiachain/web3js-ext package.
Set up the provider and define a web3 instance using the provider.
Define an encrypted keystore version 4
Specify the current password of the keystore and a new password.
Load the keystore with its current password
After decryped, you can access the public and private key.
You can generate a new keystore using the descrypted key and a new password. Note that the new encrypted key will be a keystore v3.
Check the new keystore public and private key, it will differ from original one since keystore v3 does not support klaytn account system.