secrets

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package secrets defines the opaque value and reference contracts used by LoopRig's credential stores. Secret values deliberately have no useful ordinary representation: callers must opt in to Bytes at the point where a value is consumed.

Index

Constants

View Source
const (
	MaxReferenceLength     = 512
	MaxReferencePathLength = 448
	MaxReferenceSchemeLen  = 32
)

Reference limits keep parsing and canonicalization bounded at untrusted boundaries. Paths are slash-separated opaque identifiers, not filesystem paths.

View Source
const MaxPageItems = 1000

MaxPageItems is the largest page an implementation may return. A caller's smaller limit is still mandatory for each List operation.

View Source
const MaxPageTokenLength = 256

MaxPageTokenLength bounds opaque continuation tokens.

View Source
const MaxSecretSize = 1 << 20

MaxSecretSize is the largest value accepted by New. Keeping the bound in the base package gives stores a common limit to enforce before allocating or decoding an envelope.

View Source
const MaxVersionLength = 256

MaxVersionLength bounds backend-issued opaque versions.

Variables

View Source
var (
	ErrInvalidVersion        = errors.New("secrets: invalid version")
	ErrInvalidOptions        = errors.New("secrets: invalid options")
	ErrInvalidPageToken      = errors.New("secrets: invalid page token")
	ErrNotFound              = errors.New("secrets: secret not found")
	ErrUnsupportedScheme     = errors.New("secrets: unsupported scheme")
	ErrUnsupportedCapability = errors.New("secrets: unsupported capability")
	ErrInsecurePath          = errors.New("secrets: insecure path")
	ErrCorruptRecord         = errors.New("secrets: corrupt record")
	ErrConflict              = errors.New("secrets: version conflict")
	ErrUnavailable           = errors.New("secrets: backend unavailable")
	ErrCanceled              = errors.New("secrets: operation canceled")
)
View Source
var (
	ErrInvalidReference = errors.New("secrets: invalid reference")
	ErrInvalidNamespace = errors.New("secrets: invalid namespace")
)
View Source
var (
	// ErrEmptySecret identifies an empty value passed to New.
	ErrEmptySecret = errors.New("secrets: empty secret")
	// ErrSecretTooLarge identifies a value over MaxSecretSize.
	ErrSecretTooLarge = errors.New("secrets: secret value too large")
	// ErrZeroSecret identifies an invalid zero Secret supplied to a record or
	// mutation.  A zero Secret has no value that can be disclosed or stored.
	ErrZeroSecret = errors.New("secrets: zero secret")
)
View Source
var VersionUnsupported = Version{/* contains filtered or unexported fields */}

VersionUnsupported explicitly represents a backend that cannot provide a stable comparable version. It is not synthesized from timestamps or fingerprints, and it is the only supported way to report the marker.

Functions

func IsVisibleCommit

func IsVisibleCommit(err error) bool

IsVisibleCommit reports whether err contains a visible-commit classification without requiring consumers to import a backend-specific error package.

Types

type CanceledError

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

CanceledError reports cancellation while preserving errors.Is only for the normalized context cancellation sentinels, without retaining arbitrary wrapped text.

func NewCanceledError

func NewCanceledError(operation string, cause error) *CanceledError

NewCanceledError constructs a bounded cancellation error. Only the two standard context sentinels are retained as a normalized kind.

func (*CanceledError) Error

func (e *CanceledError) Error() string

func (*CanceledError) Format

func (e *CanceledError) Format(state fmt.State, verb rune)

func (*CanceledError) GoString

func (e *CanceledError) GoString() string

func (*CanceledError) Is

func (e *CanceledError) Is(target error) bool

func (*CanceledError) LogValue

func (e *CanceledError) LogValue() slog.Value

type ConflictError

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

ConflictError reports a failed compare-and-swap precondition. Version details are intentionally not retained in the public error; callers can resolve the record again if they need fresh coordination state.

func NewConflictError

func NewConflictError(reference Reference) *ConflictError

NewConflictError constructs an error carrying only the safe reference.

func (*ConflictError) Error

func (e *ConflictError) Error() string

