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 /tool/src/commands | |
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 'tool/src/commands')
-rw-r--r-- | tool/src/commands/inspect.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tool/src/commands/inspect.rs b/tool/src/commands/inspect.rs index e7372f11..3f499fa9 100644 --- a/tool/src/commands/inspect.rs +++ b/tool/src/commands/inspect.rs @@ -207,7 +207,7 @@ fn inspect_cert(policy: &dyn Policy, fn inspect_key(policy: &dyn Policy, output: &mut dyn io::Write, indent: &str, - ka: openpgp::cert::components::KeyAmalgamation<PublicParts>, + ka: ErasedKeyAmalgamation<PublicParts>, print_keygrips: bool, print_certifications: bool) -> Result<()> |