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