@absolutejs/auth 0.74.0 → 0.75.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/README.md +8 -6
- package/dist/apikeys/routes.d.ts +1 -1
- package/dist/compliance/routes.d.ts +1 -1
- package/dist/credentials/emailVerification.d.ts +1 -1
- package/dist/credentials/login.d.ts +1 -1
- package/dist/credentials/passwordReset.d.ts +1 -1
- package/dist/credentials/register.d.ts +1 -1
- package/dist/htmx/configuredRoutes.d.ts +1 -1
- package/dist/htmx/routes.d.ts +1 -1
- package/dist/index.js +116 -57
- package/dist/index.js.map +5 -5
- package/dist/mfa/challenge.d.ts +1 -1
- package/dist/mfa/management.d.ts +1 -1
- package/dist/mfa/sms.d.ts +1 -1
- package/dist/mfa/totp.d.ts +1 -1
- package/dist/nativePush.d.ts +500 -20
- package/dist/organizations/routes.d.ts +1 -1
- package/dist/portal/routes.d.ts +1 -1
- package/dist/roles/routes.d.ts +1 -1
- package/dist/routes/authorize.d.ts +1 -1
- package/dist/routes/callback.d.ts +1 -1
- package/dist/routes/profile.d.ts +1 -1
- package/dist/routes/refresh.d.ts +1 -1
- package/dist/routes/revoke.d.ts +1 -1
- package/dist/routes/sessions.d.ts +1 -1
- package/dist/routes/signout.d.ts +1 -1
- package/dist/routes/userStatus.d.ts +1 -1
- package/dist/scim/routes.d.ts +1 -1
- package/dist/server.js +114 -57
- package/dist/server.js.map +5 -5
- package/dist/sso/discoveryRoute.d.ts +1 -1
- package/dist/sso/oidcRoutes.d.ts +1 -1
- package/dist/sso/samlIdpRoutes.d.ts +1 -1
- package/dist/sso/samlRoutes.d.ts +1 -1
- package/dist/types.d.ts +3 -1
- package/dist/vc/statusListRoutes.d.ts +1 -1
- package/dist/vc/vpRoutes.d.ts +1 -1
- package/dist/webauthn/routes.d.ts +1 -1
- package/package.json +1 -1
package/dist/portal/routes.d.ts
CHANGED
|
@@ -127,7 +127,7 @@ export declare const portalRoutes: ({ emit, onScimTokenCreated, onSsoConnectionC
|
|
|
127
127
|
status?: number | keyof import("elysia").StatusMap;
|
|
128
128
|
cookie?: Record<string, import("elysia").BaseCookie>;
|
|
129
129
|
};
|
|
130
|
-
status: <const Code extends number | keyof import("elysia").StatusMap, const T = Code extends 400 | 401 | 403 | 501 | 204 | 404 | 200 | 301 | 302 | 303 | 307 | 308 | 100 | 101 | 102 | 103 | 201 | 202 | 203 | 205 | 206 | 207 | 208 | 300 | 304 | 402 | 405 | 406 | 407 | 408 |
|
|
130
|
+
status: <const Code extends number | keyof import("elysia").StatusMap, const T = Code extends 400 | 401 | 403 | 501 | 204 | 404 | 200 | 301 | 302 | 303 | 307 | 308 | 409 | 100 | 101 | 102 | 103 | 201 | 202 | 203 | 205 | 206 | 207 | 208 | 300 | 304 | 402 | 405 | 406 | 407 | 408 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 428 | 429 | 431 | 451 | 500 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511 ? {
|
|
131
131
|
readonly 100: "Continue";
|
|
132
132
|
readonly 101: "Switching Protocols";
|
|
133
133
|
readonly 102: "Processing";
|
package/dist/roles/routes.d.ts
CHANGED
|
@@ -78,7 +78,7 @@ export declare const roleRoutes: <UserType>({ authSessionStore, canManageRoles,
|
|
|
78
78
|
status?: number | keyof import("elysia").StatusMap;
|
|
79
79
|
cookie?: Record<string, import("elysia").BaseCookie>;
|
|
80
80
|
};
|
|
81
|
-
status: <const Code extends number | keyof import("elysia").StatusMap, const T = Code extends 400 | 401 | 403 | 501 | 204 | 404 | 200 | 301 | 302 | 303 | 307 | 308 | 100 | 101 | 102 | 103 | 201 | 202 | 203 | 205 | 206 | 207 | 208 | 300 | 304 | 402 | 405 | 406 | 407 | 408 |
|
|
81
|
+
status: <const Code extends number | keyof import("elysia").StatusMap, const T = Code extends 400 | 401 | 403 | 501 | 204 | 404 | 200 | 301 | 302 | 303 | 307 | 308 | 409 | 100 | 101 | 102 | 103 | 201 | 202 | 203 | 205 | 206 | 207 | 208 | 300 | 304 | 402 | 405 | 406 | 407 | 408 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 428 | 429 | 431 | 451 | 500 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511 ? {
|
|
82
82
|
readonly 100: "Continue";
|
|
83
83
|
readonly 101: "Switching Protocols";
|
|
84
84
|
readonly 102: "Processing";
|
|
@@ -44,7 +44,7 @@ export declare const authorize: ({ clientProviders, authorizeRoute, cookieSecure
|
|
|
44
44
|
status?: number | keyof import("elysia").StatusMap;
|
|
45
45
|
cookie?: Record<string, import("elysia").BaseCookie>;
|
|
46
46
|
};
|
|
47
|
-
status: <const Code extends number | keyof import("elysia").StatusMap, const T = Code extends 400 | 401 | 403 | 501 | 204 | 404 | 200 | 301 | 302 | 303 | 307 | 308 | 100 | 101 | 102 | 103 | 201 | 202 | 203 | 205 | 206 | 207 | 208 | 300 | 304 | 402 | 405 | 406 | 407 | 408 |
|
|
47
|
+
status: <const Code extends number | keyof import("elysia").StatusMap, const T = Code extends 400 | 401 | 403 | 501 | 204 | 404 | 200 | 301 | 302 | 303 | 307 | 308 | 409 | 100 | 101 | 102 | 103 | 201 | 202 | 203 | 205 | 206 | 207 | 208 | 300 | 304 | 402 | 405 | 406 | 407 | 408 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 428 | 429 | 431 | 451 | 500 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511 ? {
|
|
48
48
|
readonly 100: "Continue";
|
|
49
49
|
readonly 101: "Switching Protocols";
|
|
50
50
|
readonly 102: "Processing";
|
|
@@ -58,7 +58,7 @@ export declare const callback: <UserType>({ authSessionStore, clientProviders, c
|
|
|
58
58
|
status?: number | keyof import("elysia").StatusMap;
|
|
59
59
|
cookie?: Record<string, import("elysia").BaseCookie>;
|
|
60
60
|
};
|
|
61
|
-
status: <const Code extends number | keyof import("elysia").StatusMap, const T = Code extends 400 | 401 | 403 | 501 | 204 | 404 | 200 | 301 | 302 | 303 | 307 | 308 | 100 | 101 | 102 | 103 | 201 | 202 | 203 | 205 | 206 | 207 | 208 | 300 | 304 | 402 | 405 | 406 | 407 | 408 |
|
|
61
|
+
status: <const Code extends number | keyof import("elysia").StatusMap, const T = Code extends 400 | 401 | 403 | 501 | 204 | 404 | 200 | 301 | 302 | 303 | 307 | 308 | 409 | 100 | 101 | 102 | 103 | 201 | 202 | 203 | 205 | 206 | 207 | 208 | 300 | 304 | 402 | 405 | 406 | 407 | 408 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 428 | 429 | 431 | 451 | 500 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511 ? {
|
|
62
62
|
readonly 100: "Continue";
|
|
63
63
|
readonly 101: "Switching Protocols";
|
|
64
64
|
readonly 102: "Processing";
|
package/dist/routes/profile.d.ts
CHANGED
|
@@ -46,7 +46,7 @@ export declare const profile: <UserType>({ authSessionStore, clientProviders, pr
|
|
|
46
46
|
status?: number | keyof import("elysia").StatusMap;
|
|
47
47
|
cookie?: Record<string, import("elysia").BaseCookie>;
|
|
48
48
|
};
|
|
49
|
-
status: <const Code extends number | keyof import("elysia").StatusMap, const T = Code extends 400 | 401 | 403 | 501 | 204 | 404 | 200 | 301 | 302 | 303 | 307 | 308 | 100 | 101 | 102 | 103 | 201 | 202 | 203 | 205 | 206 | 207 | 208 | 300 | 304 | 402 | 405 | 406 | 407 | 408 |
|
|
49
|
+
status: <const Code extends number | keyof import("elysia").StatusMap, const T = Code extends 400 | 401 | 403 | 501 | 204 | 404 | 200 | 301 | 302 | 303 | 307 | 308 | 409 | 100 | 101 | 102 | 103 | 201 | 202 | 203 | 205 | 206 | 207 | 208 | 300 | 304 | 402 | 405 | 406 | 407 | 408 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 428 | 429 | 431 | 451 | 500 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511 ? {
|
|
50
50
|
readonly 100: "Continue";
|
|
51
51
|
readonly 101: "Switching Protocols";
|
|
52
52
|
readonly 102: "Processing";
|
package/dist/routes/refresh.d.ts
CHANGED
|
@@ -47,7 +47,7 @@ export declare const refresh: <UserType>({ authSessionStore, clientProviders, re
|
|
|
47
47
|
status?: number | keyof import("elysia").StatusMap;
|
|
48
48
|
cookie?: Record<string, import("elysia").BaseCookie>;
|
|
49
49
|
};
|
|
50
|
-
status: <const Code extends number | keyof import("elysia").StatusMap, const T = Code extends 400 | 401 | 403 | 501 | 204 | 404 | 200 | 301 | 302 | 303 | 307 | 308 | 100 | 101 | 102 | 103 | 201 | 202 | 203 | 205 | 206 | 207 | 208 | 300 | 304 | 402 | 405 | 406 | 407 | 408 |
|
|
50
|
+
status: <const Code extends number | keyof import("elysia").StatusMap, const T = Code extends 400 | 401 | 403 | 501 | 204 | 404 | 200 | 301 | 302 | 303 | 307 | 308 | 409 | 100 | 101 | 102 | 103 | 201 | 202 | 203 | 205 | 206 | 207 | 208 | 300 | 304 | 402 | 405 | 406 | 407 | 408 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 428 | 429 | 431 | 451 | 500 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511 ? {
|
|
51
51
|
readonly 100: "Continue";
|
|
52
52
|
readonly 101: "Switching Protocols";
|
|
53
53
|
readonly 102: "Processing";
|
package/dist/routes/revoke.d.ts
CHANGED
|
@@ -46,7 +46,7 @@ export declare const revoke: <UserType>({ authSessionStore, clientProviders, rev
|
|
|
46
46
|
status?: number | keyof import("elysia").StatusMap;
|
|
47
47
|
cookie?: Record<string, import("elysia").BaseCookie>;
|
|
48
48
|
};
|
|
49
|
-
status: <const Code extends number | keyof import("elysia").StatusMap, const T = Code extends 400 | 401 | 403 | 501 | 204 | 404 | 200 | 301 | 302 | 303 | 307 | 308 | 100 | 101 | 102 | 103 | 201 | 202 | 203 | 205 | 206 | 207 | 208 | 300 | 304 | 402 | 405 | 406 | 407 | 408 |
|
|
49
|
+
status: <const Code extends number | keyof import("elysia").StatusMap, const T = Code extends 400 | 401 | 403 | 501 | 204 | 404 | 200 | 301 | 302 | 303 | 307 | 308 | 409 | 100 | 101 | 102 | 103 | 201 | 202 | 203 | 205 | 206 | 207 | 208 | 300 | 304 | 402 | 405 | 406 | 407 | 408 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 428 | 429 | 431 | 451 | 500 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511 ? {
|
|
50
50
|
readonly 100: "Continue";
|
|
51
51
|
readonly 101: "Switching Protocols";
|
|
52
52
|
readonly 102: "Processing";
|
|
@@ -73,7 +73,7 @@ export declare const sessionRoutes: <UserType>({ authSessionStore, getUserId, se
|
|
|
73
73
|
status?: number | keyof import("elysia").StatusMap;
|
|
74
74
|
cookie?: Record<string, import("elysia").BaseCookie>;
|
|
75
75
|
};
|
|
76
|
-
status: <const Code extends number | keyof import("elysia").StatusMap, const T = Code extends 400 | 401 | 403 | 501 | 204 | 404 | 200 | 301 | 302 | 303 | 307 | 308 | 100 | 101 | 102 | 103 | 201 | 202 | 203 | 205 | 206 | 207 | 208 | 300 | 304 | 402 | 405 | 406 | 407 | 408 |
|
|
76
|
+
status: <const Code extends number | keyof import("elysia").StatusMap, const T = Code extends 400 | 401 | 403 | 501 | 204 | 404 | 200 | 301 | 302 | 303 | 307 | 308 | 409 | 100 | 101 | 102 | 103 | 201 | 202 | 203 | 205 | 206 | 207 | 208 | 300 | 304 | 402 | 405 | 406 | 407 | 408 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 428 | 429 | 431 | 451 | 500 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511 ? {
|
|
77
77
|
readonly 100: "Continue";
|
|
78
78
|
readonly 101: "Switching Protocols";
|
|
79
79
|
readonly 102: "Processing";
|
package/dist/routes/signout.d.ts
CHANGED
|
@@ -42,7 +42,7 @@ export declare const signout: <UserType>({ authSessionStore, signoutRoute, onSig
|
|
|
42
42
|
status?: number | keyof import("elysia").StatusMap;
|
|
43
43
|
cookie?: Record<string, import("elysia").BaseCookie>;
|
|
44
44
|
};
|
|
45
|
-
status: <const Code extends number | keyof import("elysia").StatusMap, const T = Code extends 400 | 401 | 403 | 501 | 204 | 404 | 200 | 301 | 302 | 303 | 307 | 308 | 100 | 101 | 102 | 103 | 201 | 202 | 203 | 205 | 206 | 207 | 208 | 300 | 304 | 402 | 405 | 406 | 407 | 408 |
|
|
45
|
+
status: <const Code extends number | keyof import("elysia").StatusMap, const T = Code extends 400 | 401 | 403 | 501 | 204 | 404 | 200 | 301 | 302 | 303 | 307 | 308 | 409 | 100 | 101 | 102 | 103 | 201 | 202 | 203 | 205 | 206 | 207 | 208 | 300 | 304 | 402 | 405 | 406 | 407 | 408 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 428 | 429 | 431 | 451 | 500 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511 ? {
|
|
46
46
|
readonly 100: "Continue";
|
|
47
47
|
readonly 101: "Switching Protocols";
|
|
48
48
|
readonly 102: "Processing";
|
|
@@ -40,7 +40,7 @@ export declare const userStatus: <UserType>({ authSessionStore, statusRoute, onS
|
|
|
40
40
|
status?: number | keyof import("elysia").StatusMap;
|
|
41
41
|
cookie?: Record<string, import("elysia").BaseCookie>;
|
|
42
42
|
};
|
|
43
|
-
status: <const Code extends number | keyof import("elysia").StatusMap, const T = Code extends 400 | 401 | 403 | 501 | 204 | 404 | 200 | 301 | 302 | 303 | 307 | 308 | 100 | 101 | 102 | 103 | 201 | 202 | 203 | 205 | 206 | 207 | 208 | 300 | 304 | 402 | 405 | 406 | 407 | 408 |
|
|
43
|
+
status: <const Code extends number | keyof import("elysia").StatusMap, const T = Code extends 400 | 401 | 403 | 501 | 204 | 404 | 200 | 301 | 302 | 303 | 307 | 308 | 409 | 100 | 101 | 102 | 103 | 201 | 202 | 203 | 205 | 206 | 207 | 208 | 300 | 304 | 402 | 405 | 406 | 407 | 408 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 428 | 429 | 431 | 451 | 500 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511 ? {
|
|
44
44
|
readonly 100: "Continue";
|
|
45
45
|
readonly 101: "Switching Protocols";
|
|
46
46
|
readonly 102: "Processing";
|
package/dist/scim/routes.d.ts
CHANGED
|
@@ -361,7 +361,7 @@ export declare const scimRoutes: ({ customAttributes, getScimGroup, getScimUser,
|
|
|
361
361
|
status?: number | keyof import("elysia").StatusMap;
|
|
362
362
|
cookie?: Record<string, import("elysia").BaseCookie>;
|
|
363
363
|
};
|
|
364
|
-
status: <const Code extends number | keyof import("elysia").StatusMap, const T = Code extends 400 | 401 | 403 | 501 | 204 | 404 | 200 | 301 | 302 | 303 | 307 | 308 | 100 | 101 | 102 | 103 | 201 | 202 | 203 | 205 | 206 | 207 | 208 | 300 | 304 | 402 | 405 | 406 | 407 | 408 |
|
|
364
|
+
status: <const Code extends number | keyof import("elysia").StatusMap, const T = Code extends 400 | 401 | 403 | 501 | 204 | 404 | 200 | 301 | 302 | 303 | 307 | 308 | 409 | 100 | 101 | 102 | 103 | 201 | 202 | 203 | 205 | 206 | 207 | 208 | 300 | 304 | 402 | 405 | 406 | 407 | 408 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 428 | 429 | 431 | 451 | 500 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511 ? {
|
|
365
365
|
readonly 100: "Continue";
|
|
366
366
|
readonly 101: "Switching Protocols";
|
|
367
367
|
readonly 102: "Processing";
|
package/dist/server.js
CHANGED
|
@@ -7187,24 +7187,97 @@ var createMfaGate = ({ getUserId, mfaStore }) => async (user) => isMfaEnrolled(a
|
|
|
7187
7187
|
|
|
7188
7188
|
// src/nativePush.ts
|
|
7189
7189
|
import { Elysia as Elysia17, t as t11 } from "elysia";
|
|
7190
|
+
var DEFAULT_PUSH_ROUTE = "/auth/push";
|
|
7190
7191
|
var DEFAULT_NATIVE_PUSH_ROUTE = "/auth/mobile/push";
|
|
7191
7192
|
var requireServerText = (value, field) => {
|
|
7192
7193
|
const normalized = value.trim();
|
|
7193
7194
|
if (!normalized)
|
|
7194
|
-
throw new TypeError(`
|
|
7195
|
+
throw new TypeError(`Push ${field} must not be empty.`);
|
|
7195
7196
|
return normalized;
|
|
7196
7197
|
};
|
|
7197
7198
|
var isInstallationOwnershipError = (error) => error instanceof Error && error.name === "PushInstallationOwnershipError";
|
|
7198
|
-
var
|
|
7199
|
+
var pushRoutes = ({
|
|
7199
7200
|
accessTokens,
|
|
7200
7201
|
authSessionStore,
|
|
7201
7202
|
config
|
|
7202
7203
|
}) => {
|
|
7203
|
-
const resolveTenant = async (principal) => requireServerText(typeof config.tenant === "function" ? await config.tenant(principal) : config.tenant, "
|
|
7204
|
+
const resolveTenant = async (principal) => requireServerText(typeof config.tenant === "function" ? await config.tenant(principal) : config.tenant, "tenant");
|
|
7204
7205
|
const resolveTopics = async (principal) => [
|
|
7205
7206
|
...new Set((await config.topics?.(principal) ?? []).map((topic) => requireServerText(topic, "topic")))
|
|
7206
7207
|
].sort();
|
|
7207
|
-
|
|
7208
|
+
const register = async (body, principal) => {
|
|
7209
|
+
try {
|
|
7210
|
+
const registration = await config.registrar.registerInstallation({
|
|
7211
|
+
...body.installationId ? { installationId: body.installationId } : {},
|
|
7212
|
+
...body.locale ? { locale: body.locale } : {},
|
|
7213
|
+
...body.platform === "webpush" ? {
|
|
7214
|
+
platform: body.platform,
|
|
7215
|
+
subscription: body.subscription
|
|
7216
|
+
} : { platform: body.platform, token: body.token },
|
|
7217
|
+
tenant: await resolveTenant(principal),
|
|
7218
|
+
topics: await resolveTopics(principal),
|
|
7219
|
+
userId: principal.subject
|
|
7220
|
+
});
|
|
7221
|
+
return {
|
|
7222
|
+
installationId: requireServerText(registration.installationId, "installation id"),
|
|
7223
|
+
registered: true
|
|
7224
|
+
};
|
|
7225
|
+
} catch (error) {
|
|
7226
|
+
if (isInstallationOwnershipError(error))
|
|
7227
|
+
return null;
|
|
7228
|
+
throw error;
|
|
7229
|
+
}
|
|
7230
|
+
};
|
|
7231
|
+
const remove = async (installationId, principal) => {
|
|
7232
|
+
try {
|
|
7233
|
+
await config.registrar.removeInstallation({
|
|
7234
|
+
installationId,
|
|
7235
|
+
tenant: await resolveTenant(principal),
|
|
7236
|
+
userId: principal.subject
|
|
7237
|
+
});
|
|
7238
|
+
} catch (error) {
|
|
7239
|
+
if (isInstallationOwnershipError(error))
|
|
7240
|
+
return false;
|
|
7241
|
+
throw error;
|
|
7242
|
+
}
|
|
7243
|
+
return true;
|
|
7244
|
+
};
|
|
7245
|
+
const commonRegistrationFields = {
|
|
7246
|
+
installationId: t11.Optional(t11.String({ maxLength: 128, minLength: 1 })),
|
|
7247
|
+
locale: t11.Optional(t11.String({ maxLength: 64, minLength: 1 }))
|
|
7248
|
+
};
|
|
7249
|
+
const registrationBody = t11.Union([
|
|
7250
|
+
t11.Object({
|
|
7251
|
+
...commonRegistrationFields,
|
|
7252
|
+
platform: t11.Union([t11.Literal("apns"), t11.Literal("fcm")]),
|
|
7253
|
+
token: t11.String({ maxLength: 8192, minLength: 1 })
|
|
7254
|
+
}),
|
|
7255
|
+
t11.Object({
|
|
7256
|
+
...commonRegistrationFields,
|
|
7257
|
+
platform: t11.Literal("webpush"),
|
|
7258
|
+
subscription: t11.Object({
|
|
7259
|
+
endpoint: t11.String({ maxLength: 8192, minLength: 1 }),
|
|
7260
|
+
keys: t11.Object({
|
|
7261
|
+
auth: t11.String({ maxLength: 8192, minLength: 1 }),
|
|
7262
|
+
p256dh: t11.String({ maxLength: 8192, minLength: 1 })
|
|
7263
|
+
})
|
|
7264
|
+
})
|
|
7265
|
+
})
|
|
7266
|
+
]);
|
|
7267
|
+
const registrationOptions = {
|
|
7268
|
+
body: registrationBody,
|
|
7269
|
+
beforeHandle: ({
|
|
7270
|
+
pushPrincipal,
|
|
7271
|
+
status
|
|
7272
|
+
}) => pushPrincipal ? undefined : status("Unauthorized", "User is not authenticated")
|
|
7273
|
+
};
|
|
7274
|
+
const removalOptions = {
|
|
7275
|
+
body: t11.Object({
|
|
7276
|
+
installationId: t11.String({ maxLength: 128, minLength: 1 })
|
|
7277
|
+
}),
|
|
7278
|
+
beforeHandle: registrationOptions.beforeHandle
|
|
7279
|
+
};
|
|
7280
|
+
return new Elysia17({ name: "@absolutejs/auth/push" }).use(sessionStore()).guard({
|
|
7208
7281
|
cookie: t11.Cookie({ user_session_id: userSessionIdTypebox }),
|
|
7209
7282
|
schema: "merge"
|
|
7210
7283
|
}).derive(async ({
|
|
@@ -7225,56 +7298,36 @@ var nativePushRoutes = ({
|
|
|
7225
7298
|
authorization: headers.authorization,
|
|
7226
7299
|
config: accessTokens
|
|
7227
7300
|
});
|
|
7228
|
-
return {
|
|
7229
|
-
}).post(
|
|
7230
|
-
|
|
7231
|
-
installationId: t11.Optional(t11.String({ maxLength: 128, minLength: 1 })),
|
|
7232
|
-
locale: t11.Optional(t11.String({ maxLength: 64, minLength: 1 })),
|
|
7233
|
-
platform: t11.Union([t11.Literal("apns"), t11.Literal("fcm")]),
|
|
7234
|
-
token: t11.String({ maxLength: 8192, minLength: 1 })
|
|
7235
|
-
}),
|
|
7236
|
-
beforeHandle: ({ nativePushPrincipal, status }) => nativePushPrincipal ? undefined : status("Unauthorized", "User is not authenticated")
|
|
7237
|
-
}, async ({ body, nativePushPrincipal, status }) => {
|
|
7238
|
-
if (!nativePushPrincipal)
|
|
7301
|
+
return { pushPrincipal: principal };
|
|
7302
|
+
}).post(DEFAULT_PUSH_ROUTE, registrationOptions, async ({ body, pushPrincipal, status }) => {
|
|
7303
|
+
if (!pushPrincipal)
|
|
7239
7304
|
return status("Unauthorized", "User is not authenticated");
|
|
7240
|
-
|
|
7241
|
-
|
|
7242
|
-
|
|
7243
|
-
|
|
7244
|
-
|
|
7245
|
-
|
|
7246
|
-
|
|
7247
|
-
|
|
7248
|
-
|
|
7249
|
-
|
|
7250
|
-
|
|
7251
|
-
|
|
7252
|
-
|
|
7253
|
-
|
|
7254
|
-
|
|
7255
|
-
|
|
7256
|
-
|
|
7257
|
-
|
|
7258
|
-
|
|
7259
|
-
installationId: requireServerText(registration.installationId, "installation id"),
|
|
7260
|
-
registered: true
|
|
7261
|
-
};
|
|
7262
|
-
}).delete(DEFAULT_NATIVE_PUSH_ROUTE, {
|
|
7263
|
-
body: t11.Object({
|
|
7264
|
-
installationId: t11.String({ maxLength: 128, minLength: 1 })
|
|
7265
|
-
}),
|
|
7266
|
-
beforeHandle: ({ nativePushPrincipal, status }) => nativePushPrincipal ? undefined : status("Unauthorized", "User is not authenticated")
|
|
7267
|
-
}, async ({ body, nativePushPrincipal, status }) => {
|
|
7268
|
-
if (!nativePushPrincipal)
|
|
7305
|
+
const result = await register(body, pushPrincipal);
|
|
7306
|
+
return result ?? status("Conflict", {
|
|
7307
|
+
code: "installation-ownership"
|
|
7308
|
+
});
|
|
7309
|
+
}).post(DEFAULT_NATIVE_PUSH_ROUTE, registrationOptions, async ({ body, pushPrincipal, status }) => {
|
|
7310
|
+
if (!pushPrincipal)
|
|
7311
|
+
return status("Unauthorized", "User is not authenticated");
|
|
7312
|
+
const result = await register(body, pushPrincipal);
|
|
7313
|
+
return result ?? status("Conflict", {
|
|
7314
|
+
code: "installation-ownership"
|
|
7315
|
+
});
|
|
7316
|
+
}).delete(DEFAULT_PUSH_ROUTE, removalOptions, async ({ body, pushPrincipal, status }) => {
|
|
7317
|
+
if (!pushPrincipal)
|
|
7318
|
+
return status("Unauthorized", "User is not authenticated");
|
|
7319
|
+
return await remove(body.installationId, pushPrincipal) ? { removed: true } : status("Conflict", {
|
|
7320
|
+
code: "installation-ownership"
|
|
7321
|
+
});
|
|
7322
|
+
}).delete(DEFAULT_NATIVE_PUSH_ROUTE, removalOptions, async ({ body, pushPrincipal, status }) => {
|
|
7323
|
+
if (!pushPrincipal)
|
|
7269
7324
|
return status("Unauthorized", "User is not authenticated");
|
|
7270
|
-
await
|
|
7271
|
-
|
|
7272
|
-
tenant: await resolveTenant(nativePushPrincipal),
|
|
7273
|
-
userId: nativePushPrincipal.subject
|
|
7325
|
+
return await remove(body.installationId, pushPrincipal) ? { removed: true } : status("Conflict", {
|
|
7326
|
+
code: "installation-ownership"
|
|
7274
7327
|
});
|
|
7275
|
-
return { removed: true };
|
|
7276
7328
|
});
|
|
7277
7329
|
};
|
|
7330
|
+
var nativePushRoutes = pushRoutes;
|
|
7278
7331
|
|
|
7279
7332
|
// src/mfa/routes.ts
|
|
7280
7333
|
import { Elysia as Elysia22 } from "elysia";
|
|
@@ -41043,6 +41096,7 @@ var buildAuthApplications = async (configuration) => {
|
|
|
41043
41096
|
customProviders,
|
|
41044
41097
|
mfa,
|
|
41045
41098
|
nativePush: nativePush2,
|
|
41099
|
+
push,
|
|
41046
41100
|
verificationProvider,
|
|
41047
41101
|
passwordless,
|
|
41048
41102
|
lockout,
|
|
@@ -41079,8 +41133,11 @@ var buildAuthApplications = async (configuration) => {
|
|
|
41079
41133
|
onRevocationError,
|
|
41080
41134
|
onSessionCleanup
|
|
41081
41135
|
} = configuration;
|
|
41082
|
-
if (
|
|
41083
|
-
throw new Error("
|
|
41136
|
+
if (push && nativePush2)
|
|
41137
|
+
throw new Error("Configure `push`, not both `push` and `nativePush`");
|
|
41138
|
+
const pushConfig = push ?? nativePush2;
|
|
41139
|
+
if (pushConfig && !oidc)
|
|
41140
|
+
throw new Error("push requires the OIDC provider");
|
|
41084
41141
|
if (agentAuth?.agentRegistration !== undefined) {
|
|
41085
41142
|
if (oidc === undefined) {
|
|
41086
41143
|
throw new Error("agentAuth.agentRegistration requires the OIDC provider");
|
|
@@ -41324,18 +41381,18 @@ var buildAuthApplications = async (configuration) => {
|
|
|
41324
41381
|
emit: auditEmit
|
|
41325
41382
|
}) : new Elysia48
|
|
41326
41383
|
]);
|
|
41327
|
-
const
|
|
41328
|
-
if (
|
|
41329
|
-
|
|
41384
|
+
const pushApplication = new Elysia48;
|
|
41385
|
+
if (pushConfig && oidcConfig)
|
|
41386
|
+
pushApplication.use(pushRoutes({
|
|
41330
41387
|
accessTokens: {
|
|
41331
41388
|
oidc: oidcConfig,
|
|
41332
41389
|
getUser: async (subject) => await getUser(subject) ?? null
|
|
41333
41390
|
},
|
|
41334
41391
|
authSessionStore,
|
|
41335
|
-
config:
|
|
41392
|
+
config: pushConfig
|
|
41336
41393
|
}));
|
|
41337
41394
|
const extendedFeatureRoutes = new Elysia48().use([
|
|
41338
|
-
|
|
41395
|
+
pushApplication,
|
|
41339
41396
|
portal ? portalRoutes({ ...portal, emit: auditEmit }) : new Elysia48,
|
|
41340
41397
|
webauthn ? webauthnRoutes({
|
|
41341
41398
|
...webauthn,
|
|
@@ -41562,5 +41619,5 @@ export {
|
|
|
41562
41619
|
VerificationProviderError
|
|
41563
41620
|
};
|
|
41564
41621
|
|
|
41565
|
-
//# debugId=
|
|
41622
|
+
//# debugId=471E09DA92BB95D564756E2164756E21
|
|
41566
41623
|
//# sourceMappingURL=server.js.map
|