mirror of
https://github.com/coder/coder.git
synced 2025-07-12 00:14:10 +00:00
feat: add cache abstraction for fetching signing keys (#14777)
- Adds the database implementation for fetching and caching keys used for JWT signing. It's been merged into the `keyrotate` pkg and renamed to `cryptokeys` since they're coupled concepts.
This commit is contained in:
21
coderd/cryptokeys/keycache.go
Normal file
21
coderd/cryptokeys/keycache.go
Normal file
@ -0,0 +1,21 @@
|
||||
package cryptokeys
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/coder/coder/v2/codersdk"
|
||||
)
|
||||
|
||||
var (
|
||||
ErrKeyNotFound = xerrors.New("key not found")
|
||||
ErrKeyInvalid = xerrors.New("key is invalid for use")
|
||||
ErrClosed = xerrors.New("closed")
|
||||
)
|
||||
|
||||
// Keycache provides an abstraction for fetching signing keys.
|
||||
type Keycache interface {
|
||||
Signing(ctx context.Context) (codersdk.CryptoKey, error)
|
||||
Verifying(ctx context.Context, sequence int32) (codersdk.CryptoKey, error)
|
||||
}
|
Reference in New Issue
Block a user