@absolutejs/auth 0.74.0 → 0.75.1

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.
Files changed (47) hide show
  1. package/README.md +21 -6
  2. package/dist/agents/index.js +46 -11
  3. package/dist/agents/index.js.map +4 -4
  4. package/dist/agents/oidcAdapter.d.ts +3 -1
  5. package/dist/apikeys/routes.d.ts +1 -1
  6. package/dist/compliance/routes.d.ts +1 -1
  7. package/dist/credentials/emailVerification.d.ts +1 -1
  8. package/dist/credentials/login.d.ts +1 -1
  9. package/dist/credentials/passwordReset.d.ts +1 -1
  10. package/dist/credentials/register.d.ts +1 -1
  11. package/dist/htmx/configuredRoutes.d.ts +1 -1
  12. package/dist/htmx/routes.d.ts +1 -1
  13. package/dist/index.d.ts +1 -1
  14. package/dist/index.js +166 -68
  15. package/dist/index.js.map +8 -8
  16. package/dist/mfa/challenge.d.ts +1 -1
  17. package/dist/mfa/management.d.ts +1 -1
  18. package/dist/mfa/sms.d.ts +1 -1
  19. package/dist/mfa/totp.d.ts +1 -1
  20. package/dist/nativePush.d.ts +500 -20
  21. package/dist/oidc/dpop.d.ts +6 -2
  22. package/dist/oidc/index.d.ts +1 -0
  23. package/dist/oidc/index.js +130 -1
  24. package/dist/oidc/index.js.map +4 -3
  25. package/dist/organizations/routes.d.ts +1 -1
  26. package/dist/portal/routes.d.ts +1 -1
  27. package/dist/roles/routes.d.ts +1 -1
  28. package/dist/routes/authorize.d.ts +1 -1
  29. package/dist/routes/callback.d.ts +1 -1
  30. package/dist/routes/profile.d.ts +1 -1
  31. package/dist/routes/refresh.d.ts +1 -1
  32. package/dist/routes/revoke.d.ts +1 -1
  33. package/dist/routes/sessions.d.ts +1 -1
  34. package/dist/routes/signout.d.ts +1 -1
  35. package/dist/routes/userStatus.d.ts +1 -1
  36. package/dist/scim/routes.d.ts +1 -1
  37. package/dist/server.js +164 -68
  38. package/dist/server.js.map +8 -8
  39. package/dist/sso/discoveryRoute.d.ts +1 -1
  40. package/dist/sso/oidcRoutes.d.ts +1 -1
  41. package/dist/sso/samlIdpRoutes.d.ts +1 -1
  42. package/dist/sso/samlRoutes.d.ts +1 -1
  43. package/dist/types.d.ts +3 -1
  44. package/dist/vc/statusListRoutes.d.ts +1 -1
  45. package/dist/vc/vpRoutes.d.ts +1 -1
  46. package/dist/webauthn/routes.d.ts +1 -1
  47. package/package.json +1 -1
