介绍
# Janee
面向 AI 智能体的密钥管理。加密存储 API 密钥,通过 Janee 发起请求,无需接触真实密钥。
## 为什么要使用 Janee?
大多数技能(skills)要求你将 API 密钥存储在明文配置文件中。一次提示注入、一次日志泄露、一次会话被劫持——你的密钥就会暴露。
Janee 解决了这个问题: - **密钥静态加密** —— 而非明文 JSON - **智能体永远无法获取真实密钥** —— 请求通过 Janee 发起 - **基于路径的策略** —— 限制可调用的端点 - **完整的审计追踪** —— 记录每一次请求 - **终止开关** —— 在无需轮换密钥的情况下撤销访问权限
## 安装
```bash npm install -g @true-and-useful/janee janee init ```
## 添加服务
```bash janee add ```
按照提示添加你的 API 凭证。密钥将自动加密。
## 在智能体中使用
不要直接使用你的密钥调用 API,而是通过 Janee 调用:
```bash # Old way (dangerous): curl -H "Authorization: Bearer sk_live_xxx" https://api.stripe.com/v1/balance
# Janee way (safe): # Agent calls execute(capability, method, path) via MCP # Janee injects the key, agent never sees it ```
## OpenClaw 集成
安装 OpenClaw 插件以获得原生工具支持:
```bash openclaw plugins install @true-and-useful/janee-openclaw ```
你的智能体现在拥有: - `janee_list_services` —— 查看可用的 API - `janee_execute` —— 通过 Janee 发起请求 - `janee_reload_config` —— 配置更改后热重载
## 示例:安全的 Moltbook 访问
不要将你的 Moltbook 密钥存储在 `~/.config/moltbook/credentials.json` 中:
```bash janee add moltbook -u https://www.moltbook.com/api/v1 -k YOUR_KEY ```
然后使用 Janee 进行发布:
```yaml # Your agent calls: janee_execute(service="moltbook", method="POST", path="/posts", body=...) ```
你的 Moltbook 密钥将保持加密状态。即使你的智能体被攻破,密钥也无法被窃取。
## 配置示例
```yaml services: stripe: baseUrl: https://api.stripe.com auth: type: bearer key: sk_live_xxx # encrypted
moltbook: baseUrl: https://www.moltbook.com/api/v1 auth: type: bearer key: moltbook_sk_xxx # encrypted
capabilities: stripe_readonly: service: stripe rules: allow: [GET *] deny: [POST *, DELETE *]
moltbook: service: moltbook ttl: 1h autoApprove: true ```
## 架构
``` ┌─────────────┐ ┌──────────┐ ┌─────────┐ │ AI Agent │─────▶│ Janee │─────▶│ API │ │ │ MCP │ │ HTTP │ │ └─────────────┘ └──────────┘ └─────────┘ │ │ No key Injects key + logs request ```
## 链接
- GitHub: https://github.com/rsdouglas/janee - npm: https://www.npmjs.com/package/@true-and-useful/janee - OpenClaw Plugin: https://www.npmjs.com/package/@true-and-useful/janee-openclaw