@crossauth/sveltekit 0.0.18 → 0.0.20

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 CHANGED
@@ -1,10 +1,10 @@
1
- import { User, ApiKey } from '@crossauth/common';
2
1
  export { SvelteKitSessionServer, type Header } from './sveltekitsession';
3
2
  export type { SvelteKitSessionServerOptions } from './sveltekitsession';
4
3
  export type { LoginReturn, LogoutReturn, SignupReturn, ConfigureFactor2Return, VerifyEmailReturn, RequestPasswordResetReturn, ResetPasswordReturn, RequestFactor2Return, ChangePasswordReturn, ChangeFactor2Return, DeleteUserReturn, UpdateUserReturn, } from './sveltekituserendpoints';
5
4
  export type { SearchUsersReturn, AdminUpdateUserReturn, AdminCreateUserReturn, AdminDeleteUserReturn, AdminChangePasswordReturn, } from './sveltekitadminendpoints';
6
5
  export { SvelteKitServer } from './sveltekitserver';
7
6
  export type { SvelteKitServerOptions, Resolver, SveltekitEndpoint } from './sveltekitserver';
7
+ import type { User, ApiKey } from '@crossauth/common';
8
8
  export { JsonOrFormData } from './utils';
9
9
  export {} from './sveltekitoauthserver';
10
10
  export { SvelteKitAuthorizationServer } from './sveltekitoauthserver';
@@ -1,7 +1,8 @@
1
- import { SvelteKitSessionServer, SvelteKitSessionServerOptions } from './sveltekitsession';
2
- import { RequestEvent } from '@sveltejs/kit';
3
- import { SvelteKitSharedClientEndpoints, SearchClientsPageData, UpdateClientPageData, UpdateClientFormData, DeleteClientPageData, DeleteClientFormData } from './sveltekitsharedclientendpoints';
4
-
1
+ import { SvelteKitSessionServer } from './sveltekitsession';
2
+ import type { SvelteKitSessionServerOptions } from './sveltekitsession';
3
+ import type { RequestEvent } from '@sveltejs/kit';
4
+ import { SvelteKitSharedClientEndpoints } from './sveltekitsharedclientendpoints';
5
+ import type { SearchClientsPageData, UpdateClientPageData, UpdateClientFormData, DeleteClientPageData, DeleteClientFormData } from './sveltekitsharedclientendpoints';
5
6
  /**
6
7
  * Endpoints for manipulating the OAuth client table, for use by admins.
7
8
  *
@@ -72,7 +73,7 @@ export declare class SvelteKitAdminClientEndpoints extends SvelteKitSharedClient
72
73
  readonly searchClientsEndpoint: {
73
74
  load: (event: RequestEvent) => Promise<{
74
75
  ok: boolean;
75
- clients?: import('@crossauth/common').OAuthClient[] | undefined;
76
+ clients?: import("@crossauth/common").OAuthClient[] | undefined;
76
77
  skip: number;
77
78
  take: number;
78
79
  search?: string | undefined;
@@ -82,8 +83,8 @@ export declare class SvelteKitAdminClientEndpoints extends SvelteKitSharedClient
82
83
  hasPrevious: boolean;
83
84
  hasNext: boolean;
84
85
  clientUserId?: string | number | undefined;
85
- user: import('@crossauth/common').User | undefined;
86
- csrfToken: string | undefined;
86
+ user: any;
87
+ csrfToken: any;
87
88
  }>;
88
89
  };
89
90
  /**
@@ -92,7 +93,7 @@ export declare class SvelteKitAdminClientEndpoints extends SvelteKitSharedClient
92
93
  readonly updateClientEndpoint: {
93
94
  load: (event: RequestEvent) => Promise<{
94
95
  ok: boolean;
95
- client?: import('@crossauth/common').OAuthClient | undefined;
96
+ client?: import("@crossauth/common").OAuthClient | undefined;
96
97
  client_id?: string | undefined;
97
98
  clientUsername?: string | undefined;
98
99
  error?: string | undefined;
@@ -102,8 +103,8 @@ export declare class SvelteKitAdminClientEndpoints extends SvelteKitSharedClient
102
103
  valid_flowNames: {
103
104
  [key: string]: string;
104
105
  };
105
- user: import('@crossauth/common').User | undefined;
106
- csrfToken: string | undefined;
106
+ user: any;
107
+ csrfToken: any;
107
108
  }>;
108
109
  actions: {
109
110
  default: (event: RequestEvent) => Promise<UpdateClientFormData>;
@@ -115,7 +116,7 @@ export declare class SvelteKitAdminClientEndpoints extends SvelteKitSharedClient
115
116
  readonly createClientEndpoint: {
116
117
  load: (event: RequestEvent) => Promise<{
117
118
  ok: boolean;
118
- client?: import('@crossauth/common').OAuthClient | undefined;
119
+ client?: import("@crossauth/common").OAuthClient | undefined;
119
120
  client_id?: string | undefined;
120
121
  clientUsername?: string | undefined;
121
122
  error?: string | undefined;
@@ -125,8 +126,8 @@ export declare class SvelteKitAdminClientEndpoints extends SvelteKitSharedClient
125
126
  valid_flowNames: {
126
127
  [key: string]: string;
127
128
  };
128
- user: import('@crossauth/common').User | undefined;
129
- csrfToken: string | undefined;
129
+ user: any;
130
+ csrfToken: any;
130
131
  }>;
131
132
  actions: {
132
133
  default: (event: RequestEvent) => Promise<UpdateClientFormData>;
@@ -138,14 +139,14 @@ export declare class SvelteKitAdminClientEndpoints extends SvelteKitSharedClient
138
139
  readonly deleteClientEndpoint: {
139
140
  load: (event: RequestEvent) => Promise<{
140
141
  ok: boolean;
141
- client?: import('@crossauth/common').OAuthClient | undefined;
142
+ client?: import("@crossauth/common").OAuthClient | undefined;
142
143
  client_id?: string | undefined;
143
144
  clientUsername?: string | undefined;
144
145
  error?: string | undefined;
145
146
  errorCode?: number | undefined;
146
147
  errorCodeName?: string | undefined;
147
- user: import('@crossauth/common').User | undefined;
148
- csrfToken: string | undefined;
148
+ user: any;
149
+ csrfToken: any;
149
150
  }>;
150
151
  actions: {
151
152
  default: (event: RequestEvent) => Promise<DeleteClientFormData>;
@@ -1,7 +1,8 @@
1
- import { SvelteKitSessionServer, SvelteKitSessionServerOptions } from './sveltekitsession';
2
- import { User, UserInputFields, ErrorCode } from '@crossauth/common';
3
- import { RequestEvent } from '@sveltejs/kit';
4
-
1
+ import { SvelteKitSessionServer } from './sveltekitsession';
2
+ import type { SvelteKitSessionServerOptions } from './sveltekitsession';
3
+ import type { User, UserInputFields } from '@crossauth/common';
4
+ import { ErrorCode } from '@crossauth/common';
5
+ import type { RequestEvent } from '@sveltejs/kit';
5
6
  /**
6
7
  * Return type for {@link SvelteKitAdminEndpoints.updateUser}
7
8
  * {@link SvelteKitAdminEndpoints.updateUserEndpoint} action.
@@ -294,8 +295,8 @@ export declare class SvelteKitAdminEndpoints {
294
295
  */
