Skip to content
MightyKey.ai
FeaturesPricingDocsBlog
Log inGet Started

Stay in the loop

Product updates, engineering deep dives, and early access announcements. No spam.

MightyKey.ai

The autonomous business operating system. Build, run, and scale — with words.

Product

  • Features
  • Pricing
  • Get Started

Resources

  • API Docs
  • Blog
  • Status

Legal

  • Privacy Policy
  • Terms of Service
  • DPA

© 2026 Mighty Maverick LLC. All rights reserved.

Back to Blog
Engineering

Security-First AI: How Phantom Tokens Protect Your Credentials

March 2, 2026·7 min read·MightyKey Team

Here's a problem that most AI platforms don't talk about: if you want an AI agent to act on your behalf, it needs your credentials. Your API keys, your OAuth tokens, your database passwords, your payment processor secrets. The agent can't deploy to AWS without your AWS keys. It can't send emails without your SMTP credentials. It can't manage your Stripe account without your Stripe secret key.

And here's the uncomfortable part: in most AI platforms, that means your credentials are passed directly to the language model as part of the prompt or context. The model sees your secrets. They flow through the model's inference pipeline, potentially get logged, and exist in memory alongside every other piece of context. This is a security architecture that no enterprise security team would approve — and for good reason.

MightyKey was built to solve this problem from day one with a system we call Phantom Tokens.

The Fundamental Problem: Models See Everything

Language models are, by design, general-purpose text processors. They take text in and produce text out. They don't distinguish between a paragraph of instructions and a database connection string. They don't have a concept of "sensitive" versus "non-sensitive" content. Everything in the context window is treated the same way — as tokens to be processed.

This creates several critical security risks:

  • Prompt injection attacks: A malicious input could trick the model into outputting credentials that were included in its context.
  • Logging exposure: Many AI platforms log prompts and completions for debugging and improvement. If credentials are in the prompt, they're in the logs.
  • Model provider exposure: When you use a third-party model (OpenAI, Anthropic, Google), your credentials flow through their infrastructure. Even with strong privacy policies, this increases your attack surface.
  • Context window leakage: In multi-turn conversations or multi-agent systems, credentials in one context can unintentionally surface in another.

The standard industry response is "use environment variables" or "don't put secrets in prompts." But if your agent needs to use a credential to take an action, it needs access to that credential somehow. The question is: where does that access happen?

How Most Platforms Handle This (Poorly)

Most AI agent platforms handle credentials in one of three ways, and all three are problematic:

Option 1: Direct Injection

The credential is included directly in the model's context. "Here's the Stripe API key: sk_live_abc123. Use it to create a charge." This is the most common approach and the most dangerous. The model sees the key, and everything downstream of the model has potential access to it.

Option 2: Environment Variables

The credential is stored in an environment variable that the agent's execution environment can access. Better than direct injection, but the model still needs to reference the credential by name, and the execution environment has blanket access to all configured secrets. There's no scoping, no per-action permissions, and no audit trail of which credential was used for which action.

Option 3: User Provides on Demand

The platform asks you to provide credentials at runtime. This is secure but defeats the purpose of automation. If you have to paste your API key every time the agent needs to make an API call, you haven't automated anything — you've just added a middleman.

MightyKey's Phantom Token System

Phantom Tokens take a fundamentally different approach. The core principle is simple: the language model never sees your real credentials. Ever.

Here's how it works:

Opaque References

When an agent needs to use a credential, it doesn't receive the actual key. Instead, it receives a phantom token — an opaque, meaningless reference string like ptk_7f3a9b2e. The phantom token has no cryptographic relationship to the real credential. It can't be reversed, decoded, or brute-forced. It's simply a pointer that the execution layer understands.

The model sees: "Use credential ptk_7f3a9b2e to authenticate with the Stripe API." It doesn't see: "Use sk_live_abc123..." The model plans the action using the phantom token, and the execution layer — which operates outside the model's context — swaps the phantom token for the real credential at the moment of execution.

The Credential Vault

