firebase-admin 12.5.0 → 12.7.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 (218) 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 +5 -4
  35. package/lib/auth/auth-config.d.ts +41 -17
  36. package/lib/auth/auth-config.js +112 -25
  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 +8 -8
  50. package/lib/auth/project-config.js +9 -9
  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 +4 -4
  54. package/lib/auth/tenant.js +4 -4
  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/data-connect/data-connect-api-client-internal.d.ts +32 -0
  66. package/lib/data-connect/data-connect-api-client-internal.js +182 -0
  67. package/lib/data-connect/data-connect-api.d.ts +52 -0
  68. package/lib/data-connect/data-connect-api.js +19 -0
  69. package/lib/data-connect/data-connect.d.ts +59 -0
  70. package/lib/data-connect/data-connect.js +87 -0
  71. package/lib/data-connect/index.d.ts +61 -0
  72. package/lib/data-connect/index.js +71 -0
  73. package/lib/database/database-namespace.d.ts +1 -1
  74. package/lib/database/database-namespace.js +1 -1
  75. package/lib/database/database.d.ts +1 -1
  76. package/lib/database/database.js +1 -1
  77. package/lib/database/index.d.ts +1 -1
  78. package/lib/database/index.js +1 -1
  79. package/lib/default-namespace.d.ts +1 -1
  80. package/lib/default-namespace.js +1 -1
  81. package/lib/esm/data-connect/index.js +4 -0
  82. package/lib/eventarc/cloudevent.d.ts +1 -1
  83. package/lib/eventarc/cloudevent.js +1 -1
  84. package/lib/eventarc/eventarc-client-internal.d.ts +1 -1
  85. package/lib/eventarc/eventarc-client-internal.js +1 -1
  86. package/lib/eventarc/eventarc-utils.d.ts +1 -1
  87. package/lib/eventarc/eventarc-utils.js +1 -1
  88. package/lib/eventarc/eventarc.d.ts +1 -1
  89. package/lib/eventarc/eventarc.js +1 -1
  90. package/lib/eventarc/index.d.ts +1 -1
  91. package/lib/eventarc/index.js +1 -1
  92. package/lib/extensions/extensions-api-client-internal.d.ts +1 -1
  93. package/lib/extensions/extensions-api-client-internal.js +1 -1
  94. package/lib/extensions/extensions-api.d.ts +1 -1
  95. package/lib/extensions/extensions-api.js +1 -1
  96. package/lib/extensions/extensions.d.ts +1 -1
  97. package/lib/extensions/extensions.js +1 -1
  98. package/lib/extensions/index.d.ts +1 -1
  99. package/lib/extensions/index.js +1 -1
  100. package/lib/firebase-namespace-api.d.ts +1 -1
  101. package/lib/firebase-namespace-api.js +1 -1
  102. package/lib/firestore/firestore-internal.d.ts +1 -1
  103. package/lib/firestore/firestore-internal.js +1 -1
  104. package/lib/firestore/firestore-namespace.d.ts +1 -1
  105. package/lib/firestore/firestore-namespace.js +1 -1
  106. package/lib/firestore/index.d.ts +1 -1
  107. package/lib/firestore/index.js +1 -1
  108. package/lib/functions/functions-api-client-internal.d.ts +1 -1
  109. package/lib/functions/functions-api-client-internal.js +5 -5
  110. package/lib/functions/functions-api.d.ts +1 -1
  111. package/lib/functions/functions-api.js +1 -1
  112. package/lib/functions/functions.d.ts +1 -1
  113. package/lib/functions/functions.js +1 -1
  114. package/lib/functions/index.d.ts +1 -1
  115. package/lib/functions/index.js +1 -1
  116. package/lib/index.d.ts +1 -1
  117. package/lib/index.js +1 -1
  118. package/lib/installations/index.d.ts +1 -1
  119. package/lib/installations/index.js +1 -1
  120. package/lib/installations/installations-namespace.d.ts +1 -1
  121. package/lib/installations/installations-namespace.js +1 -1
  122. package/lib/installations/installations-request-handler.d.ts +1 -1
  123. package/lib/installations/installations-request-handler.js +1 -1
  124. package/lib/installations/installations.d.ts +1 -1
  125. package/lib/installations/installations.js +1 -1
  126. package/lib/instance-id/index.d.ts +1 -1
  127. package/lib/instance-id/index.js +1 -1
  128. package/lib/instance-id/instance-id-namespace.d.ts +1 -1
  129. package/lib/instance-id/instance-id-namespace.js +1 -1
  130. package/lib/instance-id/instance-id.d.ts +1 -1
  131. package/lib/instance-id/instance-id.js +1 -1
  132. package/lib/machine-learning/index.d.ts +1 -1
  133. package/lib/machine-learning/index.js +1 -1
  134. package/lib/machine-learning/machine-learning-api-client.d.ts +1 -1
  135. package/lib/machine-learning/machine-learning-api-client.js +1 -1
  136. package/lib/machine-learning/machine-learning-namespace.d.ts +1 -1
  137. package/lib/machine-learning/machine-learning-namespace.js +1 -1
  138. package/lib/machine-learning/machine-learning-utils.d.ts +1 -1
  139. package/lib/machine-learning/machine-learning-utils.js +1 -1
  140. package/lib/machine-learning/machine-learning.d.ts +1 -1
  141. package/lib/machine-learning/machine-learning.js +1 -1
  142. package/lib/messaging/batch-request-internal.d.ts +1 -1
  143. package/lib/messaging/batch-request-internal.js +1 -1
  144. package/lib/messaging/index.d.ts +1 -1
  145. package/lib/messaging/index.js +1 -1
  146. package/lib/messaging/messaging-api-request-internal.d.ts +1 -1
  147. package/lib/messaging/messaging-api-request-internal.js +3 -1
  148. package/lib/messaging/messaging-api.d.ts +1 -1
  149. package/lib/messaging/messaging-api.js +1 -1
  150. package/lib/messaging/messaging-errors-internal.d.ts +1 -1
  151. package/lib/messaging/messaging-errors-internal.js +1 -1
  152. package/lib/messaging/messaging-internal.d.ts +1 -1
  153. package/lib/messaging/messaging-internal.js +1 -1
  154. package/lib/messaging/messaging-namespace.d.ts +1 -1
  155. package/lib/messaging/messaging-namespace.js +1 -1
  156. package/lib/messaging/messaging.d.ts +1 -1
  157. package/lib/messaging/messaging.js +1 -1
  158. package/lib/project-management/android-app.d.ts +1 -1
  159. package/lib/project-management/android-app.js +1 -1
  160. package/lib/project-management/app-metadata.d.ts +1 -1
  161. package/lib/project-management/app-metadata.js +1 -1
  162. package/lib/project-management/index.d.ts +1 -1
  163. package/lib/project-management/index.js +1 -1
  164. package/lib/project-management/ios-app.d.ts +1 -1
  165. package/lib/project-management/ios-app.js +1 -1
  166. package/lib/project-management/project-management-api-request-internal.d.ts +1 -1
  167. package/lib/project-management/project-management-api-request-internal.js +1 -1
  168. package/lib/project-management/project-management-namespace.d.ts +1 -1
  169. package/lib/project-management/project-management-namespace.js +1 -1
  170. package/lib/project-management/project-management.d.ts +1 -1
  171. package/lib/project-management/project-management.js +1 -1
  172. package/lib/remote-config/condition-evaluator-internal.d.ts +1 -1
  173. package/lib/remote-config/condition-evaluator-internal.js +1 -1
  174. package/lib/remote-config/index.d.ts +1 -1
  175. package/lib/remote-config/index.js +1 -1
  176. package/lib/remote-config/internal/value-impl.d.ts +1 -1
  177. package/lib/remote-config/internal/value-impl.js +1 -1
  178. package/lib/remote-config/remote-config-api-client-internal.d.ts +1 -1
  179. package/lib/remote-config/remote-config-api-client-internal.js +1 -1
  180. package/lib/remote-config/remote-config-api.d.ts +1 -1
  181. package/lib/remote-config/remote-config-api.js +1 -1
  182. package/lib/remote-config/remote-config-namespace.d.ts +1 -1
  183. package/lib/remote-config/remote-config-namespace.js +1 -1
  184. package/lib/remote-config/remote-config.d.ts +1 -1
  185. package/lib/remote-config/remote-config.js +1 -1
  186. package/lib/security-rules/index.d.ts +1 -1
  187. package/lib/security-rules/index.js +1 -1
  188. package/lib/security-rules/security-rules-api-client-internal.d.ts +1 -1
  189. package/lib/security-rules/security-rules-api-client-internal.js +1 -1
  190. package/lib/security-rules/security-rules-internal.d.ts +1 -1
  191. package/lib/security-rules/security-rules-internal.js +1 -1
  192. package/lib/security-rules/security-rules-namespace.d.ts +1 -1
  193. package/lib/security-rules/security-rules-namespace.js +1 -1
  194. package/lib/security-rules/security-rules.d.ts +1 -1
  195. package/lib/security-rules/security-rules.js +1 -1
  196. package/lib/storage/index.d.ts +1 -1
  197. package/lib/storage/index.js +1 -1
  198. package/lib/storage/storage-namespace.d.ts +1 -1
  199. package/lib/storage/storage-namespace.js +1 -1
  200. package/lib/storage/storage.d.ts +1 -1
  201. package/lib/storage/storage.js +1 -1
  202. package/lib/storage/utils.d.ts +1 -1
  203. package/lib/storage/utils.js +1 -1
  204. package/lib/utils/api-request.d.ts +1 -1
  205. package/lib/utils/api-request.js +1 -1
  206. package/lib/utils/crypto-signer.d.ts +1 -1
  207. package/lib/utils/crypto-signer.js +1 -1
  208. package/lib/utils/deep-copy.d.ts +1 -1
  209. package/lib/utils/deep-copy.js +1 -1
  210. package/lib/utils/error.d.ts +1 -1
  211. package/lib/utils/error.js +1 -1
  212. package/lib/utils/index.d.ts +1 -1
  213. package/lib/utils/index.js +1 -1
  214. package/lib/utils/jwt.d.ts +1 -1
  215. package/lib/utils/jwt.js +1 -1
  216. package/lib/utils/validator.d.ts +1 -1
  217. package/lib/utils/validator.js +1 -1
  218. package/package.json +11 -3
package/lib/app/core.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.5.0 */
1
+ /*! firebase-admin v12.7.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 v12.5.0 */
1
+ /*! firebase-admin v12.7.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.5.0 */
1
+ /*! firebase-admin v12.7.0 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2021 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.5.0 */
1
+ /*! firebase-admin v12.7.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.5.0 */
1
+ /*! firebase-admin v12.7.0 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2020 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.5.0 */
1
+ /*! firebase-admin v12.7.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.5.0 */
1
+ /*! firebase-admin v12.7.0 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2021 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.5.0 */
1
+ /*! firebase-admin v12.7.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.5.0 */
1
+ /*! firebase-admin v12.7.0 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2017 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.5.0 */
1
+ /*! firebase-admin v12.7.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.5.0 */
1
+ /*! firebase-admin v12.7.0 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2017 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.5.0 */
1
+ /*! firebase-admin v12.7.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.5.0 */
1
+ /*! firebase-admin v12.7.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 v12.5.0 */
1
+ /*! firebase-admin v12.7.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.5.0 */
1
+ /*! firebase-admin v12.7.0 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2021 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.5.0 */
1
+ /*! firebase-admin v12.7.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.5.0 */
1
+ /*! firebase-admin v12.7.0 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2021 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.5.0 */
1
+ /*! firebase-admin v12.7.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.5.0 */
1
+ /*! firebase-admin v12.7.0 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2021 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.5.0 */
1
+ /*! firebase-admin v12.7.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.5.0 */
1
+ /*! firebase-admin v12.7.0 */
2
2
  /*!
3
3
  * Copyright 2021 Google Inc.
4
4
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.5.0 */
1
+ /*! firebase-admin v12.7.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2021 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.5.0 */
1
+ /*! firebase-admin v12.7.0 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2021 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.5.0 */
1
+ /*! firebase-admin v12.7.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.5.0 */
1
+ /*! firebase-admin v12.7.0 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2021 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.5.0 */
1
+ /*! firebase-admin v12.7.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.5.0 */
1
+ /*! firebase-admin v12.7.0 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2021 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.5.0 */
1
+ /*! firebase-admin v12.7.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.5.0 */
1
+ /*! firebase-admin v12.7.0 */
2
2
  /*!
3
3
  * Copyright 2021 Google Inc.
4
4
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.5.0 */
1
+ /*! firebase-admin v12.7.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2021 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.5.0 */
1
+ /*! firebase-admin v12.7.0 */
2
2
  /*!
3
3
  * Copyright 2018 Google Inc.
4
4
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.5.0 */
1
+ /*! firebase-admin v12.7.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2018 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.5.0 */
1
+ /*! firebase-admin v12.7.0 */
2
2
  /*!
3
3
  * @license
4
4
  * Copyright 2017 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.5.0 */
