Make AuthCertKeyIds sortable.

This commit is contained in:
Nick Mathewson 2020-11-16 15:08:12 -05:00
parent 1148b2d79a
commit 168def3c28
1 changed files with 16 additions and 0 deletions

View File

@ -99,6 +99,22 @@ pub struct AuthCertKeyIds {
pub sk_fingerprint: rsa::RSAIdentity,
}
impl Ord for AuthCertKeyIds {
fn cmp(&self, other: &AuthCertKeyIds) -> std::cmp::Ordering {
use std::cmp::Ordering::Equal;
match self.id_fingerprint.cmp(&other.id_fingerprint) {
Equal => self.sk_fingerprint.cmp(&other.sk_fingerprint),
r => r,
}
}
}
impl PartialOrd for AuthCertKeyIds {
fn partial_cmp(&self, other: &AuthCertKeyIds) -> Option<std::cmp::Ordering> {
Some(self.cmp(other))
}
}
/// An authority certificate whose signature and validity time we
/// haven't checked.
pub type UncheckedAuthCert = signed::SignatureGated<timed::TimerangeBound<AuthCert>>;