### Install and Initialize Keyclasp Source: https://github.com/andreacatalucci/keyclasp/blob/main/index.html Global installation and initialization of the Keyclasp vault. ```bash npm install -g keyclasp && keyclasp init ``` -------------------------------- ### New User Flow Source: https://github.com/andreacatalucci/keyclasp/blob/main/AGENTS.md Basic commands for installing, initializing, and using Keyclasp. ```bash npm i -g keyclasp # Install keyclasp init # Empty passphrase for machine-only (agents/CI) keyclasp set API_KEY - # Store a secret securely keyclasp run --env API_KEY -- npm test # Inject only the named secret ``` -------------------------------- ### Install Keyclasp via NPM Source: https://github.com/andreacatalucci/keyclasp/blob/main/docs/getting-started.md Install the package globally and initialize the vault. ```bash npm install -g keyclasp keyclasp init ``` -------------------------------- ### Install Keyclasp Source: https://github.com/andreacatalucci/keyclasp/blob/main/README.md Install the package globally via npm or build from source. ```bash npm install -g keyclasp ``` ```bash git clone https://github.com/AndreaCatalucci/keyclasp.git cd keyclasp npm install npm run build npm link ``` -------------------------------- ### Install Keyclasp in Docker Source: https://github.com/andreacatalucci/keyclasp/blob/main/docs/recipes.md Include Keyclasp in a Docker image by installing it globally via npm. ```dockerfile FROM node:24-slim RUN npm install -g keyclasp ``` -------------------------------- ### Manage secrets with project and environment flags Source: https://github.com/andreacatalucci/keyclasp/blob/main/docs/commands.md Examples of setting, retrieving, listing, and checking the status of secrets while explicitly defining project and environment scopes. ```bash keyclasp set DATABASE_URL - --project myapp --environment prod keyclasp get DATABASE_URL --project myapp --environment prod keyclasp list --project myapp --environment prod keyclasp status --project myapp --environment prod ``` -------------------------------- ### Install Keyclasp Agent Skill Source: https://github.com/andreacatalucci/keyclasp/blob/main/README.md Commands to install the Keyclasp agent skill globally for coding agents. ```bash npx skills add AndreaCatalucci/keyclasp@keyclasp-agent -g ``` ```bash npx skills add . --skill keyclasp-agent -g ``` -------------------------------- ### Initialize Keyclasp Development Environment Source: https://github.com/andreacatalucci/keyclasp/blob/main/README.md Use these commands to clone the repository and prepare the local environment for development. ```bash git clone https://github.com/AndreaCatalucci/keyclasp.git cd keyclasp npm install npm run build npm test ``` -------------------------------- ### Build Keyclasp from Source Source: https://github.com/andreacatalucci/keyclasp/blob/main/docs/getting-started.md Clone the repository and build the project locally. ```bash git clone https://github.com/AndreaCatalucci/keyclasp.git cd keyclasp npm install npm run build npm link keyclasp init ``` -------------------------------- ### Discover Projects and Environments Source: https://github.com/andreacatalucci/keyclasp/blob/main/skills/keyclasp-agent/SKILL.md Use these commands to identify available projects and environments when the scope is unknown. ```bash keyclasp projects keyclasp environments keyclasp list --all ``` -------------------------------- ### Run vault-backed commands in CI/CD Source: https://github.com/andreacatalucci/keyclasp/blob/main/docs/recipes.md Initialize Keyclasp with an empty passphrase for non-TTY environments and execute commands using the vault-backed secret store. ```bash keyclasp init <<< "" echo "$SECRET_API_KEY" | keyclasp set SECRET_API_KEY --project myapp --environment ci keyclasp run --project myapp --environment ci --env SECRET_API_KEY -- npm test ``` -------------------------------- ### Keyclasp Utility Commands Source: https://github.com/andreacatalucci/keyclasp/blob/main/docs/commands.md Basic commands to display the current version or access help information. ```bash keyclasp version # Show package or local/dev version keyclasp help # Show usage ``` -------------------------------- ### Manage Demo Secrets Source: https://github.com/andreacatalucci/keyclasp/blob/main/docs/getting-started.md Set, list, and check the status of secrets in a local environment. ```bash keyclasp set DEMO_SECRET - --project demo --environment local # Paste any 8+ character string, then press Enter keyclasp list --project demo --environment local keyclasp status --project demo --environment local ``` -------------------------------- ### Package Versioning and Publishing Workflow Source: https://github.com/andreacatalucci/keyclasp/blob/main/docs/commands.md Standard sequence for managing package versions and publishing to npm, including prerelease tagging. ```bash keyclasp version npm version patch # or minor / major for an intentional release npm publish npm version prerelease --preid beta npm publish --tag beta # deliberate prerelease channel, not latest ``` -------------------------------- ### Initialize Vault Source: https://github.com/andreacatalucci/keyclasp/blob/main/README.md Initialize a new local vault for storing secrets. ```bash keyclasp init ``` -------------------------------- ### Build Commands Source: https://github.com/andreacatalucci/keyclasp/blob/main/AGENTS.md Commands for compiling the TypeScript project. ```bash npm run build # Compile TypeScript npx tsc --watch # Dev mode ``` -------------------------------- ### Project Structure Source: https://github.com/andreacatalucci/keyclasp/blob/main/AGENTS.md Overview of the source code organization and key modules. ```text src/ ├── vault.ts → AES-256-GCM encryption + SQLite store, key management, project/environment scoping ├── run.ts → Guarded child-process execution with secret injection ├── context.ts → --project/--environment flag parsing and precedence resolution (flag > env var > context.json > default) ├── cli.ts → CLI entry point (init/set/get/list/delete/use/projects/environments/rename/run/status/version) ├── index.ts → Public API exports └── version.ts → Package/git-derived version string docs/solutions/ # documented solutions (bugs, best practices, workflow patterns), organized by category with YAML frontmatter (module, tags, problem_type) ``` -------------------------------- ### Production Usage Source: https://github.com/andreacatalucci/keyclasp/blob/main/README.md Set secrets for production and run commands with specific or all environment variables. ```bash keyclasp set SECRET_API_KEY - --project myapp --environment prod keyclasp run --project myapp --environment prod --env SECRET_API_KEY -- npm test keyclasp status --project myapp --environment prod ``` ```bash keyclasp run --project myapp --environment prod -- npm test ``` -------------------------------- ### Manage and Test Secrets Source: https://github.com/andreacatalucci/keyclasp/blob/main/README.md Set, list, and verify secret injection into child processes. ```bash keyclasp set DEMO_SECRET - --project demo --environment local # Paste any 8+ character string, then press Enter keyclasp list --project demo --environment local ``` ```bash keyclasp run --project demo --environment local --env DEMO_SECRET -- \ node -e 'const v = process.env.DEMO_SECRET; console.log(v ? "injected, " + v.length + " chars" : "missing")' ``` ```bash keyclasp run --project demo --environment local --env DEMO_SECRET -- \ node -e 'console.log(process.env.DEMO_SECRET)' ``` -------------------------------- ### Store Production Secrets Source: https://github.com/andreacatalucci/keyclasp/blob/main/docs/getting-started.md Set and verify secrets for a production environment. ```bash keyclasp set SECRET_API_KEY - --project myapp --environment prod # Paste the value, then press Enter keyclasp list --project myapp --environment prod keyclasp status --project myapp --environment prod ``` -------------------------------- ### Execute Commands with Secrets Source: https://github.com/andreacatalucci/keyclasp/blob/main/docs/getting-started.md Run commands with injected secrets using the specified project and environment. ```bash keyclasp run --project myapp --environment prod --env SECRET_API_KEY -- npm test keyclasp run --project myapp --environment prod --env SECRET_API_KEY -- npm start ``` -------------------------------- ### Verify Secret Injection Source: https://github.com/andreacatalucci/keyclasp/blob/main/docs/getting-started.md Run a command to verify that the secret is injected into the environment without leaking it. ```bash keyclasp run --project demo --environment local --env DEMO_SECRET -- \ node -e 'const v = process.env.DEMO_SECRET; console.log(v ? "injected, " + v.length + " chars" : "missing")' ``` -------------------------------- ### Inject secrets with least-privilege Source: https://github.com/andreacatalucci/keyclasp/blob/main/docs/recipes.md Use explicit --env mappings to restrict the secrets available to a specific command. ```bash keyclasp run --project myapp --environment prod --env SECRET_API_KEY --env DATABASE_URL -- npm test ``` -------------------------------- ### Mount vault in Docker container Source: https://github.com/andreacatalucci/keyclasp/blob/main/docs/recipes.md Bind mount the local .keyclasp directory at runtime to provide access to secrets without baking them into the image. ```bash docker run --mount type=bind,source="$HOME/.keyclasp",target=/root/.keyclasp your-image \ keyclasp run --project myapp --environment ci --env SECRET_API_KEY -- npm test ``` -------------------------------- ### Verify Vault Status and Secret Availability Source: https://github.com/andreacatalucci/keyclasp/blob/main/skills/keyclasp-agent/SKILL.md Check the vault status and list available secrets for a specific project and environment. ```bash keyclasp status --project --environment keyclasp list --project --environment ``` -------------------------------- ### Store a Secret Source: https://github.com/andreacatalucci/keyclasp/blob/main/index.html Encrypts a secret into the local vault using the specified key name. ```bash keyclasp set SECRET_API_KEY - ``` -------------------------------- ### Execute Commands with Secret Injection Source: https://github.com/andreacatalucci/keyclasp/blob/main/skills/keyclasp-agent/SKILL.md Run commands at the process boundary, mapping secrets to environment variables as needed. ```bash keyclasp run --project --environment --env OPENAI_API_KEY -- npm test keyclasp run --project --environment --env OPENAI_KEY:OPENAI_API_KEY -- npm test ``` -------------------------------- ### Execute commands with injected secrets Source: https://github.com/andreacatalucci/keyclasp/blob/main/docs/commands.md Injects secrets into a child process. Requires Touch ID or vault passphrase authentication for full scope injection. ```bash keyclasp run --project myapp --environment prod --env API_KEY -- npm test keyclasp run --project myapp --environment prod --env HELLO:WORLD -- npm test keyclasp run --project myapp --environment prod -- npm start # Operator-only; Touch ID or vault passphrase ``` -------------------------------- ### Run Command with Injected Secrets Source: https://github.com/andreacatalucci/keyclasp/blob/main/index.html Executes a command with specified secrets injected into the environment, while monitoring for output leaks. ```bash keyclasp run --env SECRET_API_KEY -- npm start ``` -------------------------------- ### List Available Secrets Source: https://github.com/andreacatalucci/keyclasp/blob/main/index.html Displays the names of stored secrets without revealing their values. ```bash keyclasp list ``` -------------------------------- ### Map Secret to Custom Environment Variable Source: https://github.com/andreacatalucci/keyclasp/blob/main/docs/getting-started.md Inject a stored secret into a child process using a different environment variable name. ```bash keyclasp run --project myapp --environment prod --env SECRET_API_KEY:API_TOKEN -- npm test ``` -------------------------------- ### Implement Prefix-Aware Carry Buffer Source: https://github.com/andreacatalucci/keyclasp/blob/main/docs/solutions/integration-issues/run-guard-stream-scanning-cli-compatibility.md Logic for flushing output chunks while retaining potential secret prefixes to ensure split-secret detection without blocking interactive prompts. ```ts const combined = carry + chunk; const keepLength = prefixCarryLength(combined, values, maxSecretLength); const flushLength = combined.length - keepLength; carry = combined.slice(flushLength); const redacted = redact(combined.slice(0, flushLength)); return redacted; ``` ```ts function prefixCarryLength(input: string, values: string[], maxSecretLength: number): number { for (let length = Math.min(input.length, maxSecretLength - 1); length > 0; length -= 1) { const suffix = input.slice(-length); if (values.some((value) => value.startsWith(suffix))) return length; } return 0; } ``` -------------------------------- ### Rename project or environment scopes Source: https://github.com/andreacatalucci/keyclasp/blob/main/docs/commands.md Renames are atomic and will abort if the destination scope contains colliding secret names. ```bash keyclasp rename --project OLD --to-project NEW keyclasp rename --project APP --environment OLD --to-environment NEW keyclasp rename --all-projects --environment OLD --to-environment NEW keyclasp rename --project APP --environment ENV --to-project NEW_APP --to-environment NEW_ENV ``` -------------------------------- ### Derive Data Encryption Key and Key Encryption Key Source: https://github.com/andreacatalucci/keyclasp/blob/main/docs/security.md Generates a 32-byte random data key and derives a key encryption key using PBKDF2-HMAC-SHA256 with 600,000 iterations. ```ts const dek = crypto.randomBytes(32); const kek = crypto.pbkdf2Sync(passphrase, salt, 600_000, 32, "sha256"); ``` -------------------------------- ### Perform bulk deletion of secrets Source: https://github.com/andreacatalucci/keyclasp/blob/main/docs/commands.md Requires an interactive TTY and manual confirmation. The operation aborts if the scope changes during the prompt to prevent accidental deletion of new secrets. ```bash keyclasp delete --bulk --project APP keyclasp delete --bulk --project APP --environment ENV keyclasp delete --bulk --environment ENV --all-projects ``` -------------------------------- ### Encrypt Secret Values with AES-256-GCM Source: https://github.com/andreacatalucci/keyclasp/blob/main/docs/security.md Encrypts individual database values using a 96-bit random IV and 128-bit authentication tag. ```ts const iv = crypto.randomBytes(12); const cipher = crypto.createCipheriv("aes-256-gcm", key, iv, { authTagLength: 16 }); const encrypted = Buffer.concat([cipher.update(plaintext, "utf8"), cipher.final()]); const authTag = cipher.getAuthTag(); ``` -------------------------------- ### Keyclasp Vault Cryptographic Architecture Source: https://github.com/andreacatalucci/keyclasp/blob/main/docs/security.md Visual representation of the vault's encryption flow, showing the use of AES-256-GCM and PBKDF2 for secret protection. ```text ┌──────────────────────────────────────────────────────┐ │ KEYCLASP VAULT │ ├──────────────────────────────────────────────────────┤ │ │ │ Random DEK ──► AES-256-GCM ──► SQLite (secret blobs) │ │ │ │ Passphrase ──► PBKDF2 (600K) ──► GCM-wrap DEK │ │ or machine identity ──► GCM-wrap DEK (weaker mode) │ │ │ │ Secrets stored as: │ │ { iv, authTag, ciphertext } │ │ │ └──────────────────────────────────────────────────────┘ ``` -------------------------------- ### Define Minimum Leak Value Length Source: https://github.com/andreacatalucci/keyclasp/blob/main/docs/solutions/integration-issues/run-guard-stream-scanning-cli-compatibility.md Sets the threshold for tracking injected values to avoid false positives from short, common strings. ```ts export const MIN_LEAK_VALUE_LENGTH = 8; if (value.length >= MIN_LEAK_VALUE_LENGTH && !seenLeakValues.has(value)) { leakValues.push(value); seenLeakValues.add(value); } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.