jwk

package
v0.27.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 12, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CreatePostgresTable represents a query to create the Postgres jwks table.
	CreatePostgresTable = `
CREATE TABLE
IF NOT EXISTS
jwks (
	id     UUID PRIMARY KEY,
	active BOOLEAN,
	key    JSON DEFAULT NULL
);
`

	// CreateSqliteTable represents a query to create the Sqlite jwks table.
	CreateSqliteTable = `
CREATE TABLE
IF NOT EXISTS
jwks (
	id     TEXT PRIMARY KEY,
	active BOOLEAN,
	key    TEXT
);
`
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Engine added in v0.27.0

type Engine struct {
	// contains filtered or unexported fields
}

Engine represents the key set functionality that implements the JWKService interface.

func New

func New(opts ...EngineOpt) (*Engine, error)

New creates and returns a Vela service for integrating with key sets in the database.

func (*Engine) CreateJWK added in v0.27.0

func (e *Engine) CreateJWK(ctx context.Context, j jwk.RSAPublicKey) error

CreateJWK creates a new JWK in the database.

func (*Engine) CreateJWKTable added in v0.27.0

func (e *Engine) CreateJWKTable(ctx context.Context, driver string) error

CreateJWKTable creates the jwks table in the database.

func (*Engine) GetActiveJWK added in v0.27.0

func (e *Engine) GetActiveJWK(ctx context.Context, id string) (jwk.RSAPublicKey, error)

GetActiveJWK gets a JWK by UUID (kid) from the database if active.

func (*Engine) ListJWKs added in v0.27.0

func (e *Engine) ListJWKs(ctx context.Context) (jwk.Set, error)

ListJWKs gets a list of all configured JWKs from the database.

func (*Engine) RotateKeys added in v0.27.0

func (e *Engine) RotateKeys(ctx context.Context) error

RotateKeys removes all inactive keys and sets active keys to inactive.

type EngineOpt

type EngineOpt func(*Engine) error

EngineOpt represents a configuration option to initialize the database engine for key sets.

func WithClient

func WithClient(client *gorm.DB) EngineOpt

WithClient sets the gorm.io/gorm client in the database engine for key sets.

func WithContext

func WithContext(ctx context.Context) EngineOpt

WithContext sets the context in the database engine for key sets.

func WithLogger

func WithLogger(logger *logrus.Entry) EngineOpt

WithLogger sets the github.com/sirupsen/logrus logger in the database engine for key sets.

func WithSkipCreation

func WithSkipCreation(skipCreation bool) EngineOpt

WithSkipCreation sets the skip creation logic in the database engine for key sets.

type JWKInterface

type JWKInterface interface {
	// JWK Data Definition Language Functions
	//
	// https://en.wikipedia.org/wiki/Data_definition_language
	CreateJWKTable(context.Context, string) error

	// CreateJWK defines a function that creates a JWK.
	CreateJWK(context.Context, jwk.RSAPublicKey) error
	// RotateKeys defines a function that rotates JWKs.
	RotateKeys(context.Context) error
	// ListJWKs defines a function that lists all JWKs configured.
	ListJWKs(context.Context) (jwk.Set, error)
	// GetJWK defines a function that gets a JWK by the provided key ID.
	GetActiveJWK(context.Context, string) (jwk.RSAPublicKey, error)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL