Implement Ord and PartialOrd for secret key type
This commit is contained in:
parent
2a6f3c4f55
commit
ee17f35218
|
|
@ -1,3 +1,4 @@
|
||||||
|
use std::cmp::Ordering;
|
||||||
use std::{fmt, ops::Deref, str::FromStr};
|
use std::{fmt, ops::Deref, str::FromStr};
|
||||||
|
|
||||||
use ed25519_compact as ed25519;
|
use ed25519_compact as ed25519;
|
||||||
|
|
@ -156,6 +157,18 @@ impl PublicKey {
|
||||||
#[derive(Clone, Debug, Eq, PartialEq, Hash)]
|
#[derive(Clone, Debug, Eq, PartialEq, Hash)]
|
||||||
pub struct SecretKey(ed25519::SecretKey);
|
pub struct SecretKey(ed25519::SecretKey);
|
||||||
|
|
||||||
|
impl PartialOrd for SecretKey {
|
||||||
|
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
|
||||||
|
Some(self.cmp(other))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Ord for SecretKey {
|
||||||
|
fn cmp(&self, other: &Self) -> Ordering {
|
||||||
|
self.0.cmp(&other.0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl zeroize::Zeroize for SecretKey {
|
impl zeroize::Zeroize for SecretKey {
|
||||||
fn zeroize(&mut self) {
|
fn zeroize(&mut self) {
|
||||||
self.0.zeroize();
|
self.0.zeroize();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue