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.

Send the shared secret when IrlRoom hydrates the internal bbox feed

nirholas5afbfbc8fd1f
diff --git a/multiplayer/src/irl-publish-auth.js b/multiplayer/src/irl-publish-auth.js
index 3e8913141..eadd76861 100644
--- a/multiplayer/src/irl-publish-auth.js
+++ b/multiplayer/src/irl-publish-auth.js
@@ -15,7 +15,12 @@
import crypto from 'node:crypto';
-function secret() {
+// The shared secret this Colyseus host proves identity with — both as the
+// verifier of inbound publish webhooks AND as the bearer the room presents when
+// it hydrates pins from the internal-only bbox feed (api/irl/pins.js). Kept as
+// one resolver so the two directions can never drift. Mirrors the API-side
+// internalSecret() in api/irl/pins.js byte-for-byte.
+export function multiplayerSecret() {
return (
process.env.MULTIPLAYER_SHARED_SECRET ||
process.env.HOLDER_PASS_SECRET ||
@@ -23,6 +28,10 @@ function secret() {
);
}
+function secret() {
+ return multiplayerSecret();
+}
+
function timingSafeEqualStr(a, b) {
const ab = Buffer.from(String(a || ''));
const bb = Buffer.from(String(b || ''));
diff --git a/multiplayer/src/rooms/IrlRoom.js b/multiplayer/src/rooms/IrlRoom.js
index 08fc80bb2..ced39d283 100644
--- a/multiplayer/src/rooms/IrlRoom.js
+++ b/multiplayer/src/rooms/IrlRoom.js
@@ -28,6 +28,7 @@ import { Room } from '@colyseus/core';
import { IrlPin, IrlViewer, IrlState } from '../irl-schemas.js';
import { encodeGeohash, geohashNeighbors, decodeGeohashBounds, decodeGeohash } from '../geohash.js';
import { irlRegistry } from '../irl-registry.js';
+import { multiplayerSecret } from '../irl-publish-auth.js';
import {
isReactionType,
reactionAllowed,
@@ -157,7 +158,12 @@ export class IrlRoom extends Room {
const bbox = this._windowBounds();
if (!bbox) return;
const url = `${API_BASE}/api/irl/pins?bbox=${bbox.minLat},${bbox.minLng},${bbox.maxLat},${bbox.maxLng}`;
- const res = await fetch(url, { headers: { accept: 'application/json' } });
+ // The bbox feed is internal-only (it would otherwise be a bulk GPS-scrape
+ // vector). Present the shared multiplayer secret so the API trusts this as
+ // server-to-server room hydration rather than a public read.
+ const res = await fetch(url, {
+ headers: { accept: 'application/json', 'x-mp-internal': multiplayerSecret() },
+ });
if (!res.ok) throw new Error(`HTTP ${res.status}`);
const body = await res.json();
const pins = Array.isArray(body?.pins) ? body.pins : [];