diff --git a/crates/nostr/src/key/mod.rs b/crates/nostr/src/key/mod.rs index 1c93be805..97f9c339b 100644 --- a/crates/nostr/src/key/mod.rs +++ b/crates/nostr/src/key/mod.rs @@ -209,12 +209,6 @@ impl Keys { &self.secret_key } - /// Get keypair - #[inline] - pub fn keypair(&self) -> &Keypair { - &self.keypair - } - /// Creates a schnorr signature of the [`Message`]. /// /// This method uses a random number generator that retrieves randomness from the operating system (see [`SysRng`]). @@ -265,6 +259,16 @@ impl FromStr for Keys { } } +impl Drop for Keys { + #[inline] + fn drop(&mut self) { + // Erase the keypair. + // + // NOTE: we already erase the secret key in 'impl Drop for SecretKey'. + self.keypair.non_secure_erase(); + } +} + impl GetPublicKey for Keys { type Error = Infallible;