架构
┌─────────────────────────────────────────────────────────┐
│ AI Agent (Hermes / LLM) │
│ "run psql with DATABASE_URL" │
└────────────────────┬────────────────────────────────────┘
│ CLI / HTTP
▼
┌─────────────────────────────────────────────────────────┐
│ trustless CLI │
│ │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
│ │ secret │ │ run │ │ proxy │ │
│ │ (list/ │ │ (subproc │ │ (HTTP │ │
│ │ get/set)│ │ inject) │ │ proxy + │ │
│ └────┬─────┘ └────┬─────┘ │ MITM) │ │
│ │ │ └─────┬─────┘ │
│ │ │ │ │
│ ┌────┴─────────────┴──────────────┴─────┐ │
│ │ Backend Interface │ │
│ │ (pass / env / bitwarden — swappable) │ │
│ └─────────────────────┬──────────────────┘ │
└────────────────────────┼────────────────────────────────┘
│
┌─────────────┴─────────────┐
│ │
▼ ▼
┌──────────────┐ ┌──────────────┐
│ pass store │ │ Target API │
│ (GPG + pass) │ │ / Service │
└──────────────┘ └──────────────┘
后端抽象
凭据解析器被抽象为简单接口:
type Backend interface {
Resolve(ctx context.Context, key string) (string, error)
List(ctx context.Context) ([]Entry, error)
}
已实现的后端:
pass(默认)—— 封装pass show <key>,读取第一行作为密钥env—— 通过os.Getenv()从环境变量读取(用于 CI/CD、容器)bitwarden—— 封装bwCLI(bw list items),解析 secureNotefields[value]/ 登录密码 / notes 首行。会话密钥通过BW_SESSION环境变量传递(绝不经过 argv)。通过trustless bw-unlock解锁(会话密钥保存到~/.config/trustless/bw-session,0600)。会话无效时 fail closed。详见 docs/bitwarden-backend-design.md
通过 trustless config set backend <name> 配置。