SigningKeys: Add added_at when creating new signing key (#85060)

This commit is contained in:
Karl Persson 2024-03-25 09:58:40 +01:00 committed by GitHub
parent 2f5be54252
commit c33bc819bc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -177,12 +177,14 @@ func (s *Service) addPrivateKey(ctx context.Context, keyID string, alg jose.Sign
return nil, err
}
expiry := time.Now().Add(30 * 24 * time.Hour)
now := time.Now()
expiry := now.Add(30 * 24 * time.Hour)
key, err := s.store.Add(ctx, &signingkeys.SigningKey{
KeyID: keyID,
PrivateKey: encoded,
ExpiresAt: &expiry,
Alg: alg,
AddedAt: now,
}, force)
if err != nil && !errors.Is(err, signingkeys.ErrSigningKeyAlreadyExists) {