auth

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

internal/auth/apikey.go 从配置文件读取 API Key

internal/auth/auth.go 认证链:按优先级依次尝试获取 API Key

internal/auth/keychain_other.go 非 macOS 平台的 CC OAuth 占位实现

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClearAPIKey

func ClearAPIKey(configDir string) error

ClearAPIKey 清除已保存的 API Key

func LoadCCOAuthToken

func LoadCCOAuthToken() (string, error)

LoadCCOAuthToken 非 macOS 平台暂不支持 CC OAuth TODO: Linux 支持通过 libsecret / secret-tool 读取

func ReadAPIKeyFromFile

func ReadAPIKeyFromFile(path string) string

ReadAPIKeyFromFile 从 JSON 文件读取 API Key(公开导出版本)

func ResolveAPIKey

func ResolveAPIKey(configDir string) (apiKey string, source string)

ResolveAPIKey 按优先级解析 API Key 优先级:环境变量 > 配置文件 > CC OAuth Token

func SaveAPIKey

func SaveAPIKey(configDir, apiKey string) error

SaveAPIKey 保存 API Key 到标准凭据路径

func SaveCredentials

func SaveCredentials(path, apiKey string) error

SaveCredentials 将 API Key 写入 JSON 凭据文件 自动创建父目录

Types

This section is empty.

Jump to

Keyboard shortcuts

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