295
296
  deleteUser(event: RequestEvent): Promise<AdminDeleteUserReturn>;
296
297
  baseEndpoint(event: RequestEvent): {
297
- user: User | undefined;
298
- csrfToken: string | undefined;
298
+ user: any;
299
+ csrfToken: any;
299
300
  };
300
301
  readonly searchUsersEndpoint: {
301
302
  load: (event: RequestEvent) => Promise<{
@@ -309,8 +310,8 @@ export declare class SvelteKitAdminEndpoints {
309
310
  errorCodeName?: string | undefined;
310
311
  hasPrevious: boolean;
311
312
  hasNext: boolean;
312
- user: User | undefined;
313
- csrfToken: string | undefined;
313
+ user: any;
314
+ csrfToken: any;
314
315
  }>;
315
316
  };
316
317
  private getUserFromParam;
@@ -319,8 +320,8 @@ export declare class SvelteKitAdminEndpoints {
319
320
  default: (event: RequestEvent) => Promise<AdminUpdateUserReturn>;
320
321
  };
321
322
  load: (event: RequestEvent) => Promise<{
322
- user: User | undefined;
323
- csrfToken: string | undefined;
323
+ user: any;
324
+ csrfToken: any;
324
325
  allowedFactor2: {
325
326
  name: string;
326
327
  friendlyName: string;
@@ -334,20 +335,20 @@ export declare class SvelteKitAdminEndpoints {
334
335
  default: (event: RequestEvent) => Promise<AdminChangePasswordReturn>;
335
336
  };
336
337
  load: (event: RequestEvent) => Promise<{
337
- user: User | undefined;
338
- csrfToken: string | undefined;
338
+ user: any;
339
+ csrfToken: any;
339
340
  editUser: User | undefined;
340
341
  } | {
341
- user: User | undefined;
342
- csrfToken: string | undefined;
342
+ user: any;
343
+ csrfToken: any;
343
344
  editUser: User;
344
345
  next?: string | undefined;
345
346
  }>;
346
347
  };
347
348
  readonly createUserEndpoint: {
348
349
  load: (event: RequestEvent) => Promise<{
349
- user: User | undefined;
350
- csrfToken: string | undefined;
350
+ user: any;
351
+ csrfToken: any;
351
352
  allowedFactor2: {
352
353
  name: string;
353
354
  friendlyName: string;
@@ -363,14 +364,14 @@ export declare class SvelteKitAdminEndpoints {
363
364
  default: (event: RequestEvent) => Promise<AdminDeleteUserReturn>;
364
365
  };
365
366
  load: (event: RequestEvent) => Promise<{
366
- user: User | undefined;
367
- csrfToken: string | undefined;
367
+ user: any;
368
+ csrfToken: any;
368
369
  error: string;
369
370
  errorCode: ErrorCode | undefined;
370
371
  errorCodeName: string | undefined;
371
372
  } | {
372
- user: User | undefined;
373
- csrfToken: string | undefined;
373
+ user: any;
374
+ csrfToken: any;
374
375
  username: string;
375
376
  }>;
376
377
  };
@@ -1,6 +1,6 @@
1
- import { UserStorage, KeyStorage, ApiKeyManagerOptions } from '@crossauth/backend';
2
- import { RequestEvent, MaybePromise } from '@sveltejs/kit';
3
-
1
+ import { UserStorage, KeyStorage } from '@crossauth/backend';
2
+ import type { ApiKeyManagerOptions } from '@crossauth/backend';
3
+ import type { RequestEvent, MaybePromise } from '@sveltejs/kit';
4
4
  /**
5
5
  * Options for {@link SvelteKitApiKeyServer }.
6
6
  *
@@ -1,8 +1,9 @@
1
- import { CrossauthError, ErrorCode, OAuthTokenResponse, OAuthDeviceAuthorizationResponse, User } from '@crossauth/common';
2
- import { OAuthClientBackend, OAuthClientOptions } from '@crossauth/backend';
1
+ import { CrossauthError, ErrorCode } from '@crossauth/common';
2
+ import type { OAuthTokenResponse, OAuthDeviceAuthorizationResponse, User } from '@crossauth/common';
3
+ import { OAuthClientBackend } from '@crossauth/backend';
4
+ import type { OAuthClientOptions } from '@crossauth/backend';
3
5
  import { SvelteKitServer } from './sveltekitserver';
4
- import { RequestEvent, MaybePromise } from '@sveltejs/kit';
5
-
6
+ import type { RequestEvent, MaybePromise } from '@sveltejs/kit';
6
7
  export type SvelteKitErrorFn = (server: SvelteKitServer, event: RequestEvent, ce: CrossauthError) => Promise<Response>;
7
8
  /**
8
9
  * Options for {@link SvelteKitOAuthClient}.
@@ -402,7 +403,7 @@ export declare class SvelteKitOAuthClient extends OAuthClientBackend {
402
403
  }>;
403
404
  pack(ret: {
404
405
  [key: string]: any;
405
- } | undefined | Response): Response;
406
+ } | undefined | Response): any;
406
407
  /**
407
408
  * Ordinarily you would not call this directly but use `allBffEndpoint`.
408
409
  *
@@ -431,7 +432,7 @@ export declare class SvelteKitOAuthClient extends OAuthClientBackend {
431
432
  load: (event: RequestEvent) => Promise<AuthorizationCodeFlowReturn>;
432
433
  };
433
434
  readonly authorizationCodeFlowWithPKCEEndpoint: {
434
- get: (event: RequestEvent) => Promise<Response>;
435
+ get: (event: RequestEvent) => Promise<any>;
435
436
  load: (event: RequestEvent) => Promise<AuthorizationCodeFlowReturn>;
436
437
  };
437
438
  readonly redirectUriEndpoint: {
@@ -439,7 +440,7 @@ export declare class SvelteKitOAuthClient extends OAuthClientBackend {
439
440
  load: (event: RequestEvent) => Promise<RedirectUriReturn>;
440
441
  };
441
442
  readonly clientCredentialsFlowEndpoint: {
442
- post: (event: RequestEvent) => Promise<Response>;
443
+ post: (event: RequestEvent) => Promise<any>;
443
444
  actions: {
444
445
  default: (event: RequestEvent) => Promise<{}>;
445
446
  };
@@ -451,7 +452,7 @@ export declare class SvelteKitOAuthClient extends OAuthClientBackend {
451
452
  };
452
453
  };
453
454
  readonly refreshTokensIfExpiredEndpoint: {
454
- post: (event: RequestEvent) => Promise<Response>;
455
+ post: (event: RequestEvent) => Promise<any>;
455
456
  actions: {
456
457
  default: (event: RequestEvent) => Promise<Response | (TokenReturn & {
457
458
  expires_at?: number | undefined;
@@ -459,10 +460,10 @@ export declare class SvelteKitOAuthClient extends OAuthClientBackend {
459
460
  };
460
461
  };
461
462
  readonly autoRefreshTokensIfExpiredEndpoint: {
462
- post: (event: RequestEvent) => Promise<Response>;
463
+ post: (event: RequestEvent) => Promise<any>;
463
464
  };
464
465
  readonly autoRefreshTokensEndpoint: {
465
- post: (event: RequestEvent) => Promise<Response>;
466
+ post: (event: RequestEvent) => Promise<any>;
466
467
  };
467
468
  readonly startDeviceCodeFlowEndpoint: {
468
469
  actions: {
@@ -470,20 +471,19 @@ export declare class SvelteKitOAuthClient extends OAuthClientBackend {
470
471
  verification_uri_qrdata?: string | undefined;
471
472
  }>;
472
473
  };
473
- post: (event: RequestEvent) => Promise<Response>;
474
+ post: (event: RequestEvent) => Promise<any>;
474
475
  };
475
476
  readonly pollDeviceCodeFlowEndpoint: {
476
477
  actions: {
477
478
  default: (event: RequestEvent) => Promise<{}>;
478
479
  };
479
- post: (event: RequestEvent) => Promise<Response>;
480
+ post: (event: RequestEvent) => Promise<any>;
480
481
  };
481
482
  readonly passwordFlowEndpoint: {
482
483
  post: (event: RequestEvent) => Promise<Response | {
483
484
  access_token?: string | undefined;
484
485
  refresh_token?: string | undefined;
485
- id_token?: string | undefined;
486
- /**
486
+ id_token?: string | undefined; /**
487
487
  * This function is called after successful authorization to pass the
488
488
  * new tokens to.
489
489
  * @param oauthResponse the response from the OAuth `token` endpoint.
@@ -517,8 +517,7 @@ export declare class SvelteKitOAuthClient extends OAuthClientBackend {
517
517
  post: (event: RequestEvent) => Promise<Response | {
518
518
  access_token?: string | undefined;
519
519
  refresh_token?: string | undefined;
520
- id_token?: string | undefined;
521
- /**
520
+ id_token?: string | undefined; /**
522
521
  * This function is called after successful authorization to pass the
523
522
  * new tokens to.
524
523
  * @param oauthResponse the response from the OAuth `token` endpoint.
@@ -550,8 +549,7 @@ export declare class SvelteKitOAuthClient extends OAuthClientBackend {
550
549
  post: (event: RequestEvent) => Promise<Response | {
551
550
  access_token?: string | undefined;
552
551
  refresh_token?: string | undefined;
553
- id_token?: string | undefined;
554
- /**
552
+ id_token?: string | undefined; /**
555
553
  * This function is called after successful authorization to pass the
556
554
  * new tokens to.
557
555
  * @param oauthResponse the response from the OAuth `token` endpoint.
@@ -580,7 +578,7 @@ export declare class SvelteKitOAuthClient extends OAuthClientBackend {
580
578
  };
581
579
  };
582
580
  readonly deleteTokensEndpoint: {
583
- post: (event: RequestEvent) => Promise<Response>;
581
+ post: (event: RequestEvent) => Promise<any>;
584
582
  actions: {
585
583
  default: (event: RequestEvent) => Promise<{
586
584
  ok: boolean;
@@ -1,8 +1,8 @@
1
- import { OAuthClientStorage, KeyStorage, OAuthAuthorizationServer, Authenticator, OAuthAuthorizationServerOptions, DoubleSubmitCsrfTokenOptions } from '@crossauth/backend';
1
+ import { OAuthClientStorage, KeyStorage, OAuthAuthorizationServer, Authenticator } from '@crossauth/backend';
2
+ import type { OAuthAuthorizationServerOptions, DoubleSubmitCsrfTokenOptions } from '@crossauth/backend';
2
3
  import { SvelteKitServer } from './sveltekitserver';
3
- import { OpenIdConfiguration, User } from '@crossauth/common';
4
- import { RequestEvent } from '@sveltejs/kit';
5
-
4
+ import { type OpenIdConfiguration, type User } from '@crossauth/common';
5
+ import type { RequestEvent } from '@sveltejs/kit';
6
6
  /**
7
7
  * Query parameters for the `authorize` request.
8
8
  */
@@ -313,8 +313,8 @@ export declare class SvelteKitAuthorizationServer {
313
313
  * - `csrfToken` the CSRF token from `event.locals.csrfToken`
314
314
  */
315
315
  baseEndpoint(event: RequestEvent): {
316
- user: User | undefined;
317
- csrfToken: string | undefined;
316
+ user: any;
317
+ csrfToken: any;
318
318
  };
319
319
  /**
320
320
  * `get` function for the oidcConfiguration endpoint.
@@ -322,7 +322,7 @@ export declare class SvelteKitAuthorizationServer {
322
322
  * See class description for details.
323
323
  */
324
324
  readonly oidcConfigurationEndpoint: {
325
- get: (_event: RequestEvent) => Promise<Response>;
325
+ get: (_event: RequestEvent) => Promise<any>;
326
326
  };
327
327
  /**
328
328
  * `get` function for the jwks endpoint.
@@ -330,7 +330,7 @@ export declare class SvelteKitAuthorizationServer {
330
330
  * See class description for details.
331
331
  */
332
332
  readonly jwksGetEndpoint: {
333
- get: (_event: RequestEvent) => Promise<Response>;
333
+ get: (_event: RequestEvent) => Promise<any>;
334
334
  };
335
335
  /**
336
336
  * `get` function for the csrfToken endpoint.
@@ -339,7 +339,7 @@ export declare class SvelteKitAuthorizationServer {
339
339
  * protection to rely on Sveltekit's.
340
340
  */
341
341
  readonly getCsrfTokenEndpoint: {
342
- get: (event: RequestEvent) => Promise<Response>;
342
+ get: (event: RequestEvent) => Promise<any>;
343
343
  };
344
344
  /**
345
345
  * `load` and `actions` functions for the authorize endpoint.
@@ -360,7 +360,7 @@ export declare class SvelteKitAuthorizationServer {
360
360
  * protection to rely on Sveltekit's.
361
361
  */
362
362
  readonly tokenEndpoint: {
363
- post: (event: RequestEvent) => Promise<Response>;
363
+ post: (event: RequestEvent) => Promise<any>;
364
364
  };
365
365
  /**
366
366
  * `get` and `post` functions for the mfa/authenticators endpoint.
@@ -369,8 +369,8 @@ export declare class SvelteKitAuthorizationServer {
369
369
  * protection to rely on Sveltekit's.
370
370
  */
371
371
  readonly mfaAuthenticatorsEndpoint: {
372
- get: (event: RequestEvent) => Promise<Response>;
373
- post: (event: RequestEvent) => Promise<Response>;
372
+ get: (event: RequestEvent) => Promise<any>;
373
+ post: (event: RequestEvent) => Promise<any>;
374
374
  };
375
375
  /**
376
376
  * `post` function for the mfa/challenge endpoint.
@@ -379,7 +379,7 @@ export declare class SvelteKitAuthorizationServer {
379
379
  * protection to rely on Sveltekit's.
380
380
  */
381
381
  readonly mfaChallengeEndpoint: {
382
- post: (event: RequestEvent) => Promise<Response>;
382
+ post: (event: RequestEvent) => Promise<any>;
383
383
  };
384
384
  /**
385
385
  * `post` function for the device_authorization endpoint.
@@ -388,7 +388,7 @@ export declare class SvelteKitAuthorizationServer {
388
388
  * protection to rely on Sveltekit's.
389
389
  */
390
390
  readonly deviceAuthorizationEndpoint: {
391
- post: (event: RequestEvent) => Promise<Response>;
391
+ post: (event: RequestEvent) => Promise<any>;
392
392
  };
393
393
  /**
394
394
  * `load` and `actions` functions for the authorize endpoint.
@@ -1,8 +1,9 @@
1
- import { RequestEvent, MaybePromise } from '@sveltejs/kit';
2
- import { User } from '@crossauth/common';
3
- import { OAuthResourceServer, UserStorage, OAuthResourceServerOptions, OAuthTokenConsumer } from '@crossauth/backend';
1
+ import type { RequestEvent, MaybePromise } from '@sveltejs/kit';
2
+ import { type User } from '@crossauth/common';
3
+ import { OAuthResourceServer, UserStorage } from '@crossauth/backend';
4
+ import type { OAuthResourceServerOptions } from '@crossauth/backend';
5
+ import { OAuthTokenConsumer } from '@crossauth/backend';
4
6
  import { SvelteKitSessionAdapter } from './sveltekitsessionadapter';
5
-
6
7
  /**
7
8
  * Options for {@link SvelteKitOAuthResourceServer}
8
9
  */
@@ -1,13 +1,13 @@
1
- import { SvelteKitSessionServer, SvelteKitSessionServerOptions } from './sveltekitsession';
2
- import { SvelteKitApiKeyServer, SvelteKitApiKeyServerOptions } from './sveltekitapikey';
3
- import { SvelteKitAuthorizationServer, SvelteKitAuthorizationServerOptions } from './sveltekitoauthserver';
1
+ import { SvelteKitSessionServer, type SvelteKitSessionServerOptions } from './sveltekitsession';
2
+ import { SvelteKitApiKeyServer, type SvelteKitApiKeyServerOptions } from './sveltekitapikey';
3
+ import { SvelteKitAuthorizationServer, type SvelteKitAuthorizationServerOptions } from './sveltekitoauthserver';
4
4
  import { UserStorage, KeyStorage, OAuthClientStorage } from '@crossauth/backend';
5
- import { User } from '@crossauth/common';
6
- import { Handle, RequestEvent, ResolveOptions, MaybePromise } from '@sveltejs/kit';
7
- import { SvelteKitOAuthClient, SvelteKitOAuthClientOptions } from './sveltekitoauthclient';
8
- import { SvelteKitOAuthResourceServer, SvelteKitOAuthResourceServerOptions } from './sveltekitresserver';
5
+ import { type User } from '@crossauth/common';
6
+ import { type Handle, type RequestEvent, type ResolveOptions, type MaybePromise } from '@sveltejs/kit';
7
+ import { SvelteKitOAuthClient } from './sveltekitoauthclient';
8
+ import type { SvelteKitOAuthClientOptions } from './sveltekitoauthclient';
9
+ import { SvelteKitOAuthResourceServer, type SvelteKitOAuthResourceServerOptions } from './sveltekitresserver';
9
10
  import { SvelteKitSessionAdapter } from './sveltekitsessionadapter';
10
-
11
11
  export interface SvelteKitServerOptions extends SvelteKitSessionServerOptions, SvelteKitApiKeyServerOptions, SvelteKitAuthorizationServerOptions, SvelteKitOAuthClientOptions, SvelteKitOAuthResourceServerOptions {
12
12
  /** User can set this to check if the user is an administrator.
13
13
  * By default, the admin booloean field in the user object is checked
@@ -1,12 +1,12 @@
1
- import { KeyStorage, UserStorage, OAuthClientStorage, SessionManager, Authenticator, Cookie, SessionManagerOptions } from '@crossauth/backend';
2
- import { Key, User, UserInputFields, OAuthClient } from '@crossauth/common';
3
- import { RequestEvent, MaybePromise } from '@sveltejs/kit';
1
+ import { KeyStorage, UserStorage, OAuthClientStorage, SessionManager, Authenticator } from '@crossauth/backend';
2
+ import type { Cookie, SessionManagerOptions } from '@crossauth/backend';
3
+ import type { Key, User, UserInputFields, OAuthClient } from '@crossauth/common';
4
+ import type { RequestEvent, MaybePromise } from '@sveltejs/kit';
4
5
  import { SvelteKitUserEndpoints } from './sveltekituserendpoints';
5
6
  import { SvelteKitAdminEndpoints } from './sveltekitadminendpoints';
6
7
  import { SvelteKitUserClientEndpoints } from './sveltekituserclientendpoints';
7
8
  import { SvelteKitAdminClientEndpoints } from './sveltekitadminclientendpoints';
8
9
  import { SvelteKitSessionAdapter } from './sveltekitsessionadapter';
9
-
10
10
  export declare const CSRFHEADER = "X-CROSSAUTH-CSRF";
11
11
  export type Header = {
12
12
  name: string;
@@ -514,7 +514,7 @@ export declare class SvelteKitSessionServer implements SvelteKitSessionAdapter {
514
514
  */
515
515
  static updateRequest(event: RequestEvent, params: {
516
516
  [key: string]: string;
517
- }, contentType: string): RequestEvent<Partial<Record<string, string>>, string | null>;
517
+ }, contentType: string): RequestEvent;
518
518
  /**
519
519
  * Returns a hash of the session ID. Used for logging (for security,
520
520
  * the actual session ID is not logged)
@@ -1,6 +1,5 @@
1
- import { RequestEvent } from '@sveltejs/kit';
2
- import { User } from '@crossauth/common';
3
-
1
+ import type { RequestEvent } from '@sveltejs/kit';
2
+ import type { User } from '@crossauth/common';
4
3
  export declare abstract class SvelteKitSessionAdapter {
5
4
  abstract csrfProtectionEnabled(): boolean;
6
5
  abstract getCsrfToken(event: RequestEvent): string | undefined;
@@ -1,8 +1,9 @@
1
- import { SvelteKitSessionServer, SvelteKitSessionServerOptions } from './sveltekitsession';
2
- import { OAuthClientManager, OAuthClientStorage } from '@crossauth/backend';
3
- import { OAuthClient } from '@crossauth/common';
4
- import { RequestEvent } from '@sveltejs/kit';
5
-
1
+ import { SvelteKitSessionServer } from './sveltekitsession';
2
+ import type { SvelteKitSessionServerOptions } from './sveltekitsession';
3
+ import { OAuthClientManager } from '@crossauth/backend';
4
+ import type { OAuthClientStorage } from '@crossauth/backend';
5
+ import type { OAuthClient } from '@crossauth/common';
6
+ import type { RequestEvent } from '@sveltejs/kit';
6
7
  /**
7
8
  * Return type for {@link SvelteKitUserClientEndpoints.searchClients}
8
9
  * {@link SvelteKitAdminClientEndpoints.searchClients} load.
@@ -290,7 +291,7 @@ export declare class SvelteKitSharedClientEndpoints {
290
291
  * - `csrfToken` the CSRF token if using
291
292
  */
292
293
  baseEndpoint(event: RequestEvent): {
293
- user: import('@crossauth/common').User | undefined;
294
- csrfToken: string | undefined;
294
+ user: any;
295
+ csrfToken: any;
295
296
  };
296
297
  }
@@ -1,7 +1,8 @@
1
- import { SvelteKitSessionServer, SvelteKitSessionServerOptions } from './sveltekitsession';
2
- import { RequestEvent } from '@sveltejs/kit';
3
- import { SearchClientsPageData, UpdateClientPageData, UpdateClientFormData, DeleteClientPageData, DeleteClientFormData, SvelteKitSharedClientEndpoints } from './sveltekitsharedclientendpoints';
4
-
1
+ import { SvelteKitSessionServer } from './sveltekitsession';
2
+ import type { SvelteKitSessionServerOptions } from './sveltekitsession';
3
+ import type { RequestEvent } from '@sveltejs/kit';
4
+ import type { SearchClientsPageData, UpdateClientPageData, UpdateClientFormData, DeleteClientPageData, DeleteClientFormData } from './sveltekitsharedclientendpoints';
5
+ import { SvelteKitSharedClientEndpoints } from './sveltekitsharedclientendpoints';
5
6
  /**
6
7
  * Endpoints for manipulating the OAuth client table, for use by users.
7
8
  *
@@ -72,7 +73,7 @@ export declare class SvelteKitUserClientEndpoints extends SvelteKitSharedClientE
72
73
  readonly searchClientsEndpoint: {
73
74
  load: (event: RequestEvent) => Promise<{
74
75
  ok: boolean;
75
- clients?: import('@crossauth/common').OAuthClient[] | undefined;
76
+ clients?: import("@crossauth/common").OAuthClient[] | undefined;
76
77
  skip: number;
77
78
  take: number;
78
79
  search?: string | undefined;
@@ -82,8 +83,8 @@ export declare class SvelteKitUserClientEndpoints extends SvelteKitSharedClientE
82
83
  hasPrevious: boolean;
83
84
  hasNext: boolean;
84
85
  clientUserId?: string | number | undefined;
85
- user: import('@crossauth/common').User | undefined;
86
- csrfToken: string | undefined;
86
+ user: any;
87
+ csrfToken: any;
87
88
  }>;
88
89
  };
89
90
  /**
@@ -92,7 +93,7 @@ export declare class SvelteKitUserClientEndpoints extends SvelteKitSharedClientE
92
93
  readonly updateClientEndpoint: {
93
94
  load: (event: RequestEvent) => Promise<{
94
95
  ok: boolean;
95
- client?: import('@crossauth/common').OAuthClient | undefined;
96
+ client?: import("@crossauth/common").OAuthClient | undefined;
96
97
  client_id?: string | undefined;
97
98
  clientUsername?: string | undefined;
98
99
  error?: string | undefined;
@@ -102,8 +103,8 @@ export declare class SvelteKitUserClientEndpoints extends SvelteKitSharedClientE
102
103
  valid_flowNames: {
103
104
  [key: string]: string;
104
105
  };
105
- user: import('@crossauth/common').User | undefined;
106
- csrfToken: string | undefined;
106
+ user: any;
107
+ csrfToken: any;
107
108
  }>;
108
109
  actions: {
109
110
  default: (event: RequestEvent) => Promise<UpdateClientFormData>;
@@ -115,7 +116,7 @@ export declare class SvelteKitUserClientEndpoints extends SvelteKitSharedClientE
115
116
  readonly createClientEndpoint: {
116
117
  load: (event: RequestEvent) => Promise<{
117
118
  ok: boolean;
118
- client?: import('@crossauth/common').OAuthClient | undefined;
119
+ client?: import("@crossauth/common").OAuthClient | undefined;
119
120
  client_id?: string | undefined;
120
121
  clientUsername?: string | undefined;
121
122
  error?: string | undefined;
@@ -125,8 +126,8 @@ export declare class SvelteKitUserClientEndpoints extends SvelteKitSharedClientE
125
126
  valid_flowNames: {
126
127
  [key: string]: string;
127
128
  };
128
- user: import('@crossauth/common').User | undefined;
129
- csrfToken: string | undefined;
129
+ user: any;
130
+ csrfToken: any;
130
131
  }>;
131
132
  actions: {
132
133
  default: (event: RequestEvent) => Promise<UpdateClientFormData>;
@@ -138,14 +139,14 @@ export declare class SvelteKitUserClientEndpoints extends SvelteKitSharedClientE
138
139
  readonly deleteClientEndpoint: {
139
140
  load: (event: RequestEvent) => Promise<{
140
141
  ok: boolean;
141
- client?: import('@crossauth/common').OAuthClient | undefined;
142
+ client?: import("@crossauth/common").OAuthClient | undefined;
142
143
  client_id?: string | undefined;
143
144
  clientUsername?: string | undefined;
144
145
  error?: string | undefined;
145
146
  errorCode?: number | undefined;
146
147
  errorCodeName?: string | undefined;
147
- user: import('@crossauth/common').User | undefined;
148
- csrfToken: string | undefined;
148
+ user: any;
149
+ csrfToken: any;
149
150
  }>;
150
151
  actions: {
151
152
  default: (event: RequestEvent) => Promise<DeleteClientFormData>;
@@ -1,8 +1,9 @@
1
- import { SveltekitEndpoint } from './sveltekitserver';
2
- import { SvelteKitSessionServer, SvelteKitSessionServerOptions } from './sveltekitsession';
3
- import { User, UserInputFields, ErrorCode } from '@crossauth/common';
4
- import { RequestEvent } from '@sveltejs/kit';
5
-
1
+ import { type SveltekitEndpoint } from './sveltekitserver';
2
+ import { SvelteKitSessionServer } from './sveltekitsession';
3
+ import type { SvelteKitSessionServerOptions } from './sveltekitsession';
4
+ import type { User, UserInputFields } from '@crossauth/common';
5
+ import { ErrorCode } from '@crossauth/common';
6
+ import type { RequestEvent } from '@sveltejs/kit';
6
7
  /**
7
8
  * Return type for {@link SvelteKitUserEndpoints.login},
8
9
  * {@link SvelteKitUserEndpoints.loginFactor2} and the
@@ -305,7 +306,7 @@ export declare class SvelteKitUserEndpoints {
305
306
  * @param event the SvelteKit request event
306
307
  * @returns true or false
307
308
  */
308
- canEditUser(event: RequestEvent): boolean | "" | undefined;
309
+ canEditUser(event: RequestEvent): any;
309
310
  /**
310
311
  * Log a user in if possible.
311
312
  *
@@ -627,13 +628,13 @@ export declare class SvelteKitUserEndpoints {
627
628
  */
628
629
  reconfigureFactor2(event: RequestEvent): Promise<ChangeFactor2Return>;
629
630
  baseEndpoint(event: RequestEvent): {
630
- user: User | undefined;
631
- csrfToken: string | undefined;
631
+ user: any;
632
+ csrfToken: any;
632
633
  };
633
634
  readonly signupEndpoint: {
634
635
  load: (event: RequestEvent) => Promise<{
635
- user: User | undefined;
636
- csrfToken: string | undefined;
636
+ user: any;
637
+ csrfToken: any;
637
638
  allowedFactor2: {
638
639
  name: string;
639
640
  friendlyName: string;
@@ -646,9 +647,9 @@ export declare class SvelteKitUserEndpoints {
646
647
  };
647
648
  readonly loginEndpoint: {
648
649
  load: (event: RequestEvent) => Promise<{
649
- user: User | undefined;
650
- csrfToken: string | undefined;
651
- next: string;
650
+ user: any;
651
+ csrfToken: any;
652
+ next: any;
652
653
  }>;
653
654
  actions: {
654
655
  login: (event: RequestEvent) => Promise<LoginReturn>;
@@ -663,8 +664,8 @@ export declare class SvelteKitUserEndpoints {
663
664
  default: (event: RequestEvent) => Promise<LogoutReturn>;
664
665
  };
665
666
  load: (event: RequestEvent) => Promise<{
666
- user: User | undefined;
667
- csrfToken: string | undefined;
667
+ user: any;
668
+ csrfToken: any;
668
669
  }>;
669
670
  };
670
671
  readonly changeFactor2Endpoint: {
@@ -673,9 +674,9 @@ export declare class SvelteKitUserEndpoints {
673
674
  reconfigure: (event: RequestEvent) => Promise<ChangeFactor2Return>;
674
675
  };
675
676
  load: (event: RequestEvent) => Promise<{
676
- user: User | undefined;
677
- csrfToken: string | undefined;
678
- username: string | undefined;
677
+ user: any;
678
+ csrfToken: any;
679
+ username: any;
679
680
  required?: boolean | undefined;
680
681
  next?: string | undefined;
681
682
  allowedFactor2: {
@@ -690,8 +691,8 @@ export declare class SvelteKitUserEndpoints {
690
691
  default: (event: RequestEvent) => Promise<ChangePasswordReturn>;
691
692
  };
692
693
  load: (event: RequestEvent) => Promise<{
693
- user: User | undefined;
694
- csrfToken: string | undefined;
694
+ user: any;
695
+ csrfToken: any;
695
696
  required?: boolean | undefined;
696
697
  next?: string | undefined;
697
698
  }>;
@@ -701,8 +702,8 @@ export declare class SvelteKitUserEndpoints {
701
702
  default: (event: RequestEvent) => Promise<ConfigureFactor2Return>;
702
703
  };
703
704
  load: (event: RequestEvent) => Promise<{
704
- user: User | undefined;
705
- csrfToken: string | undefined;
705
+ user: any;
706
+ csrfToken: any;
706
707
  }>;
707
708
  };
708
709
  readonly deleteUserEndpoint: {
@@ -710,8 +711,8 @@ export declare class SvelteKitUserEndpoints {
710
711
  default: (event: RequestEvent) => Promise<DeleteUserReturn>;
711
712
  };
712
713
  load: (event: RequestEvent) => Promise<{
713
- user: User | undefined;
714
- csrfToken: string | undefined;
714
+ user: any;
715
+ csrfToken: any;
715
716
  }>;
716
717
  };
717
718
  readonly resetPasswordEndpoint: {
@@ -719,8 +720,8 @@ export declare class SvelteKitUserEndpoints {
719
720
  default: (event: RequestEvent) => Promise<RequestPasswordResetReturn>;
720
721
  };
721
722
  load: (event: RequestEvent) => Promise<{
722
- user: User | undefined;
723
- csrfToken: string | undefined;
723
+ user: any;
724
+ csrfToken: any;
724
725
  required?: boolean | undefined;
725
726
  next?: string | undefined;
726
727
  }>;
@@ -728,14 +729,14 @@ export declare class SvelteKitUserEndpoints {
728
729
  readonly passwordResetTokenEndpoint: {
729
730
  actions: {
730
731
  default: (event: RequestEvent) => Promise<ResetPasswordReturn | {
731
- user: User | undefined;
732
- csrfToken: string | undefined;
732
+ user: any;
733
+ csrfToken: any;
733
734
  ok: boolean;
734
735
  tokenValidated: boolean;
735
736
  error: string;
736
737
  } | {
737
- user: User | undefined;
738
- csrfToken: string | undefined;
738
+ user: any;
739
+ csrfToken: any;
739
740
  ok: boolean;
740
741
  tokenValidated: boolean;
741
742
  error: string | undefined;
@@ -744,17 +745,17 @@ export declare class SvelteKitUserEndpoints {
744
745
  }>;
745
746
  };
746
747
  load: (event: RequestEvent) => Promise<{
747
- user: User | undefined;
748
- csrfToken: string | undefined;
748
+ user: any;
749
+ csrfToken: any;
749
750
  tokenValidated: boolean;
750
751
  error: string | undefined;
751
752
  } | {
752
- user: User | undefined;
753
- csrfToken: string | undefined;
753
+ user: any;
754
+ csrfToken: any;
754
755
  tokenValidated: boolean;
755
756
  } | {
756
- user: User | undefined;
757
- csrfToken: string | undefined;
757
+ user: any;
758
+ csrfToken: any;
758
759
  tokenValidated: boolean;
759
760
  error: string;
760
761
  errorCode: ErrorCode;
@@ -1,11 +1,11 @@
1
1
  export declare function oauthLogin(options?: {}): Promise<{
2
- server: import('..').SvelteKitServer;
3
- authServer: import('@crossauth/backend').OAuthAuthorizationServer;
4
- sessionCookieValue: string | undefined;
2
+ server: import("..").SvelteKitServer;
3
+ authServer: import("@crossauth/backend").OAuthAuthorizationServer;
4
+ sessionCookieValue: any;
5
5
  sessionId: string | undefined;
6
6
  access_token: any;
7
7
  refresh_token: any;
8
- keyStorage: import('@crossauth/backend').InMemoryKeyStorage;
9
- userStorage: import('@crossauth/backend').InMemoryUserStorage;
10
- clientStorage: import('@crossauth/backend').InMemoryOAuthClientStorage;
8
+ keyStorage: import("@crossauth/backend").InMemoryKeyStorage;
9
+ userStorage: import("@crossauth/backend").InMemoryUserStorage;
10
+ clientStorage: import("@crossauth/backend").InMemoryOAuthClientStorage;
11
11
  }>;
@@ -1,10 +1,10 @@
1
1
  export declare function oauthLogin(): Promise<{
2
- server: import('..').SvelteKitServer;
3
- authServer: import('@crossauth/backend').OAuthAuthorizationServer;
4
- sessionCookieValue: string | undefined;
2
+ server: import("..").SvelteKitServer;
3
+ authServer: import("@crossauth/backend").OAuthAuthorizationServer;
4
+ sessionCookieValue: any;
5
5
  sessionId: string | undefined;
6
6
  access_token: any;
7
7
  refresh_token: any;
8
- keyStorage: import('@crossauth/backend').InMemoryKeyStorage;
9
- userStorage: import('@crossauth/backend').InMemoryUserStorage;
8
+ keyStorage: import("@crossauth/backend").InMemoryKeyStorage;
9
+ userStorage: import("@crossauth/backend").InMemoryUserStorage;
10
10
  }>;
@@ -1,6 +1,5 @@
1
- import { Cookies, RequestEvent, MaybePromise, ResolveOptions } from '@sveltejs/kit';
2
- import { CookieParseOptions, CookieSerializeOptions } from 'cookie';
3
-
1
+ import { type Cookies, type RequestEvent, type MaybePromise, type ResolveOptions } from '@sveltejs/kit';
2
+ import { type CookieParseOptions, type CookieSerializeOptions } from 'cookie';
4
3
  export declare class MockCookies implements Cookies {
5
4
  cookies: {
6
5
  [key: string]: {
@@ -1,14 +1,14 @@
1
1
  import { MockResolver, MockRequestEvent } from './sveltemocks';
2
2
  import { SvelteKitServer } from '../sveltekitserver';
3
- import { OAuthAuthorizationServer, InMemoryKeyStorage, InMemoryUserStorage, InMemoryOAuthClientStorage, LocalPasswordAuthenticator, ApiKeyManager } from '@crossauth/backend';
4
- import { OpenIdConfiguration, OAuthClient } from '@crossauth/common';
5
- import { Handle } from '@sveltejs/kit';
6
-
3
+ import { OAuthAuthorizationServer } from '@crossauth/backend';
4
+ import { type OpenIdConfiguration, type OAuthClient } from '@crossauth/common';
5
+ import { InMemoryKeyStorage, InMemoryUserStorage, InMemoryOAuthClientStorage, LocalPasswordAuthenticator, ApiKeyManager } from '@crossauth/backend';
6
+ import type { Handle } from '@sveltejs/kit';
7
7
  export declare const oidcConfiguration: OpenIdConfiguration;
8
8
  export declare function createUsers(userStorage: InMemoryUserStorage): Promise<void>;
9
9
  export declare function createSession(userid: string, userStorage: InMemoryUserStorage, keyStorage: InMemoryKeyStorage, options?: {}): Promise<{
10
- key: import('@crossauth/common').Key;
11
- cookie: import('@crossauth/backend').Cookie;
10
+ key: import("@crossauth/common").Key;
11
+ cookie: import("@crossauth/backend").Cookie;
12
12
  }>;
13
13
  export declare function createClients(clientStorage: InMemoryOAuthClientStorage, secretRequired?: boolean): Promise<OAuthClient>;
14
14
  export declare function makeServer(makeSession?: boolean, makeApiKey?: boolean, makeOAuthServer?: boolean, makeOAuthClient?: boolean, options?: {}): Promise<{
@@ -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('..').LoginReturn | undefined;
35
+ ret: import("..").LoginReturn | 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('..').LoginReturn | undefined;
41
+ ret: import("..").LoginReturn | undefined;
42
42
  }>;
43
43
  export declare function getAuthServer({ aud, persistAccessToken, emptyScopeIsValid, secretRequired, rollingRefreshToken, }?: {
44
44
  challenge?: boolean;
package/dist/utils.d.ts CHANGED
@@ -1,5 +1,4 @@
1
- import { RequestEvent } from '@sveltejs/kit';
2
-
1
+ import type { RequestEvent } from '@sveltejs/kit';
3
2
  export declare class ObjectIterator implements IterableIterator<[string, string]> {
4
3
  values: string[];
5
4
  keys: string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crossauth/sveltekit",
3
- "version": "0.0.18",
3
+ "version": "0.0.20",
4
4
  "license": "Apache-2.0",
5
5
  "private": false,
6
6
  "type": "module",
@@ -46,10 +46,11 @@
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.18",
50
- "@crossauth/common": "^0.0.18"
49
+ "@crossauth/backend": "^0.0.20",
50
+ "@crossauth/common": "^0.0.20"
51
51
  },
52
52
  "scripts": {
53
+ "preparex": "svelte-kit sync",
53
54
  "dev": "vite dev",
54
55
  "build": "vite build",
55
56
  "preview": "vite preview",