diff options
author | Nora Widdecke <nora@sequoia-pgp.org> | 2022-12-01 11:57:32 +0100 |
---|---|---|
committer | Nora Widdecke <nora@sequoia-pgp.org> | 2022-12-01 16:11:58 +0100 |
commit | 33fb8848dcfa90bc9fa66f8810082fa7da80c0a5 (patch) | |
tree | 405f1a88dde1e7e32c751a76c41cda096812f567 | |
parent | daa6cad49144d3ee7a474f3c6eb96f80b54367fc (diff) |
sq: Improve error message for key userid add.
- To add a userid to a key, private key material is needed.
- State this explicitly in the error message.
- Fixes #952.
-rw-r--r-- | sq/src/commands/key.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sq/src/commands/key.rs b/sq/src/commands/key.rs index f6f8b729..d428ceb0 100644 --- a/sq/src/commands/key.rs +++ b/sq/src/commands/key.rs @@ -340,7 +340,9 @@ fn userid_add(config: Config, command: sq_cli::key::UseridAddCommand) -> Result< // If a password is needed to use the key, the user will be prompted. let pk = get_primary_keys(&[key.clone()], &config.policy, command.private_key_store.as_deref(), - creation_time, None)?; + creation_time, None); + + let pk = pk.context("Adding a User ID requires the private key")?; assert_eq!(pk.len(), 1, "Expect exactly one result from get_primary_keys()"); let mut pk = pk.into_iter().next().unwrap(); |