func (*ConflictError) Format

func (e *ConflictError) Format(state fmt.State, verb rune)

func (*ConflictError) GoString

func (e *ConflictError) GoString() string

func (*ConflictError) LogValue

func (e *ConflictError) LogValue() slog.Value

func (*ConflictError) Reference

func (e *ConflictError) Reference() Reference

Reference returns the safe reference associated with the error.

func (*ConflictError) Unwrap

func (e *ConflictError) Unwrap() error

type CorruptRecordError

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

CorruptRecordError reports a record that cannot be safely decoded.

func NewCorruptRecordError

func NewCorruptRecordError(reference Reference) *CorruptRecordError

NewCorruptRecordError constructs an error carrying only the safe reference. Backend detail is intentionally not accepted or retained.

func (*CorruptRecordError) Error

func (e *CorruptRecordError) Error() string

func (*CorruptRecordError) Format

func (e *CorruptRecordError) Format(state fmt.State, verb rune)

func (*CorruptRecordError) GoString

func (e *CorruptRecordError) GoString() string

func (*CorruptRecordError) LogValue

func (e *CorruptRecordError) LogValue() slog.Value

func (*CorruptRecordError) Reference

func (e *CorruptRecordError) Reference() Reference

Reference returns the safe reference associated with the error.

func (*CorruptRecordError) Unwrap

func (e *CorruptRecordError) Unwrap() error

type DeleteOptions

type DeleteOptions struct {
	Precondition    Precondition
	ExpectedVersion Version
}

DeleteOptions carries an unconditional or compare-and-swap condition. The zero value is unconditional and deletion of an absent reference is idempotent.

func CompareAndSwapDelete

func CompareAndSwapDelete(version Version) DeleteOptions

CompareAndSwapDelete returns options requiring the supplied existing version.

func UnconditionalDelete

func UnconditionalDelete() DeleteOptions

UnconditionalDelete returns options for an unconditional delete.

func (DeleteOptions) Validate

func (o DeleteOptions) Validate() error

Validate checks DeleteOptions.

type DeleteResult

type DeleteResult struct {
	Reference Reference
	Version   Version
	Status    DeleteStatus
}

DeleteResult reports an idempotent deletion without returning secret bytes. A successful unconditional delete may report VersionUnsupported only when the backend explicitly lacks comparable versions; that marker never implies that a compare-and-swap precondition was checked or can be used safely.

func NewDeleteResult

func NewDeleteResult(reference Reference, status DeleteStatus, version Version) (DeleteResult, error)

NewDeleteResult constructs a value-free delete result and validates its status/version combination. Absent deletes use VersionUnsupported because no record version exists to report.

func (DeleteResult) Validate

func (r DeleteResult) Validate() error

Validate checks a delete result's status and safe coordination metadata.

type DeleteStatus

type DeleteStatus uint8

DeleteStatus reports whether a delete removed a record or found it already absent. It is intentionally one status field rather than several booleans whose combinations could be contradictory.

const (
	DeleteStatusAbsent DeleteStatus = iota
	DeleteStatusDeleted
)

func (DeleteStatus) String

func (s DeleteStatus) String() string

type EmptySecretError

type EmptySecretError struct{}

EmptySecretError reports an empty value passed to New.

func (*EmptySecretError) Error

func (e *EmptySecretError) Error() string

func (*EmptySecretError) Format

func (e *EmptySecretError) Format(state fmt.State, verb rune)

func (*EmptySecretError) GoString

func (e *EmptySecretError) GoString() string

func (*EmptySecretError) LogValue

func (e *EmptySecretError) LogValue() slog.Value

func (*EmptySecretError) Unwrap

func (e *EmptySecretError) Unwrap() error

type InsecurePathError

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

InsecurePathError reports an unsafe path or permission boundary.

func NewInsecurePathError

func NewInsecurePathError(reason string) *InsecurePathError

NewInsecurePathError constructs a bounded insecure-path error.

func (*InsecurePathError) Error

func (e *InsecurePathError) Error() string

func (*InsecurePathError) Format

