MCPcopy Create free account
hub / github.com/bewcloud/bewcloud / validateUserAndSession

Function validateUserAndSession

lib/models/user.ts:213–231  ·  view source on GitHub ↗
(userId: string, sessionId: string)

Source from the content-addressed store, hash-verified

211}
212
213export async function validateUserAndSession(userId: string, sessionId: string) {
214 const user = await UserModel.getById(userId);
215
216 if (!user) {
217 throw new Error('Not Found');
218 }
219
220 const session = await UserSessionModel.getById(sessionId);
221
222 if (!session || session.user_id !== user.id) {
223 throw new Error('Not Found');
224 }
225
226 session.last_seen_at = new Date();
227
228 await UserSessionModel.update(session);
229
230 return { user, session };
231}
232
233export class VerificationCodeModel {
234 static async create(

Callers 1

getDataFromCookieFunction · 0.90

Calls 2

getByIdMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected