@firebase/auth 1.7.9-canary.aa6db78eb → 1.7.9-canary.b942e9e6e

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 (148) hide show
  1. package/README.md +32 -1
  2. package/dist/auth-public.d.ts +22 -10
  3. package/dist/auth.d.ts +22 -10
  4. package/dist/browser-cjs/{index-8c4960c5.js → index-c1e3d4f9.js} +392 -175
  5. package/dist/browser-cjs/index-c1e3d4f9.js.map +1 -0
  6. package/dist/browser-cjs/index.js +1 -1
  7. package/dist/browser-cjs/internal.js +1 -1
  8. package/dist/browser-cjs/src/api/account_management/mfa.d.ts +5 -1
  9. package/dist/browser-cjs/src/api/authentication/mfa.d.ts +5 -1
  10. package/dist/browser-cjs/src/api/authentication/sms.d.ts +5 -1
  11. package/dist/browser-cjs/src/api/index.d.ts +7 -3
  12. package/dist/browser-cjs/src/platform_browser/providers/phone.d.ts +7 -5
  13. package/dist/browser-cjs/src/platform_browser/recaptcha/recaptcha.d.ts +7 -0
  14. package/dist/browser-cjs/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +4 -4
  15. package/dist/browser-cjs/src/platform_browser/strategies/phone.d.ts +10 -6
  16. package/dist/browser-cjs/test/integration/flows/recaptcha_enterprise.test.d.ts +17 -0
  17. package/dist/cordova/auth-cordova-public.d.ts +7 -0
  18. package/dist/cordova/auth-cordova.d.ts +7 -0
  19. package/dist/cordova/index.js +2 -2
  20. package/dist/cordova/internal.js +168 -177
  21. package/dist/cordova/internal.js.map +1 -1
  22. package/dist/cordova/{popup_redirect-1e109c2a.js → popup_redirect-63b3580d.js} +285 -21
  23. package/dist/cordova/popup_redirect-63b3580d.js.map +1 -0
  24. package/dist/cordova/src/api/account_management/mfa.d.ts +5 -1
  25. package/dist/cordova/src/api/authentication/mfa.d.ts +5 -1
  26. package/dist/cordova/src/api/authentication/sms.d.ts +5 -1
  27. package/dist/cordova/src/api/index.d.ts +7 -3
  28. package/dist/cordova/src/platform_browser/providers/phone.d.ts +7 -5
  29. package/dist/cordova/src/platform_browser/recaptcha/recaptcha.d.ts +7 -0
  30. package/dist/cordova/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +4 -4
  31. package/dist/cordova/src/platform_browser/strategies/phone.d.ts +10 -6
  32. package/dist/cordova/test/integration/flows/recaptcha_enterprise.test.d.ts +17 -0
  33. package/dist/esm2017/{index-6cb7b51a.js → index-c8d513e3.js} +392 -175
  34. package/dist/esm2017/index-c8d513e3.js.map +1 -0
  35. package/dist/esm2017/index.js +1 -1
  36. package/dist/esm2017/internal.js +2 -2
  37. package/dist/esm2017/src/api/account_management/mfa.d.ts +5 -1
  38. package/dist/esm2017/src/api/authentication/mfa.d.ts +5 -1
  39. package/dist/esm2017/src/api/authentication/sms.d.ts +5 -1
  40. package/dist/esm2017/src/api/index.d.ts +7 -3
  41. package/dist/esm2017/src/platform_browser/providers/phone.d.ts +7 -5
  42. package/dist/esm2017/src/platform_browser/recaptcha/recaptcha.d.ts +7 -0
  43. package/dist/esm2017/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +4 -4
  44. package/dist/esm2017/src/platform_browser/strategies/phone.d.ts +10 -6
  45. package/dist/esm2017/test/integration/flows/recaptcha_enterprise.test.d.ts +17 -0
  46. package/dist/esm5/{index-262b3f24.js → index-82b3e33f.js} +450 -195
  47. package/dist/esm5/index-82b3e33f.js.map +1 -0
  48. package/dist/esm5/index.js +1 -1
  49. package/dist/esm5/internal.js +2 -2
  50. package/dist/esm5/src/api/account_management/mfa.d.ts +5 -1
  51. package/dist/esm5/src/api/authentication/mfa.d.ts +5 -1
  52. package/dist/esm5/src/api/authentication/sms.d.ts +5 -1
  53. package/dist/esm5/src/api/index.d.ts +7 -3
  54. package/dist/esm5/src/platform_browser/providers/phone.d.ts +7 -5
  55. package/dist/esm5/src/platform_browser/recaptcha/recaptcha.d.ts +7 -0
  56. package/dist/esm5/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +4 -4
  57. package/dist/esm5/src/platform_browser/strategies/phone.d.ts +10 -6
  58. package/dist/esm5/test/integration/flows/recaptcha_enterprise.test.d.ts +17 -0
  59. package/dist/index.webworker.esm5.js +163 -19
  60. package/dist/index.webworker.esm5.js.map +1 -1
  61. package/dist/node/index.js +1 -1
  62. package/dist/node/internal.js +1 -1
  63. package/dist/node/src/api/account_management/mfa.d.ts +5 -1
  64. package/dist/node/src/api/authentication/mfa.d.ts +5 -1
  65. package/dist/node/src/api/authentication/sms.d.ts +5 -1
  66. package/dist/node/src/api/index.d.ts +7 -3
  67. package/dist/node/src/platform_browser/providers/phone.d.ts +7 -5
  68. package/dist/node/src/platform_browser/recaptcha/recaptcha.d.ts +7 -0
  69. package/dist/node/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +4 -4
  70. package/dist/node/src/platform_browser/strategies/phone.d.ts +10 -6
  71. package/dist/node/test/integration/flows/recaptcha_enterprise.test.d.ts +17 -0
  72. package/dist/node/{totp-617e4db6.js → totp-c9a669c7.js} +164 -20
  73. package/dist/node/totp-c9a669c7.js.map +1 -0
  74. package/dist/node-esm/index.js +1 -1
  75. package/dist/node-esm/internal.js +2 -2
  76. package/dist/node-esm/src/api/account_management/mfa.d.ts +5 -1
  77. package/dist/node-esm/src/api/authentication/mfa.d.ts +5 -1
  78. package/dist/node-esm/src/api/authentication/sms.d.ts +5 -1
  79. package/dist/node-esm/src/api/index.d.ts +7 -3
  80. package/dist/node-esm/src/platform_browser/providers/phone.d.ts +7 -5
  81. package/dist/node-esm/src/platform_browser/recaptcha/recaptcha.d.ts +7 -0
  82. package/dist/node-esm/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +4 -4
  83. package/dist/node-esm/src/platform_browser/strategies/phone.d.ts +10 -6
  84. package/dist/node-esm/test/integration/flows/recaptcha_enterprise.test.d.ts +17 -0
  85. package/dist/node-esm/{totp-98ba6f1f.js → totp-9698d31a.js} +168 -30
  86. package/dist/node-esm/totp-9698d31a.js.map +1 -0
  87. package/dist/rn/{index-198b1e87.js → index-dd6cc9b0.js} +450 -195
  88. package/dist/rn/index-dd6cc9b0.js.map +1 -0
  89. package/dist/rn/index.js +1 -1
  90. package/dist/rn/internal.js +1 -1
  91. package/dist/rn/src/api/account_management/mfa.d.ts +5 -1
  92. package/dist/rn/src/api/authentication/mfa.d.ts +5 -1
  93. package/dist/rn/src/api/authentication/sms.d.ts +5 -1
  94. package/dist/rn/src/api/index.d.ts +7 -3
  95. package/dist/rn/src/platform_browser/providers/phone.d.ts +7 -5
  96. package/dist/rn/src/platform_browser/recaptcha/recaptcha.d.ts +7 -0
  97. package/dist/rn/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +4 -4
  98. package/dist/rn/src/platform_browser/strategies/phone.d.ts +10 -6
  99. package/dist/rn/test/integration/flows/recaptcha_enterprise.test.d.ts +17 -0
  100. package/dist/src/api/account_management/mfa.d.ts +5 -1
  101. package/dist/src/api/authentication/mfa.d.ts +5 -1
  102. package/dist/src/api/authentication/sms.d.ts +5 -1
  103. package/dist/src/api/index.d.ts +7 -3
  104. package/dist/src/platform_browser/providers/phone.d.ts +7 -5
  105. package/dist/src/platform_browser/recaptcha/recaptcha.d.ts +7 -0
  106. package/dist/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +4 -4
  107. package/dist/src/platform_browser/strategies/phone.d.ts +10 -6
  108. package/dist/test/integration/flows/recaptcha_enterprise.test.d.ts +17 -0
  109. package/dist/web-extension-cjs/index.js +1 -1
  110. package/dist/web-extension-cjs/internal.js +115 -147
  111. package/dist/web-extension-cjs/internal.js.map +1 -1
  112. package/dist/web-extension-cjs/{register-0aa8e295.js → register-1a706c5a.js} +283 -30
  113. package/dist/web-extension-cjs/register-1a706c5a.js.map +1 -0
  114. package/dist/web-extension-cjs/src/api/account_management/mfa.d.ts +5 -1
  115. package/dist/web-extension-cjs/src/api/authentication/mfa.d.ts +5 -1
  116. package/dist/web-extension-cjs/src/api/authentication/sms.d.ts +5 -1
  117. package/dist/web-extension-cjs/src/api/index.d.ts +7 -3
  118. package/dist/web-extension-cjs/src/platform_browser/providers/phone.d.ts +7 -5
  119. package/dist/web-extension-cjs/src/platform_browser/recaptcha/recaptcha.d.ts +7 -0
  120. package/dist/web-extension-cjs/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +4 -4
  121. package/dist/web-extension-cjs/src/platform_browser/strategies/phone.d.ts +10 -6
  122. package/dist/web-extension-cjs/test/integration/flows/recaptcha_enterprise.test.d.ts +17 -0
  123. package/dist/web-extension-esm2017/auth-web-extension-public.d.ts +7 -0
  124. package/dist/web-extension-esm2017/auth-web-extension.d.ts +7 -0
  125. package/dist/web-extension-esm2017/index.js +2 -2
  126. package/dist/web-extension-esm2017/internal.js +115 -147
  127. package/dist/web-extension-esm2017/internal.js.map +1 -1
  128. package/dist/web-extension-esm2017/{register-68ef89ff.js → register-3c017834.js} +280 -31
  129. package/dist/web-extension-esm2017/register-3c017834.js.map +1 -0
  130. package/dist/web-extension-esm2017/src/api/account_management/mfa.d.ts +5 -1
  131. package/dist/web-extension-esm2017/src/api/authentication/mfa.d.ts +5 -1
  132. package/dist/web-extension-esm2017/src/api/authentication/sms.d.ts +5 -1
  133. package/dist/web-extension-esm2017/src/api/index.d.ts +7 -3
  134. package/dist/web-extension-esm2017/src/platform_browser/providers/phone.d.ts +7 -5
  135. package/dist/web-extension-esm2017/src/platform_browser/recaptcha/recaptcha.d.ts +7 -0
  136. package/dist/web-extension-esm2017/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +4 -4
  137. package/dist/web-extension-esm2017/src/platform_browser/strategies/phone.d.ts +10 -6
  138. package/dist/web-extension-esm2017/test/integration/flows/recaptcha_enterprise.test.d.ts +17 -0
  139. package/package.json +6 -6
  140. package/dist/browser-cjs/index-8c4960c5.js.map +0 -1
  141. package/dist/cordova/popup_redirect-1e109c2a.js.map +0 -1
  142. package/dist/esm2017/index-6cb7b51a.js.map +0 -1
  143. package/dist/esm5/index-262b3f24.js.map +0 -1
  144. package/dist/node/totp-617e4db6.js.map +0 -1
  145. package/dist/node-esm/totp-98ba6f1f.js.map +0 -1
  146. package/dist/rn/index-198b1e87.js.map +0 -1
  147. package/dist/web-extension-cjs/register-0aa8e295.js.map +0 -1
  148. package/dist/web-extension-esm2017/register-68ef89ff.js.map +0 -1
@@ -1,4 +1,4 @@
1
- export { A as ActionCodeOperation, ai as ActionCodeURL, L as AuthCredential, I as AuthErrorCodes, M as EmailAuthCredential, V as EmailAuthProvider, W as FacebookAuthProvider, F as FactorId, Y as GithubAuthProvider, X as GoogleAuthProvider, N as OAuthCredential, Z as OAuthProvider, O as OperationType, Q as PhoneAuthCredential, P as PhoneAuthProvider, m as PhoneMultiFactorGenerator, p as ProviderId, R as RecaptchaVerifier, _ as SAMLAuthProvider, S as SignInMethod, T as TotpMultiFactorGenerator, n as TotpSecret, $ as TwitterAuthProvider, a7 as applyActionCode, x as beforeAuthStateChanged, b as browserLocalPersistence, k as browserPopupRedirectResolver, a as browserSessionPersistence, a8 as checkActionCode, a6 as confirmPasswordReset, K as connectAuthEmulator, aa as createUserWithEmailAndPassword, G as debugErrorMap, E as deleteUser, af as fetchSignInMethodsForEmail, aq as getAdditionalUserInfo, o as getAuth, an as getIdToken, ao as getIdTokenResult, as as getMultiFactorResolver, j as getRedirectResult, U as inMemoryPersistence, i as indexedDBLocalPersistence, J as initializeAuth, t as initializeRecaptchaConfig, ad as isSignInWithEmailLink, a2 as linkWithCredential, l as linkWithPhoneNumber, d as linkWithPopup, g as linkWithRedirect, at as multiFactor, y as onAuthStateChanged, w as onIdTokenChanged, aj as parseActionCodeURL, H as prodErrorMap, a3 as reauthenticateWithCredential, r as reauthenticateWithPhoneNumber, e as reauthenticateWithPopup, h as reauthenticateWithRedirect, ar as reload, D as revokeAccessToken, ag as sendEmailVerification, a5 as sendPasswordResetEmail, ac as sendSignInLinkToEmail, q as setPersistence, a0 as signInAnonymously, a1 as signInWithCredential, a4 as signInWithCustomToken, ab as signInWithEmailAndPassword, ae as signInWithEmailLink, s as signInWithPhoneNumber, c as signInWithPopup, f as signInWithRedirect, C as signOut, ap as unlink, B as updateCurrentUser, al as updateEmail, am as updatePassword, u as updatePhoneNumber, ak as updateProfile, z as useDeviceLanguage, v as validatePassword, ah as verifyBeforeUpdateEmail, a9 as verifyPasswordResetCode } from './totp-98ba6f1f.js';
1
+ export { A as ActionCodeOperation, ai as ActionCodeURL, L as AuthCredential, I as AuthErrorCodes, M as EmailAuthCredential, V as EmailAuthProvider, W as FacebookAuthProvider, F as FactorId, Y as GithubAuthProvider, X as GoogleAuthProvider, N as OAuthCredential, Z as OAuthProvider, O as OperationType, Q as PhoneAuthCredential, P as PhoneAuthProvider, m as PhoneMultiFactorGenerator, p as ProviderId, R as RecaptchaVerifier, _ as SAMLAuthProvider, S as SignInMethod, T as TotpMultiFactorGenerator, n as TotpSecret, $ as TwitterAuthProvider, a7 as applyActionCode, x as beforeAuthStateChanged, b as browserLocalPersistence, k as browserPopupRedirectResolver, a as browserSessionPersistence, a8 as checkActionCode, a6 as confirmPasswordReset, K as connectAuthEmulator, aa as createUserWithEmailAndPassword, G as debugErrorMap, E as deleteUser, af as fetchSignInMethodsForEmail, aq as getAdditionalUserInfo, o as getAuth, an as getIdToken, ao as getIdTokenResult, as as getMultiFactorResolver, j as getRedirectResult, U as inMemoryPersistence, i as indexedDBLocalPersistence, J as initializeAuth, t as initializeRecaptchaConfig, ad as isSignInWithEmailLink, a2 as linkWithCredential, l as linkWithPhoneNumber, d as linkWithPopup, g as linkWithRedirect, at as multiFactor, y as onAuthStateChanged, w as onIdTokenChanged, aj as parseActionCodeURL, H as prodErrorMap, a3 as reauthenticateWithCredential, r as reauthenticateWithPhoneNumber, e as reauthenticateWithPopup, h as reauthenticateWithRedirect, ar as reload, D as revokeAccessToken, ag as sendEmailVerification, a5 as sendPasswordResetEmail, ac as sendSignInLinkToEmail, q as setPersistence, a0 as signInAnonymously, a1 as signInWithCredential, a4 as signInWithCustomToken, ab as signInWithEmailAndPassword, ae as signInWithEmailLink, s as signInWithPhoneNumber, c as signInWithPopup, f as signInWithRedirect, C as signOut, ap as unlink, B as updateCurrentUser, al as updateEmail, am as updatePassword, u as updatePhoneNumber, ak as updateProfile, z as useDeviceLanguage, v as validatePassword, ah as verifyBeforeUpdateEmail, a9 as verifyPasswordResetCode } from './totp-9698d31a.js';
2
2
  import '@firebase/app';