func (e *InsecurePathError) Format(state fmt.State, verb rune)

func (*InsecurePathError) GoString

func (e *InsecurePathError) GoString() string

func (*InsecurePathError) LogValue

func (e *InsecurePathError) LogValue() slog.Value

func (*InsecurePathError) Reason

func (e *InsecurePathError) Reason() string

Reason returns a normalized, secret-free reason label.

func (*InsecurePathError) Unwrap

func (e *InsecurePathError) Unwrap() error

type InvalidNamespaceError

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

InvalidNamespaceError reports a malformed namespace without retaining raw input.

func NewInvalidNamespaceError

func NewInvalidNamespaceError(reason string) *InvalidNamespaceError

NewInvalidNamespaceError constructs a bounded invalid-namespace error.

func (*InvalidNamespaceError) Error

func (e *InvalidNamespaceError) Error() string

func (*InvalidNamespaceError) Format

func (e *InvalidNamespaceError) Format(state fmt.State, verb rune)

func (*InvalidNamespaceError) GoString

func (e *InvalidNamespaceError) GoString() string

func (*InvalidNamespaceError) LogValue

func (e *InvalidNamespaceError) LogValue() slog.Value

func (*InvalidNamespaceError) Reason

func (e *InvalidNamespaceError) Reason() string

Reason returns a normalized, secret-free reason label.

func (*InvalidNamespaceError) Unwrap

func (e *InvalidNamespaceError) Unwrap() error

type InvalidOptionsError

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

InvalidOptionsError reports malformed mutation or pagination options.

func NewInvalidOptionsError

func NewInvalidOptionsError(reason string) *InvalidOptionsError

NewInvalidOptionsError constructs a bounded invalid-options error.

func (*InvalidOptionsError) Error

func (e *InvalidOptionsError) Error() string

func (*InvalidOptionsError) Format

func (e *InvalidOptionsError) Format(state fmt.State, verb rune)

func (*InvalidOptionsError) GoString

func (e *InvalidOptionsError) GoString() string

func (*InvalidOptionsError) LogValue

func (e *InvalidOptionsError) LogValue() slog.Value

func (*InvalidOptionsError) Reason

func (e *InvalidOptionsError) Reason() string

Reason returns a normalized, secret-free reason label.

func (*InvalidOptionsError) Unwrap

func (e *InvalidOptionsError) Unwrap() error

type InvalidPageTokenError

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

InvalidPageTokenError reports malformed or oversized token text without retaining raw input.

func NewInvalidPageTokenError

func NewInvalidPageTokenError(reason string) *InvalidPageTokenError

NewInvalidPageTokenError constructs a bounded invalid-page-token error.

func (*InvalidPageTokenError) Error

func (e *InvalidPageTokenError) Error() string

func (*InvalidPageTokenError) Format

func (e *InvalidPageTokenError) Format(state fmt.State, verb rune)

func (*InvalidPageTokenError) GoString

func (e *InvalidPageTokenError) GoString() string

func (*InvalidPageTokenError) LogValue

func (e *InvalidPageTokenError) LogValue() slog.Value

func (*InvalidPageTokenError) Reason

func (e *InvalidPageTokenError) Reason() string

Reason returns a normalized, secret-free reason label.

func (*InvalidPageTokenError) Unwrap

func (e *InvalidPageTokenError) Unwrap() error

type InvalidReferenceError

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

InvalidReferenceError reports malformed or unsafe reference text without retaining the caller's raw input (which could itself contain a credential).

func NewInvalidReferenceError

func NewInvalidReferenceError(reason string) *InvalidReferenceError

NewInvalidReferenceError constructs a bounded invalid-reference error. The reason is normalized to a small package-owned vocabulary and is never retained verbatim.

func (*InvalidReferenceError) Error

func (e *InvalidReferenceError) Error() string

func (*InvalidReferenceError) Format

func (e *InvalidReferenceError) Format(state fmt.State, verb rune)

func (*InvalidReferenceError) GoString

func (e *InvalidReferenceError) GoString() string

func (*InvalidReferenceError) LogValue

func (e *InvalidReferenceError) LogValue() slog.Value

