Versions in this module Expand all Collapse all v0 v0.2.0 Aug 14, 2026 Changes in this version + const LockFilename + const MaxProviderDataBytes + const MaxStateBytes + const SchemaV1 + const StateSchemaV1 + const StateVersion1 + var ErrAdoptionUnavailable = errors.New("credentials/refresh: advanced generation has no usable lease") + var ErrAmbiguousRefresh = ErrAmbiguousRotation + var ErrAmbiguousRotation = errors.New("credentials/refresh: ambiguous token rotation") + var ErrCanceled = credentials.ErrCanceled + var ErrClosed = credentials.ErrSourceClosed + var ErrCoordinator = errors.New("credentials/refresh: coordinator unavailable") + var ErrDurabilityUnknown = errors.New("credentials/refresh: visible commit durability unknown") + var ErrExchange = errors.New("credentials/refresh: token exchange failed") + var ErrInvalidOptions = errors.New("credentials/refresh: invalid options") + var ErrInvalidState = errors.New("credentials/refresh: invalid state") + var ErrRefresh = errors.New("credentials/refresh: refresh failed") + var ErrRefreshAmbiguous = ErrAmbiguousRotation + var ErrUnsupportedPlatform = errors.New("credentials/refresh: unsupported platform") + func EncodeState(state State) (secrets.Secret, error) + func MarshalState(state State) (secrets.Secret, error) + func NewCoordinator(args ...any) (credentials.RefreshCoordinator, error) + type AmbiguousRotationError struct + Generation credentials.Generation + Reference credentials.Reference + func (e *AmbiguousRotationError) Error() string + func (e *AmbiguousRotationError) Format(s fmt.State, _ rune) + func (e *AmbiguousRotationError) GoString() string + func (e *AmbiguousRotationError) Unwrap() error + type Clock = credentials.Clock + type ClockFunc = credentials.ClockFunc + type Config = Options + type Coordinator = credentials.RefreshCoordinator + type ExchangeError struct + func (e *ExchangeError) Error() string + func (e *ExchangeError) Format(s fmt.State, _ rune) + func (e *ExchangeError) GoString() string + func (e *ExchangeError) Unwrap() error + type ExchangeFunc func(context.Context, State) (TokenResponse, error) + type ExchangeResult = TokenResponse + type FileCoordinator struct + func NewFileCoordinator(root string) (*FileCoordinator, error) + func NewLocalCoordinator(root string) (*FileCoordinator, error) + func (c *FileCoordinator) Close() error + func (c *FileCoordinator) Scope() credentials.SharingScope + func (c *FileCoordinator) WithLock(ctx context.Context, ref credentials.Reference, fn func(context.Context) error) error + type InvalidStateError struct + func (e *InvalidStateError) Error() string + func (e *InvalidStateError) Format(state fmt.State, _ rune) + func (e *InvalidStateError) GoString() string + func (e *InvalidStateError) Unwrap() error + type Lease struct + func (l *Lease) Authorizer() httpauth.Authorizer + func (l *Lease) Descriptor() credentials.Descriptor + func (l *Lease) ExpiresAt() time.Time + func (l *Lease) Format(state fmt.State, _ rune) + func (l *Lease) Generation() credentials.Generation + func (l *Lease) GoString() string + func (l *Lease) String() string + type Options struct + Clock Clock + Context context.Context + Coordinator credentials.RefreshCoordinator + Descriptor credentials.Descriptor + Exchange any + ExpirySkew time.Duration + InitialState State + Now func() time.Time + PersistAccessToken bool + Preconditions secrets.PreconditionCapabilities + Reference credentials.Reference + Refresh any + RefreshCoordinator credentials.RefreshCoordinator + RefreshTimeout time.Duration + Refresher any + Resolver secrets.Resolver + Sharing credentials.SharingScope + Skew time.Duration + SourceRefreshTimeout time.Duration + State secrets.Reference + StateReference secrets.Reference + StateSharing credentials.SharingScope + Store secrets.Store + type ProcessCoordinator struct + func NewInProcessCoordinator() *ProcessCoordinator + func NewProcessCoordinator() *ProcessCoordinator + func (c *ProcessCoordinator) Close() error + func (c *ProcessCoordinator) Scope() credentials.SharingScope + func (c *ProcessCoordinator) WithLock(ctx context.Context, ref credentials.Reference, fn func(context.Context) error) error + type RefreshCoordinator = credentials.RefreshCoordinator + type RefreshResponse = TokenResponse + type RefreshState = State + type Source struct + func New(args ...any) (*Source, error) + func NewRefreshableSource(args ...any) (*Source, error) + func NewSource(args ...any) (*Source, error) + func NewWithOptions(args ...any) (*Source, error) + func (s *Source) Acquire(ctx context.Context) (credentials.Lease, error) + func (s *Source) CanRecover(failure credentials.Failure) bool + func (s *Source) Close() error + func (s *Source) Descriptor() credentials.Descriptor + func (s *Source) Invalidate(ctx context.Context, generation credentials.Generation, ...) error + func (s *Source) Reauth(ctx context.Context, value any) error + func (s *Source) Reauthenticate(ctx context.Context, value any) error + func (s *Source) ReauthenticateLease(ctx context.Context, value any) (credentials.Lease, error) + func (s *Source) Reference() credentials.Reference + type SourceOptions = Options + type State struct + AccessToken secrets.Secret + Continuity []byte + ExpiresAt time.Time + Expiry time.Time + Generation credentials.Generation + PersistAccessToken bool + ProviderData []byte + RefreshToken secrets.Secret + Schema uint32 + func DecodeState(value secrets.Secret) (State, error) + func NewState(generation credentials.Generation, value any) (State, error) + func UnmarshalState(value secrets.Secret) (State, error) + func (s State) Clone() (State, error) + func (s State) Format(state fmt.State, _ rune) + func (s State) GoString() string + func (s State) LogValue() slog.Value + func (s State) String() string + func (s State) Validate() error + type Token = TokenResponse + type TokenResponse struct + AccessToken secrets.Secret + Continuity []byte + ExpiresAt time.Time + ExpiresIn time.Duration + ExpiresInSeconds int64 + Generation credentials.Generation + PersistAccessToken bool + ProviderData []byte + RefreshToken secrets.Secret + RefreshTokenSet bool + func (r TokenResponse) Format(state fmt.State, _ rune) + func (r TokenResponse) GoString() string + func (r TokenResponse) LogValue() slog.Value + func (r TokenResponse) String() string + func (r TokenResponse) Validate() error v0.1.0 Aug 10, 2026