@absolutejs/auth 0.80.1 → 0.82.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/CHANGELOG.md +20 -0
- package/changelog.json +40 -0
- package/dist/credentials/api.d.ts +214 -0
- package/dist/credentials/emailVerification.d.ts +189 -1
- package/dist/credentials/integration.d.ts +3 -0
- package/dist/credentials/login.d.ts +208 -1
- package/dist/credentials/passwordReset.d.ts +197 -1
- package/dist/credentials/register.d.ts +198 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +76 -34
- package/dist/index.js.map +11 -10
- package/dist/manifest.js +57 -2
- package/dist/manifest.js.map +5 -4
- package/dist/manifest.json +25 -1
- package/dist/routes/signout.d.ts +192 -1
- package/dist/server.d.ts +2 -0
- package/dist/server.js +76 -34
- package/dist/server.js.map +11 -10
- package/docs/PERSISTENT-CREDENTIALS.md +44 -1
- package/package.json +4 -3
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
6367
|
+
registerRoute,
|
|
6352
6368
|
requireEmailVerification = false,
|
|
6353
6369
|
revealRegistrationConflicts = false,
|
|
6354
6370
|
sessionDurationMs = DEFAULT_CREDENTIAL_SESSION_TTL_MS,
|
|
@@ -11854,9 +11870,18 @@ var runSignOut = async (onSignOut, args) => {
|
|
|
11854
11870
|
return false;
|
|
11855
11871
|
}
|
|
11856
11872
|
};
|
|
11857
|
-
var
|
|
11873
|
+
var createSignoutApi = (configuration) => createSignoutRoute({
|
|
11874
|
+
...configuration,
|
|
11875
|
+
onSignOut: configuration.onSignOut,
|
|
11876
|
+
signoutRoute: "/oauth2/signout"
|
|
11877
|
+
});
|
|
11878
|
+
var signout = (configuration) => createSignoutRoute({
|
|
11879
|
+
...configuration,
|
|
11880
|
+
signoutRoute: configuration.signoutRoute ?? "/oauth2/signout"
|
|
11881
|
+
});
|
|
11882
|
+
var createSignoutRoute = ({
|
|
11858
11883
|
authSessionStore,
|
|
11859
|
-
signoutRoute
|
|
11884
|
+
signoutRoute,
|
|
11860
11885
|
onSignOut
|
|
11861
11886
|
}) => new Elysia35().use(sessionStore()).delete(signoutRoute, {
|
|
11862
11887
|
cookie: t28.Cookie({
|
|
@@ -40565,6 +40590,21 @@ var createInMemorySetupSessionStore = () => {
|
|
|
40565
40590
|
}
|
|
40566
40591
|
};
|
|
40567
40592
|
};
|
|
40593
|
+
// src/credentials/api.ts
|
|
40594
|
+
import { Elysia as Elysia48 } from "elysia";
|
|
40595
|
+
var createCredentialsApi = (configuration) => new Elysia48().use(credentialsRegisterRoute({
|
|
40596
|
+
...configuration,
|
|
40597
|
+
registerRoute: "/auth/register"
|
|
40598
|
+
})).use(credentialsLoginRoute({
|
|
40599
|
+
...configuration,
|
|
40600
|
+
loginRoute: "/auth/login"
|
|
40601
|
+
})).use(credentialsEmailVerificationRoute({
|
|
40602
|
+
...configuration,
|
|
40603
|
+
verifyEmailRoute: "/auth/verify-email"
|
|
40604
|
+
})).use(credentialsPasswordResetRoute({
|
|
40605
|
+
...configuration,
|
|
40606
|
+
resetPasswordRoute: "/auth/reset-password"
|
|
40607
|
+
}));
|
|
40568
40608
|
|
|
40569
40609
|
// src/index.ts
|
|
40570
40610
|
var validatePositiveOptions = (prefix, options) => {
|
|
@@ -40798,7 +40838,7 @@ var buildAuthApplications = async (configuration) => {
|
|
|
40798
40838
|
const auditedOnRevocationSuccess = auditEmit ? composeRevocationAudit(onRevocationSuccess, auditEmit) : onRevocationSuccess;
|
|
40799
40839
|
const auditedOnSignOut = auditEmit ? composeSignOutAudit(onSignOut, auditEmit) : onSignOut;
|
|
40800
40840
|
const pluginSeed = pluginDependencySeed(configuration);
|
|
40801
|
-
const coreRoutes = new
|
|
40841
|
+
const coreRoutes = new Elysia49({
|
|
40802
40842
|
name: "@absolutejs/auth/core-routes",
|
|
40803
40843
|
seed: pluginSeed
|
|
40804
40844
|
}).use([
|
|
@@ -40855,62 +40895,62 @@ var buildAuthApplications = async (configuration) => {
|
|
|
40855
40895
|
profileRoute
|
|
40856
40896
|
})
|
|
40857
40897
|
]);
|
|
40858
|
-
const identityFeatureRoutes = new
|
|
40898
|
+
const identityFeatureRoutes = new Elysia49().use([
|
|
40859
40899
|
auditedCredentials ? credentialRoutes({
|
|
40860
40900
|
...auditedCredentials,
|
|
40861
40901
|
authSessionStore,
|
|
40862
40902
|
cookieSecure: resolvedCookieSecure,
|
|
40863
40903
|
lockoutGuard
|
|
40864
|
-
}) : new
|
|
40904
|
+
}) : new Elysia49,
|
|
40865
40905
|
auditedMfa ? mfaRoutes({
|
|
40866
40906
|
...auditedMfa,
|
|
40867
40907
|
authSessionStore,
|
|
40868
40908
|
cookieSecure: resolvedCookieSecure,
|
|
40869
40909
|
verificationProvider
|
|
40870
|
-
}) : new
|
|
40910
|
+
}) : new Elysia49,
|
|
40871
40911
|
passwordless ? passwordlessRoutes({
|
|
40872
40912
|
...passwordless,
|
|
40873
40913
|
authSessionStore,
|
|
40874
40914
|
cookieSecure: resolvedCookieSecure,
|
|
40875
40915
|
emit: auditEmit
|
|
40876
|
-
}) : new
|
|
40877
|
-
sessions ? sessionRoutes({ ...sessions, authSessionStore }) : new
|
|
40916
|
+
}) : new Elysia49,
|
|
40917
|
+
sessions ? sessionRoutes({ ...sessions, authSessionStore }) : new Elysia49,
|
|
40878
40918
|
sso ? oidcSsoRoutes({
|
|
40879
40919
|
...sso,
|
|
40880
40920
|
authSessionStore,
|
|
40881
40921
|
cookieSecure: resolvedCookieSecure
|
|
40882
|
-
}) : new
|
|
40922
|
+
}) : new Elysia49,
|
|
40883
40923
|
sso && sso.samlAdapter ? samlSsoRoutes({
|
|
40884
40924
|
...sso,
|
|
40885
40925
|
authSessionStore,
|
|
40886
40926
|
cookieSecure: resolvedCookieSecure,
|
|
40887
40927
|
samlAdapter: sso.samlAdapter
|
|
40888
|
-
}) : new
|
|
40928
|
+
}) : new Elysia49
|
|
40889
40929
|
]);
|
|
40890
|
-
const organizationFeatureRoutes = new
|
|
40930
|
+
const organizationFeatureRoutes = new Elysia49().use([
|
|
40891
40931
|
sso && sso.getOrganizationByEmailDomain ? ssoDiscoveryRoute({
|
|
40892
40932
|
getOrganizationByEmailDomain: sso.getOrganizationByEmailDomain,
|
|
40893
40933
|
ssoConnectionStore: sso.ssoConnectionStore,
|
|
40894
40934
|
ssoRoute: sso.ssoRoute
|
|
40895
|
-
}) : new
|
|
40896
|
-
scim ? scimRoutes(scim) : new
|
|
40897
|
-
apikeys ? apiKeysRoutes(apikeys) : new
|
|
40935
|
+
}) : new Elysia49,
|
|
40936
|
+
scim ? scimRoutes(scim) : new Elysia49,
|
|
40937
|
+
apikeys ? apiKeysRoutes(apikeys) : new Elysia49,
|
|
40898
40938
|
oidcConfig ? oidcProviderRoutes({
|
|
40899
40939
|
...oidcConfig,
|
|
40900
40940
|
authSessionStore
|
|
40901
|
-
}) : new
|
|
40941
|
+
}) : new Elysia49,
|
|
40902
40942
|
organizations ? organizationRoutes({
|
|
40903
40943
|
...organizations,
|
|
40904
40944
|
authSessionStore,
|
|
40905
40945
|
emit: auditEmit
|
|
40906
|
-
}) : new
|
|
40946
|
+
}) : new Elysia49,
|
|
40907
40947
|
roles ? roleRoutes({
|
|
40908
40948
|
...roles,
|
|
40909
40949
|
authSessionStore,
|
|
40910
40950
|
emit: auditEmit
|
|
40911
|
-
}) : new
|
|
40951
|
+
}) : new Elysia49
|
|
40912
40952
|
]);
|
|
40913
|
-
const pushApplication = new
|
|
40953
|
+
const pushApplication = new Elysia49;
|
|
40914
40954
|
if (pushConfig && oidcConfig)
|
|
40915
40955
|
pushApplication.use(pushRoutes({
|
|
40916
40956
|
accessTokens: {
|
|
@@ -40920,24 +40960,24 @@ var buildAuthApplications = async (configuration) => {
|
|
|
40920
40960
|
authSessionStore,
|
|
40921
40961
|
config: pushConfig
|
|
40922
40962
|
}));
|
|
40923
|
-
const extendedFeatureRoutes = new
|
|
40963
|
+
const extendedFeatureRoutes = new Elysia49().use([
|
|
40924
40964
|
pushApplication,
|
|
40925
|
-
portal ? portalRoutes({ ...portal, emit: auditEmit }) : new
|
|
40965
|
+
portal ? portalRoutes({ ...portal, emit: auditEmit }) : new Elysia49,
|
|
40926
40966
|
webauthn ? webauthnRoutes({
|
|
40927
40967
|
...webauthn,
|
|
40928
40968
|
authSessionStore,
|
|
40929
40969
|
cookieSecure: resolvedCookieSecure,
|
|
40930
40970
|
emit: auditEmit
|
|
40931
|
-
}) : new
|
|
40971
|
+
}) : new Elysia49,
|
|
40932
40972
|
compliance ? complianceRoutes({
|
|
40933
40973
|
...compliance,
|
|
40934
40974
|
authSessionStore,
|
|
40935
40975
|
emit: auditEmit
|
|
40936
|
-
}) : new
|
|
40976
|
+
}) : new Elysia49,
|
|
40937
40977
|
createConfiguredAuthHtmxRoutes({ authSessionStore, config: htmx }),
|
|
40938
40978
|
agentAuthRoutes(resolvedAgentAuth)
|
|
40939
40979
|
]);
|
|
40940
|
-
const featureRoutes = new
|
|
40980
|
+
const featureRoutes = new Elysia49({
|
|
40941
40981
|
name: "@absolutejs/auth/feature-routes",
|
|
40942
40982
|
seed: pluginSeed
|
|
40943
40983
|
}).use([
|
|
@@ -40960,7 +41000,7 @@ var buildAuthApplications = async (configuration) => {
|
|
|
40960
41000
|
};
|
|
40961
41001
|
var auth = async (configuration) => {
|
|
40962
41002
|
const { authContext, coreRoutes, featureRoutes } = await buildAuthApplications(configuration);
|
|
40963
|
-
const application = new
|
|
41003
|
+
const application = new Elysia49({
|
|
40964
41004
|
name: "@absolutejs/auth",
|
|
40965
41005
|
seed: pluginDependencySeed(configuration)
|
|
40966
41006
|
});
|
|
@@ -41089,6 +41129,7 @@ export {
|
|
|
41089
41129
|
createBunSqlDrizzleAgentRegistrationStore,
|
|
41090
41130
|
createClientIdMetadataResolver,
|
|
41091
41131
|
createCredentialOffer,
|
|
41132
|
+
createCredentialsApi,
|
|
41092
41133
|
createCustomOAuth2Client,
|
|
41093
41134
|
createDrizzleAgentDelegationStore,
|
|
41094
41135
|
createFederatedTokenStore,
|
|
@@ -41232,6 +41273,7 @@ export {
|
|
|
41232
41273
|
createSecretCipher,
|
|
41233
41274
|
createSetupSession,
|
|
41234
41275
|
createSiemLogStream,
|
|
41276
|
+
createSignoutApi,
|
|
41235
41277
|
createStatusList,
|
|
41236
41278
|
createTamperEvidentSink,
|
|
41237
41279
|
createTotpKeyUri,
|
|
@@ -41505,5 +41547,5 @@ export {
|
|
|
41505
41547
|
writeWarrant
|
|
41506
41548
|
};
|
|
41507
41549
|
|
|
41508
|
-
//# debugId=
|
|
41550
|
+
//# debugId=38CB2131C9C8A6BB64756E2164756E21
|
|
41509
41551
|
//# sourceMappingURL=index.js.map
|