awconfig

package
v0.24.1 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultClawDIDRegistryURL = "https://api.clawdid.ai"

DefaultClawDIDRegistryURL is the default ClawDID registry endpoint.

Variables

This section is empty.

Functions

func ArchiveKey added in v0.14.0

func ArchiveKey(keysDir, oldDID string, pub ed25519.PublicKey, priv ed25519.PrivateKey) error

ArchiveKey writes a keypair to keysDir/rotated/ named by the old DID. Colons in the DID are replaced with dashes for filesystem compatibility.

func DefaultGlobalConfigPath

func DefaultGlobalConfigPath() (string, error)

func DefaultWorktreeContextRelativePath

func DefaultWorktreeContextRelativePath() string

func DeriveBaseURLFromServerName

func DeriveBaseURLFromServerName(name string) (string, error)

func DeriveServerNameFromURL

func DeriveServerNameFromURL(raw string) (string, error)

func FindWorktreeContextPath

func FindWorktreeContextPath(startDir string) (string, error)

func GenerateKeypair added in v0.14.0

func GenerateKeypair() (ed25519.PublicKey, ed25519.PrivateKey, error)

GenerateKeypair creates a new Ed25519 keypair using crypto/rand.

func KeysDir added in v0.14.0

func KeysDir(configPath string) string

KeysDir returns the keys directory for a given config file path (e.g. "~/.config/aw/config.yaml" → "~/.config/aw/keys").

func LoadPublicKey added in v0.14.0

func LoadPublicKey(path string) (ed25519.PublicKey, error)

LoadPublicKey reads an Ed25519 public key from a PEM file.

func LoadSigningKey added in v0.14.0

func LoadSigningKey(path string) (ed25519.PrivateKey, error)

LoadSigningKey reads an Ed25519 private key from a PEM file.

func LockExclusive

func LockExclusive(lockPath string) (*fileLock, error)

func SaveKeypair added in v0.14.0

func SaveKeypair(keysDir, address string, pub ed25519.PublicKey, priv ed25519.PrivateKey) error

SaveKeypair writes a keypair to keysDir as PEM files named by agent address. Private key: 0600. Public key: 0644.

func SaveWorktreeContextTo

func SaveWorktreeContextTo(path string, ctx *WorktreeContext) error

func ScanKeysForPublicKey added in v0.19.0

func ScanKeysForPublicKey(keysDir string, target ed25519.PublicKey) (string, error)

ScanKeysForPublicKey searches keysDir (and keysDir/rotated/) for a private key whose derived public key matches target. Returns the path to the private key file, or empty string if not found.

func SigningKeyPath added in v0.14.0

func SigningKeyPath(keysDir, address string) string

SigningKeyPath returns the path to an agent's signing key file.

func UpdateGlobal

func UpdateGlobal(fn func(cfg *GlobalConfig) error) error

func UpdateGlobalAt

func UpdateGlobalAt(path string, fn func(cfg *GlobalConfig) error) error

func ValidateBaseURL

func ValidateBaseURL(raw string) error

Types

type Account

type Account struct {
	Server         string `yaml:"server,omitempty"`
	APIKey         string `yaml:"api_key,omitempty"`
	DefaultProject string `yaml:"default_project,omitempty"`
	AgentID        string `yaml:"agent_id,omitempty"`
	AgentAlias     string `yaml:"agent_alias,omitempty"`
	Email          string `yaml:"email,omitempty"`
	NamespaceSlug  string `yaml:"namespace_slug,omitempty"`
	DID            string `yaml:"did,omitempty"`
	StableID       string `yaml:"stable_id,omitempty"`
	SigningKey     string `yaml:"signing_key,omitempty"`
	Custody        string `yaml:"custody,omitempty"`
	Lifetime       string `yaml:"lifetime,omitempty"`
}

type GlobalConfig

type GlobalConfig struct {
	Servers               map[string]Server  `yaml:"servers,omitempty"`
	Accounts              map[string]Account `yaml:"accounts,omitempty"`
	DefaultAccount        string             `yaml:"default_account,omitempty"`
	ClientDefaultAccounts map[string]string  `yaml:"client_default_accounts,omitempty"`
	ClawDIDRegistryURL    string             `yaml:"clawdid_registry_url,omitempty"`
}

func LoadGlobal

func LoadGlobal() (*GlobalConfig, error)

func LoadGlobalFrom

func LoadGlobalFrom(path string) (*GlobalConfig, error)

func (*GlobalConfig) SaveGlobal

func (c *GlobalConfig) SaveGlobal() error

func (*GlobalConfig) SaveGlobalTo

func (c *GlobalConfig) SaveGlobalTo(path string) error

type ResolveOptions

type ResolveOptions struct {
	AccountName string
	ServerName  string
	ClientName  string

	WorkingDir  string
	ContextPath string
	Context     *WorktreeContext

	BaseURLOverride string
	APIKeyOverride  string

	AllowEnvOverrides bool
}

type Selection

type Selection struct {
	AccountName string
	ServerName  string
	BaseURL     string
	APIKey      string

	DefaultProject     string
	AgentID            string
	AgentAlias         string
	Email              string
	NamespaceSlug      string
	DID                string
	StableID           string
	SigningKey         string
	Custody            string
	Lifetime           string
	ClawDIDRegistryURL string
}

func Resolve

func Resolve(global *GlobalConfig, opts ResolveOptions) (*Selection, error)

type Server

type Server struct {
	URL string `yaml:"url,omitempty"`
}

type WorktreeContext

type WorktreeContext struct {
	DefaultAccount        string            `yaml:"default_account,omitempty"`
	ServerAccounts        map[string]string `yaml:"server_accounts,omitempty"`
	ClientDefaultAccounts map[string]string `yaml:"client_default_accounts,omitempty"`
	HumanAccount          string            `yaml:"human_account,omitempty"`
}

func LoadWorktreeContextFrom

func LoadWorktreeContextFrom(path string) (*WorktreeContext, error)

func LoadWorktreeContextFromDir

func LoadWorktreeContextFromDir(startDir string) (*WorktreeContext, string, error)

Jump to

Keyboard shortcuts

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