custody

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StateActive  = "active"
	StateRevoked = "revoked"
)

Variables

View Source
var (
	ErrPartialBundle   = errors.New("partial sealed custody bundle")
	ErrStaleKEKVersion = errors.New("stale KEK version")
	ErrRotateConflict  = errors.New("custody rotate conflict")
	ErrRevokedRef      = errors.New("revoked custody ref")
)

Functions

This section is empty.

Types

type AuditEvent

type AuditEvent struct {
	Action    string
	RefID     string
	Status    string
	SecretRef string
	Fields    map[string]string
	Time      time.Time
}

type AuditWriter

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

func NewAuditWriter

func NewAuditWriter(path string) *AuditWriter

func (*AuditWriter) Append

func (w *AuditWriter) Append(event AuditEvent) error

type Config

type Config struct {
	BackendID     string
	StorageDir    string
	KEKRef        string
	KEKVersion    string
	SchemaVersion uint32
	ResolveSecret SecretResolver
}

type CreateRequest

type CreateRequest struct {
	RefID      string
	AccountRef string
	DeviceRef  string
	Material   map[string][]byte
	Now        time.Time
}

type Metadata

type Metadata struct {
	BackendID     string    `json:"backend_id"`
	RefID         string    `json:"ref_id"`
	SchemaVersion uint32    `json:"schema_version"`
	KEKRef        string    `json:"kek_ref"`
	KEKVersion    string    `json:"kek_version"`
	CreatedAt     time.Time `json:"created_at"`
	RotatedAt     time.Time `json:"rotated_at"`
	RevokedAt     time.Time `json:"revoked_at,omitempty"`
	State         string    `json:"state"`
	AccountRef    string    `json:"account_ref,omitempty"`
	DeviceRef     string    `json:"device_ref,omitempty"`
}

func (Metadata) MarshalJSON

func (m Metadata) MarshalJSON() ([]byte, error)

type RotateRequest

type RotateRequest struct {
	RefID              string
	ExpectedKekVersion string
	NewKekRef          string
	NewKekVersion      string
	Now                time.Time
}

type SecretResolver

type SecretResolver func(string) ([]byte, error)

type Store

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

func NewSealedStore

func NewSealedStore(cfg Config) (*Store, error)

func (*Store) Config

func (s *Store) Config() Config

func (*Store) Create

func (s *Store) Create(req CreateRequest) (Metadata, error)

func (*Store) Inspect

func (s *Store) Inspect(refID string) (Metadata, error)

func (*Store) Restore

func (s *Store) Restore(refID string) (Metadata, error)

func (*Store) Revoke

func (s *Store) Revoke(refID string, now time.Time) (Metadata, error)

func (*Store) Rotate

func (s *Store) Rotate(req RotateRequest) (Metadata, error)

Jump to

Keyboard shortcuts

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