{"slug": "show-hn-interenv-hardware-enclave-secrets-in-pure-rust", "title": "Show HN: InterEnv – Hardware enclave secrets in pure Rust", "summary": "InterEnv, a pure-Rust tool that seals project secrets inside hardware security enclaves (Apple Secure Enclave, Windows TPM 2.0, Linux Secret Service) and decrypts them only in volatile process memory, has been released as free, open-source software (MIT) for the Interlayer Blockchain ecosystem. Version 1.0.1 is available on crates.io, npm, PyPI, Packagist, Go Modules, GitHub Releases, and GHCR, with the project claiming zero plaintext on disk and no cloud dependency, contrasting with tools like dotenvx and cloud secret managers.", "body_md": "**Eradicate Plaintext `.env` Files from Developer Disks Forever**\n\n*Ultra-fast, hardware-enclave secret isolation in pure Rust, built for Interlayer Blockchain and open for all.*\n\n**Built for macOS TouchID, Windows Hello / TPM 2.0, and Linux Secret Service.**\n\n  Secrets decrypt *only* in volatile process memory. Never touches disk. Never leaks in Git.\n\nInterEnv core engine, CLI, and multi-language client SDKs are officially published and immediately available across all major package ecosystems:\n\n| Ecosystem | Registry / Source | Install / Add Command | Direct Registry Links | \n|---|---|---|---|\n| **Rust** | **crates.io** | `cargo add interenv` •`cargo install interenv` |  [•](https://crates.io/crates/interenv) [crates.io/crates/interenv](https://crates.io/crates/interenv) | \n| **Node.js / TypeScript** | **npm** | `npm install interenv` •`npx interenv` |  [•](https://www.npmjs.com/package/interenv) [npmjs.com/package/interenv](https://www.npmjs.com/package/interenv) | \n| **Python / AI Agents** | **PyPI** | `pip install interenv` |  [•](https://pypi.org/project/interenv/) [pypi.org/project/interenv](https://pypi.org/project/interenv/1.0.1/) | \n| **PHP / Laravel / Symfony** | **Packagist** | `composer require bharathcoorg/interenv` |  [•](https://packagist.org/packages/bharathcoorg/interenv) [packagist.org/packages/bharathcoorg/interenv](https://packagist.org/packages/bharathcoorg/interenv) | \n| **Go Microservices** | **Go Modules** | `go get github.com/Bharathcoorg/interenv/go/interenv@v1.0.1` | [pkg.go.dev/github.com/Bharathcoorg/interenv/go](https://pkg.go.dev/github.com/Bharathcoorg/interenv/go) | \n| **Standalone Binaries** | **GitHub Releases** | Prebuilt binaries for Linux, macOS (Apple Silicon & Intel), Windows | [GitHub v1.0.1 Release Assets](https://github.com/Bharathcoorg/interenv/releases/tag/v1.0.1) | \n| **Container Image** | **GitHub Packages (GHCR)** | `docker pull ghcr.io/bharathcoorg/interenv:latest` | [GitHub Packages](https://github.com/Bharathcoorg/interenv/pkgs/container/interenv) | \n\nEvery software engineer, Web3 validator, and AI agent builder uses environment variables to store mission-critical credentials: `INTERLAYER_VALIDATOR_KEY`, `ETHEREUM_PRIVATE_KEY`, `OPENAI_API_KEY`, `AWS_SECRET_ACCESS_KEY`, database connection strings, and webhook signing secrets.\n\n- ❌ **The Catastrophic Problem** : Plaintext`.env` files get accidentally committed to public GitHub repositories daily. Malicious`npm` and`pip` packages scan developers' hard drives to exfiltrate plaintext secrets. In blockchain environments, a leaked`.env` means permanent loss of validator stake or treasury funds.\n- ❌ **The Flaw in Other Tools** :`dotenvx` encrypts secrets but stores the decryption key in another plaintext file (`.env.keys` ) on disk! Cloud secret managers (1Password, Doppler, Infisical) are cloud-locked, slow, and require expensive monthly subscriptions.\n- 🛡️ **The InterEnv Solution** : Engineered originally to safeguard high-stakes validator keys and autonomous agent secrets for the**Interlayer Blockchain** ecosystem, InterEnv seals your project secrets inside your**Host Hardware Security Enclave** (Apple Secure Enclave on macOS, TPM 2.0 / Windows Hello on Windows, Secret Service on Linux). Secrets are decrypted**strictly in volatile process memory** for the exact lifecycle of your command, and then erased with cryptographic zeroization (`zeroize` ).\n\n| Feature | Plaintext `.env` | `dotenvx` | 1Password / Doppler | **InterEnv (This Tool)** | \n|---|---|---|---|---|\n| **Storage Security** | 🔴 Zero (Plaintext on disk) | 🟡 Key file on disk ( `.env.keys` ) | 🟢 Cloud Vault | 🟢 **Hardware Enclave (TPM / TouchID)** | \n| **Disk Plaintext** | 🔴 Exposed | 🟡 Exposes decrypted files | 🟢 None | 🟢 **ZERO Plaintext on Disk** | \n| **Cloud Dependency** | 🟢 Offline | 🟢 Offline | 🔴 Required (Vendor Lock-in) | 🟢 **100% Offline & Local-First** | \n| **Pricing** | Free | Free | $19–$39/user/month | 🟢 **100% Free & Open Source (MIT)** | \n| **Git Pre-Commit Hook** | ❌ Manual | ❌ Manual | ❌ Complex setup | 🟢 **Built-in 1-Click Guard** | \n| **Secure Shredding** | ❌ None | ❌ None | ❌ None | 🟢 **DoD 5220.22-M Multi-Pass Wipe** | \n| **Runtime Speed** | Instant | Slow (Node.js) | Slow CLI (Cloud round-trips) | ⚡ **< 1ms (Pure Rust)** | \n\n```\ncargo install interenv\nnpm install -g interenv\n# Or run instantly without installation:\nnpx interenv --help\ngit clone https://github.com/Bharathcoorg/interenv.git\ncd interenv\ncargo build --release --features tpm\n```\n\nNote\n\n**Real TPM 2.0 Support**: Linux hardware TPM 2.0 support requires building with `--features tpm`.\nWithout this flag, Linux falls back to software-based KEK protection.\n\nSee [`INSTALL.md`](/Bharathcoorg/interenv/blob/main/INSTALL.md) for full installation guides across Cargo, NPM, PyPI, Go, PHP, and Docker.\n\nInside any project with an existing `.env` file:\n\n```\ninterenv lock\n```\n\n**What happens:**\n\n1. Generates an **XChaCha20-Poly1305** master project key and binds it to your**Hardware Enclave (TouchID / TPM / Windows Hello)** .\n2. Creates an encrypted, git-safe `.interenv.lock` file.\n3. **Cryptographically shreds and destroys** the plaintext`.env` from physical storage using DoD 5220.22-M 3-pass overwriting!\n\nExecute any tool, test runner, validator node, or web server:\n\n```\n# Interlayer Blockchain Node / Validator / Contract Deployment\ninterenv run interlayer-node --validator\n\n# Node / Next.js / Web3\ninterenv run npm run dev\n\n# Rust\ninterenv run cargo run\n\n# Python / AI Agents\ninterenv run python app.py\n\n# Docker / Go / Any Binary\ninterenv run docker compose up\n```\n\nSecrets are injected directly into child process memory. **Nothing ever touches disk.**\n\nNeed to add a new API key?\n\n```\ninterenv edit\n```\n\nOpens your default `$EDITOR` in a secure temporary buffer, updates keys, re-encrypts into `.interenv.lock`, and securely shreds the temp buffer.\n\n```\ninterenv hook install\n```\n\nInstalls an automated guard in `.git/hooks/pre-commit` that detects and immediately aborts any accidental staging or commit of `.env` files or hardcoded API keys.\n\nInterEnv provides native, zero-dependency SDKs across all major programming ecosystems. Secrets are injected directly into process memory without creating or touching plaintext `.env` files on disk.\n\n```\nnpm install interenv\njs\nimport { config } from \"interenv\";\nconfig(); // Injects into process.env in-memory\n\nconsole.log(process.env.OPENAI_API_KEY);\npip install interenv\npython\nimport interenv, os\ninterenv.load_env() # Injects into os.environ in-memory\n\nprint(os.getenv(\"OPENAI_API_KEY\"))\ngo get github.com/Bharathcoorg/interenv/go/interenv\npackage main\nimport (\n    \"fmt\"\n    \"os\"\n    \"github.com/Bharathcoorg/interenv/go/interenv\"\n)\n\nfunc main() {\n    interenv.Load() // Injects into os.Setenv in-memory\n    fmt.Println(os.Getenv(\"OPENAI_API_KEY\"))\n}\ncomposer require bharathcoorg/interenv\nphp\nuse InterEnv\\InterEnv;\nInterEnv::load(); // Injects into $_ENV, $_SERVER, and putenv()\n\necho getenv('OPENAI_API_KEY');\n```\n\n| Command | Description | \n|---|---|\n| `interenv lock [file]` | Encrypt `.env` into hardware enclave and securely shred the plaintext | \n| `interenv run <cmd...>` | Execute command with secrets injected into child process memory | \n| `interenv edit` | Open decrypted secrets in `$EDITOR` and re-seal automatically on save | \n| `interenv show` | Display sealed environment keys (masked by default, `--reveal` to unmask) | \n| `interenv status` | Inspect repository security status and hardware enclave binding | \n| `interenv doctor` | Audit filesystem CoW behavior, swap configuration, and enclave status | \n| `interenv hook install` | Install Git pre-commit hook to prevent secret leaks | \n| `interenv shred <file>` | Securely erase any file with 3-pass DoD overwrite | \n\n1. **Authenticated Encryption (AEAD)** : All environment payloads are encrypted with**XChaCha20-Poly1305** using 192-bit (24-byte) random nonces sourced from the OS RNG (`rand::rngs::OsRng` ).\n2. **Hardware Enclave Sealing** : Master encryption keys are stored directly in the host OS credential enclave:\n  - **macOS** : Apple Keychain backed by Apple Secure Enclave & TouchID (`macos-secure-enclave-v1` ).\n  - **Windows** : Windows Credential Manager protected by TPM 2.0 (`windows-ncrypt-tpm-v2` ) and DPAPI.\n  - **Linux** : TPM 2.0 hardware primary key binding (`linux-tpm2-v1` ) or FreeDesktop Secret Service.\n3. **Headless & CI/CD Support** : For automated CI runners and Docker containers, pass`--passphrase` or set`INTERENV_PASSPHRASE` to derive master keys via**Argon2id** (memory-hard password hashing with OWASP defaults: 19 MiB RAM, 2 iterations, parallelism = 1).\n4. **Memory Zeroization** : Plaintext secret buffers implement`zeroize::ZeroizeOnDrop` , ensuring keys and values are actively wiped from RAM upon release.\n\n| Vector | Guarantee | Implementation | \n|---|---|---|\n| **Disk Inspection** | Zero Plaintext | Master key sealed in OS hardware vault; `.env` shredded immediately. | \n| **Peer Process Sniffing** | Process Sandbox | Linux Seccomp BPF filter; macOS Sandbox profile; Windows Job Object. | \n| **Cross-Host Replay** | Machine Bound | Hardware KEK prevents decrypting lockfile on foreign machines without passphrase. | \n| **Accidental Commits** | Pre-Commit Abort | Automatic hook intercepts `git commit` staging`.env` or plain credentials. | \n| **Memory Dump on Drop** | Buffer Scrubber | Custom `Drop` scrubs key and value buffers in-place via raw slice zeroization. | \n\n| Feature | `interenv` | `dotenv-vault` | `sops` | `git-crypt` | \n|---|---|---|---|---|\n| **Hardware Enclave KEK** | 🟢 Native (TPM / SE) | ❌ Cloud Only | 🟡 Optional (KMS/PGP) | ❌ GPG Symmetric | \n| **Zero Plaintext on Disk** | 🟢 Strict Guarantee | ❌ Decrypts on disk | ❌ Decrypts to disk | ❌ In-place filter | \n| **Process Sandboxing** | 🟢 Seccomp / Sandbox | ❌ None | ❌ None | ❌ None | \n| **Cloud Dependency** | 🟢 100% Offline | 🔴 Cloud Vault | 🟡 Cloud KMS / PGP | 🟢 100% Offline | \n| **DoD Multi-Pass Shred** | 🟢 3-Pass + Platform | ❌ None | ❌ None | ❌ None | \n| **Language Runtime** | ⚡ Pure Rust (<1ms) | 🟡 Node.js CLI | 🟡 Go CLI | ⚡ C++ Filter | \n\n| Operating System | Enclave Key Storage | Process Sandbox Isolation | Disk Shredding Hook | \n|---|---|---|---|\n| **Windows 10 / 11 / Server** | TPM 2.0 (NCrypt) + DPAPI | Windows Job Object ( `KILL_ON_CLOSE` ) | `SetEndOfFile` +`FlushFileBuffers` + ADS Wipe | \n| **macOS (Apple Silicon / Intel)** | Apple Secure Enclave + Keychain | Apple Sandbox Profile ( `sandbox_init` ) | `F_FULLFSYNC` Cache Flush | \n| **Linux (Ubuntu / Fedora / Arch)** | TPM 2.0 ( `tss-esapi` ) / Secret Service | Seccomp BPF ( `PR_SET_NO_NEW_PRIVS` ) | `FALLOC_FL_ZERO_RANGE` + TRIM | \n\nNote\n\n**Linux TPM 2.0 Hardware Binding**: Real Linux TPM 2.0 hardware binding requires building with `--features tpm` (`cargo build --release --features tpm`).\nWithout this flag or on machines lacking `/dev/tpmrm0`, Linux automatically utilizes secure Freedesktop Secret Service / software KEK protection.\n\nWarning\n\n**Windows Job Object Isolation & `unsafe_mode` Feature**:\nWindows builds strictly enforce kernel Job Object isolation with `JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE` to ensure all spawned child trees terminate immediately when `interenv` exits.\nThe optional Cargo feature `unsafe_mode` allows `INTERENV_UNSAFE=1` to bypass Windows Job Object isolation for headless or virtualized CI runners that lack nested Job Object permissions.\n**Never compile or enable `unsafe_mode` in production environments.**\n\n- **Root / Ring-0 Access** : An attacker with root or kernel privileges on the local machine can dump arbitrary memory.\n- **Solid State Drive Wear-Leveling** : CoW filesystems (APFS, Btrfs, ZFS) and SSD flash translation layers (FTL) may wear-level blocks. InterEnv applies filesystem decommit calls (`fallocate` ,`BLKDISCARD` ,`SetFileValidData` ) and warns in`interenv doctor` .\n- **Hardware Failure / Reinstall** : If a machine-bound TPM is reset, locally sealed lockfiles cannot be retrieved without an Argon2id passphrase backup (`interenv lock --passphrase` ).\n\nInterEnv has undergone multi-phase adversarial security hardening:\n\n- **v0.1.0 Security Audit** : Argon2id OWASP parameters, XChaCha20-Poly1305 cipher migration,`Secrets` full memory zeroization, crash-safe temporary file guards.\n- **v0.2.0 Platform Hardening** : Windows Job Object containment, Linux Seccomp BPF privilege filter, macOS Sandbox profile, Windows NCrypt TPM 2.0 KEK, safe atomic path canonicalization (`safe_canonicalize` ).\n- **v1.0.0 Release Candidate Hardening** : macOS Secure Enclave hardware binding, Linux TPM 2.0 KEK feature flag, supply chain verification (`cargo-audit` ,`cargo-deny` ), fuzz testing targets, criterion benchmarks, and lockfile schema v3.0 migration.\n\nInterEnv release binaries are bit-for-bit reproducible:\n\n```\nbash scripts/verify-reproducible-build.sh\n```\n\nAll release binaries are built with `lto = \"fat\"`, `codegen-units = 1`, `panic = \"abort\"`, and path prefix remapping to ensure verifiable artifact provenance.\n\n**InterEnv** is a high-performance, local-first secret management engine written in Rust that permanently eradicates plaintext `.env` files from developer disks. It binds encrypted project secrets directly to host hardware security enclaves (Apple Secure Enclave on macOS, TPM 2.0 / DPAPI on Windows, and Linux Secret Service) and decrypts them exclusively into volatile process memory.\n\n**Interlayer Blockchain** is a sovereign multi-VM Layer 1 architecture designed for high-throughput consensus, decentralized validators, and autonomous on-chain AI agents. In high-stakes blockchain infrastructure, relying on external cloud secret managers introduces latency bottlenecks and vendor lock-in, while storing validator keys, relayer secrets, or deployer credentials in plaintext `.env` files risks catastrophic financial compromise. **InterEnv** was engineered to provide host silicon-level hardware isolation (Apple Secure Enclave and TPM 2.0) so that validator operators, node engineers, and autonomous Web3 agents can execute commands with zero plaintext exposure on physical disk.\n\n- **`dotenv`** : Leaves all API keys, database passwords, and private tokens unencrypted on physical storage, exposing them to rogue npm/pip supply-chain packages and accidental git commits.\n- **`dotenvx`** : Encrypts`.env` files but writes the decryption master key to an unencrypted`.env.keys` file on the exact same disk.\n- **`dotenv-vault` / `Doppler` / `Infisical`** : Require proprietary cloud vaults, persistent internet connections, and paid monthly subscriptions.\n- **`InterEnv`** : 100% offline, local-first, free & open source (MIT), binds keys to host hardware chips (TPM 2.0 / TouchID), and cryptographically destroys plaintext files using 3-pass DoD 5220.22-M overwrites.\n\nAI coding agents execute your application via `interenv run <command>` or import the language SDK (`interenv.config()` in Node.js, `interenv.load_env()` in Python, `interenv.Load()` in Go, `InterEnv::load()` in PHP). Secrets are injected directly into the child process memory space via standard environment variables without ever creating a plaintext `.env` file on disk. This prevents LLMs, indexing bots, or repository search tools from reading or exfiltrating raw credentials.\n\nWhen sealing a project for multi-developer or continuous integration workflows, run `interenv lock --passphrase`. In your automated CI runner (GitHub Actions, GitLab CI, Docker, Kubernetes), provide the secret passphrase through the `INTERENV_PASSPHRASE` environment variable along with `INTERENV_CI=1`. InterEnv derives the master key via OWASP-compliant memory-hard **Argon2id** (19 MiB RAM, 2 iterations, 1 parallelism) without interactive terminal prompts.\n\n**InterEnv** was engineered to safeguard sensitive validator credentials, blockchain deployment keys, and autonomous AI agents for the **Interlayer Blockchain** sovereign multi-VM ecosystem, and is open source for developers worldwide:\n\n- ⚡ [**`intermcp`**](https://github.com/Bharathcoorg/intermcp) — Ultra-fast, safe Model Context Protocol (MCP) engine and multiplexing hub in pure Rust.\n- 🛡️ [**`interenv`**](https://github.com/Bharathcoorg/interenv) — Hardware-enclave protected secrets for terminal, AI agents & git.\n- ⛓️ [Interlayer Blockchain](https://interlayer.one)\n\nMIT License. Copyright (c) 2026 Bharath B R (Interlayer). Contributions welcome! Please open an issue or PR.", "url": "https://wpnews.pro/news/show-hn-interenv-hardware-enclave-secrets-in-pure-rust", "canonical_source": "https://github.com/Bharathcoorg/interenv", "published_at": "2026-09-09 06:59:05+00:00", "updated_at": "2026-09-09 07:30:05.026430+00:00", "lang": "en", "topics": ["developer-tools", "ai-tools"], "entities": ["InterEnv", "Interlayer Blockchain", "Apple Secure Enclave", "Windows TPM 2.0", "Linux Secret Service", "dotenvx", "1Password", "Doppler"], "alternates": {"html": "https://wpnews.pro/news/show-hn-interenv-hardware-enclave-secrets-in-pure-rust", "markdown": "https://wpnews.pro/news/show-hn-interenv-hardware-enclave-secrets-in-pure-rust.md", "text": "https://wpnews.pro/news/show-hn-interenv-hardware-enclave-secrets-in-pure-rust.txt", "jsonld": "https://wpnews.pro/news/show-hn-interenv-hardware-enclave-secrets-in-pure-rust.jsonld"}}