firebase-admin 11.5.0 → 11.6.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 (203) hide show
  1. package/lib/app/core.d.ts +1 -1
  2. package/lib/app/core.js +1 -1
  3. package/lib/app/credential-factory.d.ts +1 -1
  4. package/lib/app/credential-factory.js +1 -1
  5. package/lib/app/credential-internal.d.ts +1 -1
  6. package/lib/app/credential-internal.js +1 -1
  7. package/lib/app/credential.d.ts +1 -1
  8. package/lib/app/credential.js +1 -1
  9. package/lib/app/firebase-app.d.ts +1 -1
  10. package/lib/app/firebase-app.js +1 -1
  11. package/lib/app/firebase-namespace.d.ts +1 -1
  12. package/lib/app/firebase-namespace.js +1 -1
  13. package/lib/app/index.d.ts +1 -1
  14. package/lib/app/index.js +1 -1
  15. package/lib/app/lifecycle.d.ts +1 -1
  16. package/lib/app/lifecycle.js +1 -1
  17. package/lib/app-check/app-check-api-client-internal.d.ts +1 -1
  18. package/lib/app-check/app-check-api-client-internal.js +1 -1
  19. package/lib/app-check/app-check-api.d.ts +1 -1
  20. package/lib/app-check/app-check-api.js +1 -1
  21. package/lib/app-check/app-check-namespace.d.ts +1 -1
  22. package/lib/app-check/app-check-namespace.js +1 -1
  23. package/lib/app-check/app-check.d.ts +1 -1
  24. package/lib/app-check/app-check.js +1 -1
  25. package/lib/app-check/index.d.ts +1 -1
  26. package/lib/app-check/index.js +1 -1
  27. package/lib/app-check/token-generator.d.ts +1 -1
  28. package/lib/app-check/token-generator.js +1 -1
  29. package/lib/app-check/token-verifier.d.ts +1 -1
  30. package/lib/app-check/token-verifier.js +1 -1
  31. package/lib/auth/action-code-settings-builder.d.ts +1 -1
  32. package/lib/auth/action-code-settings-builder.js +1 -1
  33. package/lib/auth/auth-api-request.d.ts +1 -1
  34. package/lib/auth/auth-api-request.js +1 -1
  35. package/lib/auth/auth-config.d.ts +23 -13
  36. package/lib/auth/auth-config.js +65 -2
  37. package/lib/auth/auth-namespace.d.ts +1 -1
  38. package/lib/auth/auth-namespace.js +1 -1
  39. package/lib/auth/auth.d.ts +1 -1
  40. package/lib/auth/auth.js +1 -1
  41. package/lib/auth/base-auth.d.ts +1 -1
  42. package/lib/auth/base-auth.js +1 -1
  43. package/lib/auth/identifier.d.ts +1 -1
  44. package/lib/auth/identifier.js +1 -1
  45. package/lib/auth/index.d.ts +2 -2
  46. package/lib/auth/index.js +1 -1
  47. package/lib/auth/project-config-manager.d.ts +1 -1
  48. package/lib/auth/project-config-manager.js +1 -1
  49. package/lib/auth/project-config.d.ts +16 -2
  50. package/lib/auth/project-config.js +31 -2
  51. package/lib/auth/tenant-manager.d.ts +1 -1
  52. package/lib/auth/tenant-manager.js +1 -1
  53. package/lib/auth/tenant.d.ts +1 -1
  54. package/lib/auth/tenant.js +1 -1
  55. package/lib/auth/token-generator.d.ts +1 -1
  56. package/lib/auth/token-generator.js +1 -1
  57. package/lib/auth/token-verifier.d.ts +1 -1
  58. package/lib/auth/token-verifier.js +1 -1
  59. package/lib/auth/user-import-builder.d.ts +1 -1
  60. package/lib/auth/user-import-builder.js +1 -1
  61. package/lib/auth/user-record.d.ts +1 -1
  62. package/lib/auth/user-record.js +1 -1
  63. package/lib/credential/index.d.ts +1 -1
  64. package/lib/credential/index.js +1 -1
  65. package/lib/database/database-namespace.d.ts +1 -1
  66. package/lib/database/database-namespace.js +1 -1
  67. package/lib/database/database.d.ts +1 -1
  68. package/lib/database/database.js +1 -1
  69. package/lib/database/index.d.ts +1 -1
  70. package/lib/database/index.js +1 -1
  71. package/lib/default-namespace.d.ts +1 -1
  72. package/lib/default-namespace.js +1 -1
  73. package/lib/eventarc/cloudevent.d.ts +1 -1
  74. package/lib/eventarc/cloudevent.js +1 -1
  75. package/lib/eventarc/eventarc-client-internal.d.ts +1 -1
  76. package/lib/eventarc/eventarc-client-internal.js +1 -1
  77. package/lib/eventarc/eventarc-utils.d.ts +1 -1
  78. package/lib/eventarc/eventarc-utils.js +1 -1
  79. package/lib/eventarc/eventarc.d.ts +1 -1
  80. package/lib/eventarc/eventarc.js +1 -1
  81. package/lib/eventarc/index.d.ts +1 -1
  82. package/lib/eventarc/index.js +1 -1
  83. package/lib/extensions/extensions-api-client-internal.d.ts +1 -1
  84. package/lib/extensions/extensions-api-client-internal.js +1 -1
  85. package/lib/extensions/extensions-api.d.ts +1 -1
  86. package/lib/extensions/extensions-api.js +1 -1
  87. package/lib/extensions/extensions.d.ts +1 -1
  88. package/lib/extensions/extensions.js +1 -1
  89. package/lib/extensions/index.d.ts +1 -1
  90. package/lib/extensions/index.js +1 -1
  91. package/lib/firebase-namespace-api.d.ts +1 -1
  92. package/lib/firebase-namespace-api.js +1 -1
  93. package/lib/firestore/firestore-internal.d.ts +1 -1
  94. package/lib/firestore/firestore-internal.js +1 -1
  95. package/lib/firestore/firestore-namespace.d.ts +1 -1
  96. package/lib/firestore/firestore-namespace.js +1 -1
  97. package/lib/firestore/index.d.ts +1 -1
  98. package/lib/firestore/index.js +1 -1
  99. package/lib/functions/functions-api-client-internal.d.ts +1 -1
  100. package/lib/functions/functions-api-client-internal.js +1 -1
  101. package/lib/functions/functions-api.d.ts +1 -1
  102. package/lib/functions/functions-api.js +1 -1
  103. package/lib/functions/functions.d.ts +1 -1
  104. package/lib/functions/functions.js +1 -1
  105. package/lib/functions/index.d.ts +1 -1
  106. package/lib/functions/index.js +1 -1
  107. package/lib/index.d.ts +1 -1
  108. package/lib/index.js +1 -1
  109. package/lib/installations/index.d.ts +1 -1
  110. package/lib/installations/index.js +1 -1
  111. package/lib/installations/installations-namespace.d.ts +1 -1
  112. package/lib/installations/installations-namespace.js +1 -1
  113. package/lib/installations/installations-request-handler.d.ts +1 -1
  114. package/lib/installations/installations-request-handler.js +1 -1
  115. package/lib/installations/installations.d.ts +1 -1
  116. package/lib/installations/installations.js +1 -1
  117. package/lib/instance-id/index.d.ts +1 -1
  118. package/lib/instance-id/index.js +1 -1
  119. package/lib/instance-id/instance-id-namespace.d.ts +1 -1
  120. package/lib/instance-id/instance-id-namespace.js +1 -1
  121. package/lib/instance-id/instance-id.d.ts +1 -1
  122. package/lib/instance-id/instance-id.js +1 -1
  123. package/lib/machine-learning/index.d.ts +1 -1
  124. package/lib/machine-learning/index.js +1 -1
  125. package/lib/machine-learning/machine-learning-api-client.d.ts +1 -1
  126. package/lib/machine-learning/machine-learning-api-client.js +1 -1
  127. package/lib/machine-learning/machine-learning-namespace.d.ts +1 -1
  128. package/lib/machine-learning/machine-learning-namespace.js +1 -1
  129. package/lib/machine-learning/machine-learning-utils.d.ts +1 -1
  130. package/lib/machine-learning/machine-learning-utils.js +1 -1
  131. package/lib/machine-learning/machine-learning.d.ts +1 -1
  132. package/lib/machine-learning/machine-learning.js +1 -1
  133. package/lib/messaging/batch-request-internal.d.ts +1 -1
  134. package/lib/messaging/batch-request-internal.js +1 -1
  135. package/lib/messaging/index.d.ts +1 -1
  136. package/lib/messaging/index.js +1 -1
  137. package/lib/messaging/messaging-api-request-internal.d.ts +1 -1
  138. package/lib/messaging/messaging-api-request-internal.js +1 -1
  139. package/lib/messaging/messaging-api.d.ts +10 -1
  140. package/lib/messaging/messaging-api.js +1 -1
  141. package/lib/messaging/messaging-errors-internal.d.ts +1 -1
  142. package/lib/messaging/messaging-errors-internal.js +1 -1
  143. package/lib/messaging/messaging-internal.d.ts +1 -1
  144. package/lib/messaging/messaging-internal.js +1 -1
  145. package/lib/messaging/messaging-namespace.d.ts +1 -1
  146. package/lib/messaging/messaging-namespace.js +1 -1
  147. package/lib/messaging/messaging.d.ts +5 -1
  148. package/lib/messaging/messaging.js +5 -1
  149. package/lib/project-management/android-app.d.ts +1 -1
  150. package/lib/project-management/android-app.js +1 -1
  151. package/lib/project-management/app-metadata.d.ts +1 -1
  152. package/lib/project-management/app-metadata.js +1 -1
  153. package/lib/project-management/index.d.ts +1 -1
  154. package/lib/project-management/index.js +1 -1
  155. package/lib/project-management/ios-app.d.ts +1 -1
  156. package/lib/project-management/ios-app.js +1 -1
  157. package/lib/project-management/project-management-api-request-internal.d.ts +1 -1
  158. package/lib/project-management/project-management-api-request-internal.js +1 -1
  159. package/lib/project-management/project-management-namespace.d.ts +1 -1
  160. package/lib/project-management/project-management-namespace.js +1 -1
  161. package/lib/project-management/project-management.d.ts +1 -1
  162. package/lib/project-management/project-management.js +1 -1
  163. package/lib/remote-config/index.d.ts +1 -1
  164. package/lib/remote-config/index.js +1 -1
  165. package/lib/remote-config/remote-config-api-client-internal.d.ts +1 -1
  166. package/lib/remote-config/remote-config-api-client-internal.js +1 -1
  167. package/lib/remote-config/remote-config-api.d.ts +1 -1
  168. package/lib/remote-config/remote-config-api.js +1 -1
  169. package/lib/remote-config/remote-config-namespace.d.ts +1 -1
  170. package/lib/remote-config/remote-config-namespace.js +1 -1
  171. package/lib/remote-config/remote-config.d.ts +1 -1
  172. package/lib/remote-config/remote-config.js +1 -1
  173. package/lib/security-rules/index.d.ts +1 -1
  174. package/lib/security-rules/index.js +1 -1
  175. package/lib/security-rules/security-rules-api-client-internal.d.ts +1 -1
  176. package/lib/security-rules/security-rules-api-client-internal.js +1 -1
  177. package/lib/security-rules/security-rules-internal.d.ts +1 -1
  178. package/lib/security-rules/security-rules-internal.js +1 -1
  179. package/lib/security-rules/security-rules-namespace.d.ts +1 -1
  180. package/lib/security-rules/security-rules-namespace.js +1 -1
  181. package/lib/security-rules/security-rules.d.ts +1 -1
  182. package/lib/security-rules/security-rules.js +1 -1
  183. package/lib/storage/index.d.ts +1 -1
  184. package/lib/storage/index.js +1 -1
  185. package/lib/storage/storage-namespace.d.ts +1 -1
  186. package/lib/storage/storage-namespace.js +1 -1
  187. package/lib/storage/storage.d.ts +1 -1
  188. package/lib/storage/storage.js +1 -1
  189. package/lib/utils/api-request.d.ts +1 -1
  190. package/lib/utils/api-request.js +1 -1
  191. package/lib/utils/crypto-signer.d.ts +1 -1
  192. package/lib/utils/crypto-signer.js +1 -1
  193. package/lib/utils/deep-copy.d.ts +1 -1
  194. package/lib/utils/deep-copy.js +1 -1
  195. package/lib/utils/error.d.ts +1 -1
  196. package/lib/utils/error.js +1 -1
  197. package/lib/utils/index.d.ts +1 -1
  198. package/lib/utils/index.js +1 -1
  199. package/lib/utils/jwt.d.ts +1 -1
  200. package/lib/utils/jwt.js +1 -1
  201. package/lib/utils/validator.d.ts +1 -1
  202. package/lib/utils/validator.js +1 -1
  203. package/package.json +5 -5
package/lib/app/core.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.5.0 */
1
+ /*! firebase-admin v11.6.0 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2021 Google Inc.
package/lib/app/core.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.5.0 */
1
+ /*! firebase-admin v11.6.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.5.0 */
1
+ /*! firebase-admin v11.6.0 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2021 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.5.0 */
1
+ /*! firebase-admin v11.6.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.5.0 */
1
+ /*! firebase-admin v11.6.0 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2020 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.5.0 */
1
+ /*! firebase-admin v11.6.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.5.0 */
1
+ /*! firebase-admin v11.6.0 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2021 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.5.0 */
1
+ /*! firebase-admin v11.6.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.5.0 */
1
+ /*! firebase-admin v11.6.0 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2017 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.5.0 */
1
+ /*! firebase-admin v11.6.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.5.0 */
1
+ /*! firebase-admin v11.6.0 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2017 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.5.0 */
1
+ /*! firebase-admin v11.6.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.5.0 */
1
+ /*! firebase-admin v11.6.0 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2021 Google Inc.
package/lib/app/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.5.0 */
1
+ /*! firebase-admin v11.6.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.5.0 */
1
+ /*! firebase-admin v11.6.0 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2021 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.5.0 */
1
+ /*! firebase-admin v11.6.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.5.0 */
1
+ /*! firebase-admin v11.6.0 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2021 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.5.0 */
1
+ /*! firebase-admin v11.6.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.5.0 */
1
+ /*! firebase-admin v11.6.0 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2021 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.5.0 */
1
+ /*! firebase-admin v11.6.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.5.0 */
1
+ /*! firebase-admin v11.6.0 */
2
2
  /*!
3
3
  * Copyright 2021 Google Inc.
4
4
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.5.0 */
1
+ /*! firebase-admin v11.6.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2021 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.5.0 */
1
+ /*! firebase-admin v11.6.0 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2021 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.5.0 */
1
+ /*! firebase-admin v11.6.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.5.0 */
1
+ /*! firebase-admin v11.6.0 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2021 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.5.0 */
1
+ /*! firebase-admin v11.6.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.5.0 */
1
+ /*! firebase-admin v11.6.0 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2021 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.5.0 */
1
+ /*! firebase-admin v11.6.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.5.0 */
1
+ /*! firebase-admin v11.6.0 */
2
2
  /*!
3
3
  * Copyright 2021 Google Inc.
4
4
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.5.0 */
1
+ /*! firebase-admin v11.6.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2021 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.5.0 */
1
+ /*! firebase-admin v11.6.0 */
2
2
  /*!
3
3
  * Copyright 2018 Google Inc.
4
4
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.5.0 */
1
+ /*! firebase-admin v11.6.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2018 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.5.0 */
1
+ /*! firebase-admin v11.6.0 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2017 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.5.0 */
1
+ /*! firebase-admin v11.6.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.5.0 */
1
+ /*! firebase-admin v11.6.0 */
2
2
  /*!
3
3
  * Copyright 2018 Google Inc.
4
4
  *
@@ -386,6 +386,7 @@ declare type AuthFactorServerType = 'PHONE_SMS';
386
386
  export interface MultiFactorAuthServerConfig {
387
387
  state?: MultiFactorConfigState;
388
388
  enabledProviders?: AuthFactorServerType[];
389
+ providerConfigs?: MultiFactorProviderConfig[];
389
390
  }
390
391
  /**
391
392
  * Identifies a second factor type.
@@ -410,22 +411,31 @@ export interface MultiFactorConfig {
410
411
  * Currently only ‘phone’ is supported.
411
412
  */
