diff --git a/src/lib.rs b/src/lib.rs index c828b48..4111b7e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -463,6 +463,14 @@ impl SecretKey { pub fn inv(&self) -> Self { SecretKey(self.0.inv()) } + + pub fn clear(&mut self) { + self.0.clear(); + } + + pub fn is_zero(&self) -> bool { + self.0.is_zero() + } } impl Default for SecretKey { @@ -869,4 +877,11 @@ mod tests { .unwrap() ) } + + #[test] + fn secret_key_clear_is_correct() { + let mut sk = SecretKey::parse(&[1; 32]).unwrap(); + sk.clear(); + assert_eq!(sk.is_zero(), true); + } }