npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

safekey-cli

v1.1.0

Published

🔐 极简本地密码保险箱 — AES256 加密存储 API Key / Token / 密码

Downloads

244

Readme

🔐 safekey-cli

终端里的密码保险箱 — 一行命令,加密存储你所有的 API Key / Token / 密码


🤔 这东西解决了什么?

每个程序员手里都有几十个密钥:GitHub Token、OpenAI API Key、数据库密码、各种第三方服务的 Key…

存记事本? 明文泄漏风险。用 1Password? 太重还要钱。用浏览器密码管理器? 不适合存 API Key。

safekey-cli — 一行 npm install -g safekey-cli,终端里 safekey get openai 就拿 key,AES-256-GCM 加密落盘,绝不联网。


⚡ 5 秒上手

npm install -g safekey-cli
safekey init                 # 设一个主密码
safekey add openai           # 存你的第一个 Key
safekey get openai           # 取出,自动复制到剪贴板 ✅

📖 命令一览

safekey init

初始化保险箱,只做一次。

$ safekey init
🔐 safekey — 初始化保险箱

请设置主密码(不少于 6 位): ******
请再次输入主密码: ******

✅ 保险箱初始化成功!

safekey add

支持交互模式和参数模式:

# 交互式 — 推荐
$ safekey add openai
请输入主密码: ******
请输入 "openai" 的值: sk-xxxxxxxx

# 参数式 — 适合脚本
$ safekey add github -v "ghp_xxxxxxxxxxxx"

safekey get ⭐ 核心卖点

查询并自动复制到剪贴板。30 秒后自动清空剪贴板,不留痕迹。

$ safekey get openai
✅ 已复制 "openai" 到剪贴板
💡 30 秒后自动清空剪贴板以确保安全

只看不复制:

$ safekey get openai --no-copy
sk-xxxxxxxx

safekey list / safekey ls

列出所有已保存的记录:

$ safekey list
  名称           更新时间
  ──────────  ────────────────────
  deepseek     2026/5/8 11:54:46
  github       2026/5/8 10:20:35
  openai       2026/5/8 11:54:46
  server-db    2026/5/8 09:12:00

📦 共 4 条记录

safekey delete / safekey rm

$ safekey delete openai
✅ 已删除 "openai"

safekey status / safekey st

$ safekey status
🔐 safekey 状态
  版本:       1
  创建时间:   2026-05-08T03:54:46.301Z
  加密算法:   AES-256-GCM

🤖 脚本 / CI/CD 集成

设置 VAULT_PASSWORD 环境变量,跳过交互输入:

VAULT_PASSWORD=your_master_password safekey get deploy-key

适合 CI/CD 流水线中安全获取密钥。


🔒 安全设计

| 特性 | 实现 | |------|------| | 加密算法 | AES-256-GCM(认证加密,防篡改) | | 密钥派生 | PBKDF2 + SHA256,10 万次迭代 | | 存储位置 | 本地 ~/.safekey-cli/,不上传任何服务器 | | 文件权限 | 目录 700 / 文件 600,其他用户无法读取 | | 剪贴板保护 | 复制后 30 秒自动清空 | | 零遥测 | 无埋点、无统计、无网络请求 |

📌 数据格式:VAULT_V1: + Base64(Salt + IV + AuthTag + Ciphertext),全部加密落盘,没有主密码谁也解不开。


🆚 跟其他方案比

| | safekey-cli | 记事本 | 1Password | Bitwarden CLI | pass | |------|:---:|:---:|:---:|:---:|:---:| | 加密存储 | ✅ AES256 | ❌ 明文 | ✅ | ✅ | ✅ GPG | | 安装体积 | ~1 MB | - | ~200 MB | ~100 MB | ~5 MB | | CLI 优先 | ✅ 核心设计 | ❌ | ❌ | ✅ | ✅ | | 剪贴板自动清空 | ✅ 30s | ❌ | ✅ | ❌ | ❌ | | 免费开源 | ✅ MIT | ✅ | ❌ 付费 | ✅ | ✅ | | 一行安装 | ✅ npm -g | ✅ | ❌ | ✅ | ✅ | | 零依赖密钥管理 | ✅ | - | ❌ 需账户 | ❌ 需账户 | ❌ 需 GPG | | 适合存 API Key | ✅ 专为此设计 | ❌ | ⚠️ 偏重密码 | ⚠️ | ⚠️ |


📂 项目结构

safekey-cli/
├── bin/vault.js              # CLI 入口
├── src/
│   ├── cli.js                # Commander 框架注册
│   ├── core/vault.js         # 🔐 加解密 & 文件读写引擎
│   ├── commands/
│   │   ├── init.js
│   │   ├── add.js
│   │   ├── get.js
│   │   ├── list.js
│   │   ├── delete.js
│   │   └── status.js
│   └── utils/password.js     # 密码输入(交互 / 环境变量)
├── package.json
└── README.md

🛠 技术栈

  • CLI 框架 — Commander.js
  • 加密 — Node.js 原生 crypto(AES-256-GCM)
  • 密钥派生 — PBKDF2 / SHA256
  • 密码输入 — @inquirer/password(TTY 终端回显为 *

🚀 路线图

  • [ ] safekey export / safekey import — 加密导出,换机迁移
  • [ ] safekey search — 模糊搜索记录
  • [ ] 标签分类(safekey add --tag work
  • [ ] 多保险箱支持(safekey use <name>

📄 License

MIT © a0216


⭐ 好用的话点个 Star,让更多程序员告别明文存 Key!