Skip to main content

Module auth_manager

Module auth_manager 

Source
Expand description

Authentication manager for storing and retrieving provider credentials

§Deprecated

This module is deprecated. Credentials are now stored directly in config.toml under [profiles.{profile}.providers.{provider}.auth] instead of in a separate auth.toml file.

The AuthManager is kept temporarily for:

  • Reading existing auth.toml files during migration
  • Backward compatibility during the transition period

New code should use ProviderConfig::set_auth() and ProviderConfig::get_auth() to manage provider credentials directly in config.toml.

§Migration

When config.toml is loaded, any credentials in auth.toml are automatically migrated to the new format in config.toml, and auth.toml is backed up to auth.toml.bak.

§Legacy File Structure (auth.toml - deprecated)

# Shared across all profiles
[all.anthropic]
type = "oauth"
access = "eyJ..."
refresh = "eyJ..."
expires = 1735600000000

# Profile-specific override
[work.anthropic]
type = "api"
key = "sk-ant-..."

Structs§

AuthFile
Structure of the auth.toml file
AuthManager
Manages provider credentials stored in auth.toml

Functions§

get_auth_file_path
Get the auth file path for a given config directory
get_default_config_dir
Get the default Stakpak config directory