@absolutejs/auth 0.80.1 → 0.81.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/dist/index.js CHANGED
@@ -3019,7 +3019,7 @@ var createCustomOAuth2Client = (providerConfig, credentials) => buildOAuth2Clien
3019
3019
  var createOAuth2Client = (providerName, config) => buildOAuth2Client(providers[providerName], config);
3020
3020
 
3021
3021
  // src/index.ts
3022
- import { Elysia as Elysia48 } from "elysia";
3022
+ import { Elysia as Elysia49 } from "elysia";
3023
3023
 
3024
3024
  // src/apikeys/routes.ts
3025
3025
  import { Elysia, t } from "elysia";
@@ -5862,7 +5862,11 @@ var DEFAULT_RESET_TOKEN_TTL_MS = MILLISECONDS_IN_AN_HOUR;
5862
5862
  var DEFAULT_VERIFICATION_TOKEN_TTL_MS = MILLISECONDS_IN_A_DAY;
5863
5863
 
5864
5864
  // src/credentials/emailVerification.ts
5865
- var credentialsEmailVerification = ({
5865
+ var credentialsEmailVerification = (configuration) => credentialsEmailVerificationRoute({
5866
+ ...configuration,
5867
+ verifyEmailRoute: configuration.verifyEmailRoute ?? "/auth/verify-email"
5868
+ });
5869
+ var credentialsEmailVerificationRoute = ({
5866
5870
  credentialStore,
5867
5871
  getUserByEmail,
5868
5872
  onCreateCredentialUser,
@@ -5871,7 +5875,7 @@ var credentialsEmailVerification = ({
5871
5875
  onSendEmail,
5872
5876
  requireEmailVerification = false,
5873
5877
  verificationTokenDurationMs = DEFAULT_VERIFICATION_TOKEN_TTL_MS,
5874
- verifyEmailRoute = "/auth/verify-email"
5878
+ verifyEmailRoute
5875
5879
  }) => new Elysia10().post(verifyEmailRoute, { body: t7.Object({ token: t7.String() }) }, async ({ body: { token }, status }) => {
5876
5880
  const consumed = await credentialStore.consumeVerificationToken(await hashToken(token));
5877
5881
  if (!consumed) {
@@ -6151,7 +6155,11 @@ var isPasswordCompromised = (password) => isPasswordBreached(password);
6151
6155
  // src/credentials/login.ts
6152
6156
  var dummyPasswordHashPromise;
6153
6157
  var dummyPasswordHash = () => dummyPasswordHashPromise ??= hashPassword("absolutejs-auth-timing-equalizer");
6154
- var credentialsLogin = ({
6158
+ var credentialsLogin = (configuration) => credentialsLoginRoute({
6159
+ ...configuration,
6160
+ loginRoute: configuration.loginRoute ?? "/auth/login"
6161
+ });
6162
+ var credentialsLoginRoute = ({
6155
6163
  authSessionStore,
6156
6164
  checkBreachesOnLogin,
6157
6165
  cookieSecure,
@@ -6160,7 +6168,7 @@ var credentialsLogin = ({
6160
6168
  getUserByEmail,
6161
6169
  isMfaRequired,
6162
6170
  lockoutGuard,
6163
- loginRoute = "/auth/login",
6171
+ loginRoute,
6164
6172
  onCredentialsLoginError,
6165
6173
  onCredentialsLoginSuccess,
6166
6174
  onUntrustedOrigin,
@@ -6273,12 +6281,16 @@ var credentialsLogin = ({
6273
6281
  // src/credentials/passwordReset.ts
6274
6282
  init_crypto();
6275
6283
  import { Elysia as Elysia12, t as t9 } from "elysia";
6276
- var credentialsPasswordReset = ({
6284
+ var credentialsPasswordReset = (configuration) => credentialsPasswordResetRoute({
6285
+ ...configuration,
6286
+ resetPasswordRoute: configuration.resetPasswordRoute ?? "/auth/reset-password"
6287
+ });
6288
+ var credentialsPasswordResetRoute = ({
6277
6289
  credentialStore,
6278
6290
  onPasswordReset,
6279
6291
  onSendEmail,
6280
6292
  passwordPolicy,
6281
- resetPasswordRoute = "/auth/reset-password",
6293
+ resetPasswordRoute,
6282
6294
  resetTokenDurationMs = DEFAULT_RESET_TOKEN_TTL_MS
6283
6295
  }) => new Elysia12().post(`${resetPasswordRoute}/request`, { body: t9.Object({ email: t9.String() }) }, async ({ body: { email }, status }) => {
6284
6296
  const normalizedEmail = email.trim().toLowerCase();
@@ -6335,7 +6347,11 @@ var credentialsPasswordReset = ({
6335
6347
  // src/credentials/register.ts
6336
6348
  init_crypto();
6337
6349
  import { Elysia as Elysia13, t as t10 } from "elysia";
6338
- var credentialsRegister = ({
6350
+ var credentialsRegister = (configuration) => credentialsRegisterRoute({
6351
+ ...configuration,
6352
+ registerRoute: configuration.registerRoute ?? "/auth/register"
6353
+ });
6354
+ var credentialsRegisterRoute = ({
6339
6355
  authSessionStore,
6340
6356
  cookieSecure,
6341
6357
  credentialStore,
@@ -6348,7 +6364,7 @@ var credentialsRegister = ({
6348
6364
  onSendEmail,
6349
6365
  onUntrustedOrigin,
6350
6366
  passwordPolicy,
6351
- registerRoute = "/auth/register",
6367
+ registerRoute,
6352
6368
  requireEmailVerification = false,
6353
6369
  revealRegistrationConflicts = false,
6354
6370
  sessionDurationMs = DEFAULT_CREDENTIAL_SESSION_TTL_MS,
@@ -40565,6 +40581,21 @@ var createInMemorySetupSessionStore = () => {
40565
40581
  }
40566
40582
  };
40567
40583
  };
40584
+ // src/credentials/api.ts
40585
+ import { Elysia as Elysia48 } from "elysia";
40586
+ var createCredentialsApi = (configuration) => new Elysia48().use(credentialsRegisterRoute({
40587
+ ...configuration,
40588
+ registerRoute: "/auth/register"
40589
+ })).use(credentialsLoginRoute({
40590
+ ...configuration,
40591
+ loginRoute: "/auth/login"
40592
+ })).use(credentialsEmailVerificationRoute({
40593
+ ...configuration,
40594
+ verifyEmailRoute: "/auth/verify-email"
40595
+ })).use(credentialsPasswordResetRoute({
40596
+ ...configuration,
40597
+ resetPasswordRoute: "/auth/reset-password"
40598
+ }));
40568
40599
 
40569
40600
  // src/index.ts
40570
40601
  var validatePositiveOptions = (prefix, options) => {
@@ -40798,7 +40829,7 @@ var buildAuthApplications = async (configuration) => {
40798
40829
  const auditedOnRevocationSuccess = auditEmit ? composeRevocationAudit(onRevocationSuccess, auditEmit) : onRevocationSuccess;
40799
40830
  const auditedOnSignOut = auditEmit ? composeSignOutAudit(onSignOut, auditEmit) : onSignOut;
40800
40831
  const pluginSeed = pluginDependencySeed(configuration);
40801
- const coreRoutes = new Elysia48({
40832
+ const coreRoutes = new Elysia49({
40802
40833
  name: "@absolutejs/auth/core-routes",
40803
40834
  seed: pluginSeed
40804
40835
  }).use([
@@ -40855,62 +40886,62 @@ var buildAuthApplications = async (configuration) => {
40855
40886
  profileRoute
40856
40887
  })
40857
40888
  ]);
40858
- const identityFeatureRoutes = new Elysia48().use([
40889
+ const identityFeatureRoutes = new Elysia49().use([
40859
40890
  auditedCredentials ? credentialRoutes({
40860
40891
  ...auditedCredentials,
40861
40892
  authSessionStore,
40862
40893
  cookieSecure: resolvedCookieSecure,
40863
40894
  lockoutGuard
40864
- }) : new Elysia48,
40895
+ }) : new Elysia49,
40865
40896
  auditedMfa ? mfaRoutes({
40866
40897
  ...auditedMfa,
40867
40898
  authSessionStore,
40868
40899
  cookieSecure: resolvedCookieSecure,
40869
40900
  verificationProvider
40870
- }) : new Elysia48,
40901
+ }) : new Elysia49,
40871
40902
  passwordless ? passwordlessRoutes({
40872
40903
  ...passwordless,
40873
40904
  authSessionStore,
40874
40905
  cookieSecure: resolvedCookieSecure,
40875
40906
  emit: auditEmit
40876
- }) : new Elysia48,
40877
- sessions ? sessionRoutes({ ...sessions, authSessionStore }) : new Elysia48,
40907
+ }) : new Elysia49,
40908
+ sessions ? sessionRoutes({ ...sessions, authSessionStore }) : new Elysia49,
40878
40909
  sso ? oidcSsoRoutes({
40879
40910
  ...sso,
40880
40911
  authSessionStore,
40881
40912
  cookieSecure: resolvedCookieSecure
40882
- }) : new Elysia48,
40913
+ }) : new Elysia49,
40883
40914
  sso && sso.samlAdapter ? samlSsoRoutes({
40884
40915
  ...sso,
40885
40916
  authSessionStore,
40886
40917
  cookieSecure: resolvedCookieSecure,
40887
40918
  samlAdapter: sso.samlAdapter
40888
- }) : new Elysia48
40919
+ }) : new Elysia49
40889
40920
  ]);
40890
- const organizationFeatureRoutes = new Elysia48().use([
40921
+ const organizationFeatureRoutes = new Elysia49().use([
40891
40922
  sso && sso.getOrganizationByEmailDomain ? ssoDiscoveryRoute({
40892
40923
  getOrganizationByEmailDomain: sso.getOrganizationByEmailDomain,
40893
40924
  ssoConnectionStore: sso.ssoConnectionStore,
40894
40925
  ssoRoute: sso.ssoRoute
40895
- }) : new Elysia48,
40896
- scim ? scimRoutes(scim) : new Elysia48,
40897
- apikeys ? apiKeysRoutes(apikeys) : new Elysia48,
40926
+ }) : new Elysia49,
40927
+ scim ? scimRoutes(scim) : new Elysia49,
40928
+ apikeys ? apiKeysRoutes(apikeys) : new Elysia49,
40898
40929
  oidcConfig ? oidcProviderRoutes({
40899
40930
  ...oidcConfig,
40900
40931
  authSessionStore
40901
- }) : new Elysia48,
40932
+ }) : new Elysia49,
40902
40933
  organizations ? organizationRoutes({
40903
40934
  ...organizations,
40904
40935
  authSessionStore,
40905
40936
  emit: auditEmit
40906
- }) : new Elysia48,
40937
+ }) : new Elysia49,
40907
40938
  roles ? roleRoutes({
40908
40939
  ...roles,
40909
40940
  authSessionStore,
40910
40941
  emit: auditEmit
40911
- }) : new Elysia48
40942
+ }) : new Elysia49
40912
40943
  ]);
40913
- const pushApplication = new Elysia48;
40944
+ const pushApplication = new Elysia49;
40914
40945
  if (pushConfig && oidcConfig)
40915
40946
  pushApplication.use(pushRoutes({
40916
40947
  accessTokens: {
@@ -40920,24 +40951,24 @@ var buildAuthApplications = async (configuration) => {
40920
40951
  authSessionStore,
40921
40952
  config: pushConfig
40922
40953
  }));
40923
- const extendedFeatureRoutes = new Elysia48().use([
40954
+ const extendedFeatureRoutes = new Elysia49().use([
40924
40955
  pushApplication,
40925
- portal ? portalRoutes({ ...portal, emit: auditEmit }) : new Elysia48,
40956
+ portal ? portalRoutes({ ...portal, emit: auditEmit }) : new Elysia49,
40926
40957
  webauthn ? webauthnRoutes({
40927
40958
  ...webauthn,
40928
40959
  authSessionStore,
40929
40960
  cookieSecure: resolvedCookieSecure,
40930
40961
  emit: auditEmit
40931
- }) : new Elysia48,
40962
+ }) : new Elysia49,
40932
40963
  compliance ? complianceRoutes({
40933
40964
  ...compliance,
40934
40965
  authSessionStore,
40935
40966
  emit: auditEmit
40936
- }) : new Elysia48,
40967
+ }) : new Elysia49,
40937
40968
  createConfiguredAuthHtmxRoutes({ authSessionStore, config: htmx }),
40938
40969
  agentAuthRoutes(resolvedAgentAuth)
40939
40970
  ]);
40940
- const featureRoutes = new Elysia48({
40971
+ const featureRoutes = new Elysia49({
40941
40972
  name: "@absolutejs/auth/feature-routes",
40942
40973
  seed: pluginSeed
40943
40974
  }).use([
@@ -40960,7 +40991,7 @@ var buildAuthApplications = async (configuration) => {
40960
40991
  };
40961
40992
  var auth = async (configuration) => {
40962
40993
  const { authContext, coreRoutes, featureRoutes } = await buildAuthApplications(configuration);
40963
- const application = new Elysia48({
40994
+ const application = new Elysia49({
40964
40995
  name: "@absolutejs/auth",
40965
40996
  seed: pluginDependencySeed(configuration)
40966
40997
  });
@@ -41089,6 +41120,7 @@ export {
41089
41120
  createBunSqlDrizzleAgentRegistrationStore,
41090
41121
  createClientIdMetadataResolver,
41091
41122
  createCredentialOffer,
41123
+ createCredentialsApi,
41092
41124
  createCustomOAuth2Client,
41093
41125
  createDrizzleAgentDelegationStore,
41094
41126
  createFederatedTokenStore,
@@ -41505,5 +41537,5 @@ export {
41505
41537
  writeWarrant
41506
41538
  };
41507
41539
 
41508
- //# debugId=637E1C97D77705DC64756E2164756E21
41540
+ //# debugId=135272E1F5245CC264756E2164756E21
41509
41541
  //# sourceMappingURL=index.js.map