Expand description
Encrypted wallet persistence.
Default: Web3 Secret Storage v3 JSON (Foundry/Geth/MetaMask-interoperable),
resolved under $XDG_DATA_HOME/taskfast/wallets/ so a wallet generated here
can be imported by cast wallet import without conversion.
This module owns two concerns and nothing else:
- Path resolution — XDG-compliant directory layout with
0700perms on the containing dir and0600perms on the keyfile. - Encrypt/decrypt — thin wrappers around
PrivateKeySigner::encrypt_keystore/decrypt_keystore, which delegate toeth-keystorefor the scrypt+AES-128-CTR pipeline.
§Future: OS keychain
KeySource::Keychain is reserved but not yet implemented. When it lands,
it’ll go behind a keyring cargo feature so the default build has no
dbus/secret-service transitive deps. CLI sandboxes that need portable
persistence should use the file backend; keychain support is targeted at
interactive dev boxes.
Enums§
- KeySource
- Where a wallet private key is (or will be) stored.
- Keystore
Error
Functions§
- default_
keyfile_ name - Canonical filename for a wallet keyed by its address: lowercase hex,
no
0xprefix,.jsonsuffix. Matches the shapecast wallet importproduces when given--keystore-dirwithout an explicit name. - default_
keyfile_ path - Resolves the default keyfile path for a given address under the default keystore dir.
- default_
keystore_ dir - Returns
$XDG_DATA_HOME/taskfast/wallets, falling back to$HOME/.local/share/taskfast/walletswhen XDG is unset. - generate_
and_ save - Generates a fresh random signer, encrypts it, writes it to the default
path for its address, and returns
(signer, path). The most common init flow:taskfast init --generate-wallet. - load
- Load a signer by
KeySource— dispatches to the file backend today. Keychain support will slot in here under a cargo feature. - load_
signer - Decrypts the keystore at
pathwithpasswordand returns the signer. - save_
signer - Encrypts
signerwithpasswordand writes it topath, creating parent directories as needed. Overwrites any existing file at the same path — callers wanting idempotency should checkPath::existsfirst.