Commit Graph

1130 Commits

Author SHA1 Message Date
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
Neal H. Walfield
6645fdee6c
Change --email and --add-email to only match user IDs unambiguously.
- Commands like `sq pki vouch certify` allow designating a user ID
    by email address.  Currently, if multiple self-signed user IDs
    include the specified email address, all are used.  Change the
    semantics of `--email` and --add-email` to only match
    unambiguously.

  - Fixes #309.
2024-11-13 14:29:32 +01:00
Justus Winter
78d8538707
Add sq sign --mode to create binary or text signatures.
- Fixes #390.
2024-11-13 14:08:57 +01:00
Neal H. Walfield
9eb0f0754e
Change --add-userid from a flag to two arguments.
- `sq pki link add`, `sq pki link authorize`, `sq pki vouch
    certify`, and `sq pki vouch authorize` have a `--add-userid` flag.

  - Replace the `--add-userid` flag with an `--add-userid` argument,
    and an `--add-email` argument.

  - This change means that a flag does not change how an argument is
    interpreted.  It also makes it more explicit whether a user ID
    should be added, because `--userid` and `--email` could be given
    multiple times.

  - See #309 and #318.
2024-11-13 13:51:35 +01:00
Neal H. Walfield
eabbd68240
Generalize active_certifications.
- `active_certifications` returns what user IDs match.  Sometimes it
    is useful to preserve additional details.

  - This can be fixed by changing `active_certifications` to take
    something that implements `AsRef<UserID>` instead of taking
    `UserID`s directly.  Unfortunately, we can't use the standard
    `AsRef` trait, because `UserID` doesn't implement `AsRef`, and due
    to the orphan rule, we change implement it ourselves.  As thus,
    introduce a local copy of `AsRef` and use that instead.
2024-11-13 13:19:42 +01:00
Neal H. Walfield
267a3d3481
tests: When calling sq pki authenticate include --show-paths.
- When `sq pki authenticate` fails, it is helpful to see as much
    details as possible.  As such, include `--show-paths` when calling
    `sq pki authenticate`.  `--show-paths` shows more information, but
    doesn't change the command's behavior.
2024-11-13 13:19:41 +01:00
Neal H. Walfield
fbd7f260e7
tests: Abstract user ID argument passing.
- Add a new type, `UserIDArg`, which represents a user ID argument.

  - Change functions that take user IDs like `Sq::key_generate` to use
    it.
2024-11-13 13:19:40 +01:00
Justus Winter
82a5f13a96
Drop debugging remnant. 2024-11-13 12:38:05 +01:00
Justus Winter
14f4c8fd3a
Replace --no-cert-store and --no-key-store.
- Replace the flag `sq --no-cert-store` with `sq
     --cert-store=none`.

   - Replace the flag `sq --no-key-store` with `sq --key-store=none`.

   - Similarly, `sq --home=none` disables all state, unless explicitly
     re-enabled using `--cert-store` or `--key-store`.

   - Fixes #427.
2024-11-13 12:34:53 +01:00
Justus Winter
5414ceec07
Make home directory optional. 2024-11-13 12:04:49 +01:00
Justus Winter
b8dba63d39
Introduce accessors. 2024-11-13 11:52:59 +01:00
Justus Winter
ee737472da
Require explicit mode, and align sq sign and sq verify.
- The flag `sq sign --detached` is now called `sq sign
     --signature-file`.

   - The flag `sq sign --clearsign` is now called `sq sign
     --cleartext`.

   - Both `sq sign` and `sq verify` now require an explicit mode,
     one of `--signature-file`, `--message`, or `--cleartext`.

   - Fixes #430.
2024-11-13 11:18:25 +01:00
Justus Winter
3e3a9e5096
Make tests less expensive.
- Only write out 30 megabytes, not 100.
2024-11-13 11:18:12 +01:00
Neal H. Walfield
34a519f785
Change sq key list to not filter out unauthenticated certificates.
- When `sq key list` is passed a filter, it only shows
    certificates that it can authenticate.  (When it is passed
    nothing, it shows all certificates with secret key material.)

  - Don't require certificates to be authenticated.

  - Fixes #293.
2024-11-12 10:12:36 +01:00
Neal H. Walfield
70e65c5fcd
Add a DWIM search parameter to sq key list.
- Add a DWIM search parameter to `sq key list`.  If the pattern
    appears to be a fingerprint or key ID, treat it as if it were passed
    to `--cert` and match on the certificate's fingerprint.  Otherwise,
    treat it as if it were passed via `--grep`, and match on user IDs.

  - This aligns `sq key list` with `sq cert list`.

  - See #293.
2024-11-12 10:12:34 +01:00
Justus Winter
0b562c476e
Remove sq cert lint --list-keys.
- Fixes #316.
2024-11-11 18:30:03 +01:00
Justus Winter
2700b908ac
Set signature creation times closer to where the builder is created.
- This makes it more obvious that the creation time is set
    appropriately.
2024-11-11 18:27:25 +01:00
Justus Winter
bfdd0a9558
Expand the designated signers to user ID, email, and domain queries.
- This allows one to require a signature from sequoia-pgp.org, for
    example.

  - See #248.
2024-11-11 18:27:25 +01:00
Justus Winter
16941dea66
Use only designated signers to verify signatures.
- Previously, the signers cert designators added to the set of certs
    in the store, and marked them as trusted.

  - Change this so that only the designated certs are used to verify
    the signatures, and they are marked as trusted.  This allows
    useful semantics like requiring a signature from a set of
    explicitly provided signers.

  - If no signers are designated, the cert store is consulted.

  - Fixes #248.
2024-11-11 18:27:25 +01:00
Justus Winter
e7c48b81f9
Make sq pki link add honor sq --time. 2024-11-11 17:24:25 +01:00
Justus Winter
bebb78dca4
Move struct VHelper to commands::verify. 2024-11-11 16:23:29 +01:00
Neal H. Walfield
390b318b4e
Disable the help subcommand everywhere except at the top-level.
- We want a top-level `help` subcommand, but we don't want
    subcommand groups (like `sq pki`) to have a `help` subcommand.
    Users get used to being able to use `help` instead of `--help`,
    and then are confused when `sq pki authenticate help` (i.e., using
    the `help` subcommand on an action) doesn't work.

  - Fixes #418.
2024-11-10 16:49:37 +01:00
Neal H. Walfield
7ecc843dee
Add new command sq download.
- Add a new command, `sq download`, which downloads a file and a
    signature file, and then authenticates the file.

  - Fixes #84.
2024-11-09 13:28:17 +01:00
Neal H. Walfield
6697846b78
Don't move when passing a reference will do.
- `commands::pki::authenticate` takes ownership of `sq`, but it only
     needs a reference.

  - Change it accordingly.
2024-11-09 09:19:33 +01:00
Neal H. Walfield
ee1c6f3fcf
Add new argument, --cli-version, to require a CLI version.
- Add a new argument, `--cli-version`, which the user can use to
    request a particular semver-compatible version of the CLI.

  - This enables breaking changes to the CLI, and enables `sq` to
    support multiple CLI versions.

  - Fixes #75.
2024-11-08 11:42:18 +01:00
Neal H. Walfield
f6a8a4ab2c
Rename OutputVersion to Version and move it to its own module.
- Rename `OutputVersion` to `Version`, and move it from the
    `cli::output` module to `cli::types::version` module.
2024-11-08 09:19:27 +01:00
Neal H. Walfield
2c548dfb74
Fix sq toolbox packet dump's help text.
- `sq toolbox packet dump` decrypts any encrypted containers by
    default.  Adjust the documentation accordingly.

  - Fixes #403.
2024-11-07 18:26:17 +01:00
Neal H. Walfield
f48a8ce033
Don't show the progress bar if --batch is specified.
- The progress bar changes the terminal.

  - If `--batch` is specified, `sq` is probably running from a script,
    and we shouldn't change the terminal.

  - Fixes #395.
2024-11-07 14:10:20 +01:00