From ed9650be6bad88936f72cf305f5d6635109d1e56 Mon Sep 17 00:00:00 2001 From: aeneasr <3372410+aeneasr@users.noreply.github.com> Date: Tue, 29 Oct 2024 15:20:38 +0100 Subject: [PATCH] chore: synchronize workspaces --- jwk/helper.go | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/jwk/helper.go b/jwk/helper.go index 3ecaa35357..b435f7f7cb 100644 --- a/jwk/helper.go +++ b/jwk/helper.go @@ -61,22 +61,22 @@ func GetOrGenerateKeys(ctx context.Context, r InternalRegistry, m Manager, set, privKey, privKeyErr := FindPrivateKey(keys) if privKeyErr == nil { return privKey, nil - } else { - r.Logger().WithField("jwks", set).Warnf("JSON Web Key not found in JSON Web Key Set %s, generating new key pair...", set) + } - getLock(set).Lock() - keys, err = m.GenerateAndPersistKeySet(ctx, set, kid, alg, "sig") - getLock(set).Unlock() - if err != nil { - return nil, err - } + r.Logger().WithField("jwks", set).Warnf("JSON Web Key not found in JSON Web Key Set %s, generating new key pair...", set) - privKey, err := FindPrivateKey(keys) - if err != nil { - return nil, err - } - return privKey, nil + getLock(set).Lock() + keys, err = m.GenerateAndPersistKeySet(ctx, set, kid, alg, "sig") + getLock(set).Unlock() + if err != nil { + return nil, err + } + + privKey, err := FindPrivateKey(keys) + if err != nil { + return nil, err } + return privKey, nil } func First(keys []jose.JSONWebKey) *jose.JSONWebKey {