firebase-admin 9.3.0 → 9.5.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.
Files changed (82) hide show
  1. package/lib/auth/action-code-settings-builder.js +1 -1
  2. package/lib/auth/auth-api-request.js +98 -25
  3. package/lib/auth/auth-config.js +15 -15
  4. package/lib/auth/auth.js +82 -61
  5. package/lib/auth/identifier.js +3 -2
  6. package/lib/auth/index.d.ts +1868 -0
  7. package/lib/{credential/credential-interfaces.js → auth/index.js} +1 -1
  8. package/lib/auth/tenant-manager.js +1 -1
  9. package/lib/auth/tenant.js +7 -1
  10. package/lib/auth/token-generator.js +6 -4
  11. package/lib/auth/token-verifier.js +32 -36
  12. package/lib/auth/user-import-builder.js +18 -15
  13. package/lib/auth/user-record.js +4 -4
  14. package/lib/credential/credential-internal.js +1 -2
  15. package/lib/credential/credential.js +8 -122
  16. package/lib/credential/index.d.ts +169 -0
  17. package/lib/credential/index.js +5 -17
  18. package/lib/database/database-internal.js +19 -26
  19. package/lib/database/index.d.ts +89 -0
  20. package/lib/database/index.js +12 -28
  21. package/lib/default-namespace.js +2 -1
  22. package/lib/firebase-app.js +26 -48
  23. package/lib/firebase-namespace-api.d.ts +238 -0
  24. package/lib/{firebase-service.js → firebase-namespace-api.js} +2 -2
  25. package/lib/{database/database.js → firebase-namespace.d.ts} +14 -7
  26. package/lib/firebase-namespace.js +22 -92
  27. package/lib/firestore/firestore-internal.js +2 -19
  28. package/lib/firestore/index.d.ts +50 -0
  29. package/lib/firestore/index.js +28 -43
  30. package/lib/index.d.ts +3 -932
  31. package/lib/index.js +2 -1
  32. package/lib/instance-id/index.d.ts +81 -0
  33. package/lib/instance-id/index.js +1 -10
  34. package/lib/instance-id/instance-id-request-internal.js +2 -1
  35. package/lib/instance-id/instance-id.js +1 -19
  36. package/lib/machine-learning/index.d.ts +249 -0
  37. package/lib/{messaging/messaging-types.js → machine-learning/index.js} +2 -2
  38. package/lib/machine-learning/machine-learning-api-client.js +1 -1
  39. package/lib/machine-learning/machine-learning-utils.js +1 -1
  40. package/lib/machine-learning/machine-learning.js +3 -22
  41. package/lib/messaging/batch-request-internal.js +1 -1
  42. package/lib/messaging/index.d.ts +1174 -0
  43. package/lib/messaging/index.js +1 -24
  44. package/lib/messaging/messaging-api-request-internal.js +2 -1
  45. package/lib/messaging/messaging-errors-internal.js +1 -1
  46. package/lib/messaging/messaging-internal.js +1 -1
  47. package/lib/messaging/messaging.js +21 -25
  48. package/lib/project-management/android-app.js +7 -6
  49. package/lib/project-management/index.d.ts +363 -0
  50. package/lib/project-management/index.js +23 -25
  51. package/lib/project-management/ios-app.js +5 -4
  52. package/lib/project-management/project-management-api-request-internal.js +5 -5
  53. package/lib/project-management/project-management.js +9 -26
  54. package/lib/remote-config/index.d.ts +359 -0
  55. package/lib/remote-config/index.js +1 -26
  56. package/lib/remote-config/remote-config-api-client-internal.js +3 -3
  57. package/lib/remote-config/remote-config.js +15 -32
  58. package/lib/security-rules/index.d.ts +216 -0
  59. package/lib/security-rules/index.js +1 -24
  60. package/lib/security-rules/security-rules-api-client-internal.js +1 -1
  61. package/lib/security-rules/security-rules-internal.js +1 -1
  62. package/lib/security-rules/security-rules.js +6 -15
  63. package/lib/storage/index.d.ts +60 -0
  64. package/lib/storage/index.js +1 -10
  65. package/lib/storage/storage.js +2 -19
  66. package/lib/utils/api-request.js +10 -3
  67. package/lib/utils/deep-copy.js +2 -1
  68. package/lib/utils/error.js +2 -1
  69. package/lib/utils/index.js +6 -5
  70. package/lib/utils/validator.js +2 -1
  71. package/package.json +15 -12
  72. package/lib/auth.d.ts +0 -2016
  73. package/lib/credential.d.ts +0 -150
  74. package/lib/database.d.ts +0 -1663
  75. package/lib/instance-id.d.ts +0 -37
  76. package/lib/messaging.d.ts +0 -1341
  77. package/lib/project-management/app-metadata.js +0 -37
  78. package/lib/project-management.d.ts +0 -361
  79. package/lib/remote-config/remote-config-api-client.js +0 -36
  80. package/lib/remote-config.d.ts +0 -350
  81. package/lib/security-rules.d.ts +0 -192
  82. package/lib/storage.d.ts +0 -40
