477 Commits

Author SHA1 Message Date
Neal H. Walfield
c2d5f24782
Change FileOrStdin::open to return a buffered reader with a cookie.
- `FileOrStdin::open` returns a buffered reader without a cookie,
    i.e., a `BufferedReader<()>`.

  - Sequoia functions that a buffered reader, they expect a
    `BufferedReader<openpgp::parse::Cookie>`.

  - Make it easier to use the Sequoia functions by changing
    `FileOrStdin::open` to return a
    `BufferedReader<openpgp::parse::Cookie>`.
2024-04-12 11:14:30 +02:00
Neal H. Walfield
3a0fc2fdb5
Show more error context in the output of sq inspect.
- When showing why a key is not valid, or why a certification is not
    valid, `sq inspect` only showed the top-level error.

  - To make the issue clearer, show the whole error chain.

  - Fixes #237.
2024-04-10 13:07:08 +02:00
Neal H. Walfield
d44ea64fa5
When generating a key, write out the revocation certificate first.
- When generating a key using `sq key generate`, we first write out
    the certificate, and then the revocation certificate.

  - If writing out the revocation certificate fails, then we error
    out *after* we've already written out the certificate.

  - This is particularly surprising when the certificate is written to
    the key store: the operation failed, but a new key was added to the
    key store!

  - Change the order of operations so that we write out the revocation
    certificate first, and then the new certificate.
2024-04-09 13:31:52 +02:00
Neal H. Walfield
bf51db6e02
When generating a key, show how to use sq toolbox extract-cert.
- When `sq key generate` saves the key to a file, provide guidance
    on how to extract the certificate using `sq toolbox extract-cert`.
2024-04-09 12:37:41 +02:00
Neal H. Walfield
a5502e9f2f
Display hints on stderr, not stdout. 2024-04-09 12:34:22 +02:00
Neal H. Walfield
a549cabf8d
Require canonical user IDs by default.
- Change `sq key generate` and `sq key userid add` to require
    canonical user IDs by default.

  - If a user ID is not in canonical form, explain the problem, and
    suggest a solution, if possible.

  - Allow the user to disable this check by passing the
    `--allow-non-canonical-userids` flag.

  - Fixes #209.
2024-04-09 12:07:42 +02:00
Neal H. Walfield
3344444407
Change the type of user ID arguments to UserID instead of String.
- `sq key generate --userid USERID`, `sq key add --userid USERID`,
    and `sq key strip --userid USERID` expect a user ID.  Use the more
    precise type, `UserID`, instead of `String`.
2024-04-09 11:57:08 +02:00
Neal H. Walfield
5cc0398384
Output guidance when failing to authenticate bindings.
- `sq pki list`, etc. have two failure modes: there are no matching
    bindings, and some matching bindings couldn't be authenticated.

  - In both cases, the current error message is less than helpful,
    e.g.:

    ```
    $ sq pki list user@example.org
    No paths found.
    ```

  - If there are no matching bindings, suggest that the run `sq
    network fetch`.

  - If there are matching bindings that can't be authenticated, tell
    they user that they can see them by using the `--gossip` option.

  - Fixes #221.
2024-04-08 15:47:14 +02:00
Neal H. Walfield
893a7aafe9
Show guidance when sq key generate saves the key to the key store.
- When `sq key generate` saves the generated certificate on the key
    store, add guidance on how to designate it as a trusted introducer,
    or to mark it as certified.  Also explain how to export it, and
    how to publish it.
2024-04-05 18:14:13 +02:00
Neal H. Walfield
0cd8bae06f
Don't generate user ID-less certificates by default.
- Although Sequoia is able to use user ID-less certificates, they
    don't have good support in the ecosystem, and are probably not
    what most users want.

  - Consequently, don't make user ID-less certificates the default.
    Instead, require users to opt in by passing the `--no-userids` flag
    to `sq key generate`.

  - Fixes #223.
2024-04-05 18:08:45 +02:00
Neal H. Walfield
68cc605687
Fix spelling.
- It's a "user ID" not a "userid."
2024-04-05 17:14:55 +02:00
Neal H. Walfield
8954033c29
Output guidance when there are no matching certificates.
- If `sq pki list KEYID|FINGERPRINT` doesn't match any certificates,
    suggest that the user run `sq network fetch`.
