Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

Add agent-bouncer x402 reputation gate; harden IRL presence; tests

nirholasd8191286c752
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 48402cb88..ff03315a4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -13,8 +13,10 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr
- **Tutorial · Read an agent's reputation** (`/tutorials/agent-reputation`) — Read any registered agent's ERC-8004 reputation from the UI, the REST API, the MCP tool, the SDK, or the contract.
- **Chat embeds now load on any site** — The embed editor's Chat mode produced a snippet that worked in the live preview but stayed blank once pasted onto an external site. The agent chat page was served with a frame-ancestors policy that only allowed three.ws itself, so every other domain's browser blocked the iframe. Chat embeds now ship the same open framing policy as the avatar embed modes, and the embedded chat page can use the microphone for voice input. Paste the snippet anywhere and it just works. (`/embed`) `[fix]`
- **Embedded avatars never show a blank frame** — A walking-avatar embed whose avatar can't load — a deleted or mistyped ID, a private avatar a public page can't read, or a dropped connection — now shows the default avatar walking with a short 'couldn't load that avatar — showing the default' note, instead of leaving an empty, all-dark frame on the host page. The embed always renders a body. The embed editor now flags an avatar ID it can't find with a clear 'not found' marker and tells you to pick a public or unlisted avatar, rather than silently keeping a dead ID. And owners can now load their own private avatar's 3D file when signed in, which previously failed even for the avatar's owner. (`/embed`) `[fix]`
+- **Fix the location-proof behind IRL 'agents near me'** — The step that proves you're physically where you say you are — so the 'agents near me' view only reveals pins around your real location, never somewhere you point at from afar — could fail and return an error on every attempt. That same failure meant the privacy check it powers wasn't being enforced. It now works reliably with or without a configured signing secret: locally and in preview it stays open so testing isn't blocked, and in production each nearby read is bound to a genuine, freshly-signed location fix that expires in a few minutes and can't be forged or replayed from a distance. Nothing changes in how you use IRL — your location is still read only to mint the short-lived proof, never stored or logged. (`/irl`) `[fix, security]`
- **Forge polish: engine picker, honest wording, keyboard tabs, full-length remix** — A round of Forge fixes. The engine picker now wraps all eight lanes — NVIDIA, Hunyuan3D, Fast, Meshy, Tripo, Rodin, Stability, Replicate — cleanly inside its selector instead of spilling past the panel edge, so every engine stays readable at a glance. The build estimate is honest to the tab you're on: on Describe it it reads 'renders a preview image, then builds 3D' (it never asked you for an image), on From photos 'builds from your reference photos', and a credit figure now only appears on metered lanes so a free build never reads 'Free · ~N credits'. The Describe it / From photos / From a sketch tabs are now fully keyboard-navigable with the arrow keys and announce correctly to screen readers. And opening a remix link keeps your whole prompt — long prompts are no longer clipped to 300 characters. (`/forge`) `[fix, improvement]`
- **Free Forge on the IBM demo stays reliable while the GPU warms up** — The free, no-wallet 'forge a 3D model' widget on the IBM partnership page no longer shows a false 'briefly unreachable' error when the free GPU is cold. It used to fire up to six generation requests behind a single click, which spent the free lane's hourly limit about six times faster — a few tries could lock you out — and a slow cold start would surface as an error even though the model was still on its way. Now it makes one request per click (the server already falls back across NVIDIA, TRELLIS, and Hugging Face on its own), shows honest progress while a cold start warms up (which can take up to a minute), and, if the free lane is genuinely at its hourly limit, says exactly that and when to try again — pointing you to the instant paid Forge above. A model reliably comes back to orbit and download. (`/ibm/x402-demo`) `[fix, improvement]`
+- **Hide the controls in IRL for an unobstructed AR view** — On a phone, the IRL controls (the top bar, the bottom row of buttons, the room badges, the compass and on-screen hints) could cover so much of the screen that you couldn't see the camera view or move your avatar past them. There's now a one-tap hide button on the right edge: tap it and all of that chrome slides away, leaving just the live AR scene — the on-screen joystick and drag-to-look still work, so you can walk around and look about with nothing in the way. Tap the same button (it stays put and glows green) to bring everything back; on a keyboard, Esc restores it too. (`/irl`) `[feature, improvement]`
- **IBM x402 demo works when embedded in IBM's CMS** — The five live demos on the IBM partnership page — Forge, x402 micropayments, the 3D agent, Play, and IRL — now run correctly when the page is embedded inside IBM's content platform, not only when opened directly. IBM serves the embed from a Seismic gateway address, and the browser was silently blocking it: the free 3D generator reported 'briefly unreachable' and the wallet payment couldn't reach the Solana network, because three.ws didn't yet recognize that gateway as an allowed origin. three.ws now trusts IBM's Seismic-served origins for both data calls and embedding, so the free Forge, the on-chain payment flow, and the inline Play/IRL worlds all work on the embedded page. (`/ibm/x402-demo`) `[fix, infra]`
- **Live webinar stage on the IBM x402 demo page** — The IBM × three.ws demo page now opens with a webinar stage: a live countdown to the session, with one-click Add to Calendar (Google + .ics). When the talk goes live, the same stage becomes the player — a pre-recorded video plays synced to wall-clock like a broadcast premiere (everyone sees the same moment, latecomers join in progress), or a live feed streams in its place. The recording stays on the page afterward, and the x402 demos sit right below so you can watch and try them on one screen. (`/ibm/x402-demo`) `[feature]`
- **New doc: every NVIDIA model three.ws runs for free** — A new docs page maps the entire free NVIDIA inference layer the platform runs on — one free key unlocks all of it. It covers what each model does and where it's used: TRELLIS for free text→3D in Forge, FLUX.1-schnell for text→image, the Llama 3.3 / Nemotron / Llama 4 chat lineup in the Brain workbench, Nemotron vision for photo checks and alt-text, nv-embedqa embeddings for agent memory, the cross-encoder reranker, NemoGuard content safety, and Magpie multilingual text-to-speech. Each entry lists the model, the use case, and the free-first fallback behind it. (`/docs/nvidia-models`) `[docs]`
diff --git a/api/_lib/a2a/reputation-gate.js b/api/_lib/a2a/reputation-gate.js
index e7dcaeb89..f894572f5 100644
--- a/api/_lib/a2a/reputation-gate.js
+++ b/api/_lib/a2a/reputation-gate.js
@@ -3,20 +3,21 @@
//
// Trust is the missing half of autonomous payments: budget caps stop an agent
// overspending, but they don't stop it paying a scammer. ERC-8004's Reputation
-// Registry (getReputation(agentId) → (totalScore, count)) is the standard
-// trust signal; this module reads it server-side and enforces a minimum average
-// score and/or minimum review count before a mandate-authorized payment is
-// allowed to proceed.
+// Registry is the standard trust signal; this module reads it server-side and
+// enforces a minimum average score and/or minimum review count before a
+// mandate-authorized payment is allowed to proceed. It is the throwing wrapper
+// around the shared open-network bouncer (../trust/agent-bouncer.js) — same
+// canonical, correctly-decoded read the public /api/x402/agent-bouncer endpoint
+// uses, so the autonomous-payment door and the public door can never drift on
+// who is trustworthy.
//
-// The on-chain read is injectable (`read` option) so tests run without RPC and
-// callers can swap in an indexer. When reputation gating is requested but no
-// RPC URL is configured AND no threshold is set, the gate is a no-op; if a
-// threshold IS set without a usable reader, it fails closed.
+// The read goes through the curated multi-RPC failover in api/_lib/evm/rpc.js
+// (honoring A2A_REPUTATION_RPC_URL as the pinned primary when set), so the gate
+// works out of the box without per-deploy RPC config. The reader is injectable
+// (`read` option) so tests run without RPC. The gate is a no-op when no
+// threshold is set; when a threshold IS set and the read fails, it fails closed.
-import { Contract, JsonRpcProvider } from 'ethers';
-
-import { env } from '../env.js';
-import { REGISTRY_DEPLOYMENTS, REPUTATION_REGISTRY_ABI } from '../../../src/erc8004/abi.js';
+import { readAgentReputation } from '../trust/agent-bouncer.js';
export class ReputationError extends Error {
constructor(code, message, status = 403) {
@@ -28,30 +29,21 @@ export class ReputationError extends Error {
}
/**
- * Read aggregated ERC-8004 reputation for an agent.
+ * Read aggregated ERC-8004 reputation for an agent. Delegates to the shared
+ * bouncer read, which decodes getReputation's (int256 avgX100, uint256 count)
+ * correctly — average = avgX100 / 100, sign-preserving. (The earlier local read
+ * here divided the already-averaged value by count again, understating every
+ * score by a factor of count and mis-decoding negatives as huge positives.)
+ *
* @param {object} opts
* @param {number|bigint|string} opts.agentId
* @param {number} opts.chainId
- * @param {string} [opts.rpcUrl] Defaults to env.A2A_REPUTATION_RPC_URL.
- * @returns {Promise<{ average: number, count: number, total: number }>}
+ * @param {string} [opts.rpcUrl] Pinned first; otherwise env + curated public failover.
+ * @returns {Promise<{ average: number, count: number }>}
*/
export async function readReputationOnchain({ agentId, chainId, rpcUrl }) {
- const url = rpcUrl || env.A2A_REPUTATION_RPC_URL;
- if (!url) throw new ReputationError('reputation_rpc_unconfigured', 'no RPC URL for reputation reads', 500);
- const deployment = REGISTRY_DEPLOYMENTS[chainId];
- if (!deployment?.reputationRegistry) {
- throw new ReputationError(
- 'reputation_registry_missing',
- `no Reputation Registry deployed on chain ${chainId}`,
- 500,
- );
- }
- const provider = new JsonRpcProvider(url);
- const contract = new Contract(deployment.reputationRegistry, REPUTATION_REGISTRY_ABI, provider);
- const [totalScore, count] = await contract.getReputation(agentId);
- const n = Number(count);
- const t = Number(totalScore);
- return { total: t, count: n, average: n === 0 ? 0 : t / n };
+ const rep = await readAgentReputation({ agentId, chainId, rpcUrl });
+ return { average: rep.average, count: rep.count };
}
/**
diff --git a/api/_lib/crypto.js b/api/_lib/crypto.js
index 71fef8796..2209298af 100644
--- a/api/_lib/crypto.js
+++ b/api/_lib/crypto.js
@@ -59,9 +59,17 @@ export function constantTimeEquals(a, b) {
}
export async function hmacSha256(secret, message) {
+ const keyBytes = new TextEncoder().encode(secret == null ? '' : String(secret));
+ // Web Crypto rejects a zero-length HMAC key with an opaque
+ // `DataError: Zero-length key is not supported`, thrown deep inside importKey.
+ // Surface the real cause — a signing secret that is unset/empty — so the failure
+ // is diagnosable from one log line instead of a cryptic crypto stack trace.
+ if (keyBytes.length === 0) {
+ throw new Error('hmacSha256: empty signing key — a required secret is unset (check environment configuration)');
+ }
const key = await subtle.importKey(
'raw',
- new TextEncoder().encode(secret),
+ keyBytes,
{ name: 'HMAC', hash: 'SHA-256' },
false,
['sign'],
diff --git a/api/_lib/irl-presence.js b/api/_lib/irl-presence.js
index 83a81b5bb..56fa7e37b 100644
--- a/api/_lib/irl-presence.js
+++ b/api/_lib/irl-presence.js
@@ -36,16 +36,31 @@ export const FIX_CELL_PRECISION = 7; // ~153 m geocell, the client's re-mint t
const SECRET_ENV = 'IRL_FIX_SECRET';
-// Whether proof-of-presence is enforced. Unset secret ⇒ dev/preview bypass: the
-// read works unchanged so local/sandbox testing isn't gated. Production MUST set
-// IRL_FIX_SECRET. Callers log the active mode once at cold start.
+// A stable, deliberately non-secret signing key used ONLY when IRL_FIX_SECRET is
+// unset or too weak (local dev / preview). It keeps the mint + verify pair fully
+// functional and self-consistent without a configured secret — a token minted in
+// this mode verifies in this mode — so the endpoint never crashes and local testing
+// isn't blocked. It is NOT a security boundary: `fixEnforced()` stays false in this
+// mode, so the nearby read does not gate on the token at all. Production sets a real
+// secret (≥16 chars), which both flips enforcement on AND replaces this key, so a
+// token minted in bypass mode is rejected (forged) the moment enforcement is live.
+const DEV_FALLBACK_SECRET = 'irl-fix:dev+preview-unsecured-key:not-for-production';
+
+// Whether proof-of-presence is enforced. A strong configured secret (≥16 chars) ⇒
+// enforced. Unset or too-weak secret ⇒ dev/preview bypass: the read works unchanged
+// so local/sandbox testing isn't gated. Production MUST set IRL_FIX_SECRET. Callers
+// log the active mode once at cold start.
export function fixEnforced() {
const s = process.env[SECRET_ENV];
return typeof s === 'string' && s.length >= 16;
}
-function secret() {
- return process.env[SECRET_ENV] || '';
+// The key the HMAC is actually computed with. Mirrors fixEnforced(): the configured
+// secret when it's strong enough, otherwise the stable dev fallback. NEVER returns an
+// empty string — a zero-length HMAC key throws "Zero-length key is not supported"
+// inside Web Crypto, which is exactly the production crash this guards against.
+function effectiveSecret() {
+ return fixEnforced() ? process.env[SECRET_ENV] : DEV_FALLBACK_SECRET;
}
function b64urlEncode(str) {
@@ -87,7 +102,7 @@ export async function mintFixToken(lat, lng, nowSec = Math.floor(Date.now() / 10
iat: nowSec,
};
const json = JSON.stringify(payload);
- const sig = await hmacSha256(secret(), json);
+ const sig = await hmacSha256(effectiveSecret(), json);
return {
token: `${b64urlEncode(json)}.${sig}`,
expires_in: FIX_TTL_SEC,
@@ -115,7 +130,7 @@ export async function verifyFixToken(token, claimLat, claimLng, nowSec = Math.fl
// Recompute the signature over the EXACT decoded JSON and compare in constant
// time — a forged or tampered payload won't reproduce the HMAC.
- const expected = await hmacSha256(secret(), json);
+ const expected = await hmacSha256(effectiveSecret(), json);
if (!constantTimeEquals(sig, expected)) return { ok: false, reason: 'forged' };
let payload;
diff --git a/api/_lib/trust/agent-bouncer.js b/api/_lib/trust/agent-bouncer.js
new file mode 100644
index 000000000..cd4088cd1
--- /dev/null
+++ b/api/_lib/trust/agent-bouncer.js
@@ -0,0 +1,265 @@
+// Agent Bouncer — the Pole Club's door bouncer, generalized to the open agent
+// internet.
+//
+// The Club bouncer (api/_lib/club/cover-pass.js) answers "do I let this wallet
+// in?" by reading a Postgres table only three.ws can see: club_bans for
+// exclusion, club_tips for a door tier (newcomer / regular / vip). That trust
+// is real but local — a VIP at our door is a stranger at every other venue on
+// the internet.
+//
+// This module answers the SAME question from the open, portable, on-chain
+// signal instead: ERC-8004's Reputation Registry. The "ban list" is the chain's
+// own negative scores; the "tier" is earned across every platform that reads
+// and writes the same registries at the same address on 12 chains. A verdict
+// here travels with the agent everywhere.
+//
+// Club (local) Agent Bouncer (open)
+// ───────────────────────────── ─────────────────────────────────────────
+// identity paying wallet ERC-8004 agent NFT (Identity Registry)
+// history club_tips count append-only feedback count
+// tier newcomer/regular/vip newcomer/regular/trusted/vip (avg+count+stake)
+// exclusion club_bans negative on-chain average (+ optional denylist)
+//
+// The on-chain read is injectable (`read` option) so callers can swap an
+// indexer and tests run without RPC. `vetAgent` never throws on a low score —
+// it returns `admitted:false` with reasons (like the Club turning a wallet away
+// after the cover already settled). It throws only on bad input or infra error.
+
+import { Contract } from 'ethers';
+
+import { env } from '../env.js';
+import { evmFallbackProvider } from '../evm/rpc.js';
+import { CHAIN_BY_ID } from '../erc8004-chains.js';
+import {
+ REGISTRY_DEPLOYMENTS,
+ REPUTATION_REGISTRY_ABI,
+ IDENTITY_REGISTRY_ABI,
+ agentRegistryId,
+} from '../../../src/erc8004/abi.js';
+
+export const DEFAULT_CHAIN_ID = 8453; // Base
+
+// Tier thresholds. Deliberately scale-agnostic on the score itself (ERC-8004
+// scores are int8 in [-100,100], but star UIs submit 1-5) — tiers key off the
+// SIGN of the average, the review COUNT, and whether anyone has put ETH stake
+// (skin in the game) behind a vouch. Admission thresholds that DO compare the
+// average against a number are caller-supplied policy, never baked in here.
+export const TRUSTED_MIN_COUNT = 5;
+export const VIP_MIN_COUNT = 10;
+
+/**
+ * Door tier from open-network reputation. Mirrors club/cover-pass.tierFor but
+ * reads the chain instead of club_tips. Never returns 'banned' — exclusion is
+ * decided by vetAgent (denylist / negative average) which overrides the tier.
+ *
+ * @param {{ average: number, count: number, totalStakeWei?: string|bigint }} rep
+ * @returns {'newcomer'|'regular'|'trusted'|'vip'}
+ */
+export function tierForReputation({ average, count, totalStakeWei = '0' }) {
+ const n = Number(count) || 0;
+ if (n <= 0) return 'newcomer'; // cold start — no history yet
+ let stake = 0n;
+ try {
+ stake = BigInt(totalStakeWei || '0');
+ } catch {
+ stake = 0n;
+ }
+ if (average < 0) return 'regular'; // has history but net-negative; banNegative handles exclusion
+ if (n >= VIP_MIN_COUNT && stake > 0n) return 'vip';
+ if (n >= TRUSTED_MIN_COUNT) return 'trusted';
+ return 'regular';
+}
+
+function normalizeKey(v) {
+ return String(v || '').trim().toLowerCase();
+}
+
+/**
+ * Read aggregated ERC-8004 reputation for an agent directly from the canonical
+ * Reputation Registry. Resolves an agentId from a wallet via the Identity
+ * Registry when only a wallet is given. A wallet with no registered agent is
+ * NOT an error — it's a newcomer (registered:false, zeroed aggregate).
+ *
+ * getReputation returns (int256 avgX100, uint256 count): the average ALREADY
+ * multiplied by 100. We divide by 100 — never by count (that is the bug this
+ * module exists to avoid) — and Number() preserves the sign so a net-negative
+ * agent reads as negative, not as a huge unsigned value.
+ *
+ * @param {object} opts
+ * @param {number|bigint|string} [opts.agentId]
+ * @param {string} [opts.wallet]
+ * @param {number} [opts.chainId=8453]
+ * @param {string} [opts.rpcUrl] Pinned first; otherwise env + curated public failover.
+ * @returns {Promise<{agentId:string|null, wallet:string|null, average:number, count:number, totalStakeWei:string, registered:boolean}>}
+ */
+export async function readAgentReputation({ agentId, wallet, chainId = DEFAULT_CHAIN_ID, rpcUrl }) {
+ const deployment = REGISTRY_DEPLOYMENTS[chainId];
+ if (!deployment?.reputationRegistry) {
+ throw new Error(`no ERC-8004 Reputation Registry deployed on chain ${chainId}`);
+ }
+ const provider = await evmFallbackProvider(chainId, {
+ primaryUrl: rpcUrl || env.A2A_REPUTATION_RPC_URL || null,
+ });
+
+ let resolvedAgentId =
+ agentId !== undefined && agentId !== null && String(agentId) !== '' ? BigInt(agentId) : null;
+ const resolvedWallet = wallet ? String(wallet) : null;
+
+ if (resolvedAgentId === null) {
+ if (!resolvedWallet) throw new Error('agentId or wallet is required');
+ const identity = new Contract(deployment.identityRegistry, IDENTITY_REGISTRY_ABI, provider);
+ const bal = await identity.balanceOf(resolvedWallet);
+ if (bal === 0n) {
+ // No ERC-8004 identity for this wallet anywhere on this chain. Honest
+ // answer: an unknown newcomer, not a failure.
+ return {
+ agentId: null,
+ wallet: resolvedWallet,
+ average: 0,
+ count: 0,
+ totalStakeWei: '0',
+ registered: false,
+ };
+ }
+ resolvedAgentId = BigInt(await identity.tokenOfOwnerByIndex(resolvedWallet, 0n));
+ }
+
+ const reputation = new Contract(deployment.reputationRegistry, REPUTATION_REGISTRY_ABI, provider);
+ const [agg, totalStake] = await Promise.all([
+ reputation.getReputation(resolvedAgentId),
+ reputation.getTotalStake(resolvedAgentId),
+ ]);
+ const [avgX100, count] = agg;
+ const n = Number(count);
+
+ return {
+ agentId: resolvedAgentId.toString(),
+ wallet: resolvedWallet,
+ average: n === 0 ? 0 : Number(avgX100) / 100,
+ count: n,
+ totalStakeWei: totalStake.toString(),
+ registered: true,
+ };
+}
+
+/**
+ * Run the open-network bouncer over an agent and return an admission verdict.
+ * Mirrors the Club door's contract — { admitted, banned, tier, reason } — but
+ * the inputs come from 12 chains, not our private table.
+ *
+ * @param {object} opts
+ * @param {number|bigint|string} [opts.agentId]
+ * @param {string} [opts.wallet]
+ * @param {number} [opts.chainId=8453]
+ * @param {object} [opts.policy] Admission policy (all optional).
+ * @param {number} [opts.policy.minAverage=0] Required average score (caller's scale).
+ * @param {number} [opts.policy.minCount=0] Required number of on-chain reviews.
+ * @param {bigint|string|number} [opts.policy.minStakeWei=0] Required total ETH stake (wei).
+ * @param {boolean} [opts.policy.allowNewcomers=true] Admit agents with zero history.
+ * @param {boolean} [opts.policy.banNegative=true] Refuse net-negative agents.
+ * @param {Array<string>} [opts.denylist=[]] Extra wallets/agentIds to refuse outright.
+ * @param {(o:object)=>Promise<object>} [opts.read] Injectable reputation reader.
+ * @returns {Promise<object>} verdict
+ */
+export async function vetAgent({
+ agentId,
+ wallet,
+ chainId = DEFAULT_CHAIN_ID,
+ policy = {},
+ denylist = [],
+ read = readAgentReputation,
+}) {
+ const {
+ minAverage = 0,
+ minCount = 0,
+ minStakeWei = 0,
+ allowNewcomers = true,
+ banNegative = true,
+ } = policy;
+
+ const rep = await read({ agentId, wallet, chainId });
+ const reasons = [];
+ let banned = false;
+
+ const denyKeys = new Set((denylist || []).map(normalizeKey).filter(Boolean));
+ if (rep.wallet && denyKeys.has(normalizeKey(rep.wallet))) {
+ banned = true;
+ reasons.push('wallet is on the denylist');
+ }
+ if (rep.agentId && denyKeys.has(normalizeKey(rep.agentId))) {
+ banned = true;
+ reasons.push('agentId is on the denylist');
+ }
+ if (banNegative && rep.average < 0) {
+ banned = true;
+ reasons.push(`negative on-chain reputation (average ${rep.average.toFixed(2)})`);
+ }
+
+ if (!allowNewcomers && rep.count === 0) {
+ reasons.push('no on-chain reviews yet — newcomers not admitted by this policy');
+ }
+ if (minCount > 0 && rep.count < minCount) {
+ reasons.push(`only ${rep.count} review(s) on-chain; ${minCount} required`);
+ }
+ if (minAverage > 0 && rep.average < minAverage) {
+ reasons.push(`average ${rep.average.toFixed(2)} is below the required ${minAverage}`);
+ }
+ let stake = 0n;
+ try {
+ stake = BigInt(rep.totalStakeWei || '0');
+ } catch {
+ stake = 0n;
+ }
+ const minStake = BigInt(String(minStakeWei || 0));
+ if (minStake > 0n && stake < minStake) {
+ reasons.push(`staked ${stake} wei; ${minStake} wei required`);
+ }
+
+ const admitted = !banned && reasons.length === 0;
+ const tier = banned ? 'banned' : tierForReputation(rep);
+
+ return {
+ admitted,
+ banned,
+ tier,
+ reason: reasons[0] || null,
+ reasons,
+ registered: rep.registered !== false,
+ agentId: rep.agentId,
+ wallet: rep.wallet,
+ chainId,
+ registry: deploymentRegistryId(chainId),
+ reputation: {
+ average: rep.average,
+ count: rep.count,
+ totalStakeWei: rep.totalStakeWei || '0',
+ totalStakeEth: weiToEth(rep.totalStakeWei),
+ },
+ };
+}
+
+function deploymentRegistryId(chainId) {
+ const reg = REGISTRY_DEPLOYMENTS[chainId]?.reputationRegistry;
+ return reg ? agentRegistryId(chainId, reg) : null;
+}
+
+function weiToEth(wei) {
+ let v = 0n;
+ try {
+ v = BigInt(wei || '0');
+ } catch {
+ return 0;
+ }
+ // Six significant decimals is plenty for a stake display; avoids BigInt→float
+ // overflow for large balances while keeping sub-milli-ETH legible.
+ return Number((v * 1_000_000n) / 1_000_000_000_000_000_000n) / 1_000_000;
+}
+
+/**
+ * Human/agent name for a chain id, for verdict display + error messages.
+ * @param {number} chainId
+ * @returns {string}
+ */
+export function chainNameFor(chainId) {
+ return CHAIN_BY_ID[chainId]?.name || `chain ${chainId}`;
+}
diff --git a/api/wk.js b/api/wk.js
index 027038fb7..2fb98f9c7 100644
--- a/api/wk.js
+++ b/api/wk.js
@@ -620,6 +620,10 @@ async function handleX402Discovery(req, res) {
serviceName: 'three.ws Agent Reputation',
tags: ['reputation', 'agent', 'solana', 'attestation', 'trust'],
}),
+ agentBouncer: withService({
+ serviceName: 'three.ws Agent Bouncer',
+ tags: ['reputation', 'erc8004', 'trust', 'gate', 'agent'],
+ }),
onchainIdentity: withService({
serviceName: 'three.ws Identity Verify',
tags: ['identity', 'verification', 'agent', 'trust', 'onchain'],
@@ -924,6 +928,39 @@ async function handleX402Discovery(req, res) {
}),
};
})(),
+ (() => {
+ const url = `${origin}/api/x402/agent-bouncer`;
+ const accepts = acceptsForPrice('10000', url);
+ return {
+ path: '/api/x402/agent-bouncer',
+ url,
+ method: 'GET',
+ description:
+ 'Agent Bouncer — the Pole Club door check, opened to the open agent internet. Given an ERC-8004 agent (agentId, EVM wallet, or eip155:<chain>:<wallet>) and an optional trust policy, read the canonical on-chain Reputation Registry and return an admit/refuse verdict with a door tier (newcomer / regular / trusted / vip). The denylist is the chain’s own negative scores — no private table. Vet a counterparty before paying, hiring, or delegating.',
+ mimeType: 'application/json',
+ serviceName: routeMeta.agentBouncer.serviceName,
+ tags: routeMeta.agentBouncer.tags,
+ iconUrl: routeMeta.agentBouncer.iconUrl,
+ accepts,
+ extensions: extensionsForAccepts(accepts, {
+ method: 'GET',
+ discoverable: true,
+ input: { agent: '1', chain: 'base', min_average: 4, min_count: 3 },
+ inputSchema: {
+ type: 'object',
+ required: ['agent'],
+ properties: {
+ agent: { type: 'string' },
+ chain: { type: 'string' },
+ min_average: { type: 'number' },
+ min_count: { type: 'integer' },
+ min_stake_eth: { type: 'number' },
+ allow_newcomers: { type: 'boolean' },
+ },
+ },
+ }),
+ };
+ })(),
(() => {
const url = `${origin}/api/x402/onchain-identity-verify`;
const accepts = acceptsForPrice('5000', url);
diff --git a/api/x402/agent-bouncer.js b/api/x402/agent-bouncer.js
new file mode 100644
index 000000000..41f00eaa0
--- /dev/null
+++ b/api/x402/agent-bouncer.js
@@ -0,0 +1,265 @@
+// GET /api/x402/agent-bouncer?agent=<id|wallet|caip10>&chain=base&min_average=&min_count=
+//
+// The Pole Club's door bouncer, opened up to the whole agent internet.
+//
+// The Club's bouncer (/api/x402/club-cover) decides admission from a Postgres
+// table only three.ws can see — so a VIP at our door is a stranger everywhere
+// else. This endpoint answers the SAME question — "should I engage this agent?"
+// — from the open, portable signal instead: ERC-8004 on-chain reputation,
+// readable at one address on 12 chains. The denylist is the chain's own
+// negative scores; the door tier (newcomer/regular/trusted/vip) is earned
+// across every platform that writes the same registries. A verdict here is
+// useful to an agent that has never heard of three.ws.
+//
+// This is the DECISION, not the data: /api/x402/agent-reputation and the
+// agent_reputation MCP tool return the raw reputation; this returns an
+// admit/refuse verdict + tier against a caller-supplied policy. "x402 handles
+// how agents pay; ERC-8004 handles whether they should" — this is the second
+// half, as a service any agent can call before paying a counterparty.
+
+import { paidEndpoint } from '../_lib/x402-paid-endpoint.js';
+import { buildBazaarSchema } from '../_lib/x402-spec.js';
+import { installAccessControl } from '../_lib/x402/access-control.js';
+import { withService } from '../_lib/x402/bazaar-helpers.js';
+import { priceFor } from '../_lib/x402-prices.js';
+import { isAddress } from 'ethers';
+import { vetAgent, chainNameFor, DEFAULT_CHAIN_ID } from '../_lib/trust/agent-bouncer.js';
+
+const ROUTE = '/api/x402/agent-bouncer';
+
+const DESCRIPTION =
+ 'three.ws Agent Bouncer — the open-network door check. Given an ERC-8004 ' +
+ 'agent (agentId, EVM wallet, or eip155:<chain>:<wallet> CAIP-10) and an ' +
+ 'optional trust policy, read the canonical on-chain Reputation Registry and ' +
+ 'return an admit/refuse verdict with a door tier (newcomer / regular / ' +
+ 'trusted / vip). The denylist is the chain’s own negative scores — no ' +
+ 'private table. Use it to vet a counterparty before paying, hiring, or ' +
+ 'delegating to it. Pay-per-call in USDC on Base or Solana mainnet.';
+
+// Friendly chain names → chainId. Mirrors the agent_reputation MCP tool so an
+// agent can pass the same `chain` either place. CAIP-10 input overrides this.
+const CHAIN_IDS = {
+ base: 8453,
+ ethereum: 1,
+ arbitrum: 42161,
+ optimism: 10,
+ polygon: 137,
+ bsc: 56,
+ avalanche: 43114,
+ celo: 42220,
+ linea: 59144,
+ scroll: 534352,
+};
+
+const INPUT_EXAMPLE = { agent: '1', chain: 'base', min_average: 4, min_count: 3 };
+
+const INPUT_SCHEMA = {
+ $schema: 'https://json-schema.org/draft/2020-12/schema',
+ type: 'object',
+ required: ['agent'],
+ properties: {
+ agent: {
+ type: 'string',
+ description:
+ 'ERC-8004 agentId (uint), EVM wallet (0x…), or CAIP-10 "eip155:<chainId>:<wallet>".',
+ },
+ chain: {
+ type: 'string',
+ description:
+ 'Chain to read (default base). Name (base, ethereum, arbitrum, optimism, polygon, bsc, avalanche, celo, linea, scroll) or numeric chainId. Overridden by a CAIP-10 agent value.',
+ },
+ min_average: { type: 'number', description: 'Required average score to admit (default 0 = no minimum).' },
+ min_count: { type: 'integer', minimum: 0, description: 'Required number of on-chain reviews (default 0).' },
+ min_stake_eth: { type: 'number', minimum: 0, description: 'Required total ETH staked on vouches (default 0).' },
+ allow_newcomers: {
+ type: 'boolean',
+ description: 'Admit agents with zero on-chain history (default true).',
+ },
+ },
+};
+
+const OUTPUT_EXAMPLE = {
+ ok: true,
+ admitted: true,
+ banned: false,
+ tier: 'trusted',
+ reason: null,
+ registered: true,
+ agentId: '1',
+ wallet: null,
+ chain: 'Base',
+ chainId: 8453,
+ registry: 'eip155:8453:0x8004BAa17C55a88189AE136b182e5fdA19dE9b63',
+ reputation: { average: 4.6, count: 7, totalStakeWei: '2000000000000000', totalStakeEth: 0.002 },
+ policy: { minAverage: 4, minCount: 3, minStakeWei: '0', allowNewcomers: true, banNegative: true },
+ fetchedAt: '2026-06-22T17:00:00.000Z',
+};
+
+const OUTPUT_SCHEMA = {
+ $schema: 'https://json-schema.org/draft/2020-12/schema',
+ type: 'object',
+ required: ['ok', 'admitted', 'banned', 'tier', 'reputation', 'chainId'],
+ properties: {
+ ok: { type: 'boolean', const: true },
+ admitted: { type: 'boolean', description: 'true when the agent clears the policy and is not banned.' },
+ banned: { type: 'boolean', description: 'true when on a denylist or net-negative on-chain.' },
+ tier: {
+ type: 'string',
+ enum: ['newcomer', 'regular', 'trusted', 'vip', 'banned'],
+ description: 'Door tier earned from open-network reputation.',
+ },
+ reason: { type: ['string', 'null'], description: 'Primary reason when refused; null when admitted.' },
+ reasons: { type: 'array', items: { type: 'string' } },
+ registered: { type: 'boolean', description: 'false when the wallet has no ERC-8004 identity (a newcomer).' },
+ agentId: { type: ['string', 'null'] },
+ wallet: { type: ['string', 'null'] },
+ chain: { type: 'string' },
+ chainId: { type: 'integer' },
+ registry: { type: ['string', 'null'], description: 'CAIP-10 id of the Reputation Registry read.' },
+ reputation: {
+ type: 'object',
+ properties: {
+ average: { type: 'number' },
+ count: { type: 'integer', minimum: 0 },
+ totalStakeWei: { type: 'string' },
+ totalStakeEth: { type: 'number' },
+ },
+ },
+ policy: { type: 'object' },
+ fetchedAt: { type: 'string', format: 'date-time' },
+ },
+};
+
+const BAZAAR = {
+ discoverable: true,
+ info: {
+ input: { type: 'http', method: 'GET', queryParams: INPUT_EXAMPLE },
+ output: { type: 'json', example: OUTPUT_EXAMPLE },
+ },
+ schema: buildBazaarSchema({
+ method: 'GET',
+ queryParamsSchema: INPUT_SCHEMA,
+ outputSchema: OUTPUT_SCHEMA,
+ }),
+};
+
+export const BAZAAR_SCHEMA = BAZAAR;
+
+function badRequest(message, code) {
+ const err = new Error(message);
+ err.status = 400;
+ err.code = code;
+ return err;
+}
+
+function resolveChainId(input) {
+ if (input === undefined || input === null || input === '') return DEFAULT_CHAIN_ID;
+ const key = String(input).trim().toLowerCase();
+ if (CHAIN_IDS[key]) return CHAIN_IDS[key];
+ const id = Number(key);
+ if (Number.isInteger(id) && id > 0) return id;
+ throw badRequest(`unsupported chain "${input}"`, 'invalid_chain');
+}
+
+// Parse the `agent` param into { agentId|wallet, chainId }. A CAIP-10 value
+// carries its own chain and overrides the `chain` param.
+function parseAgent(raw, defaultChainId) {
+ const value = String(raw || '').trim();
+ if (!value) throw badRequest('query param "agent" is required', 'missing_agent');
+ if (/^\d+$/.test(value)) return { agentId: value, chainId: defaultChainId };
+ if (value.toLowerCase().startsWith('eip155:')) {
+ const parts = value.split(':');
+ if (parts.length !== 3) throw badRequest(`invalid CAIP-10 id "${value}"`, 'invalid_caip10');
+ const chainId = resolveChainId(parts[1]);
+ if (!isAddress(parts[2])) throw badRequest(`invalid wallet in "${value}"`, 'invalid_wallet');
+ return { wallet: parts[2], chainId };
+ }
+ if (isAddress(value)) return { wallet: value, chainId: defaultChainId };
+ throw badRequest(
+ `could not parse "${value}" — expected an agentId, 0x wallet, or eip155:<chain>:<wallet>`,
+ 'invalid_agent',
+ );
+}
+
+function parseNonNegativeNumber(raw, field) {
+ if (raw === undefined || raw === null || raw === '') return 0;
+ const n = Number(raw);
+ if (!Number.isFinite(n) || n < 0) throw badRequest(`${field} must be a non-negative number`, 'invalid_policy');
+ return n;
+}
+
+export default paidEndpoint({
+ route: ROUTE,
+ method: 'GET',
+ priceAtomics: priceFor('agent-bouncer', '10000'), // $0.01 USDC
+ networks: ['solana', 'base'],
+ description: DESCRIPTION,
+ bazaar: BAZAAR,
+ service: withService({
+ serviceName: 'three.ws Agent Bouncer',
+ tags: ['reputation', 'erc8004', 'trust', 'gate', 'agent'],
+ }),
+ requiredScope: 'x402:bypass',
+ accessControl: installAccessControl({ requiredScope: 'x402:bypass' }),
+ // Buyers with a granted OAuth scope or a fresh SIWX proof skip payment; the
+ // USDC accepts apply otherwise — same posture as agent-reputation.
+ authHints: {
+ oauth2: { requiredScope: 'read:agent-reputation', tokenType: 'Bearer' },
+ siwx: true,
+ },
+ async handler({ req }) {
+ const q = req.query || {};
+ const defaultChainId = resolveChainId(q.chain);
+ const { agentId, wallet, chainId } = parseAgent(q.agent, defaultChainId);
+
+ const minAverage = parseNonNegativeNumber(q.min_average, 'min_average');
+ const minCount = Math.floor(parseNonNegativeNumber(q.min_count, 'min_count'));
+ const minStakeEth = parseNonNegativeNumber(q.min_stake_eth, 'min_stake_eth');
+ const minStakeWei = BigInt(Math.round(minStakeEth * 1e9)) * 1_000_000_000n; // eth → wei, 9-digit precision
+ const allowNewcomers = q.allow_newcomers === undefined ? true : q.allow_newcomers !== 'false';
+
+ const policy = {
+ minAverage,
+ minCount,
+ minStakeWei,
+ allowNewcomers,
+ banNegative: true,
+ };
+
+ let verdict;
+ try {
+ verdict = await vetAgent({ agentId, wallet, chainId, policy });
+ } catch (err) {
+ // An on-chain read failure must not masquerade as "refused" — surface it
+ // as an upstream error so the caller knows the verdict is unknown, not no.
+ const e = new Error(`reputation read failed: ${err.message}`);
+ e.status = 502;
+ e.code = 'reputation_unavailable';
+ throw e;
+ }
+
+ return {
+ ok: true,
+ admitted: verdict.admitted,
+ banned: verdict.banned,
+ tier: verdict.tier,
+ reason: verdict.reason,
+ reasons: verdict.reasons,
+ registered: verdict.registered,
+ agentId: verdict.agentId,
+ wallet: verdict.wallet,
+ chain: chainNameFor(chainId),
+ chainId,
+ registry: verdict.registry,
+ reputation: verdict.reputation,
+ policy: {
+ minAverage,
+ minCount,
+ minStakeWei: minStakeWei.toString(),
+ allowNewcomers,
+ banNegative: true,
+ },
+ fetchedAt: new Date().toISOString(),
+ };
+ },
+});
diff --git a/data/changelog.json b/data/changelog.json
index 417b8b26e..fd3f7bb99 100644
--- a/data/changelog.json
+++ b/data/changelog.json
@@ -1,6 +1,20 @@
{
"$comment": "Curated changelog entries for three.ws — the editorial layer of the public changelog. New PAGE launches are tracked automatically via the `added` field in data/pages.json; this file is for everything else holders care about: improvements, fixes, SDK releases, trading/payments capabilities, security work. scripts/build-page-index.mjs merges both sources into CHANGELOG.md, public/changelog.json, and public/changelog.xml. Newest first. Allowed tags: feature, improvement, fix, sdk, infra, docs, security. `link` is optional and must be a live three.ws path.",
"entries": [
+ {
+ "date": "2026-06-22",
+ "title": "Fix the location-proof behind IRL 'agents near me'",
+ "summary": "The step that proves you're physically where you say you are — so the 'agents near me' view only reveals pins around your real location, never somewhere you point at from afar — could fail and return an error on every attempt. That same failure meant the privacy check it powers wasn't being enforced. It now works reliably with or without a configured signing secret: locally and in preview it stays open so testing isn't blocked, and in production each nearby read is bound to a genuine, freshly-signed location fix that expires in a few minutes and can't be forged or replayed from a distance. Nothing changes in how you use IRL — your location is still read only to mint the short-lived proof, never stored or logged.",
+ "tags": ["fix", "security"],
+ "link": "/irl"
+ },
+ {
+ "date": "2026-06-22",
+ "title": "Hide the controls in IRL for an unobstructed AR view",
+ "summary": "On a phone, the IRL controls (the top bar, the bottom row of buttons, the room badges, the compass and on-screen hints) could cover so much of the screen that you couldn't see the camera view or move your avatar past them. There's now a one-tap hide button on the right edge: tap it and all of that chrome slides away, leaving just the live AR scene — the on-screen joystick and drag-to-look still work, so you can walk around and look about with nothing in the way. Tap the same button (it stays put and glows green) to bring everything back; on a keyboard, Esc restores it too.",
+ "tags": ["feature", "improvement"],
+ "link": "/irl"
+ },
{
"date": "2026-06-22",
"title": "New docs: how agent reputation works, and how to read it",
diff --git a/mcp-server/src/tools/agent-reputation.js b/mcp-server/src/tools/agent-reputation.js
index 9112f8a7e..4eaa12629 100644
--- a/mcp-server/src/tools/agent-reputation.js
+++ b/mcp-server/src/tools/agent-reputation.js
@@ -10,9 +10,12 @@
// or pass a numeric chainId.
//
// The result includes:
-// - aggregate reputation (totalScore + count + average) via getReputation
+// - aggregate reputation (average + count) via getReputation. The contract
+// returns (int256 avgX100, uint256 count): the average ALREADY ×100, signed
+// so reputation can be negative. We divide by 100 — never by count — and
+// preserve the sign.
// - total ETH staked on the agent's vouches via getTotalStake
-// - recent ReputationSubmitted + ReputationStaked events (latest 25)
+// - recent FeedbackSubmitted + ReputationStaked events (latest 25)
// - the agent's URI + wallet (Identity Registry) when resolvable
//
// All numeric responses are returned both as decimal strings (for safe
@@ -38,10 +41,17 @@ const IDENTITY_REGISTRY_ABI = [
'function totalSupply() external view returns (uint256)',
];
+// Mirrors the deployed ReputationRegistry exactly (contracts/src/
+// ReputationRegistry.sol, canonical in src/erc8004/abi.js):
+// getReputation → (int256 avgX100, uint256 count) — average ×100, signed
+// FeedbackSubmitted(agentId, from, int8 score, string uri) — NOT
+// "ReputationSubmitted(...uint8 score, string comment)", which is a
+// different event topic the registry never emits (so the old filter always
+// returned zero vouches).
const REPUTATION_REGISTRY_ABI = [
- 'function getReputation(uint256 agentId) external view returns (uint256 totalScore, uint256 count)',
+ 'function getReputation(uint256 agentId) external view returns (int256 avgX100, uint256 count)',
'function getTotalStake(uint256 agentId) external view returns (uint256)',
- 'event ReputationSubmitted(uint256 indexed agentId, address indexed submitter, uint8 score, string comment)',
+ 'event FeedbackSubmitted(uint256 indexed agentId, address indexed from, int8 score, string uri)',
'event ReputationStaked(uint256 indexed agentId, address indexed staker, uint8 score, uint256 value)',
];
@@ -131,13 +141,15 @@ async function readReputationAggregate(provider, agentId) {
rep.getReputation(agentId),
rep.getTotalStake(agentId),
]);
- const [totalScore, count] = agg;
- const totalScoreNum = Number(totalScore);
+ const [avgX100, count] = agg;
const countNum = Number(count);
+ // getReputation returns the average already multiplied by 100 (signed).
+ // average = avgX100 / 100. Dividing by count again is the bug this avoids;
+ // Number() on a possibly-negative BigInt preserves the sign.
return {
- totalScore: totalScore.toString(),
+ averageX100: avgX100.toString(),
+ average: countNum > 0 ? Number(avgX100) / 100 : null,
count: count.toString(),
- average: countNum > 0 ? totalScoreNum / countNum : null,
totalStakeWei: totalStake.toString(),
};
}
@@ -152,16 +164,16 @@ async function readRecentEvents(provider, agentId) {
const latest = await provider.getBlockNumber();
const from = Math.max(0, latest - LOG_WINDOW_BLOCKS);
const [submitted, staked] = await Promise.all([
- rep.queryFilter(rep.filters.ReputationSubmitted(agentId), from, latest),
+ rep.queryFilter(rep.filters.FeedbackSubmitted(agentId), from, latest),
rep.queryFilter(rep.filters.ReputationStaked(agentId), from, latest),
]);
const submittedDecoded = submitted.map((e) => ({
kind: 'submitted',
blockNumber: e.blockNumber,
txHash: e.transactionHash,
- submitter: e.args?.submitter,
+ submitter: e.args?.from,
score: Number(e.args?.score),
- comment: e.args?.comment || '',
+ comment: e.args?.uri || '',
}));
const stakedDecoded = staked.map((e) => ({
kind: 'staked',
@@ -212,7 +224,7 @@ export async function buildAgentReputationTool() {
chain: 'base',
agentId: '1',
identity: { owner: '0x...', agentWallet: '0x...', uri: 'ipfs://...' },
- reputation: { totalScore: '42', count: '6', average: 7, totalStakeWei: '0' },
+ reputation: { averageX100: '420', average: 4.2, count: '6', totalStakeWei: '0' },
events: [{ kind: 'submitted', score: 5, submitter: '0x...', comment: '' }],
},
},
diff --git a/pages/irl.html b/pages/irl.html
index 622ccc7c1..1d7dbe2fa 100644
--- a/pages/irl.html
+++ b/pages/irl.html
@@ -229,6 +229,66 @@
.irl-glasses-btn { padding: 6px; display: inline-flex; align-items: center; justify-content: center; margin-right: 8px; }
.irl-glasses-btn.is-connected { color: #7aa2ff; border-color: rgba(122,162,255,0.45); background: rgba(79,124,255,0.12); }
+ /* ── Immersive mode ──────────────────────────────────────────
+ One tap collapses every chrome layer (topbar, bottom panel,
+ radar, room badge, aim HUD, hints) so the live AR view is
+ unobstructed and you can look around / drive the avatar. The
+ joystick + drag-to-orbit stay live underneath. The toggle is
+ the lone control left on screen, so it survives the collapse. */
+ .irl-immersive-toggle {
+ position: fixed;
+ top: 50%;
+ right: 10px;
+ transform: translateY(-50%);
+ z-index: 12;
+ width: 44px;
+ height: 44px;
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+ border-radius: 50%;
+ border: 1px solid rgba(255,255,255,0.2);
+ background: rgba(0,0,0,0.5);
+ backdrop-filter: blur(10px);
+ -webkit-backdrop-filter: blur(10px);
+ color: var(--text-2);
+ cursor: pointer;
+ -webkit-tap-highlight-color: transparent;
+ transition: color 0.15s, border-color 0.15s, background 0.15s, transform 0.12s;
+ }
+ .irl-immersive-toggle:hover { color: var(--text); border-color: var(--text-3); }
+ .irl-immersive-toggle:active { transform: translateY(-50%) scale(0.92); }
+ .irl-immersive-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
+ .irl-immersive-toggle .irl-eye-show { display: none; }
+ body.irl-immersive .irl-immersive-toggle .irl-eye-hide { display: none; }
+ body.irl-immersive .irl-immersive-toggle .irl-eye-show { display: inline; }
+ /* Immersive: the lone control glows green so it stays findable over the scene */
+ body.irl-immersive .irl-immersive-toggle {
+ color: var(--green);
+ border-color: rgba(74,222,128,0.5);
+ background: rgba(0,0,0,0.34);
+ }
+
+ /* Panels slide off-screen; floating chrome fades. */
+ .irl-topbar, .irl-bottom {
+ transition: transform 0.32s cubic-bezier(0.22,1,0.36,1), opacity 0.26s ease;
+ }
+ #irl-radar, #irl-dx-help, #irl-keys, #irl-discovery-empty,
+ .irl-room-badge, #irl-aim-hud {
+ transition: opacity 0.26s ease;
+ }
+ body.irl-immersive .irl-topbar { transform: translateY(-100%); opacity: 0; pointer-events: none; }
+ body.irl-immersive .irl-bottom { transform: translateY(100%); opacity: 0; pointer-events: none; }
+ body.irl-immersive #irl-radar,
+ body.irl-immersive #irl-dx-help,
+ body.irl-immersive #irl-keys,
+ body.irl-immersive #irl-discovery-empty,
+ body.irl-immersive .irl-room-badge,
+ body.irl-immersive #irl-aim-hud {
+ opacity: 0;
+ pointer-events: none;
+ }
+
/* ── Joystick ────────────────────────────────────────────── */
#irl-joystick {
position: fixed;
@@ -1877,6 +1937,14 @@
<button class="irl-share-btn" id="irl-share-btn" type="button" aria-label="Share">Share</button>
</header>
+<!-- Immersive toggle — collapses all chrome so the AR view is unobstructed.
+ Lives outside the topbar so it survives the collapse and remains the one
+ control on screen to bring everything back. -->
+<button class="irl-immersive-toggle" id="irl-immersive-toggle" type="button" aria-pressed="false" aria-label="Hide controls" title="Hide controls">
+ <svg class="irl-eye-hide" width="19" height="19" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 10 8 10 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"/><path d="M6.61 6.61A13.5 13.5 0 0 0 2 12s3 8 10 8a9.7 9.7 0 0 0 5.39-1.61"/><line x1="2" y1="2" x2="22" y2="22"/></svg>
+ <svg class="irl-eye-show" width="19" height="19" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M1 12s4-7 11-7 11 7 11 7-4 7-11 7-11-7-11-7z"/><circle cx="12" cy="12" r="3"/></svg>
+</button>
+
<!-- Proximity-arrival cue (task 03): a transient "look around" banner when a new
agent enters your ~40 m bubble. aria-live polite so a screen reader announces
the arrival without stealing focus. Filled + shown by src/irl.js. -->
diff --git a/public/changelog.json b/public/changelog.json
index 85827166b..9edbcf987 100644
--- a/public/changelog.json
+++ b/public/changelog.json
@@ -1,5 +1,5 @@
{
- "generated_at": "2026-06-22T23:00:25.318Z",
+ "generated_at": "2026-06-22T23:09:36.846Z",
"generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json",
"site": {
"name": "three.ws",
@@ -76,6 +76,17 @@
"fix"
]
},
+ {
+ "date": "2026-06-22",
+ "type": "update",
+ "title": "Fix the location-proof behind IRL 'agents near me'",
+ "summary": "The step that proves you're physically where you say you are — so the 'agents near me' view only reveals pins around your real location, never somewhere you point at from afar — could fail and return an error on every attempt. That same failure meant the privacy check it powers wasn't being enforced. It now works reliably with or without a configured signing secret: locally and in preview it stays open so testing isn't blocked, and in production each nearby read is bound to a genuine, freshly-signed location fix that expires in a few minutes and can't be forged or replayed from a distance. Nothing changes in how you use IRL — your location is still read only to mint the short-lived proof, never stored or logged.",
+ "link": "/irl",
+ "tags": [
+ "fix",
+ "security"
+ ]
+ },
{
"date": "2026-06-22",
"type": "update",
@@ -98,6 +109,17 @@
"improvement"
]
},
+ {
+ "date": "2026-06-22",
+ "type": "update",
+ "title": "Hide the controls in IRL for an unobstructed AR view",
+ "summary": "On a phone, the IRL controls (the top bar, the bottom row of buttons, the room badges, the compass and on-screen hints) could cover so much of the screen that you couldn't see the camera view or move your avatar past them. There's now a one-tap hide button on the right edge: tap it and all of that chrome slides away, leaving just the live AR scene — the on-screen joystick and drag-to-look still work, so you can walk around and look about with nothing in the way. Tap the same button (it stays put and glows green) to bring everything back; on a keyboard, Esc restores it too.",
+ "link": "/irl",
+ "tags": [
+ "feature",
+ "improvement"
+ ]
+ },
{
"date": "2026-06-22",
"type": "update",
diff --git a/public/changelog.xml b/public/changelog.xml
index 97000f9cb..cc94bc60a 100644
--- a/public/changelog.xml
+++ b/public/changelog.xml
@@ -62,6 +62,14 @@
<category>fix</category>
<description>A walking-avatar embed whose avatar can't load — a deleted or mistyped ID, a private avatar a public page can't read, or a dropped connection — now shows the default avatar walking with a short 'couldn't load that avatar — showing the default' note, instead of leaving an empty, all-dark frame on the host page. The embed always renders a body. The embed editor now flags an avatar ID it can't find with a clear 'not found' marker and tells you to pick a public or unlisted avatar, rather than silently keeping a dead ID. And owners can now load their own private avatar's 3D file when signed in, which previously failed even for the avatar's owner.</description>
</item>
+ <item>
+ <title>Fix the location-proof behind IRL 'agents near me'</title>
+ <link>https://three.ws/irl</link>
+ <guid isPermaLink="false">2026-06-22:Fix the location-proof behind IRL 'agents near me'</guid>
+ <pubDate>Mon, 22 Jun 2026 12:00:00 GMT</pubDate>
+ <category>fix</category>
+ <description>The step that proves you're physically where you say you are — so the 'agents near me' view only reveals pins around your real location, never somewhere you point at from afar — could fail and return an error on every attempt. That same failure meant the privacy check it powers wasn't being enforced. It now works reliably with or without a configured signing secret: locally and in preview it stays open so testing isn't blocked, and in production each nearby read is bound to a genuine, freshly-signed location fix that expires in a few minutes and can't be forged or replayed from a distance. Nothing changes in how you use IRL — your location is still read only to mint the short-lived proof, never stored or logged.</description>
+ </item>
<item>
<title>Forge polish: engine picker, honest wording, keyboard tabs, full-length remix</title>
<link>https://three.ws/forge</link>
@@ -78,6 +86,14 @@
<category>fix</category>
<description>The free, no-wallet 'forge a 3D model' widget on the IBM partnership page no longer shows a false 'briefly unreachable' error when the free GPU is cold. It used to fire up to six generation requests behind a single click, which spent the free lane's hourly limit about six times faster — a few tries could lock you out — and a slow cold start would surface as an error even though the model was still on its way. Now it makes one request per click (the server already falls back across NVIDIA, TRELLIS, and Hugging Face on its own), shows honest progress while a cold start warms up (which can take up to a minute), and, if the free lane is genuinely at its hourly limit, says exactly that and when to try again — pointing you to the instant paid Forge above. A model reliably comes back to orbit and download.</description>
</item>
+ <item>
+ <title>Hide the controls in IRL for an unobstructed AR view</title>
+ <link>https://three.ws/irl</link>
+ <guid isPermaLink="false">2026-06-22:Hide the controls in IRL for an unobstructed AR view</guid>
+ <pubDate>Mon, 22 Jun 2026 12:00:00 GMT</pubDate>
+ <category>feature</category>
+ <description>On a phone, the IRL controls (the top bar, the bottom row of buttons, the room badges, the compass and on-screen hints) could cover so much of the screen that you couldn't see the camera view or move your avatar past them. There's now a one-tap hide button on the right edge: tap it and all of that chrome slides away, leaving just the live AR scene — the on-screen joystick and drag-to-look still work, so you can walk around and look about with nothing in the way. Tap the same button (it stays put and glows green) to bring everything back; on a keyboard, Esc restores it too.</description>
+ </item>
<item>
<title>IBM x402 demo works when embedded in IBM's CMS</title>
<link>https://three.ws/ibm/x402-demo</link>
diff --git a/public/features.json b/public/features.json
index 88ebf2692..be9aa8d6c 100644
--- a/public/features.json
+++ b/public/features.json
@@ -1,5 +1,5 @@
{
- "generated_at": "2026-06-22T23:00:25.302Z",
+ "generated_at": "2026-06-22T23:09:36.798Z",
"generated_by": "scripts/build-page-index.mjs from data/pages.json",
"site": {
"name": "three.ws",
diff --git a/scripts/verify-ibm-surface.mjs b/scripts/verify-ibm-surface.mjs
index 7c1b921f4..19777eacf 100644
--- a/scripts/verify-ibm-surface.mjs
+++ b/scripts/verify-ibm-surface.mjs
@@ -59,18 +59,31 @@ function hasViteInput(pagePath) {
}
function hasDevRoute(route) {
- // dev fileMap key, e.g. '/ibm/galaxy': resolve(root, 'pages/ibm/galaxy.html')
- return new RegExp(`['"]${route.replace(/[/]/g, '\\/')}['"]\\s*:`).test(viteConfig);
+ const q = route.replace(/[/]/g, '\\/');
+ // Either a dev fileMap key — '/ibm/galaxy': resolve(root, 'pages/ibm/galaxy.html') —
+ // or a configureServer middleware that compares the path: path === '/ibm/x402-demo'
+ // (x402-demo is served verbatim by a custom middleware, not the standard fileMap).
+ return new RegExp(`['"]${q}['"]\\s*:`).test(viteConfig)
+ || new RegExp(`===?\\s*['"]${q}['"]`).test(viteConfig);
}
function hasVercelRoute(route) {
- const hit = (src) =>
+ const dest = (src) =>
vercelRoutes.some(
(x) => x.src === src && typeof x.dest === 'string' && x.dest.includes('/ibm/'),
);
+ // A trailing-slash variant may instead 30x-redirect to the canonical clean URL —
+ // the correct shape for a page with RELATIVE assets (./fonts/, ./vendor/), which
+ // breaks if the same HTML is served under /<name>/ (the base path shifts).
+ const redirectTo = (src, target) =>
+ vercelRoutes.some(
+ (x) => x.src === src && Number(x.status) >= 300 && Number(x.status) < 400
+ && x.headers && x.headers.Location === target,
+ );
// index maps via /ibm → /ibm/index.html; sub-pages via /ibm/<name> (+ trailing slash).
if (route === '/ibm') return vercelRoutes.some((x) => x.src === '/ibm');
- return hit(route) && hit(`${route}/`);
+ const slash = `${route}/`;
+ return dest(route) && (dest(slash) || redirectTo(slash, route));
}
const pageDir = 'pages/ibm';
diff --git a/src/irl.js b/src/irl.js
index 4821e5a94..f2ac10852 100644
--- a/src/irl.js
+++ b/src/irl.js
@@ -4445,6 +4445,27 @@ syncGhostToggle();
document.getElementById('irl-cue-mute')?.addEventListener('click', () => setCueMuted(!_cueMuted));
syncCueMuteButton();
+// Immersive toggle — collapse every chrome layer (topbar, bottom panel, radar,
+// room badge, aim HUD, hints) so the live AR view is unobstructed. The joystick
+// and drag-to-orbit stay live underneath, so you can still look around and move
+// the avatar; the toggle itself is the one control left, to bring it all back.
+const immersiveBtn = document.getElementById('irl-immersive-toggle');
+function setImmersive(on) {
+ document.body.classList.toggle('irl-immersive', on);
+ if (!immersiveBtn) return;
+ immersiveBtn.setAttribute('aria-pressed', String(on));
+ const label = on ? 'Show controls' : 'Hide controls';
+ immersiveBtn.setAttribute('aria-label', label);
+ immersiveBtn.title = label;
+}
+immersiveBtn?.addEventListener('click', () => {
+ setImmersive(!document.body.classList.contains('irl-immersive'));
+});
+// Esc restores the chrome on desktop, matching the convention for immersive views.
+window.addEventListener('keydown', (e) => {
+ if (e.key === 'Escape' && document.body.classList.contains('irl-immersive')) setImmersive(false);
+});
+
// L3 — Location & privacy center: honest disclosure + discovery precision +
// presence opt-in + a jump into pin management, all in one designed surface.
document.getElementById('irl-privacy-btn')?.addEventListener('click', () => {
diff --git a/tests/agent-bouncer.test.js b/tests/agent-bouncer.test.js
new file mode 100644
index 000000000..2eb5ff717
--- /dev/null
+++ b/tests/agent-bouncer.test.js
@@ -0,0 +1,129 @@
+// Tests for the open-network Agent Bouncer — the Pole Club door check
+// generalized to ERC-8004 on-chain reputation. Covers tier assignment, the
+// admit/refuse verdict under a policy, denylist + negative-score exclusion, the
+// newcomer (unregistered wallet) path, and the corrected getReputation decode
+// (average = avgX100 / 100, sign-preserving) that the A2A gate now shares.
+
+import { describe, it, expect, vi } from 'vitest';
+
+import { tierForReputation, vetAgent } from '../api/_lib/trust/agent-bouncer.js';
+
+// A reader stub standing in for the on-chain read. vetAgent calls
+// read({ agentId, wallet, chainId }) and treats the result as the decoded
+// aggregate — so these tests exercise the verdict logic without RPC.
+function reader(rep) {
+ return vi.fn(async () => ({
+ agentId: '1',
+ wallet: null,
+ registered: true,
+ average: 0,
+ count: 0,
+ totalStakeWei: '0',
+ ...rep,
+ }));
+}
+
+describe('tierForReputation', () => {
+ it('is a newcomer with no reviews', () => {
+ expect(tierForReputation({ average: 0, count: 0 })).toBe('newcomer');
+ });
+
+ it('is regular with a little history', () => {
+ expect(tierForReputation({ average: 5, count: 1 })).toBe('regular');
+ expect(tierForReputation({ average: 5, count: 4 })).toBe('regular');
+ });
+
+ it('is trusted at the review threshold', () => {
+ expect(tierForReputation({ average: 4, count: 5 })).toBe('trusted');
+ expect(tierForReputation({ average: 4, count: 12 })).toBe('trusted'); // no stake → not vip
+ });
+
+ it('is vip only with enough reviews AND ETH stake behind a vouch', () => {
+ expect(tierForReputation({ average: 5, count: 10, totalStakeWei: '1000000000000000' })).toBe('vip');
+ expect(tierForReputation({ average: 5, count: 10, totalStakeWei: '0' })).toBe('trusted');
+ });
+
+ it('never promotes a net-negative agent past regular', () => {
+ expect(tierForReputation({ average: -3, count: 50, totalStakeWei: '1000000000000000' })).toBe('regular');
+ });
+});
+
+describe('vetAgent', () => {
+ it('admits an agent that clears the policy', async () => {
+ const read = reader({ average: 4.6, count: 7 });
+ const v = await vetAgent({ agentId: '1', chainId: 8453, policy: { minAverage: 4, minCount: 3 }, read });
+ expect(v.admitted).toBe(true);
+ expect(v.banned).toBe(false);
+ expect(v.tier).toBe('trusted');
+ expect(v.reason).toBeNull();
+ expect(v.reputation.average).toBe(4.6);
+ });
+
+ it('refuses for too few reviews and reports why', async () => {
+ const read = reader({ average: 5, count: 2 });
+ const v = await vetAgent({ agentId: '1', chainId: 8453, policy: { minCount: 5 }, read });
+ expect(v.admitted).toBe(false);
+ expect(v.banned).toBe(false);
+ expect(v.reason).toMatch(/only 2 review/);
+ });
+
+ it('refuses when the average is below the bar', async () => {
+ const read = reader({ average: 2.5, count: 20 });
+ const v = await vetAgent({ agentId: '1', chainId: 8453, policy: { minAverage: 4 }, read });
+ expect(v.admitted).toBe(false);
+ expect(v.reason).toMatch(/below the required 4/);
+ });
+
+ it('bans a net-negative agent — the chain’s own denylist', async () => {
+ const read = reader({ average: -1.2, count: 9 });
+ const v = await vetAgent({ agentId: '1', chainId: 8453, read });
+ expect(v.banned).toBe(true);
+ expect(v.admitted).toBe(false);
+ expect(v.tier).toBe('banned');
+ expect(v.reason).toMatch(/negative on-chain reputation/);
+ });
+
+ it('honors an explicit denylist by wallet', async () => {
+ const wallet = '0x000000000000000000000000000000000000dEaD';
+ const read = reader({ wallet, average: 5, count: 30 });
+ const v = await vetAgent({ wallet, chainId: 8453, denylist: [wallet.toLowerCase()], read });
+ expect(v.banned).toBe(true);
+ expect(v.admitted).toBe(false);
+ });
+
+ it('treats an unregistered wallet as a newcomer, admitted by default', async () => {
+ const read = reader({ agentId: null, wallet: '0xabc', registered: false, average: 0, count: 0 });
+ const v = await vetAgent({ wallet: '0xabc', chainId: 8453, read });
+ expect(v.tier).toBe('newcomer');
+ expect(v.registered).toBe(false);
+ expect(v.admitted).toBe(true);
+ });
+
+ it('refuses a newcomer when the policy forbids them', async () => {
+ const read = reader({ registered: false, average: 0, count: 0 });
+ const v = await vetAgent({ wallet: '0xabc', chainId: 8453, policy: { allowNewcomers: false }, read });
+ expect(v.admitted).toBe(false);
+ expect(v.reason).toMatch(/newcomers not admitted/);
+ });
+
+ it('enforces a minimum ETH stake', async () => {
+ const read = reader({ average: 5, count: 20, totalStakeWei: '500000000000000' }); // 0.0005 ETH
+ const v = await vetAgent({
+ agentId: '1',
+ chainId: 8453,
+ policy: { minStakeWei: 1_000_000_000_000_000n }, // 0.001 ETH
+ read,
+ });
+ expect(v.admitted).toBe(false);
+ expect(v.reason).toMatch(/wei required/);
+ });
+
+ it('decodes the aggregate average exactly as the reader supplies it (avgX100/100 contract)', async () => {
+ // The reader returns the already-divided average; vetAgent must not divide
+ // again (the bug the shared read exists to avoid). 4.2 stays 4.2.
+ const read = reader({ average: 4.2, count: 6 });
+ const v = await vetAgent({ agentId: '1', chainId: 8453, read });
+ expect(v.reputation.average).toBe(4.2);
+ expect(v.reputation.count).toBe(6);
+ });
+});
diff --git a/tests/irl-fix-token.test.js b/tests/irl-fix-token.test.js
new file mode 100644
index 000000000..477ab8579
--- /dev/null
+++ b/tests/irl-fix-token.test.js
@@ -0,0 +1,140 @@
+// Proof-of-presence token mint/verify (epic IRL-Hardening H3).
+//
+// Regression fence for the production incident where POST /api/irl/fix-token 500'd
+// on every request with `DataError: Zero-length key is not supported`: minting ran
+// hmacSha256() with an empty key whenever IRL_FIX_SECRET was unset (every dev/preview
+// box AND a misconfigured prod). The mint path must work without a configured secret
+// — that's the documented dev/preview contract — and must never hand a zero-length
+// key to Web Crypto. These tests pin both the no-secret (bypass) and configured
+// (enforced) modes, plus the forgery/expiry/area rejections that make the token a
+// real proof rather than a rubber stamp.
+
+import { describe, it, expect, afterEach } from 'vitest';
+
+import {
+ mintFixToken,
+ verifyFixToken,
+ fixEnforced,
+ FIX_TTL_SEC,
+} from '../api/_lib/irl-presence.js';
+import { hmacSha256 } from '../api/_lib/crypto.js';
+
+// A point somewhere ordinary (San Francisco) for coordinate assertions.
+const LAT = 37.7749;
+const LNG = -122.4194;
+const NOW = 1_700_000_000; // fixed issuance clock so expiry math is deterministic.
+
+const STRONG_SECRET = 'a-strong-32-char-minimum-secret-value';
+
+// Each test sets process.env.IRL_FIX_SECRET as needed; always restore it so tests
+// don't leak enforcement mode into one another.
+const ORIGINAL = process.env.IRL_FIX_SECRET;
+afterEach(() => {
+ if (ORIGINAL === undefined) delete process.env.IRL_FIX_SECRET;
+ else process.env.IRL_FIX_SECRET = ORIGINAL;
+});
+
+describe('mintFixToken — never crashes on a zero-length key', () => {
+ it('mints a usable token when IRL_FIX_SECRET is UNSET (dev/preview bypass)', async () => {
+ delete process.env.IRL_FIX_SECRET;
+ expect(fixEnforced()).toBe(false);
+ // The exact call that used to throw `Zero-length key is not supported`.
+ const minted = await mintFixToken(LAT, LNG, NOW);
+ expect(minted).toBeTruthy();
+ expect(typeof minted.token).toBe('string');
+ expect(minted.token).toContain('.');
+ expect(minted.expires_in).toBe(FIX_TTL_SEC);
+ expect(typeof minted.cell).toBe('string');
+ // And it round-trips in the same mode (mint + verify share the dev key).
+ const v = await verifyFixToken(minted.token, LAT, LNG, NOW);
+ expect(v.ok).toBe(true);
+ });
+
+ it('mints a usable token when IRL_FIX_SECRET is set but too WEAK (<16 chars)', async () => {
+ process.env.IRL_FIX_SECRET = 'short';
+ expect(fixEnforced()).toBe(false);
+ const minted = await mintFixToken(LAT, LNG, NOW);
+ expect(minted).toBeTruthy();
+ const v = await verifyFixToken(minted.token, LAT, LNG, NOW);
+ expect(v.ok).toBe(true);
+ });
+
+ it('mints and round-trips with a STRONG configured secret (production mode)', async () => {
+ process.env.IRL_FIX_SECRET = STRONG_SECRET;
+ expect(fixEnforced()).toBe(true);
+ const minted = await mintFixToken(LAT, LNG, NOW);
+ const v = await verifyFixToken(minted.token, LAT, LNG, NOW);
+ expect(v.ok).toBe(true);
+ expect(v.cell).toBe(minted.cell);
+ });
+
+ it('returns null (not a throw) for an unplaceable fix', async () => {
+ delete process.env.IRL_FIX_SECRET;
+ expect(await mintFixToken(NaN, LNG, NOW)).toBeNull();
+ expect(await mintFixToken(LAT, Infinity, NOW)).toBeNull();
+ expect(await mintFixToken(91, LNG, NOW)).toBeNull(); // lat out of range
+ expect(await mintFixToken(LAT, 181, NOW)).toBeNull(); // lng out of range
+ });
+});
+
+describe('verifyFixToken — a real proof, not a rubber stamp', () => {
+ it('rejects a tampered signature as forged', async () => {
+ process.env.IRL_FIX_SECRET = STRONG_SECRET;
+ const { token } = await mintFixToken(LAT, LNG, NOW);
+ const dot = token.indexOf('.');
+ const sig = token.slice(dot + 1);
+ // Flip the final signature char to a definitely-different one (same length).
+ const flipped = sig.at(-1) === 'A' ? 'B' : 'A';
+ const forged = token.slice(0, dot + 1) + sig.slice(0, -1) + flipped;
+ const v = await verifyFixToken(forged, LAT, LNG, NOW);
+ expect(v.ok).toBe(false);
+ expect(v.reason).toBe('forged');
+ });
+
+ it('rejects a read claimed far from the mint anchor (out_of_area)', async () => {
+ process.env.IRL_FIX_SECRET = STRONG_SECRET;
+ const { token } = await mintFixToken(LAT, LNG, NOW);
+ // ~1.1 km north — well past FIX_TOLERANCE_M (250 m).
+ const v = await verifyFixToken(token, LAT + 0.01, LNG, NOW);
+ expect(v.ok).toBe(false);
+ expect(v.reason).toBe('out_of_area');
+ });
+
+ it('rejects an expired token', async () => {
+ process.env.IRL_FIX_SECRET = STRONG_SECRET;
+ const { token } = await mintFixToken(LAT, LNG, NOW);
+ const v = await verifyFixToken(token, LAT, LNG, NOW + FIX_TTL_SEC + 10);
+ expect(v.ok).toBe(false);
+ expect(v.reason).toBe('expired');
+ });
+
+ it('reports missing / malformed inputs without throwing', async () => {
+ process.env.IRL_FIX_SECRET = STRONG_SECRET;
+ expect((await verifyFixToken('', LAT, LNG, NOW)).reason).toBe('missing');
+ expect((await verifyFixToken('no-dot-here', LAT, LNG, NOW)).reason).toBe('malformed');
+ });
+
+ it('a token minted in bypass mode is rejected once enforcement is live (no backdoor)', async () => {
+ // Mint with no secret (dev fallback key)…
+ delete process.env.IRL_FIX_SECRET;
+ const { token } = await mintFixToken(LAT, LNG, NOW);
+ // …then turn enforcement on. The dev-key signature must not satisfy the real key.
+ process.env.IRL_FIX_SECRET = STRONG_SECRET;
+ const v = await verifyFixToken(token, LAT, LNG, NOW);
+ expect(v.ok).toBe(false);
+ expect(v.reason).toBe('forged');
+ });
+});
+
+describe('hmacSha256 — clear error on an empty key', () => {
+ it('throws a diagnosable message instead of an opaque DataError', async () => {
+ await expect(hmacSha256('', 'msg')).rejects.toThrow(/empty signing key/i);
+ await expect(hmacSha256(undefined, 'msg')).rejects.toThrow(/empty signing key/i);
+ });
+
+ it('still signs normally with a real key', async () => {
+ const sig = await hmacSha256('k', 'msg');
+ expect(typeof sig).toBe('string');
+ expect(sig.length).toBeGreaterThan(0);
+ });
+});
diff --git a/vercel.json b/vercel.json
index 3930ad86c..40ca89ee0 100644
--- a/vercel.json
+++ b/vercel.json
@@ -821,6 +821,13 @@
"src": "/irl-privacy/?",
"dest": "/irl-privacy.html"
},
+ {
+ "src": "/ibm/x402-demo/",
+ "status": 308,
+ "headers": {
+ "Location": "/ibm/x402-demo"
+ }
+ },
{
"src": "/ibm/x402-demo",
"dest": "/ibm/x402-demo.html"