IntentGuard Docs

Two-factor authentication for every Solana transaction. Commit from your phone, verify on-chain.

Program ID: 4etWfDJNHhjYdv7fuGe236GDPguwUXVk9WhbEpQsPix7 — Live on Solana devnet

What is IntentGuard?

IntentGuard is a commit-reveal 2FA protocol for Solana. It separates transaction intent from execution across two devices, so a compromised browser can never change your transaction parameters.

Device Separation

Confirm intent on your phone, execute from your browser. Two different attack surfaces.

On-Chain Verification

Intent hash is verified by the Solana program itself. No trusted server, no centralized service.

Atomic Transactions

Verify instruction is prepended to your TX. If the hash doesn't match, the entire TX reverts.

Per-App Isolation

Each app gets its own intent PDA. Intents for Jupiter can't interfere with Raydium.

How It Works

  1. Commit — User confirms intent on their mobile app. The intent hash (SHA-256 of action + params) is committed on-chain via commit_intent.
  2. Verify — The dApp prepends a verify_intent instruction to the actual transaction. The program checks that the hash matches the committed intent.
  3. Execute or Revert — If hashes match, the TX proceeds atomically. If they don't match (attacker changed params), the TX reverts and funds are safe.

Install

TypeScript

npm install intentguard-sdk

Rust (CPI)

cargo add intentguard-cpi

Quick Example

import {
  computeIntentHash,
  createCommitIntentInstruction,
  createVerifyIntentInstruction,
} from 'intentguard-sdk';

// 1. Compute hash of what the user intends
const hash = computeIntentHash('swap', { amount: 1_000_000_000, mint: '...' });

// 2. Commit on-chain (from mobile app)
const commitIx = createCommitIntentInstruction(user, appId, hash, 300);

// 3. Verify + execute atomically (from browser)
const verifyIx = createVerifyIntentInstruction(user, appId, hash);
const tx = new Transaction().add(verifyIx).add(swapIx);

Key Concepts

ConceptDescription
Intent HashSHA-256 of action + params with length-prefix encoding. Deterministic and collision-resistant.
PDA SeedsIntent: [b"intent", user, app_id] — one active intent per user per app.
TTLTime-to-live: 30s–3600s (default 300s). Expired intents cannot be verified.
GuardConfigGlobal config PDA: [b"config"]. Stores admin, counters, pause state, fee settings.
Verify FeeOptional per-verify fee (0 by default). Collected in config PDA, withdrawable by admin.

Architecture

ComponentTechnologyPackage
On-chain programRust / Anchor 0.32programs/intent-guard/
TypeScript SDKNo Anchor dep, CJS+ESMintentguard-sdk
Rust CPI crateAnchor-compatibleintentguard-cpi
React widgetReact componentintentguard-sdk/react
Browser extensionChrome Manifest V3extension/
Mobile appReact Native / Expoapp/

Next: Quick Start Guide — integrate IntentGuard in 5 minutes.