Skip to main content

resolve_password

Function resolve_password 

Source
pub fn resolve_password(
    password_file: Option<&Path>,
) -> Result<Zeroizing<String>, CmdError>
Expand description

Resolve the keystore password: env var wins over file. Trims trailing \r/\n but rejects a file that is otherwise empty.

Wraps the secret in Zeroizing so the backing allocation is scrubbed on drop — reduces the in-memory window of the plaintext password within our address space. The scrypt derivation inside alloy_signer_local::decrypt_keystore copies the bytes into its own buffer we cannot control; this fix shrinks the CLI’s copy scope.