Commit Graph

1357 Commits

Author SHA1 Message Date
Neal H. Walfield
df5eb0c4d2
Add support for examples that are only syntax checked.
- Currently, we execute all examples.  Unfortunately, some examples
    can't be executed reliably, e.g., those that require network access.

  - Add a new example variant that is only syntax checked.

  - Fixes #423.

  - Add some examples for `sq network search`.
2024-11-16 22:01:18 +01:00
Neal H. Walfield
3f21498607
Add some tracing. 2024-11-16 21:19:44 +01:00
Neal H. Walfield
84b1bf99c6
Fix sq cert list for fingerprints and key IDs.
- The implementation of `sq cert list` tried to parse the
    pattern.  To do so, it relied on type inference to determine how
    to parse it.  The type was inferred from the type of the `cert`
    parameter to `authenticate`.  In
    2e17dec9ad, the type of the `cert`
    parameter changed from `KeyHandle` to `Cert`.  `Cert` has a
    `Parse` implementation so the type system didn't detect anything
    wrong.  However, we were now trying to parse the pattern as a
    `Cert` instead of a `KeyHandle`, which would fail for key handles.

  - Fix it, and add some tests for `sq cert list`.
2024-11-16 21:19:28 +01:00
Neal H. Walfield
ebea7371db
Implement From<KeyHandle> for CertDesignators.
- To make it easier to call `Sq::resolve_cert` with a fingerprint,
    implement `From<KeyHandle>` for `CertDesignators`.
2024-11-16 21:11:08 +01:00
Neal H. Walfield
6353cd61b2
When listing who made a certification, show the fingerprint.
- `sq key approvals list` shows a user ID for the certificate that
    made a certification, but not its fingerprint.  Also show the
    fingerprint.
2024-11-16 19:01:23 +01:00
Neal H. Walfield
8edf3de3de
When listing approvals, indicate whether there are any pending.
- When `sq key approvals list` is used to list approvals, indicate
    whether any certifications are pending approval, and suggest using
    `--pending` to view them.
2024-11-16 19:01:14 +01:00
Neal H. Walfield
491d15be17
Make sq key approvals more transparent.
- Show how many approvals were added, and how many were retracted.

  - Fixes #436.
2024-11-16 18:37:57 +01:00
Neal H. Walfield
d54334b97b
Make sq key approvals update require an action.
- `sq key approvals update` doesn't require an action, but it
    should.  Make it so.

  - See #436.
2024-11-16 18:22:05 +01:00
Neal H. Walfield
f95db6fc9e
Lint user IDs that would be added and are not self signed.
- When a user ID designator designates a user ID that is not
    self-signed, and the command would add it to the certificate, check
    that it is in canonical form.

  - The relevant commands are: `sq key userid revoke`, `sq pki link
    add`, `sq pki link authorize`, `sq pki vouch certify`, and `sq pki
    vouch authorize`

  - Allow the user to disable the check with a new flag,
    `--allow-non-canonical-userids`.

  - Fixes #437.
2024-11-16 17:31:33 +01:00
Neal H. Walfield
f176fe9a4c
Rename sq toolbox dearmor to sq packet dearmor.
- See #326.
2024-11-16 10:12:36 +01:00
Neal H. Walfield
5a500f8fee
Rename sq toolbox armor to sq packet armor.
- See #326.
2024-11-16 10:09:56 +01:00
Neal H. Walfield
d46844ca35
Move sq toolbox packet to sq packet.
- Make `sq packet` a top-level subcommand.

  - See #326.
2024-11-16 10:07:07 +01:00
Neal H. Walfield
e1a4fa656c
Move sq toolbox keyring to sq keyring.
- Make `sq keyring` a top-level subcommand.

  - See #326.
2024-11-16 10:06:59 +01:00
Neal H. Walfield
050bba99f8
Fix comment. 2024-11-16 07:13:29 +01:00
Neal H. Walfield
8e41fb7cd4
tests: Fix check.
- When checking if there are any user ID arguments, also check for
    `--userid`.
