keys

package
v0.0.0-...-2d4ef54 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

Package keys owns the encrypted master copies of gateway signing keys. Deployments reuse Current; Rotate starts an overlap, and Retire ends it only after the operator has confirmed the replacement is in use.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidCaller   = errors.New("unregistered gateway caller")
	ErrKeyNotFound     = errors.New("gateway key is not provisioned")
	ErrInvalidKeyring  = errors.New("invalid encrypted gateway keyring")
	ErrRotationPending = errors.New("previous gateway key must be retired before another rotation")
	ErrActiveKey       = errors.New("cannot retire the current signing key")
)

Functions

This section is empty.

Types

type Info

type Info struct {
	Caller string    `json:"caller"`
	Keys   []KeyInfo `json:"keys"`
}

type KeyInfo

type KeyInfo struct {
	KeyID     string `json:"key_id"`
	Current   bool   `json:"current"`
	CreatedAt int64  `json:"created_at_unix"`
}

type SigningKey

type SigningKey struct {
	Caller string `json:"caller"`
	KeyID  string `json:"key_id"`
	// contains filtered or unexported fields
}

SigningKey deliberately omits the secret from formatting and JSON. Exporters must explicitly request Credentials and write its Secret to a private file.

func (SigningKey) Credentials

func (k SigningKey) Credentials() gatewayauth.Credentials

func (SigningKey) GoString

func (k SigningKey) GoString() string

func (SigningKey) String

func (k SigningKey) String() string

type Store

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

func NewStore

func NewStore(db *gorm.DB, encryptionKey string) (*Store, error)

NewStore never creates schema, generates a master key, or seeds callers.

func (*Store) Current

func (s *Store) Current(ctx context.Context, caller string) (SigningKey, error)

func (*Store) Ensure

func (s *Store) Ensure(ctx context.Context, caller string) (SigningKey, error)

func (*Store) EnsureAll

func (s *Store) EnsureAll(ctx context.Context) ([]SigningKey, error)

EnsureAll provisions the catalog's callers and all registered host gateway identities in one transaction. Existing material is never regenerated.

func (*Store) ExternalVerification

func (s *Store) ExternalVerification(ctx context.Context) ([]VerificationKey, error)

func (*Store) GoString

func (s *Store) GoString() string

func (*Store) Info

func (s *Store) Info(ctx context.Context, caller string) (Info, error)

func (*Store) InternalVerification

func (s *Store) InternalVerification(ctx context.Context, callers []string) ([]VerificationKey, error)

InternalVerification never accepts external principals. The caller list must come from the target host's compiled ACL, not all callers in the fleet.

func (*Store) Retire

func (s *Store) Retire(ctx context.Context, caller, keyID string) error

func (*Store) Rotate

func (s *Store) Rotate(ctx context.Context, caller string) (SigningKey, error)

func (*Store) String

func (*Store) String() string

type VerificationKey

type VerificationKey struct {
	Caller string `json:"caller"`
	KeyID  string `json:"key_id"`
	Secret []byte `json:"-"`
}

VerificationKey carries material only to snapshot/Access exporters. Both current and retiring keys remain valid until explicit retirement.

func (VerificationKey) GoString

func (k VerificationKey) GoString() string

func (VerificationKey) String

func (k VerificationKey) String() string

Jump to

Keyboard shortcuts

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