func (*InvalidReferenceError) Reason

func (e *InvalidReferenceError) Reason() string

Reason returns a normalized, secret-free reason label.

func (*InvalidReferenceError) Unwrap

func (e *InvalidReferenceError) Unwrap() error

type InvalidVersionError

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

InvalidVersionError reports an empty, oversized, or unsafe version without retaining the caller's raw value.

func NewInvalidVersionError

func NewInvalidVersionError(reason string) *InvalidVersionError

NewInvalidVersionError constructs a bounded invalid-version error.

func (*InvalidVersionError) Error

func (e *InvalidVersionError) Error() string

func (*InvalidVersionError) Format

func (e *InvalidVersionError) Format(state fmt.State, verb rune)

func (*InvalidVersionError) GoString

func (e *InvalidVersionError) GoString() string

func (*InvalidVersionError) LogValue

func (e *InvalidVersionError) LogValue() slog.Value

func (*InvalidVersionError) Reason

func (e *InvalidVersionError) Reason() string

Reason returns a normalized, secret-free reason label.

func (*InvalidVersionError) Unwrap

func (e *InvalidVersionError) Unwrap() error

type Lister

type Lister interface {
	List(context.Context, Namespace, PageToken, int) (Page[Metadata], error)
}

Lister is an optional metadata-only capability. Implementations must honor the caller's bounded limit and namespace exactly; values are never listed.

type Metadata

type Metadata struct {
	Reference Reference
	Version   Version
	UpdatedAt time.Time
}

Metadata is the value-free portion of a Record used for listing.

func (Metadata) Validate

func (m Metadata) Validate() error

Validate checks that metadata contains no secret value and only safe coordination fields.

type Namespace

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

Namespace is a canonical scheme and path prefix used to constrain listing. It cannot contain references from another scheme or a sibling prefix.

func NewNamespace

func NewNamespace(scheme, prefix string) (Namespace, error)

NewNamespace constructs a namespace. A single trailing slash is accepted as presentation syntax and removed from the canonical prefix.

func ParseNamespace

func ParseNamespace(raw string) (Namespace, error)

ParseNamespace parses a namespace written in reference form. It accepts a single trailing slash to make prefix literals convenient, while String always emits the canonical no-trailing-slash form.

func (Namespace) Canonical

func (n Namespace) Canonical() string

Canonical returns the bounded stable namespace representation.

func (Namespace) Contains

func (n Namespace) Contains(ref Reference) bool

Contains reports whether ref is the namespace itself or a descendant path. The segment boundary check prevents "personal" from containing "personally".

func (Namespace) IsZero

func (n Namespace) IsZero() bool

IsZero reports whether n is invalid/empty.

func (Namespace) Path

func (n Namespace) Path() string

Path returns the canonical path prefix without a trailing slash.

func (Namespace) Prefix

func (n Namespace) Prefix() string

Prefix is an alias for Path, useful at call sites that emphasize boundary semantics.

func (Namespace) Scheme

func (n Namespace) Scheme() string

Scheme returns the namespace's validated scheme.

func (Namespace) String

func (n Namespace) String() string

String returns the canonical namespace representation.

type NotFoundError

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

NotFoundError reports an absent safe reference.

func NewNotFoundError

func NewNotFoundError(reference Reference) *NotFoundError

NewNotFoundError constructs an error carrying only the already-validated reference.

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

func (*NotFoundError) Format

func (e *NotFoundError) Format(state fmt.State, verb rune)

func (*NotFoundError) GoString

func (e *NotFoundError) GoString() string

func (*NotFoundError) LogValue

func (e *NotFoundError) LogValue() slog.Value

func (*NotFoundError) Reference

func (e *NotFoundError) Reference() Reference

Reference returns the safe reference associated with the error.

func (*NotFoundError) Unwrap

func (e *NotFoundError) Unwrap() error

type Page

type Page[T any] struct {
	Items     []T
	NextToken PageToken
}

Page is a bounded metadata page and optional opaque continuation token.

func NewPage

func NewPage[T any](items []T, next PageToken) (Page[T], error)

