import { ConvexError } from "convex/values"; export type AuthContext = { readonly auth: { readonly getUserIdentity: () => Promise<{ readonly tokenIdentifier: string; } | null>; }; }; export const requireOwnerId = async (ctx: AuthContext): Promise => { const identity = await ctx.auth.getUserIdentity(); if (!identity) { throw new ConvexError("Authentication required"); } return identity.tokenIdentifier; };