@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/CHANGELOG.md +14 -0
- package/changelog.json +27 -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 +1 -0
- package/dist/index.js +64 -32
- package/dist/index.js.map +10 -9
- package/dist/manifest.js +53 -2
- package/dist/manifest.js.map +5 -4
- package/dist/manifest.json +25 -1
- package/dist/server.d.ts +1 -0
- package/dist/server.js +64 -32
- package/dist/server.js.map +10 -9
- package/docs/PERSISTENT-CREDENTIALS.md +29 -1
- package/package.json +4 -3
package/dist/manifest.json
CHANGED
|
@@ -333,7 +333,7 @@
|
|
|
333
333
|
},
|
|
334
334
|
"wiring": [
|
|
335
335
|
{
|
|
336
|
-
"description": "Sign in with Google, GitHub, and 60+ other services.
|
|
336
|
+
"description": "Sign in with Google, GitHub, and 60+ other services. For email/password use get_credentials_integration and supply application-owned user, storage and email bindings.",
|
|
337
337
|
"id": "default",
|
|
338
338
|
"server": {
|
|
339
339
|
"code": ".use(\n\tawait auth({\n\t\t// TODO: return your application user for a session subject.\n\t\tgetUser: (sub) => ({ sub }),\n\t\tauthSessionStore: ${slot.sessionStore},\n\t\tcookieSecure: ${settings.cookieSecure},\n\t\tmaxSessions: ${settings.maxSessions},\n\t\tprovidersConfiguration: providersFromEnv(${settings.providersConfiguration} ?? {}),\n\t\tsessionDurationMs: ${settings.sessionDurationMs}\n\t})\n)",
|
|
@@ -352,6 +352,30 @@
|
|
|
352
352
|
}
|
|
353
353
|
],
|
|
354
354
|
"tools": {
|
|
355
|
+
"get_credentials_integration": {
|
|
356
|
+
"annotations": {
|
|
357
|
+
"readOnlyHint": true
|
|
358
|
+
},
|
|
359
|
+
"authorization": {
|
|
360
|
+
"approval": "never",
|
|
361
|
+
"audience": "admin",
|
|
362
|
+
"effects": [
|
|
363
|
+
"read"
|
|
364
|
+
],
|
|
365
|
+
"requiredScopes": [
|
|
366
|
+
"auth:inspect"
|
|
367
|
+
]
|
|
368
|
+
},
|
|
369
|
+
"capabilities": [
|
|
370
|
+
"read"
|
|
371
|
+
],
|
|
372
|
+
"description": "Get the package-owned typed email/password API and protected account route recipe. Reuse createCredentialsApi rather than inventing request wrappers. Requires application-owned user callbacks, a durable session and credential store, and real email delivery.",
|
|
373
|
+
"input": {
|
|
374
|
+
"type": "object",
|
|
375
|
+
"properties": {}
|
|
376
|
+
},
|
|
377
|
+
"kind": "workspace"
|
|
378
|
+
},
|
|
355
379
|
"list_sign_in_providers": {
|
|
356
380
|
"annotations": {
|
|
357
381
|
"readOnlyHint": true
|
package/dist/server.d.ts
CHANGED
|
@@ -34,3 +34,4 @@ export type { AuthConfig, OAuth2ConfigurationOptions, SessionData, UnregisteredS
|
|
|
34
34
|
export { instantiateUserSession } from './utils';
|
|
35
35
|
export type { OAuth2TokenResponse, ProviderOption } from 'citra';
|
|
36
36
|
export { extractPropFromIdentity, isValidProviderOption, providers } from 'citra';
|
|
37
|
+
export { createCredentialsApi } from './credentials/api';
|
package/dist/server.js
CHANGED
|
@@ -4015,7 +4015,7 @@ var createCustomOAuth2Client = (providerConfig, credentials) => buildOAuth2Clien
|
|
|
4015
4015
|
var createOAuth2Client = (providerName, config) => buildOAuth2Client(providers[providerName], config);
|
|
4016
4016
|
|
|
4017
4017
|
// src/index.ts
|
|
4018
|
-
import { Elysia as
|
|
4018
|
+
import { Elysia as Elysia49 } from "elysia";
|
|
4019
4019
|
|
|
4020
4020
|
// src/apikeys/routes.ts
|
|
4021
4021
|
import { Elysia, t } from "elysia";
|
|
@@ -6858,7 +6858,11 @@ var DEFAULT_RESET_TOKEN_TTL_MS = MILLISECONDS_IN_AN_HOUR;
|
|
|
6858
6858
|
var DEFAULT_VERIFICATION_TOKEN_TTL_MS = MILLISECONDS_IN_A_DAY;
|
|
6859
6859
|
|
|
6860
6860
|
// src/credentials/emailVerification.ts
|
|
6861
|
-
var credentialsEmailVerification = ({
|
|
6861
|
+
var credentialsEmailVerification = (configuration) => credentialsEmailVerificationRoute({
|
|
6862
|
+
...configuration,
|
|
6863
|
+
verifyEmailRoute: configuration.verifyEmailRoute ?? "/auth/verify-email"
|
|
6864
|
+
});
|
|
6865
|
+
var credentialsEmailVerificationRoute = ({
|
|
6862
6866
|
credentialStore,
|
|
6863
6867
|
getUserByEmail,
|
|
6864
6868
|
onCreateCredentialUser,
|
|
@@ -6867,7 +6871,7 @@ var credentialsEmailVerification = ({
|
|
|
6867
6871
|
onSendEmail,
|
|
6868
6872
|
requireEmailVerification = false,
|
|
6869
6873
|
verificationTokenDurationMs = DEFAULT_VERIFICATION_TOKEN_TTL_MS,
|
|
6870
|
-
verifyEmailRoute
|
|
6874
|
+
verifyEmailRoute
|
|
6871
6875
|
}) => new Elysia10().post(verifyEmailRoute, { body: t7.Object({ token: t7.String() }) }, async ({ body: { token }, status }) => {
|
|
6872
6876
|
const consumed = await credentialStore.consumeVerificationToken(await hashToken(token));
|
|
6873
6877
|
if (!consumed) {
|
|
@@ -7147,7 +7151,11 @@ var isPasswordCompromised = (password) => isPasswordBreached(password);
|
|
|
7147
7151
|
// src/credentials/login.ts
|
|
7148
7152
|
var dummyPasswordHashPromise;
|
|
7149
7153
|
var dummyPasswordHash = () => dummyPasswordHashPromise ??= hashPassword("absolutejs-auth-timing-equalizer");
|
|
7150
|
-
var credentialsLogin = ({
|
|
7154
|
+
var credentialsLogin = (configuration) => credentialsLoginRoute({
|
|
7155
|
+
...configuration,
|
|
7156
|
+
loginRoute: configuration.loginRoute ?? "/auth/login"
|
|
7157
|
+
});
|
|
7158
|
+
var credentialsLoginRoute = ({
|
|
7151
7159
|
authSessionStore,
|
|
7152
7160
|
checkBreachesOnLogin,
|
|
7153
7161
|
cookieSecure,
|
|
@@ -7156,7 +7164,7 @@ var credentialsLogin = ({
|
|
|
7156
7164
|
getUserByEmail,
|
|
7157
7165
|
isMfaRequired,
|
|
7158
7166
|
lockoutGuard,
|
|
7159
|
-
loginRoute
|
|
7167
|
+
loginRoute,
|
|
7160
7168
|
onCredentialsLoginError,
|
|
7161
7169
|
onCredentialsLoginSuccess,
|
|
7162
7170
|
onUntrustedOrigin,
|
|
@@ -7269,12 +7277,16 @@ var credentialsLogin = ({
|
|
|
7269
7277
|
// src/credentials/passwordReset.ts
|
|
7270
7278
|
init_crypto();
|
|
7271
7279
|
import { Elysia as Elysia12, t as t9 } from "elysia";
|
|
7272
|
-
var credentialsPasswordReset = ({
|
|
7280
|
+
var credentialsPasswordReset = (configuration) => credentialsPasswordResetRoute({
|
|
7281
|
+
...configuration,
|
|
7282
|
+
resetPasswordRoute: configuration.resetPasswordRoute ?? "/auth/reset-password"
|
|
7283
|
+
});
|
|
7284
|
+
var credentialsPasswordResetRoute = ({
|
|
7273
7285
|
credentialStore,
|
|
7274
7286
|
onPasswordReset,
|
|
7275
7287
|
onSendEmail,
|
|
7276
7288
|
passwordPolicy,
|
|
7277
|
-
resetPasswordRoute
|
|
7289
|
+
resetPasswordRoute,
|
|
7278
7290
|
resetTokenDurationMs = DEFAULT_RESET_TOKEN_TTL_MS
|
|
7279
7291
|
}) => new Elysia12().post(`${resetPasswordRoute}/request`, { body: t9.Object({ email: t9.String() }) }, async ({ body: { email }, status }) => {
|
|
7280
7292
|
const normalizedEmail = email.trim().toLowerCase();
|
|
@@ -7331,7 +7343,11 @@ var credentialsPasswordReset = ({
|
|
|
7331
7343
|
// src/credentials/register.ts
|
|
7332
7344
|
init_crypto();
|
|
7333
7345
|
import { Elysia as Elysia13, t as t10 } from "elysia";
|
|
7334
|
-
var credentialsRegister = ({
|
|
7346
|
+
var credentialsRegister = (configuration) => credentialsRegisterRoute({
|
|
7347
|
+
...configuration,
|
|
7348
|
+
registerRoute: configuration.registerRoute ?? "/auth/register"
|
|
7349
|
+
});
|
|
7350
|
+
var credentialsRegisterRoute = ({
|
|
7335
7351
|
authSessionStore,
|
|
7336
7352
|
cookieSecure,
|
|
7337
7353
|
credentialStore,
|
|
@@ -7344,7 +7360,7 @@ var credentialsRegister = ({
|
|
|
7344
7360
|
onSendEmail,
|
|
7345
7361
|
onUntrustedOrigin,
|
|
7346
7362
|
passwordPolicy,
|
|
7347
|
-
registerRoute
|
|
7363
|
+
registerRoute,
|
|
7348
7364
|
requireEmailVerification = false,
|
|
7349
7365
|
revealRegistrationConflicts = false,
|
|
7350
7366
|
sessionDurationMs = DEFAULT_CREDENTIAL_SESSION_TTL_MS,
|
|
@@ -41561,6 +41577,21 @@ var createInMemorySetupSessionStore = () => {
|
|
|
41561
41577
|
}
|
|
41562
41578
|
};
|
|
41563
41579
|
};
|
|
41580
|
+
// src/credentials/api.ts
|
|
41581
|
+
import { Elysia as Elysia48 } from "elysia";
|
|
41582
|
+
var createCredentialsApi = (configuration) => new Elysia48().use(credentialsRegisterRoute({
|
|
41583
|
+
...configuration,
|
|
41584
|
+
registerRoute: "/auth/register"
|
|
41585
|
+
})).use(credentialsLoginRoute({
|
|
41586
|
+
...configuration,
|
|
41587
|
+
loginRoute: "/auth/login"
|
|
41588
|
+
})).use(credentialsEmailVerificationRoute({
|
|
41589
|
+
...configuration,
|
|
41590
|
+
verifyEmailRoute: "/auth/verify-email"
|
|
41591
|
+
})).use(credentialsPasswordResetRoute({
|
|
41592
|
+
...configuration,
|
|
41593
|
+
resetPasswordRoute: "/auth/reset-password"
|
|
41594
|
+
}));
|
|
41564
41595
|
|
|
41565
41596
|
// src/index.ts
|
|
41566
41597
|
var validatePositiveOptions = (prefix, options) => {
|
|
@@ -41794,7 +41825,7 @@ var buildAuthApplications = async (configuration) => {
|
|
|
41794
41825
|
const auditedOnRevocationSuccess = auditEmit ? composeRevocationAudit(onRevocationSuccess, auditEmit) : onRevocationSuccess;
|
|
41795
41826
|
const auditedOnSignOut = auditEmit ? composeSignOutAudit(onSignOut, auditEmit) : onSignOut;
|
|
41796
41827
|
const pluginSeed = pluginDependencySeed(configuration);
|
|
41797
|
-
const coreRoutes = new
|
|
41828
|
+
const coreRoutes = new Elysia49({
|
|
41798
41829
|
name: "@absolutejs/auth/core-routes",
|
|
41799
41830
|
seed: pluginSeed
|
|
41800
41831
|
}).use([
|
|
@@ -41851,62 +41882,62 @@ var buildAuthApplications = async (configuration) => {
|
|
|
41851
41882
|
profileRoute
|
|
41852
41883
|
})
|
|
41853
41884
|
]);
|
|
41854
|
-
const identityFeatureRoutes = new
|
|
41885
|
+
const identityFeatureRoutes = new Elysia49().use([
|
|
41855
41886
|
auditedCredentials ? credentialRoutes({
|
|
41856
41887
|
...auditedCredentials,
|
|
41857
41888
|
authSessionStore,
|
|
41858
41889
|
cookieSecure: resolvedCookieSecure,
|
|
41859
41890
|
lockoutGuard
|
|
41860
|
-
}) : new
|
|
41891
|
+
}) : new Elysia49,
|
|
41861
41892
|
auditedMfa ? mfaRoutes({
|
|
41862
41893
|
...auditedMfa,
|
|
41863
41894
|
authSessionStore,
|
|
41864
41895
|
cookieSecure: resolvedCookieSecure,
|
|
41865
41896
|
verificationProvider
|
|
41866
|
-
}) : new
|
|
41897
|
+
}) : new Elysia49,
|
|
41867
41898
|
passwordless ? passwordlessRoutes({
|
|
41868
41899
|
...passwordless,
|
|
41869
41900
|
authSessionStore,
|
|
41870
41901
|
cookieSecure: resolvedCookieSecure,
|
|
41871
41902
|
emit: auditEmit
|
|
41872
|
-
}) : new
|
|
41873
|
-
sessions ? sessionRoutes({ ...sessions, authSessionStore }) : new
|
|
41903
|
+
}) : new Elysia49,
|
|
41904
|
+
sessions ? sessionRoutes({ ...sessions, authSessionStore }) : new Elysia49,
|
|
41874
41905
|
sso ? oidcSsoRoutes({
|
|
41875
41906
|
...sso,
|
|
41876
41907
|
authSessionStore,
|
|
41877
41908
|
cookieSecure: resolvedCookieSecure
|
|
41878
|
-
}) : new
|
|
41909
|
+
}) : new Elysia49,
|
|
41879
41910
|
sso && sso.samlAdapter ? samlSsoRoutes({
|
|
41880
41911
|
...sso,
|
|
41881
41912
|
authSessionStore,
|
|
41882
41913
|
cookieSecure: resolvedCookieSecure,
|
|
41883
41914
|
samlAdapter: sso.samlAdapter
|
|
41884
|
-
}) : new
|
|
41915
|
+
}) : new Elysia49
|
|
41885
41916
|
]);
|
|
41886
|
-
const organizationFeatureRoutes = new
|
|
41917
|
+
const organizationFeatureRoutes = new Elysia49().use([
|
|
41887
41918
|
sso && sso.getOrganizationByEmailDomain ? ssoDiscoveryRoute({
|
|
41888
41919
|
getOrganizationByEmailDomain: sso.getOrganizationByEmailDomain,
|
|
41889
41920
|
ssoConnectionStore: sso.ssoConnectionStore,
|
|
41890
41921
|
ssoRoute: sso.ssoRoute
|
|
41891
|
-
}) : new
|
|
41892
|
-
scim ? scimRoutes(scim) : new
|
|
41893
|
-
apikeys ? apiKeysRoutes(apikeys) : new
|
|
41922
|
+
}) : new Elysia49,
|
|
41923
|
+
scim ? scimRoutes(scim) : new Elysia49,
|
|
41924
|
+
apikeys ? apiKeysRoutes(apikeys) : new Elysia49,
|
|
41894
41925
|
oidcConfig ? oidcProviderRoutes({
|
|
41895
41926
|
...oidcConfig,
|
|
41896
41927
|
authSessionStore
|
|
41897
|
-
}) : new
|
|
41928
|
+
}) : new Elysia49,
|
|
41898
41929
|
organizations ? organizationRoutes({
|
|
41899
41930
|
...organizations,
|
|
41900
41931
|
authSessionStore,
|
|
41901
41932
|
emit: auditEmit
|
|
41902
|
-
}) : new
|
|
41933
|
+
}) : new Elysia49,
|
|
41903
41934
|
roles ? roleRoutes({
|
|
41904
41935
|
...roles,
|
|
41905
41936
|
authSessionStore,
|
|
41906
41937
|
emit: auditEmit
|
|
41907
|
-
}) : new
|
|
41938
|
+
}) : new Elysia49
|
|
41908
41939
|
]);
|
|
41909
|
-
const pushApplication = new
|
|
41940
|
+
const pushApplication = new Elysia49;
|
|
41910
41941
|
if (pushConfig && oidcConfig)
|
|
41911
41942
|
pushApplication.use(pushRoutes({
|
|
41912
41943
|
accessTokens: {
|
|
@@ -41916,24 +41947,24 @@ var buildAuthApplications = async (configuration) => {
|
|
|
41916
41947
|
authSessionStore,
|
|
41917
41948
|
config: pushConfig
|
|
41918
41949
|
}));
|
|
41919
|
-
const extendedFeatureRoutes = new
|
|
41950
|
+
const extendedFeatureRoutes = new Elysia49().use([
|
|
41920
41951
|
pushApplication,
|
|
41921
|
-
portal ? portalRoutes({ ...portal, emit: auditEmit }) : new
|
|
41952
|
+
portal ? portalRoutes({ ...portal, emit: auditEmit }) : new Elysia49,
|
|
41922
41953
|
webauthn ? webauthnRoutes({
|
|
41923
41954
|
...webauthn,
|
|
41924
41955
|
authSessionStore,
|
|
41925
41956
|
cookieSecure: resolvedCookieSecure,
|
|
41926
41957
|
emit: auditEmit
|
|
41927
|
-
}) : new
|
|
41958
|
+
}) : new Elysia49,
|
|
41928
41959
|
compliance ? complianceRoutes({
|
|
41929
41960
|
...compliance,
|
|
41930
41961
|
authSessionStore,
|
|
41931
41962
|
emit: auditEmit
|
|
41932
|
-
}) : new
|
|
41963
|
+
}) : new Elysia49,
|
|
41933
41964
|
createConfiguredAuthHtmxRoutes({ authSessionStore, config: htmx }),
|
|
41934
41965
|
agentAuthRoutes(resolvedAgentAuth)
|
|
41935
41966
|
]);
|
|
41936
|
-
const featureRoutes = new
|
|
41967
|
+
const featureRoutes = new Elysia49({
|
|
41937
41968
|
name: "@absolutejs/auth/feature-routes",
|
|
41938
41969
|
seed: pluginSeed
|
|
41939
41970
|
}).use([
|
|
@@ -41956,7 +41987,7 @@ var buildAuthApplications = async (configuration) => {
|
|
|
41956
41987
|
};
|
|
41957
41988
|
var auth = async (configuration) => {
|
|
41958
41989
|
const { authContext, coreRoutes, featureRoutes } = await buildAuthApplications(configuration);
|
|
41959
|
-
const application = new
|
|
41990
|
+
const application = new Elysia49({
|
|
41960
41991
|
name: "@absolutejs/auth",
|
|
41961
41992
|
seed: pluginDependencySeed(configuration)
|
|
41962
41993
|
});
|
|
@@ -42127,6 +42158,7 @@ export {
|
|
|
42127
42158
|
auth2 as auth,
|
|
42128
42159
|
createAbsoluteAuthSyncBridge,
|
|
42129
42160
|
createAuthContext,
|
|
42161
|
+
createCredentialsApi,
|
|
42130
42162
|
createNodeSamlAdapter,
|
|
42131
42163
|
createPostgresScimTokenStore,
|
|
42132
42164
|
createPostgresSetupSessionStore,
|
|
@@ -42144,5 +42176,5 @@ export {
|
|
|
42144
42176
|
userSessionIdTypebox
|
|
42145
42177
|
};
|
|
42146
42178
|
|
|
42147
|
-
//# debugId=
|
|
42179
|
+
//# debugId=57C7A1ECE15922C664756E2164756E21
|
|
42148
42180
|
//# sourceMappingURL=server.js.map
|