412
413
  factorIds?: AuthFactorType[];
414
+ /**
415
+ * A list of multi-factor provider configurations.
416
+ * MFA providers (except phone) indicate whether they're enabled through this field. */
417
+ providerConfigs?: MultiFactorProviderConfig[];
418
+ }
419
+ /**
420
+ * Interface representing a multi-factor auth provider configuration.
421
+ * This interface is used for second factor auth providers other than SMS.
422
+ * Currently, only TOTP is supported.
423
+ */ export interface MultiFactorProviderConfig {
424
+ /**
425
+ * Indicates whether this multi-factor provider is enabled or disabled. */
426
+ state: MultiFactorConfigState;
427
+ /**
428
+ * TOTP multi-factor provider config. */
429
+ totpProviderConfig?: TotpMultiFactorProviderConfig;
413
430
  }
414
431
  /**
415
- * Defines the multi-factor config class used to convert client side MultiFactorConfig
416
- * to a format that is understood by the Auth server.
432
+ * Interface representing configuration settings for TOTP second factor auth.
417
433
  */
418
- export declare class MultiFactorAuthConfig implements MultiFactorConfig {
419
- readonly state: MultiFactorConfigState;
420
- readonly factorIds: AuthFactorType[];
434
+ export interface TotpMultiFactorProviderConfig {
421
435
  /**
422
- * Validates the MultiFactorConfig options object. Throws an error on failure.
423
- *
424
- * @param options - The options object to validate.
425
- */
426
- private static validate;
427
- /** @returns The plain object representation of the multi-factor config instance. */
428
- toJSON(): object;
436
+ * The allowed number of adjacent intervals that will be used for verification
437
+ * to compensate for clock skew. */
438
+ adjacentIntervals?: number;
429
439
  }
430
440
  /**
431
441
  * Validates the provided map of test phone number / code pairs.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.5.0 */
1
+ /*! firebase-admin v11.6.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2018 Google Inc.
@@ -35,6 +35,8 @@ const AUTH_FACTOR_SERVER_TO_CLIENT_TYPE = Object.keys(AUTH_FACTOR_CLIENT_TO_SERV
35
35
  /**
36
36
  * Defines the multi-factor config class used to convert client side MultiFactorConfig
37
37
  * to a format that is understood by the Auth server.
38
+ *
39
+ * @internal
38
40
  */
39
41
  class MultiFactorAuthConfig {
40
42
  /**
@@ -58,6 +60,18 @@ class MultiFactorAuthConfig {
58
60
  this.factorIds.push(AUTH_FACTOR_SERVER_TO_CLIENT_TYPE[enabledProvider]);
59
61
  }
60
62
  });
63
+ this.providerConfigs = [];
64
+ (response.providerConfigs || []).forEach((providerConfig) => {
65
+ if (typeof providerConfig !== 'undefined') {
66
+ if (typeof providerConfig.state === 'undefined' ||
67
+ typeof providerConfig.totpProviderConfig === 'undefined' ||
68
+ (typeof providerConfig.totpProviderConfig.adjacentIntervals !== 'undefined' &&
69
+ typeof providerConfig.totpProviderConfig.adjacentIntervals !== 'number')) {
70
+ throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INTERNAL_ERROR, 'INTERNAL ASSERT FAILED: Invalid multi-factor configuration response');
71
+ }
72
+ this.providerConfigs.push(providerConfig);
73
+ }
74
+ });
61
75
  }
62
76
  /**
63
77
  * Static method to convert a client side request to a MultiFactorAuthServerConfig.
@@ -85,6 +99,9 @@ class MultiFactorAuthConfig {
85
99
  request.enabledProviders = [];
86
100
  }
87
101
  }
102
+ if (Object.prototype.hasOwnProperty.call(options, 'providerConfigs')) {
103
+ request.providerConfigs = options.providerConfigs;
104
+ }
88
105
  return request;
89
106
  }
90
107
  /**
@@ -96,6 +113,7 @@ class MultiFactorAuthConfig {
96
113
  const validKeys = {
97
114
  state: true,
98
115
  factorIds: true,
116
+ providerConfigs: true,
99
117
  };
100
118
  if (!validator.isNonNullObject(options)) {
101
119
  throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_CONFIG, '"MultiFactorConfig" must be a non-null object.');
@@ -123,12 +141,57 @@ class MultiFactorAuthConfig {
123
141
  }
124
142
  });
125
143
  }
144
+ if (typeof options.providerConfigs !== 'undefined') {
145
+ if (!validator.isArray(options.providerConfigs)) {
146
+ throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_CONFIG, '"MultiFactorConfig.providerConfigs" must be an array of valid "MultiFactorProviderConfig."');
147
+ }
148
+ //Validate content of array.
149
+ options.providerConfigs.forEach((multiFactorProviderConfig) => {
150
+ if (typeof multiFactorProviderConfig === 'undefined' || !validator.isObject(multiFactorProviderConfig)) {
151
+ throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_CONFIG, `"${multiFactorProviderConfig}" is not a valid "MultiFactorProviderConfig" type.`);
152
+ }
153
+ const validProviderConfigKeys = {
154
+ state: true,
155
+ totpProviderConfig: true,
156
+ };
157
+ for (const key in multiFactorProviderConfig) {
158
+ if (!(key in validProviderConfigKeys)) {
159
+ throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_CONFIG, `"${key}" is not a valid ProviderConfig parameter.`);
160
+ }
161
+ }
162
+ if (typeof multiFactorProviderConfig.state === 'undefined' ||
163
+ (multiFactorProviderConfig.state !== 'ENABLED' &&
164
+ multiFactorProviderConfig.state !== 'DISABLED')) {
165
+ throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_CONFIG, '"MultiFactorConfig.providerConfigs.state" must be either "ENABLED" or "DISABLED".');
166
+ }
167
+ // Since TOTP is the only provider config available right now, not defining it will lead into an error
168
+ if (typeof multiFactorProviderConfig.totpProviderConfig === 'undefined') {
169
+ throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_CONFIG, '"MultiFactorConfig.providerConfigs.totpProviderConfig" must be defined.');
170
+ }
171
+ const validTotpProviderConfigKeys = {
172
+ adjacentIntervals: true,
173
+ };
174
+ for (const key in multiFactorProviderConfig.totpProviderConfig) {
175
+ if (!(key in validTotpProviderConfigKeys)) {
176
+ throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_CONFIG, `"${key}" is not a valid TotpProviderConfig parameter.`);
177
+ }
178
+ }
179
+ const adjIntervals = multiFactorProviderConfig.totpProviderConfig.adjacentIntervals;
180
+ if (typeof adjIntervals !== 'undefined' &&
181
+ (!Number.isInteger(adjIntervals) || adjIntervals < 0 || adjIntervals > 10)) {
182
+ throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_ARGUMENT, '"MultiFactorConfig.providerConfigs.totpProviderConfig.adjacentIntervals" must' +
183
+ ' be a valid number between 0 and 10 (both inclusive).');
184
+ }
185
+ });
186
+ }
126
187
  }
127
- /** @returns The plain object representation of the multi-factor config instance. */
188
+ /** Converts MultiFactorConfig to JSON object
189
+ * @returns The plain object representation of the multi-factor config instance. */
128
190
  toJSON() {
129
191
  return {
130
192
  state: this.state,
131
193
  factorIds: this.factorIds,
194
+ providerConfigs: this.providerConfigs,
132
195
  };
133
196
  }
134
197
  }
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.5.0 */
1
+ /*! firebase-admin v11.6.0 */
2
2
  /*!
3
3
  * Copyright 2021 Google Inc.
4
4
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.5.0 */
1
+ /*! firebase-admin v11.6.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2021 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.5.0 */
1
+ /*! firebase-admin v11.6.0 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2017 Google Inc.
package/lib/auth/auth.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.5.0 */
1
+ /*! firebase-admin v11.6.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.5.0 */
1
+ /*! firebase-admin v11.6.0 */
2
2
  /*!
3
3
  * Copyright 2021 Google Inc.
4
4
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.5.0 */
1
+ /*! firebase-admin v11.6.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2021 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.5.0 */
1
+ /*! firebase-admin v11.6.0 */
2
2
  /*!
3
3
  * Copyright 2020 Google Inc.
4
4
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.5.0 */
1
+ /*! firebase-admin v11.6.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2020 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.5.0 */
1
+ /*! firebase-admin v11.6.0 */
2
2
  /*!
3
3
  * Copyright 2020 Google Inc.
4
4
  *
@@ -45,7 +45,7 @@ import { Auth } from './auth';
45
45
  export declare function getAuth(app?: App): Auth;
46
46
  export { ActionCodeSettings } from './action-code-settings-builder';
47
47
  export { Auth, } from './auth';
48
- export { AllowByDefault, AllowByDefaultWrap, AllowlistOnly, AllowlistOnlyWrap, AuthFactorType, AuthProviderConfig, AuthProviderConfigFilter, BaseAuthProviderConfig, BaseCreateMultiFactorInfoRequest, BaseUpdateMultiFactorInfoRequest, CreateMultiFactorInfoRequest, CreatePhoneMultiFactorInfoRequest, CreateRequest, EmailSignInProviderConfig, ListProviderConfigResults, MultiFactorConfig, MultiFactorConfigState, MultiFactorCreateSettings, MultiFactorUpdateSettings, OAuthResponseType, OIDCAuthProviderConfig, OIDCUpdateAuthProviderRequest, SAMLAuthProviderConfig, SAMLUpdateAuthProviderRequest, SmsRegionConfig, UserProvider, UpdateAuthProviderRequest, UpdateMultiFactorInfoRequest, UpdatePhoneMultiFactorInfoRequest, UpdateRequest, } from './auth-config';
48
+ export { AllowByDefault, AllowByDefaultWrap, AllowlistOnly, AllowlistOnlyWrap, AuthFactorType, AuthProviderConfig, AuthProviderConfigFilter, BaseAuthProviderConfig, BaseCreateMultiFactorInfoRequest, BaseUpdateMultiFactorInfoRequest, CreateMultiFactorInfoRequest, CreatePhoneMultiFactorInfoRequest, CreateRequest, EmailSignInProviderConfig, ListProviderConfigResults, MultiFactorConfig, MultiFactorConfigState, MultiFactorCreateSettings, MultiFactorUpdateSettings, MultiFactorProviderConfig, OAuthResponseType, OIDCAuthProviderConfig, OIDCUpdateAuthProviderRequest, SAMLAuthProviderConfig, SAMLUpdateAuthProviderRequest, SmsRegionConfig, UserProvider, UpdateAuthProviderRequest, UpdateMultiFactorInfoRequest, UpdatePhoneMultiFactorInfoRequest, UpdateRequest, TotpMultiFactorProviderConfig, } from './auth-config';
49
49
  export { BaseAuth, DeleteUsersResult, GetUsersResult, ListUsersResult, SessionCookieOptions, } from './base-auth';
50
50
  export { EmailIdentifier, PhoneIdentifier, ProviderIdentifier, UidIdentifier, UserIdentifier, } from './identifier';
51
51
  export { CreateTenantRequest, Tenant, UpdateTenantRequest, } from './tenant';
package/lib/auth/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.5.0 */
1
+ /*! firebase-admin v11.6.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2020 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.5.0 */
1
+ /*! firebase-admin v11.6.0 */
2
2
  import { ProjectConfig, UpdateProjectConfigRequest } from './project-config';
3
3
  /**
4
4
  * Defines the project config manager used to help manage project config related operations.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.5.0 */
1
+ /*! firebase-admin v11.6.0 */
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.ProjectConfigManager = void 0;
@@ -1,5 +1,5 @@
1
- /*! firebase-admin v11.5.0 */
2
- import { SmsRegionConfig } from './auth-config';
1
+ /*! firebase-admin v11.6.0 */
2
+ import { SmsRegionConfig, MultiFactorConfig, MultiFactorAuthServerConfig } from './auth-config';
3
3
  /**
4
4
  * Interface representing the properties to update on the provided project config.
5
5
  */
@@ -8,6 +8,10 @@ export interface UpdateProjectConfigRequest {
8
8
  * The SMS configuration to update on the project.
9
9
  */
10
10
  smsRegionConfig?: SmsRegionConfig;
11
+ /**
12
+ * The multi-factor auth configuration to update on the project.
13
+ */
14
+ multiFactorConfig?: MultiFactorConfig;
11
15
  }
12
16
  /**
13
17
  * Response received from getting or updating a project config.
@@ -15,6 +19,7 @@ export interface UpdateProjectConfigRequest {
15
19
  */
16
20
  export interface ProjectConfigServerResponse {
17
21
  smsRegionConfig?: SmsRegionConfig;
22
+ mfa?: MultiFactorAuthServerConfig;
18
23
  }
19
24
  /**
20
25
  * Request sent to update project config.
@@ -22,6 +27,7 @@ export interface ProjectConfigServerResponse {
22
27
  */
23
28
  export interface ProjectConfigClientRequest {
24
29
  smsRegionConfig?: SmsRegionConfig;
30
+ mfa?: MultiFactorAuthServerConfig;
25
31
  }
26
32
  /**
27
33
  * Represents a project configuration.
@@ -33,6 +39,14 @@ export declare class ProjectConfig {
33
39
  * This is based on the calling code of the destination phone number.
34
40
  */
35
41
  readonly smsRegionConfig?: SmsRegionConfig;
42
+ /**
43
+ * The project's multi-factor auth configuration.
44
+ * Supports only phone and TOTP.
45
+ */ private readonly multiFactorConfig_?;
46
+ /**
47
+ * The multi-factor auth configuration.
48
+ */
49
+ get multiFactorConfig(): MultiFactorConfig | undefined;
36
50
  /**
37
51
  * Validates a project config options object. Throws an error on failure.
38
52
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.5.0 */
1
+ /*! firebase-admin v11.6.0 */
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.ProjectConfig = void 0;
@@ -36,6 +36,17 @@ class ProjectConfig {
36
36
  if (typeof response.smsRegionConfig !== 'undefined') {
37
37
  this.smsRegionConfig = response.smsRegionConfig;
38
38
  }
39
+ //Backend API returns "mfa" in case of project config and "mfaConfig" in case of tenant config.
40
+ //The SDK exposes it as multiFactorConfig always.
41
+ if (typeof response.mfa !== 'undefined') {
42
+ this.multiFactorConfig_ = new auth_config_1.MultiFactorAuthConfig(response.mfa);
43
+ }
44
+ }
45
+ /**
46
+ * The multi-factor auth configuration.
47
+ */
48
+ get multiFactorConfig() {
49
+ return this.multiFactorConfig_;
39
50
  }
40
51
  /**
41
52
  * Validates a project config options object. Throws an error on failure.
@@ -48,6 +59,7 @@ class ProjectConfig {
48
59
  }
49
60
  const validKeys = {
50
61
  smsRegionConfig: true,
62
+ multiFactorConfig: true,
51
63
  };
52
64
  // Check for unsupported top level attributes.
53
65
  for (const key in request) {
@@ -59,6 +71,10 @@ class ProjectConfig {
59
71
  if (typeof request.smsRegionConfig !== 'undefined') {
60
72
  auth_config_1.SmsRegionsAuthConfig.validate(request.smsRegionConfig);
61
73
  }
74
+ // Validate Multi Factor Config if provided
75
+ if (typeof request.multiFactorConfig !== 'undefined') {
76
+ auth_config_1.MultiFactorAuthConfig.validate(request.multiFactorConfig);
77
+ }
62
78
  }
63
79
  /**
64
80
  * Build the corresponding server request for a UpdateProjectConfigRequest object.
@@ -69,7 +85,16 @@ class ProjectConfig {
69
85
  */
70
86
  static buildServerRequest(configOptions) {
71
87
  ProjectConfig.validate(configOptions);
72
- return configOptions;
88
+ const request = configOptions;
89
+ if (configOptions.multiFactorConfig !== undefined) {
90
+ request.mfa = auth_config_1.MultiFactorAuthConfig.buildServerRequest(configOptions.multiFactorConfig);
91
+ }
92
+ // Backend API returns "mfa" in case of project config and "mfaConfig" in case of tenant config.
93
+ // The SDK exposes it as multiFactorConfig always.
94
+ // See https://cloud.google.com/identity-platform/docs/reference/rest/v2/projects.tenants#resource:-tenant
95
+ // and https://cloud.google.com/identity-platform/docs/reference/rest/v2/Config
96
+ delete request.multiFactorConfig;
97
+ return request;
73
98
  }
74
99
  /**
75
100
  * Returns a JSON-serializable representation of this object.
@@ -80,10 +105,14 @@ class ProjectConfig {
80
105
  // JSON serialization
81
106
  const json = {
82
107
  smsRegionConfig: (0, deep_copy_1.deepCopy)(this.smsRegionConfig),
108
+ multiFactorConfig: (0, deep_copy_1.deepCopy)(this.multiFactorConfig),
83
109
  };
84
110
  if (typeof json.smsRegionConfig === 'undefined') {
85
111
  delete json.smsRegionConfig;
86
112
  }
113
+ if (typeof json.multiFactorConfig === 'undefined') {
114
+ delete json.multiFactorConfig;
115
+ }
87
116
  return json;
88
117
  }
89
118
  }
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v11.5.0 */
1
+ /*! firebase-admin v11.6.0 */
2
2
  /*!
3
3
  * Copyright 2019 Google Inc.
4
4
  *