New:Microsoft Teams Notifications Are Now Available in Socket.Learn more
Get Started

@foreseal/demo

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@foreseal/demo

Watch Foreseal verify-before-act: an AI agent ACTs on genuine bytes and REFUSEs four tamper/forgery attacks — runs locally in ~1s, no real USDC, no signup, no API key.

Source
npmnpm
Version
0.1.0
Version published
Weekly downloads
13
225%
Maintainers
1
Weekly downloads
 
Created
Source

@foreseal/demo

Watch an AI agent refuse tampered data — in one command, in about a second.

npx @foreseal/demo

No install, no signup, no API key, no real USDC. It spins up the whole loop locally — a data seller fronted by the Foreseal Gate, a fake x402 facilitator standing in for settlement, and a buyer running Foreseal Kit's verify-before-act check — then plays six scenarios past the agent: two genuine payloads and four attacks. You watch it decide ACT ✅ or REFUSE ❌ on each.

A  genuine receipt, trusted attester ............ ACT ✅
B  one tampered byte (64000 → 99999) ............ REFUSE ❌  hash mismatch
C  forged receipt (attacker self-signs) ......... REFUSE ❌  signer is not the attester we trust
D  missing / empty receipt ...................... REFUSE ❌  fail-closed, no crash
E  rewritten domain (chainId 1) ................. REFUSE ❌  consensus-domain pin
F  binary (non-UTF-8) payload ................... ACT ✅   bytes survive verbatim, hash matches

What this proves

An agent that spends money must prove the bytes it received are exactly what a named publisher attested, before it acts on them. Foreseal does that with an EIP-712 PayloadAttestation: the buyer recomputes the keccak256 hash of the bytes it actually received and recovers the signer — so it can prove who produced the bytes and that nothing changed in transit. If the hash doesn't match, or the signer isn't the attester you trust, or the signing domain was forked — it refuses.

Two sides of one receipt. The Gate (bundled into this demo; a standalone package is not yet released) stamps a receipt over the exact bytes you paid for. The Kit (@payperbyte/sdk, on npm) lets the agent verify that receipt before it acts on a single byte. This demo runs both sides locally.

Use it for real

This package is a demonstration — it settles no real money. To wire the tamper-evidence check into your own agent, install the Kit:

npm i @payperbyte/sdk
import { verifyPayload, HashMismatchError } from "@payperbyte/sdk";

// `expectedHash` is the publisher's on-chain attested keccak256 hash —
// from the DataStreamed/BroadcastStreamed event or a gateway response.
try {
  verifyPayload(receivedBytes, expectedHash); // recomputes keccak256; throws on drift
  // safe to act — the bytes match what the publisher attested on-chain
} catch (e) {
  if (e instanceof HashMismatchError) {
    // do NOT act — the bytes you received are not what was attested
  } else throw e;
}

verifyPayload is the tamper-evidence leg: it proves your bytes match the publisher's on-chain EIP-712 attestation (which itself certifies the signer). The full hash and signer-identity decision — the one you watched ACT/REFUSE above — is what the bundled Gate runs end-to-end in the demo.

Rails, stated honestly: x402 USDC payments settle on Base mainnet; the EIP-712 attestation domain is anchored on Arbitrum (the Kit ships ARBITRUM_SEPOLIA / ARBITRUM_ONE; mainnet anchoring is audit-gated).

There's also a 15-tool MCP server you can drop into any agent stack:

npx -y byte-mcp-server

Honest scope

This proves authenticity — provenance, tamper-evidence, and signer identity. It does not score whether the data is correct; quality scoring is a separate layer on the roadmap, and we won't pretend otherwise. The project is dogfooded end-to-end; external adoption is the open question we're working on.

MIT licensed.

Keywords

x402

FAQs

Package last updated on 18 Jun 2026

Related posts