All real credentials are stored in MightyKey's credential vault — an encrypted, access-controlled store that is architecturally isolated from the language model layer. The vault supports:

  • AES-256 encryption at rest with customer-managed keys available for enterprise plans
  • Hardware security module (HSM) integration for organizations that require FIPS 140-2 compliance
  • Automatic rotation for supported credential types
  • Version history so you can roll back to previous credentials if needed

The vault is the only component in the entire system that ever accesses real credentials. The model layer, the planning layer, and the logging layer all operate exclusively on phantom tokens.

Just-in-Time Injection

The real credential is injected at the last possible moment — the instant the API call is made. This is what we call just-in-time injection. The sequence is:

  1. The model plans an action: "Call Stripe API to create a charge, authenticate with ptk_7f3a9b2e"
  2. The execution engine receives the plan and validates it against the agent's permissions
  3. At the moment of HTTP request construction, the engine resolves ptk_7f3a9b2e to the real credential from the vault
  4. The real credential is injected into the request header
  5. The request is sent, the response is received, and the real credential is immediately discarded from memory
  6. The model receives the response with the phantom token reference — never the real credential

The real credential exists in memory for milliseconds, during the execution of a single API call. It never appears in logs, never flows through the model, and never persists in any cache or context window.

Per-Agent, Per-Project, Per-Run Scoping

Phantom Tokens aren't just opaque — they're scoped. You control exactly which agents can use which credentials, for which projects, and for what types of actions.

  • Per-agent scoping: Your deployment agent can access AWS credentials but not Stripe credentials. Your billing agent can access Stripe but not AWS.
  • Per-project scoping: Credentials for Project A are invisible to agents working on Project B, even if they're the same agent type.
  • Per-run scoping: A phantom token can be configured to be valid for a single execution run. Once the run completes, the phantom token is invalidated and can never be used again.
  • Action-type scoping: A credential can be restricted to specific API operations. Your Stripe phantom token might allow creating charges but not deleting customers.

This granular scoping means that even in the worst-case scenario — a compromised agent — the blast radius is contained to the specific permissions that agent was granted for that specific project and run.

SOC 2 Readiness and Compliance

MightyKey's security architecture was designed with enterprise compliance requirements in mind from the beginning — not bolted on after the fact.

  • SOC 2 Type II: The Phantom Token system, credential vault, and audit trail are all designed to meet SOC 2 trust service criteria for security, availability, and confidentiality.
  • Audit trail: Every credential access — including phantom token resolution — is logged with timestamps, agent identity, action context, and outcome. This immutable audit trail satisfies the monitoring and logging requirements of major compliance frameworks.
  • Data residency: Enterprise customers can configure credential vaults to reside in specific geographic regions, supporting GDPR and data sovereignty requirements.
  • Penetration testing: The Phantom Token system undergoes regular third-party penetration testing, with results available to enterprise customers under NDA.

Why Security-First Design Matters for Enterprise Adoption

The biggest barrier to enterprise AI adoption isn't capability — it's security review. Every enterprise has an information security team that needs to approve new tools before they can be used with production data and credentials. Most AI agent platforms fail this review because they can't answer a basic question: "How do you ensure our API keys don't end up in your model's training data?"

With Phantom Tokens, the answer is categorical: your real credentials never enter the model layer at any point in the pipeline. They're stored in an encrypted vault, injected at execution time by a system that is architecturally separate from the model, and discarded immediately after use. There is no path by which your credentials could appear in model training data, because the model never sees them.

This isn't a policy. It's an architecture. Policies can be violated. Architectures enforce constraints by design.

Security Is a Feature, Not a Tax

We built Phantom Tokens because we believe that AI agents will only become mainstream when businesses can trust them with real systems and real credentials. That trust must be earned through design, not demanded through terms of service.

Every decision in MightyKey's security architecture serves one goal: make it structurally impossible for AI models to access your secrets, while giving your agents the ability to act on your behalf with full authority. Phantom Tokens make this possible.

Want to learn more about how MightyKey keeps your credentials safe? Join the waitlist and explore our security architecture in depth.

Ready to transform your business?

MightyKey.ai is the autonomous business operating system that lets you build, run, and scale — with words. Start free today.

Get Started FreeExplore Features
← PreviousThe Cost of Building vs. The Cost of AI Agents