feat: Warn on missing signing keys when persisting challenges (#1088)

This commit is contained in:
Jason Cameron 2025-09-07 15:43:58 -04:00 committed by GitHub
parent 7e1b5d9951
commit abf6c8de57
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 37 additions and 6 deletions

View file

@ -11,10 +11,9 @@ import (
"go.etcd.io/bbolt"
)
// Sentinel error values used for testing and in admin-visible error messages.
// Sentinel error value used for testing and in admin-visible error messages.
var (
ErrBucketDoesNotExist = errors.New("bbolt: bucket does not exist")
ErrNotExists = errors.New("bbolt: value does not exist in store")
ErrNotExists = errors.New("bbolt: value does not exist in store")
)
// Store implements store.Interface backed by bbolt[1].
@ -150,6 +149,10 @@ func (s *Store) cleanup(ctx context.Context) error {
})
}
func (s *Store) IsPersistent() bool {
return true
}
func (s *Store) cleanupThread(ctx context.Context) {
t := time.NewTicker(time.Hour)
defer t.Stop()

View file

@ -37,6 +37,11 @@ type Interface interface {
// Set puts a value into the store that expires according to its expiry.
Set(ctx context.Context, key string, value []byte, expiry time.Duration) error
// IsPersistent returns true if this storage backend persists data across
// service restarts (e.g., bbolt, valkey). Returns false for volatile storage
// like in-memory backends.
IsPersistent() bool
}
func z[T any]() T { return *new(T) }
@ -88,3 +93,7 @@ func (j *JSON[T]) Set(ctx context.Context, key string, value T, expiry time.Dura
return nil
}
func (j *JSON[T]) IsPersistent() bool {
return j.Underlying.IsPersistent()
}

View file

@ -48,6 +48,10 @@ func (i *impl) Set(_ context.Context, key string, value []byte, expiry time.Dura
return nil
}
func (i *impl) IsPersistent() bool {
return false
}
func (i *impl) cleanupThread(ctx context.Context) {
t := time.NewTicker(5 * time.Minute)
defer t.Stop()

View file

@ -47,3 +47,7 @@ func (s *Store) Set(ctx context.Context, key string, value []byte, expiry time.D
return nil
}
func (s *Store) IsPersistent() bool {
return true
}