@firebase/auth 1.7.9 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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-e2e765e6.js → index-b60d3212.js} +393 -176
- package/dist/browser-cjs/index-b60d3212.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/cordova/auth-cordova-public.d.ts +7 -0
- package/dist/cordova/auth-cordova.d.ts +7 -0
- package/dist/cordova/index.js +6 -7
- package/dist/cordova/index.js.map +1 -1
- package/dist/cordova/internal.js +660 -985
- package/dist/cordova/internal.js.map +1 -1
- package/dist/cordova/popup_redirect-6fcd583a.js +9635 -0
- package/dist/cordova/popup_redirect-6fcd583a.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/{esm5/src/api/account_management/mfa.test.d.ts → cordova/test/integration/flows/recaptcha_enterprise.test.d.ts} +1 -1
- package/dist/esm2017/{index-68602d24.js → index-a7d5cfcc.js} +393 -176
- package/dist/esm2017/index-a7d5cfcc.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/{esm5/src/api/account_management/email_and_password.test.d.ts → esm2017/test/integration/flows/recaptcha_enterprise.test.d.ts} +1 -1
- package/dist/index.webworker.js +7912 -0
- package/dist/index.webworker.js.map +1 -0
- package/dist/node/index.js +2 -3
- package/dist/node/index.js.map +1 -1
- package/dist/node/internal.js +555 -844
- package/dist/node/internal.js.map +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-ab108bed.js +7582 -0
- package/dist/node/totp-ab108bed.js.map +1 -0
- package/dist/node-esm/index.js +1 -2
- package/dist/node-esm/index.js.map +1 -1
- package/dist/node-esm/internal.js +2 -3
- package/dist/node-esm/internal.js.map +1 -1
- 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/{esm5/scripts/run_node_tests.d.ts → node-esm/test/integration/flows/recaptcha_enterprise.test.d.ts} +1 -1
- package/dist/node-esm/{totp-219bb96f.js → totp-f311e20a.js} +170 -33
- package/dist/node-esm/totp-f311e20a.js.map +1 -0
- package/dist/rn/index-4d73adbf.js +8575 -0
- package/dist/rn/index-4d73adbf.js.map +1 -0
- package/dist/rn/index.js +45 -55
- package/dist/rn/index.js.map +1 -1
- package/dist/rn/internal.js +1195 -1890
- package/dist/rn/internal.js.map +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-674a8250.js → register-17c71bd5.js} +284 -31
- package/dist/web-extension-cjs/register-17c71bd5.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-428f8789.js → register-77f1d56a.js} +281 -32
- package/dist/web-extension-esm2017/register-77f1d56a.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/internal/package.json +5 -3
- package/package.json +10 -11
- package/dist/browser-cjs/index-e2e765e6.js.map +0 -1
- package/dist/cordova/popup_redirect-abcbab4c.js +0 -11249
- package/dist/cordova/popup_redirect-abcbab4c.js.map +0 -1
- package/dist/esm2017/index-68602d24.js.map +0 -1
- package/dist/esm5/index-c0803b14.js +0 -12741
- package/dist/esm5/index-c0803b14.js.map +0 -1
- package/dist/esm5/index.cordova.d.ts +0 -32
- package/dist/esm5/index.d.ts +0 -37
- package/dist/esm5/index.doc.d.ts +0 -24
- package/dist/esm5/index.js +0 -7
- package/dist/esm5/index.js.map +0 -1
- package/dist/esm5/index.node.d.ts +0 -17
- package/dist/esm5/index.rn.d.ts +0 -40
- package/dist/esm5/index.shared.d.ts +0 -19
- package/dist/esm5/index.web-extension.d.ts +0 -31
- package/dist/esm5/index.webworker.d.ts +0 -21
- package/dist/esm5/internal/index.d.ts +0 -42
- package/dist/esm5/internal.js +0 -682
- package/dist/esm5/internal.js.map +0 -1
- package/dist/esm5/src/api/account_management/account.d.ts +0 -59
- package/dist/esm5/src/api/account_management/account.test.d.ts +0 -17
- package/dist/esm5/src/api/account_management/email_and_password.d.ts +0 -49
- package/dist/esm5/src/api/account_management/mfa.d.ts +0 -103
- package/dist/esm5/src/api/account_management/profile.d.ts +0 -29
- package/dist/esm5/src/api/account_management/profile.test.d.ts +0 -17
- package/dist/esm5/src/api/authentication/create_auth_uri.d.ts +0 -26
- package/dist/esm5/src/api/authentication/create_auth_uri.test.d.ts +0 -17
- package/dist/esm5/src/api/authentication/custom_token.d.ts +0 -26
- package/dist/esm5/src/api/authentication/custom_token.test.d.ts +0 -17
- package/dist/esm5/src/api/authentication/email_and_password.d.ts +0 -85
- package/dist/esm5/src/api/authentication/email_and_password.test.d.ts +0 -17
- package/dist/esm5/src/api/authentication/email_link.d.ts +0 -32
- package/dist/esm5/src/api/authentication/email_link.test.d.ts +0 -17
- package/dist/esm5/src/api/authentication/idp.d.ts +0 -40
- package/dist/esm5/src/api/authentication/idp.test.d.ts +0 -17
- package/dist/esm5/src/api/authentication/mfa.d.ts +0 -69
- package/dist/esm5/src/api/authentication/mfa.test.d.ts +0 -17
- package/dist/esm5/src/api/authentication/recaptcha.d.ts +0 -34
- package/dist/esm5/src/api/authentication/recaptcha.test.d.ts +0 -17
- package/dist/esm5/src/api/authentication/sign_up.d.ts +0 -34
- package/dist/esm5/src/api/authentication/sign_up.test.d.ts +0 -17
- package/dist/esm5/src/api/authentication/sms.d.ts +0 -50
- package/dist/esm5/src/api/authentication/sms.test.d.ts +0 -17
- package/dist/esm5/src/api/authentication/token.d.ts +0 -37
- package/dist/esm5/src/api/authentication/token.test.d.ts +0 -17
- package/dist/esm5/src/api/errors.d.ts +0 -128
- package/dist/esm5/src/api/index.d.ts +0 -97
- package/dist/esm5/src/api/index.test.d.ts +0 -17
- package/dist/esm5/src/api/password_policy/get_password_policy.d.ts +0 -48
- package/dist/esm5/src/api/password_policy/get_password_policy.test.d.ts +0 -17
- package/dist/esm5/src/api/project_config/get_project_config.d.ts +0 -25
- package/dist/esm5/src/api/project_config/get_project_config.test.d.ts +0 -17
- package/dist/esm5/src/core/action_code_url.d.ts +0 -73
- package/dist/esm5/src/core/action_code_url.test.d.ts +0 -17
- package/dist/esm5/src/core/auth/auth_event_manager.d.ts +0 -34
- package/dist/esm5/src/core/auth/auth_event_manager.test.d.ts +0 -17
- package/dist/esm5/src/core/auth/auth_impl.d.ts +0 -130
- package/dist/esm5/src/core/auth/auth_impl.test.d.ts +0 -17
- package/dist/esm5/src/core/auth/emulator.d.ts +0 -42
- package/dist/esm5/src/core/auth/emulator.test.d.ts +0 -17
- package/dist/esm5/src/core/auth/firebase_internal.d.ts +0 -35
- package/dist/esm5/src/core/auth/firebase_internal.test.d.ts +0 -17
- package/dist/esm5/src/core/auth/initialize.d.ts +0 -46
- package/dist/esm5/src/core/auth/initialize.test.d.ts +0 -17
- package/dist/esm5/src/core/auth/middleware.d.ts +0 -25
- package/dist/esm5/src/core/auth/middleware.test.d.ts +0 -17
- package/dist/esm5/src/core/auth/password_policy_impl.d.ts +0 -59
- package/dist/esm5/src/core/auth/password_policy_impl.test.d.ts +0 -17
- package/dist/esm5/src/core/auth/register.d.ts +0 -23
- package/dist/esm5/src/core/credentials/auth_credential.d.ts +0 -75
- package/dist/esm5/src/core/credentials/email.d.ts +0 -60
- package/dist/esm5/src/core/credentials/email.test.d.ts +0 -17
- package/dist/esm5/src/core/credentials/index.d.ts +0 -23
- package/dist/esm5/src/core/credentials/oauth.d.ts +0 -81
- package/dist/esm5/src/core/credentials/oauth.test.d.ts +0 -17
- package/dist/esm5/src/core/credentials/phone.d.ts +0 -52
- package/dist/esm5/src/core/credentials/phone.test.d.ts +0 -17
- package/dist/esm5/src/core/credentials/saml.d.ts +0 -52
- package/dist/esm5/src/core/credentials/saml.test.d.ts +0 -17
- package/dist/esm5/src/core/errors.d.ts +0 -325
- package/dist/esm5/src/core/errors.test.d.ts +0 -17
- package/dist/esm5/src/core/index.d.ts +0 -230
- package/dist/esm5/src/core/persistence/in_memory.d.ts +0 -35
- package/dist/esm5/src/core/persistence/in_memory.test.d.ts +0 -17
- package/dist/esm5/src/core/persistence/index.d.ts +0 -41
- package/dist/esm5/src/core/persistence/persistence_user_manager.d.ts +0 -45
- package/dist/esm5/src/core/persistence/persistence_user_manager.test.d.ts +0 -17
- package/dist/esm5/src/core/providers/email.d.ts +0 -83
- package/dist/esm5/src/core/providers/email.test.d.ts +0 -17
- package/dist/esm5/src/core/providers/facebook.d.ts +0 -93
- package/dist/esm5/src/core/providers/facebook.test.d.ts +0 -17
- package/dist/esm5/src/core/providers/federated.d.ts +0 -64
- package/dist/esm5/src/core/providers/federated.test.d.ts +0 -17
- package/dist/esm5/src/core/providers/github.d.ts +0 -89
- package/dist/esm5/src/core/providers/github.test.d.ts +0 -17
- package/dist/esm5/src/core/providers/google.d.ts +0 -96
- package/dist/esm5/src/core/providers/google.test.d.ts +0 -17
- package/dist/esm5/src/core/providers/oauth.d.ts +0 -151
- package/dist/esm5/src/core/providers/oauth.test.d.ts +0 -17
- package/dist/esm5/src/core/providers/saml.d.ts +0 -62
- package/dist/esm5/src/core/providers/saml.test.d.ts +0 -17
- package/dist/esm5/src/core/providers/twitter.d.ts +0 -103
- package/dist/esm5/src/core/providers/twitter.test.d.ts +0 -17
- package/dist/esm5/src/core/strategies/abstract_popup_redirect_operation.d.ts +0 -44
- package/dist/esm5/src/core/strategies/abstract_popup_redirect_operation.test.d.ts +0 -17
- package/dist/esm5/src/core/strategies/action_code_settings.d.ts +0 -19
- package/dist/esm5/src/core/strategies/action_code_settings.test.d.ts +0 -17
- package/dist/esm5/src/core/strategies/anonymous.d.ts +0 -32
- package/dist/esm5/src/core/strategies/anonymous.test.d.ts +0 -17
- package/dist/esm5/src/core/strategies/credential.d.ts +0 -64
- package/dist/esm5/src/core/strategies/credential.test.d.ts +0 -17
- package/dist/esm5/src/core/strategies/custom_token.d.ts +0 -37
- package/dist/esm5/src/core/strategies/custom_token.test.d.ts +0 -17
- package/dist/esm5/src/core/strategies/email.d.ts +0 -104
- package/dist/esm5/src/core/strategies/email.test.d.ts +0 -17
- package/dist/esm5/src/core/strategies/email_and_password.d.ts +0 -139
- package/dist/esm5/src/core/strategies/email_and_password.test.d.ts +0 -17
- package/dist/esm5/src/core/strategies/email_link.d.ts +0 -107
- package/dist/esm5/src/core/strategies/email_link.test.d.ts +0 -17
- package/dist/esm5/src/core/strategies/idp.d.ts +0 -32
- package/dist/esm5/src/core/strategies/idp.test.d.ts +0 -17
- package/dist/esm5/src/core/strategies/redirect.d.ts +0 -36
- package/dist/esm5/src/core/strategies/redirect.test.d.ts +0 -17
- package/dist/esm5/src/core/user/account_info.d.ts +0 -68
- package/dist/esm5/src/core/user/account_info.test.d.ts +0 -17
- package/dist/esm5/src/core/user/additional_user_info.d.ts +0 -31
- package/dist/esm5/src/core/user/additional_user_info.test.d.ts +0 -17
- package/dist/esm5/src/core/user/id_token_result.d.ts +0 -48
- package/dist/esm5/src/core/user/id_token_result.test.d.ts +0 -17
- package/dist/esm5/src/core/user/invalidation.d.ts +0 -18
- package/dist/esm5/src/core/user/invalidation.test.d.ts +0 -17
- package/dist/esm5/src/core/user/link_unlink.d.ts +0 -30
- package/dist/esm5/src/core/user/link_unlink.test.d.ts +0 -17
- package/dist/esm5/src/core/user/proactive_refresh.d.ts +0 -34
- package/dist/esm5/src/core/user/proactive_refresh.test.d.ts +0 -17
- package/dist/esm5/src/core/user/reauthenticate.d.ts +0 -20
- package/dist/esm5/src/core/user/reauthenticate.test.d.ts +0 -17
- package/dist/esm5/src/core/user/reload.d.ts +0 -29
- package/dist/esm5/src/core/user/reload.test.d.ts +0 -17
- package/dist/esm5/src/core/user/token_manager.d.ts +0 -50
- package/dist/esm5/src/core/user/token_manager.test.d.ts +0 -17
- package/dist/esm5/src/core/user/user_credential_impl.d.ts +0 -37
- package/dist/esm5/src/core/user/user_credential_impl.test.d.ts +0 -17
- package/dist/esm5/src/core/user/user_impl.d.ts +0 -74
- package/dist/esm5/src/core/user/user_impl.test.d.ts +0 -17
- package/dist/esm5/src/core/user/user_metadata.d.ts +0 -27
- package/dist/esm5/src/core/util/assert.d.ts +0 -94
- package/dist/esm5/src/core/util/assert.test.d.ts +0 -17
- package/dist/esm5/src/core/util/browser.d.ts +0 -50
- package/dist/esm5/src/core/util/browser.test.d.ts +0 -17
- package/dist/esm5/src/core/util/delay.d.ts +0 -31
- package/dist/esm5/src/core/util/delay.test.d.ts +0 -17
- package/dist/esm5/src/core/util/emulator.d.ts +0 -18
- package/dist/esm5/src/core/util/emulator.test.d.ts +0 -17
- package/dist/esm5/src/core/util/event_id.d.ts +0 -17
- package/dist/esm5/src/core/util/event_id.test.d.ts +0 -17
- package/dist/esm5/src/core/util/fetch_provider.d.ts +0 -25
- package/dist/esm5/src/core/util/handler.d.ts +0 -20
- package/dist/esm5/src/core/util/instantiator.d.ts +0 -28
- package/dist/esm5/src/core/util/instantiator.test.d.ts +0 -17
- package/dist/esm5/src/core/util/location.d.ts +0 -19
- package/dist/esm5/src/core/util/log.d.ts +0 -23
- package/dist/esm5/src/core/util/navigator.d.ts +0 -21
- package/dist/esm5/src/core/util/providers.d.ts +0 -23
- package/dist/esm5/src/core/util/resolver.d.ts +0 -25
- package/dist/esm5/src/core/util/time.d.ts +0 -17
- package/dist/esm5/src/core/util/validate_origin.d.ts +0 -18
- package/dist/esm5/src/core/util/validate_origin.test.d.ts +0 -17
- package/dist/esm5/src/core/util/version.d.ts +0 -31
- package/dist/esm5/src/core/util/version.test.d.ts +0 -17
- package/dist/esm5/src/index.d.ts +0 -18
- package/dist/esm5/src/mfa/assertions/totp.d.ts +0 -124
- package/dist/esm5/src/mfa/assertions/totp.test.d.ts +0 -17
- package/dist/esm5/src/mfa/index.d.ts +0 -18
- package/dist/esm5/src/mfa/mfa_assertion.d.ts +0 -27
- package/dist/esm5/src/mfa/mfa_error.d.ts +0 -35
- package/dist/esm5/src/mfa/mfa_info.d.ts +0 -36
- package/dist/esm5/src/mfa/mfa_info.test.d.ts +0 -17
- package/dist/esm5/src/mfa/mfa_resolver.d.ts +0 -41
- package/dist/esm5/src/mfa/mfa_resolver.test.d.ts +0 -17
- package/dist/esm5/src/mfa/mfa_session.d.ts +0 -39
- package/dist/esm5/src/mfa/mfa_session.test.d.ts +0 -17
- package/dist/esm5/src/mfa/mfa_user.d.ts +0 -38
- package/dist/esm5/src/mfa/mfa_user.test.d.ts +0 -17
- package/dist/esm5/src/model/application_verifier.d.ts +0 -23
- package/dist/esm5/src/model/auth.d.ts +0 -87
- package/dist/esm5/src/model/enum_maps.d.ts +0 -98
- package/dist/esm5/src/model/enums.d.ts +0 -74
- package/dist/esm5/src/model/id_token.d.ts +0 -87
- package/dist/esm5/src/model/password_policy.d.ts +0 -111
- package/dist/esm5/src/model/popup_redirect.d.ts +0 -94
- package/dist/esm5/src/model/public_types.d.ts +0 -1285
- package/dist/esm5/src/model/user.d.ts +0 -83
- package/dist/esm5/src/platform_browser/auth.test.d.ts +0 -17
- package/dist/esm5/src/platform_browser/auth_window.d.ts +0 -37
- package/dist/esm5/src/platform_browser/iframe/gapi.d.ts +0 -19
- package/dist/esm5/src/platform_browser/iframe/gapi.iframes.d.ts +0 -47
- package/dist/esm5/src/platform_browser/iframe/gapi.test.d.ts +0 -17
- package/dist/esm5/src/platform_browser/iframe/iframe.d.ts +0 -18
- package/dist/esm5/src/platform_browser/iframe/iframe.test.d.ts +0 -17
- package/dist/esm5/src/platform_browser/index.d.ts +0 -27
- package/dist/esm5/src/platform_browser/load_js.d.ts +0 -29
- package/dist/esm5/src/platform_browser/load_js.test.d.ts +0 -17
- package/dist/esm5/src/platform_browser/messagechannel/index.d.ts +0 -87
- package/dist/esm5/src/platform_browser/messagechannel/promise.d.ts +0 -33
- package/dist/esm5/src/platform_browser/messagechannel/promise.test.d.ts +0 -17
- package/dist/esm5/src/platform_browser/messagechannel/receiver.d.ts +0 -63
- package/dist/esm5/src/platform_browser/messagechannel/receiver.test.d.ts +0 -17
- package/dist/esm5/src/platform_browser/messagechannel/sender.d.ts +0 -46
- package/dist/esm5/src/platform_browser/messagechannel/sender.test.d.ts +0 -17
- package/dist/esm5/src/platform_browser/mfa/assertions/phone.d.ts +0 -59
- package/dist/esm5/src/platform_browser/mfa/assertions/phone.test.d.ts +0 -17
- package/dist/esm5/src/platform_browser/persistence/browser.d.ts +0 -27
- package/dist/esm5/src/platform_browser/persistence/browser.test.d.ts +0 -17
- package/dist/esm5/src/platform_browser/persistence/indexed_db.d.ts +0 -33
- package/dist/esm5/src/platform_browser/persistence/indexed_db.test.d.ts +0 -17
- package/dist/esm5/src/platform_browser/persistence/local_storage.d.ts +0 -25
- package/dist/esm5/src/platform_browser/persistence/local_storage.test.d.ts +0 -17
- package/dist/esm5/src/platform_browser/persistence/session_storage.d.ts +0 -24
- package/dist/esm5/src/platform_browser/persistence/session_storage.test.d.ts +0 -17
- package/dist/esm5/src/platform_browser/popup_redirect.d.ts +0 -27
- package/dist/esm5/src/platform_browser/popup_redirect.test.d.ts +0 -17
- package/dist/esm5/src/platform_browser/providers/phone.d.ts +0 -152
- package/dist/esm5/src/platform_browser/providers/phone.test.d.ts +0 -17
- package/dist/esm5/src/platform_browser/recaptcha/recaptcha.d.ts +0 -71
- package/dist/esm5/src/platform_browser/recaptcha/recaptcha.test.d.ts +0 -17
- package/dist/esm5/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +0 -45
- package/dist/esm5/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.test.d.ts +0 -17
- package/dist/esm5/src/platform_browser/recaptcha/recaptcha_loader.d.ts +0 -49
- package/dist/esm5/src/platform_browser/recaptcha/recaptcha_loader.test.d.ts +0 -17
- package/dist/esm5/src/platform_browser/recaptcha/recaptcha_mock.d.ts +0 -66
- package/dist/esm5/src/platform_browser/recaptcha/recaptcha_mock.test.d.ts +0 -17
- package/dist/esm5/src/platform_browser/recaptcha/recaptcha_verifier.d.ts +0 -92
- package/dist/esm5/src/platform_browser/recaptcha/recaptcha_verifier.test.d.ts +0 -17
- package/dist/esm5/src/platform_browser/strategies/phone.d.ts +0 -112
- package/dist/esm5/src/platform_browser/strategies/phone.test.d.ts +0 -17
- package/dist/esm5/src/platform_browser/strategies/popup.d.ts +0 -109
- package/dist/esm5/src/platform_browser/strategies/popup.test.d.ts +0 -17
- package/dist/esm5/src/platform_browser/strategies/redirect.d.ts +0 -176
- package/dist/esm5/src/platform_browser/strategies/redirect.test.d.ts +0 -17
- package/dist/esm5/src/platform_browser/util/popup.d.ts +0 -24
- package/dist/esm5/src/platform_browser/util/popup.test.d.ts +0 -17
- package/dist/esm5/src/platform_browser/util/worker.d.ts +0 -20
- package/dist/esm5/src/platform_cordova/plugins.d.ts +0 -42
- package/dist/esm5/src/platform_cordova/popup_redirect/events.d.ts +0 -39
- package/dist/esm5/src/platform_cordova/popup_redirect/events.test.d.ts +0 -17
- package/dist/esm5/src/platform_cordova/popup_redirect/popup_redirect.d.ts +0 -24
- package/dist/esm5/src/platform_cordova/popup_redirect/popup_redirect.test.d.ts +0 -17
- package/dist/esm5/src/platform_cordova/popup_redirect/utils.d.ts +0 -47
- package/dist/esm5/src/platform_cordova/popup_redirect/utils.test.d.ts +0 -17
- package/dist/esm5/src/platform_cordova/strategies/redirect.d.ts +0 -20
- package/dist/esm5/src/platform_node/index.d.ts +0 -50
- package/dist/esm5/src/platform_react_native/persistence/react_native.d.ts +0 -25
- package/dist/esm5/src/platform_react_native/persistence/react_native.test.d.ts +0 -17
- package/dist/esm5/test/helpers/api/helper.d.ts +0 -22
- package/dist/esm5/test/helpers/delay.d.ts +0 -20
- package/dist/esm5/test/helpers/erroring_unavailable_persistence.d.ts +0 -36
- package/dist/esm5/test/helpers/fake_service_worker.d.ts +0 -22
- package/dist/esm5/test/helpers/id_token_response.d.ts +0 -18
- package/dist/esm5/test/helpers/iframe_event.d.ts +0 -19
- package/dist/esm5/test/helpers/integration/emulator_rest_helpers.d.ts +0 -35
- package/dist/esm5/test/helpers/integration/helpers.d.ts +0 -32
- package/dist/esm5/test/helpers/integration/settings.d.ts +0 -23
- package/dist/esm5/test/helpers/jwt.d.ts +0 -17
- package/dist/esm5/test/helpers/mock_auth.d.ts +0 -47
- package/dist/esm5/test/helpers/mock_auth_credential.d.ts +0 -31
- package/dist/esm5/test/helpers/mock_fetch.d.ts +0 -30
- package/dist/esm5/test/helpers/mock_fetch.test.d.ts +0 -17
- package/dist/esm5/test/helpers/mock_popup_redirect_resolver.d.ts +0 -24
- package/dist/esm5/test/helpers/redirect_persistence.d.ts +0 -24
- package/dist/esm5/test/helpers/timeout_stub.d.ts +0 -34
- package/dist/esm5/test/integration/flows/anonymous.test.d.ts +0 -17
- package/dist/esm5/test/integration/flows/custom.local.test.d.ts +0 -17
- package/dist/esm5/test/integration/flows/email.test.d.ts +0 -17
- package/dist/esm5/test/integration/flows/idp.local.test.d.ts +0 -17
- package/dist/esm5/test/integration/flows/middleware_test_generator.d.ts +0 -18
- package/dist/esm5/test/integration/flows/oob.local.test.d.ts +0 -17
- package/dist/esm5/test/integration/flows/password_policy.test.d.ts +0 -17
- package/dist/esm5/test/integration/flows/phone.test.d.ts +0 -17
- package/dist/esm5/test/integration/flows/totp.test.d.ts +0 -17
- package/dist/esm5/test/integration/webdriver/anonymous.test.d.ts +0 -17
- package/dist/esm5/test/integration/webdriver/compat/firebaseui.test.d.ts +0 -17
- package/dist/esm5/test/integration/webdriver/persistence.test.d.ts +0 -17
- package/dist/esm5/test/integration/webdriver/popup.test.d.ts +0 -17
- package/dist/esm5/test/integration/webdriver/redirect.test.d.ts +0 -17
- package/dist/esm5/test/integration/webdriver/util/auth_driver.d.ts +0 -46
- package/dist/esm5/test/integration/webdriver/util/functions.d.ts +0 -81
- package/dist/esm5/test/integration/webdriver/util/idp_page.d.ts +0 -31
- package/dist/esm5/test/integration/webdriver/util/js_load_condition.d.ts +0 -25
- package/dist/esm5/test/integration/webdriver/util/test_runner.d.ts +0 -19
- package/dist/esm5/test/integration/webdriver/util/test_server.d.ts +0 -27
- package/dist/esm5/test/integration/webdriver/util/ui_page.d.ts +0 -33
- package/dist/index.webworker.esm5.js +0 -9265
- package/dist/index.webworker.esm5.js.map +0 -1
- package/dist/node/totp-259483a2.js +0 -8762
- package/dist/node/totp-259483a2.js.map +0 -1
- package/dist/node-esm/totp-219bb96f.js.map +0 -1
- package/dist/rn/index-2f66320e.js +0 -9819
- package/dist/rn/index-2f66320e.js.map +0 -1
- package/dist/web-extension-cjs/register-674a8250.js.map +0 -1
- package/dist/web-extension-esm2017/register-428f8789.js.map +0 -1
- /package/dist/{esm5/test/integration/flows/firebaseserverapp.test.d.ts → browser-cjs/test/integration/flows/recaptcha_enterprise.test.d.ts} +0 -0
|
@@ -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
|
}
|
package/dist/web-extension-cjs/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts
CHANGED
|
@@ -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 {};
|
|
@@ -2283,6 +2283,13 @@ declare class RecaptchaConfig {
|
|
|
2283
2283
|
* @returns Whether or not reCAPTCHA Enterprise protection is enabled for the given provider.
|
|
2284
2284
|
*/
|
|
2285
2285
|
isProviderEnabled(providerStr: string): boolean;
|
|
2286
|
+
/**
|
|
2287
|
+
* Returns true if reCAPTCHA Enterprise protection is enabled in at least one provider, otherwise
|
|
2288
|
+
* returns false.
|
|
2289
|
+
*
|
|
2290
|
+
* @returns Whether or not reCAPTCHA Enterprise protection is enabled for at least one provider.
|
|
2291
|
+
*/
|
|
2292
|
+
isAnyProviderEnabled(): boolean;
|
|
2286
2293
|
}
|
|
2287
2294
|
|
|
2288
2295
|
declare interface RecaptchaEnforcementProviderState {
|
|
@@ -2743,6 +2743,13 @@ declare class RecaptchaConfig {
|
|
|
2743
2743
|
* @returns Whether or not reCAPTCHA Enterprise protection is enabled for the given provider.
|
|
2744
2744
|
*/
|
|
2745
2745
|
isProviderEnabled(providerStr: string): boolean;
|
|
2746
|
+
/**
|
|
2747
|
+
* Returns true if reCAPTCHA Enterprise protection is enabled in at least one provider, otherwise
|
|
2748
|
+
* returns false.
|
|
2749
|
+
*
|
|
2750
|
+
* @returns Whether or not reCAPTCHA Enterprise protection is enabled for at least one provider.
|
|
2751
|
+
*/
|
|
2752
|
+
isAnyProviderEnabled(): boolean;
|
|
2746
2753
|
}
|
|
2747
2754
|
|
|
2748
2755
|
declare interface RecaptchaEnforcementProviderState {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { r as registerAuth, i as initializeAuth, a as indexedDBLocalPersistence, c as connectAuthEmulator } from './register-
|
|
2
|
-
export { Y as ActionCodeURL, m as AuthCredential, A as AuthErrorCodes, E as EmailAuthCredential, q as EmailAuthProvider, F as FacebookAuthProvider, t as GithubAuthProvider, G as GoogleAuthProvider, O as OAuthCredential, w as OAuthProvider, P as PhoneAuthCredential, S as SAMLAuthProvider, T as TotpMultiFactorGenerator, b as TotpSecret, x as TwitterAuthProvider, J as applyActionCode, e as beforeAuthStateChanged, K as checkActionCode, I as confirmPasswordReset, c as connectAuthEmulator, M as createUserWithEmailAndPassword, l as debugErrorMap, k as deleteUser, V as fetchSignInMethodsForEmail, a4 as getAdditionalUserInfo, a1 as getIdToken, a2 as getIdTokenResult, a6 as getMultiFactorResolver, n as inMemoryPersistence, a as indexedDBLocalPersistence, i as initializeAuth, d as initializeRecaptchaConfig, R as isSignInWithEmailLink, B as linkWithCredential, a7 as multiFactor, f as onAuthStateChanged, o as onIdTokenChanged, Z as parseActionCodeURL, p as prodErrorMap, C as reauthenticateWithCredential, a5 as reload, j as revokeAccessToken, W as sendEmailVerification, H as sendPasswordResetEmail, Q as sendSignInLinkToEmail, s as setPersistence, y as signInAnonymously, z as signInWithCredential, D as signInWithCustomToken, N as signInWithEmailAndPassword, U as signInWithEmailLink, h as signOut, a3 as unlink, g as updateCurrentUser, $ as updateEmail, a0 as updatePassword, _ as updateProfile, u as useDeviceLanguage, v as validatePassword, X as verifyBeforeUpdateEmail, L as verifyPasswordResetCode } from './register-
|
|
1
|
+
import { r as registerAuth, i as initializeAuth, a as indexedDBLocalPersistence, c as connectAuthEmulator } from './register-77f1d56a.js';
|
|
2
|
+
export { Y as ActionCodeURL, m as AuthCredential, A as AuthErrorCodes, E as EmailAuthCredential, q as EmailAuthProvider, F as FacebookAuthProvider, t as GithubAuthProvider, G as GoogleAuthProvider, O as OAuthCredential, w as OAuthProvider, P as PhoneAuthCredential, S as SAMLAuthProvider, T as TotpMultiFactorGenerator, b as TotpSecret, x as TwitterAuthProvider, J as applyActionCode, e as beforeAuthStateChanged, K as checkActionCode, I as confirmPasswordReset, c as connectAuthEmulator, M as createUserWithEmailAndPassword, l as debugErrorMap, k as deleteUser, V as fetchSignInMethodsForEmail, a4 as getAdditionalUserInfo, a1 as getIdToken, a2 as getIdTokenResult, a6 as getMultiFactorResolver, n as inMemoryPersistence, a as indexedDBLocalPersistence, i as initializeAuth, d as initializeRecaptchaConfig, R as isSignInWithEmailLink, B as linkWithCredential, a7 as multiFactor, f as onAuthStateChanged, o as onIdTokenChanged, Z as parseActionCodeURL, p as prodErrorMap, C as reauthenticateWithCredential, a5 as reload, j as revokeAccessToken, W as sendEmailVerification, H as sendPasswordResetEmail, Q as sendSignInLinkToEmail, s as setPersistence, y as signInAnonymously, z as signInWithCredential, D as signInWithCustomToken, N as signInWithEmailAndPassword, U as signInWithEmailLink, h as signOut, a3 as unlink, g as updateCurrentUser, $ as updateEmail, a0 as updatePassword, _ as updateProfile, u as useDeviceLanguage, v as validatePassword, X as verifyBeforeUpdateEmail, L as verifyPasswordResetCode } from './register-77f1d56a.js';
|
|
3
3
|
import { _getProvider, getApp } from '@firebase/app';
|
|
4
4
|
import { getDefaultEmulatorHost } from '@firebase/util';
|
|
5
5
|
import 'tslib';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a8 as STORAGE_AVAILABLE_KEY, a9 as _isMobileBrowser, aa as _isIE10, ab as
|
|
2
|
-
export { Y as ActionCodeURL, m as AuthCredential, A as AuthErrorCodes,
|
|
1
|
+
import { a8 as STORAGE_AVAILABLE_KEY, a9 as _isMobileBrowser, aa as _isIE10, ab as Delay, ac as _window, ad as _assert, ae as isV2, af as _createError, ag as _recaptchaV2ScriptUrl, ah as _loadJS, ai as MockReCaptcha, aj as _generateCallbackName, ak as _castAuth, al as _isHttpOrHttps, am as _isWorker, an as getRecaptchaParams, ao as _serverAppCurrentUserOperationNotSupportedError, z as signInWithCredential, ap as _assertLinkedStatus, B as linkWithCredential, C as reauthenticateWithCredential, aq as _initializeRecaptchaConfig, ar as FAKE_TOKEN, as as startEnrollPhoneMfa, at as handleRecaptchaFlow, au as startSignInPhoneMfa, av as sendPhoneVerificationCode, aw as _link$1, P as PhoneAuthCredential, ax as _getInstance, ay as _signInWithCredential, az as _reauthenticate, m as AuthCredential, aA as signInWithIdp, aB as _fail, aC as debugAssert, aD as _assertInstanceOf, aE as _generateEventId, aF as FederatedAuthProvider, aG as _persistenceKeyName, aH as _performApiRequest, aI as _getCurrentUrl, aJ as _gapiScriptUrl, aK as _emulatorUrl, aL as _isChromeIOS, aM as _isFirefox, aN as _isIOSStandalone, aO as BaseOAuthProvider, aP as _setWindowLocation, aQ as _isSafari, aR as _isIOS, aS as MultiFactorAssertionImpl, aT as finalizeEnrollPhoneMfa, aU as finalizeSignInPhoneMfa, r as registerAuth, i as initializeAuth, a as indexedDBLocalPersistence, e as beforeAuthStateChanged, o as onIdTokenChanged, c as connectAuthEmulator, aV as _setExternalJSProvider, aW as _isAndroid, aX as _isIOS7Or8 } from './register-77f1d56a.js';
|
|
2
|
+
export { Y as ActionCodeURL, m as AuthCredential, A as AuthErrorCodes, aZ as AuthImpl, E as EmailAuthCredential, q as EmailAuthProvider, F as FacebookAuthProvider, a$ as FetchProvider, t as GithubAuthProvider, G as GoogleAuthProvider, O as OAuthCredential, w as OAuthProvider, P as PhoneAuthCredential, b0 as SAMLAuthCredential, S as SAMLAuthProvider, T as TotpMultiFactorGenerator, b as TotpSecret, x as TwitterAuthProvider, aY as UserImpl, ad as _assert, ak as _castAuth, aB as _fail, aE as _generateEventId, a_ as _getClientVersion, ax as _getInstance, aG as _persistenceKeyName, J as applyActionCode, e as beforeAuthStateChanged, K as checkActionCode, I as confirmPasswordReset, c as connectAuthEmulator, M as createUserWithEmailAndPassword, l as debugErrorMap, k as deleteUser, V as fetchSignInMethodsForEmail, a4 as getAdditionalUserInfo, a1 as getIdToken, a2 as getIdTokenResult, a6 as getMultiFactorResolver, n as inMemoryPersistence, a as indexedDBLocalPersistence, i as initializeAuth, d as initializeRecaptchaConfig, R as isSignInWithEmailLink, B as linkWithCredential, a7 as multiFactor, f as onAuthStateChanged, o as onIdTokenChanged, Z as parseActionCodeURL, p as prodErrorMap, C as reauthenticateWithCredential, a5 as reload, j as revokeAccessToken, W as sendEmailVerification, H as sendPasswordResetEmail, Q as sendSignInLinkToEmail, s as setPersistence, y as signInAnonymously, z as signInWithCredential, D as signInWithCustomToken, N as signInWithEmailAndPassword, U as signInWithEmailLink, h as signOut, a3 as unlink, g as updateCurrentUser, $ as updateEmail, a0 as updatePassword, _ as updateProfile, u as useDeviceLanguage, v as validatePassword, X as verifyBeforeUpdateEmail, L as verifyPasswordResetCode } from './register-77f1d56a.js';
|
|
3
3
|
import { querystring, getModularInstance, getUA, isEmpty, getExperimentalSetting, getDefaultEmulatorHost, querystringDecode } from '@firebase/util';
|
|
4
4
|
import { _isFirebaseServerApp, SDK_VERSION, _getProvider, getApp } from '@firebase/app';
|
|
5
5
|
import 'tslib';
|
|
@@ -379,134 +379,6 @@ BrowserSessionPersistence.type = 'SESSION';
|
|
|
379
379
|
*/
|
|
380
380
|
const browserSessionPersistence = BrowserSessionPersistence;
|
|
381
381
|
|
|
382
|
-
/**
|
|
383
|
-
* @license
|
|
384
|
-
* Copyright 2020 Google LLC
|
|
385
|
-
*
|
|
386
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
387
|
-
* you may not use this file except in compliance with the License.
|
|
388
|
-
* You may obtain a copy of the License at
|
|
389
|
-
*
|
|
390
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
391
|
-
*
|
|
392
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
393
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
394
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
395
|
-
* See the License for the specific language governing permissions and
|
|
396
|
-
* limitations under the License.
|
|
397
|
-
*/
|
|
398
|
-
const _SOLVE_TIME_MS = 500;
|
|
399
|
-
const _EXPIRATION_TIME_MS = 60000;
|
|
400
|
-
const _WIDGET_ID_START = 1000000000000;
|
|
401
|
-
class MockReCaptcha {
|
|
402
|
-
constructor(auth) {
|
|
403
|
-
this.auth = auth;
|
|
404
|
-
this.counter = _WIDGET_ID_START;
|
|
405
|
-
this._widgets = new Map();
|
|
406
|
-
}
|
|
407
|
-
render(container, parameters) {
|
|
408
|
-
const id = this.counter;
|
|
409
|
-
this._widgets.set(id, new MockWidget(container, this.auth.name, parameters || {}));
|
|
410
|
-
this.counter++;
|
|
411
|
-
return id;
|
|
412
|
-
}
|
|
413
|
-
reset(optWidgetId) {
|
|
414
|
-
var _a;
|
|
415
|
-
const id = optWidgetId || _WIDGET_ID_START;
|
|
416
|
-
void ((_a = this._widgets.get(id)) === null || _a === void 0 ? void 0 : _a.delete());
|
|
417
|
-
this._widgets.delete(id);
|
|
418
|
-
}
|
|
419
|
-
getResponse(optWidgetId) {
|
|
420
|
-
var _a;
|
|
421
|
-
const id = optWidgetId || _WIDGET_ID_START;
|
|
422
|
-
return ((_a = this._widgets.get(id)) === null || _a === void 0 ? void 0 : _a.getResponse()) || '';
|
|
423
|
-
}
|
|
424
|
-
async execute(optWidgetId) {
|
|
425
|
-
var _a;
|
|
426
|
-
const id = optWidgetId || _WIDGET_ID_START;
|
|
427
|
-
void ((_a = this._widgets.get(id)) === null || _a === void 0 ? void 0 : _a.execute());
|
|
428
|
-
return '';
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
class MockWidget {
|
|
432
|
-
constructor(containerOrId, appName, params) {
|
|
433
|
-
this.params = params;
|
|
434
|
-
this.timerId = null;
|
|
435
|
-
this.deleted = false;
|
|
436
|
-
this.responseToken = null;
|
|
437
|
-
this.clickHandler = () => {
|
|
438
|
-
this.execute();
|
|
439
|
-
};
|
|
440
|
-
const container = typeof containerOrId === 'string'
|
|
441
|
-
? document.getElementById(containerOrId)
|
|
442
|
-
: containerOrId;
|
|
443
|
-
_assert(container, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */, { appName });
|
|
444
|
-
this.container = container;
|
|
445
|
-
this.isVisible = this.params.size !== 'invisible';
|
|
446
|
-
if (this.isVisible) {
|
|
447
|
-
this.execute();
|
|
448
|
-
}
|
|
449
|
-
else {
|
|
450
|
-
this.container.addEventListener('click', this.clickHandler);
|
|
451
|
-
}
|
|
452
|
-
}
|
|
453
|
-
getResponse() {
|
|
454
|
-
this.checkIfDeleted();
|
|
455
|
-
return this.responseToken;
|
|
456
|
-
}
|
|
457
|
-
delete() {
|
|
458
|
-
this.checkIfDeleted();
|
|
459
|
-
this.deleted = true;
|
|
460
|
-
if (this.timerId) {
|
|
461
|
-
clearTimeout(this.timerId);
|
|
462
|
-
this.timerId = null;
|
|
463
|
-
}
|
|
464
|
-
this.container.removeEventListener('click', this.clickHandler);
|
|
465
|
-
}
|
|
466
|
-
execute() {
|
|
467
|
-
this.checkIfDeleted();
|
|
468
|
-
if (this.timerId) {
|
|
469
|
-
return;
|
|
470
|
-
}
|
|
471
|
-
this.timerId = window.setTimeout(() => {
|
|
472
|
-
this.responseToken = generateRandomAlphaNumericString(50);
|
|
473
|
-
const { callback, 'expired-callback': expiredCallback } = this.params;
|
|
474
|
-
if (callback) {
|
|
475
|
-
try {
|
|
476
|
-
callback(this.responseToken);
|
|
477
|
-
}
|
|
478
|
-
catch (e) { }
|
|
479
|
-
}
|
|
480
|
-
this.timerId = window.setTimeout(() => {
|
|
481
|
-
this.timerId = null;
|
|
482
|
-
this.responseToken = null;
|
|
483
|
-
if (expiredCallback) {
|
|
484
|
-
try {
|
|
485
|
-
expiredCallback();
|
|
486
|
-
}
|
|
487
|
-
catch (e) { }
|
|
488
|
-
}
|
|
489
|
-
if (this.isVisible) {
|
|
490
|
-
this.execute();
|
|
491
|
-
}
|
|
492
|
-
}, _EXPIRATION_TIME_MS);
|
|
493
|
-
}, _SOLVE_TIME_MS);
|
|
494
|
-
}
|
|
495
|
-
checkIfDeleted() {
|
|
496
|
-
if (this.deleted) {
|
|
497
|
-
throw new Error('reCAPTCHA mock was already deleted!');
|
|
498
|
-
}
|
|
499
|
-
}
|
|
500
|
-
}
|
|
501
|
-
function generateRandomAlphaNumericString(len) {
|
|
502
|
-
const chars = [];
|
|
503
|
-
const allowedChars = '1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
|
504
|
-
for (let i = 0; i < len; i++) {
|
|
505
|
-
chars.push(allowedChars.charAt(Math.floor(Math.random() * allowedChars.length)));
|
|
506
|
-
}
|
|
507
|
-
return chars.join('');
|
|
508
|
-
}
|
|
509
|
-
|
|
510
382
|
/**
|
|
511
383
|
* @license
|
|
512
384
|
* Copyright 2020 Google LLC
|
|
@@ -861,12 +733,15 @@ class ConfirmationResultImpl {
|
|
|
861
733
|
* provides the code sent to their phone, call {@link ConfirmationResult.confirm}
|
|
862
734
|
* with the code to sign the user in.
|
|
863
735
|
*
|
|
864
|
-
* For abuse prevention, this method
|
|
865
|
-
* This SDK includes
|
|
736
|
+
* For abuse prevention, this method requires a {@link ApplicationVerifier}.
|
|
737
|
+
* This SDK includes an implementation based on reCAPTCHA v2, {@link RecaptchaVerifier}.
|
|
866
738
|
* This function can work on other platforms that do not support the
|
|
867
739
|
* {@link RecaptchaVerifier} (like React Native), but you need to use a
|
|
868
740
|
* third-party {@link ApplicationVerifier} implementation.
|
|
869
741
|
*
|
|
742
|
+
* If you've enabled project-level reCAPTCHA Enterprise bot protection in
|
|
743
|
+
* Enforce mode, you can omit the {@link ApplicationVerifier}.
|
|
744
|
+
*
|
|
870
745
|
* This method does not work in a Node.js environment or with {@link Auth} instances created with a
|
|
871
746
|
* {@link @firebase/app#FirebaseServerApp}.
|
|
872
747
|
*
|
|
@@ -940,10 +815,19 @@ async function reauthenticateWithPhoneNumber(user, phoneNumber, appVerifier) {
|
|
|
940
815
|
*/
|
|
941
816
|
async function _verifyPhoneNumber(auth, options, verifier) {
|
|
942
817
|
var _a;
|
|
943
|
-
|
|
818
|
+
if (!auth._getRecaptchaConfig()) {
|
|
819
|
+
try {
|
|
820
|
+
await _initializeRecaptchaConfig(auth);
|
|
821
|
+
}
|
|
822
|
+
catch (error) {
|
|
823
|
+
// If an error occurs while fetching the config, there is no way to know the enablement state
|
|
824
|
+
// of Phone provider, so we proceed with recaptcha V2 verification.
|
|
825
|
+
// The error is likely "recaptchaKey undefined", as reCAPTCHA Enterprise is not
|
|
826
|
+
// enabled for any provider.
|
|
827
|
+
console.log('Failed to initialize reCAPTCHA Enterprise config. Triggering the reCAPTCHA v2 verification.');
|
|
828
|
+
}
|
|
829
|
+
}
|
|
944
830
|
try {
|
|
945
|
-
_assert(typeof recaptchaToken === 'string', auth, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
946
|
-
_assert(verifier.type === RECAPTCHA_VERIFIER_TYPE, auth, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
947
831
|
let phoneInfoOptions;
|
|
948
832
|
if (typeof options === 'string') {
|
|
949
833
|
phoneInfoOptions = {
|
|
@@ -957,12 +841,25 @@ async function _verifyPhoneNumber(auth, options, verifier) {
|
|
|
957
841
|
const session = phoneInfoOptions.session;
|
|
958
842
|
if ('phoneNumber' in phoneInfoOptions) {
|
|
959
843
|
_assert(session.type === "enroll" /* MultiFactorSessionType.ENROLL */, auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
960
|
-
const
|
|
844
|
+
const startPhoneMfaEnrollmentRequest = {
|
|
961
845
|
idToken: session.credential,
|
|
962
846
|
phoneEnrollmentInfo: {
|
|
963
847
|
phoneNumber: phoneInfoOptions.phoneNumber,
|
|
964
|
-
|
|
848
|
+
clientType: "CLIENT_TYPE_WEB" /* RecaptchaClientType.WEB */
|
|
849
|
+
}
|
|
850
|
+
};
|
|
851
|
+
const startEnrollPhoneMfaActionCallback = async (authInstance, request) => {
|
|
852
|
+
// If reCAPTCHA Enterprise token is FAKE_TOKEN, fetch reCAPTCHA v2 token and inject into request.
|
|
853
|
+
if (request.phoneEnrollmentInfo.captchaResponse === FAKE_TOKEN) {
|
|
854
|
+
_assert((verifier === null || verifier === void 0 ? void 0 : verifier.type) === RECAPTCHA_VERIFIER_TYPE, authInstance, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
855
|
+
const requestWithRecaptchaV2 = await injectRecaptchaV2Token(authInstance, request, verifier);
|
|
856
|
+
return startEnrollPhoneMfa(authInstance, requestWithRecaptchaV2);
|
|
965
857
|
}
|
|
858
|
+
return startEnrollPhoneMfa(authInstance, request);
|
|
859
|
+
};
|
|
860
|
+
const startPhoneMfaEnrollmentResponse = handleRecaptchaFlow(auth, startPhoneMfaEnrollmentRequest, "mfaSmsEnrollment" /* RecaptchaActionName.MFA_SMS_ENROLLMENT */, startEnrollPhoneMfaActionCallback, "PHONE_PROVIDER" /* RecaptchaAuthProvider.PHONE_PROVIDER */);
|
|
861
|
+
const response = await startPhoneMfaEnrollmentResponse.catch(error => {
|
|
862
|
+
return Promise.reject(error);
|
|
966
863
|
});
|
|
967
864
|
return response.phoneSessionInfo.sessionInfo;
|
|
968
865
|
}
|
|
@@ -971,26 +868,52 @@ async function _verifyPhoneNumber(auth, options, verifier) {
|
|
|
971
868
|
const mfaEnrollmentId = ((_a = phoneInfoOptions.multiFactorHint) === null || _a === void 0 ? void 0 : _a.uid) ||
|
|
972
869
|
phoneInfoOptions.multiFactorUid;
|
|
973
870
|
_assert(mfaEnrollmentId, auth, "missing-multi-factor-info" /* AuthErrorCode.MISSING_MFA_INFO */);
|
|
974
|
-
const
|
|
871
|
+
const startPhoneMfaSignInRequest = {
|
|
975
872
|
mfaPendingCredential: session.credential,
|
|
976
873
|
mfaEnrollmentId,
|
|
977
874
|
phoneSignInInfo: {
|
|
978
|
-
|
|
875
|
+
clientType: "CLIENT_TYPE_WEB" /* RecaptchaClientType.WEB */
|
|
876
|
+
}
|
|
877
|
+
};
|
|
878
|
+
const startSignInPhoneMfaActionCallback = async (authInstance, request) => {
|
|
879
|
+
// If reCAPTCHA Enterprise token is FAKE_TOKEN, fetch reCAPTCHA v2 token and inject into request.
|
|
880
|
+
if (request.phoneSignInInfo.captchaResponse === FAKE_TOKEN) {
|
|
881
|
+
_assert((verifier === null || verifier === void 0 ? void 0 : verifier.type) === RECAPTCHA_VERIFIER_TYPE, authInstance, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
882
|
+
const requestWithRecaptchaV2 = await injectRecaptchaV2Token(authInstance, request, verifier);
|
|
883
|
+
return startSignInPhoneMfa(authInstance, requestWithRecaptchaV2);
|
|
979
884
|
}
|
|
885
|
+
return startSignInPhoneMfa(authInstance, request);
|
|
886
|
+
};
|
|
887
|
+
const startPhoneMfaSignInResponse = handleRecaptchaFlow(auth, startPhoneMfaSignInRequest, "mfaSmsSignIn" /* RecaptchaActionName.MFA_SMS_SIGNIN */, startSignInPhoneMfaActionCallback, "PHONE_PROVIDER" /* RecaptchaAuthProvider.PHONE_PROVIDER */);
|
|
888
|
+
const response = await startPhoneMfaSignInResponse.catch(error => {
|
|
889
|
+
return Promise.reject(error);
|
|
980
890
|
});
|
|
981
891
|
return response.phoneResponseInfo.sessionInfo;
|
|
982
892
|
}
|
|
983
893
|
}
|
|
984
894
|
else {
|
|
985
|
-
const
|
|
895
|
+
const sendPhoneVerificationCodeRequest = {
|
|
986
896
|
phoneNumber: phoneInfoOptions.phoneNumber,
|
|
987
|
-
|
|
897
|
+
clientType: "CLIENT_TYPE_WEB" /* RecaptchaClientType.WEB */
|
|
898
|
+
};
|
|
899
|
+
const sendPhoneVerificationCodeActionCallback = async (authInstance, request) => {
|
|
900
|
+
// If reCAPTCHA Enterprise token is FAKE_TOKEN, fetch reCAPTCHA v2 token and inject into request.
|
|
901
|
+
if (request.captchaResponse === FAKE_TOKEN) {
|
|
902
|
+
_assert((verifier === null || verifier === void 0 ? void 0 : verifier.type) === RECAPTCHA_VERIFIER_TYPE, authInstance, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
903
|
+
const requestWithRecaptchaV2 = await injectRecaptchaV2Token(authInstance, request, verifier);
|
|
904
|
+
return sendPhoneVerificationCode(authInstance, requestWithRecaptchaV2);
|
|
905
|
+
}
|
|
906
|
+
return sendPhoneVerificationCode(authInstance, request);
|
|
907
|
+
};
|
|
908
|
+
const sendPhoneVerificationCodeResponse = handleRecaptchaFlow(auth, sendPhoneVerificationCodeRequest, "sendVerificationCode" /* RecaptchaActionName.SEND_VERIFICATION_CODE */, sendPhoneVerificationCodeActionCallback, "PHONE_PROVIDER" /* RecaptchaAuthProvider.PHONE_PROVIDER */);
|
|
909
|
+
const response = await sendPhoneVerificationCodeResponse.catch(error => {
|
|
910
|
+
return Promise.reject(error);
|
|
988
911
|
});
|
|
989
|
-
return sessionInfo;
|
|
912
|
+
return response.sessionInfo;
|
|
990
913
|
}
|
|
991
914
|
}
|
|
992
915
|
finally {
|
|
993
|
-
verifier._reset();
|
|
916
|
+
verifier === null || verifier === void 0 ? void 0 : verifier._reset();
|
|
994
917
|
}
|
|
995
918
|
}
|
|
996
919
|
/**
|
|
@@ -1022,6 +945,49 @@ async function updatePhoneNumber(user, credential) {
|
|
|
1022
945
|
return Promise.reject(_serverAppCurrentUserOperationNotSupportedError(userInternal.auth));
|
|
1023
946
|
}
|
|
1024
947
|
await _link$1(userInternal, credential);
|
|
948
|
+
}
|
|
949
|
+
// Helper function that fetches and injects a reCAPTCHA v2 token into the request.
|
|
950
|
+
async function injectRecaptchaV2Token(auth, request, recaptchaV2Verifier) {
|
|
951
|
+
_assert(recaptchaV2Verifier.type === RECAPTCHA_VERIFIER_TYPE, auth, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
952
|
+
const recaptchaV2Token = await recaptchaV2Verifier.verify();
|
|
953
|
+
_assert(typeof recaptchaV2Token === 'string', auth, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
954
|
+
const newRequest = Object.assign({}, request);
|
|
955
|
+
if ('phoneEnrollmentInfo' in newRequest) {
|
|
956
|
+
const phoneNumber = newRequest.phoneEnrollmentInfo.phoneNumber;
|
|
957
|
+
const captchaResponse = newRequest.phoneEnrollmentInfo.captchaResponse;
|
|
958
|
+
const clientType = newRequest
|
|
959
|
+
.phoneEnrollmentInfo.clientType;
|
|
960
|
+
const recaptchaVersion = newRequest.phoneEnrollmentInfo.recaptchaVersion;
|
|
961
|
+
Object.assign(newRequest, {
|
|
962
|
+
'phoneEnrollmentInfo': {
|
|
963
|
+
phoneNumber,
|
|
964
|
+
recaptchaToken: recaptchaV2Token,
|
|
965
|
+
captchaResponse,
|
|
966
|
+
clientType,
|
|
967
|
+
recaptchaVersion
|
|
968
|
+
}
|
|
969
|
+
});
|
|
970
|
+
return newRequest;
|
|
971
|
+
}
|
|
972
|
+
else if ('phoneSignInInfo' in newRequest) {
|
|
973
|
+
const captchaResponse = newRequest.phoneSignInInfo.captchaResponse;
|
|
974
|
+
const clientType = newRequest
|
|
975
|
+
.phoneSignInInfo.clientType;
|
|
976
|
+
const recaptchaVersion = newRequest.phoneSignInInfo.recaptchaVersion;
|
|
977
|
+
Object.assign(newRequest, {
|
|
978
|
+
'phoneSignInInfo': {
|
|
979
|
+
recaptchaToken: recaptchaV2Token,
|
|
980
|
+
captchaResponse,
|
|
981
|
+
clientType,
|
|
982
|
+
recaptchaVersion
|
|
983
|
+
}
|
|
984
|
+
});
|
|
985
|
+
return newRequest;
|
|
986
|
+
}
|
|
987
|
+
else {
|
|
988
|
+
Object.assign(newRequest, { 'recaptchaToken': recaptchaV2Token });
|
|
989
|
+
return newRequest;
|
|
990
|
+
}
|
|
1025
991
|
}
|
|
1026
992
|
|
|
1027
993
|
/**
|
|
@@ -1093,12 +1059,14 @@ class PhoneAuthProvider {
|
|
|
1093
1059
|
*
|
|
1094
1060
|
* @param phoneInfoOptions - The user's {@link PhoneInfoOptions}. The phone number should be in
|
|
1095
1061
|
* E.164 format (e.g. +16505550101).
|
|
1096
|
-
* @param applicationVerifier -
|
|
1097
|
-
*
|
|
1098
|
-
* {@link RecaptchaVerifier}.
|
|
1062
|
+
* @param applicationVerifier - An {@link ApplicationVerifier}, which prevents
|
|
1063
|
+
* requests from unauthorized clients. This SDK includes an implementation
|
|
1064
|
+
* based on reCAPTCHA v2, {@link RecaptchaVerifier}. If you've enabled
|
|
1065
|
+
* reCAPTCHA Enterprise bot protection in Enforce mode, this parameter is
|
|
1066
|
+
* optional; in all other configurations, the parameter is required.
|
|
1099
1067
|
*
|
|
1100
1068
|
* @returns A Promise for a verification ID that can be passed to
|
|
1101
|
-
* {@link PhoneAuthProvider.credential} to identify this flow
|
|
1069
|
+
* {@link PhoneAuthProvider.credential} to identify this flow.
|
|
1102
1070
|
*/
|
|
1103
1071
|
verifyPhoneNumber(phoneOptions, applicationVerifier) {
|
|
1104
1072
|
return _verifyPhoneNumber(this.auth, phoneOptions, getModularInstance(applicationVerifier));
|