keys

package
v0.0.0-...-9831a62 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2021 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrKeyIsEmpty = fmt.Errorf("key is empty")
)

Known errors

Functions

This section is empty.

Types

type Database

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

Database is a persistent storage for jwt keys.

func NewDatabase

func NewDatabase(db *sql.DB) *Database

NewDatabase crates new DB.

func (*Database) Create

func (db *Database) Create(ctx context.Context, key *Key) error

Create adds a key to the db.

func (*Database) Delete

func (db *Database) Delete(ctx context.Context, id string) error

Delete deletes key by id.

func (*Database) Get

func (db *Database) Get(ctx context.Context, id string) (*Key, error)

Get returns a key by the given id.

func (*Database) List

func (db *Database) List(ctx context.Context) ([]*Key, error)

List returns all keys.

type Key

type Key struct {
	ID        string
	PublicDER []byte
}

Key is a public key.

func New

func New(publicDER []byte) (*Key, error)

New creates a new key with a public der payload.

Jump to

Keyboard shortcuts

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