@crossauth/sveltekit 1.1.1 → 1.1.2
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.d.ts +4 -4
- package/dist/sveltekitadminclientendpoints.d.ts +19 -19
- package/dist/sveltekitadminclientendpoints.js +3 -3
- package/dist/sveltekitadminendpoints.d.ts +102 -74
- package/dist/sveltekitadminendpoints.js +10 -0
- package/dist/sveltekitoauthserver.d.ts +7 -7
- package/dist/sveltekitoauthserver.js +1 -1
- package/dist/sveltekitsharedclientendpoints.d.ts +33 -26
- package/dist/sveltekitsharedclientendpoints.js +8 -3
- package/dist/sveltekituserclientendpoints.d.ts +19 -19
- package/dist/sveltekituserclientendpoints.js +3 -3
- package/dist/sveltekituserendpoints.d.ts +214 -108
- package/dist/sveltekituserendpoints.js +23 -0
- package/dist/tests/testshared.d.ts +2 -2
- package/package.json +3 -3
|
@@ -4,6 +4,21 @@ import type { SvelteKitSessionServerOptions } from './sveltekitsession';
|
|
|
4
4
|
import type { User, UserInputFields } from '@crossauth/common';
|
|
5
5
|
import { ErrorCode } from '@crossauth/common';
|
|
6
6
|
import type { RequestEvent } from '@sveltejs/kit';
|
|
7
|
+
/**
|
|
8
|
+
* Return type for {@link SvelteKitUserEndpoints.login},
|
|
9
|
+
* {@link SvelteKitUserEndpoints.loginFactor2} and the
|
|
10
|
+
* {@link SvelteKitUserEndpoints.loginEndpoint} load.
|
|
11
|
+
*
|
|
12
|
+
* See class documentation for {@link SvelteKitUserEndpoints} for more details.
|
|
13
|
+
*/
|
|
14
|
+
export interface LoginPageData {
|
|
15
|
+
user?: User;
|
|
16
|
+
csrfToken?: string;
|
|
17
|
+
error?: string;
|
|
18
|
+
next?: string;
|
|
19
|
+
errorCode?: number;
|
|
20
|
+
errorCodeName?: string;
|
|
21
|
+
}
|
|
7
22
|
/**
|
|
8
23
|
* Return type for {@link SvelteKitUserEndpoints.login},
|
|
9
24
|
* {@link SvelteKitUserEndpoints.loginFactor2} and the
|
|
@@ -11,7 +26,7 @@ import type { RequestEvent } from '@sveltejs/kit';
|
|
|
11
26
|
*
|
|
12
27
|
* See class documentation for {@link SvelteKitUserEndpoints} for more details.
|
|
13
28
|
*/
|
|
14
|
-
export
|
|
29
|
+
export interface LoginActionData {
|
|
15
30
|
user?: User;
|
|
16
31
|
error?: string;
|
|
17
32
|
formData?: {
|
|
@@ -22,26 +37,52 @@ export type LoginReturn = {
|
|
|
22
37
|
ok: boolean;
|
|
23
38
|
errorCode?: number;
|
|
24
39
|
errorCodeName?: string;
|
|
25
|
-
}
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Return type for {@link SvelteKitUserEndpoints.logout}
|
|
43
|
+
* {@link SvelteKitUserEndpoints.logoutEndpoint} load.
|
|
44
|
+
*
|
|
45
|
+
* See class documentation for {@link SvelteKitUserEndpoints} for more details.
|
|
46
|
+
*/
|
|
47
|
+
export interface LogoutPageData {
|
|
48
|
+
user?: User;
|
|
49
|
+
csrfToken?: string;
|
|
50
|
+
error?: string;
|
|
51
|
+
errorCode?: number;
|
|
52
|
+
errorCodeName?: string;
|
|
53
|
+
}
|
|
26
54
|
/**
|
|
27
55
|
* Return type for {@link SvelteKitUserEndpoints.logout}
|
|
28
56
|
* {@link SvelteKitUserEndpoints.logoutEndpoint} action.
|
|
29
57
|
*
|
|
30
58
|
* See class documentation for {@link SvelteKitUserEndpoints} for more details.
|
|
31
59
|
*/
|
|
32
|
-
export
|
|
60
|
+
export interface LogoutActionData {
|
|
33
61
|
ok: boolean;
|
|
34
62
|
error?: string;
|
|
35
63
|
errorCode?: number;
|
|
36
64
|
errorCodeName?: string;
|
|
37
|
-
}
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Return type for {@link SvelteKitUserEndpoints.signup}
|
|
68
|
+
* {@link SvelteKitUserEndpoints.signupEndpoint} load.
|
|
69
|
+
*
|
|
70
|
+
* See class documentation for {@link SvelteKitUserEndpoints} for more details.
|
|
71
|
+
*/
|
|
72
|
+
export interface SignupPageData {
|
|
73
|
+
user?: User;
|
|
74
|
+
csrfToken?: string;
|
|
75
|
+
error?: string;
|
|
76
|
+
errorCode?: number;
|
|
77
|
+
errorCodeName?: string;
|
|
78
|
+
}
|
|
38
79
|
/**
|
|
39
80
|
* Return type for {@link SvelteKitUserEndpoints.signup}
|
|
40
81
|
* {@link SvelteKitUserEndpoints.signupEndpoint} action.
|
|
41
82
|
*
|
|
42
83
|
* See class documentation for {@link SvelteKitUserEndpoints} for more details.
|
|
43
84
|
*/
|
|
44
|
-
export
|
|
85
|
+
export interface SignupActionData {
|
|
45
86
|
user?: UserInputFields;
|
|
46
87
|
factor2Data?: {
|
|
47
88
|
userData: {
|
|
@@ -60,14 +101,27 @@ export type SignupReturn = {
|
|
|
60
101
|
emailVerificationRequired?: boolean;
|
|
61
102
|
errorCode?: number;
|
|
62
103
|
errorCodeName?: string;
|
|
63
|
-
}
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Return type for {@link SvelteKitUserEndpoints.configureFactor2}
|
|
107
|
+
* {@link SvelteKitUserEndpoints.configureFactor2Endpoint} load.
|
|
108
|
+
*
|
|
109
|
+
* See class documentation for {@link SvelteKitUserEndpoints} for more details.
|
|
110
|
+
*/
|
|
111
|
+
export interface ConfigureFactor2PageData {
|
|
112
|
+
user?: User;
|
|
113
|
+
csrdfToken?: string;
|
|
114
|
+
error?: string;
|
|
115
|
+
errorCode?: number;
|
|
116
|
+
errorCodeName?: string;
|
|
117
|
+
}
|
|
64
118
|
/**
|
|
65
119
|
* Return type for {@link SvelteKitUserEndpoints.configureFactor2}
|
|
66
120
|
* {@link SvelteKitUserEndpoints.configureFactor2Endpoint} action.
|
|
67
121
|
*
|
|
68
122
|
* See class documentation for {@link SvelteKitUserEndpoints} for more details.
|
|
69
123
|
*/
|
|
70
|
-
export
|
|
124
|
+
export interface ConfigureFactor2ActionData {
|
|
71
125
|
user?: UserInputFields;
|
|
72
126
|
factor2Data?: {
|
|
73
127
|
userData: {
|
|
@@ -85,36 +139,65 @@ export type ConfigureFactor2Return = {
|
|
|
85
139
|
emailVerificationRequired?: boolean;
|
|
86
140
|
errorCode?: number;
|
|
87
141
|
errorCodeName?: string;
|
|
88
|
-
}
|
|
142
|
+
}
|
|
89
143
|
/**
|
|
90
144
|
* Return type for {@link SvelteKitUserEndpoints.verifyEmail}
|
|
91
|
-
* {@link SvelteKitUserEndpoints.verifyEmailTokenEndpoint}
|
|
145
|
+
* {@link SvelteKitUserEndpoints.verifyEmailTokenEndpoint} load.
|
|
92
146
|
*
|
|
93
147
|
* See class documentation for {@link SvelteKitUserEndpoints} for more details.
|
|
94
148
|
*/
|
|
95
|
-
export
|
|
149
|
+
export interface VerifyEmailPageData {
|
|
96
150
|
user?: User;
|
|
151
|
+
csrdfToken?: string;
|
|
97
152
|
error?: string;
|
|
153
|
+
errorCode?: number;
|
|
154
|
+
errorCodeName?: string;
|
|
98
155
|
ok: boolean;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Return type for {@link SvelteKitUserEndpoints.requestPasswordReset}
|
|
159
|
+
* {@link SvelteKitUserEndpoints.resetPasswordEndpoint} load.
|
|
160
|
+
*
|
|
161
|
+
* See class documentation for {@link SvelteKitUserEndpoints} for more details.
|
|
162
|
+
*/
|
|
163
|
+
export interface RequestPasswordResetPageData {
|
|
164
|
+
user?: User;
|
|
165
|
+
csrdfToken?: string;
|
|
166
|
+
error?: string;
|
|
99
167
|
errorCode?: number;
|
|
100
168
|
errorCodeName?: string;
|
|
101
|
-
}
|
|
169
|
+
}
|
|
102
170
|
/**
|
|
103
171
|
* Return type for {@link SvelteKitUserEndpoints.requestPasswordReset}
|
|
104
172
|
* {@link SvelteKitUserEndpoints.resetPasswordEndpoint} action.
|
|
105
173
|
*
|
|
106
174
|
* See class documentation for {@link SvelteKitUserEndpoints} for more details.
|
|
107
175
|
*/
|
|
108
|
-
export
|
|
176
|
+
export interface RequestPasswordActionData {
|
|
109
177
|
user?: User;
|
|
110
178
|
formData?: {
|
|
111
179
|
[key: string]: string | undefined;
|
|
112
180
|
};
|
|
113
181
|
error?: string;
|
|
114
|
-
ok
|
|
182
|
+
ok?: boolean;
|
|
115
183
|
errorCode?: number;
|
|
116
184
|
errorCodeName?: string;
|
|
117
|
-
}
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Return type for {@link SvelteKitUserEndpoints.resetPassword}
|
|
188
|
+
* {@link SvelteKitUserEndpoints.validatePasswordResetToken} and the
|
|
189
|
+
* {@link SvelteKitUserEndpoints.passwordResetTokenEndpoint} load.
|
|
190
|
+
*
|
|
191
|
+
* See class documentation for {@link SvelteKitUserEndpoints} for more details.
|
|
192
|
+
*/
|
|
193
|
+
export interface ResetPasswordPageData {
|
|
194
|
+
user?: User;
|
|
195
|
+
csrdfToken?: string;
|
|
196
|
+
error?: string;
|
|
197
|
+
errorCode?: number;
|
|
198
|
+
errorCodeName?: string;
|
|
199
|
+
tokenValidated: boolean;
|
|
200
|
+
}
|
|
118
201
|
/**
|
|
119
202
|
* Return type for {@link SvelteKitUserEndpoints.resetPassword}
|
|
120
203
|
* {@link SvelteKitUserEndpoints.validatePasswordResetToken} and the
|
|
@@ -122,23 +205,36 @@ export type RequestPasswordResetReturn = {
|
|
|
122
205
|
*
|
|
123
206
|
* See class documentation for {@link SvelteKitUserEndpoints} for more details.
|
|
124
207
|
*/
|
|
125
|
-
export
|
|
208
|
+
export interface ResetPasswordActionData {
|
|
126
209
|
user?: User;
|
|
127
210
|
formData?: {
|
|
128
211
|
[key: string]: string | undefined;
|
|
129
212
|
};
|
|
130
213
|
error?: string;
|
|
131
|
-
ok: boolean;
|
|
132
214
|
errorCode?: number;
|
|
133
215
|
errorCodeName?: string;
|
|
134
|
-
|
|
216
|
+
ok?: boolean;
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Return type for {@link SvelteKitUserEndpoints.requestFactor2}
|
|
220
|
+
* {@link SvelteKitUserEndpoints.factor2Endpoint} load.
|
|
221
|
+
*
|
|
222
|
+
* See class documentation for {@link SvelteKitUserEndpoints} for more details.
|
|
223
|
+
*/
|
|
224
|
+
export interface RequestFactor2PageData {
|
|
225
|
+
user?: User;
|
|
226
|
+
csrdfToken?: string;
|
|
227
|
+
error?: string;
|
|
228
|
+
errorCode?: number;
|
|
229
|
+
errorCodeName?: string;
|
|
230
|
+
}
|
|
135
231
|
/**
|
|
136
232
|
* Return type for {@link SvelteKitUserEndpoints.requestFactor2}
|
|
137
233
|
* {@link SvelteKitUserEndpoints.factor2Endpoint} action.
|
|
138
234
|
*
|
|
139
235
|
* See class documentation for {@link SvelteKitUserEndpoints} for more details.
|
|
140
236
|
*/
|
|
141
|
-
export
|
|
237
|
+
export interface RequestFactor2ActionData {
|
|
142
238
|
ok: boolean;
|
|
143
239
|
action?: string;
|
|
144
240
|
factor2?: string;
|
|
@@ -146,14 +242,29 @@ export type RequestFactor2Return = {
|
|
|
146
242
|
csrfToken?: string;
|
|
147
243
|
errorCode?: number;
|
|
148
244
|
errorCodeName?: string;
|
|
149
|
-
}
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Return type for {@link SvelteKitUserEndpoints.changePassword}
|
|
248
|
+
* {@link SvelteKitUserEndpoints.changePasswordEndpoint} load.
|
|
249
|
+
*
|
|
250
|
+
* See class documentation for {@link SvelteKitUserEndpoints} for more details.
|
|
251
|
+
*/
|
|
252
|
+
export interface ChangePasswordPageData {
|
|
253
|
+
user?: User;
|
|
254
|
+
formData?: {
|
|
255
|
+
[key: string]: string | undefined;
|
|
256
|
+
};
|
|
257
|
+
error?: string;
|
|
258
|
+
errorCode?: number;
|
|
259
|
+
errorCodeName?: string;
|
|
260
|
+
}
|
|
150
261
|
/**
|
|
151
262
|
* Return type for {@link SvelteKitUserEndpoints.changePassword}
|
|
152
263
|
* {@link SvelteKitUserEndpoints.changePasswordEndpoint} action.
|
|
153
264
|
*
|
|
154
265
|
* See class documentation for {@link SvelteKitUserEndpoints} for more details.
|
|
155
266
|
*/
|
|
156
|
-
export
|
|
267
|
+
export interface ChangePasswordActionData {
|
|
157
268
|
user?: User;
|
|
158
269
|
error?: string;
|
|
159
270
|
formData?: {
|
|
@@ -162,14 +273,32 @@ export type ChangePasswordReturn = {
|
|
|
162
273
|
ok: boolean;
|
|
163
274
|
errorCode?: number;
|
|
164
275
|
errorCodeName?: string;
|
|
165
|
-
}
|
|
276
|
+
}
|
|
166
277
|
/**
|
|
167
278
|
* Return type for {@link SvelteKitUserEndpoints.changeFactor2}
|
|
168
279
|
* {@link SvelteKitUserEndpoints.changeFactor2Endpoint} action.
|
|
169
280
|
*
|
|
170
281
|
* See class documentation for {@link SvelteKitUserEndpoints} for more details.
|
|
171
282
|
*/
|
|
172
|
-
export
|
|
283
|
+
export interface ChangeFactor2PageData {
|
|
284
|
+
user?: User;
|
|
285
|
+
error?: string;
|
|
286
|
+
errorCode?: number;
|
|
287
|
+
errorCodeName?: string;
|
|
288
|
+
username?: string;
|
|
289
|
+
allowedFactor2: {
|
|
290
|
+
name: string;
|
|
291
|
+
friendlyName: string;
|
|
292
|
+
configurable: boolean;
|
|
293
|
+
}[];
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* Return type for {@link SvelteKitUserEndpoints.changeFactor2}
|
|
297
|
+
* {@link SvelteKitUserEndpoints.changeFactor2Endpoint} action.
|
|
298
|
+
*
|
|
299
|
+
* See class documentation for {@link SvelteKitUserEndpoints} for more details.
|
|
300
|
+
*/
|
|
301
|
+
export interface ChangeFactor2ActionData {
|
|
173
302
|
user?: User;
|
|
174
303
|
error?: string;
|
|
175
304
|
formData?: {
|
|
@@ -186,27 +315,51 @@ export type ChangeFactor2Return = {
|
|
|
186
315
|
};
|
|
187
316
|
errorCode?: number;
|
|
188
317
|
errorCodeName?: string;
|
|
189
|
-
}
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* Return type for {@link SvelteKitUserEndpoints.deleteUser}
|
|
321
|
+
* {@link SvelteKitUserEndpoints.deleteUserEndpoint} load.
|
|
322
|
+
*
|
|
323
|
+
* See class documentation for {@link SvelteKitUserEndpoints} for more details.
|
|
324
|
+
*/
|
|
325
|
+
export interface DeleteUserPageData {
|
|
326
|
+
user?: User;
|
|
327
|
+
error?: string;
|
|
328
|
+
errorCode?: number;
|
|
329
|
+
errorCodeName?: string;
|
|
330
|
+
}
|
|
190
331
|
/**
|
|
191
332
|
* Return type for {@link SvelteKitUserEndpoints.deleteUser}
|
|
192
333
|
* {@link SvelteKitUserEndpoints.deleteUserEndpoint} action.
|
|
193
334
|
*
|
|
194
335
|
* See class documentation for {@link SvelteKitUserEndpoints} for more details.
|
|
195
336
|
*/
|
|
196
|
-
export
|
|
337
|
+
export interface DeleteUserActionData {
|
|
197
338
|
user?: User;
|
|
198
339
|
error?: string;
|
|
199
340
|
ok: boolean;
|
|
200
341
|
errorCode?: number;
|
|
201
342
|
errorCodeName?: string;
|
|
202
|
-
}
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* Return type for {@link SvelteKitUserEndpoints.updateUser}
|
|
346
|
+
* {@link SvelteKitUserEndpoints.updateUserEndpoint} load.
|
|
347
|
+
*
|
|
348
|
+
* See class documentation for {@link SvelteKitUserEndpoints} for more details.
|
|
349
|
+
*/
|
|
350
|
+
export interface UpdateUserPageData {
|
|
351
|
+
user?: User;
|
|
352
|
+
error?: string;
|
|
353
|
+
errorCode?: number;
|
|
354
|
+
errorCodeName?: string;
|
|
355
|
+
}
|
|
203
356
|
/**
|
|
204
357
|
* Return type for {@link SvelteKitUserEndpoints.updateUser}
|
|
205
358
|
* {@link SvelteKitUserEndpoints.updateUserEndpoint} action.
|
|
206
359
|
*
|
|
207
360
|
* See class documentation for {@link SvelteKitUserEndpoints} for more details.
|
|
208
361
|
*/
|
|
209
|
-
export
|
|
362
|
+
export interface UpdateUserActionData {
|
|
210
363
|
user?: User;
|
|
211
364
|
error?: string;
|
|
212
365
|
formData?: {
|
|
@@ -216,7 +369,7 @@ export type UpdateUserReturn = {
|
|
|
216
369
|
ok: boolean;
|
|
217
370
|
errorCode?: number;
|
|
218
371
|
errorCodeName?: string;
|
|
219
|
-
}
|
|
372
|
+
}
|
|
220
373
|
/**
|
|
221
374
|
* Provides endpoints for users to login, logout and maintain their
|
|
222
375
|
* own account.
|
|
@@ -338,7 +491,7 @@ export declare class SvelteKitUserEndpoints {
|
|
|
338
491
|
* - `factor2Required` if true, second factor authentication is needed
|
|
339
492
|
* to complete login
|
|
340
493
|
*/
|
|
341
|
-
login(event: RequestEvent): Promise<
|
|
494
|
+
login(event: RequestEvent): Promise<LoginActionData>;
|
|
342
495
|
/**
|
|
343
496
|
* This is called after the user has been validated to log the user in
|
|
344
497
|
*/
|
|
@@ -358,7 +511,7 @@ export declare class SvelteKitUserEndpoints {
|
|
|
358
511
|
* - `exception` a {@link @crossauth/common!CrossauthError} if an
|
|
359
512
|
* exception was raised
|
|
360
513
|
*/
|
|
361
|
-
logout(event: RequestEvent): Promise<
|
|
514
|
+
logout(event: RequestEvent): Promise<LogoutActionData>;
|
|
362
515
|
/**
|
|
363
516
|
* Creates an account.
|
|
364
517
|
*
|
|
@@ -404,7 +557,7 @@ export declare class SvelteKitUserEndpoints {
|
|
|
404
557
|
* - `emailVerificationRequired` if true, the user needs to click on
|
|
405
558
|
* the link emailed to them to complete signup.
|
|
406
559
|
*/
|
|
407
|
-
signup(event: RequestEvent): Promise<
|
|
560
|
+
signup(event: RequestEvent): Promise<SignupActionData>;
|
|
408
561
|
/**
|
|
409
562
|
* Takes email verification token from the params on the URL and attempts
|
|
410
563
|
* email verification.
|
|
@@ -430,7 +583,7 @@ export declare class SvelteKitUserEndpoints {
|
|
|
430
583
|
* - `emailVerificationRequired` if true, the user needs to click on
|
|
431
584
|
* the link emailed to them to complete signup.
|
|
432
585
|
*/
|
|
433
|
-
verifyEmail(event: RequestEvent): Promise<
|
|
586
|
+
verifyEmail(event: RequestEvent): Promise<VerifyEmailPageData>;
|
|
434
587
|
/**
|
|
435
588
|
* Completes factor2 configuration.
|
|
436
589
|
*
|
|
@@ -452,7 +605,7 @@ export declare class SvelteKitUserEndpoints {
|
|
|
452
605
|
* - `emailVerificationRequired` if true, the user needs to click on
|
|
453
606
|
* the link emailed to them to complete configuration.
|
|
454
607
|
*/
|
|
455
|
-
configureFactor2(event: RequestEvent): Promise<
|
|
608
|
+
configureFactor2(event: RequestEvent): Promise<ConfigureFactor2ActionData>;
|
|
456
609
|
/**
|
|
457
610
|
* Call this when `login()` returns `factor2Required = true`
|
|
458
611
|
*
|
|
@@ -468,8 +621,8 @@ export declare class SvelteKitUserEndpoints {
|
|
|
468
621
|
* - `exception` a {@link @crossauth/common!CrossauthError} if an
|
|
469
622
|
* exception was raised
|
|
470
623
|
*/
|
|
471
|
-
loginFactor2(event: RequestEvent): Promise<
|
|
472
|
-
requestPasswordReset(event: RequestEvent): Promise<
|
|
624
|
+
loginFactor2(event: RequestEvent): Promise<LoginActionData>;
|
|
625
|
+
requestPasswordReset(event: RequestEvent): Promise<RequestPasswordActionData>;
|
|
473
626
|
/**
|
|
474
627
|
* Call this from the GET url the user clicks on to reset their password.
|
|
475
628
|
*
|
|
@@ -488,7 +641,7 @@ export declare class SvelteKitUserEndpoints {
|
|
|
488
641
|
* exception was raised
|
|
489
642
|
* - `formData` the form fields extracted from the request
|
|
490
643
|
*/
|
|
491
|
-
validatePasswordResetToken(event: RequestEvent): Promise<
|
|
644
|
+
validatePasswordResetToken(event: RequestEvent): Promise<ResetPasswordActionData>;
|
|
492
645
|
/**
|
|
493
646
|
* Call this from the POST url the user uses to fill in a new password
|
|
494
647
|
* after validating the token in the GET url with
|
|
@@ -508,7 +661,7 @@ export declare class SvelteKitUserEndpoints {
|
|
|
508
661
|
* exception was raised
|
|
509
662
|
* - `formData` the form fields extracted from the request
|
|
510
663
|
*/
|
|
511
|
-
resetPassword(event: RequestEvent): Promise<
|
|
664
|
+
resetPassword(event: RequestEvent): Promise<ResetPasswordActionData>;
|
|
512
665
|
/**
|
|
513
666
|
* Call this from your factor2 endpoint to fetch the data needed to
|
|
514
667
|
* display the factor2 form.
|
|
@@ -531,7 +684,7 @@ export declare class SvelteKitUserEndpoints {
|
|
|
531
684
|
* - `exception` a {@link @crossauth/common!CrossauthError} if an
|
|
532
685
|
* exception was raised
|
|
533
686
|
*/
|
|
534
|
-
requestFactor2(event: RequestEvent): Promise<
|
|
687
|
+
requestFactor2(event: RequestEvent): Promise<RequestFactor2ActionData>;
|
|
535
688
|
/**
|
|
536
689
|
* Call this with POST data to change the logged-in user's password
|
|
537
690
|
*
|
|
@@ -550,7 +703,7 @@ export declare class SvelteKitUserEndpoints {
|
|
|
550
703
|
* exception was raised
|
|
551
704
|
* - `formData` the form fields extracted from the request
|
|
552
705
|
*/
|
|
553
|
-
changePassword(event: RequestEvent): Promise<
|
|
706
|
+
changePassword(event: RequestEvent): Promise<ChangePasswordActionData>;
|
|
554
707
|
/**
|
|
555
708
|
* Call this to delete the logged-in user
|
|
556
709
|
*
|
|
@@ -564,7 +717,7 @@ export declare class SvelteKitUserEndpoints {
|
|
|
564
717
|
* - `exception` a {@link @crossauth/common!CrossauthError} if an
|
|
565
718
|
* exception was raised
|
|
566
719
|
*/
|
|
567
|
-
deleteUser(event: RequestEvent): Promise<
|
|
720
|
+
deleteUser(event: RequestEvent): Promise<DeleteUserActionData>;
|
|
568
721
|
/**
|
|
569
722
|
* Call this to update a user's details (apart from password and factor2)
|
|
570
723
|
*
|
|
@@ -589,7 +742,7 @@ export declare class SvelteKitUserEndpoints {
|
|
|
589
742
|
* - `emailVerificationRequired` if true, the user needs to click on
|
|
590
743
|
* the link emailed to them to complete signup.
|
|
591
744
|
*/
|
|
592
|
-
updateUser(event: RequestEvent): Promise<
|
|
745
|
+
updateUser(event: RequestEvent): Promise<UpdateUserActionData>;
|
|
593
746
|
/**
|
|
594
747
|
* Call this to change the logged in user's factor2.
|
|
595
748
|
*
|
|
@@ -610,7 +763,7 @@ export declare class SvelteKitUserEndpoints {
|
|
|
610
763
|
* exception was raised
|
|
611
764
|
* - `factor2Data` the data to pass to the factor2 configuration page.
|
|
612
765
|
*/
|
|
613
|
-
changeFactor2(event: RequestEvent): Promise<
|
|
766
|
+
changeFactor2(event: RequestEvent): Promise<ChangeFactor2ActionData>;
|
|
614
767
|
/**
|
|
615
768
|
* Call this to reconfigure the current factor2 type.
|
|
616
769
|
*
|
|
@@ -629,7 +782,7 @@ export declare class SvelteKitUserEndpoints {
|
|
|
629
782
|
* exception was raised
|
|
630
783
|
* - `factor2Data` the data to pass to the factor2 configuration page.
|
|
631
784
|
*/
|
|
632
|
-
reconfigureFactor2(event: RequestEvent): Promise<
|
|
785
|
+
reconfigureFactor2(event: RequestEvent): Promise<ChangeFactor2ActionData>;
|
|
633
786
|
baseEndpoint(event: RequestEvent): {
|
|
634
787
|
user: User | undefined;
|
|
635
788
|
csrfToken: string | undefined;
|
|
@@ -645,26 +798,22 @@ export declare class SvelteKitUserEndpoints {
|
|
|
645
798
|
}[];
|
|
646
799
|
}>;
|
|
647
800
|
actions: {
|
|
648
|
-
default: (event: RequestEvent) => Promise<
|
|
801
|
+
default: (event: RequestEvent) => Promise<SignupActionData>;
|
|
649
802
|
};
|
|
650
803
|
};
|
|
651
804
|
readonly loginEndpoint: {
|
|
652
|
-
load: (event: RequestEvent) => Promise<
|
|
653
|
-
user: User | undefined;
|
|
654
|
-
csrfToken: string | undefined;
|
|
655
|
-
next: string;
|
|
656
|
-
}>;
|
|
805
|
+
load: (event: RequestEvent) => Promise<LoginPageData>;
|
|
657
806
|
actions: {
|
|
658
|
-
login: (event: RequestEvent) => Promise<
|
|
659
|
-
factor2: (event: RequestEvent) => Promise<
|
|
807
|
+
login: (event: RequestEvent) => Promise<LoginActionData>;
|
|
808
|
+
factor2: (event: RequestEvent) => Promise<LoginActionData>;
|
|
660
809
|
};
|
|
661
810
|
};
|
|
662
811
|
readonly factor2Endpoint: {
|
|
663
|
-
load: (event: RequestEvent) => Promise<
|
|
812
|
+
load: (event: RequestEvent) => Promise<RequestFactor2PageData>;
|
|
664
813
|
};
|
|
665
814
|
readonly logoutEndpoint: {
|
|
666
815
|
actions: {
|
|
667
|
-
default: (event: RequestEvent) => Promise<
|
|
816
|
+
default: (event: RequestEvent) => Promise<LogoutActionData>;
|
|
668
817
|
};
|
|
669
818
|
load: (event: RequestEvent) => Promise<{
|
|
670
819
|
user: User | undefined;
|
|
@@ -673,65 +822,38 @@ export declare class SvelteKitUserEndpoints {
|
|
|
673
822
|
};
|
|
674
823
|
readonly changeFactor2Endpoint: {
|
|
675
824
|
actions: {
|
|
676
|
-
change: (event: RequestEvent) => Promise<
|
|
677
|
-
reconfigure: (event: RequestEvent) => Promise<
|
|
825
|
+
change: (event: RequestEvent) => Promise<ChangeFactor2ActionData>;
|
|
826
|
+
reconfigure: (event: RequestEvent) => Promise<ChangeFactor2ActionData>;
|
|
678
827
|
};
|
|
679
|
-
load: (event: RequestEvent) => Promise<
|
|
680
|
-
user: User | undefined;
|
|
681
|
-
csrfToken: string | undefined;
|
|
682
|
-
username: string | undefined;
|
|
683
|
-
required?: boolean | undefined;
|
|
684
|
-
next?: string | undefined;
|
|
685
|
-
allowedFactor2: {
|
|
686
|
-
name: string;
|
|
687
|
-
friendlyName: string;
|
|
688
|
-
configurable: boolean;
|
|
689
|
-
}[];
|
|
690
|
-
}>;
|
|
828
|
+
load: (event: RequestEvent) => Promise<ChangeFactor2PageData>;
|
|
691
829
|
};
|
|
692
830
|
readonly changePasswordEndpoint: {
|
|
693
831
|
actions: {
|
|
694
|
-
default: (event: RequestEvent) => Promise<
|
|
832
|
+
default: (event: RequestEvent) => Promise<ChangePasswordActionData>;
|
|
695
833
|
};
|
|
696
|
-
load: (event: RequestEvent) => Promise<
|
|
697
|
-
user: User | undefined;
|
|
698
|
-
csrfToken: string | undefined;
|
|
699
|
-
required?: boolean | undefined;
|
|
700
|
-
next?: string | undefined;
|
|
701
|
-
}>;
|
|
834
|
+
load: (event: RequestEvent) => Promise<ChangePasswordPageData>;
|
|
702
835
|
};
|
|
703
836
|
readonly configureFactor2Endpoint: {
|
|
704
837
|
actions: {
|
|
705
|
-
default: (event: RequestEvent) => Promise<
|
|
838
|
+
default: (event: RequestEvent) => Promise<ConfigureFactor2ActionData>;
|
|
706
839
|
};
|
|
707
|
-
load: (event: RequestEvent) => Promise<
|
|
708
|
-
user: User | undefined;
|
|
709
|
-
csrfToken: string | undefined;
|
|
710
|
-
}>;
|
|
840
|
+
load: (event: RequestEvent) => Promise<ConfigureFactor2PageData>;
|
|
711
841
|
};
|
|
712
842
|
readonly deleteUserEndpoint: {
|
|
713
843
|
actions: {
|
|
714
|
-
default: (event: RequestEvent) => Promise<
|
|
844
|
+
default: (event: RequestEvent) => Promise<DeleteUserActionData>;
|
|
715
845
|
};
|
|
716
|
-
load: (event: RequestEvent) => Promise<
|
|
717
|
-
user: User | undefined;
|
|
718
|
-
csrfToken: string | undefined;
|
|
719
|
-
}>;
|
|
846
|
+
load: (event: RequestEvent) => Promise<DeleteUserPageData>;
|
|
720
847
|
};
|
|
721
848
|
readonly resetPasswordEndpoint: {
|
|
722
849
|
actions: {
|
|
723
|
-
default: (event: RequestEvent) => Promise<
|
|
850
|
+
default: (event: RequestEvent) => Promise<RequestPasswordActionData>;
|
|
724
851
|
};
|
|
725
|
-
load: (event: RequestEvent) => Promise<
|
|
726
|
-
user: User | undefined;
|
|
727
|
-
csrfToken: string | undefined;
|
|
728
|
-
required?: boolean | undefined;
|
|
729
|
-
next?: string | undefined;
|
|
730
|
-
}>;
|
|
852
|
+
load: (event: RequestEvent) => Promise<ResetPasswordActionData>;
|
|
731
853
|
};
|
|
732
854
|
readonly passwordResetTokenEndpoint: {
|
|
733
855
|
actions: {
|
|
734
|
-
default: (event: RequestEvent) => Promise<
|
|
856
|
+
default: (event: RequestEvent) => Promise<ResetPasswordActionData | {
|
|
735
857
|
user: User | undefined;
|
|
736
858
|
csrfToken: string | undefined;
|
|
737
859
|
ok: boolean;
|
|
@@ -747,23 +869,7 @@ export declare class SvelteKitUserEndpoints {
|
|
|
747
869
|
errorCodeName: string;
|
|
748
870
|
}>;
|
|
749
871
|
};
|
|
750
|
-
load: (event: RequestEvent) => Promise<
|
|
751
|
-
user: User | undefined;
|
|
752
|
-
csrfToken: string | undefined;
|
|
753
|
-
tokenValidated: boolean;
|
|
754
|
-
error: string | undefined;
|
|
755
|
-
} | {
|
|
756
|
-
user: User | undefined;
|
|
757
|
-
csrfToken: string | undefined;
|
|
758
|
-
tokenValidated: boolean;
|
|
759
|
-
} | {
|
|
760
|
-
user: User | undefined;
|
|
761
|
-
csrfToken: string | undefined;
|
|
762
|
-
tokenValidated: boolean;
|
|
763
|
-
error: string;
|
|
764
|
-
errorCode: ErrorCode;
|
|
765
|
-
errorCodeName: string;
|
|
766
|
-
}>;
|
|
872
|
+
load: (event: RequestEvent) => Promise<ResetPasswordPageData>;
|
|
767
873
|
};
|
|
768
874
|
readonly updateUserEndpoint: SveltekitEndpoint;
|
|
769
875
|
readonly verifyEmailTokenEndpoint: SveltekitEndpoint;
|
|
@@ -4,6 +4,29 @@ import { SvelteKitSessionServer } from './sveltekitsession';
|
|
|
4
4
|
import { toCookieSerializeOptions, setParameter, ParamType, } from '@crossauth/backend';
|
|
5
5
|
import { CrossauthError, CrossauthLogger, j, ErrorCode, UserState } from '@crossauth/common';
|
|
6
6
|
import { JsonOrFormData } from './utils';
|
|
7
|
+
;
|
|
8
|
+
;
|
|
9
|
+
;
|
|
10
|
+
;
|
|
11
|
+
;
|
|
12
|
+
;
|
|
13
|
+
;
|
|
14
|
+
;
|
|
15
|
+
;
|
|
16
|
+
;
|
|
17
|
+
;
|
|
18
|
+
;
|
|
19
|
+
;
|
|
20
|
+
;
|
|
21
|
+
;
|
|
22
|
+
;
|
|
23
|
+
;
|
|
24
|
+
;
|
|
25
|
+
;
|
|
26
|
+
;
|
|
27
|
+
;
|
|
28
|
+
;
|
|
29
|
+
;
|
|
7
30
|
//////////////////////////////////////////////////////////////////////
|
|
8
31
|
// Class
|
|
9
32
|
/**
|
|
@@ -32,13 +32,13 @@ export declare function login(server: SvelteKitServer, resolver: MockResolver, h
|
|
|
32
32
|
event: MockRequestEvent<{
|
|
33
33
|
param1: string;
|
|
34
34
|
}, "1">;
|
|
35
|
-
ret: import("..").
|
|
35
|
+
ret: import("..").LoginActionData | undefined;
|
|
36
36
|
}>;
|
|
37
37
|
export declare function loginFactor2(server: SvelteKitServer, resolver: MockResolver, handle: Handle, sessionCookieValue: string, sessionId: string): Promise<{
|
|
38
38
|
event: MockRequestEvent<{
|
|
39
39
|
param1: string;
|
|
40
40
|
}, "1">;
|
|
41
|
-
ret: import("..").
|
|
41
|
+
ret: import("..").LoginActionData | undefined;
|
|
42
42
|
}>;
|
|
43
43
|
export declare function getAuthServer({ aud, persistAccessToken, emptyScopeIsValid, secretRequired, rollingRefreshToken, }?: {
|
|
44
44
|
challenge?: boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crossauth/sveltekit",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "Sveltekit adapter for Crossauth authentication package",
|
|
6
6
|
"private": false,
|
|
@@ -54,8 +54,8 @@
|
|
|
54
54
|
"minimatch": "^10.0.1",
|
|
55
55
|
"publint": "0.3.15",
|
|
56
56
|
"qrcode": "^1.5.4",
|
|
57
|
-
"@crossauth/backend": "^1.1.
|
|
58
|
-
"@crossauth/common": "^1.1.
|
|
57
|
+
"@crossauth/backend": "^1.1.2",
|
|
58
|
+
"@crossauth/common": "^1.1.2"
|
|
59
59
|
},
|
|
60
60
|
"scripts": {
|
|
61
61
|
"preparex": "svelte-kit sync",
|