h2signer

package
v0.2.16 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2023 License: MPL-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PEMBlockTypePrivateKey = "PRIVATE KEY"
	PEMBlockTypePublicKey  = "PUBLIC KEY"
)

Variables

View Source
var (
	// ErrNotSupported is returned when t he signing key is not supported
	ErrNotSupported errNotSupported
	// ErrSigningKeyInvalid is returned when the signing key config is invalid
	ErrSigningKeyInvalid errSigningKeyInvalid
	// ErrVerifierKeyInvalid is returned when the verifier key config is invalid
	ErrVerifierKeyInvalid errVerifierKeyInvalid
)

Functions

func KeyID

func KeyID(params string) string

KeyID computes a key id from params

Types

type SigningKey

type SigningKey interface {
	Alg() string
	Private() any
	Verifier() VerifierKey
}

SigningKey is a signing key interface

func SigningKeyFromParams

func SigningKeyFromParams(params string, signingKeys SigningKeyAlgs) (SigningKey, error)

SigningKeyFromParams creates a cipher from params

type SigningKeyAlgs

type SigningKeyAlgs interface {
	Register(b SigningKeyBuilder)
	Get(id string) (SigningKeyBuilder, bool)
}

SigningKeyAlgs are a map of valid signing keys

type SigningKeyBuilder

type SigningKeyBuilder interface {
	ID() string
	Build(params string) (SigningKey, error)
}

SigningKeyBuilder constructs a new signing key from params

type SigningKeyring

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

SigningKeyring holds signing keys

func NewSigningKeyring

func NewSigningKeyring() *SigningKeyring

NewSigningKeyring creates a new signing keyring

func (*SigningKeyring) Get

func (s *SigningKeyring) Get(id string) (SigningKey, bool)

Get gets a registered signing key by id

func (*SigningKeyring) Register

func (s *SigningKeyring) Register(k SigningKey)

Register registers a signing key

func (*SigningKeyring) Size

func (s *SigningKeyring) Size() int

Size returns the number of registered signing keys

type SigningKeysMap

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

func NewSigningKeysMap

func NewSigningKeysMap() *SigningKeysMap

func (*SigningKeysMap) Get

func (*SigningKeysMap) Register

func (m *SigningKeysMap) Register(b SigningKeyBuilder)

type VerifierKey

type VerifierKey interface {
	Alg() string
	ID() string
	Public() any
}

VerifierKey is a verifier key interface

func VerifierKeyFromParams

func VerifierKeyFromParams(params string, verifierKeys VerifierKeyAlgs) (VerifierKey, error)

VerifierKeyFromParams creates a verifier from params

type VerifierKeyAlgs

type VerifierKeyAlgs interface {
	Register(b VerifierKeyBuilder)
	Get(id string) (VerifierKeyBuilder, bool)
}

VerifierKeyAlgs are a map of valid verifier keys

type VerifierKeyBuilder

type VerifierKeyBuilder interface {
	ID() string
	Build(params string) (VerifierKey, error)
}

VerifierKeyBuilder constructs a new verifier key from params

type VerifierKeyring

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

VerifierKeyring holds verifier keys

func NewVerifierKeyring

func NewVerifierKeyring() *VerifierKeyring

NewVerifierKeyring creates a new verifier keyring

func (*VerifierKeyring) Get

func (s *VerifierKeyring) Get(id string) (VerifierKey, bool)

Get gets a registered verifier key by id

func (*VerifierKeyring) Register

func (s *VerifierKeyring) Register(k VerifierKey)

Register registers a verifier key

func (*VerifierKeyring) Size

func (s *VerifierKeyring) Size() int

Size returns the number of registered verifier keys

type VerifierKeysMap

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

func NewVerifierKeysMap

func NewVerifierKeysMap() *VerifierKeysMap

func (*VerifierKeysMap) Get

func (*VerifierKeysMap) Register

func (m *VerifierKeysMap) Register(b VerifierKeyBuilder)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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