summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeal H. Walfield <neal@pep.foundation>2020-03-01 16:29:08 +0100
committerNeal H. Walfield <neal@pep.foundation>2020-03-01 16:29:08 +0100
commit4ad415af5d0e76918b6e3199941cad753ac59dda (patch)
treeb14928382ef105b57faaf19f26d39fab9ed450be
parentdd3a10e2cfde25c78445f8e9e5a81c2a356b061a (diff)
openpgp: Rename CertAmalgamation to ValidCert.
- A `CertAmalgamation` is more like a `ValidKeyAmalgamation` than a `KeyAmalgamation`: it contains a policy and a reference time. So, add the `Valid` prefix. - Since a `CertAmalgamation` doesn't actually amalgamate anything like a `KeyAmalgamation` (it just contains a back reference to the `Cert`), and we don't have a `CertAmalgamation` data type, remove the `Amalgamation` suffix.
-rw-r--r--openpgp/src/cert/mod.rs12
-rw-r--r--openpgp/src/cert/prelude.rs2
2 files changed, 7 insertions, 7 deletions
diff --git a/openpgp/src/cert/mod.rs b/openpgp/src/cert/mod.rs
index c0d16372..8694588e 100644
--- a/openpgp/src/cert/mod.rs
+++ b/openpgp/src/cert/mod.rs
@@ -1395,13 +1395,13 @@ impl Cert {
/// Returns an error if the certificate is not valid for the given
/// policy at the given time.
pub fn with_policy<'a, T>(&'a self, policy: &'a dyn Policy, time: T)
- -> Result<CertAmalgamation<'a>>
+ -> Result<ValidCert<'a>>
where T: Into<Option<time::SystemTime>>,
{
let time = time.into().unwrap_or_else(time::SystemTime::now);
self.primary_key().with_policy(policy, time)?;
- Ok(CertAmalgamation {
+ Ok(ValidCert {
cert: self,
policy,
time: time,
@@ -1410,14 +1410,14 @@ impl Cert {
}
/// A certificate under a given policy at a given time.
-pub struct CertAmalgamation<'a> {
+pub struct ValidCert<'a> {
cert: &'a Cert,
policy: &'a dyn Policy,
// The reference time.
time: time::SystemTime,
}
-impl<'a> std::ops::Deref for CertAmalgamation<'a> {
+impl<'a> std::ops::Deref for ValidCert<'a> {
type Target = Cert;
fn deref(&self) -> &Self::Target {
@@ -1425,7 +1425,7 @@ impl<'a> std::ops::Deref for CertAmalgamation<'a> {
}
}
-impl<'a> CertAmalgamation<'a> {
+impl<'a> ValidCert<'a> {
/// Returns the amalgamation's reference time.
///
/// For queries that are with respect to a point in time, this
@@ -1445,7 +1445,7 @@ impl<'a> CertAmalgamation<'a> {
pub fn with_policy<T>(self, policy: &'a dyn Policy, time: T) -> Self
where T: Into<Option<time::SystemTime>>,
{
- CertAmalgamation {
+ ValidCert {
cert: self.cert,
policy,
time: time.into().unwrap_or_else(time::SystemTime::now),
diff --git a/openpgp/src/cert/prelude.rs b/openpgp/src/cert/prelude.rs
index 3ae5d19f..2b1cb2d0 100644
--- a/openpgp/src/cert/prelude.rs
+++ b/openpgp/src/cert/prelude.rs
@@ -15,7 +15,6 @@
#![allow(unused_imports)]
pub use crate::cert::{
Cert,
- CertAmalgamation,
CertBuilder,
CertParser,
CertRevocationBuilder,
@@ -28,6 +27,7 @@ pub use crate::cert::{
SubkeyRevocationBuilder,
UserAttributeRevocationBuilder,
UserIDRevocationBuilder,
+ ValidCert,
amalgamation::ComponentAmalgamation,
amalgamation::ValidAmalgamation as _,
amalgamation::ValidComponentAmalgamation,