1
+ /*! firebase-admin v12.7.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -30,8 +30,9 @@ const identifier_1 = require("./identifier");
30
30
  const auth_config_1 = require("./auth-config");
31
31
  const project_config_1 = require("./project-config");
32
32
  /** Firebase Auth request header. */
33
- const FIREBASE_AUTH_HEADER = {
33
+ const FIREBASE_AUTH_HEADERS = {
34
34
  'X-Client-Version': `Node/Admin/${utils.getSdkVersion()}`,
35
+ 'X-Goog-Api-Client': `gl-node/${process.versions.node} fire-admin/${utils.getSdkVersion()}`
35
36
  };
36
37
  /** Firebase Auth request timeout duration in milliseconds. */
37
38
  const FIREBASE_AUTH_TIMEOUT = 25000;
@@ -882,7 +883,7 @@ class AbstractAuthRequestHandler {
882
883
  const request = {
883
884
  idToken,
884
885
  // Convert to seconds.
885
- validDuration: expiresIn / 1000,
886
+ validDuration: Math.floor(expiresIn / 1000),
886
887
  };
887
888
  return this.invokeRequestHandler(this.getAuthUrlBuilder(), exports.FIREBASE_AUTH_CREATE_SESSION_COOKIE, request)
888
889
  .then((response) => response.sessionCookie);
@@ -1603,7 +1604,7 @@ class AbstractAuthRequestHandler {
1603
1604
  const req = {
1604
1605
  method: apiSettings.getHttpMethod(),
1605
1606
  url,
1606
- headers: FIREBASE_AUTH_HEADER,
1607
+ headers: FIREBASE_AUTH_HEADERS,
1607
1608
  data: requestData,
1608
1609
  timeout: FIREBASE_AUTH_TIMEOUT,
1609
1610
  };
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.5.0 */
1
+ /*! firebase-admin v12.7.0 */
2
2
  /*!
3
3
  * Copyright 2018 Google Inc.
4
4
  *
@@ -662,6 +662,20 @@ export interface RecaptchaManagedRule {
662
662
  */
663
663
  action?: RecaptchaAction;
664
664
  }
665
+ /**
666
+ * The managed rules for toll fraud provider, containing the enforcement status.
667
+ * The toll fraud provider contains all SMS related user flows.
668
+ */
669
+ export interface RecaptchaTollFraudManagedRule {
670
+ /**
671
+ * The action will be enforced if the reCAPTCHA score of a request is larger than startScore.
672
+ */
673
+ startScore: number;
674
+ /**
675
+ * The action for reCAPTCHA-protected requests.
676
+ */
677
+ action?: RecaptchaAction;
678
+ }
665
679
  /**
666
680
  * The key's platform type.
667
681
  */
@@ -690,6 +704,10 @@ export interface RecaptchaConfig {
690
704
  * The enforcement state of the email password provider.
691
705
  */
692
706
  emailPasswordEnforcementState?: RecaptchaProviderEnforcementState;
707
+ /**
708
+ * The enforcement state of the phone provider.
709
+ */
710
+ phoneEnforcementState?: RecaptchaProviderEnforcementState;
693
711
  /**
694
712
  * The reCAPTCHA managed rules.
695
713
  */
@@ -703,28 +721,34 @@ export interface RecaptchaConfig {
703
721
  * The default value is false.
704
722
  */
705
723
  useAccountDefender?: boolean;
706
- }
707
- export declare class RecaptchaAuthConfig implements RecaptchaConfig {
708
- readonly emailPasswordEnforcementState?: RecaptchaProviderEnforcementState;
709
- readonly managedRules?: RecaptchaManagedRule[];
710
- readonly recaptchaKeys?: RecaptchaKey[];
711
- readonly useAccountDefender?: boolean;
712
- constructor(recaptchaConfig: RecaptchaConfig);
713
724
  /**
714
- * Validates the RecaptchaConfig options object. Throws an error on failure.
715
- * @param options - The options object to validate.
725
+ * Whether to use the rCE bot score for reCAPTCHA phone provider.
726
+ * Can only be true when the phone_enforcement_state is AUDIT or ENFORCE.
716
727
  */
717
- static validate(options: RecaptchaConfig): void;
728
+ useSmsBotScore?: boolean;
718
729
  /**
719
- * Validate each element in ManagedRule array
720
- * @param options - The options object to validate.
730
+ * Whether to use the rCE SMS toll fraud protection risk score for reCAPTCHA phone provider.
731
+ * Can only be true when the phone_enforcement_state is AUDIT or ENFORCE.
721
732
  */
722
- private static validateManagedRule;
733
+ useSmsTollFraudProtection?: boolean;
723
734
  /**
724
- * Returns a JSON-serializable representation of this object.
725
- * @returns The JSON-serializable object representation of the ReCaptcha config instance
735
+ * The managed rules for toll fraud provider, containing the enforcement status.
736
+ * The toll fraud provider contains all SMS related user flows.
726
737
  */
727
- toJSON(): object;
738
+ smsTollFraudManagedRules?: RecaptchaTollFraudManagedRule[];
739
+ }
740
+ /**
741
+ * Server side recaptcha configuration.
742
+ */
743
+ export interface RecaptchaAuthServerConfig {
744
+ emailPasswordEnforcementState?: RecaptchaProviderEnforcementState;
745
+ phoneEnforcementState?: RecaptchaProviderEnforcementState;
746
+ managedRules?: RecaptchaManagedRule[];
747
+ recaptchaKeys?: RecaptchaKey[];
748
+ useAccountDefender?: boolean;
749
+ useSmsBotScore?: boolean;
750
+ useSmsTollFraudProtection?: boolean;
751
+ tollFraudManagedRules?: RecaptchaTollFraudManagedRule[];
728
752
  }
729
753
  /**
730
754
  * A password policy configuration for a project or tenant
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.5.0 */
1
+ /*! firebase-admin v12.7.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2018 Google Inc.
@@ -752,12 +752,66 @@ class SmsRegionsAuthConfig {
752
752
  }
753
753
  }
754
754
  exports.SmsRegionsAuthConfig = SmsRegionsAuthConfig;
755
+ /**
756
+ * Defines the recaptcha config class used to convert client side RecaptchaConfig
757
+ * to a format that is understood by the Auth server.
758
+ *
759
+ * @internal
760
+ */
755
761
  class RecaptchaAuthConfig {
756
- constructor(recaptchaConfig) {
757
- this.emailPasswordEnforcementState = recaptchaConfig.emailPasswordEnforcementState;
758
- this.managedRules = recaptchaConfig.managedRules;
759
- this.recaptchaKeys = recaptchaConfig.recaptchaKeys;
760
- this.useAccountDefender = recaptchaConfig.useAccountDefender;
762
+ /**
763
+ * The RecaptchaAuthConfig constructor.
764
+ *
765
+ * @param response - The server side response used to initialize the
766
+ * RecaptchaAuthConfig object.
767
+ * @constructor
768
+ * @internal
769
+ */
770
+ constructor(response) {
771
+ const filteredResponse = Object.fromEntries(Object.entries(response).filter(([, value]) => value !== undefined));
772
+ // Explicitly map the 'tollFraudManagedRules' to 'smsTollFraudManagedRules'
773
+ if (filteredResponse.tollFraudManagedRules !== undefined) {
774
+ this.smsTollFraudManagedRules = filteredResponse.tollFraudManagedRules;
775
+ delete filteredResponse.tollFraudManagedRules; // Remove it if necessary
776
+ }
777
+ // Assign the remaining properties directly
778
+ Object.assign(this, filteredResponse);
779
+ }
780
+ /**
781
+ * Builds a server request object from the client-side RecaptchaConfig.
782
+ * Converts client-side fields to their server-side equivalents.
783
+ *
784
+ * @param options - The client-side RecaptchaConfig object.
785
+ * @returns The server-side RecaptchaAuthServerConfig object.
786
+ */
787
+ static buildServerRequest(options) {
788
+ RecaptchaAuthConfig.validate(options); // Validate options before building request
789
+ const request = {};
790
+ if (typeof options.emailPasswordEnforcementState !== 'undefined') {
791
+ request.emailPasswordEnforcementState = options.emailPasswordEnforcementState;
792
+ }
793
+ if (typeof options.phoneEnforcementState !== 'undefined') {
794
+ request.phoneEnforcementState = options.phoneEnforcementState;
795
+ }
796
+ if (typeof options.managedRules !== 'undefined') {
797
+ request.managedRules = options.managedRules;
798
+ }
799
+ if (typeof options.recaptchaKeys !== 'undefined') {
800
+ request.recaptchaKeys = options.recaptchaKeys;
801
+ }
802
+ if (typeof options.useAccountDefender !== 'undefined') {
803
+ request.useAccountDefender = options.useAccountDefender;
804
+ }
805
+ if (typeof options.useSmsBotScore !== 'undefined') {
806
+ request.useSmsBotScore = options.useSmsBotScore;
807
+ }
808
+ if (typeof options.useSmsTollFraudProtection !== 'undefined') {
809
+ request.useSmsTollFraudProtection = options.useSmsTollFraudProtection;
810
+ }
811
+ if (typeof options.smsTollFraudManagedRules !== 'undefined') {
812
+ request.tollFraudManagedRules = options.smsTollFraudManagedRules; // Map client-side field to server-side
813
+ }
814
+ return request;
761
815
  }
762
816
  /**
763
817
  * Validates the RecaptchaConfig options object. Throws an error on failure.
@@ -766,9 +820,13 @@ class RecaptchaAuthConfig {
766
820
  static validate(options) {
767
821
  const validKeys = {
768
822
  emailPasswordEnforcementState: true,
823
+ phoneEnforcementState: true,
769
824
  managedRules: true,
770
825
  recaptchaKeys: true,
771
826
  useAccountDefender: true,
827
+ useSmsBotScore: true,
828
+ useSmsTollFraudProtection: true,
829
+ smsTollFraudManagedRules: true,
772
830
  };
773
831
  if (!validator.isNonNullObject(options)) {
774
832
  throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_CONFIG, '"RecaptchaConfig" must be a non-null object.');
@@ -779,7 +837,7 @@ class RecaptchaAuthConfig {
779
837
  }
780
838
  }
781
839
  // Validation
782
- if (typeof options.emailPasswordEnforcementState !== undefined) {
840
+ if (typeof options.emailPasswordEnforcementState !== 'undefined') {
783
841
  if (!validator.isNonEmptyString(options.emailPasswordEnforcementState)) {
784
842
  throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_ARGUMENT, '"RecaptchaConfig.emailPasswordEnforcementState" must be a valid non-empty string.');
785
843
  }
@@ -789,6 +847,16 @@ class RecaptchaAuthConfig {
789
847
  throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_CONFIG, '"RecaptchaConfig.emailPasswordEnforcementState" must be either "OFF", "AUDIT" or "ENFORCE".');
790
848
  }
791
849
  }
850
+ if (typeof options.phoneEnforcementState !== 'undefined') {
851
+ if (!validator.isNonEmptyString(options.phoneEnforcementState)) {
852
+ throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_ARGUMENT, '"RecaptchaConfig.phoneEnforcementState" must be a valid non-empty string.');
853
+ }
854
+ if (options.phoneEnforcementState !== 'OFF' &&
855
+ options.phoneEnforcementState !== 'AUDIT' &&
856
+ options.phoneEnforcementState !== 'ENFORCE') {
857
+ throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_CONFIG, '"RecaptchaConfig.phoneEnforcementState" must be either "OFF", "AUDIT" or "ENFORCE".');
858
+ }
859
+ }
792
860
  if (typeof options.managedRules !== 'undefined') {
793
861
  // Validate array
794
862
  if (!validator.isArray(options.managedRules)) {
@@ -804,6 +872,26 @@ class RecaptchaAuthConfig {
804
872
  throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_CONFIG, '"RecaptchaConfig.useAccountDefender" must be a boolean value".');
805
873
  }
806
874
  }
875
+ if (typeof options.useSmsBotScore !== 'undefined') {
876
+ if (!validator.isBoolean(options.useSmsBotScore)) {
877
+ throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_CONFIG, '"RecaptchaConfig.useSmsBotScore" must be a boolean value".');
878
+ }
879
+ }
880
+ if (typeof options.useSmsTollFraudProtection !== 'undefined') {
881
+ if (!validator.isBoolean(options.useSmsTollFraudProtection)) {
882
+ throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_CONFIG, '"RecaptchaConfig.useSmsTollFraudProtection" must be a boolean value".');
883
+ }
884
+ }
885
+ if (typeof options.smsTollFraudManagedRules !== 'undefined') {
886
+ // Validate array
887
+ if (!validator.isArray(options.smsTollFraudManagedRules)) {
888
+ throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_CONFIG, '"RecaptchaConfig.smsTollFraudManagedRules" must be an array of valid "RecaptchaTollFraudManagedRule".');
889
+ }
890
+ // Validate each rule of the array
891
+ options.smsTollFraudManagedRules.forEach((tollFraudManagedRule) => {
892
+ RecaptchaAuthConfig.validateTollFraudManagedRule(tollFraudManagedRule);
893
+ });
894
+ }
807
895
  }
808
896
  /**
809
897
  * Validate each element in ManagedRule array
@@ -830,29 +918,28 @@ class RecaptchaAuthConfig {
830
918
  }
831
919
  }
832
920
  /**
833
- * Returns a JSON-serializable representation of this object.
834
- * @returns The JSON-serializable object representation of the ReCaptcha config instance
921
+ * Validate each element in TollFraudManagedRule array
922
+ * @param options - The options object to validate.
835
923
  */
836
- toJSON() {
837
- const json = {
838
- emailPasswordEnforcementState: this.emailPasswordEnforcementState,
839
- managedRules: (0, deep_copy_1.deepCopy)(this.managedRules),
840
- recaptchaKeys: (0, deep_copy_1.deepCopy)(this.recaptchaKeys),
841
- useAccountDefender: this.useAccountDefender,
924
+ static validateTollFraudManagedRule(options) {
925
+ const validKeys = {
926
+ startScore: true,
927
+ action: true,
842
928
  };
843
- if (typeof json.emailPasswordEnforcementState === 'undefined') {
844
- delete json.emailPasswordEnforcementState;
845
- }
846
- if (typeof json.managedRules === 'undefined') {
847
- delete json.managedRules;
929
+ if (!validator.isNonNullObject(options)) {
930
+ throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_CONFIG, '"RecaptchaTollFraudManagedRule" must be a non-null object.');
848
931
  }
849
- if (typeof json.recaptchaKeys === 'undefined') {
850
- delete json.recaptchaKeys;
932
+ // Check for unsupported top level attributes.
933
+ for (const key in options) {
934
+ if (!(key in validKeys)) {
935
+ throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_CONFIG, `"${key}" is not a valid RecaptchaTollFraudManagedRule parameter.`);
936
+ }
851
937
  }
852
- if (typeof json.useAccountDefender === 'undefined') {
853
- delete json.useAccountDefender;
938
+ // Validate content.
939
+ if (typeof options.action !== 'undefined' &&
940
+ options.action !== 'BLOCK') {
941
+ throw new error_1.FirebaseAuthError(error_1.AuthClientErrorCode.INVALID_CONFIG, '"RecaptchaTollFraudManagedRule.action" must be "BLOCK".');
854
942
  }
855
- return json;
856
943
  }
857
944
  }
858
945
  exports.RecaptchaAuthConfig = RecaptchaAuthConfig;
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.5.0 */
1
+ /*! firebase-admin v12.7.0 */
2
2
  /*!
3
3
  * Copyright 2021 Google Inc.
4
4
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.5.0 */
1
+ /*! firebase-admin v12.7.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2021 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.5.0 */
1
+ /*! firebase-admin v12.7.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 v12.5.0 */
1
+ /*! firebase-admin v12.7.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * @license
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.5.0 */
1
+ /*! firebase-admin v12.7.0 */
2
2
  /*!
3
3
  * Copyright 2021 Google Inc.
4
4
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.5.0 */
1
+ /*! firebase-admin v12.7.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2021 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.5.0 */
1
+ /*! firebase-admin v12.7.0 */
2
2
  /*!
3
3
  * Copyright 2020 Google Inc.
4
4
  *
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.5.0 */
1
+ /*! firebase-admin v12.7.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2020 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.5.0 */
1
+ /*! firebase-admin v12.7.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, MultiFactorProviderConfig, OAuthResponseType, OIDCAuthProviderConfig, OIDCUpdateAuthProviderRequest, RecaptchaAction, RecaptchaConfig, RecaptchaKey, RecaptchaKeyClientType, RecaptchaManagedRule, RecaptchaProviderEnforcementState, SAMLAuthProviderConfig, SAMLUpdateAuthProviderRequest, SmsRegionConfig, UserProvider, UpdateAuthProviderRequest, UpdateMultiFactorInfoRequest, UpdatePhoneMultiFactorInfoRequest, UpdateRequest, TotpMultiFactorProviderConfig, PasswordPolicyConfig, PasswordPolicyEnforcementState, CustomStrengthOptionsConfig, EmailPrivacyConfig, } 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, RecaptchaAction, RecaptchaConfig, RecaptchaKey, RecaptchaKeyClientType, RecaptchaManagedRule, RecaptchaTollFraudManagedRule, RecaptchaProviderEnforcementState, SAMLAuthProviderConfig, SAMLUpdateAuthProviderRequest, SmsRegionConfig, UserProvider, UpdateAuthProviderRequest, UpdateMultiFactorInfoRequest, UpdatePhoneMultiFactorInfoRequest, UpdateRequest, TotpMultiFactorProviderConfig, PasswordPolicyConfig, PasswordPolicyEnforcementState, CustomStrengthOptionsConfig, EmailPrivacyConfig, } 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 v12.5.0 */
1
+ /*! firebase-admin v12.7.0 */
2
2
  "use strict";
3
3
  /*!
4
4
  * Copyright 2020 Google Inc.
@@ -1,4 +1,4 @@
1
- /*! firebase-admin v12.5.0 */
1
+ /*! firebase-admin v12.7.0 */
2
2
  import { ProjectConfig, UpdateProjectConfigRequest } from './project-config';
3
3
  /**
4
4
  * Manages (gets and updates) the current project config.