3
3
  import '@firebase/util';
4
4
  import 'tslib';
@@ -1,5 +1,5 @@
1
- import { au as _getInstance, av as _assert, aw as _signInWithCredential, ax as _reauthenticate, ay as _link$1, L as AuthCredential, az as signInWithIdp, aA as _fail, aB as debugAssert, aC as _persistenceKeyName, aD as _serverAppCurrentUserOperationNotSupportedError, aE as _castAuth, aF as FederatedAuthProvider, aG as BaseOAuthProvider, aH as _emulatorUrl, aI as _performApiRequest, aJ as _isIOS, aK as _isAndroid, aL as _isIOS7Or8, aM as _createError, aN as _isMobileBrowser, aO as _isIE10 } from './totp-98ba6f1f.js';
2
- export { A as ActionCodeOperation, ai as ActionCodeURL, L as AuthCredential, I as AuthErrorCodes, aQ as AuthImpl, M as EmailAuthCredential, V as EmailAuthProvider, W as FacebookAuthProvider, F as FactorId, aS as FetchProvider, Y as GithubAuthProvider, X as GoogleAuthProvider, N as OAuthCredential, Z as OAuthProvider, O as OperationType, Q as PhoneAuthCredential, P as PhoneAuthProvider, m as PhoneMultiFactorGenerator, p as ProviderId, R as RecaptchaVerifier, aT as SAMLAuthCredential, _ as SAMLAuthProvider, S as SignInMethod, T as TotpMultiFactorGenerator, n as TotpSecret, $ as TwitterAuthProvider, aP as UserImpl, av as _assert, aE as _castAuth, aA as _fail, aR as _getClientVersion, au as _getInstance, aC as _persistenceKeyName, a7 as applyActionCode, x as beforeAuthStateChanged, b as browserLocalPersistence, k as browserPopupRedirectResolver, a as browserSessionPersistence, a8 as checkActionCode, a6 as confirmPasswordReset, K as connectAuthEmulator, aa as createUserWithEmailAndPassword, G as debugErrorMap, E as deleteUser, af as fetchSignInMethodsForEmail, aq as getAdditionalUserInfo, o as getAuth, an as getIdToken, ao as getIdTokenResult, as as getMultiFactorResolver, j as getRedirectResult, U as inMemoryPersistence, i as indexedDBLocalPersistence, J as initializeAuth, t as initializeRecaptchaConfig, ad as isSignInWithEmailLink, a2 as linkWithCredential, l as linkWithPhoneNumber, d as linkWithPopup, g as linkWithRedirect, at as multiFactor, y as onAuthStateChanged, w as onIdTokenChanged, aj as parseActionCodeURL, H as prodErrorMap, a3 as reauthenticateWithCredential, r as reauthenticateWithPhoneNumber, e as reauthenticateWithPopup, h as reauthenticateWithRedirect, ar as reload, D as revokeAccessToken, ag as sendEmailVerification, a5 as sendPasswordResetEmail, ac as sendSignInLinkToEmail, q as setPersistence, a0 as signInAnonymously, a1 as signInWithCredential, a4 as signInWithCustomToken, ab as signInWithEmailAndPassword, ae as signInWithEmailLink, s as signInWithPhoneNumber, c as signInWithPopup, f as signInWithRedirect, C as signOut, ap as unlink, B as updateCurrentUser, al as updateEmail, am as updatePassword, u as updatePhoneNumber, ak as updateProfile, z as useDeviceLanguage, v as validatePassword, ah as verifyBeforeUpdateEmail, a9 as verifyPasswordResetCode } from './totp-98ba6f1f.js';
1
+ import { au as _getInstance, av as _assert, aw as _signInWithCredential, ax as _reauthenticate, ay as _link$1, L as AuthCredential, az as signInWithIdp, aA as _fail, aB as debugAssert, aC as _persistenceKeyName, aD as _serverAppCurrentUserOperationNotSupportedError, aE as _castAuth, aF as FederatedAuthProvider, aG as BaseOAuthProvider, aH as _emulatorUrl, aI as _performApiRequest, aJ as _isIOS, aK as _isAndroid, aL as _isIOS7Or8, aM as _createError, aN as _isMobileBrowser, aO as _isIE10 } from './totp-9698d31a.js';
2
+ export { A as ActionCodeOperation, ai as ActionCodeURL, L as AuthCredential, I as AuthErrorCodes, aQ as AuthImpl, M as EmailAuthCredential, V as EmailAuthProvider, W as FacebookAuthProvider, F as FactorId, aS as FetchProvider, Y as GithubAuthProvider, X as GoogleAuthProvider, N as OAuthCredential, Z as OAuthProvider, O as OperationType, Q as PhoneAuthCredential, P as PhoneAuthProvider, m as PhoneMultiFactorGenerator, p as ProviderId, R as RecaptchaVerifier, aT as SAMLAuthCredential, _ as SAMLAuthProvider, S as SignInMethod, T as TotpMultiFactorGenerator, n as TotpSecret, $ as TwitterAuthProvider, aP as UserImpl, av as _assert, aE as _castAuth, aA as _fail, aR as _getClientVersion, au as _getInstance, aC as _persistenceKeyName, a7 as applyActionCode, x as beforeAuthStateChanged, b as browserLocalPersistence, k as browserPopupRedirectResolver, a as browserSessionPersistence, a8 as checkActionCode, a6 as confirmPasswordReset, K as connectAuthEmulator, aa as createUserWithEmailAndPassword, G as debugErrorMap, E as deleteUser, af as fetchSignInMethodsForEmail, aq as getAdditionalUserInfo, o as getAuth, an as getIdToken, ao as getIdTokenResult, as as getMultiFactorResolver, j as getRedirectResult, U as inMemoryPersistence, i as indexedDBLocalPersistence, J as initializeAuth, t as initializeRecaptchaConfig, ad as isSignInWithEmailLink, a2 as linkWithCredential, l as linkWithPhoneNumber, d as linkWithPopup, g as linkWithRedirect, at as multiFactor, y as onAuthStateChanged, w as onIdTokenChanged, aj as parseActionCodeURL, H as prodErrorMap, a3 as reauthenticateWithCredential, r as reauthenticateWithPhoneNumber, e as reauthenticateWithPopup, h as reauthenticateWithRedirect, ar as reload, D as revokeAccessToken, ag as sendEmailVerification, a5 as sendPasswordResetEmail, ac as sendSignInLinkToEmail, q as setPersistence, a0 as signInAnonymously, a1 as signInWithCredential, a4 as signInWithCustomToken, ab as signInWithEmailAndPassword, ae as signInWithEmailLink, s as signInWithPhoneNumber, c as signInWithPopup, f as signInWithRedirect, C as signOut, ap as unlink, B as updateCurrentUser, al as updateEmail, am as updatePassword, u as updatePhoneNumber, ak as updateProfile, z as useDeviceLanguage, v as validatePassword, ah as verifyBeforeUpdateEmail, a9 as verifyPasswordResetCode } from './totp-9698d31a.js';
3
3
  import { isEmpty, querystring, querystringDecode } from '@firebase/util';
