postgres

package
v2.2.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMissingDBConnection = fmt.Errorf("missing db connection")
	ErrMissingCryptKey     = fmt.Errorf("missing secret")
)

Functions

func DecryptRawKey

func DecryptRawKey(key RawKey, secret string) (auth.JWTKey, error)

Types

type DB

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

func New

func New(opts ...Opt) (*DB, error)

func (*DB) ListJWTKeys

func (db *DB) ListJWTKeys(c context.Context) ([]auth.JWTKey, error)

ListJWTKeys lists the keys from database.

func (*DB) RotateJWTKeys

func (db *DB) RotateJWTKeys(ctx context.Context, new auth.JWTKey) error

RotateJWTKeys rotates the JWT keys in database.

type Opt

type Opt func(*DB)

func WithSecret

func WithSecret(secret string) Opt

func WithSqlxDB

func WithSqlxDB(db *sqlx.DB) Opt

type RawKey

type RawKey struct {
	sqlxutil.Model
	KID        string `db:"k_id"`
	PrivateKey []byte `db:"private_key_as_bytes"`
	PublicKey  []byte `db:"public_key_as_bytes"`
}

Jump to

Keyboard shortcuts

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