@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.
- package/README.md +32 -1
- package/dist/auth-public.d.ts +22 -10
- package/dist/auth.d.ts +22 -10
- package/dist/browser-cjs/{index-8c4960c5.js → index-c1e3d4f9.js} +392 -175
- package/dist/browser-cjs/index-c1e3d4f9.js.map +1 -0
- package/dist/browser-cjs/index.js +1 -1
- package/dist/browser-cjs/internal.js +1 -1
- package/dist/browser-cjs/src/api/account_management/mfa.d.ts +5 -1
- package/dist/browser-cjs/src/api/authentication/mfa.d.ts +5 -1
- package/dist/browser-cjs/src/api/authentication/sms.d.ts +5 -1
- package/dist/browser-cjs/src/api/index.d.ts +7 -3
- package/dist/browser-cjs/src/platform_browser/providers/phone.d.ts +7 -5
- package/dist/browser-cjs/src/platform_browser/recaptcha/recaptcha.d.ts +7 -0
- package/dist/browser-cjs/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +4 -4
- package/dist/browser-cjs/src/platform_browser/strategies/phone.d.ts +10 -6
- package/dist/browser-cjs/test/integration/flows/recaptcha_enterprise.test.d.ts +17 -0
- package/dist/cordova/auth-cordova-public.d.ts +7 -0
- package/dist/cordova/auth-cordova.d.ts +7 -0
- package/dist/cordova/index.js +2 -2
- package/dist/cordova/internal.js +168 -177
- package/dist/cordova/internal.js.map +1 -1
- package/dist/cordova/{popup_redirect-1e109c2a.js → popup_redirect-63b3580d.js} +285 -21
- package/dist/cordova/popup_redirect-63b3580d.js.map +1 -0
- package/dist/cordova/src/api/account_management/mfa.d.ts +5 -1
- package/dist/cordova/src/api/authentication/mfa.d.ts +5 -1
- package/dist/cordova/src/api/authentication/sms.d.ts +5 -1
- package/dist/cordova/src/api/index.d.ts +7 -3
- package/dist/cordova/src/platform_browser/providers/phone.d.ts +7 -5
- package/dist/cordova/src/platform_browser/recaptcha/recaptcha.d.ts +7 -0
- package/dist/cordova/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +4 -4
- package/dist/cordova/src/platform_browser/strategies/phone.d.ts +10 -6
- package/dist/cordova/test/integration/flows/recaptcha_enterprise.test.d.ts +17 -0
- package/dist/esm2017/{index-6cb7b51a.js → index-c8d513e3.js} +392 -175
- package/dist/esm2017/index-c8d513e3.js.map +1 -0
- package/dist/esm2017/index.js +1 -1
- package/dist/esm2017/internal.js +2 -2
- package/dist/esm2017/src/api/account_management/mfa.d.ts +5 -1
- package/dist/esm2017/src/api/authentication/mfa.d.ts +5 -1
- package/dist/esm2017/src/api/authentication/sms.d.ts +5 -1
- package/dist/esm2017/src/api/index.d.ts +7 -3
- package/dist/esm2017/src/platform_browser/providers/phone.d.ts +7 -5
- package/dist/esm2017/src/platform_browser/recaptcha/recaptcha.d.ts +7 -0
- package/dist/esm2017/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +4 -4
- package/dist/esm2017/src/platform_browser/strategies/phone.d.ts +10 -6
- package/dist/esm2017/test/integration/flows/recaptcha_enterprise.test.d.ts +17 -0
- package/dist/esm5/{index-262b3f24.js → index-82b3e33f.js} +450 -195
- package/dist/esm5/index-82b3e33f.js.map +1 -0
- package/dist/esm5/index.js +1 -1
- package/dist/esm5/internal.js +2 -2
- package/dist/esm5/src/api/account_management/mfa.d.ts +5 -1
- package/dist/esm5/src/api/authentication/mfa.d.ts +5 -1
- package/dist/esm5/src/api/authentication/sms.d.ts +5 -1
- package/dist/esm5/src/api/index.d.ts +7 -3
- package/dist/esm5/src/platform_browser/providers/phone.d.ts +7 -5
- package/dist/esm5/src/platform_browser/recaptcha/recaptcha.d.ts +7 -0
- package/dist/esm5/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +4 -4
- package/dist/esm5/src/platform_browser/strategies/phone.d.ts +10 -6
- package/dist/esm5/test/integration/flows/recaptcha_enterprise.test.d.ts +17 -0
- package/dist/index.webworker.esm5.js +163 -19
- package/dist/index.webworker.esm5.js.map +1 -1
- package/dist/node/index.js +1 -1
- package/dist/node/internal.js +1 -1
- package/dist/node/src/api/account_management/mfa.d.ts +5 -1
- package/dist/node/src/api/authentication/mfa.d.ts +5 -1
- package/dist/node/src/api/authentication/sms.d.ts +5 -1
- package/dist/node/src/api/index.d.ts +7 -3
- package/dist/node/src/platform_browser/providers/phone.d.ts +7 -5
- package/dist/node/src/platform_browser/recaptcha/recaptcha.d.ts +7 -0
- package/dist/node/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +4 -4
- package/dist/node/src/platform_browser/strategies/phone.d.ts +10 -6
- package/dist/node/test/integration/flows/recaptcha_enterprise.test.d.ts +17 -0
- package/dist/node/{totp-617e4db6.js → totp-c9a669c7.js} +164 -20
- package/dist/node/totp-c9a669c7.js.map +1 -0
- package/dist/node-esm/index.js +1 -1
- package/dist/node-esm/internal.js +2 -2
- package/dist/node-esm/src/api/account_management/mfa.d.ts +5 -1
- package/dist/node-esm/src/api/authentication/mfa.d.ts +5 -1
- package/dist/node-esm/src/api/authentication/sms.d.ts +5 -1
- package/dist/node-esm/src/api/index.d.ts +7 -3
- package/dist/node-esm/src/platform_browser/providers/phone.d.ts +7 -5
- package/dist/node-esm/src/platform_browser/recaptcha/recaptcha.d.ts +7 -0
- package/dist/node-esm/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +4 -4
- package/dist/node-esm/src/platform_browser/strategies/phone.d.ts +10 -6
- package/dist/node-esm/test/integration/flows/recaptcha_enterprise.test.d.ts +17 -0
- package/dist/node-esm/{totp-98ba6f1f.js → totp-9698d31a.js} +168 -30
- package/dist/node-esm/totp-9698d31a.js.map +1 -0
- package/dist/rn/{index-198b1e87.js → index-dd6cc9b0.js} +450 -195
- package/dist/rn/index-dd6cc9b0.js.map +1 -0
- package/dist/rn/index.js +1 -1
- package/dist/rn/internal.js +1 -1
- package/dist/rn/src/api/account_management/mfa.d.ts +5 -1
- package/dist/rn/src/api/authentication/mfa.d.ts +5 -1
- package/dist/rn/src/api/authentication/sms.d.ts +5 -1
- package/dist/rn/src/api/index.d.ts +7 -3
- package/dist/rn/src/platform_browser/providers/phone.d.ts +7 -5
- package/dist/rn/src/platform_browser/recaptcha/recaptcha.d.ts +7 -0
- package/dist/rn/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +4 -4
- package/dist/rn/src/platform_browser/strategies/phone.d.ts +10 -6
- package/dist/rn/test/integration/flows/recaptcha_enterprise.test.d.ts +17 -0
- package/dist/src/api/account_management/mfa.d.ts +5 -1
- package/dist/src/api/authentication/mfa.d.ts +5 -1
- package/dist/src/api/authentication/sms.d.ts +5 -1
- package/dist/src/api/index.d.ts +7 -3
- package/dist/src/platform_browser/providers/phone.d.ts +7 -5
- package/dist/src/platform_browser/recaptcha/recaptcha.d.ts +7 -0
- package/dist/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +4 -4
- package/dist/src/platform_browser/strategies/phone.d.ts +10 -6
- package/dist/test/integration/flows/recaptcha_enterprise.test.d.ts +17 -0
- package/dist/web-extension-cjs/index.js +1 -1
- package/dist/web-extension-cjs/internal.js +115 -147
- package/dist/web-extension-cjs/internal.js.map +1 -1
- package/dist/web-extension-cjs/{register-0aa8e295.js → register-1a706c5a.js} +283 -30
- package/dist/web-extension-cjs/register-1a706c5a.js.map +1 -0
- package/dist/web-extension-cjs/src/api/account_management/mfa.d.ts +5 -1
- package/dist/web-extension-cjs/src/api/authentication/mfa.d.ts +5 -1
- package/dist/web-extension-cjs/src/api/authentication/sms.d.ts +5 -1
- package/dist/web-extension-cjs/src/api/index.d.ts +7 -3
- package/dist/web-extension-cjs/src/platform_browser/providers/phone.d.ts +7 -5
- package/dist/web-extension-cjs/src/platform_browser/recaptcha/recaptcha.d.ts +7 -0
- package/dist/web-extension-cjs/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +4 -4
- package/dist/web-extension-cjs/src/platform_browser/strategies/phone.d.ts +10 -6
- package/dist/web-extension-cjs/test/integration/flows/recaptcha_enterprise.test.d.ts +17 -0
- package/dist/web-extension-esm2017/auth-web-extension-public.d.ts +7 -0
- package/dist/web-extension-esm2017/auth-web-extension.d.ts +7 -0
- package/dist/web-extension-esm2017/index.js +2 -2
- package/dist/web-extension-esm2017/internal.js +115 -147
- package/dist/web-extension-esm2017/internal.js.map +1 -1
- package/dist/web-extension-esm2017/{register-68ef89ff.js → register-3c017834.js} +280 -31
- package/dist/web-extension-esm2017/register-3c017834.js.map +1 -0
- package/dist/web-extension-esm2017/src/api/account_management/mfa.d.ts +5 -1
- package/dist/web-extension-esm2017/src/api/authentication/mfa.d.ts +5 -1
- package/dist/web-extension-esm2017/src/api/authentication/sms.d.ts +5 -1
- package/dist/web-extension-esm2017/src/api/index.d.ts +7 -3
- package/dist/web-extension-esm2017/src/platform_browser/providers/phone.d.ts +7 -5
- package/dist/web-extension-esm2017/src/platform_browser/recaptcha/recaptcha.d.ts +7 -0
- package/dist/web-extension-esm2017/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +4 -4
- package/dist/web-extension-esm2017/src/platform_browser/strategies/phone.d.ts +10 -6
- package/dist/web-extension-esm2017/test/integration/flows/recaptcha_enterprise.test.d.ts +17 -0
- package/package.json +6 -6
- package/dist/browser-cjs/index-8c4960c5.js.map +0 -1
- package/dist/cordova/popup_redirect-1e109c2a.js.map +0 -1
- package/dist/esm2017/index-6cb7b51a.js.map +0 -1
- package/dist/esm5/index-262b3f24.js.map +0 -1
- package/dist/node/totp-617e4db6.js.map +0 -1
- package/dist/node-esm/totp-98ba6f1f.js.map +0 -1
- package/dist/rn/index-198b1e87.js.map +0 -1
- package/dist/web-extension-cjs/register-0aa8e295.js.map +0 -1
- package/dist/web-extension-esm2017/register-68ef89ff.js.map +0 -1
package/dist/esm5/index.js
CHANGED
|
@@ -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 './index-
|
|
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 './index-82b3e33f.js';
|
|
2
2
|
import 'tslib';
|
|
3
3
|
import '@firebase/app';
|
|
4
4
|
import '@firebase/util';
|
package/dist/esm5/internal.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { au as _isIOS, av as _isAndroid, aw as _fail, ax as _getRedirectUrl, ay as debugAssert, az as _getProjectConfig, aA as _isIOS7Or8, aB as _assert, aC as _createError, aD as AuthEventManager, aE as _getInstance, b as browserLocalPersistence, aF as _persistenceKeyName, aG as _clearRedirectOutcomes, a as browserSessionPersistence, aH as _getRedirectResult, aI as _overrideRedirectResult, aJ as _castAuth } from './index-
|
|
2
|
-
export { A as ActionCodeOperation, ai as ActionCodeURL, L as AuthCredential, I as AuthErrorCodes, aL as AuthImpl, aO as AuthPopup, M as EmailAuthCredential, V as EmailAuthProvider, W as FacebookAuthProvider, F as FactorId, aP 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, aQ as SAMLAuthCredential, _ as SAMLAuthProvider, S as SignInMethod, T as TotpMultiFactorGenerator, n as TotpSecret, $ as TwitterAuthProvider, aK as UserImpl, aB as _assert, aJ as _castAuth, aw as _fail, aN as _generateEventId, aM as _getClientVersion, aE as _getInstance, aH as _getRedirectResult, aI as _overrideRedirectResult, aF 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 './index-
|
|
1
|
+
import { au as _isIOS, av as _isAndroid, aw as _fail, ax as _getRedirectUrl, ay as debugAssert, az as _getProjectConfig, aA as _isIOS7Or8, aB as _assert, aC as _createError, aD as AuthEventManager, aE as _getInstance, b as browserLocalPersistence, aF as _persistenceKeyName, aG as _clearRedirectOutcomes, a as browserSessionPersistence, aH as _getRedirectResult, aI as _overrideRedirectResult, aJ as _castAuth } from './index-82b3e33f.js';
|
|
2
|
+
export { A as ActionCodeOperation, ai as ActionCodeURL, L as AuthCredential, I as AuthErrorCodes, aL as AuthImpl, aO as AuthPopup, M as EmailAuthCredential, V as EmailAuthProvider, W as FacebookAuthProvider, F as FactorId, aP 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, aQ as SAMLAuthCredential, _ as SAMLAuthProvider, S as SignInMethod, T as TotpMultiFactorGenerator, n as TotpSecret, $ as TwitterAuthProvider, aK as UserImpl, aB as _assert, aJ as _castAuth, aw as _fail, aN as _generateEventId, aM as _getClientVersion, aE as _getInstance, aH as _getRedirectResult, aI as _overrideRedirectResult, aF 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 './index-82b3e33f.js';
|
|
3
3
|
import { __awaiter, __generator, __extends } from 'tslib';
|
|
4
4
|
import { querystringDecode } from '@firebase/util';
|
|
5
5
|
import '@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
|
|
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
|
|
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
|
|
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
|
|
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 -
|
|
78
|
-
*
|
|
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
|
|
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,
|
|
42
|
-
declare type ActionMethod<TRequest, TResponse> = (auth:
|
|
43
|
-
export declare function handleRecaptchaFlow<TRequest, TResponse>(authInstance: AuthInternal, request: TRequest, actionName: RecaptchaActionName, actionMethod: ActionMethod<TRequest, 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
|
|
31
|
-
* This SDK includes
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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 {};
|
|
@@ -555,7 +555,7 @@ function _initializeAuthInstance(auth, deps) {
|
|
|
555
555
|
}
|
|
556
556
|
|
|
557
557
|
var name = "@firebase/auth";
|
|
558
|
-
var version = "1.7.9-canary.
|
|
558
|
+
var version = "1.7.9-canary.b942e9e6e";
|
|
559
559
|
|
|
560
560
|
/**
|
|
561
561
|
* @license
|
|
@@ -4850,6 +4850,16 @@ var RecaptchaConfig = /** @class */ (function () {
|
|
|
4850
4850
|
"ENFORCE" /* EnforcementState.ENFORCE */ ||
|
|
4851
4851
|
this.getProviderEnforcementState(providerStr) === "AUDIT" /* EnforcementState.AUDIT */);
|
|
4852
4852
|
};
|
|
4853
|
+
/**
|
|
4854
|
+
* Returns true if reCAPTCHA Enterprise protection is enabled in at least one provider, otherwise
|
|
4855
|
+
* returns false.
|
|
4856
|
+
*
|
|
4857
|
+
* @returns Whether or not reCAPTCHA Enterprise protection is enabled for at least one provider.
|
|
4858
|
+
*/
|
|
4859
|
+
RecaptchaConfig.prototype.isAnyProviderEnabled = function () {
|
|
4860
|
+
return (this.isProviderEnabled("EMAIL_PASSWORD_PROVIDER" /* RecaptchaAuthProvider.EMAIL_PASSWORD_PROVIDER */) ||
|
|
4861
|
+
this.isProviderEnabled("PHONE_PROVIDER" /* RecaptchaAuthProvider.PHONE_PROVIDER */));
|
|
4862
|
+
};
|
|
4853
4863
|
return RecaptchaConfig;
|
|
4854
4864
|
}());
|
|
4855
4865
|
|
|
@@ -4912,6 +4922,60 @@ function _recaptchaEnterpriseScriptUrl() {
|
|
|
4912
4922
|
return externalJSProvider.recaptchaEnterpriseScript;
|
|
4913
4923
|
}
|
|
4914
4924
|
|
|
4925
|
+
/**
|
|
4926
|
+
* @license
|
|
4927
|
+
* Copyright 2020 Google LLC
|
|
4928
|
+
*
|
|
4929
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4930
|
+
* you may not use this file except in compliance with the License.
|
|
4931
|
+
* You may obtain a copy of the License at
|
|
4932
|
+
*
|
|
4933
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
4934
|
+
*
|
|
4935
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
4936
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
4937
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
4938
|
+
* See the License for the specific language governing permissions and
|
|
4939
|
+
* limitations under the License.
|
|
4940
|
+
*/
|
|
4941
|
+
var MockGreCAPTCHATopLevel = /** @class */ (function () {
|
|
4942
|
+
function MockGreCAPTCHATopLevel() {
|
|
4943
|
+
this.enterprise = new MockGreCAPTCHA();
|
|
4944
|
+
}
|
|
4945
|
+
MockGreCAPTCHATopLevel.prototype.ready = function (callback) {
|
|
4946
|
+
callback();
|
|
4947
|
+
};
|
|
4948
|
+
MockGreCAPTCHATopLevel.prototype.execute = function (
|
|
4949
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
4950
|
+
_siteKey, _options) {
|
|
4951
|
+
return Promise.resolve('token');
|
|
4952
|
+
};
|
|
4953
|
+
MockGreCAPTCHATopLevel.prototype.render = function (
|
|
4954
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
4955
|
+
_container, _parameters) {
|
|
4956
|
+
return '';
|
|
4957
|
+
};
|
|
4958
|
+
return MockGreCAPTCHATopLevel;
|
|
4959
|
+
}());
|
|
4960
|
+
var MockGreCAPTCHA = /** @class */ (function () {
|
|
4961
|
+
function MockGreCAPTCHA() {
|
|
4962
|
+
}
|
|
4963
|
+
MockGreCAPTCHA.prototype.ready = function (callback) {
|
|
4964
|
+
callback();
|
|
4965
|
+
};
|
|
4966
|
+
MockGreCAPTCHA.prototype.execute = function (
|
|
4967
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
4968
|
+
_siteKey, _options) {
|
|
4969
|
+
return Promise.resolve('token');
|
|
4970
|
+
};
|
|
4971
|
+
MockGreCAPTCHA.prototype.render = function (
|
|
4972
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
4973
|
+
_container, _parameters) {
|
|
4974
|
+
return '';
|
|
4975
|
+
};
|
|
4976
|
+
return MockGreCAPTCHA;
|
|
4977
|
+
}());
|
|
4978
|
+
|
|
4915
4979
|
/* eslint-disable @typescript-eslint/no-require-imports */
|
|
4916
4980
|
var RECAPTCHA_ENTERPRISE_VERIFIER_TYPE = 'recaptcha-enterprise';
|
|
4917
4981
|
var FAKE_TOKEN = 'NO_RECAPTCHA';
|
|
@@ -4998,8 +5062,14 @@ var RecaptchaEnterpriseVerifier = /** @class */ (function () {
|
|
|
4998
5062
|
reject(Error('No reCAPTCHA enterprise script loaded.'));
|
|
4999
5063
|
}
|
|
5000
5064
|
}
|
|
5065
|
+
var mockRecaptcha;
|
|
5001
5066
|
var _this = this;
|
|
5002
5067
|
return __generator(this, function (_a) {
|
|
5068
|
+
// Returns Promise for a mock token when appVerificationDisabledForTesting is true.
|
|
5069
|
+
if (this.auth.settings.appVerificationDisabledForTesting) {
|
|
5070
|
+
mockRecaptcha = new MockGreCAPTCHATopLevel();
|
|
5071
|
+
return [2 /*return*/, mockRecaptcha.execute('siteKey', { action: 'verify' })];
|
|
5072
|
+
}
|
|
5003
5073
|
return [2 /*return*/, new Promise(function (resolve, reject) {
|
|
5004
5074
|
retrieveSiteKey(_this.auth)
|
|
5005
5075
|
.then(function (siteKey) {
|
|
@@ -5033,15 +5103,18 @@ var RecaptchaEnterpriseVerifier = /** @class */ (function () {
|
|
|
5033
5103
|
};
|
|
5034
5104
|
return RecaptchaEnterpriseVerifier;
|
|
5035
5105
|
}());
|
|
5036
|
-
function injectRecaptchaFields(auth, request, action,
|
|
5037
|
-
if (
|
|
5106
|
+
function injectRecaptchaFields(auth, request, action, isCaptchaResp, isFakeToken) {
|
|
5107
|
+
if (isCaptchaResp === void 0) { isCaptchaResp = false; }
|
|
5108
|
+
if (isFakeToken === void 0) { isFakeToken = false; }
|
|
5038
5109
|
return __awaiter(this, void 0, void 0, function () {
|
|
5039
|
-
var verifier, captchaResponse, newRequest;
|
|
5110
|
+
var verifier, captchaResponse, newRequest, phoneNumber, recaptchaToken, recaptchaToken;
|
|
5040
5111
|
return __generator(this, function (_a) {
|
|
5041
5112
|
switch (_a.label) {
|
|
5042
5113
|
case 0:
|
|
5043
5114
|
verifier = new RecaptchaEnterpriseVerifier(auth);
|
|
5044
|
-
|
|
5115
|
+
if (!isFakeToken) return [3 /*break*/, 1];
|
|
5116
|
+
captchaResponse = FAKE_TOKEN;
|
|
5117
|
+
return [3 /*break*/, 5];
|
|
5045
5118
|
case 1:
|
|
5046
5119
|
_a.trys.push([1, 3, , 5]);
|
|
5047
5120
|
return [4 /*yield*/, verifier.verify(action)];
|
|
@@ -5056,7 +5129,35 @@ function injectRecaptchaFields(auth, request, action, captchaResp) {
|
|
|
5056
5129
|
return [3 /*break*/, 5];
|
|
5057
5130
|
case 5:
|
|
5058
5131
|
newRequest = __assign({}, request);
|
|
5059
|
-
if (
|
|
5132
|
+
if (action === "mfaSmsEnrollment" /* RecaptchaActionName.MFA_SMS_ENROLLMENT */ ||
|
|
5133
|
+
action === "mfaSmsSignIn" /* RecaptchaActionName.MFA_SMS_SIGNIN */) {
|
|
5134
|
+
if ('phoneEnrollmentInfo' in newRequest) {
|
|
5135
|
+
phoneNumber = newRequest.phoneEnrollmentInfo.phoneNumber;
|
|
5136
|
+
recaptchaToken = newRequest.phoneEnrollmentInfo.recaptchaToken;
|
|
5137
|
+
Object.assign(newRequest, {
|
|
5138
|
+
'phoneEnrollmentInfo': {
|
|
5139
|
+
phoneNumber: phoneNumber,
|
|
5140
|
+
recaptchaToken: recaptchaToken,
|
|
5141
|
+
captchaResponse: captchaResponse,
|
|
5142
|
+
'clientType': "CLIENT_TYPE_WEB" /* RecaptchaClientType.WEB */,
|
|
5143
|
+
'recaptchaVersion': "RECAPTCHA_ENTERPRISE" /* RecaptchaVersion.ENTERPRISE */
|
|
5144
|
+
}
|
|
5145
|
+
});
|
|
5146
|
+
}
|
|
5147
|
+
else if ('phoneSignInInfo' in newRequest) {
|
|
5148
|
+
recaptchaToken = newRequest.phoneSignInInfo.recaptchaToken;
|
|
5149
|
+
Object.assign(newRequest, {
|
|
5150
|
+
'phoneSignInInfo': {
|
|
5151
|
+
recaptchaToken: recaptchaToken,
|
|
5152
|
+
captchaResponse: captchaResponse,
|
|
5153
|
+
'clientType': "CLIENT_TYPE_WEB" /* RecaptchaClientType.WEB */,
|
|
5154
|
+
'recaptchaVersion': "RECAPTCHA_ENTERPRISE" /* RecaptchaVersion.ENTERPRISE */
|
|
5155
|
+
}
|
|
5156
|
+
});
|
|
5157
|
+
}
|
|
5158
|
+
return [2 /*return*/, newRequest];
|
|
5159
|
+
}
|
|
5160
|
+
if (!isCaptchaResp) {
|
|
5060
5161
|
Object.assign(newRequest, { captchaResponse: captchaResponse });
|
|
5061
5162
|
}
|
|
5062
5163
|
else {
|
|
@@ -5071,19 +5172,20 @@ function injectRecaptchaFields(auth, request, action, captchaResp) {
|
|
|
5071
5172
|
});
|
|
5072
5173
|
});
|
|
5073
5174
|
}
|
|
5074
|
-
function handleRecaptchaFlow(authInstance, request, actionName, actionMethod) {
|
|
5075
|
-
var _a;
|
|
5175
|
+
function handleRecaptchaFlow(authInstance, request, actionName, actionMethod, recaptchaAuthProvider) {
|
|
5176
|
+
var _a, _b;
|
|
5076
5177
|
return __awaiter(this, void 0, void 0, function () {
|
|
5077
|
-
var requestWithRecaptcha;
|
|
5178
|
+
var requestWithRecaptcha, requestWithRecaptcha, requestWithRecaptchaFields;
|
|
5078
5179
|
var _this = this;
|
|
5079
|
-
return __generator(this, function (
|
|
5080
|
-
switch (
|
|
5180
|
+
return __generator(this, function (_c) {
|
|
5181
|
+
switch (_c.label) {
|
|
5081
5182
|
case 0:
|
|
5183
|
+
if (!(recaptchaAuthProvider === "EMAIL_PASSWORD_PROVIDER" /* RecaptchaAuthProvider.EMAIL_PASSWORD_PROVIDER */)) return [3 /*break*/, 4];
|
|
5082
5184
|
if (!((_a = authInstance
|
|
5083
|
-
._getRecaptchaConfig()) === null || _a === void 0 ? void 0 : _a.isProviderEnabled("EMAIL_PASSWORD_PROVIDER" /*
|
|
5185
|
+
._getRecaptchaConfig()) === null || _a === void 0 ? void 0 : _a.isProviderEnabled("EMAIL_PASSWORD_PROVIDER" /* RecaptchaAuthProvider.EMAIL_PASSWORD_PROVIDER */))) return [3 /*break*/, 2];
|
|
5084
5186
|
return [4 /*yield*/, injectRecaptchaFields(authInstance, request, actionName, actionName === "getOobCode" /* RecaptchaActionName.GET_OOB_CODE */)];
|
|
5085
5187
|
case 1:
|
|
5086
|
-
requestWithRecaptcha =
|
|
5188
|
+
requestWithRecaptcha = _c.sent();
|
|
5087
5189
|
return [2 /*return*/, actionMethod(authInstance, requestWithRecaptcha)];
|
|
5088
5190
|
case 2: return [2 /*return*/, actionMethod(authInstance, request).catch(function (error) { return __awaiter(_this, void 0, void 0, function () {
|
|
5089
5191
|
var requestWithRecaptcha;
|
|
@@ -5100,6 +5202,48 @@ function handleRecaptchaFlow(authInstance, request, actionName, actionMethod) {
|
|
|
5100
5202
|
}
|
|
5101
5203
|
});
|
|
5102
5204
|
}); })];
|
|
5205
|
+
case 3: return [3 /*break*/, 10];
|
|
5206
|
+
case 4:
|
|
5207
|
+
if (!(recaptchaAuthProvider === "PHONE_PROVIDER" /* RecaptchaAuthProvider.PHONE_PROVIDER */)) return [3 /*break*/, 9];
|
|
5208
|
+
if (!((_b = authInstance
|
|
5209
|
+
._getRecaptchaConfig()) === null || _b === void 0 ? void 0 : _b.isProviderEnabled("PHONE_PROVIDER" /* RecaptchaAuthProvider.PHONE_PROVIDER */))) return [3 /*break*/, 6];
|
|
5210
|
+
return [4 /*yield*/, injectRecaptchaFields(authInstance, request, actionName)];
|
|
5211
|
+
case 5:
|
|
5212
|
+
requestWithRecaptcha = _c.sent();
|
|
5213
|
+
return [2 /*return*/, actionMethod(authInstance, requestWithRecaptcha).catch(function (error) { return __awaiter(_this, void 0, void 0, function () {
|
|
5214
|
+
var requestWithRecaptchaFields;
|
|
5215
|
+
var _a;
|
|
5216
|
+
return __generator(this, function (_b) {
|
|
5217
|
+
switch (_b.label) {
|
|
5218
|
+
case 0:
|
|
5219
|
+
if (!(((_a = authInstance
|
|
5220
|
+
._getRecaptchaConfig()) === null || _a === void 0 ? void 0 : _a.getProviderEnforcementState("PHONE_PROVIDER" /* RecaptchaAuthProvider.PHONE_PROVIDER */)) === "AUDIT" /* EnforcementState.AUDIT */)) return [3 /*break*/, 2];
|
|
5221
|
+
if (!(error.code === "auth/".concat("missing-recaptcha-token" /* AuthErrorCode.MISSING_RECAPTCHA_TOKEN */) ||
|
|
5222
|
+
error.code === "auth/".concat("invalid-app-credential" /* AuthErrorCode.INVALID_APP_CREDENTIAL */))) return [3 /*break*/, 2];
|
|
5223
|
+
console.log("Failed to verify with reCAPTCHA Enterprise. Automatically triggering the reCAPTCHA v2 flow to complete the ".concat(actionName, " flow."));
|
|
5224
|
+
return [4 /*yield*/, injectRecaptchaFields(authInstance, request, actionName, false, // isCaptchaResp
|
|
5225
|
+
true // isFakeToken
|
|
5226
|
+
)];
|
|
5227
|
+
case 1:
|
|
5228
|
+
requestWithRecaptchaFields = _b.sent();
|
|
5229
|
+
// This will call the PhoneApiCaller to fetch and inject reCAPTCHA v2 token.
|
|
5230
|
+
return [2 /*return*/, actionMethod(authInstance, requestWithRecaptchaFields)];
|
|
5231
|
+
case 2:
|
|
5232
|
+
// ENFORCE mode or AUDIT mode with any other error.
|
|
5233
|
+
return [2 /*return*/, Promise.reject(error)];
|
|
5234
|
+
}
|
|
5235
|
+
});
|
|
5236
|
+
}); })];
|
|
5237
|
+
case 6: return [4 /*yield*/, injectRecaptchaFields(authInstance, request, actionName, false, // isCaptchaResp
|
|
5238
|
+
true // isFakeToken
|
|
5239
|
+
)];
|
|
5240
|
+
case 7:
|
|
5241
|
+
requestWithRecaptchaFields = _c.sent();
|
|
5242
|
+
// This will call the PhoneApiCaller to fetch and inject v2 token.
|
|
5243
|
+
return [2 /*return*/, actionMethod(authInstance, requestWithRecaptchaFields)];
|
|
5244
|
+
case 8: return [3 /*break*/, 10];
|
|
5245
|
+
case 9: return [2 /*return*/, Promise.reject(recaptchaAuthProvider + ' provider is not supported.')];
|
|
5246
|
+
case 10: return [2 /*return*/];
|
|
5103
5247
|
}
|
|
5104
5248
|
});
|
|
5105
5249
|
});
|
|
@@ -5124,7 +5268,7 @@ function _initializeRecaptchaConfig(auth) {
|
|
|
5124
5268
|
else {
|
|
5125
5269
|
authInternal._tenantRecaptchaConfigs[authInternal.tenantId] = config;
|
|
5126
5270
|
}
|
|
5127
|
-
if (config.
|
|
5271
|
+
if (config.isAnyProviderEnabled()) {
|
|
5128
5272
|
verifier = new RecaptchaEnterpriseVerifier(authInternal);
|
|
5129
5273
|
void verifier.verify();
|
|
5130
5274
|
}
|
|
@@ -5542,7 +5686,7 @@ var EmailAuthCredential = /** @class */ (function (_super) {
|
|
|
5542
5686
|
password: this._password,
|
|
5543
5687
|
clientType: "CLIENT_TYPE_WEB" /* RecaptchaClientType.WEB */
|
|
5544
5688
|
};
|
|
5545
|
-
return [2 /*return*/, handleRecaptchaFlow(auth, request, "signInWithPassword" /* RecaptchaActionName.SIGN_IN_WITH_PASSWORD */, signInWithPassword)];
|
|
5689
|
+
return [2 /*return*/, handleRecaptchaFlow(auth, request, "signInWithPassword" /* RecaptchaActionName.SIGN_IN_WITH_PASSWORD */, signInWithPassword, "EMAIL_PASSWORD_PROVIDER" /* RecaptchaAuthProvider.EMAIL_PASSWORD_PROVIDER */)];
|
|
5546
5690
|
case "emailLink" /* SignInMethod.EMAIL_LINK */:
|
|
5547
5691
|
return [2 /*return*/, signInWithEmailLink$1(auth, {
|
|
5548
5692
|
email: this._email,
|
|
@@ -5569,7 +5713,7 @@ var EmailAuthCredential = /** @class */ (function (_super) {
|
|
|
5569
5713
|
password: this._password,
|
|
5570
5714
|
clientType: "CLIENT_TYPE_WEB" /* RecaptchaClientType.WEB */
|
|
5571
5715
|
};
|
|
5572
|
-
return [2 /*return*/, handleRecaptchaFlow(auth, request, "signUpPassword" /* RecaptchaActionName.SIGN_UP_PASSWORD */, linkEmailPassword)];
|
|
5716
|
+
return [2 /*return*/, handleRecaptchaFlow(auth, request, "signUpPassword" /* RecaptchaActionName.SIGN_UP_PASSWORD */, linkEmailPassword, "EMAIL_PASSWORD_PROVIDER" /* RecaptchaAuthProvider.EMAIL_PASSWORD_PROVIDER */)];
|
|
5573
5717
|
case "emailLink" /* SignInMethod.EMAIL_LINK */:
|
|
5574
5718
|
return [2 /*return*/, signInWithEmailLinkForLinking(auth, {
|
|
5575
5719
|
idToken: idToken,
|
|
@@ -7805,7 +7949,7 @@ function sendPasswordResetEmail(auth, email, actionCodeSettings) {
|
|
|
7805
7949
|
if (actionCodeSettings) {
|
|
7806
7950
|
_setActionCodeSettingsOnRequest(authInternal, request, actionCodeSettings);
|
|
7807
7951
|
}
|
|
7808
|
-
return [4 /*yield*/, handleRecaptchaFlow(authInternal, request, "getOobCode" /* RecaptchaActionName.GET_OOB_CODE */, sendPasswordResetEmail$1)];
|
|
7952
|
+
return [4 /*yield*/, handleRecaptchaFlow(authInternal, request, "getOobCode" /* RecaptchaActionName.GET_OOB_CODE */, sendPasswordResetEmail$1, "EMAIL_PASSWORD_PROVIDER" /* RecaptchaAuthProvider.EMAIL_PASSWORD_PROVIDER */)];
|
|
7809
7953
|
case 1:
|
|
7810
7954
|
_a.sent();
|
|
7811
7955
|
return [2 /*return*/];
|
|
@@ -7981,7 +8125,7 @@ function createUserWithEmailAndPassword(auth, email, password) {
|
|
|
7981
8125
|
password: password,
|
|
7982
8126
|
clientType: "CLIENT_TYPE_WEB" /* RecaptchaClientType.WEB */
|
|
7983
8127
|
};
|
|
7984
|
-
signUpResponse = handleRecaptchaFlow(authInternal, request, "signUpPassword" /* RecaptchaActionName.SIGN_UP_PASSWORD */, signUp);
|
|
8128
|
+
signUpResponse = handleRecaptchaFlow(authInternal, request, "signUpPassword" /* RecaptchaActionName.SIGN_UP_PASSWORD */, signUp, "EMAIL_PASSWORD_PROVIDER" /* RecaptchaAuthProvider.EMAIL_PASSWORD_PROVIDER */);
|
|
7985
8129
|
return [4 /*yield*/, signUpResponse.catch(function (error) {
|
|
7986
8130
|
if (error.code === "auth/".concat("password-does-not-meet-requirements" /* AuthErrorCode.PASSWORD_DOES_NOT_MEET_REQUIREMENTS */)) {
|
|
7987
8131
|
void recachePasswordPolicy(auth);
|
|
@@ -8112,7 +8256,7 @@ function sendSignInLinkToEmail(auth, email, actionCodeSettings) {
|
|
|
8112
8256
|
clientType: "CLIENT_TYPE_WEB" /* RecaptchaClientType.WEB */
|
|
8113
8257
|
};
|
|
8114
8258
|
setActionCodeSettings(request, actionCodeSettings);
|
|
8115
|
-
return [4 /*yield*/, handleRecaptchaFlow(authInternal, request, "getOobCode" /* RecaptchaActionName.GET_OOB_CODE */, sendSignInLinkToEmail$1)];
|
|
8259
|
+
return [4 /*yield*/, handleRecaptchaFlow(authInternal, request, "getOobCode" /* RecaptchaActionName.GET_OOB_CODE */, sendSignInLinkToEmail$1, "EMAIL_PASSWORD_PROVIDER" /* RecaptchaAuthProvider.EMAIL_PASSWORD_PROVIDER */)];
|
|
8116
8260
|
case 1:
|
|
8117
8261
|
_a.sent();
|
|
8118
8262
|
return [2 /*return*/];
|