- Home
- Skills
- APIs & Backend
- Local Vault: Password + Recovery-Code Key Wrapping
Local Vault: Password + Recovery-Code Key Wrapping
The secret is a 32-byte data key and an ECDSA P-256 signing key; the public key sits in the vault file.
$35
Works with the AI Agents you already use
Local Vault: Password + Recovery-Code Key Wrapping
Example session with this skill installed
Initialize a new vault at ./data/vault.json and seal a secret message 'hello world' into a file named 'note.enc'.
- Read your context and instructions
- Compiled the local vault
Vault initialized and data sealed successfully. A recovery code has been generated.
Vault Initialization and Encryption
// 1. Create the vault
const { recoveryCode, keys } = createVault('./data/vault.json', 'Correct-Horse-Battery-Staple-2024');
console.log(`Recovery Code: ${recoveryCode}`); // Save this offline!
// 2. Derive a specific key for document storage
const docKey = keys.subKey('documents');
// 3. Seal the message into a chunked, authenticated file
const message = Buffer.from('hello world', 'utf8');
await sealFile(docKey, 'note.enc', message);
// 4. Record the action in the audit log
const auditKey = keys.subKey('audit v1');
const logger = new AuditLog('./data/audit.log', auditKey);
await logger.record('FILE_SEAL', 'DOC', 'note.enc', 'User sealed a secret note');
// 5. Clean up sensitive material from memory
keys.dispose();
Next steps
- Print the recovery code: Ensure the user stores the 26-character code in a physical location.
Run verification: Execute node scripts/vault-cli.mjs audit-verify ./data/audit.log to ensure the log chain is intact.
- Implement auto-lock: Set a timer to call
keys.dispose()after a period of user inactivity.
Connects securely to your tools. The creator never sees your data.
About this skill
Apps that encrypt their data on the device all face the same questions: how to turn a password into keys without storing anything recoverable, what happens when the user forgets it, how to keep the database, document and audit keys apart, how to store a document so a flipped or reordered block is detected, and how to write files so a crash never leaves half of one.
Vault (vault.mjs): the password (PBKDF2-SHA-256, 600,000 rounds, then HKDF bound to the purpose) and a printed recovery code (26 Crockford characters, 130 random bits, 100,000 rounds) each wrap the same secret with AES-256-GCM whose AAD binds the format, the kind and the key id. The secret is a 32-byte data key and an ECDSA P-256 signing key; the public key sits in the vault file. createVault, unlockVault, changePassword, recoverVault (issues a new code because the old one was typed in), renewRecoveryCode, verifyPassword, publicKeyOf; sloppy codes (lower case, spaces, O for 0) normalize. Keys expose subKey(label) (HKDF, deterministic per purpose), sign(bytes) (IEEE P1363) and dispose().
Sealed files (sealed-file.mjs): per-file HKDF key, 1 MiB AES-GCM chunks with the chunk index and last-flag in the nonce and the file name plus header in the AAD; reorder, drop, truncate or rename fails at the first affected chunk.
Safe files (safe-file.mjs): write-to-temp, fsync, rename; shred (random overwrite, truncate, rename, delete) and shredTree.
Audit log (audit-log.mjs): JSON lines chained with HMAC-SHA-256 over canonical rows under an audit sub-key; readable without keys, unforgeable without them; ids, counts and digests only (strings over 200 characters refused); verify names the first broken entry.
CLI (vault-cli.mjs): init, check, change-password, recover, renew-code, seal, open, audit-record, audit-verify; passwords from files, never argv. 8 tests including recovery with a sloppily typed code, every sealed-file tamper case across chunk boundaries, atomic-write cleanliness, and chain tampering (edit, reorder, delete). reference/design.md explains the hierarchy and parameters.
Node 20+, no packages, no network.
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for APIs & Backend.
Single-user only. No built-in sync. Audit logs cannot detect tail-truncation without external anchoring. Shredding effectiveness depends on hardware wear-leveling.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 17 days ago
- Software
Node.js 20+