diff options
author | Neal H. Walfield <neal@pep.foundation> | 2020-08-03 17:22:50 +0200 |
---|---|---|
committer | Neal H. Walfield <neal@pep.foundation> | 2020-08-03 17:35:41 +0200 |
commit | cb6b672a4dbb703cb92661bfa82b7089919a107b (patch) | |
tree | 62aeb4ebca67f058822a484a7fe3668d7dee8792 /openpgp/src/types/timestamp.rs | |
parent | ad9dac7d5a68f9a6dd2bcae67a405eb9f2756b58 (diff) |
openpgp: Change CertBuilder to use a relative expiration time.
- `CertBuilder::set_expiration_time` takes an absolute time.
- Most callers use a relative time.
- Internally, we need a relative time (that's what the Key
Expiration Time packet takes).
- Converting the absolute time to a relative time is error prone:
should it be relative to the creation time when called or when
`CertBuilder` is finalized?
- KISS: Change it to just take a relative time.
- To better reflect the new semantics, also change the name to
`CertBuilder::set_validity_period`.
Diffstat (limited to 'openpgp/src/types/timestamp.rs')
-rw-r--r-- | openpgp/src/types/timestamp.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/openpgp/src/types/timestamp.rs b/openpgp/src/types/timestamp.rs index 3a9a0e4c..59b903d1 100644 --- a/openpgp/src/types/timestamp.rs +++ b/openpgp/src/types/timestamp.rs @@ -267,11 +267,11 @@ impl Arbitrary for Timestamp { /// let p = &StandardPolicy::new(); /// /// let now = Timestamp::now(); -/// let then = now.checked_add(Duration::days(365)?).unwrap(); +/// let validity_period = Duration::days(365)?; /// /// let (cert,_) = CertBuilder::new() /// .set_creation_time(now) -/// .set_expiration_time(then) +/// .set_validity_period(validity_period) /// .generate()?; /// /// let vc = cert.with_policy(p, now)?; |