Skip to content

Commit 39ae6e9

Browse files
committed
nostr: attempt to erase SecretKey when dropped
1 parent 978cda4 commit 39ae6e9

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

crates/nostr/src/key/mod.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,3 +263,14 @@ impl FromPkStr for Keys {
263263
}
264264
}
265265
}
266+
267+
impl Drop for Keys {
268+
fn drop(&mut self) {
269+
tracing::trace!("Dropping Secret Key...");
270+
if let Some(sk) = self.secret_key.as_mut() {
271+
sk.non_secure_erase();
272+
tracing::trace!("Secret Key dropped.");
273+
}
274+
self.secret_key = None;
275+
}
276+
}

0 commit comments

Comments
 (0)