@ccatto/react-auth 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +61 -0
- package/dist/config-CvzbPvtw.d.cts +88 -0
- package/dist/config-CvzbPvtw.d.ts +88 -0
- package/dist/index.cjs +325 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +296 -0
- package/dist/index.d.ts +296 -0
- package/dist/index.js +321 -0
- package/dist/index.js.map +1 -0
- package/dist/server.cjs +162 -0
- package/dist/server.cjs.map +1 -0
- package/dist/server.d.cts +15 -0
- package/dist/server.d.ts +15 -0
- package/dist/server.js +160 -0
- package/dist/server.js.map +1 -0
- package/package.json +91 -0
package/dist/server.js
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { betterAuth } from 'better-auth';
|
|
2
|
+
import { prismaAdapter } from 'better-auth/adapters/prisma';
|
|
3
|
+
import { createAuthMiddleware } from 'better-auth/api';
|
|
4
|
+
import { nextCookies } from 'better-auth/next-js';
|
|
5
|
+
|
|
6
|
+
// src/server/create-auth.ts
|
|
7
|
+
var DEFAULT_TOKEN_EXPIRY_SECONDS = 69 * 24 * 60 * 60;
|
|
8
|
+
function createCattoAuth(config) {
|
|
9
|
+
const expiresIn = config.session?.expiresInSeconds ?? DEFAULT_TOKEN_EXPIRY_SECONDS;
|
|
10
|
+
const socialProviders = {};
|
|
11
|
+
if (config.socialProviders?.google) {
|
|
12
|
+
socialProviders.google = config.socialProviders.google;
|
|
13
|
+
}
|
|
14
|
+
if (config.socialProviders?.github) {
|
|
15
|
+
socialProviders.github = config.socialProviders.github;
|
|
16
|
+
}
|
|
17
|
+
if (config.socialProviders?.facebook) {
|
|
18
|
+
socialProviders.facebook = {
|
|
19
|
+
...config.socialProviders.facebook,
|
|
20
|
+
scope: config.socialProviders.facebook.scope ?? [
|
|
21
|
+
"email",
|
|
22
|
+
"public_profile"
|
|
23
|
+
]
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
const auth = betterAuth({
|
|
27
|
+
// Database
|
|
28
|
+
// Cast needed: prismaAdapter expects PrismaClient but we use a minimal interface for package portability
|
|
29
|
+
database: prismaAdapter(
|
|
30
|
+
config.database,
|
|
31
|
+
{
|
|
32
|
+
provider: config.databaseProvider
|
|
33
|
+
}
|
|
34
|
+
),
|
|
35
|
+
// Secret & URL
|
|
36
|
+
secret: config.secret,
|
|
37
|
+
baseURL: config.baseURL,
|
|
38
|
+
// Email/password
|
|
39
|
+
emailAndPassword: {
|
|
40
|
+
enabled: config.emailAndPassword?.enabled ?? true,
|
|
41
|
+
requireEmailVerification: config.emailAndPassword?.requireEmailVerification ?? false
|
|
42
|
+
},
|
|
43
|
+
// Social providers
|
|
44
|
+
socialProviders,
|
|
45
|
+
// Session
|
|
46
|
+
session: {
|
|
47
|
+
expiresIn,
|
|
48
|
+
cookieCache: {
|
|
49
|
+
enabled: true,
|
|
50
|
+
maxAge: expiresIn
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
// Account linking
|
|
54
|
+
account: {
|
|
55
|
+
accountLinking: {
|
|
56
|
+
enabled: true,
|
|
57
|
+
trustedProviders: Object.keys(socialProviders)
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
// User fields
|
|
61
|
+
user: {
|
|
62
|
+
additionalFields: {
|
|
63
|
+
role: {
|
|
64
|
+
type: "string",
|
|
65
|
+
required: false,
|
|
66
|
+
defaultValue: "user"
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
// Advanced
|
|
71
|
+
advanced: {
|
|
72
|
+
useSecureCookies: config.advanced?.useSecureCookies ?? process.env.NODE_ENV === "production",
|
|
73
|
+
crossSubDomainCookies: {
|
|
74
|
+
enabled: false
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
// Plugins
|
|
78
|
+
plugins: [nextCookies()],
|
|
79
|
+
// Hooks
|
|
80
|
+
hooks: {
|
|
81
|
+
// Before hooks: email normalization
|
|
82
|
+
before: createAuthMiddleware(async (ctx) => {
|
|
83
|
+
if (ctx.path === "/sign-up/email") {
|
|
84
|
+
const body = ctx.body;
|
|
85
|
+
if (body?.email && typeof body.email === "string") {
|
|
86
|
+
ctx.body.email = body.email.toLowerCase();
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}),
|
|
90
|
+
// After hooks: user lifecycle events
|
|
91
|
+
after: createAuthMiddleware(async (ctx) => {
|
|
92
|
+
if (ctx.path.startsWith("/sign-in") || ctx.path.startsWith("/sign-up")) {
|
|
93
|
+
const newSession = ctx.context.newSession;
|
|
94
|
+
if (newSession?.user) {
|
|
95
|
+
const user = newSession.user;
|
|
96
|
+
const normalizedEmail = user.email?.toLowerCase();
|
|
97
|
+
if (normalizedEmail && user.email !== normalizedEmail) {
|
|
98
|
+
try {
|
|
99
|
+
await config.database.user.update({
|
|
100
|
+
where: { id: user.id },
|
|
101
|
+
data: { email: normalizedEmail }
|
|
102
|
+
});
|
|
103
|
+
} catch (hookError) {
|
|
104
|
+
config.logger?.warn?.(
|
|
105
|
+
"[CattoAuth] Email normalization failed",
|
|
106
|
+
{
|
|
107
|
+
userId: user.id,
|
|
108
|
+
error: hookError instanceof Error ? hookError.message : String(hookError)
|
|
109
|
+
}
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
if (config.hooks?.onUserCreated) {
|
|
114
|
+
try {
|
|
115
|
+
await config.hooks.onUserCreated(
|
|
116
|
+
{
|
|
117
|
+
id: user.id,
|
|
118
|
+
email: normalizedEmail || user.email,
|
|
119
|
+
name: user.name
|
|
120
|
+
},
|
|
121
|
+
config.database
|
|
122
|
+
);
|
|
123
|
+
} catch (hookError) {
|
|
124
|
+
config.logger?.warn?.("[CattoAuth] onUserCreated hook failed", {
|
|
125
|
+
userId: user.id,
|
|
126
|
+
error: hookError instanceof Error ? hookError.message : String(hookError)
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
})
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
async function getEnrichedSession(headers) {
|
|
136
|
+
try {
|
|
137
|
+
const baseSession = await auth.api.getSession({ headers });
|
|
138
|
+
if (!baseSession?.user) return null;
|
|
139
|
+
const userId = baseSession.user.id;
|
|
140
|
+
const enrichment = config.hooks?.enrichSession ? await config.hooks.enrichSession(userId, config.database) : {};
|
|
141
|
+
return {
|
|
142
|
+
user: {
|
|
143
|
+
id: baseSession.user.id,
|
|
144
|
+
email: baseSession.user.email,
|
|
145
|
+
name: baseSession.user.name,
|
|
146
|
+
image: baseSession.user.image,
|
|
147
|
+
...enrichment
|
|
148
|
+
},
|
|
149
|
+
session: baseSession.session
|
|
150
|
+
};
|
|
151
|
+
} catch {
|
|
152
|
+
return null;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
return { auth, getEnrichedSession };
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export { createCattoAuth };
|
|
159
|
+
//# sourceMappingURL=server.js.map
|
|
160
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/server/create-auth.ts"],"names":[],"mappings":";;;;;;AAoCA,IAAM,4BAAA,GAA+B,EAAA,GAAK,EAAA,GAAK,EAAA,GAAK,EAAA;AAa7C,SAAS,gBACd,MAAA,EACuB;AACvB,EAAA,MAAM,SAAA,GACJ,MAAA,CAAO,OAAA,EAAS,gBAAA,IAAoB,4BAAA;AAGtC,EAAA,MAAM,kBAGF,EAAC;AACL,EAAA,IAAI,MAAA,CAAO,iBAAiB,MAAA,EAAQ;AAClC,IAAA,eAAA,CAAgB,MAAA,GAAS,OAAO,eAAA,CAAgB,MAAA;AAAA,EAClD;AACA,EAAA,IAAI,MAAA,CAAO,iBAAiB,MAAA,EAAQ;AAClC,IAAA,eAAA,CAAgB,MAAA,GAAS,OAAO,eAAA,CAAgB,MAAA;AAAA,E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A,CAAM,aAAA,CAAc,MAAA,EAAQ,MAAA,CAAO,QAAQ,CAAA,GACxD,EAAC;AAEL,MAAA,OAAO;AAAA,QACL,IAAA,EAAM;AAAA,UACJ,EAAA,EAAI,YAAY,IAAA,CAAK,EAAA;AAAA,UACrB,KAAA,EAAO,YAAY,IAAA,CAAK,KAAA;AAAA,UACxB,IAAA,EAAM,YAAY,IAAA,CAAK,IAAA;AAAA,UACvB,KAAA,EAAO,YAAY,IAAA,CAAK,KAAA;AAAA,UACxB,GAAG;AAAA,SACL;AAAA,QACA,SAAS,WAAA,CAAY;AAAA,OACvB;AAAA,IACF,CAAA,CAAA,MAAQ;AACN,MAAA,OAAO,IAAA;AAAA,IACT;AAAA,EACF;AAEA,EAAA,OAAO,EAAE,MAAM,kBAAA,EAAmB;AACpC","file":"server.js","sourcesContent":["/**\n * @ccatto/react-auth/server - createCattoAuth Factory\n *\n * Creates a configured Better Auth instance with sensible defaults,\n * automatic email normalization, and pluggable hooks for\n * session enrichment and user lifecycle events.\n *\n * @example\n * ```typescript\n * import { createCattoAuth } from '@ccatto/react-auth/server';\n * import { prisma } from '@myapp/database';\n *\n * export const { auth, getEnrichedSession } = createCattoAuth({\n * database: prisma,\n * databaseProvider: 'postgresql',\n * secret: process.env.BETTER_AUTH_SECRET!,\n * baseURL: process.env.BETTER_AUTH_URL!,\n * hooks: {\n * enrichSession: async (userId, db) => {\n * // Return custom fields to merge into session.user\n * return { role: 'admin', customField: 'value' };\n * },\n * },\n * });\n * ```\n */\nimport { betterAuth } from 'better-auth';\nimport { prismaAdapter } from 'better-auth/adapters/prisma';\nimport { createAuthMiddleware } from 'better-auth/api';\nimport { nextCookies } from 'better-auth/next-js';\nimport type {\n CattoAuthServerConfig,\n CattoAuthSocialProvider,\n} from '../types/config';\n\n// Default: 69 days (matches common long-lived session configs)\nconst DEFAULT_TOKEN_EXPIRY_SECONDS = 69 * 24 * 60 * 60;\n\nexport interface CreateCattoAuthResult {\n /** The Better Auth instance (use for API routes) */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n auth: any;\n /**\n * Get enriched session with custom fields from hooks.enrichSession.\n * Call this instead of auth.api.getSession for full session data.\n */\n getEnrichedSession: (headers: Headers) => Promise<any | null>;\n}\n\nexport function createCattoAuth(\n config: CattoAuthServerConfig,\n): CreateCattoAuthResult {\n const expiresIn =\n config.session?.expiresInSeconds ?? DEFAULT_TOKEN_EXPIRY_SECONDS;\n\n // Build social providers config\n const socialProviders: Record<\n string,\n CattoAuthSocialProvider & { scope?: string[] }\n > = {};\n if (config.socialProviders?.google) {\n socialProviders.google = config.socialProviders.google;\n }\n if (config.socialProviders?.github) {\n socialProviders.github = config.socialProviders.github;\n }\n if (config.socialProviders?.facebook) {\n socialProviders.facebook = {\n ...config.socialProviders.facebook,\n scope: config.socialProviders.facebook.scope ?? [\n 'email',\n 'public_profile',\n ],\n };\n }\n\n const auth = betterAuth({\n // Database\n // Cast needed: prismaAdapter expects PrismaClient but we use a minimal interface for package portability\n database: prismaAdapter(\n config.database as Parameters<typeof prismaAdapter>[0],\n {\n provider: config.databaseProvider,\n },\n ),\n\n // Secret & URL\n secret: config.secret,\n baseURL: config.baseURL,\n\n // Email/password\n emailAndPassword: {\n enabled: config.emailAndPassword?.enabled ?? true,\n requireEmailVerification:\n config.emailAndPassword?.requireEmailVerification ?? false,\n },\n\n // Social providers\n socialProviders,\n\n // Session\n session: {\n expiresIn,\n cookieCache: {\n enabled: true,\n maxAge: expiresIn,\n },\n },\n\n // Account linking\n account: {\n accountLinking: {\n enabled: true,\n trustedProviders: Object.keys(socialProviders),\n },\n },\n\n // User fields\n user: {\n additionalFields: {\n role: {\n type: 'string' as const,\n required: false,\n defaultValue: 'user',\n },\n },\n },\n\n // Advanced\n advanced: {\n useSecureCookies:\n config.advanced?.useSecureCookies ??\n process.env.NODE_ENV === 'production',\n crossSubDomainCookies: {\n enabled: false,\n },\n },\n\n // Plugins\n plugins: [nextCookies()],\n\n // Hooks\n hooks: {\n // Before hooks: email normalization\n before: createAuthMiddleware(async (ctx) => {\n if (ctx.path === '/sign-up/email') {\n const body = ctx.body as { email?: string } | undefined;\n if (body?.email && typeof body.email === 'string') {\n (ctx.body as { email: string }).email = body.email.toLowerCase();\n }\n }\n }),\n\n // After hooks: user lifecycle events\n after: createAuthMiddleware(async (ctx) => {\n if (\n ctx.path.startsWith('/sign-in') ||\n ctx.path.startsWith('/sign-up')\n ) {\n const newSession = ctx.context.newSession;\n if (newSession?.user) {\n const user = newSession.user;\n\n // Normalize email in database if needed\n const normalizedEmail = user.email?.toLowerCase();\n if (normalizedEmail && user.email !== normalizedEmail) {\n try {\n await config.database.user.update({\n where: { id: user.id },\n data: { email: normalizedEmail },\n });\n } catch (hookError) {\n config.logger?.warn?.(\n '[CattoAuth] Email normalization failed',\n {\n userId: user.id,\n error:\n hookError instanceof Error\n ? hookError.message\n : String(hookError),\n },\n );\n }\n }\n\n // Call onUserCreated hook\n if (config.hooks?.onUserCreated) {\n try {\n await config.hooks.onUserCreated(\n {\n id: user.id,\n email: normalizedEmail || user.email,\n name: user.name,\n },\n config.database,\n );\n } catch (hookError) {\n config.logger?.warn?.('[CattoAuth] onUserCreated hook failed', {\n userId: user.id,\n error:\n hookError instanceof Error\n ? hookError.message\n : String(hookError),\n });\n }\n }\n }\n }\n }),\n },\n });\n\n // Enriched session factory\n async function getEnrichedSession(headers: Headers): Promise<any | null> {\n try {\n const baseSession = await auth.api.getSession({ headers });\n if (!baseSession?.user) return null;\n\n const userId = baseSession.user.id;\n\n // Call enrichSession hook if provided\n const enrichment = config.hooks?.enrichSession\n ? await config.hooks.enrichSession(userId, config.database)\n : {};\n\n return {\n user: {\n id: baseSession.user.id,\n email: baseSession.user.email,\n name: baseSession.user.name,\n image: baseSession.user.image,\n ...enrichment,\n },\n session: baseSession.session,\n };\n } catch {\n return null;\n }\n }\n\n return { auth, getEnrichedSession };\n}\n"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ccatto/react-auth",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Catto Auth - React/Next.js authentication with Better Auth, JWT, and mobile support",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "Chris Catto",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"react",
|
|
9
|
+
"nextjs",
|
|
10
|
+
"authentication",
|
|
11
|
+
"better-auth",
|
|
12
|
+
"typescript",
|
|
13
|
+
"catto"
|
|
14
|
+
],
|
|
15
|
+
"homepage": "https://github.com/ccatto/catto-packages/tree/main/packages/react-auth",
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "https://github.com/ccatto/catto-packages.git",
|
|
19
|
+
"directory": "packages/react-auth"
|
|
20
|
+
},
|
|
21
|
+
"publishConfig": {
|
|
22
|
+
"access": "public"
|
|
23
|
+
},
|
|
24
|
+
"type": "module",
|
|
25
|
+
"exports": {
|
|
26
|
+
".": {
|
|
27
|
+
"types": "./dist/index.d.ts",
|
|
28
|
+
"import": "./dist/index.js",
|
|
29
|
+
"require": "./dist/index.cjs"
|
|
30
|
+
},
|
|
31
|
+
"./server": {
|
|
32
|
+
"types": "./dist/server.d.ts",
|
|
33
|
+
"import": "./dist/server.js",
|
|
34
|
+
"require": "./dist/server.cjs"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"main": "./dist/index.cjs",
|
|
38
|
+
"module": "./dist/index.js",
|
|
39
|
+
"types": "./dist/index.d.ts",
|
|
40
|
+
"files": [
|
|
41
|
+
"dist"
|
|
42
|
+
],
|
|
43
|
+
"scripts": {
|
|
44
|
+
"build": "tsup",
|
|
45
|
+
"clean": "rimraf dist",
|
|
46
|
+
"dev": "tsup --watch",
|
|
47
|
+
"test": "vitest run",
|
|
48
|
+
"test:cov": "vitest run --coverage",
|
|
49
|
+
"test:watch": "vitest",
|
|
50
|
+
"typecheck": "tsc --noEmit"
|
|
51
|
+
},
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"@types/react": "^19.0.0",
|
|
54
|
+
"better-auth": "^1.2.8",
|
|
55
|
+
"glob": "^13.0.0",
|
|
56
|
+
"next": "^16.0.0",
|
|
57
|
+
"react": "^19.0.0",
|
|
58
|
+
"rimraf": "^6.0.0",
|
|
59
|
+
"tsup": "^8.0.0",
|
|
60
|
+
"typescript": "^5.7.0",
|
|
61
|
+
"zustand": "^5.0.0"
|
|
62
|
+
},
|
|
63
|
+
"peerDependencies": {
|
|
64
|
+
"better-auth": ">=1.0.0",
|
|
65
|
+
"next": ">=14.0.0",
|
|
66
|
+
"react": ">=18.0.0",
|
|
67
|
+
"zustand": ">=4.0.0",
|
|
68
|
+
"@apollo/client": ">=3.0.0",
|
|
69
|
+
"@capacitor/core": ">=5.0.0",
|
|
70
|
+
"@capacitor/preferences": ">=5.0.0",
|
|
71
|
+
"@simplewebauthn/browser": ">=13.0.0",
|
|
72
|
+
"graphql": ">=16.0.0"
|
|
73
|
+
},
|
|
74
|
+
"peerDependenciesMeta": {
|
|
75
|
+
"@apollo/client": {
|
|
76
|
+
"optional": true
|
|
77
|
+
},
|
|
78
|
+
"@capacitor/core": {
|
|
79
|
+
"optional": true
|
|
80
|
+
},
|
|
81
|
+
"@capacitor/preferences": {
|
|
82
|
+
"optional": true
|
|
83
|
+
},
|
|
84
|
+
"@simplewebauthn/browser": {
|
|
85
|
+
"optional": true
|
|
86
|
+
},
|
|
87
|
+
"graphql": {
|
|
88
|
+
"optional": true
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|