cloudfire-auth 0.3.3 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -7,7 +7,7 @@ A library to make Firebase Auth work in Cloudflare Workers, using native Cloudfl
7
7
  - 🔥 Firebase Auth compatibility for Cloudflare Workers
8
8
  - ⚡ Native Cloudflare KV integration for token caching
9
9
  - 🛡️ Full TypeScript support
10
- - 📦 One dependency, jose for JWT handling
10
+ - 📦 One dependency, `jose` for JWT handling
11
11
  - 🌐 ESM-only for modern JavaScript environments
12
12
 
13
13
  ## Installation
@@ -32,6 +32,8 @@
32
32
  *
33
33
  * - getOauth2AccessToken
34
34
  *
35
+ * All of the method documentation beneath the @returns tag is under the MIT
36
+ * License for this project also.
35
37
  */
36
38
  import type { DecodedIdToken, UserRecord, UserIdentifier, GetUsersResult, ListUsersResult, CreateRequest, UpdateRequest, DeleteUsersResult, ServiceAccountKey, SessionCookieOptions, ActionCodeSettings, AuthProviderConfig, UpdateAuthProviderRequest, AuthProviderConfigFilter, ListProviderConfigResults, UserImportRecord, UserImportOptions, UserImportResult } from "./types.js";
37
39
  export declare class CloudFireAuth {
@@ -55,6 +57,8 @@ export declare class CloudFireAuth {
55
57
  *
56
58
  * @returns A promise fulfilled with a custom token for the
57
59
  * provided `uid` and payload.
60
+ *
61
+ * @category Authentication
58
62
  */
59
63
  createCustomToken(uid: string, developerClaims?: object): Promise<string>;
60
64
  /**
@@ -80,6 +84,8 @@ export declare class CloudFireAuth {
80
84
  * @returns A promise fulfilled with the
81
85
  * token's decoded claims if the ID token is valid; otherwise, a rejected
82
86
  * promise.
87
+ *
88
+ * @category Authentication
83
89
  */
84
90
  verifyIdToken(idToken: string, checkRevoked?: boolean): Promise<DecodedIdToken>;
85
91
  /**
@@ -92,6 +98,8 @@ export declare class CloudFireAuth {
92
98
  *
93
99
  * @returns A promise fulfilled with the user
94
100
  * data corresponding to the provided `uid`.
101
+ *
102
+ * @category User Management
95
103
  */
96
104
  getUser(uid: string): Promise<UserRecord>;
97
105
  /**
@@ -105,6 +113,8 @@ export declare class CloudFireAuth {
105
113
  *
106
114
  * @returns A promise fulfilled with the user
107
115
  * data corresponding to the provided email.
116
+ *
117
+ * @category User Management
108
118
  */
109
119
  getUserByEmail(email: string): Promise<UserRecord>;
110
120
  /**
@@ -119,6 +129,8 @@ export declare class CloudFireAuth {
119
129
  *
120
130
  * @returns A promise fulfilled with the user
121
131
  * data corresponding to the provided phone number.
132
+ *
133
+ * @category User Management
122
134
  */
123
135
  getUserByPhoneNumber(phoneNumber: string): Promise<UserRecord>;
124
136
  /**
@@ -133,6 +145,8 @@ export declare class CloudFireAuth {
133
145
  *
134
146
  * @returns A promise fulfilled with the user data corresponding to the
135
147
  * given provider id.
148
+ *
149
+ * @category User Management
136
150
  */
137
151
  getUserByProviderUid(providerId: string, uid: string): Promise<UserRecord>;
138
152
  /**
@@ -149,6 +163,8 @@ export declare class CloudFireAuth {
149
163
  * @returns A promise that resolves to the corresponding user records.
150
164
  * @throws FirebaseAuthError If any of the identifiers are invalid or if more than 100
151
165
  * identifiers are specified.
166
+ *
167
+ * @category User Management
152
168
  */
153
169
  getUsers(identifiers: UserIdentifier[]): Promise<GetUsersResult>;
154
170
  /**
@@ -165,6 +181,8 @@ export declare class CloudFireAuth {
165
181
  * users starting without any offset.
166
182
  * @returns A promise that resolves with
167
183
  * the current batch of downloaded users and the next page token.
184
+ *
185
+ * @category User Management
168
186
  */
169
187
  listUsers(maxResults?: number, pageToken?: string): Promise<ListUsersResult>;
170
188
  /**
@@ -178,6 +196,8 @@ export declare class CloudFireAuth {
178
196
  *
179
197
  * @returns A promise fulfilled with the user
180
198
  * data corresponding to the newly created user.
199
+ *
200
+ * @category User Management
181
201
  */
182
202
  createUser(properties: CreateRequest): Promise<UserRecord>;
183
203
  /**
@@ -190,6 +210,8 @@ export declare class CloudFireAuth {
190
210
  *
191
211
  * @returns An empty promise fulfilled once the user has been
192
212
  * deleted.
213
+ *
214
+ * @category User Management
193
215
  */
194
216
  deleteUser(uid: string): Promise<void>;
195
217
  /**
@@ -213,6 +235,8 @@ export declare class CloudFireAuth {
213
235
  * @returns A Promise that resolves to the total number of successful/failed
214
236
  * deletions, as well as the array of errors that corresponds to the
215
237
  * failed deletions.
238
+ *
239
+ * @category User Management
216
240
  */
217
241
  deleteUsers(uids: string[]): Promise<DeleteUsersResult>;
218
242
  /**
@@ -227,6 +251,8 @@ export declare class CloudFireAuth {
227
251
  *
228
252
  * @returns A promise fulfilled with the
229
253
  * updated user data.
254
+ *
255
+ * @category User Management
230
256
  */
231
257
  updateUser(uid: string, properties: UpdateRequest): Promise<UserRecord>;
232
258
  /**
@@ -251,6 +277,8 @@ export declare class CloudFireAuth {
251
277
  * separate storage systems.
252
278
  * @returns A promise that resolves when the operation completes
253
279
  * successfully.
280
+ *
281
+ * @category Token Management
254
282
  */
255
283
  setCustomUserClaims(uid: string, customUserClaims: object | null): Promise<void>;
256
284
  /**
@@ -263,7 +291,7 @@ export declare class CloudFireAuth {
263
291
  * While this will revoke all sessions for a specified user and disable any
264
292
  * new ID tokens for existing sessions from getting minted, existing ID tokens
265
293
  * may remain active until their natural expiration (one hour). To verify that
266
- * ID tokens are revoked, use {@link BaseAuth.verifyIdToken}
294
+ * ID tokens are revoked, use {@link CloudFireAuth.verifyIdToken}
267
295
  * where `checkRevoked` is set to true.
268
296
  *
269
297
  * @param uid - The `uid` corresponding to the user whose refresh tokens
@@ -271,6 +299,8 @@ export declare class CloudFireAuth {
271
299
  *
272
300
  * @returns An empty promise fulfilled once the user's refresh
273
301
  * tokens have been revoked.
302
+ *
303
+ * @category Token Management
274
304
  */
275
305
  revokeRefreshTokens(uid: string): Promise<void>;
276
306
  /**
@@ -289,6 +319,8 @@ export declare class CloudFireAuth {
289
319
  * the operation completes with the result of the import. This includes the
290
320
  * number of successful imports, the number of failed imports and their
291
321
  * corresponding errors.
322
+ *
323
+ * @category User Management
292
324
  */
293
325
  importUsers(users: UserImportRecord[], options?: UserImportOptions): Promise<UserImportResult>;
294
326
  /**
@@ -307,6 +339,8 @@ export declare class CloudFireAuth {
307
339
  *
308
340
  * @returns A promise that resolves on success with the
309
341
  * created session cookie.
342
+ *
343
+ * @category Authentication
310
344
  */
311
345
  createSessionCookie(idToken: string, sessionCookieOptions: SessionCookieOptions): Promise<string>;
312
346
  /**
@@ -325,7 +359,7 @@ export declare class CloudFireAuth {
325
359
  * for code samples and detailed documentation
326
360
  *
327
361
  * @param sessionCookie - The session cookie to verify.
328
- * @param checkForRevocation - Whether to check if the session cookie was
362
+ * @param checkRevoked - Whether to check if the session cookie was
329
363
  * revoked. This requires an extra request to the Firebase Auth backend to
330
364
  * check the `tokensValidAfterTime` time for the corresponding user.
331
365
  * When not specified, this additional check is not performed.
@@ -333,6 +367,8 @@ export declare class CloudFireAuth {
333
367
  * @returns A promise fulfilled with the
334
368
  * session cookie's decoded claims if the session cookie is valid; otherwise,
335
369
  * a rejected promise.
370
+ *
371
+ * @category Authentication
336
372
  */
337
373
  verifySessionCookie(sessionCookie: string, checkRevoked?: boolean): Promise<DecodedIdToken>;
338
374
  /**
@@ -383,6 +419,8 @@ export declare class CloudFireAuth {
383
419
  * The Android package name and iOS bundle ID are respected only if they
384
420
  * are configured in the same Firebase Auth project.
385
421
  * @returns A promise that resolves with the generated link.
422
+ *
423
+ * @category Email Actions
386
424
  */
387
425
  generatePasswordResetLink(email: string, actionCodeSettings?: ActionCodeSettings): Promise<string>;
388
426
  /**
@@ -432,6 +470,8 @@ export declare class CloudFireAuth {
432
470
  * The Android package name and iOS bundle ID are respected only if they
433
471
  * are configured in the same Firebase Auth project.
434
472
  * @returns A promise that resolves with the generated link.
473
+ *
474
+ * @category Email Actions
435
475
  */
436
476
  generateEmailVerificationLink(email: string, actionCodeSettings?: ActionCodeSettings): Promise<string>;
437
477
  /**
@@ -457,6 +497,8 @@ export declare class CloudFireAuth {
457
497
  * The Android package name and iOS bundle ID are respected only if they
458
498
  * are configured in the same Firebase Auth project.
459
499
  * @returns A promise that resolves with the generated link.
500
+ *
501
+ * @category Email Actions
460
502
  */
461
503
  generateVerifyAndChangeEmailLink(email: string, newEmail: string, actionCodeSettings?: ActionCodeSettings): Promise<string>;
462
504
  /**
@@ -506,6 +548,8 @@ export declare class CloudFireAuth {
506
548
  * The Android package name and iOS bundle ID are respected only if they
507
549
  * are configured in the same Firebase Auth project.
508
550
  * @returns A promise that resolves with the generated link.
551
+ *
552
+ * @category Email Actions
509
553
  */
510
554
  generateSignInWithEmailLink(email: string, actionCodeSettings: ActionCodeSettings): Promise<string>;
511
555
  /**
@@ -519,6 +563,8 @@ export declare class CloudFireAuth {
519
563
  * @param options - The provider config filter to apply.
520
564
  * @returns A promise that resolves with the list of provider configs meeting the
521
565
  * filter requirements.
566
+ *
567
+ * @category Provider Configuration
522
568
  */
523
569
  listProviderConfigs(options: AuthProviderConfigFilter): Promise<ListProviderConfigResults>;
524
570
  /**
@@ -535,6 +581,8 @@ export declare class CloudFireAuth {
535
581
  * config to return.
536
582
  * @returns A promise that resolves
537
583
  * with the configuration corresponding to the provided ID.
584
+ *
585
+ * @category Provider Configuration
538
586
  */
539
587
  getProviderConfig(providerId: string): Promise<AuthProviderConfig>;
540
588
  /**
@@ -549,6 +597,8 @@ export declare class CloudFireAuth {
549
597
  * @param providerId - The provider ID corresponding to the provider
550
598
  * config to delete.
551
599
  * @returns A promise that resolves on completion.
600
+ *
601
+ * @category Provider Configuration
552
602
  */
553
603
  deleteProviderConfig(providerId: string): Promise<void>;
554
604
  /**
@@ -565,6 +615,8 @@ export declare class CloudFireAuth {
565
615
  * config to update.
566
616
  * @param updatedConfig - The updated configuration.
567
617
  * @returns A promise that resolves with the updated provider configuration.
618
+ *
619
+ * @category Provider Configuration
568
620
  */
569
621
  updateProviderConfig(providerId: string, updatedConfig: UpdateAuthProviderRequest): Promise<AuthProviderConfig>;
570
622
  /**
@@ -577,6 +629,8 @@ export declare class CloudFireAuth {
577
629
  *
578
630
  * @param config - The provider configuration to create.
579
631
  * @returns A promise that resolves with the created provider configuration.
632
+ *
633
+ * @category Provider Configuration
580
634
  */
581
635
  createProviderConfig(config: AuthProviderConfig): Promise<AuthProviderConfig>;
582
636
  /**
@@ -68,6 +68,8 @@ export class CloudFireAuth {
68
68
  *
69
69
  * @returns A promise fulfilled with a custom token for the
70
70
  * provided `uid` and payload.
71
+ *
72
+ * @category Authentication
71
73
  */
72
74
  async createCustomToken(uid, developerClaims) {
73
75
  const oauth2Token = await this.getOauth2AccessToken();
@@ -96,6 +98,8 @@ export class CloudFireAuth {
96
98
  * @returns A promise fulfilled with the
97
99
  * token's decoded claims if the ID token is valid; otherwise, a rejected
98
100
  * promise.
101
+ *
102
+ * @category Authentication
99
103
  */
100
104
  async verifyIdToken(idToken, checkRevoked) {
101
105
  const oauth2Token = await this.getOauth2AccessToken();
@@ -111,6 +115,8 @@ export class CloudFireAuth {
111
115
  *
112
116
  * @returns A promise fulfilled with the user
113
117
  * data corresponding to the provided `uid`.
118
+ *
119
+ * @category User Management
114
120
  */
115
121
  async getUser(uid) {
116
122
  const oauth2Token = await this.getOauth2AccessToken();
@@ -127,6 +133,8 @@ export class CloudFireAuth {
127
133
  *
128
134
  * @returns A promise fulfilled with the user
129
135
  * data corresponding to the provided email.
136
+ *
137
+ * @category User Management
130
138
  */
131
139
  async getUserByEmail(email) {
132
140
  return await getUserByEmailHandler(email);
@@ -143,6 +151,8 @@ export class CloudFireAuth {
143
151
  *
144
152
  * @returns A promise fulfilled with the user
145
153
  * data corresponding to the provided phone number.
154
+ *
155
+ * @category User Management
146
156
  */
147
157
  async getUserByPhoneNumber(phoneNumber) {
148
158
  return await getUserByPhoneNumberHandler(phoneNumber);
@@ -159,6 +169,8 @@ export class CloudFireAuth {
159
169
  *
160
170
  * @returns A promise fulfilled with the user data corresponding to the
161
171
  * given provider id.
172
+ *
173
+ * @category User Management
162
174
  */
163
175
  async getUserByProviderUid(providerId, uid) {
164
176
  return await getUserByProviderUidHandler(providerId, uid);
@@ -177,6 +189,8 @@ export class CloudFireAuth {
177
189
  * @returns A promise that resolves to the corresponding user records.
178
190
  * @throws FirebaseAuthError If any of the identifiers are invalid or if more than 100
179
191
  * identifiers are specified.
192
+ *
193
+ * @category User Management
180
194
  */
181
195
  async getUsers(identifiers) {
182
196
  return await getUsersHandler(identifiers);
@@ -195,6 +209,8 @@ export class CloudFireAuth {
195
209
  * users starting without any offset.
196
210
  * @returns A promise that resolves with
197
211
  * the current batch of downloaded users and the next page token.
212
+ *
213
+ * @category User Management
198
214
  */
199
215
  async listUsers(maxResults, pageToken) {
200
216
  return await listUsersHandler(maxResults, pageToken);
@@ -210,6 +226,8 @@ export class CloudFireAuth {
210
226
  *
211
227
  * @returns A promise fulfilled with the user
212
228
  * data corresponding to the newly created user.
229
+ *
230
+ * @category User Management
213
231
  */
214
232
  async createUser(properties) {
215
233
  return await createUserHandler(properties);
@@ -224,6 +242,8 @@ export class CloudFireAuth {
224
242
  *
225
243
  * @returns An empty promise fulfilled once the user has been
226
244
  * deleted.
245
+ *
246
+ * @category User Management
227
247
  */
228
248
  async deleteUser(uid) {
229
249
  const oauth2Token = await this.getOauth2AccessToken();
@@ -250,6 +270,8 @@ export class CloudFireAuth {
250
270
  * @returns A Promise that resolves to the total number of successful/failed
251
271
  * deletions, as well as the array of errors that corresponds to the
252
272
  * failed deletions.
273
+ *
274
+ * @category User Management
253
275
  */
254
276
  async deleteUsers(uids) {
255
277
  return await deleteUsersHandler(uids);
@@ -266,6 +288,8 @@ export class CloudFireAuth {
266
288
  *
267
289
  * @returns A promise fulfilled with the
268
290
  * updated user data.
291
+ *
292
+ * @category User Management
269
293
  */
270
294
  async updateUser(uid, properties) {
271
295
  const oauth2Token = await this.getOauth2AccessToken();
@@ -293,6 +317,8 @@ export class CloudFireAuth {
293
317
  * separate storage systems.
294
318
  * @returns A promise that resolves when the operation completes
295
319
  * successfully.
320
+ *
321
+ * @category Token Management
296
322
  */
297
323
  async setCustomUserClaims(uid, customUserClaims) {
298
324
  const oauth2Token = await this.getOauth2AccessToken();
@@ -308,7 +334,7 @@ export class CloudFireAuth {
308
334
  * While this will revoke all sessions for a specified user and disable any
309
335
  * new ID tokens for existing sessions from getting minted, existing ID tokens
310
336
  * may remain active until their natural expiration (one hour). To verify that
311
- * ID tokens are revoked, use {@link BaseAuth.verifyIdToken}
337
+ * ID tokens are revoked, use {@link CloudFireAuth.verifyIdToken}
312
338
  * where `checkRevoked` is set to true.
313
339
  *
314
340
  * @param uid - The `uid` corresponding to the user whose refresh tokens
@@ -316,6 +342,8 @@ export class CloudFireAuth {
316
342
  *
317
343
  * @returns An empty promise fulfilled once the user's refresh
318
344
  * tokens have been revoked.
345
+ *
346
+ * @category Token Management
319
347
  */
320
348
  async revokeRefreshTokens(uid) {
321
349
  const oauth2Token = await this.getOauth2AccessToken();
@@ -337,6 +365,8 @@ export class CloudFireAuth {
337
365
  * the operation completes with the result of the import. This includes the
338
366
  * number of successful imports, the number of failed imports and their
339
367
  * corresponding errors.
368
+ *
369
+ * @category User Management
340
370
  */
341
371
  async importUsers(users, options) {
342
372
  const oauth2Token = await this.getOauth2AccessToken();
@@ -358,6 +388,8 @@ export class CloudFireAuth {
358
388
  *
359
389
  * @returns A promise that resolves on success with the
360
390
  * created session cookie.
391
+ *
392
+ * @category Authentication
361
393
  */
362
394
  async createSessionCookie(idToken, sessionCookieOptions) {
363
395
  const oauth2Token = await this.getOauth2AccessToken();
@@ -379,7 +411,7 @@ export class CloudFireAuth {
379
411
  * for code samples and detailed documentation
380
412
  *
381
413
  * @param sessionCookie - The session cookie to verify.
382
- * @param checkForRevocation - Whether to check if the session cookie was
414
+ * @param checkRevoked - Whether to check if the session cookie was
383
415
  * revoked. This requires an extra request to the Firebase Auth backend to
384
416
  * check the `tokensValidAfterTime` time for the corresponding user.
385
417
  * When not specified, this additional check is not performed.
@@ -387,6 +419,8 @@ export class CloudFireAuth {
387
419
  * @returns A promise fulfilled with the
388
420
  * session cookie's decoded claims if the session cookie is valid; otherwise,
389
421
  * a rejected promise.
422
+ *
423
+ * @category Authentication
390
424
  */
391
425
  async verifySessionCookie(sessionCookie, checkRevoked) {
392
426
  return await verifySessionCookieHandler(sessionCookie, checkRevoked);
@@ -439,6 +473,8 @@ export class CloudFireAuth {
439
473
  * The Android package name and iOS bundle ID are respected only if they
440
474
  * are configured in the same Firebase Auth project.
441
475
  * @returns A promise that resolves with the generated link.
476
+ *
477
+ * @category Email Actions
442
478
  */
443
479
  async generatePasswordResetLink(email, actionCodeSettings) {
444
480
  const oauth2Token = await this.getOauth2AccessToken();
@@ -491,6 +527,8 @@ export class CloudFireAuth {
491
527
  * The Android package name and iOS bundle ID are respected only if they
492
528
  * are configured in the same Firebase Auth project.
493
529
  * @returns A promise that resolves with the generated link.
530
+ *
531
+ * @category Email Actions
494
532
  */
495
533
  async generateEmailVerificationLink(email, actionCodeSettings) {
496
534
  const oauth2Token = await this.getOauth2AccessToken();
@@ -519,6 +557,8 @@ export class CloudFireAuth {
519
557
  * The Android package name and iOS bundle ID are respected only if they
520
558
  * are configured in the same Firebase Auth project.
521
559
  * @returns A promise that resolves with the generated link.
560
+ *
561
+ * @category Email Actions
522
562
  */
523
563
  async generateVerifyAndChangeEmailLink(email, newEmail, actionCodeSettings) {
524
564
  const oauth2Token = await this.getOauth2AccessToken();
@@ -571,6 +611,8 @@ export class CloudFireAuth {
571
611
  * The Android package name and iOS bundle ID are respected only if they
572
612
  * are configured in the same Firebase Auth project.
573
613
  * @returns A promise that resolves with the generated link.
614
+ *
615
+ * @category Email Actions
574
616
  */
575
617
  async generateSignInWithEmailLink(email, actionCodeSettings) {
576
618
  const oauth2Token = await this.getOauth2AccessToken();
@@ -587,6 +629,8 @@ export class CloudFireAuth {
587
629
  * @param options - The provider config filter to apply.
588
630
  * @returns A promise that resolves with the list of provider configs meeting the
589
631
  * filter requirements.
632
+ *
633
+ * @category Provider Configuration
590
634
  */
591
635
  async listProviderConfigs(options) {
592
636
  const oauth2Token = await this.getOauth2AccessToken();
@@ -606,6 +650,8 @@ export class CloudFireAuth {
606
650
  * config to return.
607
651
  * @returns A promise that resolves
608
652
  * with the configuration corresponding to the provided ID.
653
+ *
654
+ * @category Provider Configuration
609
655
  */
610
656
  async getProviderConfig(providerId) {
611
657
  const oauth2Token = await this.getOauth2AccessToken();
@@ -623,6 +669,8 @@ export class CloudFireAuth {
623
669
  * @param providerId - The provider ID corresponding to the provider
624
670
  * config to delete.
625
671
  * @returns A promise that resolves on completion.
672
+ *
673
+ * @category Provider Configuration
626
674
  */
627
675
  async deleteProviderConfig(providerId) {
628
676
  const oauth2Token = await this.getOauth2AccessToken();
@@ -642,6 +690,8 @@ export class CloudFireAuth {
642
690
  * config to update.
643
691
  * @param updatedConfig - The updated configuration.
644
692
  * @returns A promise that resolves with the updated provider configuration.
693
+ *
694
+ * @category Provider Configuration
645
695
  */
646
696
  async updateProviderConfig(providerId, updatedConfig) {
647
697
  const oauth2Token = await this.getOauth2AccessToken();
@@ -657,6 +707,8 @@ export class CloudFireAuth {
657
707
  *
658
708
  * @param config - The provider configuration to create.
659
709
  * @returns A promise that resolves with the created provider configuration.
710
+ *
711
+ * @category Provider Configuration
660
712
  */
661
713
  async createProviderConfig(config) {
662
714
  const oauth2Token = await this.getOauth2AccessToken();
@@ -209,7 +209,7 @@ export interface CreateRequest extends UpdateRequest {
209
209
  /**
210
210
  * The response interface for listing provider configs. This is only available
211
211
  * when listing all identity providers' configurations via
212
- * {@link BaseAuth.listProviderConfigs}.
212
+ * {@link CloudFireAuth.listProviderConfigs}.
213
213
  */
214
214
  export interface ListProviderConfigResults {
215
215
  /**
@@ -224,7 +224,7 @@ export interface ListProviderConfigResults {
224
224
  /**
225
225
  * The filter interface used for listing provider configurations. This is used
226
226
  * when specifying how to list configured identity providers via
227
- * {@link BaseAuth.listProviderConfigs}.
227
+ * {@link CloudFireAuth.listProviderConfigs}.
228
228
  */
229
229
  export interface AuthProviderConfigFilter {
230
230
  /**
@@ -247,7 +247,7 @@ export interface AuthProviderConfigFilter {
247
247
  /**
248
248
  * The request interface for updating a SAML Auth provider. This is used
249
249
  * when updating a SAML provider's configuration via
250
- * {@link BaseAuth.updateProviderConfig}.
250
+ * {@link CloudFireAuth.updateProviderConfig}.
251
251
  */
252
252
  export interface SAMLUpdateAuthProviderRequest {
253
253
  /**
@@ -289,7 +289,7 @@ export interface SAMLUpdateAuthProviderRequest {
289
289
  /**
290
290
  * The request interface for updating an OIDC Auth provider. This is used
291
291
  * when updating an OIDC provider's configuration via
292
- * {@link BaseAuth.updateProviderConfig}.
292
+ * {@link CloudFireAuth.updateProviderConfig}.
293
293
  */
294
294
  export interface OIDCUpdateAuthProviderRequest {
295
295
  /**
@@ -489,7 +489,7 @@ export interface BaseAuthProviderConfig {
489
489
  * The
490
490
  * [SAML](http://docs.oasis-open.org/security/saml/Post2.0/sstc-saml-tech-overview-2.0.html)
491
491
  * Auth provider configuration interface. A SAML provider can be created via
492
- * {@link BaseAuth.createProviderConfig}.
492
+ * {@link CloudFireAuth.createProviderConfig}.
493
493
  */
494
494
  export interface SAMLAuthProviderConfig extends BaseAuthProviderConfig {
495
495
  /**
@@ -547,7 +547,7 @@ export interface OAuthResponseType {
547
547
  /**
548
548
  * The [OIDC](https://openid.net/specs/openid-connect-core-1_0-final.html) Auth
549
549
  * provider configuration interface. An OIDC provider can be created via
550
- * {@link BaseAuth.createProviderConfig}.
550
+ * {@link CloudFireAuth.createProviderConfig}.
551
551
  */
552
552
  export interface OIDCAuthProviderConfig extends BaseAuthProviderConfig {
553
553
  /**
@@ -585,7 +585,7 @@ export interface OIDCAuthProviderConfig extends BaseAuthProviderConfig {
585
585
  }
586
586
  /**
587
587
  * The Auth provider configuration type.
588
- * {@link BaseAuth.createProviderConfig}.
588
+ * {@link CloudFireAuth.createProviderConfig}.
589
589
  */
590
590
  export type AuthProviderConfig = SAMLAuthProviderConfig | OIDCAuthProviderConfig;
591
591
  /**
@@ -23,7 +23,7 @@
23
23
  /**
24
24
  * Used for looking up an account by uid.
25
25
  *
26
- * See {@link BaseAuth.getUsers}.
26
+ * See {@link CloudFireAuth.getUsers}.
27
27
  */
28
28
  export interface UidIdentifier {
29
29
  uid: string;
@@ -31,7 +31,7 @@ export interface UidIdentifier {
31
31
  /**
32
32
  * Used for looking up an account by email.
33
33
  *
34
- * See {@link BaseAuth.getUsers}.
34
+ * See {@link CloudFireAuth.getUsers}.
35
35
  */
36
36
  export interface EmailIdentifier {
37
37
  email: string;
@@ -39,7 +39,7 @@ export interface EmailIdentifier {
39
39
  /**
40
40
  * Used for looking up an account by phone number.
41
41
  *
42
- * See {@link BaseAuth.getUsers}.
42
+ * See {@link CloudFireAuth.getUsers}.
43
43
  */
44
44
  export interface PhoneIdentifier {
45
45
  phoneNumber: string;
@@ -47,7 +47,7 @@ export interface PhoneIdentifier {
47
47
  /**
48
48
  * Used for looking up an account by federated provider.
49
49
  *
50
- * See {@link BaseAuth.getUsers}.
50
+ * See {@link CloudFireAuth.getUsers}.
51
51
  */
52
52
  export interface ProviderIdentifier {
53
53
  providerId: string;
@@ -23,11 +23,13 @@
23
23
  */
24
24
  import type { DecodedIdToken } from "./token-verifier.js";
25
25
  import type { UserRecord } from "./user-record.js";
26
- import type { CreateRequest, UpdateRequest, AuthProviderConfig, UpdateAuthProviderRequest, AuthProviderConfigFilter, ListProviderConfigResults } from "./auth-config.js";
27
- import type { UserIdentifier } from "./identifier.js";
26
+ import type { UserMetadata, MultiFactorSettings, UserInfo, MultiFactorInfo } from "./user-record.js";
27
+ import type { CreateRequest, UpdateRequest, AuthProviderConfig, UpdateAuthProviderRequest, AuthProviderConfigFilter, ListProviderConfigResults, SAMLAuthProviderConfig, OIDCAuthProviderConfig, SAMLUpdateAuthProviderRequest, OIDCUpdateAuthProviderRequest, MultiFactorCreateSettings, MultiFactorUpdateSettings, UserProvider, CreatePhoneMultiFactorInfoRequest, UpdatePhoneMultiFactorInfoRequest, OAuthResponseType } from "./auth-config.js";
28
+ import type { UserIdentifier, UidIdentifier, EmailIdentifier, PhoneIdentifier, ProviderIdentifier } from "./identifier.js";
28
29
  import type { ActionCodeSettings } from "./action-code-settings.js";
29
30
  import type { UserImportRecord, UserImportOptions, UserImportResult, HashAlgorithmType, UserMetadataRequest, UserProviderRequest } from "./user-import.js";
30
- export type { DecodedIdToken, UserRecord, CreateRequest, UpdateRequest, UserIdentifier, AuthProviderConfig, UpdateAuthProviderRequest, AuthProviderConfigFilter, ListProviderConfigResults, ActionCodeSettings, UserImportRecord, UserImportOptions, UserImportResult, HashAlgorithmType, UserMetadataRequest, UserProviderRequest, };
31
+ export type { DecodedIdToken, UserRecord, CreateRequest, UpdateRequest, UserIdentifier, UidIdentifier, EmailIdentifier, PhoneIdentifier, ProviderIdentifier, AuthProviderConfig, SAMLAuthProviderConfig, OIDCAuthProviderConfig, UpdateAuthProviderRequest, SAMLUpdateAuthProviderRequest, OIDCUpdateAuthProviderRequest, AuthProviderConfigFilter, ListProviderConfigResults, ActionCodeSettings, UserImportRecord, UserImportOptions, UserImportResult, HashAlgorithmType, UserMetadataRequest, UserProviderRequest, MultiFactorCreateSettings, MultiFactorUpdateSettings, UserProvider, CreatePhoneMultiFactorInfoRequest, UpdatePhoneMultiFactorInfoRequest, OAuthResponseType, };
32
+ export type { UserMetadata, MultiFactorSettings, UserInfo, MultiFactorInfo };
31
33
  /**
32
34
  * `FirebaseError` is a subclass of the standard JavaScript `Error` object. In
33
35
  * addition to a message string and stack trace, it contains a string code.
@@ -100,7 +102,7 @@ export interface FirebaseArrayIndexError {
100
102
  */
101
103
  error: FirebaseError;
102
104
  }
103
- /** Represents the result of the {@link BaseAuth.getUsers} API. */
105
+ /** Represents the result of the {@link CloudFireAuth.getUsers} API. */
104
106
  export interface GetUsersResult {
105
107
  /**
106
108
  * Set of user records, corresponding to the set of users that were
@@ -113,7 +115,7 @@ export interface GetUsersResult {
113
115
  }
114
116
  /**
115
117
  * Interface representing the object returned from a
116
- * {@link BaseAuth.listUsers} operation. Contains the list
118
+ * {@link CloudFireAuth.listUsers} operation. Contains the list
117
119
  * of users for the current batch and the next page token if available.
118
120
  */
119
121
  export interface ListUsersResult {
@@ -128,7 +130,7 @@ export interface ListUsersResult {
128
130
  pageToken?: string;
129
131
  }
130
132
  /**
131
- * Represents the result of the {@link BaseAuth.deleteUsers}.
133
+ * Represents the result of the {@link CloudFireAuth.deleteUsers}.
132
134
  * API.
133
135
  */
134
136
  export interface DeleteUsersResult {
@@ -151,7 +153,7 @@ export interface DeleteUsersResult {
151
153
  }
152
154
  /**
153
155
  * Interface representing the session cookie options needed for the
154
- * {@link BaseAuth.createSessionCookie} method.
156
+ * {@link CloudFireAuth.createSessionCookie} method.
155
157
  */
156
158
  export interface SessionCookieOptions {
157
159
  /**
@@ -22,7 +22,7 @@
22
22
  */
23
23
  /**
24
24
  * Interface representing a decoded Firebase ID token, returned from the
25
- * {@link BaseAuth.verifyIdToken} method.
25
+ * {@link CloudFireAuth.verifyIdToken} method.
26
26
  *
27
27
  * Firebase ID tokens are OpenID Connect spec-compliant JSON Web Tokens (JWTs).
28
28
  * See the
@@ -36,7 +36,7 @@ import type { MultiFactorUpdateSettings } from "./auth-config.js";
36
36
  export type HashAlgorithmType = "SCRYPT" | "STANDARD_SCRYPT" | "HMAC_SHA512" | "HMAC_SHA256" | "HMAC_SHA1" | "HMAC_MD5" | "MD5" | "PBKDF_SHA1" | "BCRYPT" | "PBKDF2_SHA256" | "SHA512" | "SHA256" | "SHA1";
37
37
  /**
38
38
  * Interface representing the user import options needed for
39
- * {@link BaseAuth.importUsers} method. This is used to
39
+ * {@link CloudFireAuth.importUsers} method. This is used to
40
40
  * provide the password hashing algorithm information.
41
41
  */
42
42
  export interface UserImportOptions {
@@ -135,7 +135,7 @@ export interface UserProviderRequest {
135
135
  }
136
136
  /**
137
137
  * Interface representing a user to import to Firebase Auth via the
138
- * {@link BaseAuth.importUsers} method.
138
+ * {@link CloudFireAuth.importUsers} method.
139
139
  */
140
140
  export interface UserImportRecord {
141
141
  /**
@@ -207,7 +207,7 @@ export interface UserImportRecord {
207
207
  multiFactor?: MultiFactorUpdateSettings;
208
208
  }
209
209
  /**
210
- * Interface representing the result of the {@link BaseAuth.importUsers} API.
210
+ * Interface representing the result of the {@link CloudFireAuth.importUsers} API.
211
211
  */
212
212
  export interface UserImportResult {
213
213
  /**
@@ -251,7 +251,7 @@ export declare class UserRecord {
251
251
  * when uploading this user, as is typical when migrating from another Auth
252
252
  * system, this will be an empty string. If no password is set, this is
253
253
  * null. This is only available when the user is obtained from
254
- * {@link BaseAuth.listUsers}.
254
+ * {@link CloudFireAuth.listUsers}.
255
255
  */
256
256
  readonly passwordHash?: string;
257
257
  /**
@@ -259,13 +259,13 @@ export declare class UserRecord {
259
259
  * algorithm (SCRYPT) is used. If a different hashing algorithm had been used to
260
260
  * upload this user, typical when migrating from another Auth system, this will
261
261
  * be an empty string. If no password is set, this is null. This is only
262
- * available when the user is obtained from {@link BaseAuth.listUsers}.
262
+ * available when the user is obtained from {@link CloudFireAuth.listUsers}.
263
263
  */
264
264
  readonly passwordSalt?: string;
265
265
  /**
266
266
  * The user's custom claims object if available, typically used to define
267
267
  * user roles and propagated to an authenticated user's ID token.
268
- * This is set via {@link BaseAuth.setCustomUserClaims}
268
+ * This is set via {@link CloudFireAuth.setCustomUserClaims}
269
269
  */
270
270
  readonly customClaims?: {
271
271
  [key: string]: any;
@@ -277,7 +277,7 @@ export declare class UserRecord {
277
277
  /**
278
278
  * The date the user's tokens are valid after, formatted as a UTC string.
279
279
  * This is updated every time the user's refresh token are revoked either
280
- * from the {@link BaseAuth.revokeRefreshTokens}
280
+ * from the {@link CloudFireAuth.revokeRefreshTokens}
281
281
  * API or from the Firebase Auth backend on big account changes (password
282
282
  * resets, password or email updates, etc).
283
283
  */
@@ -1,4 +1,4 @@
1
- interface ProviderUserInfo {
1
+ export interface ProviderUserInfo {
2
2
  providerId: string;
3
3
  displayName?: string;
4
4
  photoUrl?: string;
@@ -22,4 +22,3 @@ export interface SetAccountInfoResponse {
22
22
  passwordHash: string;
23
23
  emailVerified: boolean;
24
24
  }
25
- export {};
package/dist/types.d.ts CHANGED
@@ -1,6 +1,3 @@
1
- import type { DecodedIdToken, UserRecord, UserIdentifier, GetUsersResult, ListUsersResult, CreateRequest, UpdateRequest, DeleteUsersResult, SessionCookieOptions, AuthProviderConfig, UpdateAuthProviderRequest, AuthProviderConfigFilter, ListProviderConfigResults, ActionCodeSettings, UserImportRecord, UserImportOptions, UserImportResult, HashAlgorithmType, UserMetadataRequest, UserProviderRequest } from "./types/firebase-admin/index.js";
2
- import type { ServiceAccountKey } from "./types/service-account-key.js";
3
- import type { SetAccountInfoResponse } from "./types/google-auth.js";
4
- export type { DecodedIdToken, UserRecord, UserIdentifier, GetUsersResult, ListUsersResult, CreateRequest, UpdateRequest, DeleteUsersResult, SessionCookieOptions, AuthProviderConfig, UpdateAuthProviderRequest, AuthProviderConfigFilter, ListProviderConfigResults, ActionCodeSettings, UserImportRecord, UserImportOptions, UserImportResult, HashAlgorithmType, UserMetadataRequest, UserProviderRequest, };
5
- export type { ServiceAccountKey };
6
- export type { SetAccountInfoResponse };
1
+ export type { DecodedIdToken, UserRecord, UserIdentifier, GetUsersResult, ListUsersResult, CreateRequest, UpdateRequest, DeleteUsersResult, SessionCookieOptions, AuthProviderConfig, UpdateAuthProviderRequest, AuthProviderConfigFilter, ListProviderConfigResults, ActionCodeSettings, UserImportRecord, UserImportOptions, UserImportResult, HashAlgorithmType, UserMetadataRequest, UserProviderRequest, SAMLAuthProviderConfig, OIDCAuthProviderConfig, SAMLUpdateAuthProviderRequest, OIDCUpdateAuthProviderRequest, MultiFactorCreateSettings, MultiFactorUpdateSettings, MultiFactorSettings, UserMetadata, UserInfo, UserProvider, FirebaseArrayIndexError, FirebaseError, UidIdentifier, EmailIdentifier, PhoneIdentifier, ProviderIdentifier, CreatePhoneMultiFactorInfoRequest, UpdatePhoneMultiFactorInfoRequest, OAuthResponseType, MultiFactorInfo, } from "./types/firebase-admin/index.js";
2
+ export type { ServiceAccountKey } from "./types/service-account-key.js";
3
+ export type { SetAccountInfoResponse, ProviderUserInfo } from "./types/google-auth.js";
package/package.json CHANGED
@@ -1,13 +1,20 @@
1
1
  {
2
2
  "name": "cloudfire-auth",
3
- "version": "0.3.3",
3
+ "version": "0.4.0",
4
4
  "author": "Connor Skelland",
5
5
  "license": "MIT",
6
6
  "engines": {
7
7
  "node": ">=18.0.0"
8
8
  },
9
9
  "description": "Firebase Auth in Cloudflare Workers.",
10
- "homepage": "https://github.com/connor56/cloudfire-auth",
10
+ "homepage": "https://connor56.github.io/cloudfire-auth/",
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git+https://github.com/Connor56/cloudfire-auth.git"
14
+ },
15
+ "bugs": {
16
+ "url": "https://github.com/Connor56/cloudfire-auth/issues"
17
+ },
11
18
  "keywords": [
12
19
  "firebase",
13
20
  "auth",
@@ -27,10 +34,11 @@
27
34
  },
28
35
  "scripts": {
29
36
  "test": "vitest run",
30
- "test:integration": "RUN_INTEGRATION_TESTS=true vitest run",
37
+ "test:integration": "npx tsx scripts/test-integration.ts",
31
38
  "build": "tsc",
32
39
  "clean": "tsx scripts/publishing/remove-dist.ts",
33
40
  "build:watch": "tsc --watch",
41
+ "docs:build": "npx tsx scripts/docs/build-docs.ts",
34
42
  "prepublishOnly": "npm run test && npm run clean && npm run build"
35
43
  },
36
44
  "devDependencies": {
@@ -1,6 +0,0 @@
1
- export { deleteUserHandler } from "./delete-user.js";
2
- export { getUserHandler } from "./get-user.js";
3
- export { updateUserHandler } from "./update-user.js";
4
- export { setCustomUserClaimsHandler, checkClaimsAreValid } from "./set-custom-user-claims.js";
5
- export { revokeRefreshTokensHandler } from "./revoke-refresh-tokens.js";
6
- export { verifyIdTokenHandler, validateJwtHeader } from "./verify-id-token.js";
@@ -1,6 +0,0 @@
1
- export { deleteUserHandler } from "./delete-user.js";
2
- export { getUserHandler } from "./get-user.js";
3
- export { updateUserHandler } from "./update-user.js";
4
- export { setCustomUserClaimsHandler, checkClaimsAreValid } from "./set-custom-user-claims.js";
5
- export { revokeRefreshTokensHandler } from "./revoke-refresh-tokens.js";
6
- export { verifyIdTokenHandler, validateJwtHeader } from "./verify-id-token.js";