2024-11-16 07:12:13 +01:00
Neal H. Walfield
574dcf9b22
Show standard usage if no arguments are supplied to sq cert export.
- `sq cert export` uses a custom error message if the user does not
    designate any certificates.

  - Instead, require that the user designate using clap, which prints
    a nicer error message if this is violated.
2024-11-15 20:59:15 +01:00
Neal H. Walfield
b76cec64b6
Port sq toolbox userid-strip to the user ID designator framework.
- Fixes #434.
2024-11-15 20:43:50 +01:00
Neal H. Walfield
4dbeebc045
Port sq cert list and two more to the user ID designator framework.
- Port `sq cert list`, `sq pki authenticate` and `sq pki lookup` to
    the user ID designator framework.  See #434.

  - This changes the user ID parameter from a positional parameter
    to a named parameter, and drops the `--email` flag.  See #318.
2024-11-15 17:47:05 +01:00
Neal H. Walfield
472ba5a3a7
Upgrade sequoia-wot.
- Upgrade to the 0.13.2, which includes a fix that the next change
    requires.
2024-11-15 17:45:55 +01:00
Neal H. Walfield
b655bb2730
Move the authenticate function to its own module under common.
- Move `commands::pki::authenticate` to `common::pki::authenticate`.

  - Also move the output module.
2024-11-15 16:17:49 +01:00
Neal H. Walfield
f419837b31
Improve the format of error messages for failing examples.
- Compiler error messages are usually formatted as follows:

    PROGRAM:FILE_NAME:LINENO: MESSAGE

  - When an example fails, format it accordingly.

  - This has the advantage that IDEs like emacs can jump to the
    specified location.
2024-11-15 11:04:39 +01:00
Neal H. Walfield
10cb342612
Revise the authenticate code's linting.
- `commands::pki::authenticate` is now given the certificate to
    authenticate.  Revise the linting code to take advantage of this.
2024-11-15 11:04:38 +01:00
Neal H. Walfield
2e17dec9ad
Port sq pki {authenticate,identify} to the cert designator framework.
- Port `sq pki authenticate` and `sq pki identify` to the cert
    designator framework.  See #207.

  - This changes the certificate parameter from a positional parameter
    to a named parameter.  See #318.
2024-11-15 11:04:38 +01:00
Neal H. Walfield
d561fad1a6
Move the sq pki identify cli definition to its own module. 2024-11-14 21:09:53 +01:00
Neal H. Walfield
dd7345340b
Move the sq pki lookup cli definition to its own module. 2024-11-14 21:09:52 +01:00
Neal H. Walfield
64aaa04914
Move the sq pki authenticate cli definition to its own module. 2024-11-14 21:09:42 +01:00
Justus Winter
beb850a673
Improve documentation.
- Fixes 14f4c8fd3a.
2024-11-14 17:35:30 +01:00
Justus Winter
64ab3c6dd3
Expand ~ in state directories.
- Fixes #391.
2024-11-14 17:30:41 +01:00
Justus Winter
0a8ba2b3f7
Make sq encrypt --set-metadata-filename take a simple string.
- Previously, the file name was constructed from the path of the
    input file, using some transformations that may be considered
    surprising (notably, the file name of unspecified encoding was
    transformed into UTF-8 using a lossy mechanism).

  - Avoid this opaque transformation by taking an explicit string
    argument.

  - Fixes #351.
2024-11-14 16:55:42 +01:00
Justus Winter
b916a13426
Remove sq encrypt --set-metadata-time.
- The literal data packet's time field is problematic for a variety
    of reasons.  The previous timestamp interface allows a number of
    time sources (ctime, mtime, message time (that is way better
    encoded in the signature creation time), explicit timestamp), but
    the information about what kind of timestamp this should be is
    lost when the time is encoded, without warning.

  - Remove it.

  - See #351.
