Documentation
¶
Index ¶
- Constants
- Variables
- func CatalogTimeValid(value time.Time) bool
- func CreateCredentialState(ctx context.Context, catalog Catalog, store secrets.Store, ...) error
- func DeleteCredentialState(ctx context.Context, catalog Catalog, store secrets.Store, ...) error
- func NewCatalogCanceledError(cause ...error) error
- func NewCatalogConflictError(ref Reference) error
- func NewCatalogCorruptError() error
- func NewCatalogDurabilityUnknownError(ref Reference) error
- func NewCatalogNotFoundError(ref Reference) error
- func NewCatalogUnavailableError() error
- func NewCatalogUnsupportedError() error
- func PublishState(ctx context.Context, publisher StatePublisher, record Record, ...) error
- func ValidateRecord(record Record) error
- type Builder
- type CallbackListener
- type CanceledError
- type Catalog
- type CatalogCAS
- type CatalogDurabilityUnknownError
- type CatalogError
- func (e *CatalogError) Error() string
- func (e *CatalogError) Format(state fmt.State, _ rune)
- func (e *CatalogError) GoString() string
- func (e *CatalogError) Is(target error) bool
- func (e *CatalogError) LogValue() slog.Value
- func (e *CatalogError) Reference() Reference
- func (e *CatalogError) Unwrap() error
- func (e *CatalogError) Visible() bool
- type Clock
- type ClockFunc
- type Descriptor
- func (d Descriptor) Binding() DescriptorBinding
- func (d Descriptor) BindingCanonical() string
- func (d Descriptor) Canonical() string
- func (d Descriptor) Format(state fmt.State, _ rune)
- func (d Descriptor) GoString() string
- func (d Descriptor) LogValue() slog.Value
- func (d Descriptor) String() string
- func (d Descriptor) Valid() bool
- func (d Descriptor) Validate() error
- type DescriptorBinding
- type FactoryInput
- type Failure
- func (f Failure) Format(state fmt.State, _ rune)
- func (f Failure) GoString() string
- func (f Failure) IsZero() bool
- func (f Failure) LogValue() slog.Value
- func (f Failure) MarshalText() ([]byte, error)
- func (f Failure) String() string
- func (f *Failure) UnmarshalText(text []byte) error
- func (f Failure) Valid() bool
- func (f Failure) Validate() error
- type FailureClass
- type Finding
- type FindingKind
- type Generation
- func (g Generation) Format(state fmt.State, _ rune)
- func (g Generation) GoString() string
- func (g Generation) IsZero() bool
- func (g Generation) LogValue() slog.Value
- func (g Generation) MarshalText() ([]byte, error)
- func (g Generation) String() string
- func (g *Generation) UnmarshalText(text []byte) error
- func (g Generation) Valid() bool
- func (g Generation) Validate() error
- type InvalidDescriptorError
- func (e *InvalidDescriptorError) Error() string
- func (e *InvalidDescriptorError) Format(state fmt.State, _ rune)
- func (e *InvalidDescriptorError) GoString() string
- func (e *InvalidDescriptorError) LogValue() slog.Value
- func (e *InvalidDescriptorError) Reason() string
- func (e *InvalidDescriptorError) Unwrap() []error
- type InvalidFailureError
- type InvalidGenerationError
- func (e *InvalidGenerationError) Error() string
- func (e *InvalidGenerationError) Format(state fmt.State, _ rune)
- func (e *InvalidGenerationError) GoString() string
- func (e *InvalidGenerationError) LogValue() slog.Value
- func (e *InvalidGenerationError) Reason() string
- func (e *InvalidGenerationError) Unwrap() error
- type InvalidRecordError
- type InvalidReferenceError
- func (e *InvalidReferenceError) Error() string
- func (e *InvalidReferenceError) Format(state fmt.State, _ rune)
- func (e *InvalidReferenceError) GoString() string
- func (e *InvalidReferenceError) LogValue() slog.Value
- func (e *InvalidReferenceError) Reason() string
- func (e *InvalidReferenceError) Unwrap() error
- type Lease
- type NilContextError
- type NoneSource
- func (s *NoneSource) Acquire(ctx context.Context) (Lease, error)
- func (s *NoneSource) Close() error
- func (s *NoneSource) Descriptor() Descriptor
- func (s *NoneSource) Format(state fmt.State, _ rune)
- func (s *NoneSource) GoString() string
- func (s *NoneSource) Invalidate(ctx context.Context, generation Generation, failure Failure) error
- func (s *NoneSource) LogValue() slog.Value
- func (s *NoneSource) Reference() Reference
- func (s *NoneSource) String() string
- type OrphanState
- type ProviderFactories
- type ReconcileFinding
- type Record
- type Reference
- func (r Reference) Canonical() string
- func (r Reference) Format(state fmt.State, _ rune)
- func (r Reference) GoString() string
- func (r Reference) IsZero() bool
- func (r Reference) LogValue() slog.Value
- func (r Reference) MarshalText() ([]byte, error)
- func (r Reference) Name() string
- func (r Reference) Provider() string
- func (r Reference) Scheme() string
- func (r Reference) String() string
- func (r *Reference) UnmarshalText(text []byte) error
- func (r Reference) Valid() bool
- func (r Reference) Validate() error
- type RefreshCoordinator
- type Scheme
- type SharingScope
- type Source
- type SourceClosedError
- type SourceFactory
- type StateDeletionError
- type StatePublicationError
- func (e *StatePublicationError) Error() string
- func (e *StatePublicationError) Format(state fmt.State, _ rune)
- func (e *StatePublicationError) GoString() string
- func (e *StatePublicationError) LogValue() slog.Value
- func (e *StatePublicationError) Orphaned() bool
- func (e *StatePublicationError) Unwrap() []error
- type StatePublisher
- type UsageClass
Constants ¶
const ( ScopeProcess = SharingProcess ScopeHost = SharingHost ScopeDistributed = SharingDistributed SharingScopeProcess = SharingProcess SharingScopeHost = SharingHost SharingScopeDistributed = SharingDistributed )
Descriptive aliases retain obvious names at call sites.
const ( MaxDescriptorLength = 1024 MaxDescriptorFieldLength = 256 MaxDescriptorIdentifierLength = 96 )
const ( FindingOrphan = FindingOrphanState FindingMissing = FindingMissingState )
const ( MaxReferenceLength = 128 MaxReferenceComponentLength = 48 )
Bounds apply before any canonicalization or allocation at an untrusted boundary. A credential reference is deliberately narrower than a general URL: exactly two safe identifier components are allowed.
const ( FailureAuthRejected Failure = "auth_rejected" FailureAuthExpired Failure = "auth_expired" FailureAuthRevoked Failure = "auth_revoked" // Short aliases keep call sites readable while retaining the explicit // authentication prefix in the canonical values. FailureRejected = FailureAuthRejected FailureExpired = FailureAuthExpired FailureRevoked = FailureAuthRevoked )
const MaxGenerationLength = 128
const RecordSchemaV1 uint32 = 1
Variables ¶
var ( ErrBuilderDependency = errors.New("credentials: builder dependency unavailable") ErrFactoryUnsupported = errors.New("credentials: no exact credential factory") ErrFactoryMismatch = errors.New("credentials: credential factory identity mismatch") ErrFactoryConstruction = errors.New("credentials: credential factory construction failed") ErrRefreshScope = errors.New("credentials: refresh coordinator scope too weak") ErrStateNamespace = errors.New("credentials: invalid credential state namespace") ErrBuilderRecord = errors.New("credentials: invalid builder record") )
var ( ErrCatalogCorrupt = errors.New("credentials: corrupt catalog") ErrCatalogConflict = errors.New("credentials: catalog conflict") ErrCatalogNotFound = errors.New("credentials: catalog record not found") ErrCatalogCanceled = errors.New("credentials: catalog operation canceled") ErrCatalogDurabilityUnknown = errors.New("credentials: catalog visible commit durability unknown") ErrCatalogUnsupported = errors.New("credentials: catalog unsupported platform") ErrCatalogInvalidRecord = errors.New("credentials: invalid catalog record") ErrCatalogInvalidDependency = errors.New("credentials: invalid catalog dependency") // InsecurePath is an alias of corruption for callers that distinguish the // filesystem boundary while retaining one fail-closed category. ErrCatalogInsecurePath = ErrCatalogCorrupt ErrCatalogUnsupportedPlatform = ErrCatalogUnsupported ErrCatalogVisibleDurabilityUnknown = ErrCatalogDurabilityUnknown ErrCatalogUnknownSchema = ErrCatalogCorrupt ErrCatalogDuplicate = ErrCatalogConflict )
var ( ErrInvalidReference = errors.New("credentials: invalid reference") ErrInvalidDescriptor = errors.New("credentials: invalid descriptor") ErrInvalidGeneration = errors.New("credentials: invalid generation") ErrInvalidFailure = errors.New("credentials: invalid failure") ErrInvalidRecord = errors.New("credentials: invalid record") ErrInvalidScheme = errors.New("credentials: invalid scheme") ErrInvalidUsage = errors.New("credentials: invalid usage class") ErrSourceClosed = errors.New("credentials: source closed") ErrClosed = ErrSourceClosed ErrNilContext = errors.New("credentials: nil context") ErrCanceled = errors.New("credentials: operation canceled") )
Package errors intentionally expose only closed, package-owned categories. None of the typed errors retain caller strings, provider responses, or wrapped provider causes: those values may contain credential material.
Functions ¶
func CatalogTimeValid ¶
CatalogTimeValid is kept small and explicit for callers constructing records without depending on a particular clock implementation.
func CreateCredentialState ¶
func CreateCredentialState(ctx context.Context, catalog Catalog, store secrets.Store, namespace secrets.Namespace, record Record, value secrets.Secret) error
CreateCredentialState is a convenient explicit free-function seam.
func DeleteCredentialState ¶
func DeleteCredentialState(ctx context.Context, catalog Catalog, store secrets.Store, namespace secrets.Namespace, record Record) error
DeleteCredentialState is the free-function deletion seam.
func NewCatalogCanceledError ¶
func NewCatalogConflictError ¶
NewCatalogConflictError returns a bounded compare-and-swap/duplicate error.
func NewCatalogCorruptError ¶
func NewCatalogCorruptError() error
func NewCatalogDurabilityUnknownError ¶
NewCatalogDurabilityUnknownError returns a visible-commit durability error.
func NewCatalogNotFoundError ¶
NewCatalogNotFoundError returns a bounded not-found error for a validated reference. It is primarily useful to catalog implementations in subpackages.
func NewCatalogUnavailableError ¶
func NewCatalogUnavailableError() error
func NewCatalogUnsupportedError ¶
func NewCatalogUnsupportedError() error
func PublishState ¶
func PublishState(ctx context.Context, publisher StatePublisher, record Record, value secrets.Secret) error
PublishState is a descriptive alias for StatePublisher.Create.
func ValidateRecord ¶
ValidateRecord is the public safe-record validation seam used by catalog implementations. Record validation never inspects or resolves secret state.
Types ¶
type Builder ¶
type Builder struct {
Catalog Catalog
Resolver secrets.Resolver
Store secrets.Store
Preconditions secrets.PreconditionCapabilities
StateIndex secrets.Lister
StateNamespace secrets.Namespace
RefreshLocks RefreshCoordinator
StateSharing SharingScope
HTTPClient *http.Client
Clock Clock
Callback CallbackListener
Providers ProviderFactories
}
Builder constructs one explicit source from one catalog reference. All dependencies are injected; no environment, home directory, browser, or mutable package registry is consulted.
func (*Builder) Build ¶
Build resolves exactly ref and invokes exactly one complete-binding factory.
type CallbackListener ¶
type CallbackListener interface{}
CallbackListener is an intentionally opaque seam owned by provider OAuth implementations. The base builder does not invoke it or infer a browser.
type CanceledError ¶
type CanceledError struct {
// contains filtered or unexported fields
}
CanceledError reports context cancellation without retaining the context or its implementation details.
func NewCanceledError ¶
func NewCanceledError(cause error) *CanceledError
NewCanceledError returns a closed cancellation classification retaining only whether the operation was canceled or exceeded its deadline.
func (*CanceledError) Error ¶
func (e *CanceledError) Error() string
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
func (*CanceledError) Unwrap ¶
func (e *CanceledError) Unwrap() error
type Catalog ¶
type Catalog interface {
Get(context.Context, Reference) (Record, error)
List(context.Context) ([]Record, error)
Create(context.Context, Record) error
Delete(context.Context, Reference) error
}
Catalog is the safe, secret-free index of configured credential identities. Implementations must validate the complete on-disk/in-memory collection before returning a result: a duplicate reference or unknown schema is a fail-closed error, never a best-effort partial result.
type CatalogCAS ¶
CatalogCAS is an optional capability for explicit reauthentication of an existing reference. Implementations must compare the complete expected record before replacing it; callers must never use it as an unconditional update primitive.
type CatalogDurabilityUnknownError ¶
type CatalogDurabilityUnknownError = CatalogError
CatalogDurabilityUnknownError reports a visible catalog mutation whose directory durability could not be confirmed. Callers must reread and adopt the visible result; they must not assume the previous catalog survived.
type CatalogError ¶
type CatalogError struct {
// contains filtered or unexported fields
}
CatalogError contains only package-owned classification and, where applicable, the already-validated safe credential reference.
func (*CatalogError) Error ¶
func (e *CatalogError) Error() string
func (*CatalogError) GoString ¶
func (e *CatalogError) GoString() string
func (*CatalogError) Is ¶
func (e *CatalogError) Is(target error) bool
func (*CatalogError) LogValue ¶
func (e *CatalogError) LogValue() slog.Value
func (*CatalogError) Reference ¶
func (e *CatalogError) Reference() Reference
func (*CatalogError) Unwrap ¶
func (e *CatalogError) Unwrap() error
func (*CatalogError) Visible ¶
func (e *CatalogError) Visible() bool
type Clock ¶
Clock is an injected time source for provider factories. Builder itself does not use ambient time; the interface exists to keep construction explicit.
type Descriptor ¶
type Descriptor struct {
Provider string
Transport string
Scheme Scheme
Usage UsageClass
Issuer string
Audience string
Label string
}
Descriptor is a bounded, secret-free binding between a source and the exact provider transport it may authorize. Authenticated bindings require non-empty issuer and audience values; the explicit none/local binding is the only unauthenticated exception and requires both values to be empty.
func NewDescriptor ¶
func NewDescriptor(provider, transport string, scheme Scheme, usage UsageClass, issuer, audience, label string) (Descriptor, error)
NewDescriptor validates and canonicalizes a descriptor. Provider and transport identifiers are lower-case; safe textual identity fields are trimmed but retain case because URI and audience paths can be case-sensitive.
func (Descriptor) Binding ¶
func (d Descriptor) Binding() DescriptorBinding
Binding returns the factory-selection tuple for d.
func (Descriptor) BindingCanonical ¶
func (d Descriptor) BindingCanonical() string
BindingCanonical is stable and excludes presentation label.
func (Descriptor) Canonical ¶
func (d Descriptor) Canonical() string
Canonical returns a stable, bounded key for exact descriptor matching. The separator is package-owned and cannot appear in any safe field.
func (Descriptor) GoString ¶
func (d Descriptor) GoString() string
func (Descriptor) LogValue ¶
func (d Descriptor) LogValue() slog.Value
func (Descriptor) String ¶
func (d Descriptor) String() string
func (Descriptor) Valid ¶
func (d Descriptor) Valid() bool
func (Descriptor) Validate ¶
func (d Descriptor) Validate() error
Validate verifies that an exported descriptor value is one that a constructor could have produced. It never mutates the receiver.
type DescriptorBinding ¶
type DescriptorBinding struct {
Provider string
Transport string
Scheme Scheme
Usage UsageClass
Issuer string
Audience string
}
DescriptorBinding is the complete authority binding used for factory selection. Label is deliberately omitted because it is presentation only.
func DescriptorBindingOf ¶
func DescriptorBindingOf(descriptor Descriptor) DescriptorBinding
func StableBindings ¶
func StableBindings(factories ProviderFactories) []DescriptorBinding
StableBindings returns the factory bindings in deterministic order for diagnostics and tests. It does not expose factories or mutable state.
func (DescriptorBinding) Canonical ¶
func (b DescriptorBinding) Canonical() string
func (DescriptorBinding) Valid ¶
func (b DescriptorBinding) Valid() bool
type FactoryInput ¶
type FactoryInput struct {
Record Record
Reference Reference
Descriptor Descriptor
State secrets.Reference
Resolver secrets.Resolver
Store secrets.Store
Preconditions secrets.PreconditionCapabilities
StateIndex secrets.Lister
StateNamespace secrets.Namespace
RefreshCoordinator RefreshCoordinator
StateSharing SharingScope
HTTPClient *http.Client
Clock Clock
Callback CallbackListener
}
FactoryInput is the complete explicit construction context. It contains a safe catalog record and opaque state capabilities, never secret bytes.
type Failure ¶
type Failure string
Failure is a closed authentication-failure classification. Provider bodies, account details, and status text are intentionally not representable.
func NewFailure ¶
func (Failure) MarshalText ¶
func (*Failure) UnmarshalText ¶
type FailureClass ¶
type FailureClass = Failure
FailureClass is an alias for integrations that use “class” terminology.
type Finding ¶
type Finding = ReconcileFinding
Finding is the concise public name for ReconcileFinding.
func Reconcile ¶
func Reconcile(ctx context.Context, catalog Catalog, states secrets.Lister, namespace secrets.Namespace) ([]Finding, error)
Reconcile compares the complete safe catalog list to metadata-only state listing constrained to namespace. It never adopts, deletes, or mutates either backend. Findings are grouped by kind and sorted by canonical state reference for stable diagnostics.
type FindingKind ¶
type FindingKind uint8
FindingKind identifies a report-only state/catalog discrepancy.
const ( FindingOrphanState FindingKind = iota + 1 FindingMissingState )
func (FindingKind) String ¶
func (k FindingKind) String() string
type Generation ¶
type Generation struct {
// contains filtered or unexported fields
}
Generation is an opaque, comparable source-issued value. Its safe text representation is bounded and cannot contain arbitrary provider material. The representation is private so callers must use NewGeneration instead of converting arbitrary strings into source generations.
func NewGeneration ¶
func NewGeneration(value string) (Generation, error)
func (Generation) GoString ¶
func (g Generation) GoString() string
func (Generation) IsZero ¶
func (g Generation) IsZero() bool
func (Generation) LogValue ¶
func (g Generation) LogValue() slog.Value
func (Generation) MarshalText ¶
func (g Generation) MarshalText() ([]byte, error)
func (Generation) String ¶
func (g Generation) String() string
func (*Generation) UnmarshalText ¶
func (g *Generation) UnmarshalText(text []byte) error
func (Generation) Valid ¶
func (g Generation) Valid() bool
func (Generation) Validate ¶
func (g Generation) Validate() error
type InvalidDescriptorError ¶
type InvalidDescriptorError struct {
// contains filtered or unexported fields
}
InvalidDescriptorError reports an invalid binding descriptor.
func NewInvalidDescriptorError ¶
func NewInvalidDescriptorError(value string) *InvalidDescriptorError
func (*InvalidDescriptorError) Error ¶
func (e *InvalidDescriptorError) Error() string
func (*InvalidDescriptorError) Format ¶
func (e *InvalidDescriptorError) Format(state fmt.State, _ rune)
func (*InvalidDescriptorError) GoString ¶
func (e *InvalidDescriptorError) GoString() string
func (*InvalidDescriptorError) LogValue ¶
func (e *InvalidDescriptorError) LogValue() slog.Value
func (*InvalidDescriptorError) Reason ¶
func (e *InvalidDescriptorError) Reason() string
func (*InvalidDescriptorError) Unwrap ¶
func (e *InvalidDescriptorError) Unwrap() []error
type InvalidFailureError ¶
type InvalidFailureError struct {
// contains filtered or unexported fields
}
InvalidFailureError reports an unknown or empty failure classification.
func NewInvalidFailureError ¶
func NewInvalidFailureError(value string) *InvalidFailureError
func (*InvalidFailureError) Error ¶
func (e *InvalidFailureError) Error() string
func (*InvalidFailureError) GoString ¶
func (e *InvalidFailureError) GoString() string
func (*InvalidFailureError) LogValue ¶
func (e *InvalidFailureError) LogValue() slog.Value
func (*InvalidFailureError) Reason ¶
func (e *InvalidFailureError) Reason() string
func (*InvalidFailureError) Unwrap ¶
func (e *InvalidFailureError) Unwrap() error
type InvalidGenerationError ¶
type InvalidGenerationError struct {
// contains filtered or unexported fields
}
InvalidGenerationError reports an invalid source generation.
func NewInvalidGenerationError ¶
func NewInvalidGenerationError(value string) *InvalidGenerationError
func (*InvalidGenerationError) Error ¶
func (e *InvalidGenerationError) Error() string
func (*InvalidGenerationError) Format ¶
func (e *InvalidGenerationError) Format(state fmt.State, _ rune)
func (*InvalidGenerationError) GoString ¶
func (e *InvalidGenerationError) GoString() string
func (*InvalidGenerationError) LogValue ¶
func (e *InvalidGenerationError) LogValue() slog.Value
func (*InvalidGenerationError) Reason ¶
func (e *InvalidGenerationError) Reason() string
func (*InvalidGenerationError) Unwrap ¶
func (e *InvalidGenerationError) Unwrap() error
type InvalidRecordError ¶
type InvalidRecordError struct {
// contains filtered or unexported fields
}
InvalidRecordError reports an invalid safe catalog record.
func NewInvalidRecordError ¶
func NewInvalidRecordError(value string) *InvalidRecordError
func (*InvalidRecordError) Error ¶
func (e *InvalidRecordError) Error() string
func (*InvalidRecordError) GoString ¶
func (e *InvalidRecordError) GoString() string
func (*InvalidRecordError) LogValue ¶
func (e *InvalidRecordError) LogValue() slog.Value
func (*InvalidRecordError) Reason ¶
func (e *InvalidRecordError) Reason() string
func (*InvalidRecordError) Unwrap ¶
func (e *InvalidRecordError) Unwrap() error
type InvalidReferenceError ¶
type InvalidReferenceError struct {
// contains filtered or unexported fields
}
InvalidReferenceError reports malformed reference text without retaining that text.
func NewInvalidReferenceError ¶
func NewInvalidReferenceError(value string) *InvalidReferenceError
func (*InvalidReferenceError) Error ¶
func (e *InvalidReferenceError) Error() string
func (*InvalidReferenceError) Format ¶
func (e *InvalidReferenceError) Format(state fmt.State, _ 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
func (*InvalidReferenceError) Unwrap ¶
func (e *InvalidReferenceError) Unwrap() error
type Lease ¶
type Lease interface {
Generation() Generation
Descriptor() Descriptor
ExpiresAt() time.Time
Authorizer() httpauth.Authorizer
}
Lease is an immutable, concurrency-safe snapshot of usable authority.
type NilContextError ¶
type NilContextError struct{}
NilContextError reports a nil context passed to a public operation.
func (*NilContextError) Error ¶
func (e *NilContextError) Error() string
func (*NilContextError) GoString ¶
func (e *NilContextError) GoString() string
func (*NilContextError) LogValue ¶
func (e *NilContextError) LogValue() slog.Value
func (*NilContextError) Unwrap ¶
func (e *NilContextError) Unwrap() error
type NoneSource ¶
type NoneSource struct {
// contains filtered or unexported fields
}
NoneSource is the explicit local unauthenticated source. It has no credential reference, never expires, never refreshes, and returns only the no-op authorizer. Close is linearized under mu and is idempotent.
func NewNoneSource ¶
func NewNoneSource(descriptor Descriptor) (*NoneSource, error)
NewNoneSource constructs the only source permitted to have a zero credential Reference. The descriptor must still identify an exact local transport and use SchemeNone/UsageLocal.
func (*NoneSource) Close ¶
func (s *NoneSource) Close() error
func (*NoneSource) Descriptor ¶
func (s *NoneSource) Descriptor() Descriptor
func (*NoneSource) GoString ¶
func (s *NoneSource) GoString() string
func (*NoneSource) Invalidate ¶
func (s *NoneSource) Invalidate(ctx context.Context, generation Generation, failure Failure) error
func (*NoneSource) LogValue ¶
func (s *NoneSource) LogValue() slog.Value
func (*NoneSource) Reference ¶
func (s *NoneSource) Reference() Reference
func (*NoneSource) String ¶
func (s *NoneSource) String() string
type OrphanState ¶
OrphanState identifies one exact opaque state version that could not be cleaned up after catalog publication failed. It intentionally contains no secret value or provider response.
func (OrphanState) Error ¶
func (o OrphanState) Error() string
func (OrphanState) GoString ¶
func (o OrphanState) GoString() string
func (OrphanState) LogValue ¶
func (o OrphanState) LogValue() slog.Value
func (OrphanState) Unwrap ¶
func (o OrphanState) Unwrap() error
func (OrphanState) Valid ¶
func (o OrphanState) Valid() bool
type ProviderFactories ¶
type ProviderFactories struct {
// contains filtered or unexported fields
}
ProviderFactories is an immutable copied factory registry. It is keyed by the complete descriptor binding, not by provider or a presentation label. The backing map is private; callers can only obtain copied snapshots.
func NewProviderFactories ¶
func NewProviderFactories(input map[DescriptorBinding]SourceFactory) ProviderFactories
NewProviderFactories copies an input map so later caller mutation cannot affect an active Builder.
func (ProviderFactories) List ¶
func (p ProviderFactories) List() []DescriptorBinding
List returns all registered bindings in deterministic canonical order.
func (ProviderFactories) Lookup ¶
func (p ProviderFactories) Lookup(binding DescriptorBinding) (SourceFactory, bool)
Lookup returns the factory for one exact descriptor binding.
func (ProviderFactories) Snapshot ¶
func (p ProviderFactories) Snapshot() map[DescriptorBinding]SourceFactory
Snapshot returns a mutable copy that cannot alter this registry.
type ReconcileFinding ¶
type ReconcileFinding struct {
Kind FindingKind
State secrets.Reference
Reference secrets.Reference // alias for callers that emphasize state ref
Credential Reference
}
ReconcileFinding is metadata only. State is the opaque secret-store reference; Credential identifies a safe catalog record for missing-state findings. No secret values or provider responses can be represented.
type Record ¶
type Record struct {
Schema uint32
Reference Reference
Descriptor Descriptor
State secrets.Reference
CreatedAt time.Time
UpdatedAt time.Time
}
Record is the safe catalog metadata for one credential. Sensitive state is held only by the referenced secrets record.
type Reference ¶
type Reference struct {
// contains filtered or unexported fields
}
Reference is an opaque, comparable credential identity. Its fields are private so a valid value can only be obtained through a constructor or text parser. It contains no authority, URL, filesystem path, or secret value.
func NewReference ¶
NewReference constructs an opaque credential identity from safe provider and name components.
func ParseReference ¶
ParseReference parses exactly credential://provider/name. The scheme and identifier components are canonicalized to lower case; no query, fragment, URL authority, path traversal, or additional path segment is accepted.
func (Reference) MarshalText ¶
func (Reference) String ¶
String returns the canonical safe representation, or an empty string for the invalid zero value.
func (*Reference) UnmarshalText ¶
type RefreshCoordinator ¶
type RefreshCoordinator interface {
Scope() SharingScope
WithLock(context.Context, Reference, func(context.Context) error) error
}
RefreshCoordinator provides context-aware exclusion around one refresh or state rotation. Implementations own any lock lifetime and must invoke fn while exclusion is held.
type Scheme ¶
type Scheme string
Scheme describes the mechanism that establishes outbound authority.
type SharingScope ¶
type SharingScope uint8
SharingScope describes the widest visibility for state coordination. The values are ordered so a coordinator can be checked against the configured state store without relying on provider-specific knowledge.
const ( SharingProcess SharingScope = iota + 1 SharingHost SharingDistributed )
func (SharingScope) AtLeast ¶
func (s SharingScope) AtLeast(required SharingScope) bool
func (SharingScope) String ¶
func (s SharingScope) String() string
func (SharingScope) Valid ¶
func (s SharingScope) Valid() bool
type Source ¶
type Source interface {
Reference() Reference
Descriptor() Descriptor
Acquire(context.Context) (Lease, error)
Invalidate(context.Context, Generation, Failure) error
Close() error
}
Source owns acquisition and invalidation for one explicit identity.
type SourceClosedError ¶
type SourceClosedError struct{}
SourceClosedError reports an operation that began after Close linearized.
func (*SourceClosedError) Error ¶
func (e *SourceClosedError) Error() string
func (*SourceClosedError) GoString ¶
func (e *SourceClosedError) GoString() string
func (*SourceClosedError) LogValue ¶
func (e *SourceClosedError) LogValue() slog.Value
func (*SourceClosedError) Unwrap ¶
func (e *SourceClosedError) Unwrap() error
type SourceFactory ¶
type SourceFactory func(context.Context, FactoryInput) (Source, error)
SourceFactory constructs exactly one source for one already-validated catalog record.
type StateDeletionError ¶
type StateDeletionError struct {
Credential Reference
State secrets.Reference
// contains filtered or unexported fields
}
StateDeletionError reports that the catalog was made unavailable but exact state deletion did not complete. The state reference is safe metadata only.
func (*StateDeletionError) Error ¶
func (e *StateDeletionError) Error() string
func (*StateDeletionError) GoString ¶
func (e *StateDeletionError) GoString() string
func (*StateDeletionError) LogValue ¶
func (e *StateDeletionError) LogValue() slog.Value
func (*StateDeletionError) Unwrap ¶
func (e *StateDeletionError) Unwrap() []error
type StatePublicationError ¶
type StatePublicationError struct {
Orphan *OrphanState
// contains filtered or unexported fields
}
StatePublicationError reports catalog publication failure and whether exact state cleanup left a detectable orphan. Causes are normalized privately and exposed only through errors.Is.
func (*StatePublicationError) Error ¶
func (e *StatePublicationError) Error() string
func (*StatePublicationError) Format ¶
func (e *StatePublicationError) Format(state fmt.State, _ rune)
func (*StatePublicationError) GoString ¶
func (e *StatePublicationError) GoString() string
func (*StatePublicationError) LogValue ¶
func (e *StatePublicationError) LogValue() slog.Value
func (*StatePublicationError) Orphaned ¶
func (e *StatePublicationError) Orphaned() bool
func (*StatePublicationError) Unwrap ¶
func (e *StatePublicationError) Unwrap() []error
type StatePublisher ¶
type StatePublisher struct {
Catalog Catalog
Store secrets.Store
Preconditions secrets.PreconditionCapabilities
Namespace secrets.Namespace
}
StatePublisher composes the two independent stores with explicit ordering. It is intentionally small: OAuth/reauthentication algorithms belong to refreshable sources, not this persistence seam.
func (StatePublisher) Create ¶
Create writes opaque state with create-only semantics before publishing the safe catalog record. A visible state warning is adopted using the returned committed record; a visible catalog warning is never rolled back.
func (StatePublisher) Delete ¶
func (p StatePublisher) Delete(ctx context.Context, supplied Record) error
Delete removes a credential in the required order: it uses only the caller's reference, rereads the current catalog record, resolves that exact state version, makes the catalog unavailable, then CAS-deletes that version.
type UsageClass ¶
type UsageClass string
UsageClass describes how use of a credential is accounted for independently of the authority mechanism.
const ( UsageLocal UsageClass = "local" UsageMeteredAPI UsageClass = "metered_api" UsageSubscription UsageClass = "subscription" )
func (UsageClass) GoString ¶
func (u UsageClass) GoString() string
func (UsageClass) IsZero ¶
func (u UsageClass) IsZero() bool
func (UsageClass) LogValue ¶
func (u UsageClass) LogValue() slog.Value
func (UsageClass) String ¶
func (u UsageClass) String() string
func (UsageClass) Valid ¶
func (u UsageClass) Valid() bool
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package catalog contains explicit credential catalog backends.
|
Package catalog contains explicit credential catalog backends. |
|
Package httpauth contains call-scoped HTTP request authorizers.
|
Package httpauth contains call-scoped HTTP request authorizers. |
|
Package oauth contains provider-neutral OAuth acquisition mechanics.
|
Package oauth contains provider-neutral OAuth acquisition mechanics. |
|
Package refresh contains provider-neutral renewable credential sources.
|
Package refresh contains provider-neutral renewable credential sources. |