โ– humdrum codex / soft
674 B raw
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
// lib/auth.ts โ€” local single-user shim.
//
// This dashboard runs only on localhost for one person, so there is no real auth.
// Every request is the same user. Routes still call requireUser(req) to keep the
// kit's API shape (and to make adding real auth later a one-file change).

export const LOCAL_USER_ID = "local";

export class AuthError extends Error {
  constructor(public status = 401, message = "Unauthorized") {
    super(message);
  }
}

// Always resolves to the single local user. `req` is accepted for signature
// compatibility with the kit and future auth.
export async function requireUser(_req?: Request): Promise<string> {
  return LOCAL_USER_ID;
}