2024-04-05 15:17:44 +02:00
Neal H. Walfield
68296b1058
When authenticating a certificate, check if it exists earlier.
- When authenticating a certificate by fingerprint e.g., using `sq
    pki identify FINGERPRINT`, check that it exists earlier.
2024-04-05 13:33:36 +02:00
Neal H. Walfield
ddfda32cec
Upgrade sequoia-keystore. 2024-04-04 17:33:30 +02:00
Luca Saiu
0035a412e7
When generating a key, store the key in the key store by default.
- Change `sq key generate` to store the generated key in the key
    store by default.

  - See #219.
2024-04-03 22:36:03 +02:00
Neal H. Walfield
30696427e6
Upgrade h2.
- Upgrade `h2` based on RUSTSEC-2024-0332.  See:

    https://rustsec.org/advisories/RUSTSEC-2024-0332
2024-04-03 22:36:02 +02:00
Justus Winter
2143899236
deny: Remove old goodlist and license entry, goodlist yaml-rust.
- yaml-rust is unmaintained.

  - yaml-rust is used by subplot/roadmap/serde_yaml thus an indirect
    dependency.  Remove when a new version of roadmap is released that
    uses a newer version of serde_yaml.  See
    https://gitlab.com/larswirzenius/roadmap/-/issues/13
2024-03-26 18:22:11 +01:00
Justus Winter
1ac709cda4
Fix documentation. 2024-03-25 14:47:28 +01:00
Justus Winter
5b898e3529
Move sq key extract-cert to sq toolbox.
- Fixes #204.
2024-03-25 14:47:28 +01:00
Justus Winter
345ac4c474
Use imperative mood to describe commands, subcommands, arguments. 2024-03-25 13:46:18 +01:00
Justus Winter
a906a5dc84
Improve wording. 2024-03-25 12:28:15 +01:00
Justus Winter
acff12f8a7
Improve wording.
- Fixes #215.
2024-03-25 12:27:15 +01:00
Justus Winter
93e8543748
Trim dependencies. 2024-03-25 12:18:53 +01:00
Neal H. Walfield
24b383275a
Port sq inspect's examples to the example framework.
- #190.
2024-03-13 10:26:32 +01:00
Devan Carpenter
7e3334740c
ci: use common-ci 2024-03-13 09:48:56 +01:00
Neal H. Walfield
039aa33153
When using ioctl's, be as general as possible.
- On some platforms, the arguments are u32s on others they are u64s,
    use `into` to cover more situations.

  - Fixes #211.
2024-03-13 09:34:05 +01:00
Neal H. Walfield
cef91ffbe7
Upgrade generator.
- Version 0.7.6 of `generator` was yanked.  Upgrade to the latest
    version.
2024-03-13 09:34:05 +01:00
Neal H. Walfield
e2e6fa8195
Upgrade mio.
- Version 0.8.10 of `mio` has a vulnerability, which is tracked as
    RUSTSEC-2024-0019.

    See https://rustsec.org/advisories/RUSTSEC-2024-0019

  - Upgrade to 0.8.11, which fixes the issue.
2024-03-13 09:34:05 +01:00
Neal H. Walfield
1d29ea0b90
ci: Don't spell check openpgp-policy.toml. 2024-03-13 09:26:21 +01:00
Devan Carpenter
9edfc9a412
add openpgp-policy
copied from sequoia.git
2024-03-06 12:35:27 -05:00
Neal H. Walfield
8fbaf04431
Move key import functionality to Config.
- Move the key import functionality from
    `commands:🔑:import::import` to `Config::import_key` so that
    it can be used by other subcommands that import or update keys.
2024-03-01 09:42:56 +01:00
Neal H. Walfield
2f38af4805
Update NEWS.
- This fixes the NEWS file, and adds missing information.
2024-02-29 17:35:10 +01:00
Neal H. Walfield
696bf3a677
Release 0.34.0. 2024-02-29 17:21:43 +01:00
Neal H. Walfield
828eb4dd44
Relax version requirements on textwrap.
- Also accept version 0.15.x of `textwrap`.
2024-02-29 17:21:37 +01:00
Neal H. Walfield
139ee6e044
Update Cargo.lock. 2024-02-29 17:18:37 +01:00
Justus Winter
fcac57be3d
Correctly reset the dumping state when processing next armor block.
- Fixes erroneously duplicated packets in the output.
2024-02-29 14:06:02 +01:00
Neal H. Walfield
1982366e08
Improve sq network fetch output.
- Call `best_effort_primary_uid` after inserting the certificate
    into the certificate store.  Otherwise, `best_effort_primary_uid`
    won't be able to take any new authentication information into
    account.

  - Sort the certificates by the degree to which we can authenticate
    them.
