From 8fbe32837148d18294d092d85e6dfe62e76b3214 Mon Sep 17 00:00:00 2001 From: Lionel Sausin Date: Thu, 25 Jan 2024 10:12:11 +0100 Subject: [PATCH] Properly report the ID of newly added keys Other commands like key list and key remove show the key's ID. Showing the ID here lets users easily reuse the ID as a key hint for subsequent commands. In particular, a key hint is needed when the repository has many keys - otherwise opening the repository may fail with "Fatal: maximum number of keys reached" even when a proper password is provided. Fixes #4656 --- changelog/unreleased/issue-4656 | 7 +++++++ cmd/restic/cmd_key.go | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 changelog/unreleased/issue-4656 diff --git a/changelog/unreleased/issue-4656 b/changelog/unreleased/issue-4656 new file mode 100644 index 000000000..8d16f0b48 --- /dev/null +++ b/changelog/unreleased/issue-4656 @@ -0,0 +1,7 @@ +Bugfix: Properly report the ID of newly added keys + +`restic key add` now reports the ID of a newly added key. This simplifies +selecting a specific key using the `--key-hint key` option. + +https://github.com/restic/restic/issues/4656 +https://github.com/restic/restic/pull/4657 diff --git a/cmd/restic/cmd_key.go b/cmd/restic/cmd_key.go index 8309f8382..acd4a029e 100644 --- a/cmd/restic/cmd_key.go +++ b/cmd/restic/cmd_key.go @@ -142,7 +142,7 @@ func addKey(ctx context.Context, repo *repository.Repository, gopts GlobalOption return err } - Verbosef("saved new key as %s\n", id) + Verbosef("saved new key with ID %s\n", id.ID()) return nil }