diff options
author | Neal H. Walfield <neal@pep.foundation> | 2020-02-26 22:15:38 +0100 |
---|---|---|
committer | Neal H. Walfield <neal@pep.foundation> | 2020-02-26 22:26:47 +0100 |
commit | 8dc1ef44289c1b11407e403a12bb4e74115cd1d4 (patch) | |
tree | 673410b6bc4d28c684254c12d18bf9027618ea0e /examples | |
parent | d8795a3db08c26239ce103991d8eada176fd3e38 (diff) |
openpgp: Rework KeyAmalgamation to preserve the key's role.
- Introduce three KeyAmalgamation variants:
`PrimaryKeyAmalgamation`, `SubordinateKeyAmalgamation`, and
`ErasedKeyAmalgamation`.
- Unlike a `Key` or a `KeyBundle` with an `UnspecifiedRole`, an
`ErasedKeyAmalgamation` remembers its role. This means that an
`ErasedKeyAmalgamation` can implement the correct semantics even
though the role marker has been erased (hence the name).
- Have `Cert::keys` return `ErasedKeyAmalgamation`s. Recall:
`Cert::keys` can't return a more specific type, because it returns
an iterator that can contain both primary and subordinate keys.
- We use a concrete type instead of a trait object so that when
the user converts a `KeyAmalgamation` to a
`ValidKeyAmalgamation` (via `with_policy`), the
`ValidKeyAmalgamation` retains the type information about the
`KeyAmalgamation`'s role.
- Preserving this type information increases type safety for users
of this API.
Diffstat (limited to 'examples')
-rw-r--r-- | examples/guide-exploring-openpgp.rs | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/examples/guide-exploring-openpgp.rs b/examples/guide-exploring-openpgp.rs index 2263dfe0..298fcd6c 100644 --- a/examples/guide-exploring-openpgp.rs +++ b/examples/guide-exploring-openpgp.rs @@ -1,7 +1,6 @@ //! https://sequoia-pgp.org/guide/exploring-openpgp/ extern crate sequoia_openpgp as openpgp; -use crate::openpgp::cert::prelude::*; use crate::openpgp::parse::Parse; use crate::openpgp::policy::StandardPolicy as P; |