@crossauth/sveltekit 0.0.36 → 0.0.38

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.
@@ -40,9 +40,15 @@ export interface SvelteKitSessionServerOptions extends SessionManagerOptions {
40
40
  /**
41
41
  * URL to call when login is required.
42
42
  *
43
- * Default "/"
43
+ * Default "/login"
44
44
  */
45
45
  loginUrl?: string;
46
+ /**
47
+ * URL to call to logout.
48
+ *
49
+ * Default "/logout"
50
+ */
51
+ logoutUrl?: string;
46
52
  /**
47
53
  * Default URL to go to after login (can be overridden by `next` POST param)
48
54
  *
@@ -52,21 +58,27 @@ export interface SvelteKitSessionServerOptions extends SessionManagerOptions {
52
58
  /**
53
59
  * URL to call when change password is required.
54
60
  *
55
- * Default "/changepassword"
61
+ * No default.
56
62
  */
57
63
  changePasswordUrl?: string;
58
64
  /**
59
65
  * URL to call when change password is required.
60
66
  *
61
- * Default "/resetpassword"
67
+ * No default.
62
68
  */
63
69
  requestPasswordResetUrl?: string;
64
70
  /**
65
71
  * URL to call when change factor2 is required.
66
72
  *
67
- * Default "/changefactor2"
73
+ * No default.
68
74
  */
69
75
  changeFactor2Url?: string;
76
+ /**
77
+ * URL to call when reconfiguring factor2 is required.
78
+ *
79
+ * No default.
80
+ */
81
+ configureFactor2Url?: string;
70
82
  /** OAuth to support. A comma-separated list from {@link @crossauth/common!OAuthFlows}.
71
83
  * If [`all`], there must be none other in the list.
72
84
  *
@@ -88,7 +100,7 @@ export interface SvelteKitSessionServerOptions extends SessionManagerOptions {
88
100
  */
89
101
  createUserFn?: (event: RequestEvent, data: {
90
102
  [key: string]: string | undefined;
91
- }, userEditableFields: string[]) => UserInputFields;
103
+ }, userEditableFields: string[], allowableFactor1: string[]) => UserInputFields;
92
104
  /** Function that updates a user from form fields.
93
105
  * Default one takes fields that begin with `user_`, removing the `user_`
94
106
  * prefix and filtering out anything not in the userEditableFields list in
@@ -264,6 +276,16 @@ export interface SvelteKitSessionServerOptions extends SessionManagerOptions {
264
276
  redirect?: any;
265
277
  /** Pass the Sveltekit error function */
266
278
  error?: any;
279
+ /**
280
+ * When signing up themselves, users may choose any of these.
281
+ * Default: ["localpassword"]
282
+ */
283
+ userAllowedFactor1?: string[];
284
+ /**
285
+ * When admins create a user, they may choose any of these.
286
+ * Default: ["localpassword"]
287
+ */
288
+ adminAllowedFactor1?: string[];
267
289
  }
268
290
  /**
269
291
  * The Sveltekit session server.
@@ -290,6 +312,7 @@ export declare class SvelteKitSessionServer implements SvelteKitSessionAdapter {
290
312
  event: RequestEvent;
291
313
  }) => MaybePromise<{
292
314
  headers: Header[];
315
+ status?: number;
293
316
  }>;
294
317
  readonly twoFAHook: (input: {
295
318
  event: RequestEvent;
@@ -331,7 +354,7 @@ export declare class SvelteKitSessionServer implements SvelteKitSessionAdapter {
331
354
  */
332
355
  createUserFn: (event: RequestEvent, data: {
333
356
  [key: string]: string | undefined;
334
- }, userEditableFields: string[]) => UserInputFields;
357
+ }, userEditableFields: string[], allowableFactor1: string[]) => UserInputFields;
335
358
  /**
336
359
  * Funtion to update a user record from form fields. Taken from the options during
337
360
  * construction or the default value.
@@ -402,6 +425,7 @@ export declare class SvelteKitSessionServer implements SvelteKitSessionAdapter {
402
425
  readonly enablePasswordReset = false;
403
426
  private factor2Url;
404
427
  private loginUrl;
428
+ private logoutUrl;
405
429
  /**
406
430
  * Use these to access the `load` and `action` endpoints for functions
407
431
  * provided by Crossauth. These are the ones intended for users to
@@ -444,6 +468,8 @@ export declare class SvelteKitSessionServer implements SvelteKitSessionAdapter {
444
468
  * See {@link SvelteKitServerOptions}.
445
469
  */
446
470
  readonly editUserScope?: string;
471
+ readonly userAllowedFactor1: string[];
472
+ readonly adminAllowedFactor1: string[];
447
473
  /**
448
474
  * Constructor
449
475
  * @param keyStorage where session IDs, email verification and reset tokens are stored
@@ -290,8 +290,10 @@ export type UpdateUserReturn = {
290
290
  */
291
291
  export declare class SvelteKitUserEndpoints {
292
292
  private sessionServer;
293
- private changePasswordUrl;
294
- private changeFactor2Url;
293
+ readonly changePasswordUrl: string | undefined;
294
+ readonly changeFactor2Url: string | undefined;
295
+ readonly configureFactor2Url: string | undefined;
296
+ readonly requestPasswordResetUrl: string | undefined;
295
297
  private loginRedirectUrl;
296
298
  private loginUrl;
297
299
  private addToSession?;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crossauth/sveltekit",
3
- "version": "0.0.36",
3
+ "version": "0.0.38",
4
4
  "license": "Apache-2.0",
5
5
  "private": false,
6
6
  "type": "module",
@@ -46,8 +46,8 @@
46
46
  "minimatch": "^10.0.1",
47
47
  "qrcode": "^1.5.4",
48
48
  "vite-plugin-dts": "^3.6.4",
49
- "@crossauth/backend": "^0.0.36",
50
- "@crossauth/common": "^0.0.36"
49
+ "@crossauth/backend": "^0.0.38",
50
+ "@crossauth/common": "^0.0.38"
51
51
  },
52
52
  "scripts": {
53
53
  "preparex": "svelte-kit sync",