{"id":51970085,"url":"https://github.com/webkubor/keyring","last_synced_at":"2026-07-29T21:01:35.229Z","repository":{"id":364570255,"uuid":"1268282048","full_name":"webkubor/keyring","owner":"webkubor","description":"🔐 告别 .env 泄露 — 让任何 AI Agent 安全读取加密密钥。AES-256-GCM 云端加密，一行命令解密。","archived":false,"fork":false,"pushed_at":"2026-07-16T12:29:35.000Z","size":129,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-07-16T14:17:33.477Z","etag":null,"topics":["aes-256-gcm","agent-skills","ai-agent","api-key","cloudflare","d1","developer-tools","devsecops","encryption","free","open-source","secret-management","secrets","security","skill"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/keyring-cli/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/webkubor.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-06-13T10:51:55.000Z","updated_at":"2026-07-16T12:30:19.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/webkubor/keyring","commit_stats":null,"previous_names":["webkubor/agent-secret-skills","webkubor/keyring"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/webkubor/keyring","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webkubor%2Fkeyring","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webkubor%2Fkeyring/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webkubor%2Fkeyring/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webkubor%2Fkeyring/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/webkubor","download_url":"https://codeload.github.com/webkubor/keyring/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webkubor%2Fkeyring/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":36049371,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-07-20T02:08:10.276Z","status":"online","status_checked_at":"2026-07-29T02:00:04.910Z","response_time":95,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aes-256-gcm","agent-skills","ai-agent","api-key","cloudflare","d1","developer-tools","devsecops","encryption","free","open-source","secret-management","secrets","security","skill"],"created_at":"2026-07-29T21:01:34.619Z","updated_at":"2026-07-29T21:01:35.214Z","avatar_url":"https://github.com/webkubor.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"![logo](https://cdn.jsdelivr.net/gh/webkubor/picx-images-hosting@master/blog/projects/keyring/cs-token4ai-1784193570620950000.png)\n\n![banner](https://cdn.jsdelivr.net/gh/webkubor/picx-images-hosting@master/blog/projects/keyring-banner/cs-token4ai-1784197546810397000.png)\n\n# 🔐 Keyring — AI 时代密钥管理\n\n\u003e **你存一次，AI 永远看不到明文。**\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)\n[![Python 3.10+](https://img.shields.io/badge/Python-3.10%2B-blue.svg)](https://www.python.org/)\n[![Version](https://img.shields.io/badge/Version-1.1.0-blue.svg)](https://github.com/webkubor/keyring/releases)\n\n---\n\n## ⚡ 30 秒上手\n\n```bash\n# 安装\npip install keyring-cli\n\n# 初始化\nkyi\n\n# 存账户密码\nkya set github user@gmail.com mypassword\n\n# 存平台密钥\nkyk set github ghp_xxxxxxxxxxxx\n\n# AI 用\nkyr --env GITHUB_TOKEN=ghp_xxxxxxxxxxxx -- git push\n```\n\n**快捷别名：** `ky`=keyring `kyp`=platform `kya`=account `kyk`=key `kyi`=init `kyr`=run\n\n---\n\n## 🎯 为什么需要 Keyring？\n\n| 方案 | AI 能读明文？ | 安全性 |\n|------|--------------|--------|\n| `.env` 文件 | ✅ 能 | ❌ 危险 |\n| 环境变量 | ✅ 能 | ⚠️ 有风险 |\n| **Keyring** | **❌ 不能** | **✅ 安全** |\n\n### 痛点\n\n```\n你: 帮我推代码到 GitHub\nAI: 好的，我看到你的 token 是 ghp_abc123...（已泄露）\n```\n\n### 解决\n\n```\n你: 帮我推代码到 GitHub  \nAI: keyring run --env GITHUB_TOKEN=github_token -- git push\n    （只看到别名，看不到明文）\n```\n\n---\n\n## 🔥 核心亮点\n\n| 特性 | 说明 |\n|------|------|\n| 🔒 **AI 安全** | 别名注入，明文不暴露 |\n| ⚡ **极速** | 纯本地，毫秒级响应 |\n| 🎯 **多账户多密钥** | 每个平台支持多个账户和多个密钥 |\n| 📦 **轻量依赖** | 仅需 `cryptography\u003e=41.0` |\n| 🔄 **兼容** | 支持 .env 导入 |\n\n---\n\n## 📖 使用指南\n\n### 账户管理\n\n```bash\n# 保存账户（用户名+密码）\nkya set github user@gmail.com mypassword123\nkya set github admin@gmail.com adminpass456\n\n# 读取密码\nkya get github user@gmail.com\n\n# 列出平台下所有账户\nkya list github\n\n# 删除账户\nkya delete github user@gmail.com\n```\n\n### 密钥管理\n\n```bash\n# 保存平台密钥（API Key、Token 等）\nkyk set github ghp_xxxxxxxxxxxx\nkyk set openai sk-xxxxxxxxxxxx\n\n# 读取密钥\nkyk get github ghp_xxxxxxxxxxxx\n\n# 列出平台下所有密钥\nkyk list github\n\n# 删除密钥\nkyk delete github ghp_xxxxxxxxxxxx\n```\n\n### 平台查询\n\n```bash\n# 列出所有平台及摘要\nkyp\n\n# 查看指定平台详情\nkyp github\n```\n\n### AI 集成\n\n```bash\n# 推代码\nkyr --env GITHUB_TOKEN=ghp_xxxxxxxxxxxx -- git push\n\n# 调 API\nkyr --env OPENAI_API_KEY=sk-xxxxxxxxxxxx -- python app.py\n\n# 多个密钥\nkyr --env TOKEN1=secret1 --env TOKEN2=secret2 -- python script.py\n```\n\n### 别名系统\n\n```bash\n# 创建别名（AI 只认识这个）\nky alias set github_token secret://github/ghp_xxxxxxxxxxxx\n\n# 用别名注入\nkyr --env GITHUB_TOKEN=github_token -- git push\n```\n\n### 从 .env 迁移\n\n```bash\n# 预览（不实际导入）\nky import --file .env --dry-run\n\n# 导入全部\nky import --file .env\n\n# 只导入 GitHub 相关\nky import --file .env --prefix GITHUB_\n```\n\n---\n\n## 📁 安全架构\n\n```\n~/.keyring/\n├── master.key       # AES-256 密钥（chmod 600）\n└── secrets.json     # 加密后的账户/密钥（AES-256-GCM）\n```\n\n### 存储结构\n\n```json\n{\n  \"github\": {\n    \"accounts\": {\n      \"user@gmail\": \"encrypted_password_1\",\n      \"admin@gmail\": \"encrypted_password_2\"\n    },\n    \"keys\": {\n      \"ghp_xxx\": \"encrypted_key_1\",\n      \"ghp_yyy\": \"encrypted_key_2\"\n    }\n  }\n}\n```\n\n- **加密算法**: AES-256-GCM（认证加密）\n- **密钥派生**: SHA-256\n- **存储**: 纯本地，零网络\n- **权限**: master.key 仅所有者可读\n\n---\n\n## 📋 命令速查\n\n| 快捷 | 完整 | 用途 | 示例 |\n|------|------|------|------|\n| `kyi` | `keyring init` | 初始化 | `kyi` |\n| **账户管理** | | | |\n| `kya set` | `keyring account set` | 存账户 | `kya set github user@gmail pass` |\n| `kya get` | `keyring account get` | 读密码 | `kya get github user@gmail` |\n| `kya list` | `keyring account list` | 列账户 | `kya list github` |\n| `kya delete` | `keyring account delete` | 删账户 | `kya delete github user@gmail` |\n| **密钥管理** | | | |\n| `kyk set` | `keyring key set` | 存密钥 | `kyk set github ghp_xxx value` |\n| `kyk get` | `keyring key get` | 读密钥 | `kyk get github ghp_xxx` |\n| `kyk list` | `keyring key list` | 列密钥 | `kyk list github` |\n| `kyk delete` | `keyring key delete` | 删密钥 | `kyk delete github ghp_xxx` |\n| **平台查询** | | | |\n| `kyp` | `keyring platform` | 平台列表 | `kyp` |\n| `kyp \u003cname\u003e` | `keyring platform \u003cname\u003e` | 平台详情 | `kyp github` |\n| **API 验证** | | | |\n| `ky check` | `keyring check` | 验证 key | `ky check openai --key sk-xxx` |\n| `ky providers` | `keyring providers` | 支持平台 | `ky providers` |\n| **AI 集成** | | | |\n| `kyr` | `keyring run` | 注入env | `kyr --env X=val -- cmd` |\n\n---\n\n## 🤖 兼容平台\n\n### LLM 大模型\n\n| 平台 | Logo | 验证 | 别名注入 |\n|------|------|------|----------|\n| OpenAI | 🟢 | `ky check openai --key sk-xxx` | ✅ |\n| DeepSeek | 🔵 | `ky check deepseek --key sk-xxx`（含余额） | ✅ |\n| 智谱 AI | 🟣 | `ky check zhipu --key xxx`（含余额） | ✅ |\n| Moonshot (Kimi) | 🌙 | `ky check moonshot --key sk-xxx`（含余额） | ✅ |\n| Anthropic (Claude) | 🟠 | `ky check anthropic --key sk-ant-xxx` | ✅ |\n| Google Gemini | 💎 | `ky check gemini --key xxx` | ✅ |\n| 通义千问 | ☁️ | `ky check qwen --key sk-xxx` | ✅ |\n| MiniMax | 🔷 | `ky check minimax --key xxx` | ✅ |\n| 字节豆包 | 🫘 | `ky check doubao --key xxx`（含余额） | ✅ |\n| Groq | ⚡ | `ky check groq --key gsk_xxx` | ✅ |\n| Together AI | 🤝 | `ky check together --key xxx` | ✅ |\n| OpenRouter | 🔀 | `ky check openrouter --key sk-or-xxx` | ✅ |\n| Fireworks AI | 🔥 | `ky check fireworks --key xxx` | ✅ |\n| SiliconFlow | 🧊 | `ky check siliconflow --key sk-xxx` | ✅\n| 百川 | 🌊 | `ky check baichuan --key xxx` | ✅ |\n| 讯飞星火 | ✨ | `ky check spark --key xxx` | ✅ |\n| 阿里云百炼 | ☁️ | `ky check aliyun --key xxx`（含余额） | ✅ |\n\n### 开发平台\n\n| 平台 | Logo | 验证 | 别名注入 |\n|------|------|------|----------|\n| GitHub | 🐙 | `ky check github --key ghp_xxx` | ✅ |\n\n---\n\n## 🏆 对比\n\n| 功能 | Keyring | .env | 1Password | Vault |\n|------|---------|------|-----------|-------|\n| AI 安全 | ✅ | ❌ | ✅ | ✅ |\n| 本地存储 | ✅ | ✅ | ❌ | ❌ |\n| 多账户多密钥 | ✅ | ❌ | ✅ | ✅ |\n| API Key 验证 | ✅ | ❌ | ❌ | ❌ |\n| 轻量依赖 | ✅ | ✅ | ❌ | ❌ |\n| 免费开源 | ✅ | ✅ | ❌ | ⚠️ |\n| 命令行 | ✅ | ✅ | ⚠️ | ⚠️ |\n\n---\n\n## 🤝 贡献\n\n欢迎贡献！请查看 [CONTRIBUTING.md](CONTRIBUTING.md)。\n\n```bash\n# 开发环境\ngit clone https://github.com/webkubor/keyring.git\ncd keyring\npip install -e .\npip install pytest\npytest\n```\n\n---\n\n## 📄 许可证\n\n[MIT License](LICENSE)\n\n---\n\n\u003cp align=\"center\"\u003e\n  Built with 🔐 by \u003ca href=\"https://github.com/webkubor\"\u003ewebkubor\u003c/a\u003e\n\u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebkubor%2Fkeyring","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwebkubor%2Fkeyring","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebkubor%2Fkeyring/lists"}