4
4
  import 'tslib';
5
5
  import { _isFirebaseServerApp, SDK_VERSION } from '@firebase/app';
@@ -14,6 +14,7 @@
14
14
  * See the License for the specific language governing permissions and
15
15
  * limitations under the License.
16
16
  */
17
+ import { RecaptchaClientType, RecaptchaVersion } from '../index';
17
18
  import { SignInWithPhoneNumberRequest } from '../authentication/sms';
18
19
  import { FinalizeMfaResponse } from '../authentication/mfa';
19
20
  import { AuthInternal } from '../../model/auth';
@@ -44,7 +45,10 @@ export interface StartPhoneMfaEnrollmentRequest {
44
45
  idToken: string;
45
46
  phoneEnrollmentInfo: {
46
47
  phoneNumber: string;
47
- recaptchaToken: string;
48
+ recaptchaToken?: string;
49
+ captchaResponse?: string;
50
+ clientType?: RecaptchaClientType;
51
+ recaptchaVersion?: RecaptchaVersion;
48
52
  };
49
53
  tenantId?: string;
50
54
  }
@@ -14,6 +14,7 @@
14
14
  * See the License for the specific language governing permissions and
15
15
  * limitations under the License.
16
16
  */
17
+ import { RecaptchaClientType, RecaptchaVersion } from '../index';
17
18
  import { Auth } from '../../model/public_types';
18
19
  import { IdTokenResponse } from '../../model/id_token';
19
20
  import { MfaEnrollment } from '../account_management/mfa';
@@ -34,7 +35,10 @@ export interface StartPhoneMfaSignInRequest {
34
35
  mfaPendingCredential: string;
35
36
  mfaEnrollmentId: string;
36
37
  phoneSignInInfo: {
37
- recaptchaToken: string;
38
+ recaptchaToken?: string;
39
+ captchaResponse?: string;
40
+ clientType?: RecaptchaClientType;
41
+ recaptchaVersion?: RecaptchaVersion;
38
42
  };
39
43
  tenantId?: string;
40
44
  }
@@ -14,12 +14,16 @@
14
14
  * See the License for the specific language governing permissions and
15
15
  * limitations under the License.
16
16
  */
17
+ import { RecaptchaClientType, RecaptchaVersion } from '../index';
17
18
  import { IdTokenResponse } from '../../model/id_token';
18
19
  import { Auth } from '../../model/public_types';
19
20
  export interface SendPhoneVerificationCodeRequest {
20
21
  phoneNumber: string;
21
- recaptchaToken: string;
22
+ recaptchaToken?: string;
22
23
  tenantId?: string;
24
+ captchaResponse?: string;
25
+ clientType?: RecaptchaClientType;
26
+ recaptchaVersion?: RecaptchaVersion;
23
27
  }
