@absolutejs/auth 0.61.0 → 0.63.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.
@@ -41,6 +41,13 @@ export type CredentialsConfig<UserType> = {
41
41
  onEmailVerified?: (context: {
42
42
  email: string;
43
43
  }) => void | Promise<void>;
44
+ /** Called (in the enumeration-safe default) when someone tries to register an
45
+ * email that already exists — send the real owner a "you already have an
46
+ * account, sign in" email out-of-band. Not called when
47
+ * `revealRegistrationConflicts` is true. */
48
+ onExistingAccount?: (context: {
49
+ email: string;
50
+ }) => void | Promise<void>;
44
51
  onPasswordReset?: (context: {
45
52
  email: string;
46
53
  }) => void | Promise<void>;
@@ -55,9 +62,17 @@ export type CredentialsConfig<UserType> = {
55
62
  * rejected until the email is verified. Default false = auto-login on register and
56
63
  * verification acts as a soft, later gate. */
57
64
  requireEmailVerification?: boolean;
65
+ /** When true, `POST /register` returns 409 "Email is already registered" for a
66
+ * known email. Default false = enumeration-safe: return the same generic
67
+ * response a new pending registration does and call `onExistingAccount`
68
+ * instead of confirming the account exists. */
69
+ revealRegistrationConflicts?: boolean;
58
70
  resetPasswordRoute?: RouteString;
59
71
  resetTokenDurationMs?: number;
60
72
  sessionDurationMs?: number;
73
+ /** When set, login/register reject requests whose `Origin` header is not in
74
+ * this list (defense against login/registration CSRF). Omit to disable. */
75
+ trustedOrigins?: readonly string[];
61
76
  verificationTokenDurationMs?: number;
62
77
  verifyEmailRoute?: RouteString;
63
78
  };
@@ -1,6 +1,6 @@
1
1
  import { Elysia } from 'elysia';
2
2
  import { type CredentialRouteProps } from './config';
3
- export declare const credentialsLogin: <UserType>({ authSessionStore, checkBreachesOnLogin, cookieSecure, credentialStore, getUserByEmail, isMfaRequired, lockoutGuard, loginRoute, onCredentialsLoginError, onCredentialsLoginSuccess, passwordVerifier, rehashOnLogin, requireEmailVerification, sessionDurationMs }: CredentialRouteProps<UserType>) => Elysia<"", {
3
+ export declare const credentialsLogin: <UserType>({ authSessionStore, checkBreachesOnLogin, cookieSecure, credentialStore, getUserByEmail, isMfaRequired, lockoutGuard, loginRoute, onCredentialsLoginError, onCredentialsLoginSuccess, passwordVerifier, rehashOnLogin, requireEmailVerification, sessionDurationMs, trustedOrigins }: CredentialRouteProps<UserType>) => Elysia<"", {
4
4
  decorator: {};
5
5
  store: {
6
6
  session: import("..").SessionRecord<UserType>;
@@ -30,7 +30,7 @@ export declare const credentialsLogin: <UserType>({ authSessionStore, checkBreac
30
30
  headers: unknown;
31
31
  response: {
32
32
  401: "Invalid email or password";
33
- 403: {
33
+ 403: "Request origin is not allowed" | {
34
34
  readonly status: "email_not_verified";
35
35
  };
36
36
  200: {
@@ -1,6 +1,6 @@
1
1
  import { Elysia } from 'elysia';
2
2
  import { type CredentialRouteProps } from './config';
3
- export declare const credentialsRegister: <UserType>({ authSessionStore, cookieSecure, credentialStore, onCreateCredentialUser, onCredentialsLoginSuccess, onRegistrationSuccess, onSendEmail, passwordPolicy, registerRoute, requireEmailVerification, sessionDurationMs, verificationTokenDurationMs }: CredentialRouteProps<UserType>) => Elysia<"", {
3
+ export declare const credentialsRegister: <UserType>({ authSessionStore, cookieSecure, credentialStore, onCreateCredentialUser, onCredentialsLoginSuccess, onExistingAccount, onRegistrationSuccess, onSendEmail, passwordPolicy, registerRoute, requireEmailVerification, revealRegistrationConflicts, sessionDurationMs, trustedOrigins, verificationTokenDurationMs }: CredentialRouteProps<UserType>) => Elysia<"", {
4
4
  decorator: {};
5
5
  store: {
6
6
  session: import("..").SessionRecord<UserType>;
@@ -98,7 +98,7 @@ export declare const credentialRoutes: <UserType>(config: CredentialRouteProps<U
98
98
  headers: unknown;
99
99
  response: {
100
100
  401: "Invalid email or password";
101
- 403: {
101
+ 403: "Request origin is not allowed" | {
102
102
  readonly status: "email_not_verified";
103
103
  };
104
104
  200: {
package/dist/csrf.d.ts ADDED
@@ -0,0 +1 @@
1
+ export declare const isTrustedOrigin: (request: Request, trustedOrigins?: readonly string[]) => boolean;
package/dist/index.d.ts CHANGED
@@ -815,7 +815,7 @@ export declare const createAuthApplications: <UserType>(configuration: AuthConfi
815
815
  headers: unknown;
816
816
  response: {
817
817
  401: "Invalid email or password";
818
- 403: {
818
+ 403: "Request origin is not allowed" | {
819
819
  readonly status: "email_not_verified";
820
820
  };
821
821
  200: {
@@ -3454,6 +3454,7 @@ export { createOAuthAccountLinkedProviderCredentialResolver, type OAuthLinkedPro
3454
3454
  export { createNeonLinkedProviderStores, createNeonOAuthLinkedProviderCredentialResolver } from './linkedProviders/neonStores';
3455
3455
  export { createInMemoryLinkedProviderStores } from './linkedProviders/inMemoryStores';
3456
3456
  export { protectRoutePlugin } from './routes/protectRoute';
3457
+ export { requireAuthPlugin } from './routes/requireAuth';
3457
3458
  export { sessionRoutes } from './routes/sessions';
3458
3459
  export { stepUpPlugin } from './routes/stepUp';
3459
3460
  export * from './session/sessionsConfig';
@@ -3468,6 +3469,7 @@ export { resolveAuthHtmxRenderers } from './htmx/renderers';
3468
3469
  export type { AuthHtmxConfig, AuthHtmxConnectorTarget, AuthHtmxProviderData, AuthHtmxProviderInfo, AuthHtmxRenderOverrides, AuthHtmxRenderersConfig, AuthHtmxUser, AuthIdentityPayload, LinkedProviderPayload } from './htmx/types';
3469
3470
  export * from './utils';
3470
3471
  export * from './redirect';
3472
+ export * from './csrf';
3471
3473
  export { buildClientProviders, resolveClientProviderEntry, resolveProviderClientConfiguration } from './providers/clients';
3472
3474
  export type { OAuth2TokenResponse, OAuth2Client, OAuth2ClientForConfig, CustomProviderCredentials, ProviderConfig, ProviderOption, PKCEProvider, OIDCProvider, RefreshableProvider, RevocableProvider, ScopeRequiredProvider, ProvidersMap, ProviderConfiguration, CredentialsFor } from 'citra';
3473
3475
  export { providers, providerOptions, createCustomOAuth2Client, defineProvider, refreshableProviderOptions, revocableProviderOptions, oidcProviderOptions, pkceProviderOptions, scopeRequiredProviderOptions, decodeJWT, extractPropFromIdentity, isValidProviderOption, isRefreshableOAuth2Client, isRefreshableProviderOption, isOIDCProviderOption, isPKCEProviderOption, isRevocableProviderOption, isRevocableOAuth2Client } from 'citra';
package/dist/index.js CHANGED
@@ -2982,7 +2982,7 @@ var createCustomOAuth2Client = (providerConfig, credentials) => buildOAuth2Clien
2982
2982
  var createOAuth2Client = (providerName, config) => buildOAuth2Client(providers[providerName], config);
2983
2983
 
2984
2984
  // src/index.ts
2985
- import { Elysia as Elysia45 } from "elysia";
2985
+ import { Elysia as Elysia46 } from "elysia";
2986
2986
 
2987
2987
  // src/apikeys/routes.ts
2988
2988
  import { Elysia, t } from "elysia";
@@ -5145,6 +5145,15 @@ init_constants();
5145
5145
  init_crypto();
5146
5146
  import { Elysia as Elysia11, t as t8 } from "elysia";
5147
5147
 
5148
+ // src/csrf.ts
5149
+ var isTrustedOrigin = (request, trustedOrigins) => {
5150
+ if (trustedOrigins === undefined || trustedOrigins.length === 0) {
5151
+ return true;
5152
+ }
5153
+ const origin = request.headers.get("origin");
5154
+ return origin !== null && trustedOrigins.includes(origin);
5155
+ };
5156
+
5148
5157
  // src/credentials/import.ts
5149
5158
  init_crypto();
5150
5159
  var normalizeEmail = (email) => email.trim().toLowerCase();
@@ -5349,7 +5358,8 @@ var credentialsLogin = ({
5349
5358
  passwordVerifier,
5350
5359
  rehashOnLogin = false,
5351
5360
  requireEmailVerification = false,
5352
- sessionDurationMs = DEFAULT_CREDENTIAL_SESSION_TTL_MS
5361
+ sessionDurationMs = DEFAULT_CREDENTIAL_SESSION_TTL_MS,
5362
+ trustedOrigins
5353
5363
  }) => new Elysia11().use(sessionStore()).post(loginRoute, async ({
5354
5364
  body: { email, password },
5355
5365
  cookie: { user_session_id },
@@ -5357,6 +5367,9 @@ var credentialsLogin = ({
5357
5367
  status,
5358
5368
  store: { session, unregisteredSession }
5359
5369
  }) => withSpan("auth.credentials.login", undefined, async (span) => {
5370
+ if (!isTrustedOrigin(request, trustedOrigins)) {
5371
+ return status("Forbidden", "Request origin is not allowed");
5372
+ }
5360
5373
  const headerBag = {};
5361
5374
  request.headers.forEach((value, key) => {
5362
5375
  headerBag[key] = value;
@@ -5514,19 +5527,26 @@ var credentialsRegister = ({
5514
5527
  credentialStore,
5515
5528
  onCreateCredentialUser,
5516
5529
  onCredentialsLoginSuccess,
5530
+ onExistingAccount,
5517
5531
  onRegistrationSuccess,
5518
5532
  onSendEmail,
5519
5533
  passwordPolicy,
5520
5534
  registerRoute = "/auth/register",
5521
5535
  requireEmailVerification = false,
5536
+ revealRegistrationConflicts = false,
5522
5537
  sessionDurationMs = DEFAULT_CREDENTIAL_SESSION_TTL_MS,
5538
+ trustedOrigins,
5523
5539
  verificationTokenDurationMs = DEFAULT_VERIFICATION_TOKEN_TTL_MS
5524
5540
  }) => new Elysia13().use(sessionStore()).post(registerRoute, async ({
5525
5541
  body: { email, password, ...extraFields },
5526
5542
  cookie: { user_session_id },
5543
+ request,
5527
5544
  status,
5528
5545
  store: { session }
5529
5546
  }) => withSpan("auth.credentials.register", undefined, async () => {
5547
+ if (!isTrustedOrigin(request, trustedOrigins)) {
5548
+ return status("Forbidden", "Request origin is not allowed");
5549
+ }
5530
5550
  const normalizedEmail = email.trim().toLowerCase();
5531
5551
  if (!normalizedEmail.includes("@")) {
5532
5552
  return status("Bad Request", "A valid email is required");
@@ -5540,7 +5560,13 @@ var credentialsRegister = ({
5540
5560
  }
5541
5561
  const existing = await credentialStore.getCredentialByEmail(normalizedEmail);
5542
5562
  if (existing) {
5543
- return status("Conflict", "Email is already registered");
5563
+ if (revealRegistrationConflicts) {
5564
+ return status("Conflict", "Email is already registered");
5565
+ }
5566
+ await onExistingAccount?.({ email: normalizedEmail });
5567
+ return status("Created", {
5568
+ status: "verification_required"
5569
+ });
5544
5570
  }
5545
5571
  const created = await onCreateCredentialUser({
5546
5572
  ...extraFields,
@@ -31506,6 +31532,21 @@ var createInMemoryLinkedProviderStores = (input = {}) => {
31506
31532
  };
31507
31533
  return { bindingStore, grantStore };
31508
31534
  };
31535
+ // src/routes/requireAuth.ts
31536
+ import { Elysia as Elysia41, t as t33 } from "elysia";
31537
+ var requireAuthPlugin = ({
31538
+ authSessionStore
31539
+ } = {}) => new Elysia41({
31540
+ name: "@absolutejs/auth/require-auth",
31541
+ seed: pluginDependencySeed(authSessionStore)
31542
+ }).use(sessionStore()).guard({ cookie: t33.Cookie({ user_session_id: userSessionIdTypebox }) }).resolve(async ({ store: { session }, cookie: { user_session_id } }) => {
31543
+ const { user } = await getStatusFromSource({
31544
+ authSessionStore,
31545
+ session,
31546
+ user_session_id
31547
+ });
31548
+ return { user: user ?? null };
31549
+ }).onBeforeHandle(({ user, status }) => user === null ? status("Unauthorized", "User is not authenticated") : undefined).as("global");
31509
31550
  // src/session/impersonation.ts
31510
31551
  init_constants();
31511
31552
  var DEFAULT_IMPERSONATION_TTL_MS = MILLISECONDS_IN_AN_HOUR;
@@ -32924,7 +32965,7 @@ var createInMemoryCredentialOfferStore = () => {
32924
32965
  };
32925
32966
  };
32926
32967
  // src/oidc/vciRoutes.ts
32927
- import { Elysia as Elysia41, t as t33 } from "elysia";
32968
+ import { Elysia as Elysia42, t as t34 } from "elysia";
32928
32969
  var HTTP_OK4 = 200;
32929
32970
  var HTTP_BAD_REQUEST4 = 400;
32930
32971
  var HTTP_UNAUTHORIZED5 = 401;
@@ -32949,7 +32990,7 @@ var vciRoutes = ({
32949
32990
  const credentialRoute = `${vciRoute}/credential`;
32950
32991
  const nonceRoute = `${vciRoute}/nonce`;
32951
32992
  const vciSigningKey = vciConfig.signingKey ?? signingKey;
32952
- return new Elysia41().get("/.well-known/openid-credential-issuer", () => Response.json(buildIssuerMetadata({
32993
+ return new Elysia42().get("/.well-known/openid-credential-issuer", () => Response.json(buildIssuerMetadata({
32953
32994
  config: vciConfig,
32954
32995
  issuer: issuerUrl,
32955
32996
  vciRoute
@@ -32972,11 +33013,11 @@ var vciRoutes = ({
32972
33013
  return errorBody(result.error, HTTP_BAD_REQUEST4);
32973
33014
  return Response.json({ credential: result.credential, format: result.format }, { status: HTTP_OK4 });
32974
33015
  }, {
32975
- body: t33.Object({
32976
- format: t33.Optional(t33.Union([t33.Literal("vc+sd-jwt")])),
32977
- proof: t33.Optional(t33.Object({
32978
- jwt: t33.String(),
32979
- proof_type: t33.Literal("jwt")
33016
+ body: t34.Object({
33017
+ format: t34.Optional(t34.Union([t34.Literal("vc+sd-jwt")])),
33018
+ proof: t34.Optional(t34.Object({
33019
+ jwt: t34.String(),
33020
+ proof_type: t34.Literal("jwt")
32980
33021
  }))
32981
33022
  })
32982
33023
  }).post(nonceRoute, async () => {
@@ -33098,7 +33139,7 @@ var verifyStatusListJwt = async ({
33098
33139
  };
33099
33140
  };
33100
33141
  // src/vc/statusListRoutes.ts
33101
- import { Elysia as Elysia42, t as t34 } from "elysia";
33142
+ import { Elysia as Elysia43, t as t35 } from "elysia";
33102
33143
  var HTTP_OK5 = 200;
33103
33144
  var HTTP_NOT_FOUND = 404;
33104
33145
  var DEFAULT_STATUS_ROUTE = "/vc/status";
@@ -33110,7 +33151,7 @@ var statusListRoutes = ({
33110
33151
  ttlSeconds
33111
33152
  }) => {
33112
33153
  const listRoute = `${statusRoute}/:listId`;
33113
- return new Elysia42().get(listRoute, async ({ params: { listId } }) => {
33154
+ return new Elysia43().get(listRoute, async ({ params: { listId } }) => {
33114
33155
  const bits = await getStatusList(listId);
33115
33156
  if (bits === undefined) {
33116
33157
  return new Response("Not found", { status: HTTP_NOT_FOUND });
@@ -33126,7 +33167,7 @@ var statusListRoutes = ({
33126
33167
  headers: { "content-type": STATUS_LIST_SUB_TYP },
33127
33168
  status: HTTP_OK5
33128
33169
  });
33129
- }, { params: t34.Object({ listId: t34.String() }) });
33170
+ }, { params: t35.Object({ listId: t35.String() }) });
33130
33171
  };
33131
33172
  // src/vc/openid4vp.ts
33132
33173
  init_crypto();
@@ -33331,7 +33372,7 @@ var createInMemoryPresentationRequestStore = () => {
33331
33372
  };
33332
33373
  };
33333
33374
  // src/vc/vpRoutes.ts
33334
- import { Elysia as Elysia43, t as t35 } from "elysia";
33375
+ import { Elysia as Elysia44, t as t36 } from "elysia";
33335
33376
  var HTTP_OK6 = 200;
33336
33377
  var HTTP_BAD_REQUEST5 = 400;
33337
33378
  var HTTP_NOT_FOUND2 = 404;
@@ -33350,7 +33391,7 @@ var vpRoutes = ({
33350
33391
  const authorizeRoute = `${vpRoute}/authorize`;
33351
33392
  const requestRoute = `${vpRoute}/request/:id`;
33352
33393
  const responseRoute = `${vpRoute}/response`;
33353
- return new Elysia43().post(authorizeRoute, async ({ body }) => {
33394
+ return new Elysia44().post(authorizeRoute, async ({ body }) => {
33354
33395
  const input = {
33355
33396
  clientId: body.client_id ?? defaultClientId,
33356
33397
  requestedClaims: body.requested_claims,
@@ -33368,10 +33409,10 @@ var vpRoutes = ({
33368
33409
  requestId: result.request.requestId
33369
33410
  }, { status: HTTP_OK6 });
33370
33411
  }, {
33371
- body: t35.Object({
33372
- client_id: t35.Optional(t35.String()),
33373
- requested_claims: t35.Array(t35.String()),
33374
- state: t35.Optional(t35.String())
33412
+ body: t36.Object({
33413
+ client_id: t36.Optional(t36.String()),
33414
+ requested_claims: t36.Array(t36.String()),
33415
+ state: t36.Optional(t36.String())
33375
33416
  })
33376
33417
  }).get(requestRoute, async ({ params: { id } }) => {
33377
33418
  const stored = await vpConfig.requestStore.getRequest(id);
@@ -33397,7 +33438,7 @@ var vpRoutes = ({
33397
33438
  },
33398
33439
  status: HTTP_OK6
33399
33440
  });
33400
- }, { params: t35.Object({ id: t35.String() }) }).post(responseRoute, async ({ body }) => {
33441
+ }, { params: t36.Object({ id: t36.String() }) }).post(responseRoute, async ({ body }) => {
33401
33442
  const requestId = body.state;
33402
33443
  if (requestId === undefined) {
33403
33444
  return errorBody2("missing_state", HTTP_BAD_REQUEST5);
@@ -33418,10 +33459,10 @@ var vpRoutes = ({
33418
33459
  verified: true
33419
33460
  }, { status: HTTP_OK6 });
33420
33461
  }, {
33421
- body: t35.Object({
33422
- presentation_submission: t35.Optional(t35.Unknown()),
33423
- state: t35.Optional(t35.String()),
33424
- vp_token: t35.String()
33462
+ body: t36.Object({
33463
+ presentation_submission: t36.Optional(t36.Unknown()),
33464
+ state: t36.Optional(t36.String()),
33465
+ vp_token: t36.String()
33425
33466
  })
33426
33467
  });
33427
33468
  };
@@ -36777,7 +36818,7 @@ var blockMigrations = {
36777
36818
  webhooks: initMigration("webhooks", [webhookDeliveriesTable])
36778
36819
  };
36779
36820
  // src/sso/samlIdpRoutes.ts
36780
- import { Elysia as Elysia44, t as t36 } from "elysia";
36821
+ import { Elysia as Elysia45, t as t37 } from "elysia";
36781
36822
  var HTTP_BAD_REQUEST6 = 400;
36782
36823
  var HTTP_UNAUTHORIZED6 = 401;
36783
36824
  var HTTP_FOUND2 = 302;
@@ -36887,19 +36928,19 @@ var samlIdpRoutes = ({
36887
36928
  user: userSession.user
36888
36929
  });
36889
36930
  };
36890
- return new Elysia44().use(sessionStore()).post(ssoIdpRoute, async ({ body, cookie: { user_session_id }, request, store }) => handleSpInitiated({
36931
+ return new Elysia45().use(sessionStore()).post(ssoIdpRoute, async ({ body, cookie: { user_session_id }, request, store }) => handleSpInitiated({
36891
36932
  binding: "POST",
36892
36933
  body,
36893
36934
  inMemorySession: store.session,
36894
36935
  request,
36895
36936
  userSessionIdValue: user_session_id.value
36896
36937
  }), {
36897
- body: t36.Object({
36898
- RelayState: t36.Optional(t36.String()),
36899
- SAMLRequest: t36.Optional(t36.String())
36938
+ body: t37.Object({
36939
+ RelayState: t37.Optional(t37.String()),
36940
+ SAMLRequest: t37.Optional(t37.String())
36900
36941
  }),
36901
- cookie: t36.Cookie({
36902
- user_session_id: t36.Optional(userSessionIdTypebox)
36942
+ cookie: t37.Cookie({
36943
+ user_session_id: t37.Optional(userSessionIdTypebox)
36903
36944
  })
36904
36945
  }).get(ssoIdpRoute, async ({ cookie: { user_session_id }, query, request, store }) => handleSpInitiated({
36905
36946
  binding: "Redirect",
@@ -36908,14 +36949,14 @@ var samlIdpRoutes = ({
36908
36949
  request,
36909
36950
  userSessionIdValue: user_session_id.value
36910
36951
  }), {
36911
- cookie: t36.Cookie({
36912
- user_session_id: t36.Optional(userSessionIdTypebox)
36952
+ cookie: t37.Cookie({
36953
+ user_session_id: t37.Optional(userSessionIdTypebox)
36913
36954
  }),
36914
- query: t36.Object({
36915
- RelayState: t36.Optional(t36.String()),
36916
- SAMLRequest: t36.Optional(t36.String()),
36917
- SigAlg: t36.Optional(t36.String()),
36918
- Signature: t36.Optional(t36.String())
36955
+ query: t37.Object({
36956
+ RelayState: t37.Optional(t37.String()),
36957
+ SAMLRequest: t37.Optional(t37.String()),
36958
+ SigAlg: t37.Optional(t37.String()),
36959
+ Signature: t37.Optional(t37.String())
36919
36960
  })
36920
36961
  }).get(idpInitiateRoute, async ({
36921
36962
  cookie: { user_session_id },
@@ -36951,12 +36992,12 @@ var samlIdpRoutes = ({
36951
36992
  user: userSession.user
36952
36993
  });
36953
36994
  }, {
36954
- cookie: t36.Cookie({
36955
- user_session_id: t36.Optional(userSessionIdTypebox)
36995
+ cookie: t37.Cookie({
36996
+ user_session_id: t37.Optional(userSessionIdTypebox)
36956
36997
  }),
36957
- query: t36.Object({
36958
- RelayState: t36.Optional(t36.String()),
36959
- sp: t36.Optional(t36.String())
36998
+ query: t37.Object({
36999
+ RelayState: t37.Optional(t37.String()),
37000
+ sp: t37.Optional(t37.String())
36960
37001
  })
36961
37002
  }).get(idpMetadataRoute, async ({ request }) => xmlResponse(await idpAdapter.getIdpMetadata({
36962
37003
  entityId: idpEntityId,
@@ -37405,7 +37446,7 @@ var buildAuthApplications = async (configuration) => {
37405
37446
  const auditedOnRevocationSuccess = auditEmit ? composeRevocationAudit(onRevocationSuccess, auditEmit) : onRevocationSuccess;
37406
37447
  const auditedOnSignOut = auditEmit ? composeSignOutAudit(onSignOut, auditEmit) : onSignOut;
37407
37448
  const pluginSeed = pluginDependencySeed(configuration);
37408
- const coreRoutes = new Elysia45({
37449
+ const coreRoutes = new Elysia46({
37409
37450
  name: "@absolutejs/auth/core-routes",
37410
37451
  seed: pluginSeed
37411
37452
  }).use([
@@ -37462,7 +37503,7 @@ var buildAuthApplications = async (configuration) => {
37462
37503
  profileRoute
37463
37504
  })
37464
37505
  ]);
37465
- const featureRoutes = new Elysia45({
37506
+ const featureRoutes = new Elysia46({
37466
37507
  name: "@absolutejs/auth/feature-routes",
37467
37508
  seed: pluginSeed
37468
37509
  }).use([
@@ -37471,64 +37512,64 @@ var buildAuthApplications = async (configuration) => {
37471
37512
  authSessionStore,
37472
37513
  cookieSecure: resolvedCookieSecure,
37473
37514
  lockoutGuard
37474
- }) : new Elysia45,
37515
+ }) : new Elysia46,
37475
37516
  auditedMfa ? mfaRoutes({
37476
37517
  ...auditedMfa,
37477
37518
  authSessionStore,
37478
37519
  cookieSecure: resolvedCookieSecure,
37479
37520
  verificationProvider
37480
- }) : new Elysia45,
37521
+ }) : new Elysia46,
37481
37522
  passwordless ? passwordlessRoutes({
37482
37523
  ...passwordless,
37483
37524
  authSessionStore,
37484
37525
  cookieSecure: resolvedCookieSecure,
37485
37526
  emit: auditEmit
37486
- }) : new Elysia45,
37487
- sessions ? sessionRoutes({ ...sessions, authSessionStore }) : new Elysia45,
37527
+ }) : new Elysia46,
37528
+ sessions ? sessionRoutes({ ...sessions, authSessionStore }) : new Elysia46,
37488
37529
  sso ? oidcSsoRoutes({
37489
37530
  ...sso,
37490
37531
  authSessionStore,
37491
37532
  cookieSecure: resolvedCookieSecure
37492
- }) : new Elysia45,
37533
+ }) : new Elysia46,
37493
37534
  sso && sso.samlAdapter ? samlSsoRoutes({
37494
37535
  ...sso,
37495
37536
  authSessionStore,
37496
37537
  cookieSecure: resolvedCookieSecure,
37497
37538
  samlAdapter: sso.samlAdapter
37498
- }) : new Elysia45,
37539
+ }) : new Elysia46,
37499
37540
  sso && sso.getOrganizationByEmailDomain ? ssoDiscoveryRoute({
37500
37541
  getOrganizationByEmailDomain: sso.getOrganizationByEmailDomain,
37501
37542
  ssoConnectionStore: sso.ssoConnectionStore,
37502
37543
  ssoRoute: sso.ssoRoute
37503
- }) : new Elysia45,
37504
- scim ? scimRoutes(scim) : new Elysia45,
37505
- apikeys ? apiKeysRoutes(apikeys) : new Elysia45,
37544
+ }) : new Elysia46,
37545
+ scim ? scimRoutes(scim) : new Elysia46,
37546
+ apikeys ? apiKeysRoutes(apikeys) : new Elysia46,
37506
37547
  oidcConfig ? oidcProviderRoutes({
37507
37548
  ...oidcConfig,
37508
37549
  authSessionStore
37509
- }) : new Elysia45,
37550
+ }) : new Elysia46,
37510
37551
  organizations ? organizationRoutes({
37511
37552
  ...organizations,
37512
37553
  authSessionStore,
37513
37554
  emit: auditEmit
37514
- }) : new Elysia45,
37555
+ }) : new Elysia46,
37515
37556
  roles ? roleRoutes({
37516
37557
  ...roles,
37517
37558
  authSessionStore,
37518
37559
  emit: auditEmit
37519
- }) : new Elysia45,
37520
- portal ? portalRoutes({ ...portal, emit: auditEmit }) : new Elysia45,
37560
+ }) : new Elysia46,
37561
+ portal ? portalRoutes({ ...portal, emit: auditEmit }) : new Elysia46,
37521
37562
  webauthn ? webauthnRoutes({
37522
37563
  ...webauthn,
37523
37564
  authSessionStore,
37524
37565
  cookieSecure: resolvedCookieSecure,
37525
37566
  emit: auditEmit
37526
- }) : new Elysia45,
37567
+ }) : new Elysia46,
37527
37568
  compliance ? complianceRoutes({
37528
37569
  ...compliance,
37529
37570
  authSessionStore,
37530
37571
  emit: auditEmit
37531
- }) : new Elysia45,
37572
+ }) : new Elysia46,
37532
37573
  createConfiguredAuthHtmxRoutes({ authSessionStore, config: htmx }),
37533
37574
  agentAuthRoutes(resolvedAgentAuth)
37534
37575
  ]);
@@ -37543,7 +37584,7 @@ var buildAuthApplications = async (configuration) => {
37543
37584
  };
37544
37585
  var auth = async (configuration) => {
37545
37586
  const { authContext, coreRoutes, featureRoutes } = await buildAuthApplications(configuration);
37546
- const application = new Elysia45({
37587
+ const application = new Elysia46({
37547
37588
  name: "@absolutejs/auth",
37548
37589
  seed: pluginDependencySeed(configuration)
37549
37590
  });
@@ -37646,6 +37687,7 @@ export {
37646
37687
  resolveAuthHtmxRenderers,
37647
37688
  resolveApiPrincipal,
37648
37689
  resolveAgentPrincipal,
37690
+ requireAuthPlugin,
37649
37691
  removeFromSessionRing,
37650
37692
  rehashCredentialPassword,
37651
37693
  registerClient,
@@ -37716,6 +37758,7 @@ export {
37716
37758
  isValidUser,
37717
37759
  isValidProviderOption,
37718
37760
  isUserSessionId,
37761
+ isTrustedOrigin,
37719
37762
  isSafeLocalPath,
37720
37763
  isRevocableProviderOption,
37721
37764
  isRevocableOAuth2Client,
@@ -38057,5 +38100,5 @@ export {
38057
38100
  AGENT_CLAIM_GRANT_TYPE
38058
38101
  };
38059
38102
 
38060
- //# debugId=60AF00D018199BB164756E2164756E21
38103
+ //# debugId=A719E0625663B7E664756E2164756E21
38061
38104
  //# sourceMappingURL=index.js.map