@nexusts/auth 0.9.6 → 0.9.8

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.
@@ -23,17 +23,19 @@
23
23
  * Most of the actual logic is delegated to `auth.handler` from
24
24
  * better-auth. The controller exists to make the routes visible to
25
25
  * `nx route:list` and to add NexusTS-style DI.
26
+ *
27
+ * Uses standard decorator patterns: field injection and `ctx.req.*`
28
+ * methods instead of legacy `@Req()`/`@Body()`/`@Res()` parameter
29
+ * decorators.
26
30
  */
27
31
  import type { Context } from "hono";
28
- import { AuthService } from "./auth.service.js";
29
32
  export declare class AuthController {
30
33
  private readonly auth;
31
- constructor(auth: AuthService);
32
34
  /**
33
35
  * GET /api/auth/session
34
36
  * Returns the current session (or null if unauthenticated).
35
37
  */
36
- session(c: Context): Promise<Response & import("hono").TypedResponse<{
38
+ session(ctx: Context): Promise<Response & import("hono").TypedResponse<{
37
39
  user: {
38
40
  [x: string]: import("hono/utils/types").JSONValue;
39
41
  id: string;
@@ -60,34 +62,34 @@ export declare class AuthController {
60
62
  * POST /api/auth/sign-up/email
61
63
  * Body: { email, password, name, callbackURL? }
62
64
  */
63
- signUpEmail(c: Context, body: any): Promise<Response & import("hono").TypedResponse<any, 201, "json">>;
65
+ signUpEmail(ctx: Context): Promise<Response & import("hono").TypedResponse<any, 201, "json">>;
64
66
  /**
65
67
  * POST /api/auth/sign-in/email
66
68
  * Body: { email, password, callbackURL? }
67
69
  */
68
- signInEmail(c: Context, body: any): Promise<Response & import("hono").TypedResponse<any, import("hono/utils/http-status").ContentfulStatusCode, "json">>;
70
+ signInEmail(ctx: Context): Promise<Response & import("hono").TypedResponse<any, import("hono/utils/http-status").ContentfulStatusCode, "json">>;
69
71
  /**
70
72
  * POST /api/auth/sign-out
71
73
  */
72
- signOut(c: Context, _res: Response): Promise<Response & import("hono").TypedResponse<{
74
+ signOut(ctx: Context): Promise<Response & import("hono").TypedResponse<{
73
75
  ok: true;
74
76
  }, import("hono/utils/http-status").ContentfulStatusCode, "json">>;
75
77
  /**
76
78
  * GET /api/auth/sign-in/:provider
77
79
  * Returns a redirect to the social provider's auth page.
78
80
  */
79
- socialSignIn(c: Context, _body: never): Promise<Response & import("hono").TypedResponse<any, import("hono/utils/http-status").ContentfulStatusCode, "json">>;
81
+ socialSignIn(ctx: Context): Promise<Response & import("hono").TypedResponse<any, import("hono/utils/http-status").ContentfulStatusCode, "json">>;
80
82
  /**
81
83
  * GET /api/auth/callback/:provider
82
84
  * Social provider redirect target. The better-auth handler does the
83
85
  * real work; this is a passthrough for `route:list` visibility.
84
86
  */
85
- oauthCallback(c: Context): Promise<Response & import("hono").TypedResponse<any, import("hono/utils/http-status").ContentfulStatusCode, "json">>;
87
+ oauthCallback(ctx: Context): Promise<Response & import("hono").TypedResponse<any, import("hono/utils/http-status").ContentfulStatusCode, "json">>;
86
88
  /**
87
89
  * POST /api/auth/jwt
88
90
  * Issues a JWT for the current user. Requires the JWT plugin.
89
91
  */
90
- issueJwt(c: Context): Promise<(Response & import("hono").TypedResponse<{
92
+ issueJwt(ctx: Context): Promise<(Response & import("hono").TypedResponse<{
91
93
  error: string;
92
94
  }, 401, "json">) | (Response & import("hono").TypedResponse<{
93
95
  token: string;
@@ -97,10 +99,10 @@ export declare class AuthController {
97
99
  * POST /api/auth/passkey/register
98
100
  * Start passkey registration. Requires the passkey plugin.
99
101
  */
100
- passkeyRegister(c: Context): Promise<Response & import("hono").TypedResponse<import("hono/utils/types").JSONValue, import("hono/utils/http-status").ContentfulStatusCode, "json">>;
102
+ passkeyRegister(ctx: Context): Promise<Response & import("hono").TypedResponse<import("hono/utils/types").JSONValue, import("hono/utils/http-status").ContentfulStatusCode, "json">>;
101
103
  /**
102
104
  * POST /api/auth/passkey/authenticate
103
105
  * Body: passkey assertion
104
106
  */
105
- passkeyAuthenticate(c: Context, body: any): Promise<Response & import("hono").TypedResponse<import("hono/utils/types").JSONValue, import("hono/utils/http-status").ContentfulStatusCode, "json">>;
107
+ passkeyAuthenticate(ctx: Context): Promise<Response & import("hono").TypedResponse<import("hono/utils/types").JSONValue, import("hono/utils/http-status").ContentfulStatusCode, "json">>;
106
108
  }
@@ -8,23 +8,28 @@
8
8
  * - Allows tests to swap the implementation via DI.
9
9
  *
10
10
  * Usage:
11
- * constructor(@Inject(AuthService.TOKEN) private auth: AuthService) {}
11
+ * @Inject(AuthService.TOKEN) declare private auth: AuthService;
12
12
  *
13
13
  * await this.auth.signUp.email({ email, password, name });
14
14
  * const session = await this.auth.getSession({ headers: c.req.raw.headers });
15
15
  * return this.auth.redirect('/dashboard'); // 302
16
16
  */
17
- import type { AuthUser, AuthSessionRecord, AuthSession, AuthConfig } from "./types.js";
17
+ import type { AuthUser, AuthSessionRecord, AuthSession } from "./types.js";
18
18
  import { type NexusAuth } from "./auth.js";
19
19
  import type { SessionService } from "@nexusts/session";
20
20
  export declare class AuthService {
21
21
  #private;
22
- private readonly config;
23
22
  /** DI token — use with `@Inject(AuthService.TOKEN)`. */
24
23
  static readonly TOKEN: unique symbol;
24
+ /** Auth configuration — injected by the DI container. */
25
+ private readonly config;
25
26
  /** The underlying better-auth instance. */
26
- readonly instance: NexusAuth;
27
- constructor(config: AuthConfig);
27
+ private _instance;
28
+ /**
29
+ * Returns the underlying better-auth instance (lazy-initialized).
30
+ */
31
+ get instance(): NexusAuth;
32
+ constructor();
28
33
  /**
29
34
  * Bind a SessionService. When bound, `getSession()` consults the
30
35
  * SessionService first and falls back to better-auth. Returns `this`
package/dist/index.js CHANGED
@@ -9,7 +9,6 @@ var __legacyDecorateClassTS = function(decorators, target, key, desc) {
9
9
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
10
10
  return c > 3 && r && Object.defineProperty(target, key, r), r;
11
11
  };
12
- var __legacyDecorateParamTS = (index, decorator) => (target, key) => decorator(target, key, index);
13
12
  var __legacyMetadataTS = (k, v) => {
14
13
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
15
14
  return Reflect.metadata(k, v);
@@ -81,14 +80,16 @@ function createAuth(config = {}) {
81
80
  // packages/auth/src/auth.service.ts
82
81
  import { Inject, Injectable } from "@nexusts/core";
83
82
  class AuthService {
84
- config;
85
83
  static TOKEN = Symbol.for("nexus:AuthService");
86
- instance;
87
- #sessionService = null;
88
- constructor(config) {
89
- this.config = config;
90
- this.instance = createAuth(this.config);
84
+ _instance = null;
85
+ get instance() {
86
+ if (!this._instance) {
87
+ this._instance = createAuth(this.config);
88
+ }
89
+ return this._instance;
91
90
  }
91
+ #sessionService = null;
92
+ constructor() {}
92
93
  bindSession(sessionService) {
93
94
  this.#sessionService = sessionService;
94
95
  return this;
@@ -189,12 +190,12 @@ class AuthService {
189
190
  return { user: session.user, session: session.session };
190
191
  }
191
192
  }
193
+ __legacyDecorateClassTS([
194
+ Inject("AUTH_CONFIG")
195
+ ], AuthService.prototype, "config", undefined);
192
196
  AuthService = __legacyDecorateClassTS([
193
197
  Injectable(),
194
- __legacyDecorateParamTS(0, Inject("AUTH_CONFIG")),
195
- __legacyMetadataTS("design:paramtypes", [
196
- typeof AuthConfig === "undefined" ? Object : AuthConfig
197
- ])
198
+ __legacyMetadataTS("design:paramtypes", [])
198
199
  ], AuthService);
199
200
  function parseCookie(cookieHeader, name) {
200
201
  if (!cookieHeader)
@@ -212,77 +213,70 @@ function parseCookie(cookieHeader, name) {
212
213
  return null;
213
214
  }
214
215
  // packages/auth/src/auth.controller.ts
215
- import {
216
- Body,
217
- Controller,
218
- Get,
219
- Inject as Inject2,
220
- Post,
221
- Req,
222
- Res
223
- } from "@nexusts/core";
216
+ import { Controller, Get, Inject as Inject2, Post } from "@nexusts/core";
224
217
  class AuthController {
225
- auth;
226
- constructor(auth) {
227
- this.auth = auth;
228
- }
229
- async session(c) {
218
+ async session(ctx) {
230
219
  const session = await this.auth.getSession({
231
- headers: c.req.raw.headers
220
+ headers: ctx.req.raw.headers
232
221
  });
233
- return c.json(session ?? { user: null, session: null });
222
+ return ctx.json(session ?? { user: null, session: null });
234
223
  }
235
- async signUpEmail(c, body) {
224
+ async signUpEmail(ctx) {
225
+ const body = await ctx.req.json();
236
226
  const result = await this.auth.signUp(body);
237
- return c.json(result, 201);
227
+ return ctx.json(result, 201);
238
228
  }
239
- async signInEmail(c, body) {
229
+ async signInEmail(ctx) {
230
+ const body = await ctx.req.json();
240
231
  const result = await this.auth.signIn(body);
241
- return c.json(result);
232
+ return ctx.json(result);
242
233
  }
243
- async signOut(c, _res) {
244
- await this.auth.signOut({ headers: c.req.raw.headers });
245
- return c.json({ ok: true });
234
+ async signOut(ctx) {
235
+ await this.auth.signOut({ headers: ctx.req.raw.headers });
236
+ return ctx.json({ ok: true });
246
237
  }
247
- async socialSignIn(c, _body) {
248
- const provider = c.req.param("provider") ?? "";
249
- const callbackURL = c.req.query("callbackURL") ?? "/";
238
+ async socialSignIn(ctx) {
239
+ const provider = ctx.req.param("provider") ?? "";
240
+ const callbackURL = ctx.req.query("callbackURL") ?? "/";
250
241
  const result = await this.auth.getOAuthUrl({ provider, callbackURL });
251
- return c.json(result);
242
+ return ctx.json(result);
252
243
  }
253
- async oauthCallback(c) {
244
+ async oauthCallback(ctx) {
254
245
  const result = await this.auth.handleOAuthCallback({
255
- headers: c.req.raw.headers,
256
- query: c.req.query()
246
+ headers: ctx.req.raw.headers,
247
+ query: ctx.req.query()
257
248
  });
258
- return c.json(result);
249
+ return ctx.json(result);
259
250
  }
260
- async issueJwt(c) {
251
+ async issueJwt(ctx) {
261
252
  const session = await this.auth.getSession({
262
- headers: c.req.raw.headers
253
+ headers: ctx.req.raw.headers
263
254
  });
264
255
  if (!session)
265
- return c.json({ error: "Unauthorized" }, 401);
256
+ return ctx.json({ error: "Unauthorized" }, 401);
266
257
  const token = await this.auth.issueJwt({ userId: session.user.id });
267
- return c.json(token);
258
+ return ctx.json(token);
268
259
  }
269
- async passkeyRegister(c) {
260
+ async passkeyRegister(ctx) {
270
261
  const result = await this.auth.registerPasskey({
271
- headers: c.req.raw.headers
262
+ headers: ctx.req.raw.headers
272
263
  });
273
- return c.json(result);
264
+ return ctx.json(result);
274
265
  }
275
- async passkeyAuthenticate(c, body) {
266
+ async passkeyAuthenticate(ctx) {
267
+ const body = await ctx.req.json();
276
268
  const result = await this.auth.authenticatePasskey({
277
- headers: c.req.raw.headers,
269
+ headers: ctx.req.raw.headers,
278
270
  body
279
271
  });
280
- return c.json(result);
272
+ return ctx.json(result);
281
273
  }
282
274
  }
275
+ __legacyDecorateClassTS([
276
+ Inject2(AuthService.TOKEN)
277
+ ], AuthController.prototype, "auth", undefined);
283
278
  __legacyDecorateClassTS([
284
279
  Get("/session"),
285
- __legacyDecorateParamTS(0, Req()),
286
280
  __legacyMetadataTS("design:type", Function),
287
281
  __legacyMetadataTS("design:paramtypes", [
288
282
  typeof Context === "undefined" ? Object : Context
@@ -291,51 +285,38 @@ __legacyDecorateClassTS([
291
285
  ], AuthController.prototype, "session", null);
292
286
  __legacyDecorateClassTS([
293
287
  Post("/sign-up/email"),
294
- __legacyDecorateParamTS(0, Req()),
295
- __legacyDecorateParamTS(1, Body()),
296
288
  __legacyMetadataTS("design:type", Function),
297
289
  __legacyMetadataTS("design:paramtypes", [
298
- typeof Context === "undefined" ? Object : Context,
299
- Object
290
+ typeof Context === "undefined" ? Object : Context
300
291
  ]),
301
292
  __legacyMetadataTS("design:returntype", Promise)
302
293
  ], AuthController.prototype, "signUpEmail", null);
303
294
  __legacyDecorateClassTS([
304
295
  Post("/sign-in/email"),
305
- __legacyDecorateParamTS(0, Req()),
306
- __legacyDecorateParamTS(1, Body()),
307
296
  __legacyMetadataTS("design:type", Function),
308
297
  __legacyMetadataTS("design:paramtypes", [
309
- typeof Context === "undefined" ? Object : Context,
310
- Object
298
+ typeof Context === "undefined" ? Object : Context
311
299
  ]),
312
300
  __legacyMetadataTS("design:returntype", Promise)
313
301
  ], AuthController.prototype, "signInEmail", null);
314
302
  __legacyDecorateClassTS([
315
303
  Post("/sign-out"),
316
- __legacyDecorateParamTS(0, Req()),
317
- __legacyDecorateParamTS(1, Res()),
318
304
  __legacyMetadataTS("design:type", Function),
319
305
  __legacyMetadataTS("design:paramtypes", [
320
- typeof Context === "undefined" ? Object : Context,
321
- typeof Response === "undefined" ? Object : Response
306
+ typeof Context === "undefined" ? Object : Context
322
307
  ]),
323
308
  __legacyMetadataTS("design:returntype", Promise)
324
309
  ], AuthController.prototype, "signOut", null);
325
310
  __legacyDecorateClassTS([
326
311
  Get("/sign-in/:provider"),
327
- __legacyDecorateParamTS(0, Req()),
328
- __legacyDecorateParamTS(1, Body()),
329
312
  __legacyMetadataTS("design:type", Function),
330
313
  __legacyMetadataTS("design:paramtypes", [
331
- typeof Context === "undefined" ? Object : Context,
332
- undefined
314
+ typeof Context === "undefined" ? Object : Context
333
315
  ]),
334
316
  __legacyMetadataTS("design:returntype", Promise)
335
317
  ], AuthController.prototype, "socialSignIn", null);
336
318
  __legacyDecorateClassTS([
337
319
  Get("/callback/:provider"),
338
- __legacyDecorateParamTS(0, Req()),
339
320
  __legacyMetadataTS("design:type", Function),
340
321
  __legacyMetadataTS("design:paramtypes", [
341
322
  typeof Context === "undefined" ? Object : Context
@@ -344,7 +325,6 @@ __legacyDecorateClassTS([
344
325
  ], AuthController.prototype, "oauthCallback", null);
345
326
  __legacyDecorateClassTS([
346
327
  Post("/jwt"),
347
- __legacyDecorateParamTS(0, Req()),
348
328
  __legacyMetadataTS("design:type", Function),
349
329
  __legacyMetadataTS("design:paramtypes", [
350
330
  typeof Context === "undefined" ? Object : Context
@@ -353,7 +333,6 @@ __legacyDecorateClassTS([
353
333
  ], AuthController.prototype, "issueJwt", null);
354
334
  __legacyDecorateClassTS([
355
335
  Post("/passkey/register"),
356
- __legacyDecorateParamTS(0, Req()),
357
336
  __legacyMetadataTS("design:type", Function),
358
337
  __legacyMetadataTS("design:paramtypes", [
359
338
  typeof Context === "undefined" ? Object : Context
@@ -362,21 +341,14 @@ __legacyDecorateClassTS([
362
341
  ], AuthController.prototype, "passkeyRegister", null);
363
342
  __legacyDecorateClassTS([
364
343
  Post("/passkey/authenticate"),
365
- __legacyDecorateParamTS(0, Req()),
366
- __legacyDecorateParamTS(1, Body()),
367
344
  __legacyMetadataTS("design:type", Function),
368
345
  __legacyMetadataTS("design:paramtypes", [
369
- typeof Context === "undefined" ? Object : Context,
370
- Object
346
+ typeof Context === "undefined" ? Object : Context
371
347
  ]),
372
348
  __legacyMetadataTS("design:returntype", Promise)
373
349
  ], AuthController.prototype, "passkeyAuthenticate", null);
374
350
  AuthController = __legacyDecorateClassTS([
375
- Controller("/api/auth"),
376
- __legacyDecorateParamTS(0, Inject2(AuthService.TOKEN)),
377
- __legacyMetadataTS("design:paramtypes", [
378
- typeof AuthService === "undefined" ? Object : AuthService
379
- ])
351
+ Controller("/api/auth")
380
352
  ], AuthController);
381
353
  // packages/auth/src/auth.module.ts
382
354
  import { Module } from "@nexusts/core";
@@ -492,5 +464,5 @@ export {
492
464
  AuthController
493
465
  };
494
466
 
495
- //# debugId=7EDCCD5DCE9F451764756E2164756E21
467
+ //# debugId=96CFDD82525FD1DA64756E2164756E21
496
468
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -3,13 +3,13 @@
3
3
  "sources": ["../src/auth.ts", "../src/auth.service.ts", "../src/auth.controller.ts", "../src/auth.module.ts", "../src/middleware.ts", "../src/decorators/current-user.ts"],
4
4
  "sourcesContent": [
5
5
  "/**\n * `createAuth()` — wrap better-auth's `betterAuth()` factory with\n * NexusTS-friendly defaults.\n *\n * This is the **only** place that talks to better-auth directly. Every\n * other NexusTS auth module consumes the resulting `Auth` instance via\n * DI or the registered token.\n *\n * Why an adapter layer instead of calling `betterAuth()` directly?\n * 1. NexusTS users write `auth.config.ts`, not raw better-auth options.\n * The adapter translates between the two.\n * 2. Plugin selection (jwt, passkey) is toggled by boolean flags,\n * not by importing plugin objects.\n * 3. Cookie / CORS / cross-subdomain defaults match Hono's `cors()`\n * middleware so the two never conflict.\n *\n * Usage:\n * // src/auth/auth.ts\n * import { createAuth } from '@nexusts/auth';\n * export const auth = createAuth({\n * basePath: '/api/auth',\n * emailAndPassword: { enabled: true },\n * socialProviders: {\n * github: {\n * clientId: process.env.GITHUB_CLIENT_ID!,\n * clientSecret: process.env.GITHUB_CLIENT_SECRET!,\n * },\n * },\n * });\n */\n\nimport { betterAuth } from \"better-auth\";\nimport type { AuthConfig } from \"./types.js\";\n\ntype BetterAuthInstance = ReturnType<typeof betterAuth>;\n\n/**\n * Create a better-auth instance with NexusTS-friendly defaults.\n *\n * @param config NexusTS-shaped config (see types.ts).\n * @returns A `better-auth` Auth instance.\n */\nexport function createAuth(config: AuthConfig = {}): BetterAuthInstance {\n\tconst secret = config.secret ?? process.env.BETTER_AUTH_SECRET;\n\tconst baseURL = config.baseUrl ?? process.env.BETTER_AUTH_URL;\n\n\tif (!secret) {\n\t\tthrow new Error(\n\t\t\t\"[nexus/auth] BETTER_AUTH_SECRET is required. \" +\n\t\t\t\t\"Generate one with `openssl rand -base64 32` and add it to .env.\",\n\t\t);\n\t}\n\tif (!baseURL) {\n\t\tthrow new Error(\n\t\t\t\"[nexus/auth] BETTER_AUTH_URL is required (e.g. http://localhost:3000).\",\n\t\t);\n\t}\n\n\tconst plugins: Array<unknown> = [];\n\n\t// JWT plugin — opt-in.\n\tif (config.jwt?.enabled) {\n\t\t// Lazy import so the plugin's transitive dependencies don't load\n\t\t// when the user hasn't asked for JWT.\n\t\t// eslint-disable-next-line @typescript-eslint/no-require-imports\n\t\tconst { jwt } = require(\"better-auth/plugins\");\n\t\tplugins.push(\n\t\t\tjwt({\n\t\t\t\tjwks: {\n\t\t\t\t\tpath: config.jwt.jwksPath ?? \"/api/auth/jwks\",\n\t\t\t\t},\n\t\t\t\tissuer: config.jwt.issuer ?? baseURL,\n\t\t\t\taudience: config.jwt.audience ?? baseURL,\n\t\t\t\texpiresIn: config.jwt.expiresIn ?? 60 * 15,\n\t\t\t}),\n\t\t);\n\t}\n\n\t// Passkey plugin — opt-in.\n\tif (config.passkey?.enabled) {\n\t\t// eslint-disable-next-line @typescript-eslint/no-require-imports\n\t\tconst { passkey } = require(\"better-auth/plugins\");\n\t\tplugins.push(\n\t\t\tpasskey({\n\t\t\t\trpName: config.passkey.rpName,\n\t\t\t\trpID: config.passkey.rpId,\n\t\t\t\torigin: config.passkey.origin,\n\t\t\t}),\n\t\t);\n\t}\n\n\treturn betterAuth({\n\t\tsecret,\n\t\tbaseURL,\n\t\tbasePath: config.basePath ?? \"/api/auth\",\n\t\temailAndPassword: {\n\t\t\tenabled: config.emailAndPassword?.enabled ?? true,\n\t\t\trequireEmailVerification:\n\t\t\t\tconfig.emailAndPassword?.requireEmailVerification ?? false,\n\t\t\tminPasswordLength: config.emailAndPassword?.minPasswordLength ?? 8,\n\t\t\tmaxPasswordLength: config.emailAndPassword?.maxPasswordLength ?? 128,\n\t\t},\n\t\tsession: {\n\t\t\texpiresIn: config.sessionExpiresInSeconds ?? 60 * 60 * 24 * 7, // 7 days\n\t\t},\n\t\tsocialProviders: config.socialProviders as never,\n\t\tadvanced: {\n\t\t\tcookies: {\n\t\t\t\tsessionToken: {\n\t\t\t\t\tattributes: {\n\t\t\t\t\t\tsameSite: (config.cookieSameSite ?? \"lax\") as\n\t\t\t\t\t\t\t| \"lax\"\n\t\t\t\t\t\t\t| \"strict\"\n\t\t\t\t\t\t\t| \"none\",\n\t\t\t\t\t\tsecure:\n\t\t\t\t\t\t\tconfig.cookieSecure ?? process.env.NODE_ENV === \"production\",\n\t\t\t\t\t\t...(config.cookieDomain ? { domain: config.cookieDomain } : {}),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\tcrossSubDomainCookies: config.crossSubDomainCookies?.enabled\n\t\t\t\t? {\n\t\t\t\t\t\tenabled: true,\n\t\t\t\t\t\tdomain: config.crossSubDomainCookies.domain,\n\t\t\t\t\t}\n\t\t\t\t: undefined,\n\t\t},\n\t\tplugins,\n\t} as never) as unknown as BetterAuthInstance;\n}\n\n/**\n * Type alias for the returned auth instance — convenient for DI token\n * typings.\n */\nexport type NexusAuth = ReturnType<typeof createAuth>;\n",
6
- "/**\n * `AuthService` — DI-friendly wrapper around a better-auth instance.\n *\n * Why a service wrapper?\n * - Hides the raw better-auth object behind a stable NexusTS API.\n * - Exposes the high-level operations controllers need:\n * signUp, signIn, signOut, getSession, oauthUrl, jwt, passkey.\n * - Allows tests to swap the implementation via DI.\n *\n * Usage:\n * constructor(@Inject(AuthService.TOKEN) private auth: AuthService) {}\n *\n * await this.auth.signUp.email({ email, password, name });\n * const session = await this.auth.getSession({ headers: c.req.raw.headers });\n * return this.auth.redirect('/dashboard'); // 302\n */\n\nimport { Inject, Injectable } from \"@nexusts/core\";\nimport type {\n\tAuthUser,\n\tAuthSessionRecord,\n\tAuthSession,\n\tAuthConfig,\n} from \"./types.js\";\nimport { createAuth, type NexusAuth } from \"./auth.js\";\nimport type { SessionService } from \"@nexusts/session\";\n\n@Injectable()\nexport class AuthService {\n\t/** DI token — use with `@Inject(AuthService.TOKEN)`. */\n\tstatic readonly TOKEN = Symbol.for(\"nexus:AuthService\");\n\n\t/** The underlying better-auth instance. */\n\treadonly instance: NexusAuth;\n\n\t/**\n\t * Optional SessionService binding. When set, `getSession()` will\n\t * first check the SessionService's cookie before falling back to\n\t * better-auth. This enables shared session state between the two\n\t * modules (e.g. flash messages, guest cart).\n\t *\n\t * Set via `bindSession()` from a feature module's `onInit`, or via\n\t * DI when both modules are present.\n\t */\n\t#sessionService: SessionService | null = null;\n\n\tconstructor(\n\t\t@Inject(\"AUTH_CONFIG\") private readonly config: AuthConfig,\n\t) {\n\t\t// Lazy: defer construction to the first call so module-load\n\t\t// order doesn't matter.\n\t\tthis.instance = createAuth(this.config);\n\t}\n\n\t// ===========================================================================\n\t// Session integration\n\t// ===========================================================================\n\n\t/**\n\t * Bind a SessionService. When bound, `getSession()` consults the\n\t * SessionService first and falls back to better-auth. Returns `this`\n\t * for chaining.\n\t */\n\tbindSession(sessionService: SessionService): this {\n\t\tthis.#sessionService = sessionService;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Returns true when a SessionService has been bound.\n\t */\n\thasSessionBinding(): boolean {\n\t\treturn this.#sessionService !== null;\n\t}\n\n\t// ===========================================================================\n\t// Session\n\t// ===========================================================================\n\n\t/**\n\t * Get the current session from a request. Returns `null` if not\n\t * authenticated.\n\t *\n\t * When a SessionService is bound, we try it first (cookie-based,\n\t * stateless, edge-friendly); better-auth remains the source of\n\t * truth for `user` / `session` records. The cookie value carries\n\t * `userId` which lets you cross-reference both systems.\n\t */\n\tasync getSession(input: { headers: Headers }): Promise<AuthSession> {\n\t\t// 1) Try SessionService (cookie-based) first.\n\t\tif (this.#sessionService) {\n\t\t\tconst cookieName = this.#sessionService.cookieName;\n\t\t\tif (cookieName) {\n\t\t\t\tconst cookieHeader = input.headers.get(\"cookie\") ?? \"\";\n\t\t\t\tconst value = parseCookie(cookieHeader, cookieName);\n\t\t\t\tif (value) {\n\t\t\t\t\tconst decoded = this.#sessionService.decodeCookie(value);\n\t\t\t\t\tif (decoded?.userId) {\n\t\t\t\t\t\t// Hydrate the user from better-auth (so the returned\n\t\t\t\t\t\t// shape matches what controllers expect).\n\t\t\t\t\t\tconst fromBetterAuth = (await this.instance.api.getSession({\n\t\t\t\t\t\t\theaders: input.headers,\n\t\t\t\t\t\t})) as AuthSession | null;\n\t\t\t\t\t\tif (fromBetterAuth?.user) {\n\t\t\t\t\t\t\treturn fromBetterAuth;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// 2) Fallback to better-auth.\n\t\tconst result = await this.instance.api.getSession({\n\t\t\theaders: input.headers,\n\t\t});\n\t\treturn result as AuthSession;\n\t}\n\n\t/**\n\t * Read the raw SessionService record from a request (no better-auth\n\t * lookup). Returns null when no SessionService is bound or no\n\t * session is found.\n\t */\n\tasync getRawSession(input: { headers: Headers }) {\n\t\tif (!this.#sessionService) return null;\n\t\tconst cookieName = this.#sessionService.cookieName;\n\t\tif (!cookieName) return null;\n\t\tconst cookieHeader = input.headers.get(\"cookie\") ?? \"\";\n\t\tconst value = parseCookie(cookieHeader, cookieName);\n\t\tif (!value) return null;\n\t\treturn this.#sessionService.decodeCookie(value);\n\t}\n\n\t// ===========================================================================\n\t// Sign up / Sign in / Sign out\n\t// ===========================================================================\n\n\t/**\n\t * Email + password sign-up. Throws if email/password is disabled\n\t * in the auth config.\n\t */\n\tasync signUp(input: {\n\t\temail: string;\n\t\tpassword: string;\n\t\tname: string;\n\t\timage?: string;\n\t\tcallbackURL?: string;\n\t}) {\n\t\treturn this.instance.api.signUpEmail({\n\t\t\tbody: input as never,\n\t\t});\n\t}\n\n\t/** Email + password sign-in. */\n\tasync signIn(input: { email: string; password: string; callbackURL?: string }) {\n\t\treturn this.instance.api.signInEmail({\n\t\t\tbody: input as never,\n\t\t});\n\t}\n\n\t/** Sign out — invalidates the current session. */\n\tasync signOut(input: { headers: Headers }) {\n\t\treturn this.instance.api.signOut({\n\t\t\theaders: input.headers,\n\t\t});\n\t}\n\n\t// ===========================================================================\n\t// Social / OAuth\n\t// ===========================================================================\n\n\t/**\n\t * Get the URL the client should redirect to for a social sign-in.\n\t */\n\tasync getOAuthUrl(input: {\n\t\tprovider: string;\n\t\tcallbackURL?: string;\n\t}) {\n\t\treturn this.instance.api.signInSocial({\n\t\t\tbody: input as never,\n\t\t});\n\t}\n\n\t/**\n\t * Sign in / link a social account and return the user.\n\t */\n\tasync handleOAuthCallback(input: { headers: Headers; query: Record<string, string> }) {\n\t\treturn this.instance.api.signInSocial({\n\t\t\theaders: input.headers,\n\t\t\tquery: input.query,\n\t\t\tbody: {} as never,\n\t\t});\n\t}\n\n\t// ===========================================================================\n\t// JWT\n\t// ===========================================================================\n\n\t/**\n\t * Issue a JWT for the currently-authenticated user. Returns\n\t * `{ token, expiresAt }`. Requires the JWT plugin (`config.jwt.enabled`).\n\t */\n\tasync issueJwt(input: { userId: string }) {\n\t\tconst api = this.instance.api as unknown as {\n\t\t\tsignJWT?: (input: { body: { userId: string } }) => Promise<{\n\t\t\t\ttoken: string;\n\t\t\t\texpiresAt: Date;\n\t\t\t}>;\n\t\t};\n\t\tif (!api.signJWT) {\n\t\t\tthrow new Error(\n\t\t\t\t\"[nexus/auth] JWT plugin not enabled. Set `auth.jwt.enabled: true` in nx.config.ts.\",\n\t\t\t);\n\t\t}\n\t\treturn api.signJWT({ body: { userId: input.userId } });\n\t}\n\n\t// ===========================================================================\n\t// Passkey\n\t// ===========================================================================\n\n\tasync registerPasskey(input: { headers: Headers }) {\n\t\tconst api = this.instance.api as unknown as {\n\t\t\tpasskey?: {\n\t\t\t\tregister: (input: { headers: Headers }) => Promise<unknown>;\n\t\t\t};\n\t\t};\n\t\tif (!api.passkey) {\n\t\t\tthrow new Error(\n\t\t\t\t\"[nexus/auth] Passkey plugin not enabled. Set `auth.passkey.enabled: true` in nx.config.ts.\",\n\t\t\t);\n\t\t}\n\t\treturn api.passkey.register({ headers: input.headers });\n\t}\n\n\tasync authenticatePasskey(input: { headers: Headers; body: unknown }) {\n\t\tconst api = this.instance.api as unknown as {\n\t\t\tpasskey?: {\n\t\t\t\tauthenticate: (input: { headers: Headers; body: unknown }) => Promise<unknown>;\n\t\t\t};\n\t\t};\n\t\tif (!api.passkey) {\n\t\t\tthrow new Error(\"[nexus/auth] Passkey plugin not enabled.\");\n\t\t}\n\t\treturn api.passkey.authenticate({ headers: input.headers, body: input.body });\n\t}\n\n\t// ===========================================================================\n\t// Helpers\n\t// ===========================================================================\n\n\t/**\n\t * Build a redirect Response. Used by controllers that need to send\n\t * the user to a different page after sign-in / sign-up.\n\t */\n\tredirect(to: string, status: 302 | 303 | 307 | 308 = 302): Response {\n\t\treturn new Response(null, { status, headers: { Location: to } });\n\t}\n\n\t/**\n\t * Convert a session into the `AuthVariables` shape Hono expects.\n\t */\n\ttoContextVariables(session: AuthSession): {\n\t\tuser: AuthUser | null;\n\t\tsession: AuthSessionRecord | null;\n\t} {\n\t\tif (!session) return { user: null, session: null };\n\t\treturn { user: session.user, session: session.session };\n\t}\n}\n\n/**\n * Extract a single cookie value from a `Cookie` header string.\n * Tiny helper to avoid pulling in a cookie-parsing dependency.\n */\nfunction parseCookie(cookieHeader: string, name: string): string | null {\n\tif (!cookieHeader) return null;\n\tconst parts = cookieHeader.split(\";\");\n\tfor (const part of parts) {\n\t\tconst eq = part.indexOf(\"=\");\n\t\tif (eq < 0) continue;\n\t\tconst k = part.slice(0, eq).trim();\n\t\tif (k === name) {\n\t\t\treturn decodeURIComponent(part.slice(eq + 1).trim());\n\t\t}\n\t}\n\treturn null;\n}",
7
- "/**\n * `AuthController` — built-in controller exposing common auth endpoints.\n *\n * Mount it in any `@Module` to get a working auth API:\n *\n * @Module({\n * controllers: [AuthController],\n * providers: [AuthService],\n * })\n * export class AuthModule {}\n *\n * Endpoints (all prefixed with `config.basePath`, default `/api/auth`):\n * - GET /session → current session\n * - POST /sign-up/email → email/password registration\n * - POST /sign-in/email → email/password login\n * - POST /sign-out → invalidate session\n * - GET /sign-in/:provider → start OAuth flow\n * - GET /callback/:provider → OAuth callback\n * - POST /jwt → issue JWT (JWT plugin only)\n * - POST /passkey/register → start passkey registration\n * - POST /passkey/authenticate → complete passkey auth\n *\n * Most of the actual logic is delegated to `auth.handler` from\n * better-auth. The controller exists to make the routes visible to\n * `nx route:list` and to add NexusTS-style DI.\n */\n\nimport {\n\tBody,\n\tController,\n\tGet,\n\tInject,\n\tPost,\n\tReq,\n\tRes,\n} from \"@nexusts/core\";\nimport type { Context } from \"hono\";\nimport { AuthService } from \"./auth.service.js\";\nimport type { AuthSession } from \"./types.js\";\n\n@Controller(\"/api/auth\")\nexport class AuthController {\n\tconstructor(@Inject(AuthService.TOKEN) private readonly auth: AuthService) {}\n\n\t/**\n\t * GET /api/auth/session\n\t * Returns the current session (or null if unauthenticated).\n\t */\n\t@Get(\"/session\")\n\tasync session(@Req() c: Context) {\n\t\tconst session: AuthSession = await this.auth.getSession({\n\t\t\theaders: c.req.raw.headers,\n\t\t});\n\t\treturn c.json(session ?? { user: null, session: null });\n\t}\n\n\t/**\n\t * POST /api/auth/sign-up/email\n\t * Body: { email, password, name, callbackURL? }\n\t */\n\t@Post(\"/sign-up/email\")\n\tasync signUpEmail(@Req() c: Context, @Body() body: any) {\n\t\tconst result = await this.auth.signUp(body);\n\t\treturn c.json(result, 201);\n\t}\n\n\t/**\n\t * POST /api/auth/sign-in/email\n\t * Body: { email, password, callbackURL? }\n\t */\n\t@Post(\"/sign-in/email\")\n\tasync signInEmail(@Req() c: Context, @Body() body: any) {\n\t\tconst result = await this.auth.signIn(body);\n\t\treturn c.json(result);\n\t}\n\n\t/**\n\t * POST /api/auth/sign-out\n\t */\n\t@Post(\"/sign-out\")\n\tasync signOut(@Req() c: Context, @Res() _res: Response) {\n\t\tawait this.auth.signOut({ headers: c.req.raw.headers });\n\t\treturn c.json({ ok: true });\n\t}\n\n\t/**\n\t * GET /api/auth/sign-in/:provider\n\t * Returns a redirect to the social provider's auth page.\n\t */\n\t@Get(\"/sign-in/:provider\")\n\tasync socialSignIn(\n\t\t@Req() c: Context,\n\t\t@Body() _body: never,\n\t) {\n\t\tconst provider = c.req.param(\"provider\") ?? \"\";\n\t\tconst callbackURL = c.req.query(\"callbackURL\") ?? \"/\";\n\t\tconst result = await this.auth.getOAuthUrl({ provider, callbackURL });\n\t\treturn c.json(result);\n\t}\n\n\t/**\n\t * GET /api/auth/callback/:provider\n\t * Social provider redirect target. The better-auth handler does the\n\t * real work; this is a passthrough for `route:list` visibility.\n\t */\n\t@Get(\"/callback/:provider\")\n\tasync oauthCallback(@Req() c: Context) {\n\t\tconst result = await this.auth.handleOAuthCallback({\n\t\t\theaders: c.req.raw.headers,\n\t\t\tquery: c.req.query() as Record<string, string>,\n\t\t});\n\t\treturn c.json(result);\n\t}\n\n\t/**\n\t * POST /api/auth/jwt\n\t * Issues a JWT for the current user. Requires the JWT plugin.\n\t */\n\t@Post(\"/jwt\")\n\tasync issueJwt(@Req() c: Context) {\n\t\tconst session = await this.auth.getSession({\n\t\t\theaders: c.req.raw.headers,\n\t\t});\n\t\tif (!session) return c.json({ error: \"Unauthorized\" }, 401);\n\t\tconst token = await this.auth.issueJwt({ userId: session.user.id });\n\t\treturn c.json(token);\n\t}\n\n\t/**\n\t * POST /api/auth/passkey/register\n\t * Start passkey registration. Requires the passkey plugin.\n\t */\n\t@Post(\"/passkey/register\")\n\tasync passkeyRegister(@Req() c: Context) {\n\t\tconst result = await this.auth.registerPasskey({\n\t\t\theaders: c.req.raw.headers,\n\t\t});\n\t\treturn c.json(result);\n\t}\n\n\t/**\n\t * POST /api/auth/passkey/authenticate\n\t * Body: passkey assertion\n\t */\n\t@Post(\"/passkey/authenticate\")\n\tasync passkeyAuthenticate(@Req() c: Context, @Body() body: any) {\n\t\tconst result = await this.auth.authenticatePasskey({\n\t\t\theaders: c.req.raw.headers,\n\t\t\tbody,\n\t\t});\n\t\treturn c.json(result);\n\t}\n}",
8
- "/**\n * `AuthModule` — drop-in module for adding auth to any NexusTS app.\n *\n * Usage:\n * // src/app/app.module.ts\n * @Module({\n * imports: [AuthModule.forRoot({ ... })],\n * })\n * export class AppModule {}\n *\n * The `forRoot` static factory builds a one-off `AuthModule` subclass\n * pre-configured with the user's `auth` config. The provider token\n * `'AUTH_CONFIG'` carries the config to the `AuthService` constructor.\n *\n * AuthService is registered under **both** its class token and\n * `AuthService.TOKEN` (a Symbol). The class token is what the\n * container scans; the Symbol is what `@Inject(AuthService.TOKEN)`\n * looks up. Both resolve to the same instance via `useExisting`.\n */\n\nimport { Module } from \"@nexusts/core\";\nimport { AuthController } from \"./auth.controller.js\";\nimport { AuthService } from \"./auth.service.js\";\nimport type { AuthConfig } from \"./types.js\";\nimport { safeGetMeta, safeDefineMeta, safeHasMeta } from \"@nexusts/core/di/safe-reflect\";\n\n@Module({\n\tcontrollers: [AuthController],\n\tproviders: [\n\t\tAuthService,\n\t\t{ provide: AuthService.TOKEN, useExisting: AuthService },\n\t],\n\texports: [AuthService, AuthService.TOKEN],\n})\nexport class AuthModule {\n\t/**\n\t * Build a configured `AuthModule` class with the given config.\n\t *\n\t * The returned class can be `imports`-ed by any other module and\n\t * will provide the `AuthService` (and a `AUTH_CONFIG` value\n\t * provider) to its container.\n\t */\n\tstatic forRoot(config: AuthConfig) {\n\t\t@Module({\n\t\t\tcontrollers: [AuthController],\n\t\t\tproviders: [\n\t\t\t\tAuthService,\n\t\t\t\t{ provide: AuthService.TOKEN, useExisting: AuthService },\n\t\t\t\t{ provide: \"AUTH_CONFIG\", useValue: config },\n\t\t\t],\n\t\t\texports: [AuthService, AuthService.TOKEN],\n\t\t})\n\t\tclass ConfiguredAuthModule {}\n\n\t\t// Tag the dynamic class so the user can see where it came from.\n\t\tObject.defineProperty(ConfiguredAuthModule, \"name\", {\n\t\t\tvalue: \"ConfiguredAuthModule\",\n\t\t});\n\n\t\treturn ConfiguredAuthModule;\n\t}\n}\n",
6
+ "/**\n * `AuthService` — DI-friendly wrapper around a better-auth instance.\n *\n * Why a service wrapper?\n * - Hides the raw better-auth object behind a stable NexusTS API.\n * - Exposes the high-level operations controllers need:\n * signUp, signIn, signOut, getSession, oauthUrl, jwt, passkey.\n * - Allows tests to swap the implementation via DI.\n *\n * Usage:\n * @Inject(AuthService.TOKEN) declare private auth: AuthService;\n *\n * await this.auth.signUp.email({ email, password, name });\n * const session = await this.auth.getSession({ headers: c.req.raw.headers });\n * return this.auth.redirect('/dashboard'); // 302\n */\n\nimport { Inject, Injectable } from \"@nexusts/core\";\nimport type {\n\tAuthUser,\n\tAuthSessionRecord,\n\tAuthSession,\n\tAuthConfig,\n} from \"./types.js\";\nimport { createAuth, type NexusAuth } from \"./auth.js\";\nimport type { SessionService } from \"@nexusts/session\";\n\n@Injectable()\nexport class AuthService {\n\t/** DI token — use with `@Inject(AuthService.TOKEN)`. */\n\tstatic readonly TOKEN = Symbol.for(\"nexus:AuthService\");\n\n\t/** Auth configuration — injected by the DI container. */\n\t@Inject(\"AUTH_CONFIG\") declare private readonly config: AuthConfig;\n\n\t/** The underlying better-auth instance. */\n\tprivate _instance: NexusAuth | null = null;\n\n\t/**\n\t * Returns the underlying better-auth instance (lazy-initialized).\n\t */\n\tget instance(): NexusAuth {\n\t\tif (!this._instance) {\n\t\t\tthis._instance = createAuth(this.config);\n\t\t}\n\t\treturn this._instance;\n\t}\n\n\t/**\n\t * Optional SessionService binding. When set, `getSession()` will\n\t * first check the SessionService's cookie before falling back to\n\t * better-auth. This enables shared session state between the two\n\t * modules (e.g. flash messages, guest cart).\n\t *\n\t * Set via `bindSession()` from a feature module's `onInit`, or via\n\t * DI when both modules are present.\n\t */\n\t#sessionService: SessionService | null = null;\n\n\tconstructor() {\n\t\t// No constructor logic DI sets @Inject fields before first use.\n\t}\n\n\t// ===========================================================================\n\t// Session integration\n\t// ===========================================================================\n\n\t/**\n\t * Bind a SessionService. When bound, `getSession()` consults the\n\t * SessionService first and falls back to better-auth. Returns `this`\n\t * for chaining.\n\t */\n\tbindSession(sessionService: SessionService): this {\n\t\tthis.#sessionService = sessionService;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Returns true when a SessionService has been bound.\n\t */\n\thasSessionBinding(): boolean {\n\t\treturn this.#sessionService !== null;\n\t}\n\n\t// ===========================================================================\n\t// Session\n\t// ===========================================================================\n\n\t/**\n\t * Get the current session from a request. Returns `null` if not\n\t * authenticated.\n\t *\n\t * When a SessionService is bound, we try it first (cookie-based,\n\t * stateless, edge-friendly); better-auth remains the source of\n\t * truth for `user` / `session` records. The cookie value carries\n\t * `userId` which lets you cross-reference both systems.\n\t */\n\tasync getSession(input: { headers: Headers }): Promise<AuthSession> {\n\t\t// 1) Try SessionService (cookie-based) first.\n\t\tif (this.#sessionService) {\n\t\t\tconst cookieName = this.#sessionService.cookieName;\n\t\t\tif (cookieName) {\n\t\t\t\tconst cookieHeader = input.headers.get(\"cookie\") ?? \"\";\n\t\t\t\tconst value = parseCookie(cookieHeader, cookieName);\n\t\t\t\tif (value) {\n\t\t\t\t\tconst decoded = this.#sessionService.decodeCookie(value);\n\t\t\t\t\tif (decoded?.userId) {\n\t\t\t\t\t\t// Hydrate the user from better-auth (so the returned\n\t\t\t\t\t\t// shape matches what controllers expect).\n\t\t\t\t\t\tconst fromBetterAuth = (await this.instance.api.getSession({\n\t\t\t\t\t\t\theaders: input.headers,\n\t\t\t\t\t\t})) as AuthSession | null;\n\t\t\t\t\t\tif (fromBetterAuth?.user) {\n\t\t\t\t\t\t\treturn fromBetterAuth;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// 2) Fallback to better-auth.\n\t\tconst result = await this.instance.api.getSession({\n\t\t\theaders: input.headers,\n\t\t});\n\t\treturn result as AuthSession;\n\t}\n\n\t/**\n\t * Read the raw SessionService record from a request (no better-auth\n\t * lookup). Returns null when no SessionService is bound or no\n\t * session is found.\n\t */\n\tasync getRawSession(input: { headers: Headers }) {\n\t\tif (!this.#sessionService) return null;\n\t\tconst cookieName = this.#sessionService.cookieName;\n\t\tif (!cookieName) return null;\n\t\tconst cookieHeader = input.headers.get(\"cookie\") ?? \"\";\n\t\tconst value = parseCookie(cookieHeader, cookieName);\n\t\tif (!value) return null;\n\t\treturn this.#sessionService.decodeCookie(value);\n\t}\n\n\t// ===========================================================================\n\t// Sign up / Sign in / Sign out\n\t// ===========================================================================\n\n\t/**\n\t * Email + password sign-up. Throws if email/password is disabled\n\t * in the auth config.\n\t */\n\tasync signUp(input: {\n\t\temail: string;\n\t\tpassword: string;\n\t\tname: string;\n\t\timage?: string;\n\t\tcallbackURL?: string;\n\t}) {\n\t\treturn this.instance.api.signUpEmail({\n\t\t\tbody: input as never,\n\t\t});\n\t}\n\n\t/** Email + password sign-in. */\n\tasync signIn(input: { email: string; password: string; callbackURL?: string }) {\n\t\treturn this.instance.api.signInEmail({\n\t\t\tbody: input as never,\n\t\t});\n\t}\n\n\t/** Sign out — invalidates the current session. */\n\tasync signOut(input: { headers: Headers }) {\n\t\treturn this.instance.api.signOut({\n\t\t\theaders: input.headers,\n\t\t});\n\t}\n\n\t// ===========================================================================\n\t// Social / OAuth\n\t// ===========================================================================\n\n\t/**\n\t * Get the URL the client should redirect to for a social sign-in.\n\t */\n\tasync getOAuthUrl(input: {\n\t\tprovider: string;\n\t\tcallbackURL?: string;\n\t}) {\n\t\treturn this.instance.api.signInSocial({\n\t\t\tbody: input as never,\n\t\t});\n\t}\n\n\t/**\n\t * Sign in / link a social account and return the user.\n\t */\n\tasync handleOAuthCallback(input: { headers: Headers; query: Record<string, string> }) {\n\t\treturn this.instance.api.signInSocial({\n\t\t\theaders: input.headers,\n\t\t\tquery: input.query,\n\t\t\tbody: {} as never,\n\t\t});\n\t}\n\n\t// ===========================================================================\n\t// JWT\n\t// ===========================================================================\n\n\t/**\n\t * Issue a JWT for the currently-authenticated user. Returns\n\t * `{ token, expiresAt }`. Requires the JWT plugin (`config.jwt.enabled`).\n\t */\n\tasync issueJwt(input: { userId: string }) {\n\t\tconst api = this.instance.api as unknown as {\n\t\t\tsignJWT?: (input: { body: { userId: string } }) => Promise<{\n\t\t\t\ttoken: string;\n\t\t\t\texpiresAt: Date;\n\t\t\t}>;\n\t\t};\n\t\tif (!api.signJWT) {\n\t\t\tthrow new Error(\n\t\t\t\t\"[nexus/auth] JWT plugin not enabled. Set `auth.jwt.enabled: true` in nx.config.ts.\",\n\t\t\t);\n\t\t}\n\t\treturn api.signJWT({ body: { userId: input.userId } });\n\t}\n\n\t// ===========================================================================\n\t// Passkey\n\t// ===========================================================================\n\n\tasync registerPasskey(input: { headers: Headers }) {\n\t\tconst api = this.instance.api as unknown as {\n\t\t\tpasskey?: {\n\t\t\t\tregister: (input: { headers: Headers }) => Promise<unknown>;\n\t\t\t};\n\t\t};\n\t\tif (!api.passkey) {\n\t\t\tthrow new Error(\n\t\t\t\t\"[nexus/auth] Passkey plugin not enabled. Set `auth.passkey.enabled: true` in nx.config.ts.\",\n\t\t\t);\n\t\t}\n\t\treturn api.passkey.register({ headers: input.headers });\n\t}\n\n\tasync authenticatePasskey(input: { headers: Headers; body: unknown }) {\n\t\tconst api = this.instance.api as unknown as {\n\t\t\tpasskey?: {\n\t\t\t\tauthenticate: (input: { headers: Headers; body: unknown }) => Promise<unknown>;\n\t\t\t};\n\t\t};\n\t\tif (!api.passkey) {\n\t\t\tthrow new Error(\"[nexus/auth] Passkey plugin not enabled.\");\n\t\t}\n\t\treturn api.passkey.authenticate({ headers: input.headers, body: input.body });\n\t}\n\n\t// ===========================================================================\n\t// Helpers\n\t// ===========================================================================\n\n\t/**\n\t * Build a redirect Response. Used by controllers that need to send\n\t * the user to a different page after sign-in / sign-up.\n\t */\n\tredirect(to: string, status: 302 | 303 | 307 | 308 = 302): Response {\n\t\treturn new Response(null, { status, headers: { Location: to } });\n\t}\n\n\t/**\n\t * Convert a session into the `AuthVariables` shape Hono expects.\n\t */\n\ttoContextVariables(session: AuthSession): {\n\t\tuser: AuthUser | null;\n\t\tsession: AuthSessionRecord | null;\n\t} {\n\t\tif (!session) return { user: null, session: null };\n\t\treturn { user: session.user, session: session.session };\n\t}\n}\n\n/**\n * Extract a single cookie value from a `Cookie` header string.\n * Tiny helper to avoid pulling in a cookie-parsing dependency.\n */\nfunction parseCookie(cookieHeader: string, name: string): string | null {\n\tif (!cookieHeader) return null;\n\tconst parts = cookieHeader.split(\";\");\n\tfor (const part of parts) {\n\t\tconst eq = part.indexOf(\"=\");\n\t\tif (eq < 0) continue;\n\t\tconst k = part.slice(0, eq).trim();\n\t\tif (k === name) {\n\t\t\treturn decodeURIComponent(part.slice(eq + 1).trim());\n\t\t}\n\t}\n\treturn null;\n}",
7
+ "/**\n * `AuthController` — built-in controller exposing common auth endpoints.\n *\n * Mount it in any `@Module` to get a working auth API:\n *\n * @Module({\n * controllers: [AuthController],\n * providers: [AuthService],\n * })\n * export class AuthModule {}\n *\n * Endpoints (all prefixed with `config.basePath`, default `/api/auth`):\n * - GET /session → current session\n * - POST /sign-up/email → email/password registration\n * - POST /sign-in/email → email/password login\n * - POST /sign-out → invalidate session\n * - GET /sign-in/:provider → start OAuth flow\n * - GET /callback/:provider → OAuth callback\n * - POST /jwt → issue JWT (JWT plugin only)\n * - POST /passkey/register → start passkey registration\n * - POST /passkey/authenticate → complete passkey auth\n *\n * Most of the actual logic is delegated to `auth.handler` from\n * better-auth. The controller exists to make the routes visible to\n * `nx route:list` and to add NexusTS-style DI.\n *\n * Uses standard decorator patterns: field injection and `ctx.req.*`\n * methods instead of legacy `@Req()`/`@Body()`/`@Res()` parameter\n * decorators.\n */\n\nimport { Controller, Get, Inject, Post } from \"@nexusts/core\";\nimport type { Context } from \"hono\";\nimport { AuthService } from \"./auth.service.js\";\nimport type { AuthSession } from \"./types.js\";\n\n@Controller(\"/api/auth\")\nexport class AuthController {\n\t@Inject(AuthService.TOKEN) declare private readonly auth: AuthService;\n\n\t/**\n\t * GET /api/auth/session\n\t * Returns the current session (or null if unauthenticated).\n\t */\n\t@Get(\"/session\")\n\tasync session(ctx: Context) {\n\t\tconst session: AuthSession = await this.auth.getSession({\n\t\t\theaders: ctx.req.raw.headers,\n\t\t});\n\t\treturn ctx.json(session ?? { user: null, session: null });\n\t}\n\n\t/**\n\t * POST /api/auth/sign-up/email\n\t * Body: { email, password, name, callbackURL? }\n\t */\n\t@Post(\"/sign-up/email\")\n\tasync signUpEmail(ctx: Context) {\n\t\tconst body = await ctx.req.json<any>();\n\t\tconst result = await this.auth.signUp(body);\n\t\treturn ctx.json(result, 201);\n\t}\n\n\t/**\n\t * POST /api/auth/sign-in/email\n\t * Body: { email, password, callbackURL? }\n\t */\n\t@Post(\"/sign-in/email\")\n\tasync signInEmail(ctx: Context) {\n\t\tconst body = await ctx.req.json<any>();\n\t\tconst result = await this.auth.signIn(body);\n\t\treturn ctx.json(result);\n\t}\n\n\t/**\n\t * POST /api/auth/sign-out\n\t */\n\t@Post(\"/sign-out\")\n\tasync signOut(ctx: Context) {\n\t\tawait this.auth.signOut({ headers: ctx.req.raw.headers });\n\t\treturn ctx.json({ ok: true });\n\t}\n\n\t/**\n\t * GET /api/auth/sign-in/:provider\n\t * Returns a redirect to the social provider's auth page.\n\t */\n\t@Get(\"/sign-in/:provider\")\n\tasync socialSignIn(ctx: Context) {\n\t\tconst provider = ctx.req.param(\"provider\") ?? \"\";\n\t\tconst callbackURL = ctx.req.query(\"callbackURL\") ?? \"/\";\n\t\tconst result = await this.auth.getOAuthUrl({ provider, callbackURL });\n\t\treturn ctx.json(result);\n\t}\n\n\t/**\n\t * GET /api/auth/callback/:provider\n\t * Social provider redirect target. The better-auth handler does the\n\t * real work; this is a passthrough for `route:list` visibility.\n\t */\n\t@Get(\"/callback/:provider\")\n\tasync oauthCallback(ctx: Context) {\n\t\tconst result = await this.auth.handleOAuthCallback({\n\t\t\theaders: ctx.req.raw.headers,\n\t\t\tquery: ctx.req.query() as Record<string, string>,\n\t\t});\n\t\treturn ctx.json(result);\n\t}\n\n\t/**\n\t * POST /api/auth/jwt\n\t * Issues a JWT for the current user. Requires the JWT plugin.\n\t */\n\t@Post(\"/jwt\")\n\tasync issueJwt(ctx: Context) {\n\t\tconst session = await this.auth.getSession({\n\t\t\theaders: ctx.req.raw.headers,\n\t\t});\n\t\tif (!session) return ctx.json({ error: \"Unauthorized\" }, 401);\n\t\tconst token = await this.auth.issueJwt({ userId: session.user.id });\n\t\treturn ctx.json(token);\n\t}\n\n\t/**\n\t * POST /api/auth/passkey/register\n\t * Start passkey registration. Requires the passkey plugin.\n\t */\n\t@Post(\"/passkey/register\")\n\tasync passkeyRegister(ctx: Context) {\n\t\tconst result = await this.auth.registerPasskey({\n\t\t\theaders: ctx.req.raw.headers,\n\t\t});\n\t\treturn ctx.json(result);\n\t}\n\n\t/**\n\t * POST /api/auth/passkey/authenticate\n\t * Body: passkey assertion\n\t */\n\t@Post(\"/passkey/authenticate\")\n\tasync passkeyAuthenticate(ctx: Context) {\n\t\tconst body = await ctx.req.json<any>();\n\t\tconst result = await this.auth.authenticatePasskey({\n\t\t\theaders: ctx.req.raw.headers,\n\t\t\tbody,\n\t\t});\n\t\treturn ctx.json(result);\n\t}\n}\n",
8
+ "/**\n * `AuthModule` — drop-in module for adding auth to any NexusTS app.\n *\n * Usage:\n * // src/app/app.module.ts\n * @Module({\n * imports: [AuthModule.forRoot({ ... })],\n * })\n * export class AppModule {}\n *\n * The `forRoot` static factory builds a one-off `AuthModule` subclass\n * pre-configured with the user's `auth` config. The provider token\n * `'AUTH_CONFIG'` carries the config to the `AuthService` constructor.\n *\n * AuthService is registered under **both** its class token and\n * `AuthService.TOKEN` (a Symbol). The class token is what the\n * container scans; the Symbol is what `@Inject(AuthService.TOKEN)`\n * looks up. Both resolve to the same instance via `useExisting`.\n */\n\nimport { Module } from \"@nexusts/core\";\nimport { AuthController } from \"./auth.controller.js\";\nimport { AuthService } from \"./auth.service.js\";\nimport type { AuthConfig } from \"./types.js\";\n\n\n@Module({\n\tcontrollers: [AuthController],\n\tproviders: [\n\t\tAuthService,\n\t\t{ provide: AuthService.TOKEN, useExisting: AuthService },\n\t],\n\texports: [AuthService, AuthService.TOKEN],\n})\nexport class AuthModule {\n\t/**\n\t * Build a configured `AuthModule` class with the given config.\n\t *\n\t * The returned class can be `imports`-ed by any other module and\n\t * will provide the `AuthService` (and a `AUTH_CONFIG` value\n\t * provider) to its container.\n\t */\n\tstatic forRoot(config: AuthConfig) {\n\t\t@Module({\n\t\t\tcontrollers: [AuthController],\n\t\t\tproviders: [\n\t\t\t\tAuthService,\n\t\t\t\t{ provide: AuthService.TOKEN, useExisting: AuthService },\n\t\t\t\t{ provide: \"AUTH_CONFIG\", useValue: config },\n\t\t\t],\n\t\t\texports: [AuthService, AuthService.TOKEN],\n\t\t})\n\t\tclass ConfiguredAuthModule {}\n\n\t\t// Tag the dynamic class so the user can see where it came from.\n\t\tObject.defineProperty(ConfiguredAuthModule, \"name\", {\n\t\t\tvalue: \"ConfiguredAuthModule\",\n\t\t});\n\n\t\treturn ConfiguredAuthModule;\n\t}\n}\n",
9
9
  "/**\n * `authMiddleware` — populate `c.var.user` and `c.var.session` on\n * every request, optionally enforcing a \"must be logged in\" policy.\n *\n * This is a Hono middleware that wraps better-auth's `getSession`.\n * It runs after the better-auth handler has set its own cookies, so\n * subsequent reads are cheap (a single DB lookup).\n *\n * Three modes:\n * - optional → always allow; populate user/session if present\n * - required → 401 if no user\n * - scoped → require user only for paths matching a regex\n *\n * Usage:\n * import { authMiddleware } from '@nexusts/auth';\n * app.use('*', authMiddleware(auth, { mode: 'optional' }));\n * app.use('/api/*', authMiddleware(auth, { mode: 'required' }));\n */\n\nimport type { Auth } from \"better-auth\";\nimport type { Context, MiddlewareHandler, } from \"hono\";\nimport type { AuthVariables } from \"./types.js\";\n\nexport type AuthMiddlewareMode = \"optional\" | \"required\" | \"scoped\";\n\nexport interface AuthMiddlewareOptions {\n\t/** Auth mode. Default: `'optional'`. */\n\tmode?: AuthMiddlewareMode;\n\t/** Path matcher (only used in `'scoped'` mode). */\n\tscope?: RegExp;\n\t/** Path matcher for `'scoped'` mode's protected set. */\n\tprotectedPaths?: RegExp | RegExp[];\n\t/** Path matcher for paths that should be skipped entirely. */\n\tignoredPaths?: RegExp | RegExp[];\n\t/** Customize the 401 response. */\n\tonUnauthenticated?: (c: Context) => Response | Promise<Response>;\n\t/** Customize the 403 response when a scope check fails. */\n\tonForbidden?: (c: Context) => Response | Promise<Response>;\n}\n\nexport function authMiddleware(\n\tauth: Auth,\n\toptions: AuthMiddlewareOptions = {},\n): MiddlewareHandler<{ Variables: AuthVariables }> {\n\tconst {\n\t\tmode = \"optional\",\n\t\tscope,\n\t\tprotectedPaths,\n\t\tignoredPaths,\n\t\tonUnauthenticated = defaultUnauthenticated,\n\t} = options;\n\n\tconst ignored = toMatcher(ignoredPaths);\n\tconst protected_ =\n\t\tmode === \"scoped\"\n\t\t\t? toMatcher(scope ?? protectedPaths ?? /^\\/.+/) // everything\n\t\t\t: null;\n\n\treturn async (c, next) => {\n\t\tconst path = c.req.path;\n\n\t\t// Skip ignored paths entirely (e.g. health checks).\n\t\tif (ignored?.test(path)) {\n\t\t\treturn next();\n\t\t}\n\n\t\t// Populate the session.\n\t\tconst session = await auth.api.getSession({\n\t\t\theaders: c.req.raw.headers,\n\t\t});\n\n\t\tif (session) {\n\t\t\tc.set(\"user\", session.user as never);\n\t\t\tc.set(\"session\", session.session as never);\n\t\t} else {\n\t\t\tc.set(\"user\", null);\n\t\t\tc.set(\"session\", null);\n\t\t}\n\n\t\t// Apply mode.\n\t\tif (mode === \"required\" || (protected_?.test(path) && session === null)) {\n\t\t\tif (session === null) return onUnauthenticated(c);\n\t\t}\n\n\t\t// Scope-based forbidden check (e.g. \"user must have a specific role\").\n\t\t// Skipped here — the route handler can call `requireRole(...)` itself.\n\n\t\treturn next();\n\t};\n}\n\nfunction toMatcher(input?: RegExp | RegExp[]): RegExp | null {\n\tif (!input) return null;\n\tif (Array.isArray(input)) {\n\t\treturn new RegExp(input.map((r) => `(?:${r.source})`).join(\"|\"));\n\t}\n\treturn input;\n}\n\nfunction defaultUnauthenticated(c: Context): Response {\n\treturn c.json(\n\t\t{ error: \"Unauthorized\", message: \"Authentication required.\" },\n\t\t401,\n\t);\n}\n\n/**\n * `authHandler` — mount better-auth's catch-all handler at a path.\n *\n * Use this instead of writing the `app.on(['POST', 'GET'], path, ...)`\n * boilerplate yourself.\n *\n * app.use('/api/auth/*', cors({ ... }));\n * app.all('/api/auth/*', authHandler(auth));\n */\nexport function authHandler(auth: Auth): MiddlewareHandler {\n\treturn async (c) => auth.handler(c.req.raw);\n}\n",
10
10
  "/**\n * `@CurrentUser()` — controller parameter decorator that injects the\n * authenticated user (and optionally the session) into a handler.\n *\n * Usage:\n * @Get('/me')\n * me(@CurrentUser() user: AuthUser) {\n * return user;\n * }\n *\n * @Get('/profile')\n * profile(@CurrentUser({ session: true }) ctx: { user: AuthUser; session: AuthSessionRecord }) {\n * return ctx;\n * }\n *\n * @Get('/dashboard')\n * dashboard(@CurrentUser({ required: true }) user: AuthUser) {\n * // 401 is thrown before the handler if no user is present.\n * return this.dashboardService.forUser(user.id);\n * }\n */\n\nimport { createParamDecorator } from \"@nexusts/core\";\nimport { PARAM_TYPES } from \"@nexusts/core\";\nimport type { AuthUser, AuthSessionRecord } from \"../types.js\";\nimport { safeGetMeta, safeDefineMeta, safeHasMeta } from \"@nexusts/core/di/safe-reflect\";\n\nexport interface CurrentUserOptions {\n\t/**\n\t * Include the session in the injected value. Default: `false`.\n\t * When true, the value is `{ user, session }` instead of just the user.\n\t */\n\tsession?: boolean;\n\t/**\n\t * Throw 401 if no user is present. Default: `false`.\n\t * When true, the framework returns a 401 response without invoking\n\t * the handler.\n\t */\n\trequired?: boolean;\n\t/**\n\t * Throw 403 if the user does not satisfy the predicate.\n\t */\n\tassert?: (user: AuthUser) => boolean | Promise<boolean>;\n}\n\n/**\n * Inject the authenticated user (or `{ user, session }` if `session: true`).\n */\nexport function CurrentUser(\n\toptions: CurrentUserOptions = {},\n): ParameterDecorator {\n\treturn createParamDecorator(PARAM_TYPES.USER, options as never);\n}\n\n/**\n * Convenience: throw 401 with a JSON body when no user is present.\n * Exposed for users who want to enforce auth inside the handler.\n */\nexport class UnauthenticatedError extends Error {\n\treadonly status = 401;\n\tconstructor(message = \"Authentication required.\") {\n\t\tsuper(message);\n\t\tthis.name = \"UnauthenticatedError\";\n\t}\n}\n\nexport class ForbiddenError extends Error {\n\treadonly status = 403;\n\tconstructor(message = \"Insufficient permissions.\") {\n\t\tsuper(message);\n\t\tthis.name = \"ForbiddenError\";\n\t}\n}\n\n// Re-export session record type for convenience.\nexport type { AuthSessionRecord as AuthSession };\n"
11
11
  ],
12
- "mappings": ";;;;;;;;;;;;;;;;;;AA+BA;AAWO,SAAS,UAAU,CAAC,SAAqB,CAAC,GAAuB;AAAA,EACvE,MAAM,SAAS,OAAO,UAAU,QAAQ,IAAI;AAAA,EAC5C,MAAM,UAAU,OAAO,WAAW,QAAQ,IAAI;AAAA,EAE9C,IAAI,CAAC,QAAQ;AAAA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AS,WAAW,CAC1B,UAA8B,CAAC,GACV;AAAA,EACrB,OAAO,qBAAqB,YAAY,MAAM,OAAgB;AAAA;AAAA;AAOxD,MAAM,6BAA6B,MAAM;AAAA,EACtC,SAAS;AAAA,EAClB,WAAW,CAAC,UAAU,4BAA4B;AAAA,IACjD,MAAM,OAAO;AAAA,IACb,KAAK,OAAO;AAAA;AAEd;AAAA;AAEO,MAAM,uBAAuB,MAAM;AAAA,EAChC,SAAS;AAAA,EAClB,WAAW,CAAC,UAAU,6BAA6B;AAAA,IAClD,MAAM,OAAO;AAAA,IACb,KAAK,OAAO;AAAA;AAEd;",
13
+ "debugId": "96CFDD82525FD1DA64756E2164756E21",
14
14
  "names": []
15
15
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nexusts/auth",
3
- "version": "0.9.6",
3
+ "version": "0.9.8",
4
4
  "description": "Authentication via better-auth integration",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -34,7 +34,7 @@
34
34
  }
35
35
  },
36
36
  "dependencies": {
37
- "@nexusts/core": "^0.9.6"
37
+ "@nexusts/core": "^0.9.8"
38
38
  },
39
39
  "repository": {
40
40
  "type": "git",