Documentation
¶
Index ¶
- Variables
- func AppendToAccounts(accountsPath string, account Account) error
- func DeleteAllFromAccounts(accountsPath string) error
- func DeleteAllFromKeyring() error
- func DeleteAllThreads(threadsPath string) error
- func DeleteFromAccounts(accountsPath, name string, service Service) error
- func DeleteFromKeyring(service Service, name string) error
- func DeleteHistoryFile(historyPath string) error
- func EnsureAccounts(accountsPath string) error
- func ExtractApiKey(secretsPath string) (string, error)
- func ReadFromKeyring(service Service, name string) (string, error)
- func UpdateActiveAccount(accountsPath, name string, service Service) error
- func WriteToAccounts(accountsPath string, accounts Accounts) error
- func WriteToAmpSecrets(apiKey, secretsPath string) error
- func WriteToClaudeCredentials(stored ClaudeStoredCredentials, claudeConfigPath, claudeCredsPath string) error
- func WriteToKeyring(service Service, name, value string) error
- type Account
- type Accounts
- type AmpSecrets
- type ClaudeOAuthAccount
- type ClaudeStoredCredentials
- type Service
Constants ¶
This section is empty.
Variables ¶
var Viper = viper.New()
Functions ¶
func AppendToAccounts ¶
AppendToAccounts adds a new account entry to the accounts file and updates LastService.
func DeleteAllFromAccounts ¶ added in v0.2.0
DeleteAllFromAccounts clears all accounts from the accounts file.
func DeleteAllFromKeyring ¶
func DeleteAllFromKeyring() error
DeleteAllFromKeyring deletes all keyring entries under the "amped" service.
func DeleteAllThreads ¶
DeleteAllThreads removes all files in the threads directory and recreates it empty.
func DeleteFromAccounts ¶
DeleteFromAccounts removes the named account for the given service from the accounts file.
func DeleteFromKeyring ¶
DeleteFromKeyring removes the keyring entry for the given service and account name.
func DeleteHistoryFile ¶
DeleteHistoryFile removes the history file, if it exists.
func EnsureAccounts ¶
EnsureAccounts creates the accounts JSON file with an empty structure if it doesn't exist.
func ExtractApiKey ¶
ExtractApiKey reads the Amp API key from Amp's secrets.json.
func ReadFromKeyring ¶
ReadFromKeyring retrieves stored credentials for the given service and account name. Falls back to the legacy (no-prefix) key format for backward compatibility with old Amp accounts.
func UpdateActiveAccount ¶
UpdateActiveAccount sets the active account for the given service and updates LastService.
func WriteToAccounts ¶
WriteToAccounts writes the full accounts structure to the accounts JSON file.
func WriteToAmpSecrets ¶
WriteToAmpSecrets writes an Amp API key to Amp's secrets.json.
func WriteToClaudeCredentials ¶ added in v0.2.0
func WriteToClaudeCredentials(stored ClaudeStoredCredentials, claudeConfigPath, claudeCredsPath string) error
WriteToClaudeCredentials restores Claude Code credentials and oauth account info. On macOS, credentials are written to the system Keychain. On Linux/other, credentials are written to the file at claudeCredsPath.
func WriteToKeyring ¶ added in v0.2.0
WriteToKeyring stores credentials for the given service and account name.
Types ¶
type Account ¶ added in v0.2.0
Account represents a single saved account entry in amped's accounts file.
type Accounts ¶ added in v0.2.0
type Accounts struct {
Accounts []Account `json:"accounts"`
ActiveAmp string `json:"activeAmp"`
ActiveClaude string `json:"activeClaude"`
// LastService is used when no --service flag is given, so the last-used service is re-applied automatically.
LastService Service `json:"lastService"`
}
Accounts is the top-level structure of amped's accounts JSON file.
func ReadFromAccounts ¶
ReadFromAccounts reads and parses the amped accounts JSON file. Migrates legacy single-service format (Active field) to the new per-service format on read.
type AmpSecrets ¶
type AmpSecrets struct {
APIKeyHTTPSAmpcodeCom string `json:"apiKey@https://ampcode.com/"`
}
AmpSecrets represents the structure of Amp's secrets.json.
type ClaudeOAuthAccount ¶ added in v0.2.0
type ClaudeOAuthAccount struct {
EmailAddress string `json:"emailAddress"`
AccountUUID string `json:"accountUuid"`
}
ClaudeOAuthAccount represents the oauthAccount section of ~/.claude/.claude.json, which identifies which account Claude Code considers currently logged in.
type ClaudeStoredCredentials ¶ added in v0.2.0
type ClaudeStoredCredentials struct {
// Credentials is the raw JSON blob from Claude Code's credential storage.
// On macOS, this comes from the Keychain entry "Claude Code-credentials".
// On Linux, this comes from ~/.claude/.credentials.json.
Credentials string `json:"credentials"`
OAuthAccount *ClaudeOAuthAccount `json:"oauthAccount,omitempty"`
}
ClaudeStoredCredentials packages the credentials blob and oauth account info needed to fully restore a Claude Code account.
func ExtractClaudeCredentials ¶ added in v0.2.0
func ExtractClaudeCredentials(claudeConfigPath, claudeCredsPath string) (ClaudeStoredCredentials, error)
ExtractClaudeCredentials reads the current Claude Code credentials and oauth account info. On macOS, credentials are read from the system Keychain ("Claude Code-credentials"). On Linux/other, credentials are read from the file at claudeCredsPath.