@firebase/auth 0.22.0 → 0.23.0-canary.0a27d2fbf
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/CHANGELOG.md +8 -0
- package/dist/auth-public.d.ts +57 -0
- package/dist/auth.d.ts +71 -1
- package/dist/browser-cjs/{index-5859881d.js → index-5df83e84.js} +590 -207
- package/dist/browser-cjs/index-5df83e84.js.map +1 -0
- package/dist/browser-cjs/index.js +3 -2
- package/dist/browser-cjs/index.js.map +1 -1
- package/dist/browser-cjs/internal.js +3 -2
- package/dist/browser-cjs/internal.js.map +1 -1
- package/dist/browser-cjs/src/api/authentication/email_and_password.d.ts +9 -0
- package/dist/browser-cjs/src/api/authentication/recaptcha.d.ts +16 -0
- package/dist/browser-cjs/src/api/authentication/sign_up.d.ts +4 -0
- package/dist/browser-cjs/src/api/errors.d.ts +9 -1
- package/dist/browser-cjs/src/api/index.d.ts +17 -2
- package/dist/browser-cjs/src/core/auth/auth_impl.d.ts +9 -1
- package/dist/browser-cjs/src/core/errors.d.ts +17 -1
- package/dist/browser-cjs/src/core/index.d.ts +26 -0
- package/dist/browser-cjs/src/core/util/handler.d.ts +1 -1
- package/dist/browser-cjs/src/core/util/log.d.ts +1 -0
- package/dist/browser-cjs/src/model/auth.d.ts +6 -0
- package/dist/browser-cjs/src/platform_browser/auth_window.d.ts +2 -2
- package/dist/browser-cjs/src/platform_browser/recaptcha/recaptcha.d.ts +33 -0
- package/dist/browser-cjs/src/platform_browser/recaptcha/recaptcha.test.d.ts +17 -0
- package/dist/browser-cjs/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +40 -0
- package/dist/browser-cjs/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.test.d.ts +17 -0
- package/dist/browser-cjs/src/platform_browser/recaptcha/recaptcha_mock.d.ts +16 -1
- package/dist/browser-cjs/src/platform_browser/strategies/popup.d.ts +1 -1
- package/dist/browser-cjs/test/helpers/api/helper.d.ts +2 -0
- package/dist/browser-cjs/test/helpers/mock_auth.d.ts +5 -0
- package/dist/cordova/index.js +2 -2
- package/dist/cordova/internal.js +21 -77
- package/dist/cordova/internal.js.map +1 -1
- package/dist/cordova/{popup_redirect-3519667a.js → popup_redirect-b3f8e40c.js} +778 -214
- package/dist/cordova/popup_redirect-b3f8e40c.js.map +1 -0
- package/dist/cordova/src/api/authentication/email_and_password.d.ts +9 -0
- package/dist/cordova/src/api/authentication/recaptcha.d.ts +16 -0
- package/dist/cordova/src/api/authentication/sign_up.d.ts +4 -0
- package/dist/cordova/src/api/errors.d.ts +9 -1
- package/dist/cordova/src/api/index.d.ts +17 -2
- package/dist/cordova/src/core/auth/auth_impl.d.ts +9 -1
- package/dist/cordova/src/core/errors.d.ts +17 -1
- package/dist/cordova/src/core/index.d.ts +26 -0
- package/dist/cordova/src/core/util/handler.d.ts +1 -1
- package/dist/cordova/src/core/util/log.d.ts +1 -0
- package/dist/cordova/src/model/auth.d.ts +6 -0
- package/dist/cordova/src/platform_browser/auth_window.d.ts +2 -2
- package/dist/cordova/src/platform_browser/recaptcha/recaptcha.d.ts +33 -0
- package/dist/cordova/src/platform_browser/recaptcha/recaptcha.test.d.ts +17 -0
- package/dist/cordova/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +40 -0
- package/dist/cordova/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.test.d.ts +17 -0
- package/dist/cordova/src/platform_browser/recaptcha/recaptcha_mock.d.ts +16 -1
- package/dist/cordova/src/platform_browser/strategies/popup.d.ts +1 -1
- package/dist/cordova/test/helpers/api/helper.d.ts +2 -0
- package/dist/cordova/test/helpers/mock_auth.d.ts +5 -0
- package/dist/esm2017/{index-680e2b70.js → index-6cb4f120.js} +591 -209
- package/dist/esm2017/index-6cb4f120.js.map +1 -0
- package/dist/esm2017/index.js +2 -2
- package/dist/esm2017/internal.js +3 -3
- package/dist/esm2017/src/api/authentication/email_and_password.d.ts +9 -0
- package/dist/esm2017/src/api/authentication/recaptcha.d.ts +16 -0
- package/dist/esm2017/src/api/authentication/sign_up.d.ts +4 -0
- package/dist/esm2017/src/api/errors.d.ts +9 -1
- package/dist/esm2017/src/api/index.d.ts +17 -2
- package/dist/esm2017/src/core/auth/auth_impl.d.ts +9 -1
- package/dist/esm2017/src/core/errors.d.ts +17 -1
- package/dist/esm2017/src/core/index.d.ts +26 -0
- package/dist/esm2017/src/core/util/handler.d.ts +1 -1
- package/dist/esm2017/src/core/util/log.d.ts +1 -0
- package/dist/esm2017/src/model/auth.d.ts +6 -0
- package/dist/esm2017/src/platform_browser/auth_window.d.ts +2 -2
- package/dist/esm2017/src/platform_browser/recaptcha/recaptcha.d.ts +33 -0
- package/dist/esm2017/src/platform_browser/recaptcha/recaptcha.test.d.ts +17 -0
- package/dist/esm2017/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +40 -0
- package/dist/esm2017/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.test.d.ts +17 -0
- package/dist/esm2017/src/platform_browser/recaptcha/recaptcha_mock.d.ts +16 -1
- package/dist/esm2017/src/platform_browser/strategies/popup.d.ts +1 -1
- package/dist/esm2017/test/helpers/api/helper.d.ts +2 -0
- package/dist/esm2017/test/helpers/mock_auth.d.ts +5 -0
- package/dist/esm5/{index-714e827f.js → index-4dc6213a.js} +797 -289
- package/dist/esm5/index-4dc6213a.js.map +1 -0
- package/dist/esm5/index.js +1 -1
- package/dist/esm5/internal.js +2 -2
- package/dist/esm5/src/api/authentication/email_and_password.d.ts +9 -0
- package/dist/esm5/src/api/authentication/recaptcha.d.ts +16 -0
- package/dist/esm5/src/api/authentication/sign_up.d.ts +4 -0
- package/dist/esm5/src/api/errors.d.ts +9 -1
- package/dist/esm5/src/api/index.d.ts +17 -2
- package/dist/esm5/src/core/auth/auth_impl.d.ts +9 -1
- package/dist/esm5/src/core/errors.d.ts +17 -1
- package/dist/esm5/src/core/index.d.ts +26 -0
- package/dist/esm5/src/core/util/handler.d.ts +1 -1
- package/dist/esm5/src/core/util/log.d.ts +1 -0
- package/dist/esm5/src/model/auth.d.ts +6 -0
- package/dist/esm5/src/platform_browser/auth_window.d.ts +2 -2
- package/dist/esm5/src/platform_browser/recaptcha/recaptcha.d.ts +33 -0
- package/dist/esm5/src/platform_browser/recaptcha/recaptcha.test.d.ts +17 -0
- package/dist/esm5/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +40 -0
- package/dist/esm5/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.test.d.ts +17 -0
- package/dist/esm5/src/platform_browser/recaptcha/recaptcha_mock.d.ts +16 -1
- package/dist/esm5/src/platform_browser/strategies/popup.d.ts +1 -1
- package/dist/esm5/test/helpers/api/helper.d.ts +2 -0
- package/dist/esm5/test/helpers/mock_auth.d.ts +5 -0
- package/dist/index.webworker.esm5.js +602 -74
- package/dist/index.webworker.esm5.js.map +1 -1
- package/dist/node/index.js +2 -1
- package/dist/node/index.js.map +1 -1
- package/dist/node/internal.js +62 -42
- package/dist/node/internal.js.map +1 -1
- package/dist/node/src/api/authentication/email_and_password.d.ts +9 -0
- package/dist/node/src/api/authentication/recaptcha.d.ts +16 -0
- package/dist/node/src/api/authentication/sign_up.d.ts +4 -0
- package/dist/node/src/api/errors.d.ts +9 -1
- package/dist/node/src/api/index.d.ts +17 -2
- package/dist/node/src/core/auth/auth_impl.d.ts +9 -1
- package/dist/node/src/core/errors.d.ts +17 -1
- package/dist/node/src/core/index.d.ts +26 -0
- package/dist/node/src/core/util/handler.d.ts +1 -1
- package/dist/node/src/core/util/log.d.ts +1 -0
- package/dist/node/src/model/auth.d.ts +6 -0
- package/dist/node/src/platform_browser/auth_window.d.ts +2 -2
- package/dist/node/src/platform_browser/recaptcha/recaptcha.d.ts +33 -0
- package/dist/node/src/platform_browser/recaptcha/recaptcha.test.d.ts +17 -0
- package/dist/node/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +40 -0
- package/dist/node/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.test.d.ts +17 -0
- package/dist/node/src/platform_browser/recaptcha/recaptcha_mock.d.ts +16 -1
- package/dist/node/src/platform_browser/strategies/popup.d.ts +1 -1
- package/dist/node/test/helpers/api/helper.d.ts +2 -0
- package/dist/node/test/helpers/mock_auth.d.ts +5 -0
- package/dist/node/{totp-416a2adc.js → totp-c1b55906.js} +700 -171
- package/dist/node/totp-c1b55906.js.map +1 -0
- package/dist/node-esm/index.js +1 -1
- package/dist/node-esm/internal.js +16 -4
- package/dist/node-esm/internal.js.map +1 -1
- package/dist/node-esm/src/api/authentication/email_and_password.d.ts +9 -0
- package/dist/node-esm/src/api/authentication/recaptcha.d.ts +16 -0
- package/dist/node-esm/src/api/authentication/sign_up.d.ts +4 -0
- package/dist/node-esm/src/api/errors.d.ts +9 -1
- package/dist/node-esm/src/api/index.d.ts +17 -2
- package/dist/node-esm/src/core/auth/auth_impl.d.ts +9 -1
- package/dist/node-esm/src/core/errors.d.ts +17 -1
- package/dist/node-esm/src/core/index.d.ts +26 -0
- package/dist/node-esm/src/core/util/handler.d.ts +1 -1
- package/dist/node-esm/src/core/util/log.d.ts +1 -0
- package/dist/node-esm/src/model/auth.d.ts +6 -0
- package/dist/node-esm/src/platform_browser/auth_window.d.ts +2 -2
- package/dist/node-esm/src/platform_browser/recaptcha/recaptcha.d.ts +33 -0
- package/dist/node-esm/src/platform_browser/recaptcha/recaptcha.test.d.ts +17 -0
- package/dist/node-esm/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +40 -0
- package/dist/node-esm/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.test.d.ts +17 -0
- package/dist/node-esm/src/platform_browser/recaptcha/recaptcha_mock.d.ts +16 -1
- package/dist/node-esm/src/platform_browser/strategies/popup.d.ts +1 -1
- package/dist/node-esm/test/helpers/api/helper.d.ts +2 -0
- package/dist/node-esm/test/helpers/mock_auth.d.ts +5 -0
- package/dist/node-esm/{totp-c3bf2a20.js → totp-5cad7b9f.js} +557 -140
- package/dist/node-esm/totp-5cad7b9f.js.map +1 -0
- package/dist/rn/index.js +2 -1
- package/dist/rn/index.js.map +1 -1
- package/dist/rn/internal.js +79 -48
- package/dist/rn/internal.js.map +1 -1
- package/dist/rn/{phone-2ec1815d.js → phone-5059d9ba.js} +738 -259
- package/dist/rn/phone-5059d9ba.js.map +1 -0
- package/dist/rn/src/api/authentication/email_and_password.d.ts +9 -0
- package/dist/rn/src/api/authentication/recaptcha.d.ts +16 -0
- package/dist/rn/src/api/authentication/sign_up.d.ts +4 -0
- package/dist/rn/src/api/errors.d.ts +9 -1
- package/dist/rn/src/api/index.d.ts +17 -2
- package/dist/rn/src/core/auth/auth_impl.d.ts +9 -1
- package/dist/rn/src/core/errors.d.ts +17 -1
- package/dist/rn/src/core/index.d.ts +26 -0
- package/dist/rn/src/core/util/handler.d.ts +1 -1
- package/dist/rn/src/core/util/log.d.ts +1 -0
- package/dist/rn/src/model/auth.d.ts +6 -0
- package/dist/rn/src/platform_browser/auth_window.d.ts +2 -2
- package/dist/rn/src/platform_browser/recaptcha/recaptcha.d.ts +33 -0
- package/dist/rn/src/platform_browser/recaptcha/recaptcha.test.d.ts +17 -0
- package/dist/rn/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +40 -0
- package/dist/rn/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.test.d.ts +17 -0
- package/dist/rn/src/platform_browser/recaptcha/recaptcha_mock.d.ts +16 -1
- package/dist/rn/src/platform_browser/strategies/popup.d.ts +1 -1
- package/dist/rn/test/helpers/api/helper.d.ts +2 -0
- package/dist/rn/test/helpers/mock_auth.d.ts +5 -0
- package/dist/src/api/authentication/email_and_password.d.ts +9 -0
- package/dist/src/api/authentication/recaptcha.d.ts +16 -0
- package/dist/src/api/authentication/sign_up.d.ts +4 -0
- package/dist/src/api/errors.d.ts +9 -1
- package/dist/src/api/index.d.ts +17 -2
- package/dist/src/core/auth/auth_impl.d.ts +9 -1
- package/dist/src/core/errors.d.ts +17 -1
- package/dist/src/core/index.d.ts +26 -0
- package/dist/src/core/util/handler.d.ts +1 -1
- package/dist/src/core/util/log.d.ts +1 -0
- package/dist/src/model/auth.d.ts +6 -0
- package/dist/src/platform_browser/auth_window.d.ts +2 -2
- package/dist/src/platform_browser/recaptcha/recaptcha.d.ts +33 -0
- package/dist/src/platform_browser/recaptcha/recaptcha.test.d.ts +17 -0
- package/dist/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +40 -0
- package/dist/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.test.d.ts +17 -0
- package/dist/src/platform_browser/recaptcha/recaptcha_mock.d.ts +16 -1
- package/dist/src/platform_browser/strategies/popup.d.ts +1 -1
- package/dist/test/helpers/api/helper.d.ts +2 -0
- package/dist/test/helpers/mock_auth.d.ts +5 -0
- package/package.json +6 -6
- package/dist/browser-cjs/index-5859881d.js.map +0 -1
- package/dist/cordova/popup_redirect-3519667a.js.map +0 -1
- package/dist/esm2017/index-680e2b70.js.map +0 -1
- package/dist/esm5/index-714e827f.js.map +0 -1
- package/dist/node/totp-416a2adc.js.map +0 -1
- package/dist/node-esm/totp-c3bf2a20.js.map +0 -1
- package/dist/rn/phone-2ec1815d.js.map +0 -1
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
*/
|
|
17
17
|
import { _FirebaseService, FirebaseApp } from '@firebase/app';
|
|
18
18
|
import { Provider } from '@firebase/component';
|
|
19
|
+
import { AppCheckInternalComponentName } from '@firebase/app-check-interop-types';
|
|
19
20
|
import { Auth, AuthErrorMap, AuthSettings, EmulatorConfig, NextOrObserver, Persistence, PopupRedirectResolver, User, CompleteFn, ErrorFn, Unsubscribe } from '../../model/public_types';
|
|
20
21
|
import { ErrorFactory } from '@firebase/util';
|
|
21
22
|
import { AuthInternal, ConfigInternal } from '../../model/auth';
|
|
@@ -23,6 +24,7 @@ import { PopupRedirectResolverInternal } from '../../model/popup_redirect';
|
|
|
23
24
|
import { UserInternal } from '../../model/user';
|
|
24
25
|
import { AuthErrorCode, AuthErrorParams } from '../errors';
|
|
25
26
|
import { PersistenceInternal } from '../persistence';
|
|
27
|
+
import { RecaptchaConfig } from '../../platform_browser/recaptcha/recaptcha';
|
|
26
28
|
export declare const enum DefaultConfig {
|
|
27
29
|
TOKEN_API_HOST = "securetoken.googleapis.com",
|
|
28
30
|
API_HOST = "identitytoolkit.googleapis.com",
|
|
@@ -31,6 +33,7 @@ export declare const enum DefaultConfig {
|
|
|
31
33
|
export declare class AuthImpl implements AuthInternal, _FirebaseService {
|
|
32
34
|
readonly app: FirebaseApp;
|
|
33
35
|
private readonly heartbeatServiceProvider;
|
|
36
|
+
private readonly appCheckServiceProvider;
|
|
34
37
|
readonly config: ConfigInternal;
|
|
35
38
|
currentUser: User | null;
|
|
36
39
|
emulatorConfig: EmulatorConfig | null;
|
|
@@ -48,12 +51,14 @@ export declare class AuthImpl implements AuthInternal, _FirebaseService {
|
|
|
48
51
|
_initializationPromise: Promise<void> | null;
|
|
49
52
|
_popupRedirectResolver: PopupRedirectResolverInternal | null;
|
|
50
53
|
_errorFactory: ErrorFactory<AuthErrorCode, AuthErrorParams>;
|
|
54
|
+
_agentRecaptchaConfig: RecaptchaConfig | null;
|
|
55
|
+
_tenantRecaptchaConfigs: Record<string, RecaptchaConfig>;
|
|
51
56
|
readonly name: string;
|
|
52
57
|
private lastNotifiedUid;
|
|
53
58
|
languageCode: string | null;
|
|
54
59
|
tenantId: string | null;
|
|
55
60
|
settings: AuthSettings;
|
|
56
|
-
constructor(app: FirebaseApp, heartbeatServiceProvider: Provider<'heartbeat'>, config: ConfigInternal);
|
|
61
|
+
constructor(app: FirebaseApp, heartbeatServiceProvider: Provider<'heartbeat'>, appCheckServiceProvider: Provider<AppCheckInternalComponentName>, config: ConfigInternal);
|
|
57
62
|
_initializeWithPersistence(persistenceHierarchy: PersistenceInternal[], popupRedirectResolver?: PopupRedirectResolver): Promise<void>;
|
|
58
63
|
/**
|
|
59
64
|
* If the persistence is changed in another window, the user manager will let us know
|
|
@@ -68,6 +73,8 @@ export declare class AuthImpl implements AuthInternal, _FirebaseService {
|
|
|
68
73
|
_updateCurrentUser(user: User | null, skipBeforeStateCallbacks?: boolean): Promise<void>;
|
|
69
74
|
signOut(): Promise<void>;
|
|
70
75
|
setPersistence(persistence: Persistence): Promise<void>;
|
|
76
|
+
initializeRecaptchaConfig(): Promise<void>;
|
|
77
|
+
_getRecaptchaConfig(): RecaptchaConfig | null;
|
|
71
78
|
_getPersistence(): string;
|
|
72
79
|
_updateErrorMap(errorMap: AuthErrorMap): void;
|
|
73
80
|
onAuthStateChanged(nextOrObserver: NextOrObserver<User>, error?: ErrorFn, completed?: CompleteFn): Unsubscribe;
|
|
@@ -100,6 +107,7 @@ export declare class AuthImpl implements AuthInternal, _FirebaseService {
|
|
|
100
107
|
_logFramework(framework: string): void;
|
|
101
108
|
_getFrameworks(): readonly string[];
|
|
102
109
|
_getAdditionalHeaders(): Promise<Record<string, string>>;
|
|
110
|
+
_getAppCheckToken(): Promise<string | undefined>;
|
|
103
111
|
}
|
|
104
112
|
/**
|
|
105
113
|
* Method to be used to cast down to our private implmentation of Auth.
|
|
@@ -121,7 +121,15 @@ export declare const enum AuthErrorCode {
|
|
|
121
121
|
USER_SIGNED_OUT = "user-signed-out",
|
|
122
122
|
WEAK_PASSWORD = "weak-password",
|
|
123
123
|
WEB_STORAGE_UNSUPPORTED = "web-storage-unsupported",
|
|
124
|
-
ALREADY_INITIALIZED = "already-initialized"
|
|
124
|
+
ALREADY_INITIALIZED = "already-initialized",
|
|
125
|
+
RECAPTCHA_NOT_ENABLED = "recaptcha-not-enabled",
|
|
126
|
+
MISSING_RECAPTCHA_TOKEN = "missing-recaptcha-token",
|
|
127
|
+
INVALID_RECAPTCHA_TOKEN = "invalid-recaptcha-token",
|
|
128
|
+
INVALID_RECAPTCHA_ACTION = "invalid-recaptcha-action",
|
|
129
|
+
MISSING_CLIENT_TYPE = "missing-client-type",
|
|
130
|
+
MISSING_RECAPTCHA_VERSION = "missing-recaptcha-version",
|
|
131
|
+
INVALID_RECAPTCHA_VERSION = "invalid-recaptcha-version",
|
|
132
|
+
INVALID_REQ_TYPE = "invalid-req-type"
|
|
125
133
|
}
|
|
126
134
|
export interface ErrorMapRetriever extends AuthErrorMap {
|
|
127
135
|
(): ErrorMap<AuthErrorCode>;
|
|
@@ -302,5 +310,13 @@ export declare const AUTH_ERROR_CODES_MAP_DO_NOT_USE_INTERNALLY: {
|
|
|
302
310
|
readonly WEAK_PASSWORD: "auth/weak-password";
|
|
303
311
|
readonly WEB_STORAGE_UNSUPPORTED: "auth/web-storage-unsupported";
|
|
304
312
|
readonly ALREADY_INITIALIZED: "auth/already-initialized";
|
|
313
|
+
readonly RECAPTCHA_NOT_ENABLED: "auth/recaptcha-not-enabled";
|
|
314
|
+
readonly MISSING_RECAPTCHA_TOKEN: "auth/missing-recaptcha-token";
|
|
315
|
+
readonly INVALID_RECAPTCHA_TOKEN: "auth/invalid-recaptcha-token";
|
|
316
|
+
readonly INVALID_RECAPTCHA_ACTION: "auth/invalid-recaptcha-action";
|
|
317
|
+
readonly MISSING_CLIENT_TYPE: "auth/missing-client-type";
|
|
318
|
+
readonly MISSING_RECAPTCHA_VERSION: "auth/missing-recaptcha-version";
|
|
319
|
+
readonly INVALID_RECAPTCHA_VERSION: "auth/invalid-recaptcha-version";
|
|
320
|
+
readonly INVALID_REQ_TYPE: "auth/invalid-req-type";
|
|
305
321
|
};
|
|
306
322
|
export {};
|
package/dist/src/core/index.d.ts
CHANGED
|
@@ -38,6 +38,32 @@ export { debugErrorMap, prodErrorMap, AUTH_ERROR_CODES_MAP_DO_NOT_USE_INTERNALLY
|
|
|
38
38
|
* @public
|
|
39
39
|
*/
|
|
40
40
|
export declare function setPersistence(auth: Auth, persistence: Persistence): Promise<void>;
|
|
41
|
+
/**
|
|
42
|
+
* Loads the reCAPTCHA configuration into the `Auth` instance.
|
|
43
|
+
*
|
|
44
|
+
* @remarks
|
|
45
|
+
* This will load the reCAPTCHA config, which indicates whether the reCAPTCHA
|
|
46
|
+
* verification flow should be triggered for each auth provider, into the
|
|
47
|
+
* current Auth session.
|
|
48
|
+
*
|
|
49
|
+
* If initializeRecaptchaConfig() is not invoked, the auth flow will always start
|
|
50
|
+
* without reCAPTCHA verification. If the provider is configured to require reCAPTCHA
|
|
51
|
+
* verification, the SDK will transparently load the reCAPTCHA config and restart the
|
|
52
|
+
* auth flows.
|
|
53
|
+
*
|
|
54
|
+
* Thus, by calling this optional method, you will reduce the latency of future auth flows.
|
|
55
|
+
* Loading the reCAPTCHA config early will also enhance the signal collected by reCAPTCHA.
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```javascript
|
|
59
|
+
* initializeRecaptchaConfig(auth);
|
|
60
|
+
* ```
|
|
61
|
+
*
|
|
62
|
+
* @param auth - The {@link Auth} instance.
|
|
63
|
+
*
|
|
64
|
+
* @public
|
|
65
|
+
*/
|
|
66
|
+
export declare function initializeRecaptchaConfig(auth: Auth): Promise<void>;
|
|
41
67
|
/**
|
|
42
68
|
* Adds an observer for changes to the signed-in user's ID token.
|
|
43
69
|
*
|
|
@@ -17,4 +17,4 @@
|
|
|
17
17
|
import { AuthProvider } from '../../model/public_types';
|
|
18
18
|
import { AuthInternal } from '../../model/auth';
|
|
19
19
|
import { AuthEventType } from '../../model/popup_redirect';
|
|
20
|
-
export declare function _getRedirectUrl(auth: AuthInternal, provider: AuthProvider, authType: AuthEventType, redirectUrl?: string, eventId?: string, additionalParams?: Record<string, string>): string
|
|
20
|
+
export declare function _getRedirectUrl(auth: AuthInternal, provider: AuthProvider, authType: AuthEventType, redirectUrl?: string, eventId?: string, additionalParams?: Record<string, string>): Promise<string>;
|
|
@@ -19,4 +19,5 @@ export { LogLevel };
|
|
|
19
19
|
export declare function _getLogLevel(): LogLevel;
|
|
20
20
|
export declare function _setLogLevel(newLevel: LogLevel): void;
|
|
21
21
|
export declare function _logDebug(msg: string, ...args: string[]): void;
|
|
22
|
+
export declare function _logWarn(msg: string, ...args: string[]): void;
|
|
22
23
|
export declare function _logError(msg: string, ...args: string[]): void;
|
package/dist/src/model/auth.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ import { AuthErrorCode, AuthErrorParams } from '../core/errors';
|
|
|
20
20
|
import { PopupRedirectResolverInternal } from './popup_redirect';
|
|
21
21
|
import { UserInternal } from './user';
|
|
22
22
|
import { ClientPlatform } from '../core/util/version';
|
|
23
|
+
import { RecaptchaConfig } from '../platform_browser/recaptcha/recaptcha';
|
|
23
24
|
export declare type AppName = string;
|
|
24
25
|
export declare type ApiKey = string;
|
|
25
26
|
export declare type AuthDomain = string;
|
|
@@ -47,6 +48,8 @@ export interface ConfigInternal extends Config {
|
|
|
47
48
|
export interface AuthInternal extends Auth {
|
|
48
49
|
currentUser: User | null;
|
|
49
50
|
emulatorConfig: EmulatorConfig | null;
|
|
51
|
+
_agentRecaptchaConfig: RecaptchaConfig | null;
|
|
52
|
+
_tenantRecaptchaConfigs: Record<string, RecaptchaConfig>;
|
|
50
53
|
_canInitEmulator: boolean;
|
|
51
54
|
_isInitialized: boolean;
|
|
52
55
|
_initializationPromise: Promise<void> | null;
|
|
@@ -61,9 +64,11 @@ export interface AuthInternal extends Auth {
|
|
|
61
64
|
_startProactiveRefresh(): void;
|
|
62
65
|
_stopProactiveRefresh(): void;
|
|
63
66
|
_getPersistence(): string;
|
|
67
|
+
_getRecaptchaConfig(): RecaptchaConfig | null;
|
|
64
68
|
_logFramework(framework: string): void;
|
|
65
69
|
_getFrameworks(): readonly string[];
|
|
66
70
|
_getAdditionalHeaders(): Promise<Record<string, string>>;
|
|
71
|
+
_getAppCheckToken(): Promise<string | undefined>;
|
|
67
72
|
readonly name: AppName;
|
|
68
73
|
readonly config: ConfigInternal;
|
|
69
74
|
languageCode: string | null;
|
|
@@ -72,4 +77,5 @@ export interface AuthInternal extends Auth {
|
|
|
72
77
|
_errorFactory: ErrorFactory<AuthErrorCode, AuthErrorParams>;
|
|
73
78
|
useDeviceLanguage(): void;
|
|
74
79
|
signOut(): Promise<void>;
|
|
80
|
+
initializeRecaptchaConfig(): Promise<void>;
|
|
75
81
|
}
|
|
@@ -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 { Recaptcha } from './recaptcha/recaptcha';
|
|
17
|
+
import { Recaptcha, GreCAPTCHATopLevel } from './recaptcha/recaptcha';
|
|
18
18
|
/**
|
|
19
19
|
* A specialized window type that melds the normal window type plus the
|
|
20
20
|
* various bits we need. The three different blocks that are &'d together
|
|
@@ -23,7 +23,7 @@ import { Recaptcha } from './recaptcha/recaptcha';
|
|
|
23
23
|
export declare type AuthWindow = {
|
|
24
24
|
[T in keyof Window]: Window[T];
|
|
25
25
|
} & {
|
|
26
|
-
grecaptcha?: Recaptcha;
|
|
26
|
+
grecaptcha?: Recaptcha | GreCAPTCHATopLevel;
|
|
27
27
|
___jsl?: Record<string, any>;
|
|
28
28
|
gapi?: typeof gapi;
|
|
29
29
|
} & {
|
|
@@ -15,9 +15,42 @@
|
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
import { RecaptchaParameters } from '../../model/public_types';
|
|
18
|
+
import { GetRecaptchaConfigResponse } from '../../api/authentication/recaptcha';
|
|
18
19
|
export interface Recaptcha {
|
|
19
20
|
render: (container: HTMLElement, parameters: RecaptchaParameters) => number;
|
|
20
21
|
getResponse: (id: number) => string;
|
|
21
22
|
execute: (id: number) => unknown;
|
|
22
23
|
reset: (id: number) => unknown;
|
|
23
24
|
}
|
|
25
|
+
export declare function isV2(grecaptcha: Recaptcha | GreCAPTCHA | undefined): grecaptcha is Recaptcha;
|
|
26
|
+
export interface GreCAPTCHATopLevel extends GreCAPTCHA {
|
|
27
|
+
enterprise: GreCAPTCHA;
|
|
28
|
+
}
|
|
29
|
+
export interface GreCAPTCHA {
|
|
30
|
+
ready: (callback: () => void) => void;
|
|
31
|
+
execute: (siteKey: string, options: {
|
|
32
|
+
action: string;
|
|
33
|
+
}) => Promise<string>;
|
|
34
|
+
render: (container: string | HTMLElement, parameters: GreCAPTCHARenderOption) => string;
|
|
35
|
+
}
|
|
36
|
+
export interface GreCAPTCHARenderOption {
|
|
37
|
+
sitekey: string;
|
|
38
|
+
size: 'invisible';
|
|
39
|
+
}
|
|
40
|
+
export declare function isEnterprise(grecaptcha: Recaptcha | GreCAPTCHA | undefined): grecaptcha is GreCAPTCHATopLevel;
|
|
41
|
+
declare global {
|
|
42
|
+
interface Window {
|
|
43
|
+
grecaptcha?: Recaptcha | GreCAPTCHATopLevel;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
export declare class RecaptchaConfig {
|
|
47
|
+
/**
|
|
48
|
+
* The reCAPTCHA site key.
|
|
49
|
+
*/
|
|
50
|
+
siteKey: string;
|
|
51
|
+
/**
|
|
52
|
+
* The reCAPTCHA enablement status of the {@link EmailAuthProvider} for the current tenant.
|
|
53
|
+
*/
|
|
54
|
+
emailPasswordEnabled: boolean;
|
|
55
|
+
constructor(response: GetRecaptchaConfigResponse);
|
|
56
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2022 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 {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2022 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
|
+
import { RecaptchaActionName } from '../../api';
|
|
18
|
+
import { Auth } from '../../model/public_types';
|
|
19
|
+
import { AuthInternal } from '../../model/auth';
|
|
20
|
+
export declare const RECAPTCHA_ENTERPRISE_VERIFIER_TYPE = "recaptcha-enterprise";
|
|
21
|
+
export declare class RecaptchaEnterpriseVerifier {
|
|
22
|
+
/**
|
|
23
|
+
* Identifies the type of application verifier (e.g. "recaptcha-enterprise").
|
|
24
|
+
*/
|
|
25
|
+
readonly type = "recaptcha-enterprise";
|
|
26
|
+
private readonly auth;
|
|
27
|
+
/**
|
|
28
|
+
*
|
|
29
|
+
* @param authExtern - The corresponding Firebase {@link Auth} instance.
|
|
30
|
+
*
|
|
31
|
+
*/
|
|
32
|
+
constructor(authExtern: Auth);
|
|
33
|
+
/**
|
|
34
|
+
* Executes the verification process.
|
|
35
|
+
*
|
|
36
|
+
* @returns A Promise for a token that can be used to assert the validity of a request.
|
|
37
|
+
*/
|
|
38
|
+
verify(action?: string, forceRefresh?: boolean): Promise<string>;
|
|
39
|
+
}
|
|
40
|
+
export declare function injectRecaptchaFields<T>(auth: AuthInternal, request: T, action: RecaptchaActionName, captchaResp?: boolean): Promise<T>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2022 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 {};
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
*/
|
|
17
17
|
import { AuthInternal } from '../../model/auth';
|
|
18
18
|
import { RecaptchaParameters } from '../../model/public_types';
|
|
19
|
-
import { Recaptcha } from './recaptcha';
|
|
19
|
+
import { Recaptcha, GreCAPTCHATopLevel, GreCAPTCHARenderOption, GreCAPTCHA } from './recaptcha';
|
|
20
20
|
export declare const _SOLVE_TIME_MS = 500;
|
|
21
21
|
export declare const _EXPIRATION_TIME_MS = 60000;
|
|
22
22
|
export declare const _WIDGET_ID_START = 1000000000000;
|
|
@@ -35,6 +35,21 @@ export declare class MockReCaptcha implements Recaptcha {
|
|
|
35
35
|
getResponse(optWidgetId?: number): string;
|
|
36
36
|
execute(optWidgetId?: number | string): Promise<string>;
|
|
37
37
|
}
|
|
38
|
+
export declare class MockGreCAPTCHATopLevel implements GreCAPTCHATopLevel {
|
|
39
|
+
enterprise: GreCAPTCHA;
|
|
40
|
+
ready(callback: () => void): void;
|
|
41
|
+
execute(_siteKey: string, _options: {
|
|
42
|
+
action: string;
|
|
43
|
+
}): Promise<string>;
|
|
44
|
+
render(_container: string | HTMLElement, _parameters: GreCAPTCHARenderOption): string;
|
|
45
|
+
}
|
|
46
|
+
export declare class MockGreCAPTCHA implements GreCAPTCHA {
|
|
47
|
+
ready(callback: () => void): void;
|
|
48
|
+
execute(_siteKey: string, _options: {
|
|
49
|
+
action: string;
|
|
50
|
+
}): Promise<string>;
|
|
51
|
+
render(_container: string | HTMLElement, _parameters: GreCAPTCHARenderOption): string;
|
|
52
|
+
}
|
|
38
53
|
export declare class MockWidget {
|
|
39
54
|
private readonly params;
|
|
40
55
|
private readonly container;
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
import { Auth, AuthProvider, PopupRedirectResolver, User, UserCredential } from '../../model/public_types';
|
|
18
18
|
import { Delay } from '../../core/util/delay';
|
|
19
19
|
export declare const enum _Timeout {
|
|
20
|
-
AUTH_EVENT =
|
|
20
|
+
AUTH_EVENT = 8000
|
|
21
21
|
}
|
|
22
22
|
export declare const _POLL_WINDOW_CLOSE_TIMEOUT: Delay;
|
|
23
23
|
/**
|
|
@@ -17,4 +17,6 @@
|
|
|
17
17
|
import { Endpoint } from '../../../src/api';
|
|
18
18
|
import { Route } from '../mock_fetch';
|
|
19
19
|
export declare function endpointUrl(endpoint: Endpoint): string;
|
|
20
|
+
export declare function endpointUrlWithParams(endpoint: Endpoint, params: Record<string, any>): string;
|
|
20
21
|
export declare function mockEndpoint(endpoint: Endpoint, response: object, status?: number): Route;
|
|
22
|
+
export declare function mockEndpointWithParams(endpoint: Endpoint, params: Record<string, any>, response: object, status?: number): Route;
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
import { Provider } from '@firebase/component';
|
|
18
|
+
import { AppCheckTokenResult } from '@firebase/app-check-interop-types';
|
|
18
19
|
import { PopupRedirectResolver } from '../../src/model/public_types';
|
|
19
20
|
import { AuthImpl } from '../../src/core/auth/auth_impl';
|
|
20
21
|
import { PersistedBlob } from '../../src/core/persistence';
|
|
@@ -33,6 +34,10 @@ export declare const FAKE_HEARTBEAT_CONTROLLER: {
|
|
|
33
34
|
getHeartbeatsHeader: () => Promise<string>;
|
|
34
35
|
};
|
|
35
36
|
export declare const FAKE_HEARTBEAT_CONTROLLER_PROVIDER: Provider<'heartbeat'>;
|
|
37
|
+
export declare const FAKE_APP_CHECK_CONTROLLER: {
|
|
38
|
+
getToken: () => Promise<AppCheckTokenResult>;
|
|
39
|
+
};
|
|
40
|
+
export declare const FAKE_APP_CHECK_CONTROLLER_PROVIDER: Provider<'app-check-internal'>;
|
|
36
41
|
export declare class MockPersistenceLayer extends InMemoryPersistence {
|
|
37
42
|
lastObjectSet: PersistedBlob | null;
|
|
38
43
|
_set(key: string, object: PersistedBlob): Promise<void>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@firebase/auth",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.23.0-canary.0a27d2fbf",
|
|
4
4
|
"description": "The Firebase Authenticaton component of the Firebase JS SDK.",
|
|
5
5
|
"author": "Firebase <firebase-support@google.com> (https://firebase.google.com/)",
|
|
6
6
|
"main": "dist/node/index.js",
|
|
@@ -108,18 +108,18 @@
|
|
|
108
108
|
"typings:public": "node ../../scripts/build/use_typings.js ./dist/auth-public.d.ts"
|
|
109
109
|
},
|
|
110
110
|
"peerDependencies": {
|
|
111
|
-
"@firebase/app": "0.
|
|
111
|
+
"@firebase/app": "0.9.8-canary.0a27d2fbf"
|
|
112
112
|
},
|
|
113
113
|
"dependencies": {
|
|
114
|
-
"@firebase/component": "0.6.4",
|
|
115
|
-
"@firebase/logger": "0.4.0",
|
|
116
|
-
"@firebase/util": "1.9.3",
|
|
114
|
+
"@firebase/component": "0.6.4-canary.0a27d2fbf",
|
|
115
|
+
"@firebase/logger": "0.4.0-canary.0a27d2fbf",
|
|
116
|
+
"@firebase/util": "1.9.3-canary.0a27d2fbf",
|
|
117
117
|
"node-fetch": "2.6.7",
|
|
118
118
|
"tslib": "^2.1.0"
|
|
119
119
|
},
|
|
120
120
|
"license": "Apache-2.0",
|
|
121
121
|
"devDependencies": {
|
|
122
|
-
"@firebase/app": "0.9.
|
|
122
|
+
"@firebase/app": "0.9.8-canary.0a27d2fbf",
|
|
123
123
|
"@rollup/plugin-json": "4.1.0",
|
|
124
124
|
"@rollup/plugin-strip": "2.1.0",
|
|
125
125
|
"chromedriver": "98.0.1",
|