Documentation
¶
Index ¶
- Constants
- func ArchiveKey(keysDir, oldDID string, pub ed25519.PublicKey, priv ed25519.PrivateKey) error
- func DefaultGlobalConfigPath() (string, error)
- func DefaultWorktreeContextRelativePath() string
- func DeriveBaseURLFromServerName(name string) (string, error)
- func DeriveServerNameFromURL(raw string) (string, error)
- func FindWorktreeContextPath(startDir string) (string, error)
- func GenerateKeypair() (ed25519.PublicKey, ed25519.PrivateKey, error)
- func KeysDir(configPath string) string
- func LoadPublicKey(path string) (ed25519.PublicKey, error)
- func LoadSigningKey(path string) (ed25519.PrivateKey, error)
- func LockExclusive(lockPath string) (*fileLock, error)
- func SaveKeypair(keysDir, address string, pub ed25519.PublicKey, priv ed25519.PrivateKey) error
- func SaveWorktreeContextTo(path string, ctx *WorktreeContext) error
- func ScanKeysForPublicKey(keysDir string, target ed25519.PublicKey) (string, error)
- func SigningKeyPath(keysDir, address string) string
- func UpdateGlobal(fn func(cfg *GlobalConfig) error) error
- func UpdateGlobalAt(path string, fn func(cfg *GlobalConfig) error) error
- func ValidateBaseURL(raw string) error
- type Account
- type GlobalConfig
- type ResolveOptions
- type Selection
- type Server
- type WorktreeContext
Constants ¶
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
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 DefaultWorktreeContextRelativePath ¶
func DefaultWorktreeContextRelativePath() string
func DeriveServerNameFromURL ¶
func FindWorktreeContextPath ¶
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
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
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 SaveKeypair ¶ added in v0.14.0
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
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
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 ¶
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 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 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)