24
28
  export interface SendPhoneVerificationCodeResponse {
25
29
  sessionInfo: string;
@@ -69,7 +69,10 @@ export declare const enum RecaptchaVersion {
69
69
  export declare const enum RecaptchaActionName {
70
70
  SIGN_IN_WITH_PASSWORD = "signInWithPassword",
71
71
  GET_OOB_CODE = "getOobCode",
72
- SIGN_UP_PASSWORD = "signUpPassword"
72
+ SIGN_UP_PASSWORD = "signUpPassword",
73
+ SEND_VERIFICATION_CODE = "sendVerificationCode",
74
+ MFA_SMS_ENROLLMENT = "mfaSmsEnrollment",
75
+ MFA_SMS_SIGNIN = "mfaSmsSignIn"
73
76
  }
74
77
  export declare const enum EnforcementState {
75
78
  ENFORCE = "ENFORCE",
@@ -77,8 +80,9 @@ export declare const enum EnforcementState {
77
80
  OFF = "OFF",
78
81
  ENFORCEMENT_STATE_UNSPECIFIED = "ENFORCEMENT_STATE_UNSPECIFIED"
79
82
  }
80
- export declare const enum RecaptchaProvider {
81
- EMAIL_PASSWORD_PROVIDER = "EMAIL_PASSWORD_PROVIDER"
83
+ export declare const enum RecaptchaAuthProvider {
84
+ EMAIL_PASSWORD_PROVIDER = "EMAIL_PASSWORD_PROVIDER",
85
+ PHONE_PROVIDER = "PHONE_PROVIDER"
82
86
  }
83
87
  export declare const DEFAULT_API_TIMEOUT_MS: Delay;
84
88
  export declare function _addTidIfNecessary<T extends {
@@ -74,14 +74,16 @@ export declare class PhoneAuthProvider {
74
74
  *
75
75
  * @param phoneInfoOptions - The user's {@link PhoneInfoOptions}. The phone number should be in
76
76
  * E.164 format (e.g. +16505550101).
77
- * @param applicationVerifier - For abuse prevention, this method also requires a
78
- * {@link ApplicationVerifier}. This SDK includes a reCAPTCHA-based implementation,
79
- * {@link RecaptchaVerifier}.
77
+ * @param applicationVerifier - An {@link ApplicationVerifier}, which prevents
78
+ * requests from unauthorized clients. This SDK includes an implementation
79
+ * based on reCAPTCHA v2, {@link RecaptchaVerifier}. If you've enabled
80
+ * reCAPTCHA Enterprise bot protection in Enforce mode, this parameter is
81
+ * optional; in all other configurations, the parameter is required.
80
82
  *
81
83
  * @returns A Promise for a verification ID that can be passed to
82
- * {@link PhoneAuthProvider.credential} to identify this flow..
84
+ * {@link PhoneAuthProvider.credential} to identify this flow.
83
85
  */
84
- verifyPhoneNumber(phoneOptions: PhoneInfoOptions | string, applicationVerifier: ApplicationVerifier): Promise<string>;
86
+ verifyPhoneNumber(phoneOptions: PhoneInfoOptions | string, applicationVerifier?: ApplicationVerifier): Promise<string>;
85
87
  /**
86
88
  * Creates a phone auth credential, given the verification ID from
87
89
  * {@link PhoneAuthProvider.verifyPhoneNumber} and the code that was sent to the user's
@@ -68,4 +68,11 @@ export declare class RecaptchaConfig {
68
68
  * @returns Whether or not reCAPTCHA Enterprise protection is enabled for the given provider.
69
69
  */
70
70
  isProviderEnabled(providerStr: string): boolean;
71
+ /**
72
+ * Returns true if reCAPTCHA Enterprise protection is enabled in at least one provider, otherwise
73
+ * returns false.
74
+ *
75
+ * @returns Whether or not reCAPTCHA Enterprise protection is enabled for at least one provider.
76
+ */
77
+ isAnyProviderEnabled(): boolean;
71
78
  }
@@ -14,7 +14,7 @@
14
14
  * See the License for the specific language governing permissions and
15
15
  * limitations under the License.
16
16
  */
17
- import { RecaptchaActionName } from '../../api';
17
+ import { RecaptchaActionName, RecaptchaAuthProvider } from '../../api';
18
18
  import { Auth } from '../../model/public_types';
19
19
  import { AuthInternal } from '../../model/auth';
20
20
  export declare const RECAPTCHA_ENTERPRISE_VERIFIER_TYPE = "recaptcha-enterprise";
@@ -38,8 +38,8 @@ export declare class RecaptchaEnterpriseVerifier {
38
38
  */
39
39
  verify(action?: string, forceRefresh?: boolean): Promise<string>;
40
40
  }
41
- export declare function injectRecaptchaFields<T>(auth: AuthInternal, request: T, action: RecaptchaActionName, captchaResp?: boolean): Promise<T>;
42
- declare type ActionMethod<TRequest, TResponse> = (auth: Auth, request: TRequest) => Promise<TResponse>;
43
- export declare function handleRecaptchaFlow<TRequest, TResponse>(authInstance: AuthInternal, request: TRequest, actionName: RecaptchaActionName, actionMethod: ActionMethod<TRequest, TResponse>): Promise<TResponse>;
41
+ export declare function injectRecaptchaFields<T>(auth: AuthInternal, request: T, action: RecaptchaActionName, isCaptchaResp?: boolean, isFakeToken?: boolean): Promise<T>;
42
+ declare type ActionMethod<TRequest, TResponse> = (auth: AuthInternal, request: TRequest) => Promise<TResponse>;
43
+ export declare function handleRecaptchaFlow<TRequest, TResponse>(authInstance: AuthInternal, request: TRequest, actionName: RecaptchaActionName, actionMethod: ActionMethod<TRequest, TResponse>, recaptchaAuthProvider: RecaptchaAuthProvider): Promise<TResponse>;
44
44
  export declare function _initializeRecaptchaConfig(auth: Auth): Promise<void>;
45
45
  export {};
@@ -27,12 +27,15 @@ import { AuthInternal } from '../../model/auth';
27
27
  * provides the code sent to their phone, call {@link ConfirmationResult.confirm}
28
28
  * with the code to sign the user in.
29
29
  *
30
- * For abuse prevention, this method also requires a {@link ApplicationVerifier}.
31
- * This SDK includes a reCAPTCHA-based implementation, {@link RecaptchaVerifier}.
30
+ * For abuse prevention, this method requires a {@link ApplicationVerifier}.
31
+ * This SDK includes an implementation based on reCAPTCHA v2, {@link RecaptchaVerifier}.
32
32
  * This function can work on other platforms that do not support the
33
33
  * {@link RecaptchaVerifier} (like React Native), but you need to use a
34
34
  * third-party {@link ApplicationVerifier} implementation.
35
35
  *
36
+ * If you've enabled project-level reCAPTCHA Enterprise bot protection in
37
+ * Enforce mode, you can omit the {@link ApplicationVerifier}.
38
+ *
36
39
  * This method does not work in a Node.js environment or with {@link Auth} instances created with a
37
40
  * {@link @firebase/app#FirebaseServerApp}.
38
41
  *
@@ -51,7 +54,7 @@ import { AuthInternal } from '../../model/auth';
51
54
  *
52
55
  * @public
53
56
  */
54
- export declare function signInWithPhoneNumber(auth: Auth, phoneNumber: string, appVerifier: ApplicationVerifier): Promise<ConfirmationResult>;
57
+ export declare function signInWithPhoneNumber(auth: Auth, phoneNumber: string, appVerifier?: ApplicationVerifier): Promise<ConfirmationResult>;
55
58
  /**
56
59
  * Links the user account with the given phone number.
57
60
  *
@@ -64,7 +67,7 @@ export declare function signInWithPhoneNumber(auth: Auth, phoneNumber: string, a
64
67
  *
65
68
  * @public
66
69
  */
67
- export declare function linkWithPhoneNumber(user: User, phoneNumber: string, appVerifier: ApplicationVerifier): Promise<ConfirmationResult>;
70
+ export declare function linkWithPhoneNumber(user: User, phoneNumber: string, appVerifier?: ApplicationVerifier): Promise<ConfirmationResult>;
68
71
  /**
69
72
  * Re-authenticates a user using a fresh phone credential.
70
73
  *
@@ -80,12 +83,12 @@ export declare function linkWithPhoneNumber(user: User, phoneNumber: string, app
80
83
  *
81
84
  * @public
82
85
  */
83
- export declare function reauthenticateWithPhoneNumber(user: User, phoneNumber: string, appVerifier: ApplicationVerifier): Promise<ConfirmationResult>;
86
+ export declare function reauthenticateWithPhoneNumber(user: User, phoneNumber: string, appVerifier?: ApplicationVerifier): Promise<ConfirmationResult>;
84
87
  /**
85
88
  * Returns a verification ID to be used in conjunction with the SMS code that is sent.
86
89
  *
87
90
  */
88
- export declare function _verifyPhoneNumber(auth: AuthInternal, options: PhoneInfoOptions | string, verifier: ApplicationVerifierInternal): Promise<string>;
91
+ export declare function _verifyPhoneNumber(auth: AuthInternal, options: PhoneInfoOptions | string, verifier?: ApplicationVerifierInternal): Promise<string>;
89
92
  /**
90
93
  * Updates the user's phone number.
91
94
  *
@@ -110,3 +113,4 @@ export declare function _verifyPhoneNumber(auth: AuthInternal, options: PhoneInf
110
113
  * @public
111
114
  */
112
115
  export declare function updatePhoneNumber(user: User, credential: PhoneAuthCredential): Promise<void>;
116
+ export declare function injectRecaptchaV2Token<T>(auth: AuthInternal, request: T, recaptchaV2Verifier: ApplicationVerifierInternal): Promise<T>;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2024 Google LLC
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
+ export {};
@@ -1077,6 +1077,16 @@ class RecaptchaConfig {
1077
1077
  "ENFORCE" /* EnforcementState.ENFORCE */ ||
1078
1078
  this.getProviderEnforcementState(providerStr) === "AUDIT" /* EnforcementState.AUDIT */);
1079
1079
  }
1080
+ /**
1081
+ * Returns true if reCAPTCHA Enterprise protection is enabled in at least one provider, otherwise
1082
+ * returns false.
1083
+ *
1084
+ * @returns Whether or not reCAPTCHA Enterprise protection is enabled for at least one provider.
1085
+ */
1086
+ isAnyProviderEnabled() {
1087
+ return (this.isProviderEnabled("EMAIL_PASSWORD_PROVIDER" /* RecaptchaAuthProvider.EMAIL_PASSWORD_PROVIDER */) ||
1088
+ this.isProviderEnabled("PHONE_PROVIDER" /* RecaptchaAuthProvider.PHONE_PROVIDER */));
1089
+ }
1080
1090
  }
1081
1091
 
1082
1092
  /**
@@ -3145,6 +3155,56 @@ function _recaptchaEnterpriseScriptUrl() {
3145
3155
  return externalJSProvider.recaptchaEnterpriseScript;
3146
3156
  }
3147
3157
 
3158
+ /**
3159
+ * @license
3160
+ * Copyright 2020 Google LLC
3161
+ *
3162
+ * Licensed under the Apache License, Version 2.0 (the "License");
3163
+ * you may not use this file except in compliance with the License.
3164
+ * You may obtain a copy of the License at
3165
+ *
3166
+ * http://www.apache.org/licenses/LICENSE-2.0
3167
+ *
3168
+ * Unless required by applicable law or agreed to in writing, software
3169
+ * distributed under the License is distributed on an "AS IS" BASIS,
3170
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3171
+ * See the License for the specific language governing permissions and
3172
+ * limitations under the License.
3173
+ */
3174
+ class MockGreCAPTCHATopLevel {
3175
+ constructor() {
3176
+ this.enterprise = new MockGreCAPTCHA();
3177
+ }
3178
+ ready(callback) {
3179
+ callback();
3180
+ }
3181
+ execute(
3182
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
3183
+ _siteKey, _options) {
3184
+ return Promise.resolve('token');
3185
+ }
3186
+ render(
3187
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
3188
+ _container, _parameters) {
3189
+ return '';
3190
+ }
3191
+ }
3192
+ class MockGreCAPTCHA {
3193
+ ready(callback) {
3194
+ callback();
3195
+ }
3196
+ execute(
3197
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
3198
+ _siteKey, _options) {
3199
+ return Promise.resolve('token');
3200
+ }
3201
+ render(
3202
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
3203
+ _container, _parameters) {
3204
+ return '';
3205
+ }
3206
+ }
3207
+
3148
3208
  /* eslint-disable @typescript-eslint/no-require-imports */
3149
3209
  const RECAPTCHA_ENTERPRISE_VERIFIER_TYPE = 'recaptcha-enterprise';
3150
3210
  const FAKE_TOKEN = 'NO_RECAPTCHA';
@@ -3220,6 +3280,11 @@ class RecaptchaEnterpriseVerifier {
3220
3280
  reject(Error('No reCAPTCHA enterprise script loaded.'));
3221
3281
  }
3222
3282
  }
3283
+ // Returns Promise for a mock token when appVerificationDisabledForTesting is true.
3284
+ if (this.auth.settings.appVerificationDisabledForTesting) {
3285
+ const mockRecaptcha = new MockGreCAPTCHATopLevel();
3286
+ return mockRecaptcha.execute('siteKey', { action: 'verify' });
3287
+ }
3223
3288
  return new Promise((resolve, reject) => {
3224
3289
  retrieveSiteKey(this.auth)
3225
3290
  .then(siteKey => {
@@ -3250,17 +3315,50 @@ class RecaptchaEnterpriseVerifier {
3250
3315
  });
3251
3316
  }
3252
3317
  }
3253
- async function injectRecaptchaFields(auth, request, action, captchaResp = false) {
3318
+ async function injectRecaptchaFields(auth, request, action, isCaptchaResp = false, isFakeToken = false) {
3254
3319
  const verifier = new RecaptchaEnterpriseVerifier(auth);
3255
3320
  let captchaResponse;
3256
- try {
3257
- captchaResponse = await verifier.verify(action);
3321
+ if (isFakeToken) {
3322
+ captchaResponse = FAKE_TOKEN;
3258
3323
  }
3259
- catch (error) {
3260
- captchaResponse = await verifier.verify(action, true);
3324
+ else {
3325
+ try {
3326
+ captchaResponse = await verifier.verify(action);
3327
+ }
3328
+ catch (error) {
3329
+ captchaResponse = await verifier.verify(action, true);
3330
+ }
3261
3331
  }
3262
3332
  const newRequest = Object.assign({}, request);
3263
- if (!captchaResp) {
3333
+ if (action === "mfaSmsEnrollment" /* RecaptchaActionName.MFA_SMS_ENROLLMENT */ ||
3334
+ action === "mfaSmsSignIn" /* RecaptchaActionName.MFA_SMS_SIGNIN */) {
3335
+ if ('phoneEnrollmentInfo' in newRequest) {
3336
+ const phoneNumber = newRequest.phoneEnrollmentInfo.phoneNumber;
3337
+ const recaptchaToken = newRequest.phoneEnrollmentInfo.recaptchaToken;
3338
+ Object.assign(newRequest, {
3339
+ 'phoneEnrollmentInfo': {
3340
+ phoneNumber,
3341
+ recaptchaToken,
3342
+ captchaResponse,
3343
+ 'clientType': "CLIENT_TYPE_WEB" /* RecaptchaClientType.WEB */,
3344
+ 'recaptchaVersion': "RECAPTCHA_ENTERPRISE" /* RecaptchaVersion.ENTERPRISE */
3345
+ }
3346
+ });
3347
+ }
3348
+ else if ('phoneSignInInfo' in newRequest) {
3349
+ const recaptchaToken = newRequest.phoneSignInInfo.recaptchaToken;
3350
+ Object.assign(newRequest, {
3351
+ 'phoneSignInInfo': {
3352
+ recaptchaToken,
3353
+ captchaResponse,
3354
+ 'clientType': "CLIENT_TYPE_WEB" /* RecaptchaClientType.WEB */,
3355
+ 'recaptchaVersion': "RECAPTCHA_ENTERPRISE" /* RecaptchaVersion.ENTERPRISE */
3356
+ }
3357
+ });
3358
+ }
3359
+ return newRequest;
3360
+ }
3361
+ if (!isCaptchaResp) {
3264
3362
  Object.assign(newRequest, { captchaResponse });
3265
3363
  }
3266
3364
  else {
@@ -3272,24 +3370,64 @@ async function injectRecaptchaFields(auth, request, action, captchaResp = false)
3272
3370
  });
3273
3371
  return newRequest;
3274
3372
  }
3275
- async function handleRecaptchaFlow(authInstance, request, actionName, actionMethod) {
3276
- var _a;
3277
- if ((_a = authInstance
3278
- ._getRecaptchaConfig()) === null || _a === void 0 ? void 0 : _a.isProviderEnabled("EMAIL_PASSWORD_PROVIDER" /* RecaptchaProvider.EMAIL_PASSWORD_PROVIDER */)) {
3279
- const requestWithRecaptcha = await injectRecaptchaFields(authInstance, request, actionName, actionName === "getOobCode" /* RecaptchaActionName.GET_OOB_CODE */);
3280
- return actionMethod(authInstance, requestWithRecaptcha);
3373
+ async function handleRecaptchaFlow(authInstance, request, actionName, actionMethod, recaptchaAuthProvider) {
3374
+ var _a, _b;
3375
+ if (recaptchaAuthProvider === "EMAIL_PASSWORD_PROVIDER" /* RecaptchaAuthProvider.EMAIL_PASSWORD_PROVIDER */) {
3376
+ if ((_a = authInstance
3377
+ ._getRecaptchaConfig()) === null || _a === void 0 ? void 0 : _a.isProviderEnabled("EMAIL_PASSWORD_PROVIDER" /* RecaptchaAuthProvider.EMAIL_PASSWORD_PROVIDER */)) {
3378
+ const requestWithRecaptcha = await injectRecaptchaFields(authInstance, request, actionName, actionName === "getOobCode" /* RecaptchaActionName.GET_OOB_CODE */);
3379
+ return actionMethod(authInstance, requestWithRecaptcha);
3380
+ }
3381
+ else {
3382
+ return actionMethod(authInstance, request).catch(async (error) => {
3383
+ if (error.code === `auth/${"missing-recaptcha-token" /* AuthErrorCode.MISSING_RECAPTCHA_TOKEN */}`) {
3384
+ console.log(`${actionName} is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.`);
3385
+ const requestWithRecaptcha = await injectRecaptchaFields(authInstance, request, actionName, actionName === "getOobCode" /* RecaptchaActionName.GET_OOB_CODE */);
3386
+ return actionMethod(authInstance, requestWithRecaptcha);
3387
+ }
3388
+ else {
3389
+ return Promise.reject(error);
3390
+ }
3391
+ });
3392
+ }
3281
3393
  }
3282
- else {
3283
- return actionMethod(authInstance, request).catch(async (error) => {
3284
- if (error.code === `auth/${"missing-recaptcha-token" /* AuthErrorCode.MISSING_RECAPTCHA_TOKEN */}`) {
3285
- console.log(`${actionName} is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.`);
3286
- const requestWithRecaptcha = await injectRecaptchaFields(authInstance, request, actionName, actionName === "getOobCode" /* RecaptchaActionName.GET_OOB_CODE */);
3287
- return actionMethod(authInstance, requestWithRecaptcha);
3288
- }
3289
- else {
3394
+ else if (recaptchaAuthProvider === "PHONE_PROVIDER" /* RecaptchaAuthProvider.PHONE_PROVIDER */) {
3395
+ if ((_b = authInstance
3396
+ ._getRecaptchaConfig()) === null || _b === void 0 ? void 0 : _b.isProviderEnabled("PHONE_PROVIDER" /* RecaptchaAuthProvider.PHONE_PROVIDER */)) {
3397
+ const requestWithRecaptcha = await injectRecaptchaFields(authInstance, request, actionName);
3398
+ return actionMethod(authInstance, requestWithRecaptcha).catch(async (error) => {
3399
+ var _a;
3400
+ if (((_a = authInstance
3401
+ ._getRecaptchaConfig()) === null || _a === void 0 ? void 0 : _a.getProviderEnforcementState("PHONE_PROVIDER" /* RecaptchaAuthProvider.PHONE_PROVIDER */)) === "AUDIT" /* EnforcementState.AUDIT */) {
3402
+ // AUDIT mode
3403
+ if (error.code === `auth/${"missing-recaptcha-token" /* AuthErrorCode.MISSING_RECAPTCHA_TOKEN */}` ||
3404
+ error.code === `auth/${"invalid-app-credential" /* AuthErrorCode.INVALID_APP_CREDENTIAL */}`) {
3405
+ console.log(`Failed to verify with reCAPTCHA Enterprise. Automatically triggering the reCAPTCHA v2 flow to complete the ${actionName} flow.`);
3406
+ // reCAPTCHA Enterprise token is missing or reCAPTCHA Enterprise token
3407
+ // check fails.
3408
+ // Fallback to reCAPTCHA v2 flow.
3409
+ const requestWithRecaptchaFields = await injectRecaptchaFields(authInstance, request, actionName, false, // isCaptchaResp
3410
+ true // isFakeToken
3411
+ );
3412
+ // This will call the PhoneApiCaller to fetch and inject reCAPTCHA v2 token.
3413
+ return actionMethod(authInstance, requestWithRecaptchaFields);
3414
+ }
3415
+ }
3416
+ // ENFORCE mode or AUDIT mode with any other error.
3290
3417
  return Promise.reject(error);
3291
- }
3292
- });
3418
+ });
3419
+ }
3420
+ else {
3421
+ // Do reCAPTCHA v2 flow.
3422
+ const requestWithRecaptchaFields = await injectRecaptchaFields(authInstance, request, actionName, false, // isCaptchaResp
3423
+ true // isFakeToken
3424
+ );
3425
+ // This will call the PhoneApiCaller to fetch and inject v2 token.
3426
+ return actionMethod(authInstance, requestWithRecaptchaFields);
3427
+ }
3428
+ }
3429
+ else {
3430
+ return Promise.reject(recaptchaAuthProvider + ' provider is not supported.');
3293
3431
  }
3294
3432
  }
3295
3433
  async function _initializeRecaptchaConfig(auth) {
@@ -3305,7 +3443,7 @@ async function _initializeRecaptchaConfig(auth) {
3305
3443
  else {
3306
3444
  authInternal._tenantRecaptchaConfigs[authInternal.tenantId] = config;
3307
3445
  }
3308
- if (config.isProviderEnabled("EMAIL_PASSWORD_PROVIDER" /* RecaptchaProvider.EMAIL_PASSWORD_PROVIDER */)) {
3446
+ if (config.isAnyProviderEnabled()) {
3309
3447
  const verifier = new RecaptchaEnterpriseVerifier(authInternal);
3310
3448
  void verifier.verify();
3311
3449
  }
@@ -3731,7 +3869,7 @@ class EmailAuthCredential extends AuthCredential {
3731
3869
  password: this._password,
3732
3870
  clientType: "CLIENT_TYPE_WEB" /* RecaptchaClientType.WEB */
3733
3871
  };
3734
- return handleRecaptchaFlow(auth, request, "signInWithPassword" /* RecaptchaActionName.SIGN_IN_WITH_PASSWORD */, signInWithPassword);
3872
+ return handleRecaptchaFlow(auth, request, "signInWithPassword" /* RecaptchaActionName.SIGN_IN_WITH_PASSWORD */, signInWithPassword, "EMAIL_PASSWORD_PROVIDER" /* RecaptchaAuthProvider.EMAIL_PASSWORD_PROVIDER */);
3735
3873
  case "emailLink" /* SignInMethod.EMAIL_LINK */:
3736
3874
  return signInWithEmailLink$1(auth, {
3737
3875
  email: this._email,
@@ -3752,7 +3890,7 @@ class EmailAuthCredential extends AuthCredential {
3752
3890
  password: this._password,
3753
3891
  clientType: "CLIENT_TYPE_WEB" /* RecaptchaClientType.WEB */
3754
3892
  };
3755
- return handleRecaptchaFlow(auth, request, "signUpPassword" /* RecaptchaActionName.SIGN_UP_PASSWORD */, linkEmailPassword);
3893
+ return handleRecaptchaFlow(auth, request, "signUpPassword" /* RecaptchaActionName.SIGN_UP_PASSWORD */, linkEmailPassword, "EMAIL_PASSWORD_PROVIDER" /* RecaptchaAuthProvider.EMAIL_PASSWORD_PROVIDER */);
3756
3894
  case "emailLink" /* SignInMethod.EMAIL_LINK */:
3757
3895
  return signInWithEmailLinkForLinking(auth, {
3758
3896
  idToken,
@@ -5744,7 +5882,7 @@ async function sendPasswordResetEmail(auth, email, actionCodeSettings) {
5744
5882
  if (actionCodeSettings) {
5745
5883
  _setActionCodeSettingsOnRequest(authInternal, request, actionCodeSettings);
5746
5884
  }
5747
- await handleRecaptchaFlow(authInternal, request, "getOobCode" /* RecaptchaActionName.GET_OOB_CODE */, sendPasswordResetEmail$1);
5885
+ await handleRecaptchaFlow(authInternal, request, "getOobCode" /* RecaptchaActionName.GET_OOB_CODE */, sendPasswordResetEmail$1, "EMAIL_PASSWORD_PROVIDER" /* RecaptchaAuthProvider.EMAIL_PASSWORD_PROVIDER */);
5748
5886
  }
5749
5887
  /**
5750
5888
  * Completes the password reset process, given a confirmation code and new password.
@@ -5877,7 +6015,7 @@ async function createUserWithEmailAndPassword(auth, email, password) {
5877
6015
  password,
5878
6016
  clientType: "CLIENT_TYPE_WEB" /* RecaptchaClientType.WEB */
5879
6017
  };
5880
- const signUpResponse = handleRecaptchaFlow(authInternal, request, "signUpPassword" /* RecaptchaActionName.SIGN_UP_PASSWORD */, signUp);
6018
+ const signUpResponse = handleRecaptchaFlow(authInternal, request, "signUpPassword" /* RecaptchaActionName.SIGN_UP_PASSWORD */, signUp, "EMAIL_PASSWORD_PROVIDER" /* RecaptchaAuthProvider.EMAIL_PASSWORD_PROVIDER */);
5881
6019
  const response = await signUpResponse.catch(error => {
5882
6020
  if (error.code === `auth/${"password-does-not-meet-requirements" /* AuthErrorCode.PASSWORD_DOES_NOT_MEET_REQUIREMENTS */}`) {
5883
6021
  void recachePasswordPolicy(auth);
@@ -5991,7 +6129,7 @@ async function sendSignInLinkToEmail(auth, email, actionCodeSettings) {
5991
6129
  }
5992
6130
  }
5993
6131
  setActionCodeSettings(request, actionCodeSettings);
5994
- await handleRecaptchaFlow(authInternal, request, "getOobCode" /* RecaptchaActionName.GET_OOB_CODE */, sendSignInLinkToEmail$1);
6132
+ await handleRecaptchaFlow(authInternal, request, "getOobCode" /* RecaptchaActionName.GET_OOB_CODE */, sendSignInLinkToEmail$1, "EMAIL_PASSWORD_PROVIDER" /* RecaptchaAuthProvider.EMAIL_PASSWORD_PROVIDER */);
5995
6133
  }
5996
6134
  /**
5997
6135
  * Checks if an incoming link is a sign-in with email link suitable for {@link signInWithEmailLink}.
@@ -6919,7 +7057,7 @@ function multiFactor(user) {
6919
7057
  }
6920
7058
 
6921
7059
  var name = "@firebase/auth";
6922
- var version = "1.7.9-canary.aa6db78eb";
7060
+ var version = "1.7.9-canary.b942e9e6e";
6923
7061
 
6924
7062
  /**
6925
7063
  * @license
@@ -7331,4 +7469,4 @@ function _isEmptyString(input) {
7331
7469
  }
7332
7470
 
7333
7471
  export { TwitterAuthProvider as $, ActionCodeOperation as A, updateCurrentUser as B, signOut as C, revokeAccessToken as D, deleteUser as E, FactorId as F, debugErrorMap as G, prodErrorMap as H, AUTH_ERROR_CODES_MAP_DO_NOT_USE_INTERNALLY as I, initializeAuth as J, connectAuthEmulator as K, AuthCredential as L, EmailAuthCredential as M, OAuthCredential as N, OperationType as O, PhoneAuthProvider as P, PhoneAuthCredential as Q, RecaptchaVerifier as R, SignInMethod as S, TotpMultiFactorGenerator as T, inMemoryPersistence as U, EmailAuthProvider as V, FacebookAuthProvider as W, GoogleAuthProvider as X, GithubAuthProvider as Y, OAuthProvider as Z, SAMLAuthProvider as _, browserSessionPersistence as a, signInAnonymously as a0, signInWithCredential as a1, linkWithCredential as a2, reauthenticateWithCredential as a3, signInWithCustomToken as a4, sendPasswordResetEmail as a5, confirmPasswordReset as a6, applyActionCode as a7, checkActionCode as a8, verifyPasswordResetCode as a9, _fail as aA, debugAssert as aB, _persistenceKeyName as aC, _serverAppCurrentUserOperationNotSupportedError as aD, _castAuth as aE, FederatedAuthProvider as aF, BaseOAuthProvider as aG, _emulatorUrl as aH, _performApiRequest as aI, _isIOS as aJ, _isAndroid as aK, _isIOS7Or8 as aL, _createError as aM, _isMobileBrowser as aN, _isIE10 as aO, UserImpl as aP, AuthImpl as aQ, _getClientVersion as aR, FetchProvider as aS, SAMLAuthCredential as aT, createUserWithEmailAndPassword as aa, signInWithEmailAndPassword as ab, sendSignInLinkToEmail as ac, isSignInWithEmailLink as ad, signInWithEmailLink as ae, fetchSignInMethodsForEmail as af, sendEmailVerification as ag, verifyBeforeUpdateEmail as ah, ActionCodeURL as ai, parseActionCodeURL as aj, updateProfile as ak, updateEmail as al, updatePassword as am, getIdToken as an, getIdTokenResult as ao, unlink as ap, getAdditionalUserInfo as aq, reload as ar, getMultiFactorResolver as as, multiFactor as at, _getInstance as au, _assert as av, _signInWithCredential as aw, _reauthenticate as ax, _link as ay, signInWithIdp as az, browserLocalPersistence as b, signInWithPopup as c, linkWithPopup as d, reauthenticateWithPopup as e, signInWithRedirect as f, linkWithRedirect as g, reauthenticateWithRedirect as h, indexedDBLocalPersistence as i, getRedirectResult as j, browserPopupRedirectResolver as k, linkWithPhoneNumber as l, PhoneMultiFactorGenerator as m, TotpSecret as n, getAuth as o, ProviderId as p, setPersistence as q, reauthenticateWithPhoneNumber as r, signInWithPhoneNumber as s, initializeRecaptchaConfig as t, updatePhoneNumber as u, validatePassword as v, onIdTokenChanged as w, beforeAuthStateChanged as x, onAuthStateChanged as y, useDeviceLanguage as z };
7334
- //# sourceMappingURL=totp-98ba6f1f.js.map
7472
+ //# sourceMappingURL=totp-9698d31a.js.map