huggi / src /lib /server /auth.ts
coyotte508's picture
coyotte508 HF staff
✨ Backend preparation for "Sign in with HF" (#190)
2e28042 unverified
raw
history blame
313 Bytes
import { HF_CLIENT_ID, HF_CLIENT_SECRET } from "$env/static/private";
export const requiresUser = !!HF_CLIENT_ID && !!HF_CLIENT_SECRET;
export const authCondition = (locals: App.Locals) => {
return locals.userId
? { userId: locals.userId }
: { sessionId: locals.sessionId, userId: { $exists: false } };
};