credentials
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCredentials Skill
凭证管理Skill
Manages arbitrary named secrets — API keys, tokens, passwords, URLs — encrypted at rest using AES-256-GCM with per-credential PBKDF2 key derivation. Values are stored as encrypted blobs in ; only identifiers, labels, categories, and timestamps are stored in plaintext. No wallet is required — the credential store uses its own master password independent of the wallet system.
~/.aibtc/credentials.json管理任意命名的机密信息——包括API密钥、令牌、密码、URL——静止状态下采用AES-256-GCM加密,每个凭证使用独立的PBKDF2密钥派生。机密值以加密 blob 形式存储在中;仅标识符、标签、分类和时间戳以明文存储。无需钱包——该凭证存储工具使用独立于钱包系统的专属主密码。
~/.aibtc/credentials.jsonUsage
使用方法
bun run credentials/credentials.ts <subcommand> [options]bun run credentials/credentials.ts <subcommand> [options]Subcommands
子命令
add
add
Add a new credential or update an existing one. The value is encrypted with AES-256-GCM using a key derived from the master password via PBKDF2 (100,000 iterations, per-credential salt).
bun run credentials/credentials.ts add --id <id> --value <value> --password <pass> [--label <text>] [--category <cat>]Options:
- (required) — Normalized credential identifier (e.g.
--id,hiro-api-key)openrouter-token - (required) — Plaintext secret value (sensitive — not stored)
--value - (required) — Master password for encryption (sensitive)
--password - (optional) — Human-readable label (default: same as id)
--label - (optional) — Category tag such as
--category,api-key,token, orurl(default:secret)secret
Output:
json
{
"success": true,
"id": "hiro-api-key",
"label": "Hiro API Key",
"category": "api-key",
"createdAt": "2026-01-01T00:00:00.000Z",
"updatedAt": "2026-01-01T00:00:00.000Z"
}添加新凭证或更新现有凭证。机密值通过PBKDF2(100,000次迭代,每个凭证独立盐值)从主密码派生的密钥,采用AES-256-GCM加密。
bun run credentials/credentials.ts add --id <id> --value <value> --password <pass> [--label <text>] [--category <cat>]选项:
- (必填)——标准化凭证标识符(例如
--id,hiro-api-key)openrouter-token - (必填)——明文机密值(敏感信息——不会存储明文)
--value - (必填)——用于加密的主密码(敏感信息)
--password - (可选)——人类可读标签(默认值:与id相同)
--label - (可选)——分类标签,例如
--category,api-key,token或url(默认值:secret)secret
输出:
json
{
"success": true,
"id": "hiro-api-key",
"label": "Hiro API Key",
"category": "api-key",
"createdAt": "2026-01-01T00:00:00.000Z",
"updatedAt": "2026-01-01T00:00:00.000Z"
}get
get
Decrypt and return a credential value. The plaintext value appears in the output — handle with care.
bun run credentials/credentials.ts get --id <id> --password <pass>Options:
- (required) — Credential identifier
--id - (required) — Master password for decryption (sensitive)
--password
Output:
json
{
"id": "hiro-api-key",
"label": "Hiro API Key",
"category": "api-key",
"value": "hiro_api_key_xxxxxxxxxxxxxxxx",
"createdAt": "2026-01-01T00:00:00.000Z",
"updatedAt": "2026-01-01T00:00:00.000Z"
}Tip: Extract the value in scripts with$(bun run credentials/credentials.ts get --id hiro-api-key --password $CRED_PASS | jq -r .value)
解密并返回凭证值。输出中会显示明文值——请谨慎处理。
bun run credentials/credentials.ts get --id <id> --password <pass>选项:
- (必填)——凭证标识符
--id - (必填)——用于解密的主密码(敏感信息)
--password
输出:
json
{
"id": "hiro-api-key",
"label": "Hiro API Key",
"category": "api-key",
"value": "hiro_api_key_xxxxxxxxxxxxxxxx",
"createdAt": "2026-01-01T00:00:00.000Z",
"updatedAt": "2026-01-01T00:00:00.000Z"
}提示:在脚本中可通过提取值$(bun run credentials/credentials.ts get --id hiro-api-key --password $CRED_PASS | jq -r .value)
list
list
List all credential identifiers and metadata. No decryption is performed and no secret values are returned.
bun run credentials/credentials.ts listOutput:
json
{
"count": 2,
"credentials": [
{
"id": "hiro-api-key",
"label": "Hiro API Key",
"category": "api-key",
"createdAt": "2026-01-01T00:00:00.000Z",
"updatedAt": "2026-01-01T00:00:00.000Z"
}
]
}列出所有凭证标识符和元数据。不会执行解密操作,也不会返回机密值。
bun run credentials/credentials.ts list输出:
json
{
"count": 2,
"credentials": [
{
"id": "hiro-api-key",
"label": "Hiro API Key",
"category": "api-key",
"createdAt": "2026-01-01T00:00:00.000Z",
"updatedAt": "2026-01-01T00:00:00.000Z"
}
]
}delete
delete
Permanently delete a credential. Requires the master password (to verify ownership) and an explicit confirmation string.
bun run credentials/credentials.ts delete --id <id> --password <pass> --confirm DELETEOptions:
- (required) — Credential identifier to delete
--id - (required) — Master password for verification (sensitive)
--password - (required) — Must be exactly
--confirmDELETE
Output:
json
{
"success": true,
"deleted": "hiro-api-key",
"message": "Credential \"hiro-api-key\" has been permanently deleted."
}永久删除凭证。需要主密码(用于验证所有权)和明确的确认字符串。
bun run credentials/credentials.ts delete --id <id> --password <pass> --confirm DELETE选项:
- (必填)——要删除的凭证标识符
--id - (必填)——用于验证的主密码(敏感信息)
--password - (必填)——必须精确为
--confirmDELETE
输出:
json
{
"success": true,
"deleted": "hiro-api-key",
"message": "Credential \"hiro-api-key\" has been permanently deleted."
}rotate-password
rotate-password
Change the master password by atomically re-encrypting all credentials. Decrypts every credential with the old password and re-encrypts with the new one. If any credential fails to decrypt, the operation is aborted before any changes are written.
bun run credentials/credentials.ts rotate-password --old-password <pass> --new-password <pass>Options:
- (required) — Current master password (sensitive)
--old-password - (required, min 8 chars) — New master password (sensitive)
--new-password
Output:
json
{
"success": true,
"message": "Password rotated. 3 credentials re-encrypted.",
"count": 3
}通过原子方式重新加密所有凭证来更改主密码。使用旧密码解密每个凭证,再用新密码重新加密。如果任何凭证解密失败,操作将中止,不会写入任何更改。
bun run credentials/credentials.ts rotate-password --old-password <pass> --new-password <pass>选项:
- (必填)——当前主密码(敏感信息)
--old-password - (必填,最少8个字符)——新主密码(敏感信息)
--new-password
输出:
json
{
"success": true,
"message": "Password rotated. 3 credentials re-encrypted.",
"count": 3
}Security Notes
安全说明
- Credentials are AES-256-GCM encrypted with a unique salt and IV per credential — a compromised credential does not weaken others
- PBKDF2-SHA256 with 100,000 iterations makes brute-force attacks expensive
- The master password is never written to disk — pass it via flag or environment variable substitution
--password - is written with mode 0o600 (owner read/write only)
~/.aibtc/credentials.json - The credential store is independent of the wallet system — a separate master password is recommended
- and
deleteverify the password by decrypting before mutating the storerotate-password
- 每个凭证使用唯一的盐值和IV进行AES-256-GCM加密——单个凭证泄露不会影响其他凭证的安全性
- 采用100,000次迭代的PBKDF2-SHA256,大幅提高暴力破解的成本
- 主密码永远不会写入磁盘——通过参数或环境变量传递
--password - 文件权限设置为0o600(仅所有者可读写)
~/.aibtc/credentials.json - 凭证存储工具独立于钱包系统——建议使用单独的主密码
- 和
delete操作会先通过解密验证密码,再修改存储内容rotate-password