NewPage copies items and validates the requested bounded page size.

func (Page[T]) Validate

func (p Page[T]) Validate(limit int) error

Validate checks a page against the mandatory caller limit.

type PageToken

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

PageToken is an opaque bounded continuation token. Its representation is constructor-enforced and comparable; its zero value denotes the first page.

func NewPageToken

func NewPageToken(token string) (PageToken, error)

NewPageToken validates an opaque continuation token. Empty input is the zero first-page token.

func (PageToken) IsZero

func (p PageToken) IsZero() bool

IsZero reports whether p denotes the first page.

func (PageToken) MarshalText

func (p PageToken) MarshalText() ([]byte, error)

MarshalText emits the bounded token text.

func (PageToken) String

func (p PageToken) String() string

String returns token text.

func (*PageToken) UnmarshalText

func (p *PageToken) UnmarshalText(text []byte) error

UnmarshalText accepts bounded printable token text and leaves p unchanged on failure.

func (PageToken) Valid

func (p PageToken) Valid() bool

Valid reports whether p is zero or bounded printable token text.

type Precondition

type Precondition uint8

Precondition selects the mutation condition for Put and Delete.

const (
	PreconditionUnconditional Precondition = iota
	PreconditionCreateOnly
	PreconditionCompareAndSwap
)

type PreconditionCapabilities

type PreconditionCapabilities interface {
	SupportsCreateOnly() bool
	SupportsCompareAndSwap() bool
}

PreconditionCapabilities reports affirmative support for conditional mutations. A Store that does not support a requested precondition must return an UnsupportedCapabilityError instead of treating it as unconditional.

type PutOptions

type PutOptions struct {
	Precondition    Precondition
	ExpectedVersion Version
}

PutOptions carries one explicit mutation precondition. The zero value is unconditional. ExpectedVersion is required only for compare-and-swap.

func CompareAndSwapPut

func CompareAndSwapPut(version Version) PutOptions

CompareAndSwapPut returns options requiring the supplied existing version.

func CreateOnlyPut

func CreateOnlyPut() PutOptions

CreateOnlyPut returns options that succeed only when the reference is absent.

func UnconditionalPut

func UnconditionalPut() PutOptions

UnconditionalPut returns options for an unconditional mutation.

func (PutOptions) Validate

func (o PutOptions) Validate() error

Validate checks that PutOptions describe exactly one supported condition.

type Record

type Record struct {
	Reference Reference
	Value     Secret
	Version   Version
	UpdatedAt time.Time
}

Record is the resolved value plus safe coordination metadata. Callers do not choose Version or UpdatedAt when a backend creates a record.

func (Record) Metadata

func (r Record) Metadata() Metadata

Metadata returns a value-free copy of r.

func (Record) Validate

func (r Record) Validate() error

Validate checks that a record contains a safe reference, a real secret, and a valid version. Timestamp zero is allowed because remote backends may not publish update timestamps.

type Reference

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

Reference is a canonical, non-secret identifier. The path is opaque to this package and is interpreted by the backend selected by Scheme; it is never treated as a filesystem path.

func NewReference

func NewReference(scheme, path string) (Reference, error)

NewReference builds a canonical reference from a validated scheme and opaque slash-separated path.

func ParseReference

func ParseReference(raw string) (Reference, error)

ParseReference parses a strict scheme://path reference and returns its canonical representation. Schemes are normalized to lowercase; paths are preserved exactly after validation. Query strings, fragments, URL authorities, filesystem traversal syntax, and endpoint schemes are not accepted.

func (Reference) Canonical

func (r Reference) Canonical() string

Canonical returns the same bounded stable representation as String.

func (Reference) IsZero

func (r Reference) IsZero() bool

IsZero reports whether r is the invalid zero Reference.

func (Reference) MarshalText

func (r Reference) MarshalText() ([]byte, error)

MarshalText allows safe persistence of the canonical reference.

func (Reference) Path

func (r Reference) Path() string

Path returns the validated opaque path.

func (Reference) Scheme

func (r Reference) Scheme() string

Scheme returns the validated backend scheme.

