diff options
author | Neal H. Walfield <neal@pep.foundation> | 2020-01-31 14:20:53 +0100 |
---|---|---|
committer | Neal H. Walfield <neal@pep.foundation> | 2020-01-31 15:59:16 +0100 |
commit | a464ce819ccd1fa07ff8c6d0be74cff5eec5cf34 (patch) | |
tree | 31ed9d18b9c7802a93b4e4c8e6e85d1121b201d8 /openpgp/src/types/timestamp.rs | |
parent | b9b6533bd5394cd5cdb6b91b5c5ca7a02e3ea199 (diff) |
openpgp: Add a policy object.
- Change all functions that need to evaluate the validity of a
signature (either directly or indirectly to take a policy object.
- Use the policy object to allow the user to place additional
constraints on a signature's validity.
- This addresses the first half of #274 (it introduces the policy
object, but does not yet implement any policy).
Diffstat (limited to 'openpgp/src/types/timestamp.rs')
-rw-r--r-- | openpgp/src/types/timestamp.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/openpgp/src/types/timestamp.rs b/openpgp/src/types/timestamp.rs index 3197b534..53f84987 100644 --- a/openpgp/src/types/timestamp.rs +++ b/openpgp/src/types/timestamp.rs @@ -100,8 +100,12 @@ impl Timestamp { /// /// ```rust /// # use sequoia_openpgp::{*, packet::prelude::*, types::*, cert::*}; + /// use sequoia_openpgp::policy::StandardPolicy; + /// /// # f().unwrap(); /// # fn f() -> Result<()> { + /// let policy = &StandardPolicy::new(); + /// /// // Let's fix a time. /// let now = Timestamp::from(1583436160); /// @@ -125,13 +129,13 @@ impl Timestamp { /// /// /// First, get the certification key. /// let mut keypair = - /// alice.keys().policy(t).secret().for_certification() + /// alice.keys().set_policy(policy, t).secret().for_certification() /// .nth(0).ok_or_else(|| failure::err_msg("no valid key at"))? /// .key().clone().into_keypair()?; /// /// // Then, lookup the binding between `bob@example.org` and /// // `bob` at `t`. - /// let ca = bob.userids().policy(t) + /// let ca = bob.userids().set_policy(policy, t) /// .filter(|ca| ca.userid().value() == b"bob@example.org") /// .nth(0).ok_or_else(|| failure::err_msg("no valid userid"))?; /// |