@@ -43,7 +43,7 @@ export declare const mfaChallenge: <UserType>({ authSessionStore, challengeRoute
43
43
  status?: number | keyof import("elysia").StatusMap;
44
44
  cookie?: Record<string, import("elysia").BaseCookie>;
45
45
  };
46
- 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 | 409 | 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
+ 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 ? {
47
47
  readonly 100: "Continue";
48
48
  readonly 101: "Switching Protocols";
49
49
  readonly 102: "Processing";
@@ -79,7 +79,7 @@ export declare const mfaManagementRoutes: <UserType>({ authSessionStore, getUser
79
79
  status?: number | keyof import("elysia").StatusMap;
80
80
  cookie?: Record<string, import("elysia").BaseCookie>;
81
81
  };
82
- 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 | 409 | 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
+ 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 ? {
83
83
  readonly 100: "Continue";
84
84
  readonly 101: "Switching Protocols";
85
85
  readonly 102: "Processing";
package/dist/mfa/sms.d.ts CHANGED
@@ -116,7 +116,7 @@ export declare const mfaSmsRoutes: <UserType>({ authSessionStore, getUserId, mfa
116
116
  status?: number | keyof import("elysia").StatusMap;
117
117
  cookie?: Record<string, import("elysia").BaseCookie>;
118
118
  };
119
- 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 | 409 | 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 ? {
119
+ 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 ? {
120
120
  readonly 100: "Continue";
121
121
  readonly 101: "Switching Protocols";
122
122
  readonly 102: "Processing";
@@ -66,7 +66,7 @@ export declare const mfaTotpRoutes: <UserType>({ authSessionStore, backupCodeCou
66
66
  status?: number | keyof import("elysia").StatusMap;
67
67
  cookie?: Record<string, import("elysia").BaseCookie>;
68
68
  };
69
- 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 | 409 | 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 ? {
69
+ 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 ? {
70
70
  readonly 100: "Continue";
71
71
  readonly 101: "Switching Protocols";
72
72
  readonly 102: "Processing";
@@ -1,41 +1,420 @@
1
1
  import type { AuthSessionSource } from './session/types';
2
2
  import { type AccessTokenPrincipalConfig, type AuthPrincipal } from './principal';
3
3
  export declare const DEFAULT_NATIVE_PUSH_ROUTE: "/auth/mobile/push";
4
- export type NativePushPlatform = 'apns' | 'fcm';
5
- export type NativePushRegistrationInput = {
4
+ /** Canonical cross-platform push route. */
5
+ export declare const DEFAULT_PUSH_ROUTE: "/auth/push";
6
+ export type PushPlatform = 'apns' | 'fcm' | 'webpush';
7
+ /** @deprecated Use PushPlatform. */
8
+ export type NativePushPlatform = PushPlatform;
9
+ export type WebPushRegistration = {
10
+ endpoint: string;
11
+ keys: {
12
+ auth: string;
13
+ p256dh: string;
14
+ };
15
+ };
16
+ type PushRegistrationCredential = {
17
+ platform: 'apns' | 'fcm';
18
+ token: string;
19
+ } | {
20
+ platform: 'webpush';
21
+ subscription: WebPushRegistration;
22
+ };
23
+ export type PushRegistrationInput = PushRegistrationCredential & {
6
24
  /** Opaque server-issued installation identity, absent on first registration. */
7
25
  installationId?: string;
8
26
  locale?: string;
9
- platform: NativePushPlatform;
10
27
  tenant: string;
11
- token: string;
12
28
  topics: readonly string[];
13
29
  userId: string;
14
30
  };
15
- export type NativePushRemovalInput = {
31
+ /** @deprecated Use PushRegistrationInput. */
32
+ export type NativePushRegistrationInput = PushRegistrationInput;
33
+ export type PushRemovalInput = {
16
34
  installationId: string;
17
35
  tenant: string;
18
36
  userId: string;
19
37
  };
20
- export type NativePushRegistrar = {
38
+ /** @deprecated Use PushRemovalInput. */
39
+ export type NativePushRemovalInput = PushRemovalInput;
40
+ export type PushRegistrar = {
21
41
  /** Must verify ownership when installationId is present. */
22
- registerInstallation(input: NativePushRegistrationInput): Promise<{
42
+ registerInstallation(input: PushRegistrationInput): Promise<{
23
43
  installationId: string;
24
44
  }>;
25
45
  /** Remove every provider token for this authenticated installation identity. */
26
- removeInstallation(input: NativePushRemovalInput): Promise<void>;
46
+ removeInstallation(input: PushRemovalInput): Promise<void>;
27
47
  };
28
- export type NativePushConfig<UserType> = {
29
- registrar: NativePushRegistrar;
48
+ /** @deprecated Use PushRegistrar. */
49
+ export type NativePushRegistrar = PushRegistrar;
50
+ export type PushConfig<UserType> = {
51
+ registrar: PushRegistrar;
30
52
  /** Server-owned tenant identity. Clients cannot submit or override it. */
31
53
  tenant: string | ((principal: AuthPrincipal<UserType>) => Promise<string> | string);
32
54
  /** Server-owned topics. Clients cannot subscribe themselves to arbitrary topics. */
33
55
  topics?: (principal: AuthPrincipal<UserType>) => Promise<readonly string[]> | readonly string[];
34
56
  };
57
+ /** @deprecated Use PushConfig. */
58
+ export type NativePushConfig<UserType> = PushConfig<UserType>;
59
+ export declare const pushRoutes: <UserType>({ accessTokens, authSessionStore, config }: {
60
+ accessTokens: AccessTokenPrincipalConfig<UserType>;
61
+ authSessionStore?: AuthSessionSource<UserType>;
62
+ config: PushConfig<UserType>;
63
+ }) => import("elysia/types").AddRoute<"", "local", {
64
+ decorator: {};
65
+ store: {
66
+ session: import("./types").SessionRecord<UserType>;
67
+ unregisteredSession: import("./types").UnregisteredSessionRecord;
68
+ };
69
+ derive: {};
70
+ }, {
71
+ typebox: {};
72
+ error: [];
73
+ }, import("elysia/types").DefaultMetadata, {
74
+ auth: {
75
+ push: {
76
+ post: {
77
+ body: {
78
+ installationId?: string | undefined;
79
+ locale?: string | undefined;
80
+ token: string;
81
+ platform: "apns" | "fcm";
82
+ } | {
83
+ installationId?: string | undefined;
84
+ locale?: string | undefined;
85
+ platform: "webpush";
86
+ subscription: {
87
+ keys: {
88
+ auth: string;
89
+ p256dh: string;
90
+ };
91
+ endpoint: string;
92
+ };
93
+ };
94
+ params: {};
95
+ query: unknown;
96
+ headers: unknown;
97
+ response: {
98
+ 401: "User is not authenticated";
99
+ 200: {
100
+ installationId: string;
101
+ registered: true;
102
+ };
103
+ 409: {
104
+ readonly code: "installation-ownership";
105
+ };
106
+ 422: {
107
+ type: "validation";
108
+ title: "Validation Error";
109
+ status: 422;
110
+ detail?: string;
111
+ on: string;
112
+ found?: unknown;
113
+ property?: string;
114
+ expected?: string;
115
+ };
116
+ };
117
+ error: never;
118
+ };
119
+ };
120
+ };
121
+ } & {
122
+ auth: {
123
+ mobile: {
124
+ push: {
125
+ post: {
126
+ body: {
127
+ installationId?: string | undefined;
128
+ locale?: string | undefined;
129
+ token: string;
130
+ platform: "apns" | "fcm";
131
+ } | {
132
+ installationId?: string | undefined;
133
+ locale?: string | undefined;
134
+ platform: "webpush";
135
+ subscription: {
136
+ keys: {
137
+ auth: string;
138
+ p256dh: string;
139
+ };
140
+ endpoint: string;
141
+ };
142
+ };
143
+ params: {};
144
+ query: unknown;
145
+ headers: unknown;
146
+ response: {
147
+ 401: "User is not authenticated";
148
+ 200: {
149
+ installationId: string;
150
+ registered: true;
151
+ };
152
+ 409: {
153
+ readonly code: "installation-ownership";
154
+ };
155
+ 422: {
156
+ type: "validation";
157
+ title: "Validation Error";
158
+ status: 422;
159
+ detail?: string;
160
+ on: string;
161
+ found?: unknown;
162
+ property?: string;
163
+ expected?: string;
164
+ };
165
+ };
166
+ error: never;
167
+ };
168
+ };
169
+ };
170
+ };
171
+ } & {
172
+ auth: {
173
+ push: {
174
+ delete: {
175
+ body: {
176
+ installationId: string;
177
+ };
178
+ params: {};
179
+ query: unknown;
180
+ headers: unknown;
181
+ response: {
182
+ 401: "User is not authenticated";
183
+ 200: {
184
+ removed: true;
185
+ };
186
+ 409: {
187
+ readonly code: "installation-ownership";
188
+ };
189
+ 422: {
190
+ type: "validation";
191
+ title: "Validation Error";
192
+ status: 422;
193
+ detail?: string;
194
+ on: string;
195
+ found?: unknown;
196
+ property?: string;
197
+ expected?: string;
198
+ };
199
+ };
200
+ error: never;
201
+ };
202
+ };
203
+ };
204
+ }, import("elysia/types").DefaultEphemeral, {
205
+ derive: {
206
+ readonly pushPrincipal: AuthPrincipal<UserType> | undefined;
207
+ };
208
+ schema: {};
209
+ schemas: import("elysia").UnwrapRoute<{
210
+ cookie: import("elysia").TCookieObject<{
211
+ user_session_id: import("typebox").TOptional<import("typebox").TTemplateLiteral<"^.*-.*-.*-.*-.*$">>;
212
+ }>;
213
+ schema: "merge";
214
+ }, {}, "">;
215
+ response: import("elysia/types").ExtractErrorFromHandle<{
216
+ readonly pushPrincipal: AuthPrincipal<UserType> | undefined;
217
+ }>;
218
+ error: [];
219
+ }, "delete", "/auth/mobile/push", import("elysia/types").IntersectIfObjectSchema<import("elysia").UnwrapRoute<{
220
+ beforeHandle: ({ pushPrincipal, status }: {
221
+ pushPrincipal: AuthPrincipal<UserType> | undefined;
222
+ status: (code: "Unauthorized", body: string) => unknown;
223
+ }) => unknown;
224
+ body: import("typebox").TObject<{
225
+ installationId: import("typebox").TString;
226
+ }>;
227
+ }, {}, "/auth/mobile/push">, import("elysia/types").MergeScopedSchemas<{}, {}, import("elysia").UnwrapRoute<{
228
+ cookie: import("elysia").TCookieObject<{
229
+ user_session_id: import("typebox").TOptional<import("typebox").TTemplateLiteral<"^.*-.*-.*-.*-.*$">>;
230
+ }>;
231
+ schema: "merge";
232
+ }, {}, "">>>, {}, ({ body, pushPrincipal, status }: {
233
+ body: {
234
+ installationId: string;
235
+ };
236
+ query: Record<string, string | undefined>;
237
+ params: {};
238
+ headers: Record<string, string | undefined>;
239
+ cookie: Record<string, import("elysia").Cookie<unknown>> & {
240
+ user_session_id: import("elysia").Cookie<`${string}-${string}-${string}-${string}-${string}` | undefined>;
241
+ };
242
+ server: import("elysia").Server | null;
243
+ redirect: import("elysia").redirect;
244
+ set: {
245
+ headers: import("elysia").HTTPHeaders;
246
+ status?: number | keyof import("elysia").StatusMap;
247
+ cookie?: Record<string, import("elysia").BaseCookie>;
248
+ };
249
+ 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 ? {
250
+ readonly 100: "Continue";
251
+ readonly 101: "Switching Protocols";
252
+ readonly 102: "Processing";
253
+ readonly 103: "Early Hints";
254
+ readonly 200: "OK";
255
+ readonly 201: "Created";
256
+ readonly 202: "Accepted";
257
+ readonly 203: "Non-Authoritative Information";
258
+ readonly 204: "No Content";
259
+ readonly 205: "Reset Content";
260
+ readonly 206: "Partial Content";
261
+ readonly 207: "Multi-Status";
262
+ readonly 208: "Already Reported";
263
+ readonly 300: "Multiple Choices";
264
+ readonly 301: "Moved Permanently";
265
+ readonly 302: "Found";
266
+ readonly 303: "See Other";
267
+ readonly 304: "Not Modified";
268
+ readonly 307: "Temporary Redirect";
269
+ readonly 308: "Permanent Redirect";
270
+ readonly 400: "Bad Request";
271
+ readonly 401: "Unauthorized";
272
+ readonly 402: "Payment Required";
273
+ readonly 403: "Forbidden";
274
+ readonly 404: "Not Found";
275
+ readonly 405: "Method Not Allowed";
276
+ readonly 406: "Not Acceptable";
277
+ readonly 407: "Proxy Authentication Required";
278
+ readonly 408: "Request Timeout";
279
+ readonly 409: "Conflict";
280
+ readonly 410: "Gone";
281
+ readonly 411: "Length Required";
282
+ readonly 412: "Precondition Failed";
283
+ readonly 413: "Payload Too Large";
284
+ readonly 414: "URI Too Long";
285
+ readonly 415: "Unsupported Media Type";
286
+ readonly 416: "Range Not Satisfiable";
287
+ readonly 417: "Expectation Failed";
288
+ readonly 418: "I'm a teapot";
289
+ readonly 420: "Enhance Your Calm";
290
+ readonly 421: "Misdirected Request";
291
+ readonly 422: "Unprocessable Content";
292
+ readonly 423: "Locked";
293
+ readonly 424: "Failed Dependency";
294
+ readonly 425: "Too Early";
295
+ readonly 426: "Upgrade Required";
296
+ readonly 428: "Precondition Required";
297
+ readonly 429: "Too Many Requests";
298
+ readonly 431: "Request Header Fields Too Large";
299
+ readonly 451: "Unavailable For Legal Reasons";
300
+ readonly 500: "Internal Server Error";
301
+ readonly 501: "Not Implemented";
302
+ readonly 502: "Bad Gateway";
303
+ readonly 503: "Service Unavailable";
304
+ readonly 504: "Gateway Timeout";
305
+ readonly 505: "HTTP Version Not Supported";
306
+ readonly 506: "Variant Also Negotiates";
307
+ readonly 507: "Insufficient Storage";
308
+ readonly 508: "Loop Detected";
309
+ readonly 510: "Not Extended";
310
+ readonly 511: "Network Authentication Required";
311
+ }[Code] : Code>(code: Code, response?: T) => import("elysia").ElysiaStatus<Code, T, Code extends "Continue" | "Switching Protocols" | "Processing" | "Early Hints" | "OK" | "Created" | "Accepted" | "Non-Authoritative Information" | "No Content" | "Reset Content" | "Partial Content" | "Multi-Status" | "Already Reported" | "Multiple Choices" | "Moved Permanently" | "Found" | "See Other" | "Not Modified" | "Temporary Redirect" | "Permanent Redirect" | "Bad Request" | "Unauthorized" | "Payment Required" | "Forbidden" | "Not Found" | "Method Not Allowed" | "Not Acceptable" | "Proxy Authentication Required" | "Request Timeout" | "Conflict" | "Gone" | "Length Required" | "Precondition Failed" | "Payload Too Large" | "URI Too Long" | "Unsupported Media Type" | "Range Not Satisfiable" | "Expectation Failed" | "I'm a teapot" | "Enhance Your Calm" | "Misdirected Request" | "Unprocessable Content" | "Locked" | "Failed Dependency" | "Too Early" | "Upgrade Required" | "Precondition Required" | "Too Many Requests" | "Request Header Fields Too Large" | "Unavailable For Legal Reasons" | "Internal Server Error" | "Not Implemented" | "Bad Gateway" | "Service Unavailable" | "Gateway Timeout" | "HTTP Version Not Supported" | "Variant Also Negotiates" | "Insufficient Storage" | "Loop Detected" | "Not Extended" | "Network Authentication Required" ? {
312
+ readonly Continue: 100;
313
+ readonly "Switching Protocols": 101;
314
+ readonly Processing: 102;
315
+ readonly "Early Hints": 103;
316
+ readonly OK: 200;
317
+ readonly Created: 201;
318
+ readonly Accepted: 202;
319
+ readonly "Non-Authoritative Information": 203;
320
+ readonly "No Content": 204;
321
+ readonly "Reset Content": 205;
322
+ readonly "Partial Content": 206;
323
+ readonly "Multi-Status": 207;
324
+ readonly "Already Reported": 208;
325
+ readonly "Multiple Choices": 300;
326
+ readonly "Moved Permanently": 301;
327
+ readonly Found: 302;
328
+ readonly "See Other": 303;
329
+ readonly "Not Modified": 304;
330
+ readonly "Temporary Redirect": 307;
331
+ readonly "Permanent Redirect": 308;
332
+ readonly "Bad Request": 400;
333
+ readonly Unauthorized: 401;
334
+ readonly "Payment Required": 402;
335
+ readonly Forbidden: 403;
336
+ readonly "Not Found": 404;
337
+ readonly "Method Not Allowed": 405;
338
+ readonly "Not Acceptable": 406;
339
+ readonly "Proxy Authentication Required": 407;
340
+ readonly "Request Timeout": 408;
341
+ readonly Conflict: 409;
342
+ readonly Gone: 410;
343
+ readonly "Length Required": 411;
344
+ readonly "Precondition Failed": 412;
345
+ readonly "Payload Too Large": 413;
346
+ readonly "URI Too Long": 414;
347
+ readonly "Unsupported Media Type": 415;
348
+ readonly "Range Not Satisfiable": 416;
349
+ readonly "Expectation Failed": 417;
350
+ readonly "I'm a teapot": 418;
351
+ readonly "Enhance Your Calm": 420;
352
+ readonly "Misdirected Request": 421;
353
+ readonly "Unprocessable Content": 422;
354
+ readonly Locked: 423;
355
+ readonly "Failed Dependency": 424;
356
+ readonly "Too Early": 425;
357
+ readonly "Upgrade Required": 426;
358
+ readonly "Precondition Required": 428;
359
+ readonly "Too Many Requests": 429;
360
+ readonly "Request Header Fields Too Large": 431;
361
+ readonly "Unavailable For Legal Reasons": 451;
362
+ readonly "Internal Server Error": 500;
363
+ readonly "Not Implemented": 501;
364
+ readonly "Bad Gateway": 502;
365
+ readonly "Service Unavailable": 503;
366
+ readonly "Gateway Timeout": 504;
367
+ readonly "HTTP Version Not Supported": 505;
368
+ readonly "Variant Also Negotiates": 506;
369
+ readonly "Insufficient Storage": 507;
370
+ readonly "Loop Detected": 508;
371
+ readonly "Not Extended": 510;
372
+ readonly "Network Authentication Required": 511;
373
+ }[Code] : Code>;
374
+ defer: (fn: import("elysia/types").AfterResponseHandler<NoInfer<import("elysia/types").IntersectIfObjectSchema<import("elysia").UnwrapRoute<{
375
+ beforeHandle: ({ pushPrincipal, status }: {
376
+ pushPrincipal: AuthPrincipal<UserType> | undefined;
377
+ status: (code: "Unauthorized", body: string) => unknown;
378
+ }) => unknown;
379
+ body: import("typebox").TObject<{
380
+ installationId: import("typebox").TString;
381
+ }>;
382
+ }, {}, "/auth/mobile/push">, import("elysia/types").MergeScopedSchemas<{}, {}, import("elysia").UnwrapRoute<{
383
+ cookie: import("elysia").TCookieObject<{
384
+ user_session_id: import("typebox").TOptional<import("typebox").TTemplateLiteral<"^.*-.*-.*-.*-.*$">>;
385
+ }>;
386
+ schema: "merge";
387
+ }, {}, "">>>>, NoInfer<{
388
+ decorator: {};
389
+ store: {
390
+ session: import("./types").SessionRecord<UserType>;
391
+ unregisteredSession: import("./types").UnregisteredSessionRecord;
392
+ };
393
+ derive: {};
394
+ } & {
395
+ derive: {
396
+ readonly pushPrincipal: AuthPrincipal<UserType> | undefined;
397
+ };
398
+ }>>) => import("elysia/types").MaybePromise<void>;
399
+ readonly path: string;
400
+ route?: string | undefined;
401
+ rid?: string | undefined;
402
+ request: Request;
403
+ store: {
404
+ session: import("./types").SessionRecord<UserType>;
405
+ unregisteredSession: import("./types").UnregisteredSessionRecord;
406
+ };
407
+ readonly pushPrincipal: AuthPrincipal<UserType> | undefined;
408
+ }) => Promise<import("elysia").ElysiaStatus<"Unauthorized", "User is not authenticated", 401> | import("elysia").ElysiaStatus<"Conflict", {
409
+ readonly code: "installation-ownership";
410
+ }, 409> | {
411
+ removed: true;
412
+ }>>;
413
+ /** @deprecated Use pushRoutes. */
35
414
  export declare const nativePushRoutes: <UserType>({ accessTokens, authSessionStore, config }: {
36
415
  accessTokens: AccessTokenPrincipalConfig<UserType>;
37
416
  authSessionStore?: AuthSessionSource<UserType>;
38
- config: NativePushConfig<UserType>;
417
+ config: PushConfig<UserType>;
39
418
  }) => import("elysia/types").AddRoute<"", "local", {
40
419
  decorator: {};
41
420
  store: {
@@ -47,6 +426,54 @@ export declare const nativePushRoutes: <UserType>({ accessTokens, authSessionSto
47
426
  typebox: {};
48
427
  error: [];
49
428
  }, import("elysia/types").DefaultMetadata, {
429
+ auth: {
430
+ push: {
431
+ post: {
432
+ body: {
433
+ installationId?: string | undefined;
434
+ locale?: string | undefined;
435
+ token: string;
436
+ platform: "apns" | "fcm";
437
+ } | {
438
+ installationId?: string | undefined;
439
+ locale?: string | undefined;
440
+ platform: "webpush";
441
+ subscription: {
442
+ keys: {
443
+ auth: string;
444
+ p256dh: string;
445
+ };
446
+ endpoint: string;
447
+ };
448
+ };
449
+ params: {};
450
+ query: unknown;
451
+ headers: unknown;
452
+ response: {
453
+ 401: "User is not authenticated";
454
+ 200: {
455
+ installationId: string;
456
+ registered: true;
457
+ };
458
+ 409: {
459
+ readonly code: "installation-ownership";
460
+ };
461
+ 422: {
462
+ type: "validation";
463
+ title: "Validation Error";
464
+ status: 422;
465
+ detail?: string;
466
+ on: string;
467
+ found?: unknown;
468
+ property?: string;
469
+ expected?: string;
470
+ };
471
+ };
472
+ error: never;
473
+ };
474
+ };
475
+ };
476
+ } & {
50
477
  auth: {
51
478
  mobile: {
52
479
  push: {
@@ -56,6 +483,17 @@ export declare const nativePushRoutes: <UserType>({ accessTokens, authSessionSto
56
483
  locale?: string | undefined;
57
484
  token: string;
58
485
  platform: "apns" | "fcm";
486
+ } | {
487
+ installationId?: string | undefined;
488
+ locale?: string | undefined;
489
+ platform: "webpush";
490
+ subscription: {
491
+ keys: {
492
+ auth: string;
493
+ p256dh: string;
494
+ };
495
+ endpoint: string;
496
+ };
59
497
  };
60
498
  params: {};
61
499
  query: unknown;
@@ -85,9 +523,42 @@ export declare const nativePushRoutes: <UserType>({ accessTokens, authSessionSto
85
523
  };
86
524
  };
87
525
  };
526
+ } & {
527
+ auth: {
528
+ push: {
529
+ delete: {
530
+ body: {
531
+ installationId: string;
532
+ };
533
+ params: {};
534
+ query: unknown;
535
+ headers: unknown;
536
+ response: {
537
+ 401: "User is not authenticated";
538
+ 200: {
539
+ removed: true;
540
+ };
541
+ 409: {
542
+ readonly code: "installation-ownership";
543
+ };
544
+ 422: {
545
+ type: "validation";
546
+ title: "Validation Error";
547
+ status: 422;
548
+ detail?: string;
549
+ on: string;
550
+ found?: unknown;
551
+ property?: string;
552
+ expected?: string;
553
+ };
554
+ };
555
+ error: never;
556
+ };
557
+ };
558
+ };
88
559
  }, import("elysia/types").DefaultEphemeral, {
89
560
  derive: {
90
- readonly nativePushPrincipal: AuthPrincipal<UserType> | undefined;
561
+ readonly pushPrincipal: AuthPrincipal<UserType> | undefined;
91
562
  };
92
563
  schema: {};
93
564
  schemas: import("elysia").UnwrapRoute<{
@@ -97,20 +568,23 @@ export declare const nativePushRoutes: <UserType>({ accessTokens, authSessionSto
97
568
  schema: "merge";
98
569
  }, {}, "">;
99
570
  response: import("elysia/types").ExtractErrorFromHandle<{
100
- readonly nativePushPrincipal: AuthPrincipal<UserType> | undefined;
571
+ readonly pushPrincipal: AuthPrincipal<UserType> | undefined;
101
572
  }>;
102
573
  error: [];
103
574
  }, "delete", "/auth/mobile/push", import("elysia/types").IntersectIfObjectSchema<import("elysia").UnwrapRoute<{
575
+ beforeHandle: ({ pushPrincipal, status }: {
576
+ pushPrincipal: AuthPrincipal<UserType> | undefined;
577
+ status: (code: "Unauthorized", body: string) => unknown;
578
+ }) => unknown;
104
579
  body: import("typebox").TObject<{
105
580
  installationId: import("typebox").TString;
106
581
  }>;
107
- beforeHandle: unknown;
108
582
  }, {}, "/auth/mobile/push">, import("elysia/types").MergeScopedSchemas<{}, {}, import("elysia").UnwrapRoute<{
109
583
  cookie: import("elysia").TCookieObject<{
110
584
  user_session_id: import("typebox").TOptional<import("typebox").TTemplateLiteral<"^.*-.*-.*-.*-.*$">>;
111
585
  }>;
112
586
  schema: "merge";
113
- }, {}, "">>>, {}, ({ body, nativePushPrincipal, status }: {
587
+ }, {}, "">>>, {}, ({ body, pushPrincipal, status }: {
114
588
  body: {
115
589
  installationId: string;
116
590
  };
@@ -127,7 +601,7 @@ export declare const nativePushRoutes: <UserType>({ accessTokens, authSessionSto
127
601
  status?: number | keyof import("elysia").StatusMap;
128
602
  cookie?: Record<string, import("elysia").BaseCookie>;
129
603
  };
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 | 409 | 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 ? {
604
+ 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
605
  readonly 100: "Continue";
132
606
  readonly 101: "Switching Protocols";
133
607
  readonly 102: "Processing";
@@ -253,10 +727,13 @@ export declare const nativePushRoutes: <UserType>({ accessTokens, authSessionSto
253
727
  readonly "Network Authentication Required": 511;
254
728
  }[Code] : Code>;
255
729
  defer: (fn: import("elysia/types").AfterResponseHandler<NoInfer<import("elysia/types").IntersectIfObjectSchema<import("elysia").UnwrapRoute<{
730
+ beforeHandle: ({ pushPrincipal, status }: {
731
+ pushPrincipal: AuthPrincipal<UserType> | undefined;
732
+ status: (code: "Unauthorized", body: string) => unknown;
733
+ }) => unknown;
256
734
  body: import("typebox").TObject<{
257
735
  installationId: import("typebox").TString;
258
736
  }>;
259
- beforeHandle: unknown;
260
737
  }, {}, "/auth/mobile/push">, import("elysia/types").MergeScopedSchemas<{}, {}, import("elysia").UnwrapRoute<{
261
738
  cookie: import("elysia").TCookieObject<{
262
739
  user_session_id: import("typebox").TOptional<import("typebox").TTemplateLiteral<"^.*-.*-.*-.*-.*$">>;
@@ -271,7 +748,7 @@ export declare const nativePushRoutes: <UserType>({ accessTokens, authSessionSto
271
748
  derive: {};
272
749
  } & {
273
750
  derive: {
274
- readonly nativePushPrincipal: AuthPrincipal<UserType> | undefined;
751
+ readonly pushPrincipal: AuthPrincipal<UserType> | undefined;
275
752
  };
276
753
  }>>) => import("elysia/types").MaybePromise<void>;
277
754
  readonly path: string;
@@ -282,7 +759,10 @@ export declare const nativePushRoutes: <UserType>({ accessTokens, authSessionSto
282
759
  session: import("./types").SessionRecord<UserType>;
283
760
  unregisteredSession: import("./types").UnregisteredSessionRecord;
284
761
  };
285
- readonly nativePushPrincipal: AuthPrincipal<UserType> | undefined;
286
- }) => Promise<import("elysia").ElysiaStatus<"Unauthorized", "User is not authenticated", 401> | {
762
+ readonly pushPrincipal: AuthPrincipal<UserType> | undefined;
763
+ }) => Promise<import("elysia").ElysiaStatus<"Unauthorized", "User is not authenticated", 401> | import("elysia").ElysiaStatus<"Conflict", {
764
+ readonly code: "installation-ownership";
765
+ }, 409> | {
287
766
  removed: true;
288
767
  }>>;
768
+ export {};