summaryrefslogtreecommitdiffstats
path: root/openpgp
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2020-11-26 13:57:42 +0100
committerJustus Winter <justus@sequoia-pgp.org>2020-11-26 15:22:34 +0100
commit0a432bfb0f17048ef7e1bdf672cb0aa6e4cd5786 (patch)
tree8e8336bfd0d7a1e1dba6b31ff18fe54fb190a9e7 /openpgp
parent67ec527d0ee1e15745e163ed1c550b385f885265 (diff)
openpgp: Add a lifetime to CertBuilder.
- This will allow us to use the CertBuilder to change certificates with detached secret keys in the future. - Fixes #608.
Diffstat (limited to 'openpgp')
-rw-r--r--openpgp/src/cert/builder.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/openpgp/src/cert/builder.rs b/openpgp/src/cert/builder.rs
index 63ebddcd..413dce36 100644
--- a/openpgp/src/cert/builder.rs
+++ b/openpgp/src/cert/builder.rs
@@ -1,4 +1,5 @@
use std::time;
+use std::marker::PhantomData;
use crate::packet;
use crate::packet::{
@@ -160,7 +161,7 @@ pub struct KeyBlueprint {
/// # }
/// ```
#[derive(Clone, Debug)]
-pub struct CertBuilder {
+pub struct CertBuilder<'a> {
creation_time: Option<std::time::SystemTime>,
ciphersuite: CipherSuite,
primary: KeyBlueprint,
@@ -169,9 +170,10 @@ pub struct CertBuilder {
user_attributes: Vec<packet::UserAttribute>,
password: Option<Password>,
revocation_keys: Option<Vec<RevocationKey>>,
+ phantom: PhantomData<&'a ()>,
}
-impl CertBuilder {
+impl CertBuilder<'_> {
/// Returns a new `CertBuilder`.
///
/// The returned builder is configured to generate a minimal
@@ -220,6 +222,7 @@ impl CertBuilder {
user_attributes: vec![],
password: None,
revocation_keys: None,
+ phantom: PhantomData,
}
}
@@ -273,6 +276,7 @@ impl CertBuilder {
user_attributes: vec![],
password: None,
revocation_keys: None,
+ phantom: PhantomData,
}
}