From d122a9c24b698acf1190f61ce5653d0c04741539 Mon Sep 17 00:00:00 2001 From: Dominik Schulz Date: Mon, 16 May 2022 13:39:03 +0200 Subject: [PATCH] Fix identity detection when using gpg (#2218) Fixes #2179 RELEASE_NOTES=[BUGFIX] Fix gpg identity detection Signed-off-by: Dominik Schulz --- internal/action/setup.go | 3 ++- internal/backend/crypto/gpg/cli/gpg.go | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/internal/action/setup.go b/internal/action/setup.go index 9eb26d344f..fb5b082291 100644 --- a/internal/action/setup.go +++ b/internal/action/setup.go @@ -10,6 +10,7 @@ import ( "github.com/gopasspw/gopass/internal/backend" "github.com/gopasspw/gopass/internal/backend/crypto/age" "github.com/gopasspw/gopass/internal/backend/crypto/gpg" + gpgcli "github.com/gopasspw/gopass/internal/backend/crypto/gpg/cli" "github.com/gopasspw/gopass/internal/out" "github.com/gopasspw/gopass/internal/store/root" "github.com/gopasspw/gopass/pkg/ctxutil" @@ -112,7 +113,7 @@ func (s *Action) initCheckPrivateKeys(ctx context.Context, crypto backend.Crypto func (s *Action) initGenerateIdentity(ctx context.Context, crypto backend.Crypto, name, email string) error { out.Printf(ctx, "🧪 Creating cryptographic key pair (%s) ...", crypto.Name()) - if crypto.Name() == "gpgcli" { + if crypto.Name() == gpgcli.Name { var err error out.Printf(ctx, "🎩 Gathering information for the %s key pair ...", crypto.Name()) diff --git a/internal/backend/crypto/gpg/cli/gpg.go b/internal/backend/crypto/gpg/cli/gpg.go index 23a2224cfe..52a2b78ff2 100644 --- a/internal/backend/crypto/gpg/cli/gpg.go +++ b/internal/backend/crypto/gpg/cli/gpg.go @@ -20,6 +20,8 @@ var ( Ext = "gpg" // IDFile is the name of the recipients file used by this backend. IDFile = ".gpg-id" + // Name is the name of this backend. + Name = "gpg" ) // GPG is a gpg wrapper. @@ -88,7 +90,7 @@ func (g *GPG) Initialized(ctx context.Context) error { // Name returns gpg. func (g *GPG) Name() string { - return "gpg" + return Name } // Ext returns gpg.