You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

13 lines
480 B

import type { H3Event } from "h3";
import { getCurrentUser } from "#server/utils/context";
import { getTempTokenFromCookie } from "./temp-token";
import type { AgentIdentity } from "./types";
export async function resolveAgentIdentity(event: H3Event): Promise<AgentIdentity> {
const user = await getCurrentUser(event);
if (user) {
return { userId: user.id, tempToken: null };
}
const tempToken = getTempTokenFromCookie(event);
return { userId: null, tempToken };
}