Skip to content

Commit

Permalink
chore: synchronize workspaces
Browse files Browse the repository at this point in the history
  • Loading branch information
aeneasr committed Oct 30, 2024
1 parent 135e99d commit ed9650b
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions jwk/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit ed9650b

Please sign in to comment.