Files
crypto_key/README.md
T
2026-05-19 01:10:36 +08:00

117 lines
2.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# crypto_key — 币圈 API 密钥管理工具
本地 Web 工具,管理多个交易所/平台 API 账户(账户名称、API Key、API Secret)。数据保存在本地 `data.json`,无登录。
| 项目 | 说明 |
|------|------|
| 仓库 | [git.bz121.com/dekun/crypto_key](https://git.bz121.com/dekun/crypto_key.git) |
| Ubuntu 部署路径 | `/opt/crypto_key` |
| 服务端口 | `5200` |
| 进程守护 | PM2 |
---
## 功能
- 交易所:`binance` / `okx` / `gate`OKX 额外保存密码 Passphrase
- 账户数量不限,每项含 `exchange` / `username` / `api_key` / `api_secret`
- 添加后默认不展示列表,需选择交易所点击「确认」查询
- 黑色专业界面,列表展示 + 每项 3 个复制按钮(**复制始终为明文**)
- 可选界面打码显示,不影响复制内容
- 数据持久化至 `data.json`
---
## Ubuntu 服务器部署(/opt
完整步骤见 **[DEPLOY.md](./DEPLOY.md)**。
```bash
sudo git clone https://git.bz121.com/dekun/crypto_key.git /opt/crypto_key
cd /opt/crypto_key
sudo bash scripts/install-ubuntu.sh
```
访问:
- 本机:**http://127.0.0.1:5200**
- 局域网:**http://<服务器局域网IP>:5200**(如 `http://192.168.1.100:5200`
查看本机 IP`hostname -I``ip addr`
```bash
pm2 status
pm2 logs api-key-manager
```
---
## 本地开发
```bash
python3 -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install -r requirements.txt
python app.py
```
浏览器打开 http://127.0.0.1:5200(局域网内其他设备用 `http://<本机IP>:5200`
PM2 守护:`./pm2-start.sh`Linux)或 `.\pm2-start.ps1`Windows
---
## 文件说明
| 文件 | 说明 |
|------|------|
| `app.py` | Flask 后端 |
| `index.html` | 前端页面 |
| `ecosystem.config.cjs` | PM2 配置 |
| `scripts/install-ubuntu.sh` | Ubuntu 一键安装 |
| `DEPLOY.md` | 完整部署文档 |
---
## 数据格式
```json
{
"id": "uuid",
"exchange": "binance",
"username": "账户名称",
"api_key": "API Key",
"api_secret": "API Secret",
"password": "仅 OKX 需要"
}
```
---
## API
| 方法 | 路径 | 说明 |
|------|------|------|
| GET | `/` | 前端页面 |
| GET | `/api/accounts` | 获取全部账户 |
| GET | `/api/accounts?exchange=binance` | 按交易所筛选 |
| POST | `/api/accounts` | 新增账户 |
| DELETE | `/api/accounts/<id>` | 删除账户 |
---
## 安全提示
- 无认证,监听 `0.0.0.0`(局域网可访问),请勿暴露到公网;建议仅在可信局域网使用
- `data.json` 为明文密钥,已 `.gitignore`,请定期备份
---
## 依赖
```
flask>=3.0.0,<4.0.0
```
服务器另需:Python 3.8+、Node.jsPM2