Files
petvity/lib/auth/edge.ts
T
GandClaude Opus 5 c65ac4b7d7 chore: add a formatter (#71)
* chore: add a formatter, matching the style this repo already writes

singleQuote=false was chosen by counting this repo's own
imports, not by fleet decree. The fleet is genuinely split and the two repos
that already had a .prettierrc disagreed with each other, so there was no
standard to restore. Quote style does not cross repo boundaries; having a
gate does.

Markdown is ignored for now — prettier rewraps prose, which would bury the
real diff.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* style: format with prettier (252 files)

Mechanical. No behaviour change. This SHA is listed in
.git-blame-ignore-revs so `git blame` skips it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* chore: teach git blame to skip the reformat

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-29 10:05:01 +00:00

25 lines
924 B
TypeScript

// Edge-compatible auth config — used ONLY in proxy.ts (middleware).
// Must NOT import bcryptjs, DrizzleAdapter, or any Node.js-only module.
// The JWT token already contains id, role, emailVerified written by the
// full auth config in lib/auth/index.ts — we just read them here.
import NextAuth from "next-auth";
import type { NextAuthConfig } from "next-auth";
import type { UserRole } from "./types";
import "./types"; // ensure module augmentation is applied
const edgeConfig: NextAuthConfig = {
session: { strategy: "jwt" },
pages: { signIn: "/login", error: "/login" },
providers: [],
callbacks: {
session({ session, token }) {
session.user.id = token.id as string;
session.user.role = token.role as UserRole;
session.user.emailVerified = (token.emailVerified as Date | null | undefined) ?? null;
return session;
},
},
};
export const { auth } = NextAuth(edgeConfig);