<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Mason Wyatt</title>
    <description>The latest articles on DEV Community by Mason Wyatt (@masonwyatt23).</description>
    <link>https://dev.to/masonwyatt23</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3852915%2F3088df0d-11e4-4bc3-991e-470767ddacb7.png</url>
      <title>DEV Community: Mason Wyatt</title>
      <link>https://dev.to/masonwyatt23</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/masonwyatt23"/>
    <language>en</language>
    <item>
      <title>How to let AI code with your real API keys (without leaking them)</title>
      <dc:creator>Mason Wyatt</dc:creator>
      <pubDate>Tue, 31 Mar 2026 07:03:37 +0000</pubDate>
      <link>https://dev.to/masonwyatt23/how-to-let-ai-code-with-your-real-api-keys-without-leaking-them-fno</link>
      <guid>https://dev.to/masonwyatt23/how-to-let-ai-code-with-your-real-api-keys-without-leaking-them-fno</guid>
      <description>&lt;p&gt;You want Claude to integrate Stripe. You want Cursor to build your OpenAI pipeline. But your API keys are in .env, and AI can read them.&lt;/p&gt;

&lt;p&gt;GitGuardian found 39.6 million secrets leaked on GitHub in 2025. AI-assisted commits leak at 2x the baseline rate.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Phantom fixes this in one command.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The Problem
&lt;/h2&gt;

&lt;p&gt;When you use AI coding tools, your .env secrets enter the LLM context window:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Claude Code reads .env to understand your project&lt;/li&gt;
&lt;li&gt;Cursor indexes your workspace files&lt;/li&gt;
&lt;li&gt;Copilot suggests code containing your keys&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Those keys can leak via session logs, prompt injection, or training data.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Solution: Phantom Tokens
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;npx phantom-secrets init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;One command:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Reads your .env and detects real secrets&lt;/li&gt;
&lt;li&gt;Stores them in your OS keychain (encrypted)&lt;/li&gt;
&lt;li&gt;Rewrites .env with worthless phantom tokens&lt;/li&gt;
&lt;li&gt;Auto-configures Claude Code MCP server&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Your .env now looks like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight conf"&gt;&lt;code&gt;&lt;span class="n"&gt;OPENAI_API_KEY&lt;/span&gt;=&lt;span class="n"&gt;phm_a7f3b9e2c1d4f6a8&lt;/span&gt;...
&lt;span class="n"&gt;STRIPE_SECRET_KEY&lt;/span&gt;=&lt;span class="n"&gt;phm_2ccb5a1e9f8d7b3c&lt;/span&gt;...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These tokens are worthless. Safe to leak. Safe for AI to read.&lt;/p&gt;

&lt;h2&gt;
  
  
  How It Works
&lt;/h2&gt;

&lt;p&gt;When your code makes an API call, Phantom's local proxy intercepts it:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;AI writes code using phantom tokens&lt;/li&gt;
&lt;li&gt;Code calls &lt;code&gt;http://127.0.0.1:PORT/openai/v1/chat/completions&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Proxy replaces &lt;code&gt;phm_...&lt;/code&gt; with your real API key&lt;/li&gt;
&lt;li&gt;Forwards the request over TLS to the real API&lt;/li&gt;
&lt;li&gt;Your code works perfectly. AI never knew.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;phantom &lt;span class="nb"&gt;exec&lt;/span&gt; &lt;span class="nt"&gt;--&lt;/span&gt; node app.js
&lt;span class="c"&gt;# Proxy running on 127.0.0.1:54321&lt;/span&gt;
&lt;span class="c"&gt;# Real keys injected at network layer&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Works With Every AI Tool
&lt;/h2&gt;

&lt;p&gt;Phantom ships an MCP server with 9 tools. Works with Claude Code, Cursor, Windsurf, and Codex.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Claude Code:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;claude mcp add phantom-secrets-mcp &lt;span class="nt"&gt;--&lt;/span&gt; npx phantom-secrets-mcp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Cursor / Windsurf / Codex:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;"phantom"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"npx"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"args"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"phantom-secrets-mcp"&lt;/span&gt;&lt;span class="p"&gt;]}}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once configured, just tell your AI: "protect my API keys" — it handles everything.&lt;/p&gt;

&lt;h2&gt;
  
  
  Cloud Sync
&lt;/h2&gt;

&lt;p&gt;Sync your vault across machines with end-to-end encryption:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;phantom login        &lt;span class="c"&gt;# GitHub OAuth&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;phantom cloud push   &lt;span class="c"&gt;# Encrypted upload&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;phantom cloud pull   &lt;span class="c"&gt;# On another machine&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The server never sees your plaintext secrets. ChaCha20-Poly1305 encryption with keys that never leave your device.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try It
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;npx phantom-secrets init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Website: &lt;a href="https://phm.dev" rel="noopener noreferrer"&gt;phm.dev&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;GitHub: &lt;a href="https://github.com/ashlrai/phantom-secrets" rel="noopener noreferrer"&gt;ashlrai/phantom-secrets&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;MIT licensed, open source, free forever&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;New since launch: cloud sync, export/import, streaming proxy support, team vaults, and MCP tools for Claude Code, Cursor, Windsurf, and Codex.&lt;/p&gt;

</description>
      <category>security</category>
      <category>ai</category>
      <category>webdev</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
