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.

702 B
Raw Blame
// Resolve the calling account for endpoints that accept either a browser
// session (cookie) or a programmatic bearer token (OAuth / API key). Returns
// { userId } or null. Mirrors the inline pattern used across api/threews/* but
// shared so the friends endpoints stay consistent.

import { getSessionUser, authenticateBearer, extractBearer } from './auth.js';

export async function resolveAccount(req, res) {
	const session = await getSessionUser(req, res);
	if (session) return { userId: session.id, source: 'session' };
	const bearer = await authenticateBearer(extractBearer(req));
	if (bearer) return { userId: bearer.userId, source: bearer.source, scope: bearer.scope || '' };
	return null;
}