Keystores provide a better way to handle private keys by storing them on encrypted files instead of on a regular .env or even exported on the terminal.
Default keystore directory: ~/foundry/keystore
# Creates a new private key and outputs to the terminal
cast wallet new
# Creates a new private key and saves on a file
cast wallet new ./pvt_keyIt will ask for a password that will be required to use the keystore on any action.
# Stores a private key on a encrypted keystore named `blockful`
cast wallet import blockful --private-key 0x....Remember to add a blank space at the beggining of the command so it doesn't get stored on the terminal history
# Runs a script using the given private key as signer
cast wallet script script/deploy/Contract.sol --account blockful# Signs a message using the given private key
cast wallet sign <MESSAGE> --account blockful
# Verifies a signature
cast wallet verify <MESSAGE> <SIGNATURE> --account blockful