package/lib/auth.d.ts DELETED
@@ -1,2016 +0,0 @@
1
- /*! firebase-admin v9.3.0 */
2
- import * as _admin from './index.d';
3
-
4
- /* eslint-disable @typescript-eslint/ban-types */
5
-
6
- export namespace admin.auth {
7
-
8
- /**
9
- * Interface representing a user's metadata.
10
- */
11
- interface UserMetadata {
12
-
13
- /**
14
- * The date the user last signed in, formatted as a UTC string.
15
- */
16
- lastSignInTime: string;
17
-
18
- /**
19
- * The date the user was created, formatted as a UTC string.
20
- */
21
- creationTime: string;
22
-
23
- /**
24
- * The time at which the user was last active (ID token refreshed),
25
- * formatted as a UTC Date string (eg 'Sat, 03 Feb 2001 04:05:06 GMT').
26
- * Returns null if the user was never active.
27
- */
28
- lastRefreshTime?: string|null;
29
-
30
- /**
31
- * @return A JSON-serializable representation of this object.
32
- */
33
- toJSON(): Object;
34
- }
35
-
36
- /**
37
- * Interface representing a user's info from a third-party identity provider
38
- * such as Google or Facebook.
39
- */
40
- interface UserInfo {
41
-
42
- /**
43
- * The user identifier for the linked provider.
44
- */
45
- uid: string;
46
-
47
- /**
48
- * The display name for the linked provider.
49
- */
50
- displayName: string;
51
-
52
- /**
53
- * The email for the linked provider.
54
- */
55
- email: string;
56
-
57
- /**
58
- * The phone number for the linked provider.
59
- */
60
- phoneNumber: string;
61
-
62
- /**
63
- * The photo URL for the linked provider.
64
- */
65
- photoURL: string;
66
-
67
- /**
68
- * The linked provider ID (for example, "google.com" for the Google provider).
69
- */
70
- providerId: string;
71
-
72
- /**
73
- * @return A JSON-serializable representation of this object.
74
- */
75
- toJSON(): Object;
76
- }
77
-
78
- /**
79
- * Interface representing the common properties of a user enrolled second factor.
80
- */
81
- interface MultiFactorInfo {
82
-
83
- /**
84
- * The ID of the enrolled second factor. This ID is unique to the user.
85
- */
86
- uid: string;
87
-
88
- /**
89
- * The optional display name of the enrolled second factor.
90
- */
91
- displayName?: string;
92
-
93
- /**
94
- * The optional date the second factor was enrolled, formatted as a UTC string.
95
- */
96
- enrollmentTime?: string;
97
-
98
- /**
99
- * The type identifier of the second factor. For SMS second factors, this is `phone`.
100
- */
101
- factorId: string;
102
-
103
- /**
104
- * @return A JSON-serializable representation of this object.
105
- */
106
- toJSON(): Object;
107
- }
108
-
109
- /**
110
- * Interface representing a phone specific user enrolled second factor.
111
- */
112
- interface PhoneMultiFactorInfo extends MultiFactorInfo {
113
-
114
- /**
115
- * The phone number associated with a phone second factor.
116
- */
117
- phoneNumber: string;
118
- }
119
-
120
- /**
121
- * Interface representing a user.
122
- */
123
- interface UserRecord {
124
-
125
- /**
126
- * The user's `uid`.
127
- */
128
- uid: string;
129
-
130
- /**
131
- * The user's primary email, if set.
132
- */
133
- email?: string;
134
-
135
- /**
136
- * Whether or not the user's primary email is verified.
137
- */
138
- emailVerified: boolean;
139
-
140
- /**
141
- * The user's display name.
142
- */
143
- displayName?: string;
144
-
145
- /**
146
- * The user's primary phone number, if set.
147
- */
148
- phoneNumber?: string;
149
-
150
- /**
151
- * The user's photo URL.
152
- */
153
- photoURL?: string;
154
-
155
- /**
156
- * Whether or not the user is disabled: `true` for disabled; `false` for
157
- * enabled.
158
- */
159
- disabled: boolean;
160
-
161
- /**
162
- * Additional metadata about the user.
163
- */
164
- metadata: admin.auth.UserMetadata;
165
-
166
- /**
167
- * An array of providers (for example, Google, Facebook) linked to the user.
168
- */
169
- providerData: admin.auth.UserInfo[];
170
-
171
- /**
172
- * The user's hashed password (base64-encoded), only if Firebase Auth hashing
173
- * algorithm (SCRYPT) is used. If a different hashing algorithm had been used
174
- * when uploading this user, as is typical when migrating from another Auth
175
- * system, this will be an empty string. If no password is set, this is
176
- * null. This is only available when the user is obtained from
177
- * {@link https://firebase.google.com/docs/reference/admin/node/admin.auth.Auth#listUsers `listUsers()`}.
178
- *
179
- */
180
- passwordHash?: string;
181
-
182
- /**
183
- * The user's password salt (base64-encoded), only if Firebase Auth hashing
184
- * algorithm (SCRYPT) is used. If a different hashing algorithm had been used to
185
- * upload this user, typical when migrating from another Auth system, this will
186
- * be an empty string. If no password is set, this is null. This is only
187
- * available when the user is obtained from
188
- * {@link https://firebase.google.com/docs/reference/admin/node/admin.auth.Auth#listUsers `listUsers()`}.
189
- *
190
- */
191
- passwordSalt?: string;
192
-
193
- /**
194
- * The user's custom claims object if available, typically used to define
195
- * user roles and propagated to an authenticated user's ID token.
196
- * This is set via
197
- * {@link https://firebase.google.com/docs/reference/admin/node/admin.auth.Auth#setCustomUserClaims `setCustomUserClaims()`}
198
- */
199
- customClaims?: {[key: string]: any};
200
-
201
- /**
202
- * The date the user's tokens are valid after, formatted as a UTC string.
203
- * This is updated every time the user's refresh token are revoked either
204
- * from the {@link https://firebase.google.com/docs/reference/admin/node/admin.auth.Auth#revokeRefreshTokens `revokeRefreshTokens()`}
205
- * API or from the Firebase Auth backend on big account changes (password
206
- * resets, password or email updates, etc).
207
- */
208
- tokensValidAfterTime?: string;
209
-
210
- /**
211
- * The ID of the tenant the user belongs to, if available.
212
- */
213
- tenantId?: string | null;
214
-
215
- /**
216
- * The multi-factor related properties for the current user, if available.
217
- */
218
- multiFactor?: admin.auth.MultiFactorSettings;
219
-
220
- /**
221
- * @return A JSON-serializable representation of this object.
222
- */
223
- toJSON(): Object;
224
- }
225
-
226
- /**
227
- * The multi-factor related user settings.
228
- */
229
- interface MultiFactorSettings {
230
- /**
231
- * List of second factors enrolled with the current user.
232
- * Currently only phone second factors are supported.
233
- */
234
- enrolledFactors: admin.auth.MultiFactorInfo[];
235
-
236
- /**
237
- * @return A JSON-serializable representation of this multi-factor object.
238
- */
239
- toJSON(): Object;
240
- }
241
-
242
- /**
243
- * The multi-factor related user settings for create operations.
244
- */
245
- interface MultiFactorCreateSettings {
246
-
247
- /**
248
- * The created user's list of enrolled second factors.
249
- */
250
- enrolledFactors: admin.auth.CreateMultiFactorInfoRequest[];
251
- }
252
-
253
- /**
254
- * The multi-factor related user settings for update operations.
255
- */
256
- interface MultiFactorUpdateSettings {
257
-
258
- /**
259
- * The updated list of enrolled second factors. The provided list overwrites the user's
260
- * existing list of second factors.
261
- * When null is passed, all of the user's existing second factors are removed.
262
- */
263
- enrolledFactors: admin.auth.UpdateMultiFactorInfoRequest[] | null;
264
- }
265
-
266
- /**
267
- * Interface representing common properties of a user enrolled second factor
268
- * for an `UpdateRequest`.
269
- */
270
- interface UpdateMultiFactorInfoRequest {
271
-
272
- /**
273
- * The ID of the enrolled second factor. This ID is unique to the user. When not provided,
274
- * a new one is provisioned by the Auth server.
275
- */
276
- uid?: string;
277
-
278
- /**
279
- * The optional display name for an enrolled second factor.
280
- */
281
- displayName?: string;
282
-
283
- /**
284
- * The optional date the second factor was enrolled, formatted as a UTC string.
285
- */
286
- enrollmentTime?: string;
287
-
288
- /**
289
- * The type identifier of the second factor. For SMS second factors, this is `phone`.
290
- */
291
- factorId: string;
292
- }
293
-
294
- /**
295
- * Interface representing a phone specific user enrolled second factor
296
- * for an `UpdateRequest`.
297
- */
298
- interface UpdatePhoneMultiFactorInfoRequest extends UpdateMultiFactorInfoRequest {
299
-
300
- /**
301
- * The phone number associated with a phone second factor.
302
- */
303
- phoneNumber: string;
304
- }
305
-
306
- /**
307
- * Interface representing the properties to update on the provided user.
308
- */
309
- interface UpdateRequest {
310
-
311
- /**
312
- * Whether or not the user is disabled: `true` for disabled;
313
- * `false` for enabled.
314
- */
315
- disabled?: boolean;
316
-
317
- /**
318
- * The user's display name.
319
- */
320
- displayName?: string | null;
321
-
322
- /**
323
- * The user's primary email.
324
- */
325
- email?: string;
326
-
327
- /**
328
- * Whether or not the user's primary email is verified.
329
- */
330
- emailVerified?: boolean;
331
-
332
- /**
333
- * The user's unhashed password.
334
- */
335
- password?: string;
336
-
337
- /**
338
- * The user's primary phone number.
339
- */
340
- phoneNumber?: string | null;
341
-
342
- /**
343
- * The user's photo URL.
344
- */
345
- photoURL?: string | null;
346
-
347
- /**
348
- * The user's updated multi-factor related properties.
349
- */
350
- multiFactor?: admin.auth.MultiFactorUpdateSettings;
351
- }
352
-
353
- /**
354
- * Interface representing base properties of a user enrolled second factor for a
355
- * `CreateRequest`.
356
- */
357
- interface CreateMultiFactorInfoRequest {
358
-
359
- /**
360
- * The optional display name for an enrolled second factor.
361
- */
362
- displayName?: string;
363
-
364
- /**
365
- * The type identifier of the second factor. For SMS second factors, this is `phone`.
366
- */
367
- factorId: string;
368
- }
369
-
370
- /**
371
- * Interface representing a phone specific user enrolled second factor for a
372
- * `CreateRequest`.
373
- */
374
- interface CreatePhoneMultiFactorInfoRequest extends CreateMultiFactorInfoRequest {
375
-
376
- /**
377
- * The phone number associated with a phone second factor.
378
- */
379
- phoneNumber: string;
380
- }
381
-
382
- /**
383
- * Interface representing the properties to set on a new user record to be
384
- * created.
385
- */
386
- interface CreateRequest extends UpdateRequest {
387
-
388
- /**
389
- * The user's `uid`.
390
- */
391
- uid?: string;
392
-
393
- /**
394
- * The user's multi-factor related properties.
395
- */
396
- multiFactor?: admin.auth.MultiFactorCreateSettings;
397
- }
398
-
399
- /**
400
- * Interface representing a decoded Firebase ID token, returned from the
401
- * {@link https://firebase.google.com/docs/reference/admin/node/admin.auth.Auth#verifyidtoken `verifyIdToken()`} method.
402
- *
403
- * Firebase ID tokens are OpenID Connect spec-compliant JSON Web Tokens (JWTs).
404
- * See the
405
- * [ID Token section of the OpenID Connect spec](http://openid.net/specs/openid-connect-core-1_0.html#IDToken)
406
- * for more information about the specific properties below.
407
- */
408
- interface DecodedIdToken {
409
-
410
- /**
411
- * The audience for which this token is intended.
412
- *
413
- * This value is a string equal to your Firebase project ID, the unique
414
- * identifier for your Firebase project, which can be found in [your project's
415
- * settings](https://console.firebase.google.com/project/_/settings/general/android:com.random.android).
416
- */
417
- aud: string;
418
-
419
- /**
420
- * Time, in seconds since the Unix epoch, when the end-user authentication
421
- * occurred.
422
- *
423
- * This value is not set when this particular ID token was created, but when the
424
- * user initially logged in to this session. In a single session, the Firebase
425
- * SDKs will refresh a user's ID tokens every hour. Each ID token will have a
426
- * different [`iat`](#iat) value, but the same `auth_time` value.
427
- */
428
- auth_time: number;
429
-
430
- /**
431
- * The email of the user to whom the ID token belongs, if available.
432
- */
433
- email?: string;
434
-
435
- /**
436
- * Whether or not the email of the user to whom the ID token belongs is
437
- * verified, provided the user has an email.
438
- */
439
- email_verified?: boolean;
440
-
441
- /**
442
- * The ID token's expiration time, in seconds since the Unix epoch. That is, the
443
- * time at which this ID token expires and should no longer be considered valid.
444
- *
445
- * The Firebase SDKs transparently refresh ID tokens every hour, issuing a new
446
- * ID token with up to a one hour expiration.
447
- */
448
- exp: number;
449
-
450
- /**
451
- * Information about the sign in event, including which sign in provider was
452
- * used and provider-specific identity details.
453
- *
454
- * This data is provided by the Firebase Authentication service and is a
455
- * reserved claim in the ID token.
456
- */
457
- firebase: {
458
-
459
- /**
460
- * Provider-specific identity details corresponding
461
- * to the provider used to sign in the user.
462
- */
463
- identities: {
464
- [key: string]: any;
465
- };
466
-
467
- /**
468
- * The ID of the provider used to sign in the user.
469
- * One of `"anonymous"`, `"password"`, `"facebook.com"`, `"github.com"`,
470
- * `"google.com"`, `"twitter.com"`, or `"custom"`.
471
- */
472
- sign_in_provider: string;
473
-
474
- /**
475
- * The type identifier or `factorId` of the second factor, provided the
476
- * ID token was obtained from a multi-factor authenticated user.
477
- * For phone, this is `"phone"`.
478
- */
479
- sign_in_second_factor?: string;
480
-
481
- /**
482
- * The `uid` of the second factor used to sign in, provided the
483
- * ID token was obtained from a multi-factor authenticated user.
484
- */
485
- second_factor_identifier?: string;
486
-
487
- /**
488
- * The ID of the tenant the user belongs to, if available.
489
- */
490
- tenant?: string;
491
- [key: string]: any;
492
- };
493
-
494
- /**
495
- * The ID token's issued-at time, in seconds since the Unix epoch. That is, the
496
- * time at which this ID token was issued and should start to be considered
497
- * valid.
498
- *
499
- * The Firebase SDKs transparently refresh ID tokens every hour, issuing a new
500
- * ID token with a new issued-at time. If you want to get the time at which the
501
- * user session corresponding to the ID token initially occurred, see the
502
- * [`auth_time`](#auth_time) property.
503
- */
504
- iat: number;
505
-
506
- /**
507
- * The issuer identifier for the issuer of the response.
508
- *
509
- * This value is a URL with the format
510
- * `https://securetoken.google.com/<PROJECT_ID>`, where `<PROJECT_ID>` is the
511
- * same project ID specified in the [`aud`](#aud) property.
512
- */
513
- iss: string;
514
-
515
- /**
516
- * The phone number of the user to whom the ID token belongs, if available.
517
- */
518
- phone_number?: string;
519
-
520
- /**
521
- * The photo URL for the user to whom the ID token belongs, if available.
522
- */
523
- picture?: string;
524
-
525
- /**
526
- * The `uid` corresponding to the user who the ID token belonged to.
527
- *
528
- * As a convenience, this value is copied over to the [`uid`](#uid) property.
529
- */
530
- sub: string;
531
-
532
- /**
533
- * The `uid` corresponding to the user who the ID token belonged to.
534
- *
535
- * This value is not actually in the JWT token claims itself. It is added as a
536
- * convenience, and is set as the value of the [`sub`](#sub) property.
537
- */
538
- uid: string;
539
- [key: string]: any;
540
- }
541
-
542
- /** Represents the result of the {@link admin.auth.getUsers()} API. */
543
- interface GetUsersResult {
544
- /**
545
- * Set of user records, corresponding to the set of users that were
546
- * requested. Only users that were found are listed here. The result set is
547
- * unordered.
548
- */
549
- users: UserRecord[];
550
-
551
- /** Set of identifiers that were requested, but not found. */
552
- notFound: UserIdentifier[];
553
- }
554
-
555
- /**
556
- * Interface representing the object returned from a
557
- * {@link https://firebase.google.com/docs/reference/admin/node/admin.auth.Auth#listUsers `listUsers()`} operation. Contains the list
558
- * of users for the current batch and the next page token if available.
559
- */
560
- interface ListUsersResult {
561
-
562
- /**
563
- * The list of {@link admin.auth.UserRecord `UserRecord`} objects for the
564
- * current downloaded batch.
565
- */
566
- users: admin.auth.UserRecord[];
567
-
568
- /**
569
- * The next page token if available. This is needed for the next batch download.
570
- */
571
- pageToken?: string;
572
- }
573
-
574
- type HashAlgorithmType = 'SCRYPT' | 'STANDARD_SCRYPT' | 'HMAC_SHA512' |
575
- 'HMAC_SHA256' | 'HMAC_SHA1' | 'HMAC_MD5' | 'MD5' | 'PBKDF_SHA1' | 'BCRYPT' |
576
- 'PBKDF2_SHA256' | 'SHA512' | 'SHA256' | 'SHA1';
577
-
578
- /**
579
- * Interface representing the user import options needed for
580
- * {@link https://firebase.google.com/docs/reference/admin/node/admin.auth.Auth#importUsers `importUsers()`} method. This is used to
581
- * provide the password hashing algorithm information.
582
- */
583
- interface UserImportOptions {
584
-
585
- /**
586
- * The password hashing information.
587
- */
588
- hash: {
589
-
590
- /**
591
- * The password hashing algorithm identifier. The following algorithm
592
- * identifiers are supported:
593
- * `SCRYPT`, `STANDARD_SCRYPT`, `HMAC_SHA512`, `HMAC_SHA256`, `HMAC_SHA1`,
594
- * `HMAC_MD5`, `MD5`, `PBKDF_SHA1`, `BCRYPT`, `PBKDF2_SHA256`, `SHA512`,
595
- * `SHA256` and `SHA1`.
596
- */
597
- algorithm: HashAlgorithmType;
598
-
599
- /**
600
- * The signing key used in the hash algorithm in buffer bytes.
601
- * Required by hashing algorithms `SCRYPT`, `HMAC_SHA512`, `HMAC_SHA256`,
602
- * `HAMC_SHA1` and `HMAC_MD5`.
603
- */
604
- key?: Buffer;
605
-
606
- /**
607
- * The salt separator in buffer bytes which is appended to salt when
608
- * verifying a password. This is only used by the `SCRYPT` algorithm.
609
- */
610
- saltSeparator?: Buffer;
611
-
612
- /**
613
- * The number of rounds for hashing calculation.
614
- * Required for `SCRYPT`, `MD5`, `SHA512`, `SHA256`, `SHA1`, `PBKDF_SHA1` and
615
- * `PBKDF2_SHA256`.
616
- */
617
- rounds?: number;
618
-
619
- /**
620
- * The memory cost required for `SCRYPT` algorithm, or the CPU/memory cost.
621
- * Required for `STANDARD_SCRYPT` algorithm.
622
- */
623
- memoryCost?: number;
624
-
625
- /**
626
- * The parallelization of the hashing algorithm. Required for the
627
- * `STANDARD_SCRYPT` algorithm.
628
- */
629
- parallelization?: number;
630
-
631
- /**
632
- * The block size (normally 8) of the hashing algorithm. Required for the
633
- * `STANDARD_SCRYPT` algorithm.
634
- */
635
- blockSize?: number;
636
- /**
637
- * The derived key length of the hashing algorithm. Required for the
638
- * `STANDARD_SCRYPT` algorithm.
639
- */
640
- derivedKeyLength?: number;
641
- };
642
- }
643
-
644
- /**
645
- * Interface representing the response from the
646
- * {@link https://firebase.google.com/docs/reference/admin/node/admin.auth.Auth#importUsers `importUsers()`} method for batch
647
- * importing users to Firebase Auth.
648
- */
649
- interface UserImportResult {
650
-
651
- /**
652
- * The number of user records that failed to import to Firebase Auth.
653
- */
654
- failureCount: number;
655
-
656
- /**
657
- * The number of user records that successfully imported to Firebase Auth.
658
- */
659
- successCount: number;
660
-
661
- /**
662
- * An array of errors corresponding to the provided users to import. The
663
- * length of this array is equal to [`failureCount`](#failureCount).
664
- */
665
- errors: _admin.FirebaseArrayIndexError[];
666
- }
667
-
668
- /**
669
- * Represents the result of the
670
- * {@link https://firebase.google.com/docs/reference/admin/node/admin.auth.Auth#deleteUsers `deleteUsers()`}
671
- * API.
672
- */
673
- interface DeleteUsersResult {
674
- /**
675
- * The number of user records that failed to be deleted (possibly zero).
676
- */
677
- failureCount: number;
678
-
679
- /**
680
- * The number of users that were deleted successfully (possibly zero).
681
- * Users that did not exist prior to calling `deleteUsers()` are
682
- * considered to be successfully deleted.
683
- */
684
- successCount: number;
685
-
686
- /**
687
- * A list of `FirebaseArrayIndexError` instances describing the errors that
688
- * were encountered during the deletion. Length of this list is equal to
689
- * the return value of [`failureCount`](#failureCount).
690
- */
691
- errors: _admin.FirebaseArrayIndexError[];
692
- }
693
-
694
- /**
695
- * User metadata to include when importing a user.
696
- */
697
- interface UserMetadataRequest {
698
-
699
- /**
700
- * The date the user last signed in, formatted as a UTC string.
701
- */
702
- lastSignInTime?: string;
703
-
704
- /**
705
- * The date the user was created, formatted as a UTC string.
706
- */
707
- creationTime?: string;
708
- }
709
-
710
- /**
711
- * User provider data to include when importing a user.
712
- */
713
- interface UserProviderRequest {
714
-
715
- /**
716
- * The user identifier for the linked provider.
717
- */
718
- uid: string;
719
-
720
- /**
721
- * The display name for the linked provider.
722
- */
723
- displayName?: string;
724
-
725
- /**
726
- * The email for the linked provider.
727
- */
728
- email?: string;
729
-
730
- /**
731
- * The phone number for the linked provider.
732
- */
733
- phoneNumber?: string;
734
-
735
- /**
736
- * The photo URL for the linked provider.
737
- */
738
- photoURL?: string;
739
-
740
- /**
741
- * The linked provider ID (for example, "google.com" for the Google provider).
742
- */
743
- providerId: string;
744
- }
745
-
746
- /**
747
- * Interface representing a user to import to Firebase Auth via the
748
- * {@link https://firebase.google.com/docs/reference/admin/node/admin.auth.Auth#importUsers `importUsers()`} method.
749
- */
750
- interface UserImportRecord {
751
-
752
- /**
753
- * The user's `uid`.
754
- */
755
- uid: string;
756
-
757
- /**
758
- * The user's primary email, if set.
759
- */
760
- email?: string;
761
-
762
- /**
763
- * Whether or not the user's primary email is verified.
764
- */
765
- emailVerified?: boolean;
766
-
767
- /**
768
- * The user's display name.
769
- */
770
- displayName?: string;
771
-
772
- /**
773
- * The user's primary phone number, if set.
774
- */
775
- phoneNumber?: string;
776
-
777
- /**
778
- * The user's photo URL.
779
- */
780
- photoURL?: string;
781
-
782
- /**
783
- * Whether or not the user is disabled: `true` for disabled; `false` for
784
- * enabled.
785
- */
786
- disabled?: boolean;
787
-
788
- /**
789
- * Additional metadata about the user.
790
- */
791
- metadata?: admin.auth.UserMetadataRequest;
792
-
793
- /**
794
- * An array of providers (for example, Google, Facebook) linked to the user.
795
- */
796
- providerData?: admin.auth.UserProviderRequest[];
797
-
798
- /**
799
- * The user's custom claims object if available, typically used to define
800
- * user roles and propagated to an authenticated user's ID token.
801
- */
802
- customClaims?: {[key: string]: any};
803
-
804
- /**
805
- * The buffer of bytes representing the user's hashed password.
806
- * When a user is to be imported with a password hash,
807
- * {@link admin.auth.UserImportOptions `UserImportOptions`} are required to be
808
- * specified to identify the hashing algorithm used to generate this hash.
809
- */
810
- passwordHash?: Buffer;
811
-
812
- /**
813
- * The buffer of bytes representing the user's password salt.
814
- */
815
- passwordSalt?: Buffer;
816
-
817
- /**
818
- * The identifier of the tenant where user is to be imported to.
819
- * When not provided in an `admin.auth.Auth` context, the user is uploaded to
820
- * the default parent project.
821
- * When not provided in an `admin.auth.TenantAwareAuth` context, the user is uploaded
822
- * to the tenant corresponding to that `TenantAwareAuth` instance's tenant ID.
823
- */
824
- tenantId?: string;
825
-
826
- /**
827
- * The user's multi-factor related properties.
828
- */
829
- multiFactor?: admin.auth.MultiFactorUpdateSettings;
830
- }
831
-
832
- /**
833
- * Interface representing the session cookie options needed for the
834
- * {@link https://firebase.google.com/docs/reference/admin/node/admin.auth.Auth#createSessionCookie `createSessionCookie()`} method.
835
- */
836
- interface SessionCookieOptions {
837
-
838
- /**
839
- * The session cookie custom expiration in milliseconds. The minimum allowed is
840
- * 5 minutes and the maxium allowed is 2 weeks.
841
- */
842
- expiresIn: number;
843
- }
844
-
845
- /**
846
- * This is the interface that defines the required continue/state URL with
847
- * optional Android and iOS bundle identifiers.
848
- */
849
- interface ActionCodeSettings {
850
-
851
- /**
852
- * Defines the link continue/state URL, which has different meanings in
853
- * different contexts:
854
- * <ul>
855
- * <li>When the link is handled in the web action widgets, this is the deep
856
- * link in the `continueUrl` query parameter.</li>
857
- * <li>When the link is handled in the app directly, this is the `continueUrl`
858
- * query parameter in the deep link of the Dynamic Link.</li>
859
- * </ul>
860
- */
861
- url: string;
862
-
863
- /**
864
- * Whether to open the link via a mobile app or a browser.
865
- * The default is false. When set to true, the action code link is sent
866
- * as a Universal Link or Android App Link and is opened by the app if
867
- * installed. In the false case, the code is sent to the web widget first
868
- * and then redirects to the app if installed.
869
- */
870
- handleCodeInApp?: boolean;
871
-
872
- /**
873
- * Defines the iOS bundle ID. This will try to open the link in an iOS app if it
874
- * is installed.
875
- */
876
- iOS?: {
877
-
878
- /**
879
- * Defines the required iOS bundle ID of the app where the link should be
880
- * handled if the application is already installed on the device.
881
- */
882
- bundleId: string;
883
- };
884
-
885
- /**
886
- * Defines the Android package name. This will try to open the link in an
887
- * android app if it is installed. If `installApp` is passed, it specifies
888
- * whether to install the Android app if the device supports it and the app is
889
- * not already installed. If this field is provided without a `packageName`, an
890
- * error is thrown explaining that the `packageName` must be provided in
891
- * conjunction with this field. If `minimumVersion` is specified, and an older
892
- * version of the app is installed, the user is taken to the Play Store to
893
- * upgrade the app.
894
- */
895
- android?: {
896
-
897
- /**
898
- * Defines the required Android package name of the app where the link should be
899
- * handled if the Android app is installed.
900
- */
901
- packageName: string;
902
-
903
- /**
904
- * Whether to install the Android app if the device supports it and the app is
905
- * not already installed.
906
- */
907
- installApp?: boolean;
908
-
909
- /**
910
- * The Android minimum version if available. If the installed app is an older
911
- * version, the user is taken to the GOogle Play Store to upgrade the app.
912
- */
913
- minimumVersion?: string;
914
- };
915
-
916
- /**
917
- * Defines the dynamic link domain to use for the current link if it is to be
918
- * opened using Firebase Dynamic Links, as multiple dynamic link domains can be
919
- * configured per project. This field provides the ability to explicitly choose
920
- * configured per project. This fields provides the ability explicitly choose
921
- * one. If none is provided, the oldest domain is used by default.
922
- */
923
- dynamicLinkDomain?: string;
924
- }
925
-
926
- /**
927
- * Interface representing a tenant configuration.
928
- *
929
- * Multi-tenancy support requires Google Cloud's Identity Platform
930
- * (GCIP). To learn more about GCIP, including pricing and features,
931
- * see the [GCIP documentation](https://cloud.google.com/identity-platform)
932
- *
933
- * Before multi-tenancy can be used on a Google Cloud Identity Platform project,
934
- * tenants must be allowed on that project via the Cloud Console UI.
935
- *
936
- * A tenant configuration provides information such as the display name, tenant
937
- * identifier and email authentication configuration.
938
- * For OIDC/SAML provider configuration management, `TenantAwareAuth` instances should
939
- * be used instead of a `Tenant` to retrieve the list of configured IdPs on a tenant.
940
- * When configuring these providers, note that tenants will inherit
941
- * whitelisted domains and authenticated redirect URIs of their parent project.
942
- *
943
- * All other settings of a tenant will also be inherited. These will need to be managed
944
- * from the Cloud Console UI.
945
- */
946
- interface Tenant {
947
-
948
- /**
949
- * The tenant identifier.
950
- */
951
- tenantId: string;
952
-
953
- /**
954
- * The tenant display name.
955
- */
956
- displayName?: string;
957
-
958
- /**
959
- * The email sign in provider configuration.
960
- */
961
- emailSignInConfig?: {
962
-
963
- /**
964
- * Whether email provider is enabled.
965
- */
966
- enabled: boolean;
967
-
968
- /**
969
- * Whether password is required for email sign-in. When not required,
970
- * email sign-in can be performed with password or via email link sign-in.
971
- */
972
- passwordRequired?: boolean;
973
- };
974
-
975
- /**
976
- * The multi-factor auth configuration on the current tenant.
977
- */
978
- multiFactorConfig?: admin.auth.MultiFactorConfig;
979
-
980
- /**
981
- * The map containing the test phone number / code pairs for the tenant.
982
- */
983
- testPhoneNumbers?: {[phoneNumber: string]: string};
984
-
985
- /**
986
- * @return A JSON-serializable representation of this object.
987
- */
988
- toJSON(): Object;
989
- }
990
-
991
- /**
992
- * Identifies a second factor type.
993
- */
994
- type AuthFactorType = 'phone';
995
-
996
- /**
997
- * Identifies a multi-factor configuration state.
998
- */
999
- type MultiFactorConfigState = 'ENABLED' | 'DISABLED';
1000
-
1001
- /**
1002
- * Interface representing a multi-factor configuration.
1003
- * This can be used to define whether multi-factor authentication is enabled
1004
- * or disabled and the list of second factor challenges that are supported.
1005
- */
1006
- interface MultiFactorConfig {
1007
- /**
1008
- * The multi-factor config state.
1009
- */
1010
- state: admin.auth.MultiFactorConfigState;
1011
-
1012
- /**
1013
- * The list of identifiers for enabled second factors.
1014
- * Currently only ‘phone’ is supported.
1015
- */
1016
- factorIds?: admin.auth.AuthFactorType[];
1017
- }
1018
-
1019
- /**
1020
- * Interface representing the properties to update on the provided tenant.
1021
- */
1022
- interface UpdateTenantRequest {
1023
-
1024
- /**
1025
- * The tenant display name.
1026
- */
1027
- displayName?: string;
1028
-
1029
- /**
1030
- * The email sign in configuration.
1031
- */
1032
- emailSignInConfig?: {
1033
-
1034
- /**
1035
- * Whether email provider is enabled.
1036
- */
1037
- enabled: boolean;
1038
-
1039
- /**
1040
- * Whether password is required for email sign-in. When not required,
1041
- * email sign-in can be performed with password or via email link sign-in.
1042
- */
1043
- passwordRequired?: boolean;
1044
- };
1045
-
1046
- /**
1047
- * The multi-factor auth configuration to update on the tenant.
1048
- */
1049
- multiFactorConfig?: admin.auth.MultiFactorConfig;
1050
-
1051
- /**
1052
- * The updated map containing the test phone number / code pairs for the tenant.
1053
- * Passing null clears the previously save phone number / code pairs.
1054
- */
1055
- testPhoneNumbers?: {[phoneNumber: string]: string} | null;
1056
- }
1057
-
1058
- /**
1059
- * Interface representing the properties to set on a new tenant.
1060
- */
1061
- type CreateTenantRequest = UpdateTenantRequest;
1062
-
1063
- /**
1064
- * Interface representing the object returned from a
1065
- * {@link https://firebase.google.com/docs/reference/admin/node/admin.auth.Auth#listTenants `listTenants()`}
1066
- * operation.
1067
- * Contains the list of tenants for the current batch and the next page token if available.
1068
- */
1069
- interface ListTenantsResult {
1070
-
1071
- /**
1072
- * The list of {@link admin.auth.Tenant `Tenant`} objects for the downloaded batch.
1073
- */
1074
- tenants: admin.auth.Tenant[];
1075
-
1076
- /**
1077
- * The next page token if available. This is needed for the next batch download.
1078
- */
1079
- pageToken?: string;
1080
- }
1081
-
1082
- /**
1083
- * The filter interface used for listing provider configurations. This is used
1084
- * when specifying how to list configured identity providers via
1085
- * {@link https://firebase.google.com/docs/reference/admin/node/admin.auth.Auth#listProviderConfigs `listProviderConfigs()`}.
1086
- */
1087
- interface AuthProviderConfigFilter {
1088
-
1089
- /**
1090
- * The Auth provider configuration filter. This can be either `saml` or `oidc`.
1091
- * The former is used to look up SAML providers only, while the latter is used
1092
- * for OIDC providers.
1093
- */
1094
- type: 'saml' | 'oidc';
1095
-
1096
- /**
1097
- * The maximum number of results to return per page. The default and maximum is
1098
- * 100.
1099
- */
1100
- maxResults?: number;
1101
-
1102
- /**
1103
- * The next page token. When not specified, the lookup starts from the beginning
1104
- * of the list.
1105
- */
1106
- pageToken?: string;
1107
- }
1108
-
1109
- /**
1110
- * The base Auth provider configuration interface.
1111
- */
1112
- interface AuthProviderConfig {
1113
-
1114
- /**
1115
- * The provider ID defined by the developer.
1116
- * For a SAML provider, this is always prefixed by `saml.`.
1117
- * For an OIDC provider, this is always prefixed by `oidc.`.
1118
- */
1119
- providerId: string;
1120
-
1121
- /**
1122
- * The user-friendly display name to the current configuration. This name is
1123
- * also used as the provider label in the Cloud Console.
1124
- */
1125
- displayName?: string;
1126
-
1127
- /**
1128
- * Whether the provider configuration is enabled or disabled. A user
1129
- * cannot sign in using a disabled provider.
1130
- */
1131
- enabled: boolean;
1132
- }
1133
-
1134
- /**
1135
- * The
1136
- * [SAML](http://docs.oasis-open.org/security/saml/Post2.0/sstc-saml-tech-overview-2.0.html)
1137
- * Auth provider configuration interface. A SAML provider can be created via
1138
- * {@link https://firebase.google.com/docs/reference/admin/node/admin.auth.Auth#createProviderConfig `createProviderConfig()`}.
1139
- */
1140
- interface SAMLAuthProviderConfig extends admin.auth.AuthProviderConfig {
1141
-
1142
- /**
1143
- * The SAML IdP entity identifier.
1144
- */
1145
- idpEntityId: string;
1146
-
1147
- /**
1148
- * The SAML IdP SSO URL. This must be a valid URL.
1149
- */
1150
- ssoURL: string;
1151
-
1152
- /**
1153
- * The list of SAML IdP X.509 certificates issued by CA for this provider.
1154
- * Multiple certificates are accepted to prevent outages during
1155
- * IdP key rotation (for example ADFS rotates every 10 days). When the Auth
1156
- * server receives a SAML response, it will match the SAML response with the
1157
- * certificate on record. Otherwise the response is rejected.
1158
- * Developers are expected to manage the certificate updates as keys are
1159
- * rotated.
1160
- */
1161
- x509Certificates: string[];
1162
-
1163
- /**
1164
- * The SAML relying party (service provider) entity ID.
1165
- * This is defined by the developer but needs to be provided to the SAML IdP.
1166
- */
1167
- rpEntityId: string;
1168
-
1169
- /**
1170
- * This is fixed and must always be the same as the OAuth redirect URL
1171
- * provisioned by Firebase Auth,
1172
- * `https://project-id.firebaseapp.com/__/auth/handler` unless a custom
1173
- * `authDomain` is used.
1174
- * The callback URL should also be provided to the SAML IdP during
1175
- * configuration.
1176
- */
1177
- callbackURL?: string;
1178
- }
1179
-
1180
- /**
1181
- * The [OIDC](https://openid.net/specs/openid-connect-core-1_0-final.html) Auth
1182
- * provider configuration interface. An OIDC provider can be created via
1183
- * {@link https://firebase.google.com/docs/reference/admin/node/admin.auth.Auth#createProviderConfig `createProviderConfig()`}.
1184
- */
1185
- interface OIDCAuthProviderConfig extends admin.auth.AuthProviderConfig {
1186
-
1187
- /**
1188
- * This is the required client ID used to confirm the audience of an OIDC
1189
- * provider's
1190
- * [ID token](https://openid.net/specs/openid-connect-core-1_0-final.html#IDToken).
1191
- */
1192
- clientId: string;
1193
-
1194
- /**
1195
- * This is the required provider issuer used to match the provider issuer of
1196
- * the ID token and to determine the corresponding OIDC discovery document, eg.
1197
- * [`/.well-known/openid-configuration`](https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderConfig).
1198
- * This is needed for the following:
1199
- * <ul>
1200
- * <li>To verify the provided issuer.</li>
1201
- * <li>Determine the authentication/authorization endpoint during the OAuth
1202
- * `id_token` authentication flow.</li>
1203
- * <li>To retrieve the public signing keys via `jwks_uri` to verify the OIDC
1204
- * provider's ID token's signature.</li>
1205
- * <li>To determine the claims_supported to construct the user attributes to be
1206
- * returned in the additional user info response.</li>
1207
- * </ul>
1208
- * ID token validation will be performed as defined in the
1209
- * [spec](https://openid.net/specs/openid-connect-core-1_0.html#IDTokenValidation).
1210
- */
1211
- issuer: string;
1212
- }
1213
-
1214
- /**
1215
- * The request interface for updating a SAML Auth provider. This is used
1216
- * when updating a SAML provider's configuration via
1217
- * {@link https://firebase.google.com/docs/reference/admin/node/admin.auth.Auth#updateProviderConfig `updateProviderConfig()`}.
1218
- */
1219
- interface SAMLUpdateAuthProviderRequest {
1220
-
1221
- /**
1222
- * The SAML provider's updated display name. If not provided, the existing
1223
- * configuration's value is not modified.
1224
- */
1225
- displayName?: string;
1226
-
1227
- /**
1228
- * Whether the SAML provider is enabled or not. If not provided, the existing
1229
- * configuration's setting is not modified.
1230
- */
1231
- enabled?: boolean;
1232
-
1233
- /**
1234
- * The SAML provider's updated IdP entity ID. If not provided, the existing
1235
- * configuration's value is not modified.
1236
- */
1237
- idpEntityId?: string;
1238
-
1239
- /**
1240
- * The SAML provider's updated SSO URL. If not provided, the existing
1241
- * configuration's value is not modified.
1242
- */
1243
- ssoURL?: string;
1244
-
1245
- /**
1246
- * The SAML provider's updated list of X.509 certificated. If not provided, the
1247
- * existing configuration list is not modified.
1248
- */
1249
- x509Certificates?: string[];
1250
-
1251
- /**
1252
- * The SAML provider's updated RP entity ID. If not provided, the existing
1253
- * configuration's value is not modified.
1254
- */
1255
- rpEntityId?: string;
1256
-
1257
- /**
1258
- * The SAML provider's callback URL. If not provided, the existing
1259
- * configuration's value is not modified.
1260
- */
1261
- callbackURL?: string;
1262
- }
1263
-
1264
- /**
1265
- * The request interface for updating an OIDC Auth provider. This is used
1266
- * when updating an OIDC provider's configuration via
1267
- * {@link https://firebase.google.com/docs/reference/admin/node/admin.auth.Auth#updateProviderConfig `updateProviderConfig()`}.
1268
- */
1269
- interface OIDCUpdateAuthProviderRequest {
1270
-
1271
- /**
1272
- * The OIDC provider's updated display name. If not provided, the existing
1273
- * configuration's value is not modified.
1274
- */
1275
- displayName?: string;
1276
-
1277
- /**
1278
- * Whether the OIDC provider is enabled or not. If not provided, the existing
1279
- * configuration's setting is not modified.
1280
- */
1281
- enabled?: boolean;
1282
-
1283
- /**
1284
- * The OIDC provider's updated client ID. If not provided, the existing
1285
- * configuration's value is not modified.
1286
- */
1287
- clientId?: string;
1288
-
1289
- /**
1290
- * The OIDC provider's updated issuer. If not provided, the existing
1291
- * configuration's value is not modified.
1292
- */
1293
- issuer?: string;
1294
- }
1295
-
1296
- /**
1297
- * The response interface for listing provider configs. This is only available
1298
- * when listing all identity providers' configurations via
1299
- * {@link https://firebase.google.com/docs/reference/admin/node/admin.auth.Auth#listProviderConfigs `listProviderConfigs()`}.
1300
- */
1301
- interface ListProviderConfigResults {
1302
-
1303
- /**
1304
- * The list of providers for the specified type in the current page.
1305
- */
1306
- providerConfigs: admin.auth.AuthProviderConfig[];
1307
-
1308
- /**
1309
- * The next page token, if available.
1310
- */
1311
- pageToken?: string;
1312
- }
1313
-
1314
- type UpdateAuthProviderRequest =
1315
- admin.auth.SAMLUpdateAuthProviderRequest | admin.auth.OIDCUpdateAuthProviderRequest;
1316
-
1317
- /**
1318
- * Used for looking up an account by uid.
1319
- *
1320
- * See auth.getUsers()
1321
- */
1322
- interface UidIdentifier {
1323
- uid: string;
1324
- }
1325
-
1326
- /**
1327
- * Used for looking up an account by email.
1328
- *
1329
- * See auth.getUsers()
1330
- */
1331
- interface EmailIdentifier {
1332
- email: string;
1333
- }
1334
-
1335
- /**
1336
- * Used for looking up an account by phone number.
1337
- *
1338
- * See auth.getUsers()
1339
- */
1340
- interface PhoneIdentifier {
1341
- phoneNumber: string;
1342
- }
1343
-
1344
- /**
1345
- * Used for looking up an account by federated provider.
1346
- *
1347
- * See auth.getUsers()
1348
- */
1349
- interface ProviderIdentifier {
1350
- providerId: string;
1351
- providerUid: string;
1352
- }
1353
-
1354
- /**
1355
- * Identifies a user to be looked up.
1356
- */
1357
- type UserIdentifier = UidIdentifier | EmailIdentifier | PhoneIdentifier | ProviderIdentifier;
1358
-
1359
- interface BaseAuth {
1360
-
1361
- /**
1362
- * Creates a new Firebase custom token (JWT) that can be sent back to a client
1363
- * device to use to sign in with the client SDKs' `signInWithCustomToken()`
1364
- * methods. (Tenant-aware instances will also embed the tenant ID in the
1365
- * token.)
1366
- *
1367
- * See [Create Custom Tokens](/docs/auth/admin/create-custom-tokens) for code
1368
- * samples and detailed documentation.
1369
- *
1370
- * @param uid The `uid` to use as the custom token's subject.
1371
- * @param developerClaims Optional additional claims to include
1372
- * in the custom token's payload.
1373
- *
1374
- * @return A promise fulfilled with a custom token for the
1375
- * provided `uid` and payload.
1376
- */
1377
- createCustomToken(uid: string, developerClaims?: object): Promise<string>;
1378
-
1379
- /**
1380
- * Creates a new user.
1381
- *
1382
- * See [Create a user](/docs/auth/admin/manage-users#create_a_user) for code
1383
- * samples and detailed documentation.
1384
- *
1385
- * @param properties The properties to set on the
1386
- * new user record to be created.
1387
- *
1388
- * @return A promise fulfilled with the user
1389
- * data corresponding to the newly created user.
1390
- */
1391
- createUser(properties: admin.auth.CreateRequest): Promise<admin.auth.UserRecord>;
1392
-
1393
- /**
1394
- * Deletes an existing user.
1395
- *
1396
- * See [Delete a user](/docs/auth/admin/manage-users#delete_a_user) for code
1397
- * samples and detailed documentation.
1398
- *
1399
- * @param uid The `uid` corresponding to the user to delete.
1400
- *
1401
- * @return An empty promise fulfilled once the user has been
1402
- * deleted.
1403
- */
1404
- deleteUser(uid: string): Promise<void>;
1405
-
1406
- /**
1407
- * Deletes the users specified by the given uids.
1408
- *
1409
- * Deleting a non-existing user won't generate an error (i.e. this method
1410
- * is idempotent.) Non-existing users are considered to be successfully
1411
- * deleted, and are therefore counted in the
1412
- * `DeleteUsersResult.successCount` value.
1413
- *
1414
- * Only a maximum of 1000 identifiers may be supplied. If more than 1000
1415
- * identifiers are supplied, this method throws a FirebaseAuthError.
1416
- *
1417
- * This API is currently rate limited at the server to 1 QPS. If you exceed
1418
- * this, you may get a quota exceeded error. Therefore, if you want to
1419
- * delete more than 1000 users, you may need to add a delay to ensure you
1420
- * don't go over this limit.
1421
- *
1422
- * @param uids The `uids` corresponding to the users to delete.
1423
- *
1424
- * @return A Promise that resolves to the total number of successful/failed
1425
- * deletions, as well as the array of errors that corresponds to the
1426
- * failed deletions.
1427
- */
1428
- deleteUsers(uids: string[]): Promise<admin.auth.DeleteUsersResult>;
1429
-
1430
- /**
1431
- * Gets the user data for the user corresponding to a given `uid`.
1432
- *
1433
- * See [Retrieve user data](/docs/auth/admin/manage-users#retrieve_user_data)
1434
- * for code samples and detailed documentation.
1435
- *
1436
- * @param uid The `uid` corresponding to the user whose data to fetch.
1437
- *
1438
- * @return A promise fulfilled with the user
1439
- * data corresponding to the provided `uid`.
1440
- */
1441
- getUser(uid: string): Promise<admin.auth.UserRecord>;
1442
-
1443
- /**
1444
- * Gets the user data for the user corresponding to a given email.
1445
- *
1446
- * See [Retrieve user data](/docs/auth/admin/manage-users#retrieve_user_data)
1447
- * for code samples and detailed documentation.
1448
- *
1449
- * @param email The email corresponding to the user whose data to
1450
- * fetch.
1451
- *
1452
- * @return A promise fulfilled with the user
1453
- * data corresponding to the provided email.
1454
- */
1455
- getUserByEmail(email: string): Promise<admin.auth.UserRecord>;
1456
-
1457
- /**
1458
- * Gets the user data for the user corresponding to a given phone number. The
1459
- * phone number has to conform to the E.164 specification.
1460
- *
1461
- * See [Retrieve user data](/docs/auth/admin/manage-users#retrieve_user_data)
1462
- * for code samples and detailed documentation.
1463
- *
1464
- * @param phoneNumber The phone number corresponding to the user whose
1465
- * data to fetch.
1466
- *
1467
- * @return A promise fulfilled with the user
1468
- * data corresponding to the provided phone number.
1469
- */
1470
- getUserByPhoneNumber(phoneNumber: string): Promise<admin.auth.UserRecord>;
1471
-
1472
- /**
1473
- * Gets the user data corresponding to the specified identifiers.
1474
- *
1475
- * There are no ordering guarantees; in particular, the nth entry in the result list is not
1476
- * guaranteed to correspond to the nth entry in the input parameters list.
1477
- *
1478
- * Only a maximum of 100 identifiers may be supplied. If more than 100 identifiers are supplied,
1479
- * this method throws a FirebaseAuthError.
1480
- *
1481
- * @param identifiers The identifiers used to indicate which user records should be returned.
1482
- * Must have <= 100 entries.
1483
- * @return {Promise<GetUsersResult>} A promise that resolves to the corresponding user records.
1484
- * @throws FirebaseAuthError If any of the identifiers are invalid or if more than 100
1485
- * identifiers are specified.
1486
- */
1487
- getUsers(identifiers: admin.auth.UserIdentifier[]): Promise<GetUsersResult>;
1488
-
1489
- /**
1490
- * Retrieves a list of users (single batch only) with a size of `maxResults`
1491
- * starting from the offset as specified by `pageToken`. This is used to
1492
- * retrieve all the users of a specified project in batches.
1493
- *
1494
- * See [List all users](/docs/auth/admin/manage-users#list_all_users)
1495
- * for code samples and detailed documentation.
1496
- *
1497
- * @param maxResults The page size, 1000 if undefined. This is also
1498
- * the maximum allowed limit.
1499
- * @param pageToken The next page token. If not specified, returns
1500
- * users starting without any offset.
1501
- * @return A promise that resolves with
1502
- * the current batch of downloaded users and the next page token.
1503
- */
1504
- listUsers(maxResults?: number, pageToken?: string): Promise<admin.auth.ListUsersResult>;
1505
-
1506
- /**
1507
- * Updates an existing user.
1508
- *
1509
- * See [Update a user](/docs/auth/admin/manage-users#update_a_user) for code
1510
- * samples and detailed documentation.
1511
- *
1512
- * @param uid The `uid` corresponding to the user to update.
1513
- * @param properties The properties to update on
1514
- * the provided user.
1515
- *
1516
- * @return A promise fulfilled with the
1517
- * updated user data.
1518
- */
1519
- updateUser(uid: string, properties: admin.auth.UpdateRequest): Promise<admin.auth.UserRecord>;
1520
-
1521
- /**
1522
- * Verifies a Firebase ID token (JWT). If the token is valid, the promise is
1523
- * fulfilled with the token's decoded claims; otherwise, the promise is
1524
- * rejected.
1525
- * An optional flag can be passed to additionally check whether the ID token
1526
- * was revoked.
1527
- *
1528
- * See [Verify ID Tokens](/docs/auth/admin/verify-id-tokens) for code samples
1529
- * and detailed documentation.
1530
- *
1531
- * @param idToken The ID token to verify.
1532
- * @param checkRevoked Whether to check if the ID token was revoked.
1533
- * This requires an extra request to the Firebase Auth backend to check
1534
- * the `tokensValidAfterTime` time for the corresponding user.
1535
- * When not specified, this additional check is not applied.
1536
- *
1537
- * @return A promise fulfilled with the
1538
- * token's decoded claims if the ID token is valid; otherwise, a rejected
1539
- * promise.
1540
- */
1541
- verifyIdToken(idToken: string, checkRevoked?: boolean): Promise<admin.auth.DecodedIdToken>;
1542
-
1543
- /**
1544
- * Sets additional developer claims on an existing user identified by the
1545
- * provided `uid`, typically used to define user roles and levels of
1546
- * access. These claims should propagate to all devices where the user is
1547
- * already signed in (after token expiration or when token refresh is forced)
1548
- * and the next time the user signs in. If a reserved OIDC claim name
1549
- * is used (sub, iat, iss, etc), an error is thrown. They are set on the
1550
- * authenticated user's ID token JWT.
1551
- *
1552
- * See
1553
- * [Defining user roles and access levels](/docs/auth/admin/custom-claims)
1554
- * for code samples and detailed documentation.
1555
- *
1556
- * @param uid The `uid` of the user to edit.
1557
- * @param customUserClaims The developer claims to set. If null is
1558
- * passed, existing custom claims are deleted. Passing a custom claims payload
1559
- * larger than 1000 bytes will throw an error. Custom claims are added to the
1560
- * user's ID token which is transmitted on every authenticated request.
1561
- * For profile non-access related user attributes, use database or other
1562
- * separate storage systems.
1563
- * @return A promise that resolves when the operation completes
1564
- * successfully.
1565
- */
1566
- setCustomUserClaims(uid: string, customUserClaims: object | null): Promise<void>;
1567
-
1568
- /**
1569
- * Revokes all refresh tokens for an existing user.
1570
- *
1571
- * This API will update the user's
1572
- * {@link admin.auth.UserRecord#tokensValidAfterTime `tokensValidAfterTime`} to
1573
- * the current UTC. It is important that the server on which this is called has
1574
- * its clock set correctly and synchronized.
1575
- *
1576
- * While this will revoke all sessions for a specified user and disable any
1577
- * new ID tokens for existing sessions from getting minted, existing ID tokens
1578
- * may remain active until their natural expiration (one hour). To verify that
1579
- * ID tokens are revoked, use
1580
- * {@link admin.auth.Auth#verifyIdToken `verifyIdToken(idToken, true)`}
1581
- * where `checkRevoked` is set to true.
1582
- *
1583
- * @param uid The `uid` corresponding to the user whose refresh tokens
1584
- * are to be revoked.
1585
- *
1586
- * @return An empty promise fulfilled once the user's refresh
1587
- * tokens have been revoked.
1588
- */
1589
- revokeRefreshTokens(uid: string): Promise<void>;
1590
-
1591
- /**
1592
- * Imports the provided list of users into Firebase Auth.
1593
- * A maximum of 1000 users are allowed to be imported one at a time.
1594
- * When importing users with passwords,
1595
- * {@link admin.auth.UserImportOptions `UserImportOptions`} are required to be
1596
- * specified.
1597
- * This operation is optimized for bulk imports and will ignore checks on `uid`,
1598
- * `email` and other identifier uniqueness which could result in duplications.
1599
- *
1600
- * @param users The list of user records to import to Firebase Auth.
1601
- * @param options The user import options, required when the users provided include
1602
- * password credentials.
1603
- * @return A promise that resolves when
1604
- * the operation completes with the result of the import. This includes the
1605
- * number of successful imports, the number of failed imports and their
1606
- * corresponding errors.
1607
- */
1608
- importUsers(
1609
- users: admin.auth.UserImportRecord[],
1610
- options?: admin.auth.UserImportOptions,
1611
- ): Promise<admin.auth.UserImportResult>;
1612
-
1613
- /**
1614
- * Creates a new Firebase session cookie with the specified options. The created
1615
- * JWT string can be set as a server-side session cookie with a custom cookie
1616
- * policy, and be used for session management. The session cookie JWT will have
1617
- * the same payload claims as the provided ID token.
1618
- *
1619
- * See [Manage Session Cookies](/docs/auth/admin/manage-cookies) for code
1620
- * samples and detailed documentation.
1621
- *
1622
- * @param idToken The Firebase ID token to exchange for a session
1623
- * cookie.
1624
- * @param sessionCookieOptions The session
1625
- * cookie options which includes custom session duration.
1626
- *
1627
- * @return A promise that resolves on success with the
1628
- * created session cookie.
1629
- */
1630
- createSessionCookie(
1631
- idToken: string,
1632
- sessionCookieOptions: admin.auth.SessionCookieOptions,
1633
- ): Promise<string>;
1634
-
1635
- /**
1636
- * Verifies a Firebase session cookie. Returns a Promise with the cookie claims.
1637
- * Rejects the promise if the cookie could not be verified. If `checkRevoked` is
1638
- * set to true, verifies if the session corresponding to the session cookie was
1639
- * revoked. If the corresponding user's session was revoked, an
1640
- * `auth/session-cookie-revoked` error is thrown. If not specified the check is
1641
- * not performed.
1642
- *
1643
- * See [Verify Session Cookies](/docs/auth/admin/manage-cookies#verify_session_cookie_and_check_permissions)
1644
- * for code samples and detailed documentation
1645
- *
1646
- * @param sessionCookie The session cookie to verify.
1647
- * @param checkForRevocation Whether to check if the session cookie was
1648
- * revoked. This requires an extra request to the Firebase Auth backend to
1649
- * check the `tokensValidAfterTime` time for the corresponding user.
1650
- * When not specified, this additional check is not performed.
1651
- *
1652
- * @return A promise fulfilled with the
1653
- * session cookie's decoded claims if the session cookie is valid; otherwise,
1654
- * a rejected promise.
1655
- */
1656
- verifySessionCookie(
1657
- sessionCookie: string,
1658
- checkForRevocation?: boolean,
1659
- ): Promise<admin.auth.DecodedIdToken>;
1660
-
1661
- /**
1662
- * Generates the out of band email action link to reset a user's password.
1663
- * The link is generated for the user with the specified email address. The
1664
- * optional {@link admin.auth.ActionCodeSettings `ActionCodeSettings`} object
1665
- * defines whether the link is to be handled by a mobile app or browser and the
1666
- * additional state information to be passed in the deep link, etc.
1667
- *
1668
- * @example
1669
- * ```javascript
1670
- * var actionCodeSettings = {
1671
- * url: 'https://www.example.com/?email=user@example.com',
1672
- * iOS: {
1673
- * bundleId: 'com.example.ios'
1674
- * },
1675
- * android: {
1676
- * packageName: 'com.example.android',
1677
- * installApp: true,
1678
- * minimumVersion: '12'
1679
- * },
1680
- * handleCodeInApp: true,
1681
- * dynamicLinkDomain: 'custom.page.link'
1682
- * };
1683
- * admin.auth()
1684
- * .generatePasswordResetLink('user@example.com', actionCodeSettings)
1685
- * .then(function(link) {
1686
- * // The link was successfully generated.
1687
- * })
1688
- * .catch(function(error) {
1689
- * // Some error occurred, you can inspect the code: error.code
1690
- * });
1691
- * ```
1692
- *
1693
- * @param email The email address of the user whose password is to be
1694
- * reset.
1695
- * @param actionCodeSettings The action
1696
- * code settings. If specified, the state/continue URL is set as the
1697
- * "continueUrl" parameter in the password reset link. The default password
1698
- * reset landing page will use this to display a link to go back to the app
1699
- * if it is installed.
1700
- * If the actionCodeSettings is not specified, no URL is appended to the
1701
- * action URL.
1702
- * The state URL provided must belong to a domain that is whitelisted by the
1703
- * developer in the console. Otherwise an error is thrown.
1704
- * Mobile app redirects are only applicable if the developer configures
1705
- * and accepts the Firebase Dynamic Links terms of service.
1706
- * The Android package name and iOS bundle ID are respected only if they
1707
- * are configured in the same Firebase Auth project.
1708
- * @return A promise that resolves with the generated link.
1709
- */
1710
- generatePasswordResetLink(
1711
- email: string,
1712
- actionCodeSettings?: admin.auth.ActionCodeSettings,
1713
- ): Promise<string>;
1714
-
1715
- /**
1716
- * Generates the out of band email action link to verify the user's ownership
1717
- * of the specified email. The
1718
- * {@link admin.auth.ActionCodeSettings `ActionCodeSettings`} object provided
1719
- * as an argument to this method defines whether the link is to be handled by a
1720
- * mobile app or browser along with additional state information to be passed in
1721
- * the deep link, etc.
1722
- *
1723
- * @example
1724
- * ```javascript
1725
- * var actionCodeSettings = {
1726
- * url: 'https://www.example.com/cart?email=user@example.com&cartId=123',
1727
- * iOS: {
1728
- * bundleId: 'com.example.ios'
1729
- * },
1730
- * android: {
1731
- * packageName: 'com.example.android',
1732
- * installApp: true,
1733
- * minimumVersion: '12'
1734
- * },
1735
- * handleCodeInApp: true,
1736
- * dynamicLinkDomain: 'custom.page.link'
1737
- * };
1738
- * admin.auth()
1739
- * .generateEmailVerificationLink('user@example.com', actionCodeSettings)
1740
- * .then(function(link) {
1741
- * // The link was successfully generated.
1742
- * })
1743
- * .catch(function(error) {
1744
- * // Some error occurred, you can inspect the code: error.code
1745
- * });
1746
- * ```
1747
- *
1748
- * @param email The email account to verify.
1749
- * @param actionCodeSettings The action
1750
- * code settings. If specified, the state/continue URL is set as the
1751
- * "continueUrl" parameter in the email verification link. The default email
1752
- * verification landing page will use this to display a link to go back to
1753
- * the app if it is installed.
1754
- * If the actionCodeSettings is not specified, no URL is appended to the
1755
- * action URL.
1756
- * The state URL provided must belong to a domain that is whitelisted by the
1757
- * developer in the console. Otherwise an error is thrown.
1758
- * Mobile app redirects are only applicable if the developer configures
1759
- * and accepts the Firebase Dynamic Links terms of service.
1760
- * The Android package name and iOS bundle ID are respected only if they
1761
- * are configured in the same Firebase Auth project.
1762
- * @return A promise that resolves with the generated link.
1763
- */
1764
- generateEmailVerificationLink(
1765
- email: string,
1766
- actionCodeSettings?: admin.auth.ActionCodeSettings,
1767
- ): Promise<string>;
1768
-
1769
- /**
1770
- * Generates the out of band email action link to sign in or sign up the owner
1771
- * of the specified email. The
1772
- * {@link admin.auth.ActionCodeSettings `ActionCodeSettings`} object provided
1773
- * as an argument to this method defines whether the link is to be handled by a
1774
- * mobile app or browser along with additional state information to be passed in
1775
- * the deep link, etc.
1776
- *
1777
- * @example
1778
- * ```javascript
1779
- * var actionCodeSettings = {
1780
- * // The URL to redirect to for sign-in completion. This is also the deep
1781
- * // link for mobile redirects. The domain (www.example.com) for this URL
1782
- * // must be whitelisted in the Firebase Console.
1783
- * url: 'https://www.example.com/finishSignUp?cartId=1234',
1784
- * iOS: {
1785
- * bundleId: 'com.example.ios'
1786
- * },
1787
- * android: {
1788
- * packageName: 'com.example.android',
1789
- * installApp: true,
1790
- * minimumVersion: '12'
1791
- * },
1792
- * // This must be true.
1793
- * handleCodeInApp: true,
1794
- * dynamicLinkDomain: 'custom.page.link'
1795
- * };
1796
- * admin.auth()
1797
- * .generateSignInWithEmailLink('user@example.com', actionCodeSettings)
1798
- * .then(function(link) {
1799
- * // The link was successfully generated.
1800
- * })
1801
- * .catch(function(error) {
1802
- * // Some error occurred, you can inspect the code: error.code
1803
- * });
1804
- * ```
1805
- *
1806
- * @param email The email account to sign in with.
1807
- * @param actionCodeSettings The action
1808
- * code settings. These settings provide Firebase with instructions on how
1809
- * to construct the email link. This includes the sign in completion URL or
1810
- * the deep link for redirects and the mobile apps to use when the
1811
- * sign-in link is opened on an Android or iOS device.
1812
- * Mobile app redirects are only applicable if the developer configures
1813
- * and accepts the Firebase Dynamic Links terms of service.
1814
- * The Android package name and iOS bundle ID are respected only if they
1815
- * are configured in the same Firebase Auth project.
1816
- * @return A promise that resolves with the generated link.
1817
- */
1818
- generateSignInWithEmailLink(
1819
- email: string,
1820
- actionCodeSettings: admin.auth.ActionCodeSettings,
1821
- ): Promise<string>;
1822
-
1823
- /**
1824
- * Returns the list of existing provider configurations matching the filter
1825
- * provided. At most, 100 provider configs can be listed at a time.
1826
- *
1827
- * SAML and OIDC provider support requires Google Cloud's Identity Platform
1828
- * (GCIP). To learn more about GCIP, including pricing and features,
1829
- * see the [GCIP documentation](https://cloud.google.com/identity-platform).
1830
- *
1831
- * @param options The provider config filter to apply.
1832
- * @return A promise that resolves with the list of provider configs meeting the
1833
- * filter requirements.
1834
- */
1835
- listProviderConfigs(
1836
- options: admin.auth.AuthProviderConfigFilter
1837
- ): Promise<admin.auth.ListProviderConfigResults>;
1838
-
1839
- /**
1840
- * Looks up an Auth provider configuration by the provided ID.
1841
- * Returns a promise that resolves with the provider configuration
1842
- * corresponding to the provider ID specified. If the specified ID does not
1843
- * exist, an `auth/configuration-not-found` error is thrown.
1844
- *
1845
- * SAML and OIDC provider support requires Google Cloud's Identity Platform
1846
- * (GCIP). To learn more about GCIP, including pricing and features,
1847
- * see the [GCIP documentation](https://cloud.google.com/identity-platform).
1848
- *
1849
- * @param providerId The provider ID corresponding to the provider
1850
- * config to return.
1851
- * @return A promise that resolves
1852
- * with the configuration corresponding to the provided ID.
1853
- */
1854
- getProviderConfig(providerId: string): Promise<admin.auth.AuthProviderConfig>;
1855
-
1856
- /**
1857
- * Deletes the provider configuration corresponding to the provider ID passed.
1858
- * If the specified ID does not exist, an `auth/configuration-not-found` error
1859
- * is thrown.
1860
- *
1861
- * SAML and OIDC provider support requires Google Cloud's Identity Platform
1862
- * (GCIP). To learn more about GCIP, including pricing and features,
1863
- * see the [GCIP documentation](https://cloud.google.com/identity-platform).
1864
- *
1865
- * @param providerId The provider ID corresponding to the provider
1866
- * config to delete.
1867
- * @return A promise that resolves on completion.
1868
- */
1869
- deleteProviderConfig(providerId: string): Promise<void>;
1870
-
1871
- /**
1872
- * Returns a promise that resolves with the updated `AuthProviderConfig`
1873
- * corresponding to the provider ID specified.
1874
- * If the specified ID does not exist, an `auth/configuration-not-found` error
1875
- * is thrown.
1876
- *
1877
- * SAML and OIDC provider support requires Google Cloud's Identity Platform
1878
- * (GCIP). To learn more about GCIP, including pricing and features,
1879
- * see the [GCIP documentation](https://cloud.google.com/identity-platform).
1880
- *
1881
- * @param providerId The provider ID corresponding to the provider
1882
- * config to update.
1883
- * @param updatedConfig The updated configuration.
1884
- * @return A promise that resolves with the updated provider configuration.
1885
- */
1886
- updateProviderConfig(
1887
- providerId: string, updatedConfig: admin.auth.UpdateAuthProviderRequest
1888
- ): Promise<admin.auth.AuthProviderConfig>;
1889
-
1890
- /**
1891
- * Returns a promise that resolves with the newly created `AuthProviderConfig`
1892
- * when the new provider configuration is created.
1893
- *
1894
- * SAML and OIDC provider support requires Google Cloud's Identity Platform
1895
- * (GCIP). To learn more about GCIP, including pricing and features,
1896
- * see the [GCIP documentation](https://cloud.google.com/identity-platform).
1897
- *
1898
- * @param config The provider configuration to create.
1899
- * @return A promise that resolves with the created provider configuration.
1900
- */
1901
- createProviderConfig(
1902
- config: admin.auth.AuthProviderConfig
1903
- ): Promise<admin.auth.AuthProviderConfig>;
1904
- }
1905
-
1906
- /**
1907
- * Tenant-aware `Auth` interface used for managing users, configuring SAML/OIDC providers,
1908
- * generating email links for password reset, email verification, etc for specific tenants.
1909
- *
1910
- * Multi-tenancy support requires Google Cloud's Identity Platform
1911
- * (GCIP). To learn more about GCIP, including pricing and features,
1912
- * see the [GCIP documentation](https://cloud.google.com/identity-platform)
1913
- *
1914
- * Each tenant contains its own identity providers, settings and sets of users.
1915
- * Using `TenantAwareAuth`, users for a specific tenant and corresponding OIDC/SAML
1916
- * configurations can also be managed, ID tokens for users signed in to a specific tenant
1917
- * can be verified, and email action links can also be generated for users belonging to the
1918
- * tenant.
1919
- *
1920
- * `TenantAwareAuth` instances for a specific `tenantId` can be instantiated by calling
1921
- * `auth.tenantManager().authForTenant(tenantId)`.
1922
- */
1923
- interface TenantAwareAuth extends BaseAuth {
1924
-
1925
- /**
1926
- * The tenant identifier corresponding to this `TenantAwareAuth` instance.
1927
- * All calls to the user management APIs, OIDC/SAML provider management APIs, email link
1928
- * generation APIs, etc will only be applied within the scope of this tenant.
1929
- */
1930
- tenantId: string;
1931
- }
1932
-
1933
- interface Auth extends admin.auth.BaseAuth {
1934
- app: _admin.app.App;
1935
-
1936
- /**
1937
- * @return The tenant manager instance associated with the current project.
1938
- */
1939
- tenantManager(): admin.auth.TenantManager;
1940
- }
1941
-
1942
- /**
1943
- * Defines the tenant manager used to help manage tenant related operations.
1944
- * This includes:
1945
- * <ul>
1946
- * <li>The ability to create, update, list, get and delete tenants for the underlying
1947
- * project.</li>
1948
- * <li>Getting a `TenantAwareAuth` instance for running Auth related operations
1949
- * (user management, provider configuration management, token verification,
1950
- * email link generation, etc) in the context of a specified tenant.</li>
1951
- * </ul>
1952
- */
1953
- interface TenantManager {
1954
- /**
1955
- * @param tenantId The tenant ID whose `TenantAwareAuth` instance is to be returned.
1956
- *
1957
- * @return The `TenantAwareAuth` instance corresponding to this tenant identifier.
1958
- */
1959
- authForTenant(tenantId: string): admin.auth.TenantAwareAuth;
1960
-
1961
- /**
1962
- * Gets the tenant configuration for the tenant corresponding to a given `tenantId`.
1963
- *
1964
- * @param tenantId The tenant identifier corresponding to the tenant whose data to fetch.
1965
- *
1966
- * @return A promise fulfilled with the tenant configuration to the provided `tenantId`.
1967
- */
1968
- getTenant(tenantId: string): Promise<admin.auth.Tenant>;
1969
-
1970
- /**
1971
- * Retrieves a list of tenants (single batch only) with a size of `maxResults`
1972
- * starting from the offset as specified by `pageToken`. This is used to
1973
- * retrieve all the tenants of a specified project in batches.
1974
- *
1975
- * @param maxResults The page size, 1000 if undefined. This is also
1976
- * the maximum allowed limit.
1977
- * @param pageToken The next page token. If not specified, returns
1978
- * tenants starting without any offset.
1979
- *
1980
- * @return A promise that resolves with
1981
- * a batch of downloaded tenants and the next page token.
1982
- */
1983
- listTenants(maxResults?: number, pageToken?: string): Promise<admin.auth.ListTenantsResult>;
1984
-
1985
- /**
1986
- * Deletes an existing tenant.
1987
- *
1988
- * @param tenantId The `tenantId` corresponding to the tenant to delete.
1989
- *
1990
- * @return An empty promise fulfilled once the tenant has been deleted.
1991
- */
1992
- deleteTenant(tenantId: string): Promise<void>;
1993
-
1994
- /**
1995
- * Creates a new tenant.
1996
- * When creating new tenants, tenants that use separate billing and quota will require their
1997
- * own project and must be defined as `full_service`.
1998
- *
1999
- * @param tenantOptions The properties to set on the new tenant configuration to be created.
2000
- *
2001
- * @return A promise fulfilled with the tenant configuration corresponding to the newly
2002
- * created tenant.
2003
- */
2004
- createTenant(tenantOptions: admin.auth.CreateTenantRequest): Promise<admin.auth.Tenant>;
2005
-
2006
- /**
2007
- * Updates an existing tenant configuration.
2008
- *
2009
- * @param tenantId The `tenantId` corresponding to the tenant to delete.
2010
- * @param tenantOptions The properties to update on the provided tenant.
2011
- *
2012
- * @return A promise fulfilled with the update tenant data.
2013
- */
2014
- updateTenant(tenantId: string, tenantOptions: admin.auth.UpdateTenantRequest): Promise<admin.auth.Tenant>;
2015
- }
2016
- }