Skip to content

Commit 67fefba

Browse files
committed
no longer keep account seed on the wallet struct
1 parent 7d11d44 commit 67fefba

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

common/client-libs/validator-client/src/signing/direct_wallet.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,6 @@ pub struct DirectSecp256k1HdWallet {
3737
/// Base secret
3838
secret: bip39::Mnemonic,
3939

40-
/// BIP39 seed
41-
seed: [u8; 64],
42-
4340
/// Derived accounts
4441
#[zeroize(skip)]
4542
// unfortunately `dyn EcdsaSigner` does not guarantee Zeroize
@@ -168,7 +165,7 @@ impl DirectSecp256k1HdWalletBuilder {
168165
self,
169166
mnemonic: bip39::Mnemonic,
170167
) -> Result<DirectSecp256k1HdWallet, DirectSecp256k1HdWalletError> {
171-
let seed = mnemonic.to_seed(&self.bip39_password);
168+
let seed = Zeroizing::new(mnemonic.to_seed(&self.bip39_password));
172169
let prefix = self.prefix.clone();
173170
let accounts = self
174171
.hd_paths
@@ -178,13 +175,12 @@ impl DirectSecp256k1HdWalletBuilder {
178175
hd_path: hd_path.clone(),
179176
prefix: prefix.clone(),
180177
}
181-
.try_derive_account(seed)
178+
.try_derive_account(&seed)
182179
})
183180
.collect::<Result<_, _>>()?;
184181

185182
Ok(DirectSecp256k1HdWallet {
186183
accounts,
187-
seed,
188184
secret: mnemonic,
189185
})
190186
}

0 commit comments

Comments
 (0)