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.

test(ibm): pin the attest on-chain submit auth gate so an anonymous caller can never broadcast

nirholasd38788f57f0b
diff --git a/tests/api/ibm-attest.test.js b/tests/api/ibm-attest.test.js
index ae5a8b493..26a85aa51 100644
--- a/tests/api/ibm-attest.test.js
+++ b/tests/api/ibm-attest.test.js
@@ -140,6 +140,7 @@ vi.mock('../../api/_lib/avatar-wallet.js', () => ({
}));
import { limits } from '../../api/_lib/rate-limit.js';
+import { getSessionUser } from '../../api/_lib/auth.js';
import { fetchOhlcv, topPoolForToken, trendingPools } from '../../api/_lib/market/ohlcv.js';
const handler = (await import('../../api/ibm/attest.js')).default;
@@ -329,6 +330,25 @@ describe('POST /api/ibm/attest (notarize)', () => {
expect(state.sendSolArgs).toBeNull(); // never reached the chain
});
+ // Broadcasting pays a real network fee from the platform's shared attester
+ // wallet, so an anonymous caller must never reach the chain. The read-only
+ // attestation (no submit) stays open to everyone.
+ it('refuses an anonymous submit with 401 and never touches the chain', async () => {
+ state.wxConfigured = true;
+ state.walletConfigured = true;
+ state.guardianVerdict = 'No';
+ getSessionUser.mockResolvedValueOnce(null);
+ const { status, body } = await invoke({
+ method: 'POST',
+ body: { pool: POOL, submit: true },
+ });
+ expect(status).toBe(401);
+ expect(body.onchain.submitted).toBe(false);
+ expect(body.onchain.error).toMatch(/sign-in or a valid bearer token/);
+ expect(state.sendSolArgs).toBeNull();
+ expect(limits.attestSubmitDaily).not.toHaveBeenCalled();
+ });
+
it('does not submit when the attester wallet is not configured', async () => {
state.wxConfigured = true;
state.walletConfigured = false;