2024-02-29 13:42:28 +01:00
Neal H. Walfield
6a73570626
Change best_effort_primary_uid to also return the trust amount.
- Change `best_effort_primary_uid` to also return the trust amount.

  - Instead of using an unergonomic tuple, use a dedicated type,
    `PreferredUserID`, so that it is easier to extend in the future.
2024-02-29 13:42:28 +01:00
Neal H. Walfield
011c426970
Change best_effort_primary_uid to prefer authenticated user IDs.
- Change `best_effort_primary_uid` to prefer authenticated user IDs
    to user IDs that are only self signed.
2024-02-29 13:42:28 +01:00
Neal H. Walfield
92e8c5c1d5
Change best_effort_primary_uid to return a sanitized string.
- The result of `best_effort_primary_uid` should always be
    sanitized.

  - Change `best_effort_primary_uid` to return a sanitized string, and
    update the callers.
2024-02-28 12:33:26 +01:00
Neal H. Walfield
df00d8fc86
Implement Display for more variants of Safe.
- Implement `Display` for `Safe<&[u8]>`, `Safe<Cow<str>>`,
    `Safe<&String>`, and `Safe<String>`.
2024-02-28 11:42:11 +01:00
Neal H. Walfield
d45ebaa04b
Optionally pass a Config to best_effort_primary_uid.
- Add an optional `Config` to `best_effort_primary_uid` in
    preparation for optionally printing authenticated user IDs instead
    of self-signed user IDs.
2024-02-27 15:40:38 +01:00
Neal H. Walfield
d0e3b0d4d8
Don't get a mutable reference to a cert store if it is not needed.
- `sequoia_cert_store::StoreUpdate` no longer requires a mutable
    reference to update the certificate store (it instead relies on
    interior mutability).

  - Don't get a mutable reference using
    `Config::cert_store_mut_or_else` if it is not necessary.  Just use
    `Config::cert_store_mut`.
2024-02-27 15:37:28 +01:00
Neal H. Walfield
074f1ab2d2
Change Config::cert_store to a wot::store::CertStore.
- A `wot::store::CertStore` is a thin wrapper around a
    `cert_store::CertStore`, which implements two traits, and maintains
    a cache of web of trust computations.

  - Change `Config` to use `wot::store::CertStore` instead of a
    `cert_store::CertStore`.

  - This makes it easier to use the web of trust elsewhere in `sq`,
    and doesn't cost anything if we don't do any web of trust
    calculations.
2024-02-27 14:59:42 +01:00
Neal H. Walfield
98cc4510b4
Change Config::policy from an owned value to a reference.
- To allow a field of `Config` to hold a reference to the policy,
    change the policy from an owned value to a reference, which can be
    copied.
2024-02-27 13:25:04 +01:00
Neal H. Walfield
314e19c1af
Upgrade sequoia-cert-store and sequoia-wot.
- Upgrade `sequoia-cert-store` and `sequoia-wot` and adapt to their
    API changes.
2024-02-23 16:58:15 +01:00
Neal H. Walfield
20f6512085
Make --key-store and --no-key-store global options.
- Change `--key-store` and `--no-key-store` to be global options,
    like `--cert-store` and `--no-cert-store`.
2024-02-21 13:49:00 +01:00
Neal H. Walfield
340751a587
Add a note to --help that global options are described by sq --help.
- To avoid overwhelming users, we don't describe global options in a
    subcommand's help output.

  - Add a short section that tells the user that there are global
    options, and that they can learn about them from the top-level's
    help output.

  - See #202.
2024-02-21 12:28:37 +01:00
Neal H. Walfield
0382001a65
Only show global options in the top-level help output.
- Fixes #202.
2024-02-21 12:28:32 +01:00
Neal H. Walfield
19f8893c46
Put global options in their own section.
- See #202.
2024-02-21 11:35:03 +01:00