func (Reference) String

func (r Reference) String() string

String returns the canonical stable representation. The zero Reference has an empty representation.

func (*Reference) UnmarshalText

func (r *Reference) UnmarshalText(text []byte) error

UnmarshalText parses canonical reference text and leaves r unchanged on error.

type Resolver

type Resolver interface {
	Resolve(context.Context, Reference) (Record, error)
}

Resolver is the read-only secret resolution contract.

type Secret

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

Secret is an immutable opaque value. Its bytes are private and all normal formatting and structured logging paths are redacted.

The zero value is invalid. Construct values with New and call Bytes only at an explicit value-consumption boundary.

func New

func New(value []byte) (Secret, error)

New copies value and returns an opaque Secret. The input remains owned by the caller and may be changed or cleared immediately after this call.

func (Secret) Bytes

func (s Secret) Bytes() []byte

Bytes returns a copy of the value. It returns nil for the invalid zero Secret, so the zero value never discloses a value or appears storable.

func (Secret) Format

func (s Secret) Format(state fmt.State, verb rune)

Format implements fmt.Formatter and ignores every verb, flag, width, and precision. This prevents numeric and nested formatting from falling back to the unexported byte slice representation.

func (Secret) GoString

func (s Secret) GoString() string

GoString implements fmt.GoStringer for %#v and always returns a fixed redaction. It deliberately does not include the underlying byte length.

func (Secret) IsZero

func (s Secret) IsZero() bool

IsZero reports whether s is the invalid zero Secret.

func (Secret) LogValue

func (s Secret) LogValue() slog.Value

LogValue implements slog.LogValuer and keeps Secret values out of structured logs, including when passed through slog.Any.

func (Secret) String

func (s Secret) String() string

String implements fmt.Stringer and always returns a fixed redaction.

func (Secret) Valid

func (s Secret) Valid() bool

Valid reports whether s was constructed by New and contains a bounded, non-empty value.

func (Secret) Validate

func (s Secret) Validate() error

Validate returns a typed error when s is the zero/invalid value.

type SecretSizeError

type SecretSizeError struct {
	Limit int
	Got   int
}

SecretSizeError reports a value larger than the module's bound. It carries only sizes, never any value bytes.

func (*SecretSizeError) Error

func (e *SecretSizeError) Error() string

func (*SecretSizeError) Format

func (e *SecretSizeError) Format(state fmt.State, verb rune)

func (*SecretSizeError) GoString

func (e *SecretSizeError) GoString() string

func (*SecretSizeError) LogValue

func (e *SecretSizeError) LogValue() slog.Value

func (*SecretSizeError) Unwrap

func (e *SecretSizeError) Unwrap() error

type Store

Store is a mutable Resolver. Implementations must reject zero Secrets and enforce the requested precondition rather than silently weakening it.

type UnavailableError

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

UnavailableError reports an unavailable backend. Operation is normalized to a closed vocabulary and arbitrary causes are intentionally not accepted or retained.

func NewUnavailableError

func NewUnavailableError(operation string, reference Reference) *UnavailableError

NewUnavailableError constructs a bounded unavailable-backend error.

func (*UnavailableError) Error

func (e *UnavailableError) Error() string

func (*UnavailableError) Format

func (e *UnavailableError) Format(state fmt.State, verb rune)

func (*UnavailableError) GoString

func (e *UnavailableError) GoString() string

func (*UnavailableError) Is

func (e *UnavailableError) Is(target error) bool

func (*UnavailableError) LogValue

func (e *UnavailableError) LogValue() slog.Value

func (*UnavailableError) Reference

func (e *UnavailableError) Reference() Reference

Reference returns the safe reference associated with the error.

type UnsupportedCapabilityError

type UnsupportedCapabilityError struct{}

UnsupportedCapabilityError reports a requested capability that the backend cannot provide safely. Capability detail is intentionally not retained.

func NewUnsupportedCapabilityError

func NewUnsupportedCapabilityError() *UnsupportedCapabilityError

NewUnsupportedCapabilityError constructs a bounded unsupported-capability error.

