cryptokeys
packageThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
Documentation¶
Overview¶
Package cryptokeys provides an abstraction for fetching internally used cryptographic keys mainly for JWT signing and verification.
Index¶
Constants¶
Variables¶
Functions¶
funcStartRotator¶
StartRotator starts a background process that rotates keys in the database.It ensures there's at least one valid key per feature prior to returning.Canceling the provided context will stop the background process.
Types¶
typeCacheOption¶
type CacheOption func(*cache)
funcWithCacheClock¶
func WithCacheClock(clockquartz.Clock)CacheOption
typeEncryptionKeycache¶
type EncryptionKeycache interface {// EncryptingKey returns the latest valid key for encrypting payloads. A valid// key is one that is both past its start time and before its deletion time.EncryptingKey(ctxcontext.Context) (idstring, key interface{}, errerror)// DecryptingKey returns the key with the provided id which maps to its sequence// number. The key is valid for decryption as long as it is not deleted or past// its deletion date. We must allow for keys prior to their start time to// account for clock skew between peers (one key may be past its start time on// one machine while another is not).DecryptingKey(ctxcontext.Context, idstring) (key interface{}, errerror)io.Closer}
funcNewEncryptionCache¶
func NewEncryptionCache(ctxcontext.Context, loggerslog.Logger, fetcherFetcher,featurecodersdk.CryptoKeyFeature, opts ...func(*cache),) (EncryptionKeycache,error)
typeRotatorOption¶
type RotatorOption func(*rotator)
funcWithClock¶
func WithClock(clockquartz.Clock)RotatorOption
funcWithKeyDuration¶
func WithKeyDuration(keyDurationtime.Duration)RotatorOption
typeSigningKeycache¶
type SigningKeycache interface {// SigningKey returns the latest valid key for signing. A valid key is one// that is both past its start time and before its deletion time.SigningKey(ctxcontext.Context) (idstring, key interface{}, errerror)// VerifyingKey returns the key with the provided id which should map to its// sequence number. The key is valid for verifying as long as it is not deleted// or past its deletion date. We must allow for keys prior to their start time// to account for clock skew between peers (one key may be past its start time// on one machine while another is not).VerifyingKey(ctxcontext.Context, idstring) (key interface{}, errerror)io.Closer}
funcNewSigningCache¶
func NewSigningCache(ctxcontext.Context, loggerslog.Logger, fetcherFetcher,featurecodersdk.CryptoKeyFeature, opts ...func(*cache),) (SigningKeycache,error)
NewSigningCache instantiates a cache. Close should be called to release resourcesassociated with its internal timer.