2024-11-14 16:55:41 +01:00
Neal H. Walfield
f16ef5d878
Port sq pki path to the user ID designator framework.
- Port `sq pki path` to the user ID designator framework.
    See #434.

  - This change adds two new additional arguments, `--email` and
    `--name`.
2024-11-14 16:48:49 +01:00
Neal H. Walfield
24f12c6fd8
Add support for adding a user ID by display name.
- Extend the user ID designator framework to allow designating a
    self-signed user ID by its display name, or adding a new user ID
    if none match.
2024-11-14 16:48:49 +01:00
Neal H. Walfield
0e36a20d97
Make sq pki path's user ID argument a named argument.
- See #318.
2024-11-14 16:48:49 +01:00
Neal H. Walfield
428e4dbde3
Move the sq pki path cli definition to its own module. 2024-11-14 16:48:49 +01:00
Neal H. Walfield
4095e19529
Move the sq pki path implementation to its own module. 2024-11-14 16:48:49 +01:00
Justus Winter
ec80c67e47
Make sq download --output mandatory.
- Fixes #438.
2024-11-14 16:24:43 +01:00
Neal H. Walfield
435b127e5f
Port sq key userid revoke to the user ID designator framework.
- Port `sq key userid revoke` to the user ID designator framework.
    See #434.

  - This replaces the `--add-userid` flag with the `--add-userid`,
    `--add-email` and `--add-name` arguments.  See #318.

  - This change also makes a user ID mandatory, which fixes #428.
2024-11-14 11:30:29 +01:00
Neal H. Walfield
58ccedb655
Add support for adding a user ID by display name.
- Extend the user ID designator framework to allow designating a
    self-signed user ID by its display name, or adding a new user ID
    if none match.
2024-11-14 11:30:29 +01:00
Neal H. Walfield
c236b3bbab
When printing self-signed user IDs, also show invalid user IDs.
- When `UserIDDesignators::resolve` fails to resolve a user ID, it
    prints a list of valid self-signed user IDs.  If there are also
    invalid user IDs according to the current policy, print those and
    indicate that they are invalid.
2024-11-14 11:30:28 +01:00
Neal H. Walfield
9712dc5cc6
Port sq key approvals update to the user ID designator framework.
- See #434.
2024-11-14 11:30:28 +01:00
Neal H. Walfield
c7795149c2
Port sq key approvals list to the user ID designator framework.
- See #434.
2024-11-14 11:30:28 +01:00
Neal H. Walfield
b203dacd00
Add support for designating a self-signed user ID by display name.
- Extend the user ID designator framework to allow designating a
    self-signed user ID by its display name.
2024-11-14 11:30:28 +01:00
Neal H. Walfield
75dcd33193
Improve naming.
- Rename the user ID designator types to make them a bit clearer.
2024-11-14 11:30:28 +01:00
Justus Winter
ae36aaccf0
Optimize downloading of data files with detached signatures. 2024-11-13 17:20:12 +01:00
Justus Winter
c1cad320e7
Forbid --output when verifying detached signatures.
- Fixes #410.
2024-11-13 17:07:23 +01:00
Justus Winter
5e56f23a59
Add note. 2024-11-13 17:06:52 +01:00
Neal H. Walfield
a8567be5ed
Cause sq download to fail faster if the output file can't be used.
- Open the output file before downloading anything so that we fail
    earlier.
2024-11-13 16:36:22 +01:00
Justus Winter
4d5e481b08
Split the argument sq network wkd publish --create into two.
- This avoids an ambiguity when parsing the arguments.

  - Fixes #426.
2024-11-13 15:19:46 +01:00
Justus Winter
cc244afd79
Use cert designators for the signer arguments of sq encrypt.
- Fixes #429.
2024-11-13 15:08:11 +01:00
Justus Winter
359245db14
Use cert designators for the signer arguments of sq sign.
- See #429.
2024-11-13 15:08:11 +01:00