auth

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2026 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package auth provides authentication checking for AI model providers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIKeyDetails added in v0.0.17

type APIKeyDetails struct {
	EnvVar  string // Environment variable name
	IsSet   bool   // Whether the env var is set
	IsValid bool   // Whether the value matches required pattern
	Source  string // Where credentials come from (e.g., "env")
}

APIKeyDetails contains API key authentication details.

type Checker

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

Checker checks authentication status for providers.

func NewChecker

func NewChecker(options ...CheckerOption) *Checker

NewChecker creates a new authentication checker.

func (*Checker) CheckProvider

func (c *Checker) CheckProvider(provider *catalogs.Provider, supportedMap map[string]bool) *Status

CheckProvider checks authentication status for a provider. Performs local checks only - no network calls are made.

Resolver selection uses catalog authentication metadata. Endpoint protocols do not select credentials.

type CheckerOption added in v0.3.0

type CheckerOption func(*Checker)

CheckerOption configures a Checker.

func WithCredentialResolver added in v0.3.0

func WithCredentialResolver(
	method catalogs.ProviderCatalogAuthMethod,
	resolver CredentialResolver,
) CheckerOption

WithCredentialResolver registers or replaces a credential resolver.

type CredentialChainDetails added in v0.3.0

type CredentialChainDetails struct {
	Method  catalogs.ProviderCatalogAuthMethod
	Source  string
	Details any
}

CredentialChainDetails describes which catalog-acquisition chain was selected. Details can contain provider-specific inspection data but never a credential value.

type CredentialResolver added in v0.3.0

type CredentialResolver interface {
	Check(*catalogs.Provider) *Status
}

CredentialResolver checks one catalog-acquisition credential method.

type CredentialResolverFunc added in v0.3.0

type CredentialResolverFunc func(*catalogs.Provider) *Status

CredentialResolverFunc adapts a function to CredentialResolver.

func (CredentialResolverFunc) Check added in v0.3.0

func (f CredentialResolverFunc) Check(provider *catalogs.Provider) *Status

Check implements CredentialResolver.

type State

type State int

State represents the authentication state of a provider.

const (
	// StateConfigured means the provider has credentials configured.
	StateConfigured State = iota
	// StateMissing means required credentials are missing.
	StateMissing
	// StateInvalid means credentials are found but malformed or invalid.
	StateInvalid
	// StateOptional means the provider has optional or no auth requirements.
	StateOptional
	// StateUnsupported means the provider has no client implementation.
	StateUnsupported
)

type Status

type Status struct {
	State           State
	Summary         string                  // Brief one-line summary
	APIKey          *APIKeyDetails          // API key details, when applicable
	CredentialChain *CredentialChainDetails // Cloud credential-chain details, when applicable
}

Status represents catalog-acquisition authentication status.

Directories

Path Synopsis
Package adc handles Google Application Default Credentials.
Package adc handles Google Application Default Credentials.

Jump to

Keyboard shortcuts

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