func (*UnsupportedCapabilityError) Error

func (*UnsupportedCapabilityError) Format

func (e *UnsupportedCapabilityError) Format(state fmt.State, verb rune)

func (*UnsupportedCapabilityError) GoString

func (e *UnsupportedCapabilityError) GoString() string

func (*UnsupportedCapabilityError) LogValue

func (e *UnsupportedCapabilityError) LogValue() slog.Value

func (*UnsupportedCapabilityError) Unwrap

func (e *UnsupportedCapabilityError) Unwrap() error

type UnsupportedSchemeError

type UnsupportedSchemeError struct{}

UnsupportedSchemeError reports a backend scheme for which an implementation has no resolver. Scheme detail is deliberately not retained: even a syntactically valid scheme can be caller-controlled secret-bearing input.

func NewUnsupportedSchemeError

func NewUnsupportedSchemeError() *UnsupportedSchemeError

NewUnsupportedSchemeError constructs a bounded unsupported-scheme error.

func (*UnsupportedSchemeError) Error

func (e *UnsupportedSchemeError) Error() string

func (*UnsupportedSchemeError) Format

func (e *UnsupportedSchemeError) Format(state fmt.State, verb rune)

func (*UnsupportedSchemeError) GoString

func (e *UnsupportedSchemeError) GoString() string

func (*UnsupportedSchemeError) LogValue

func (e *UnsupportedSchemeError) LogValue() slog.Value

func (*UnsupportedSchemeError) Unwrap

func (e *UnsupportedSchemeError) Unwrap() error

type Version

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

Version is an opaque backend-issued coordination value. Its representation is constructor-enforced and comparable, while the unsupported marker has a private tag so it cannot collide with a supported value's text.

func NewVersion

func NewVersion(value string) (Version, error)

NewVersion validates a backend-issued version. The explicit unsupported sentinel is reserved for direct backend use via VersionUnsupported.

func (Version) IsUnsupported

func (v Version) IsUnsupported() bool

IsUnsupported reports explicit lack of backend version support.

func (Version) IsZero

func (v Version) IsZero() bool

IsZero reports whether no version was supplied.

func (Version) MarshalText

func (v Version) MarshalText() ([]byte, error)

MarshalText emits the bounded canonical version text, including the explicit unsupported marker.

func (Version) String

func (v Version) String() string

String returns the opaque version text, or an empty string for zero.

func (*Version) UnmarshalText

func (v *Version) UnmarshalText(text []byte) error

UnmarshalText accepts the explicit unsupported marker or a supported value, leaving v unchanged on failure.

func (Version) Valid

func (v Version) Valid() bool

Valid reports whether v is a bounded, printable version or the explicit unsupported sentinel.

type VersionMismatchError

type VersionMismatchError = ConflictError

VersionMismatchError is a descriptive alias for ConflictError.

type VisibleCommitError

type VisibleCommitError interface {
	error
	Visible() bool
}

VisibleCommitError classifies a mutation error whose linearization point has already passed. Implementations must keep any additional error detail bounded and safe; callers use the returned mutation result as authoritative and must not assume the previous state survived.

type ZeroSecretError

type ZeroSecretError struct{}

ZeroSecretError reports use of a zero Secret where a value is required.

func (*ZeroSecretError) Error

func (e *ZeroSecretError) Error() string

func (*ZeroSecretError) Format

func (e *ZeroSecretError) Format(state fmt.State, verb rune)

func (*ZeroSecretError) GoString

func (e *ZeroSecretError) GoString() string

func (*ZeroSecretError) LogValue

func (e *ZeroSecretError) LogValue() slog.Value

func (*ZeroSecretError) Unwrap

func (e *ZeroSecretError) Unwrap() error

Directories

Path Synopsis
Package contracttest contains reusable contract checks for secrets.Store implementations.
Package contracttest contains reusable contract checks for secrets.Store implementations.
examples
local-store command
references command
secret-safety command
Package local implements an owner-only, descriptor-relative local secret store.
Package local implements an owner-only, descriptor-relative local secret store.

Jump to

Keyboard shortcuts

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