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