-
Notifications
You must be signed in to change notification settings - Fork 4
feat: Encrypt secret keys at rest in config.toml #9
Copy link
Copy link
Open
Labels
Stellar WaveIssues in the Stellar wave programIssues in the Stellar wave programenhancementNew feature or requestNew feature or requestsecurity
Description
Summary
Secret keys are currently stored in plaintext in ~/.starforge/config.toml.
While this is acceptable for throwaway testnet wallets, it is a security risk
for any wallet holding real value. Encrypting keys at rest with a user-provided
passphrase would significantly improve security.
Task
Add opt-in passphrase-based encryption for secret keys stored in config.toml,
using AES-256-GCM. When a passphrase is set, secret keys are stored encrypted
and decrypted on-demand when needed for signing.
Acceptance Criteria
-
starforge wallet create alice --encryptprompts for a passphrase and stores the key encrypted - Encrypted keys are stored as base64 ciphertext in config.toml
-
starforge wallet show alice --revealprompts for the passphrase to decrypt and display the key - If the wrong passphrase is entered, a clear error is shown (no panic)
- Unencrypted wallets continue to work without any change
- The encryption scheme (AES-256-GCM + PBKDF2) is documented in the README
Files Likely Touched
Cargo.toml— addaes-gcmandpbkdf2cratessrc/utils/config.rs— addencrypt_keyanddecrypt_keyfunctionssrc/commands/wallet.rs— add--encryptflag and passphrase prompts
Notes
Use aes-gcm crate for encryption and pbkdf2 with SHA-256 for key derivation
from the passphrase. Store the salt alongside the ciphertext in config.toml.
Never store the passphrase itself. Prompt securely using the rpassword crate.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Stellar WaveIssues in the Stellar wave programIssues in the Stellar wave programenhancementNew feature or requestNew feature or requestsecurity