Help us shape the future of Go! Take the 2026 Go Developer Survey

credential

package
v0.4.22 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrBrokerNotConfigured = errors.New("credential broker not configured")
	ErrEmptyRef            = errors.New("credential ref is empty")
)

Functions

This section is empty.

Types

type Broker

type Broker interface {
	Resolve(ctx context.Context, ref string, scope string) (Data, error)
}

Broker resolves opaque credential references into usable secret material. Implementations must never leak secret values through returned errors.

type Class added in v0.4.21

type Class string

Class is the normative BaseHarbor credential ownership class.

const (
	ClassHumanManagement    Class = "human-management"
	ClassApplicationService Class = "application-service"
	ClassInternalMachine    Class = "internal-machine"
)

func ParseClass added in v0.4.21

func ParseClass(value string) (Class, error)

ParseClass validates the public v1 credential taxonomy.

func (Class) IsMachineIdentity added in v0.4.21

func (c Class) IsMachineIdentity() bool

IsMachineIdentity reports whether the class belongs to the isolated BaseHarbor-internal machine identity boundary.

func (Class) Shareable added in v0.4.21

func (c Class) Shareable() bool

Shareable reports whether the class may participate in an explicit sharing policy. Internal machine identity is never shareable.

type Data

type Data struct {
	Payload map[string][]byte `json:"-"`
	Expires *time.Time        `json:"-"`
}

Data contains resolved secret material for a single operation. Payload and expiry metadata are deliberately excluded from JSON output.

type FilePreparedMaterialStore added in v0.4.21

type FilePreparedMaterialStore struct {
	Dir string
}

func (FilePreparedMaterialStore) Clear added in v0.4.21

func (s FilePreparedMaterialStore) Clear(key string) error

func (FilePreparedMaterialStore) Load added in v0.4.21

func (s FilePreparedMaterialStore) Load(key string) ([]byte, error)

func (FilePreparedMaterialStore) Save added in v0.4.21

func (s FilePreparedMaterialStore) Save(key string, material []byte) error

type FileRotationJournal added in v0.4.21

type FileRotationJournal struct {
	Path string
}

func (FileRotationJournal) Clear added in v0.4.21

func (j FileRotationJournal) Clear(key string) error

func (FileRotationJournal) Load added in v0.4.21

func (FileRotationJournal) Save added in v0.4.21

func (j FileRotationJournal) Save(key string, phase RotationPhase) error

type NoopBroker

type NoopBroker struct{}

NoopBroker is the safe default when no secret backend is configured.

func (NoopBroker) Resolve

func (NoopBroker) Resolve(_ context.Context, ref string, _ string) (Data, error)

type PreparedMaterialStore added in v0.4.21

type PreparedMaterialStore interface {
	Load(key string) ([]byte, error)
	Save(key string, material []byte) error
	Clear(key string) error
}

type Rotation added in v0.4.21

type Rotation struct {
	Prepare   func(context.Context) error
	Reconcile func(context.Context) error
	Verify    func(context.Context) error
	Retire    func(context.Context) error
	Rollback  func(context.Context) error
	Journal   RotationJournal
	Prepared  PreparedMaterialStore
	Key       string
}

Rotation performs one non-HA credential/material replacement.

Prepare must make new material usable without retiring the old path. Reconcile moves the managed consumer to the new material. Verify proves readiness/authentication with the new material. Retire runs only after successful verification.

func (Rotation) Run added in v0.4.21

func (r Rotation) Run(ctx context.Context) error

type RotationJournal added in v0.4.21

type RotationJournal interface {
	Load(key string) (RotationPhase, error)
	Save(key string, phase RotationPhase) error
	Clear(key string) error
}

type RotationPhase added in v0.4.21

type RotationPhase string
const (
	RotationPrepared   RotationPhase = "PREPARED"
	RotationReconciled RotationPhase = "RECONCILED"
	RotationVerified   RotationPhase = "VERIFIED"
	RotationRetired    RotationPhase = "RETIRED"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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