@firebase/auth 0.21.5 → 0.21.6-canary.45a55330e
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/README.md +25 -0
- package/dist/auth-public.d.ts +135 -4
- package/dist/auth.d.ts +138 -4
- package/dist/browser-cjs/{index-ff477525.js → index-3e63d976.js} +180 -5
- package/dist/browser-cjs/index-3e63d976.js.map +1 -0
- package/dist/browser-cjs/index.d.ts +2 -1
- package/dist/browser-cjs/index.js +3 -1
- package/dist/browser-cjs/index.js.map +1 -1
- package/dist/browser-cjs/internal.js +3 -1
- package/dist/browser-cjs/internal.js.map +1 -1
- package/dist/browser-cjs/src/api/account_management/mfa.d.ts +38 -4
- package/dist/browser-cjs/src/api/authentication/mfa.d.ts +11 -0
- package/dist/browser-cjs/src/core/errors.d.ts +1 -0
- package/dist/browser-cjs/src/core/index.d.ts +1 -0
- package/dist/browser-cjs/src/mfa/assertions/totp.d.ts +124 -0
- package/dist/browser-cjs/src/mfa/assertions/totp.test.d.ts +17 -0
- package/dist/browser-cjs/src/mfa/mfa_info.d.ts +5 -1
- package/dist/browser-cjs/src/model/enum_maps.d.ts +1 -0
- package/dist/browser-cjs/src/model/public_types.d.ts +18 -1
- package/dist/browser-cjs/test/helpers/integration/helpers.d.ts +3 -0
- package/dist/browser-cjs/test/integration/flows/totp.test.d.ts +17 -0
- package/dist/cordova/index.d.ts +2 -1
- package/dist/cordova/index.js +2 -2
- package/dist/cordova/internal.js +179 -3
- package/dist/cordova/internal.js.map +1 -1
- package/dist/cordova/{popup_redirect-a4d3c436.js → popup_redirect-4dd66477.js} +31 -6
- package/dist/cordova/popup_redirect-4dd66477.js.map +1 -0
- package/dist/cordova/src/api/account_management/mfa.d.ts +38 -4
- package/dist/cordova/src/api/authentication/mfa.d.ts +11 -0
- package/dist/cordova/src/core/errors.d.ts +1 -0
- package/dist/cordova/src/core/index.d.ts +1 -0
- package/dist/cordova/src/mfa/assertions/totp.d.ts +124 -0
- package/dist/cordova/src/mfa/assertions/totp.test.d.ts +17 -0
- package/dist/cordova/src/mfa/mfa_info.d.ts +5 -1
- package/dist/cordova/src/model/enum_maps.d.ts +1 -0
- package/dist/cordova/src/model/public_types.d.ts +18 -1
- package/dist/cordova/test/helpers/integration/helpers.d.ts +3 -0
- package/dist/cordova/test/integration/flows/totp.test.d.ts +17 -0
- package/dist/esm2017/{index-3363a72a.js → index-c8153924.js} +179 -6
- package/dist/esm2017/index-c8153924.js.map +1 -0
- package/dist/esm2017/index.d.ts +2 -1
- package/dist/esm2017/index.js +1 -1
- package/dist/esm2017/internal.js +2 -2
- package/dist/esm2017/src/api/account_management/mfa.d.ts +38 -4
- package/dist/esm2017/src/api/authentication/mfa.d.ts +11 -0
- package/dist/esm2017/src/core/errors.d.ts +1 -0
- package/dist/esm2017/src/core/index.d.ts +1 -0
- package/dist/esm2017/src/mfa/assertions/totp.d.ts +124 -0
- package/dist/esm2017/src/mfa/assertions/totp.test.d.ts +17 -0
- package/dist/esm2017/src/mfa/mfa_info.d.ts +5 -1
- package/dist/esm2017/src/model/enum_maps.d.ts +1 -0
- package/dist/esm2017/src/model/public_types.d.ts +18 -1
- package/dist/esm2017/test/helpers/integration/helpers.d.ts +3 -0
- package/dist/esm2017/test/integration/flows/totp.test.d.ts +17 -0
- package/dist/esm5/{index-3f05dc7b.js → index-f3279380.js} +207 -6
- package/dist/esm5/index-f3279380.js.map +1 -0
- package/dist/esm5/index.d.ts +2 -1
- package/dist/esm5/index.js +1 -1
- package/dist/esm5/internal.js +2 -2
- package/dist/esm5/src/api/account_management/mfa.d.ts +38 -4
- package/dist/esm5/src/api/authentication/mfa.d.ts +11 -0
- package/dist/esm5/src/core/errors.d.ts +1 -0
- package/dist/esm5/src/core/index.d.ts +1 -0
- package/dist/esm5/src/mfa/assertions/totp.d.ts +124 -0
- package/dist/esm5/src/mfa/assertions/totp.test.d.ts +17 -0
- package/dist/esm5/src/mfa/mfa_info.d.ts +5 -1
- package/dist/esm5/src/model/enum_maps.d.ts +1 -0
- package/dist/esm5/src/model/public_types.d.ts +18 -1
- package/dist/esm5/test/helpers/integration/helpers.d.ts +3 -0
- package/dist/esm5/test/integration/flows/totp.test.d.ts +17 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.webworker.esm5.js +23 -4
- package/dist/index.webworker.esm5.js.map +1 -1
- package/dist/node/index.d.ts +2 -1
- package/dist/node/index.js +83 -81
- package/dist/node/index.js.map +1 -1
- package/dist/node/internal.js +144 -142
- package/dist/node/internal.js.map +1 -1
- package/dist/node/src/api/account_management/mfa.d.ts +38 -4
- package/dist/node/src/api/authentication/mfa.d.ts +11 -0
- package/dist/node/src/core/errors.d.ts +1 -0
- package/dist/node/src/core/index.d.ts +1 -0
- package/dist/node/src/mfa/assertions/totp.d.ts +124 -0
- package/dist/node/src/mfa/assertions/totp.test.d.ts +17 -0
- package/dist/node/src/mfa/mfa_info.d.ts +5 -1
- package/dist/node/src/model/enum_maps.d.ts +1 -0
- package/dist/node/src/model/public_types.d.ts +18 -1
- package/dist/node/test/helpers/integration/helpers.d.ts +3 -0
- package/dist/node/test/integration/flows/totp.test.d.ts +17 -0
- package/dist/node/{index-45468d80.js → totp-9c98f1ff.js} +243 -6
- package/dist/node/totp-9c98f1ff.js.map +1 -0
- package/dist/node-esm/index.d.ts +2 -1
- package/dist/node-esm/index.js +2 -2
- package/dist/node-esm/internal.js +3 -3
- package/dist/node-esm/src/api/account_management/mfa.d.ts +38 -4
- package/dist/node-esm/src/api/authentication/mfa.d.ts +11 -0
- package/dist/node-esm/src/core/errors.d.ts +1 -0
- package/dist/node-esm/src/core/index.d.ts +1 -0
- package/dist/node-esm/src/mfa/assertions/totp.d.ts +124 -0
- package/dist/node-esm/src/mfa/assertions/totp.test.d.ts +17 -0
- package/dist/node-esm/src/mfa/mfa_info.d.ts +5 -1
- package/dist/node-esm/src/model/enum_maps.d.ts +1 -0
- package/dist/node-esm/src/model/public_types.d.ts +18 -1
- package/dist/node-esm/test/helpers/integration/helpers.d.ts +3 -0
- package/dist/node-esm/test/integration/flows/totp.test.d.ts +17 -0
- package/dist/node-esm/{index-1f9492de.js → totp-a3bfc07a.js} +213 -7
- package/dist/node-esm/totp-a3bfc07a.js.map +1 -0
- package/dist/rn/index.d.ts +2 -1
- package/dist/rn/index.js +1 -1
- package/dist/rn/internal.js +176 -1
- package/dist/rn/internal.js.map +1 -1
- package/dist/rn/{phone-e7bf48a1.js → phone-588b1f48.js} +37 -5
- package/dist/rn/phone-588b1f48.js.map +1 -0
- package/dist/rn/src/api/account_management/mfa.d.ts +38 -4
- package/dist/rn/src/api/authentication/mfa.d.ts +11 -0
- package/dist/rn/src/core/errors.d.ts +1 -0
- package/dist/rn/src/core/index.d.ts +1 -0
- package/dist/rn/src/mfa/assertions/totp.d.ts +124 -0
- package/dist/rn/src/mfa/assertions/totp.test.d.ts +17 -0
- package/dist/rn/src/mfa/mfa_info.d.ts +5 -1
- package/dist/rn/src/model/enum_maps.d.ts +1 -0
- package/dist/rn/src/model/public_types.d.ts +18 -1
- package/dist/rn/test/helpers/integration/helpers.d.ts +3 -0
- package/dist/rn/test/integration/flows/totp.test.d.ts +17 -0
- package/dist/src/api/account_management/mfa.d.ts +38 -4
- package/dist/src/api/authentication/mfa.d.ts +11 -0
- package/dist/src/core/errors.d.ts +1 -0
- package/dist/src/core/index.d.ts +1 -0
- package/dist/src/mfa/assertions/totp.d.ts +124 -0
- package/dist/src/mfa/assertions/totp.test.d.ts +17 -0
- package/dist/src/mfa/mfa_info.d.ts +5 -1
- package/dist/src/model/enum_maps.d.ts +1 -0
- package/dist/src/model/public_types.d.ts +18 -1
- package/dist/test/helpers/integration/helpers.d.ts +3 -0
- package/dist/test/integration/flows/totp.test.d.ts +17 -0
- package/package.json +10 -8
- package/dist/browser-cjs/index-ff477525.js.map +0 -1
- package/dist/cordova/popup_redirect-a4d3c436.js.map +0 -1
- package/dist/esm2017/index-3363a72a.js.map +0 -1
- package/dist/esm5/index-3f05dc7b.js.map +0 -1
- package/dist/node/index-45468d80.js.map +0 -1
- package/dist/node-esm/index-1f9492de.js.map +0 -1
- package/dist/rn/phone-e7bf48a1.js.map +0 -1
package/dist/node/internal.js
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var totp = require('./totp-9c98f1ff.js');
|
|
6
6
|
var tslib = require('tslib');
|
|
7
7
|
var util = require('@firebase/util');
|
|
8
8
|
var app = require('@firebase/app');
|
|
9
|
-
require('@firebase/logger');
|
|
10
9
|
require('@firebase/component');
|
|
11
10
|
require('node-fetch');
|
|
11
|
+
require('@firebase/logger');
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* @license
|
|
@@ -91,9 +91,9 @@ var AuthPopup = /** @class */ (function () {
|
|
|
91
91
|
*/
|
|
92
92
|
function _withDefaultResolver(auth, resolverOverride) {
|
|
93
93
|
if (resolverOverride) {
|
|
94
|
-
return
|
|
94
|
+
return totp._getInstance(resolverOverride);
|
|
95
95
|
}
|
|
96
|
-
|
|
96
|
+
totp._assert(auth._popupRedirectResolver, auth, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
97
97
|
return auth._popupRedirectResolver;
|
|
98
98
|
}
|
|
99
99
|
|
|
@@ -121,13 +121,13 @@ var IdpCredential = /** @class */ (function (_super) {
|
|
|
121
121
|
return _this;
|
|
122
122
|
}
|
|
123
123
|
IdpCredential.prototype._getIdTokenResponse = function (auth) {
|
|
124
|
-
return
|
|
124
|
+
return totp.signInWithIdp(auth, this._buildIdpRequest());
|
|
125
125
|
};
|
|
126
126
|
IdpCredential.prototype._linkToIdToken = function (auth, idToken) {
|
|
127
|
-
return
|
|
127
|
+
return totp.signInWithIdp(auth, this._buildIdpRequest(idToken));
|
|
128
128
|
};
|
|
129
129
|
IdpCredential.prototype._getReauthenticationResolver = function (auth) {
|
|
130
|
-
return
|
|
130
|
+
return totp.signInWithIdp(auth, this._buildIdpRequest());
|
|
131
131
|
};
|
|
132
132
|
IdpCredential.prototype._buildIdpRequest = function (idToken) {
|
|
133
133
|
var request = {
|
|
@@ -145,22 +145,22 @@ var IdpCredential = /** @class */ (function (_super) {
|
|
|
145
145
|
return request;
|
|
146
146
|
};
|
|
147
147
|
return IdpCredential;
|
|
148
|
-
}(
|
|
148
|
+
}(totp.AuthCredential));
|
|
149
149
|
function _signIn(params) {
|
|
150
|
-
return
|
|
150
|
+
return totp._signInWithCredential(params.auth, new IdpCredential(params), params.bypassAuthState);
|
|
151
151
|
}
|
|
152
152
|
function _reauth(params) {
|
|
153
153
|
var auth = params.auth, user = params.user;
|
|
154
|
-
|
|
155
|
-
return
|
|
154
|
+
totp._assert(user, auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
155
|
+
return totp._reauthenticate(user, new IdpCredential(params), params.bypassAuthState);
|
|
156
156
|
}
|
|
157
157
|
function _link(params) {
|
|
158
158
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
159
159
|
var auth, user;
|
|
160
160
|
return tslib.__generator(this, function (_a) {
|
|
161
161
|
auth = params.auth, user = params.user;
|
|
162
|
-
|
|
163
|
-
return [2 /*return*/,
|
|
162
|
+
totp._assert(user, auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
163
|
+
return [2 /*return*/, totp._link(user, new IdpCredential(params), params.bypassAuthState)];
|
|
164
164
|
});
|
|
165
165
|
});
|
|
166
166
|
}
|
|
@@ -277,16 +277,16 @@ var AbstractPopupRedirectOperation = /** @class */ (function () {
|
|
|
277
277
|
case "reauthViaRedirect" /* AuthEventType.REAUTH_VIA_REDIRECT */:
|
|
278
278
|
return _reauth;
|
|
279
279
|
default:
|
|
280
|
-
|
|
280
|
+
totp._fail(this.auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
281
281
|
}
|
|
282
282
|
};
|
|
283
283
|
AbstractPopupRedirectOperation.prototype.resolve = function (cred) {
|
|
284
|
-
|
|
284
|
+
totp.debugAssert(this.pendingPromise, 'Pending promise was never set');
|
|
285
285
|
this.pendingPromise.resolve(cred);
|
|
286
286
|
this.unregisterAndCleanUp();
|
|
287
287
|
};
|
|
288
288
|
AbstractPopupRedirectOperation.prototype.reject = function (error) {
|
|
289
|
-
|
|
289
|
+
totp.debugAssert(this.pendingPromise, 'Pending promise was never set');
|
|
290
290
|
this.pendingPromise.reject(error);
|
|
291
291
|
this.unregisterAndCleanUp();
|
|
292
292
|
};
|
|
@@ -451,10 +451,10 @@ function _overrideRedirectResult(auth, result) {
|
|
|
451
451
|
redirectOutcomeMap.set(auth._key(), result);
|
|
452
452
|
}
|
|
453
453
|
function resolverPersistence(resolver) {
|
|
454
|
-
return
|
|
454
|
+
return totp._getInstance(resolver._redirectPersistence);
|
|
455
455
|
}
|
|
456
456
|
function pendingRedirectKey(auth) {
|
|
457
|
-
return
|
|
457
|
+
return totp._persistenceKeyName(PENDING_REDIRECT_KEY, auth.config.apiKey, auth.name);
|
|
458
458
|
}
|
|
459
459
|
|
|
460
460
|
/**
|
|
@@ -480,7 +480,7 @@ function _getRedirectResult(auth, resolverExtern, bypassAuthState) {
|
|
|
480
480
|
return tslib.__generator(this, function (_a) {
|
|
481
481
|
switch (_a.label) {
|
|
482
482
|
case 0:
|
|
483
|
-
authInternal =
|
|
483
|
+
authInternal = totp._castAuth(auth);
|
|
484
484
|
resolver = _withDefaultResolver(authInternal, resolverExtern);
|
|
485
485
|
action = new RedirectAction(authInternal, resolver, bypassAuthState);
|
|
486
486
|
return [4 /*yield*/, action.execute()];
|
|
@@ -631,8 +631,8 @@ var WIDGET_PATH = '__/auth/handler';
|
|
|
631
631
|
*/
|
|
632
632
|
var EMULATOR_WIDGET_PATH = 'emulator/auth/handler';
|
|
633
633
|
function _getRedirectUrl(auth, provider, authType, redirectUrl, eventId, additionalParams) {
|
|
634
|
-
|
|
635
|
-
|
|
634
|
+
totp._assert(auth.config.authDomain, auth, "auth-domain-config-required" /* AuthErrorCode.MISSING_AUTH_DOMAIN */);
|
|
635
|
+
totp._assert(auth.config.apiKey, auth, "invalid-api-key" /* AuthErrorCode.INVALID_API_KEY */);
|
|
636
636
|
var params = {
|
|
637
637
|
apiKey: auth.config.apiKey,
|
|
638
638
|
appName: auth.name,
|
|
@@ -641,7 +641,7 @@ function _getRedirectUrl(auth, provider, authType, redirectUrl, eventId, additio
|
|
|
641
641
|
v: app.SDK_VERSION,
|
|
642
642
|
eventId: eventId
|
|
643
643
|
};
|
|
644
|
-
if (provider instanceof
|
|
644
|
+
if (provider instanceof totp.FederatedAuthProvider) {
|
|
645
645
|
provider.setDefaultLanguage(auth.languageCode);
|
|
646
646
|
params.providerId = provider.providerId || '';
|
|
647
647
|
if (!util.isEmpty(provider.getCustomParameters())) {
|
|
@@ -653,7 +653,7 @@ function _getRedirectUrl(auth, provider, authType, redirectUrl, eventId, additio
|
|
|
653
653
|
params[key] = value;
|
|
654
654
|
}
|
|
655
655
|
}
|
|
656
|
-
if (provider instanceof
|
|
656
|
+
if (provider instanceof totp.BaseOAuthProvider) {
|
|
657
657
|
var scopes = provider.getScopes().filter(function (scope) { return scope !== ''; });
|
|
658
658
|
if (scopes.length > 0) {
|
|
659
659
|
params.scopes = scopes.join(',');
|
|
@@ -678,7 +678,7 @@ function getHandlerBase(_a) {
|
|
|
678
678
|
if (!config.emulator) {
|
|
679
679
|
return "https://".concat(config.authDomain, "/").concat(WIDGET_PATH);
|
|
680
680
|
}
|
|
681
|
-
return
|
|
681
|
+
return totp._emulatorUrl(config, EMULATOR_WIDGET_PATH);
|
|
682
682
|
}
|
|
683
683
|
|
|
684
684
|
/**
|
|
@@ -721,7 +721,7 @@ function _getProjectConfig(auth, request) {
|
|
|
721
721
|
if (request === void 0) { request = {}; }
|
|
722
722
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
723
723
|
return tslib.__generator(this, function (_a) {
|
|
724
|
-
return [2 /*return*/,
|
|
724
|
+
return [2 /*return*/, totp._performApiRequest(auth, "GET" /* HttpMethod.GET */, "/v1/projects" /* Endpoint.GET_PROJECT_CONFIG */, request)];
|
|
725
725
|
});
|
|
726
726
|
});
|
|
727
727
|
}
|
|
@@ -758,21 +758,21 @@ function _generateHandlerUrl(auth, event, provider) {
|
|
|
758
758
|
switch (_b.label) {
|
|
759
759
|
case 0:
|
|
760
760
|
BuildInfo = _cordovaWindow().BuildInfo;
|
|
761
|
-
|
|
761
|
+
totp.debugAssert(event.sessionId, 'AuthEvent did not contain a session ID');
|
|
762
762
|
return [4 /*yield*/, computeSha256(event.sessionId)];
|
|
763
763
|
case 1:
|
|
764
764
|
sessionDigest = _b.sent();
|
|
765
765
|
additionalParams = {};
|
|
766
|
-
if (
|
|
766
|
+
if (totp._isIOS()) {
|
|
767
767
|
// iOS app identifier
|
|
768
768
|
additionalParams['ibi'] = BuildInfo.packageName;
|
|
769
769
|
}
|
|
770
|
-
else if (
|
|
770
|
+
else if (totp._isAndroid()) {
|
|
771
771
|
// Android app identifier
|
|
772
772
|
additionalParams['apn'] = BuildInfo.packageName;
|
|
773
773
|
}
|
|
774
774
|
else {
|
|
775
|
-
|
|
775
|
+
totp._fail(auth, "operation-not-supported-in-this-environment" /* AuthErrorCode.OPERATION_NOT_SUPPORTED */);
|
|
776
776
|
}
|
|
777
777
|
// Add the display name if available
|
|
778
778
|
if (BuildInfo.displayName) {
|
|
@@ -796,14 +796,14 @@ function _validateOrigin(auth) {
|
|
|
796
796
|
case 0:
|
|
797
797
|
BuildInfo = _cordovaWindow().BuildInfo;
|
|
798
798
|
request = {};
|
|
799
|
-
if (
|
|
799
|
+
if (totp._isIOS()) {
|
|
800
800
|
request.iosBundleId = BuildInfo.packageName;
|
|
801
801
|
}
|
|
802
|
-
else if (
|
|
802
|
+
else if (totp._isAndroid()) {
|
|
803
803
|
request.androidPackageName = BuildInfo.packageName;
|
|
804
804
|
}
|
|
805
805
|
else {
|
|
806
|
-
|
|
806
|
+
totp._fail(auth, "operation-not-supported-in-this-environment" /* AuthErrorCode.OPERATION_NOT_SUPPORTED */);
|
|
807
807
|
}
|
|
808
808
|
// Will fail automatically if package name is not authorized
|
|
809
809
|
return [4 /*yield*/, _getProjectConfig(auth, request)];
|
|
@@ -826,7 +826,7 @@ function _performRedirect(handlerUrl) {
|
|
|
826
826
|
}
|
|
827
827
|
else {
|
|
828
828
|
// TODO: Return the inappbrowser ref that's returned from the open call
|
|
829
|
-
iabRef = cordova.InAppBrowser.open(handlerUrl,
|
|
829
|
+
iabRef = cordova.InAppBrowser.open(handlerUrl, totp._isIOS7Or8() ? '_blank' : '_system', 'location=yes');
|
|
830
830
|
}
|
|
831
831
|
resolve(iabRef);
|
|
832
832
|
});
|
|
@@ -874,7 +874,7 @@ function _waitForAppResume(auth, eventListener, iabRef) {
|
|
|
874
874
|
}
|
|
875
875
|
onCloseTimer = window.setTimeout(function () {
|
|
876
876
|
// Wait two seeconds after resume then reject.
|
|
877
|
-
reject(
|
|
877
|
+
reject(totp._createError(auth, "redirect-cancelled-by-user" /* AuthErrorCode.REDIRECT_CANCELLED_BY_USER */));
|
|
878
878
|
}, REDIRECT_TIMEOUT_MS);
|
|
879
879
|
}
|
|
880
880
|
function visibilityChanged() {
|
|
@@ -887,7 +887,7 @@ function _waitForAppResume(auth, eventListener, iabRef) {
|
|
|
887
887
|
eventListener.addPassiveListener(authEventSeen);
|
|
888
888
|
// Listen for resume and visibility events
|
|
889
889
|
document.addEventListener('resume', resumed, false);
|
|
890
|
-
if (
|
|
890
|
+
if (totp._isAndroid()) {
|
|
891
891
|
document.addEventListener('visibilitychange', visibilityChanged, false);
|
|
892
892
|
}
|
|
893
893
|
// SETUP THE CLEANUP FUNCTION =====
|
|
@@ -924,22 +924,22 @@ function _checkCordovaConfiguration(auth) {
|
|
|
924
924
|
// Note that cordova-universal-links-plugin has been abandoned.
|
|
925
925
|
// A fork with latest fixes is available at:
|
|
926
926
|
// https://www.npmjs.com/package/cordova-universal-links-plugin-fix
|
|
927
|
-
|
|
927
|
+
totp._assert(typeof ((_a = win === null || win === void 0 ? void 0 : win.universalLinks) === null || _a === void 0 ? void 0 : _a.subscribe) === 'function', auth, "invalid-cordova-configuration" /* AuthErrorCode.INVALID_CORDOVA_CONFIGURATION */, {
|
|
928
928
|
missingPlugin: 'cordova-universal-links-plugin-fix'
|
|
929
929
|
});
|
|
930
930
|
// https://www.npmjs.com/package/cordova-plugin-buildinfo
|
|
931
|
-
|
|
931
|
+
totp._assert(typeof ((_b = win === null || win === void 0 ? void 0 : win.BuildInfo) === null || _b === void 0 ? void 0 : _b.packageName) !== 'undefined', auth, "invalid-cordova-configuration" /* AuthErrorCode.INVALID_CORDOVA_CONFIGURATION */, {
|
|
932
932
|
missingPlugin: 'cordova-plugin-buildInfo'
|
|
933
933
|
});
|
|
934
934
|
// https://github.com/google/cordova-plugin-browsertab
|
|
935
|
-
|
|
935
|
+
totp._assert(typeof ((_e = (_d = (_c = win === null || win === void 0 ? void 0 : win.cordova) === null || _c === void 0 ? void 0 : _c.plugins) === null || _d === void 0 ? void 0 : _d.browsertab) === null || _e === void 0 ? void 0 : _e.openUrl) === 'function', auth, "invalid-cordova-configuration" /* AuthErrorCode.INVALID_CORDOVA_CONFIGURATION */, {
|
|
936
936
|
missingPlugin: 'cordova-plugin-browsertab'
|
|
937
937
|
});
|
|
938
|
-
|
|
938
|
+
totp._assert(typeof ((_h = (_g = (_f = win === null || win === void 0 ? void 0 : win.cordova) === null || _f === void 0 ? void 0 : _f.plugins) === null || _g === void 0 ? void 0 : _g.browsertab) === null || _h === void 0 ? void 0 : _h.isAvailable) === 'function', auth, "invalid-cordova-configuration" /* AuthErrorCode.INVALID_CORDOVA_CONFIGURATION */, {
|
|
939
939
|
missingPlugin: 'cordova-plugin-browsertab'
|
|
940
940
|
});
|
|
941
941
|
// https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-inappbrowser/
|
|
942
|
-
|
|
942
|
+
totp._assert(typeof ((_k = (_j = win === null || win === void 0 ? void 0 : win.cordova) === null || _j === void 0 ? void 0 : _j.InAppBrowser) === null || _k === void 0 ? void 0 : _k.open) === 'function', auth, "invalid-cordova-configuration" /* AuthErrorCode.INVALID_CORDOVA_CONFIGURATION */, {
|
|
943
943
|
missingPlugin: 'cordova-plugin-inappbrowser'
|
|
944
944
|
});
|
|
945
945
|
}
|
|
@@ -967,7 +967,7 @@ function computeSha256(sessionId) {
|
|
|
967
967
|
function stringToArrayBuffer(str) {
|
|
968
968
|
// This function is only meant to deal with an ASCII charset and makes
|
|
969
969
|
// certain simplifying assumptions.
|
|
970
|
-
|
|
970
|
+
totp.debugAssert(/[0-9a-zA-Z]+/.test(str), 'Can only convert alpha-numeric strings');
|
|
971
971
|
if (typeof TextEncoder !== 'undefined') {
|
|
972
972
|
return new TextEncoder().encode(str);
|
|
973
973
|
}
|
|
@@ -1051,7 +1051,7 @@ var AuthEventManager = /** @class */ (function () {
|
|
|
1051
1051
|
if (event.error && !isNullRedirectEvent(event)) {
|
|
1052
1052
|
var code = ((_a = event.error.code) === null || _a === void 0 ? void 0 : _a.split('auth/')[1]) ||
|
|
1053
1053
|
"internal-error" /* AuthErrorCode.INTERNAL_ERROR */;
|
|
1054
|
-
consumer.onError(
|
|
1054
|
+
consumer.onError(totp._createError(this.auth, code));
|
|
1055
1055
|
}
|
|
1056
1056
|
else {
|
|
1057
1057
|
consumer.onAuthEvent(event);
|
|
@@ -1114,7 +1114,7 @@ function isRedirectEvent(event) {
|
|
|
1114
1114
|
*/
|
|
1115
1115
|
function _iframeCannotSyncWebStorage() {
|
|
1116
1116
|
var ua = util.getUA();
|
|
1117
|
-
return
|
|
1117
|
+
return totp._isSafari(ua) || totp._isIOS(ua);
|
|
1118
1118
|
}
|
|
1119
1119
|
// The polling period in case events are not supported
|
|
1120
1120
|
var _POLLING_INTERVAL_MS = 1000;
|
|
@@ -1131,9 +1131,9 @@ var BrowserLocalPersistence = /** @class */ (function (_super) {
|
|
|
1131
1131
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1132
1132
|
_this.pollTimer = null;
|
|
1133
1133
|
// Safari or iOS browser and embedded in an iframe.
|
|
1134
|
-
_this.safariLocalStorageNotSynced = _iframeCannotSyncWebStorage() &&
|
|
1134
|
+
_this.safariLocalStorageNotSynced = _iframeCannotSyncWebStorage() && totp._isIframe();
|
|
1135
1135
|
// Whether to use polling instead of depending on window events
|
|
1136
|
-
_this.fallbackToPolling =
|
|
1136
|
+
_this.fallbackToPolling = totp._isMobileBrowser();
|
|
1137
1137
|
_this._shouldAllowMigration = true;
|
|
1138
1138
|
return _this;
|
|
1139
1139
|
}
|
|
@@ -1207,7 +1207,7 @@ var BrowserLocalPersistence = /** @class */ (function (_super) {
|
|
|
1207
1207
|
_this.notifyListeners(key, storedValue);
|
|
1208
1208
|
};
|
|
1209
1209
|
var storedValue = this.storage.getItem(key);
|
|
1210
|
-
if (
|
|
1210
|
+
if (totp._isIE10() &&
|
|
1211
1211
|
storedValue !== event.newValue &&
|
|
1212
1212
|
event.newValue !== event.oldValue) {
|
|
1213
1213
|
// IE 10 has this weird bug where a storage event would trigger with the
|
|
@@ -1412,7 +1412,7 @@ function _generateNewEvent(auth, type, eventId) {
|
|
|
1412
1412
|
sessionId: generateSessionId(),
|
|
1413
1413
|
postBody: null,
|
|
1414
1414
|
tenantId: auth.tenantId,
|
|
1415
|
-
error:
|
|
1415
|
+
error: totp._createError(auth, "no-auth-event" /* AuthErrorCode.NO_AUTH_EVENT */)
|
|
1416
1416
|
};
|
|
1417
1417
|
}
|
|
1418
1418
|
function _savePartialEvent(auth, event) {
|
|
@@ -1455,7 +1455,7 @@ function _eventFromPartialAndUrl(partialEvent, url) {
|
|
|
1455
1455
|
? parseJsonOrNull(decodeURIComponent(params['firebaseError']))
|
|
1456
1456
|
: null;
|
|
1457
1457
|
var code = (_b = (_a = errorObject === null || errorObject === void 0 ? void 0 : errorObject['code']) === null || _a === void 0 ? void 0 : _a.split('auth/')) === null || _b === void 0 ? void 0 : _b[1];
|
|
1458
|
-
var error = code ?
|
|
1458
|
+
var error = code ? totp._createError(code) : null;
|
|
1459
1459
|
if (error) {
|
|
1460
1460
|
return {
|
|
1461
1461
|
type: partialEvent.type,
|
|
@@ -1490,10 +1490,10 @@ function generateSessionId() {
|
|
|
1490
1490
|
return chars.join('');
|
|
1491
1491
|
}
|
|
1492
1492
|
function storage() {
|
|
1493
|
-
return
|
|
1493
|
+
return totp._getInstance(browserLocalPersistence);
|
|
1494
1494
|
}
|
|
1495
1495
|
function persistenceKey(auth) {
|
|
1496
|
-
return
|
|
1496
|
+
return totp._persistenceKeyName("authEvent" /* KeyName.AUTH_EVENT */, auth.config.apiKey, auth.name);
|
|
1497
1497
|
}
|
|
1498
1498
|
function parseJsonOrNull(json) {
|
|
1499
1499
|
try {
|
|
@@ -1574,7 +1574,7 @@ var CordovaPopupRedirectResolver = /** @class */ (function () {
|
|
|
1574
1574
|
});
|
|
1575
1575
|
};
|
|
1576
1576
|
CordovaPopupRedirectResolver.prototype._openPopup = function (auth) {
|
|
1577
|
-
|
|
1577
|
+
totp._fail(auth, "operation-not-supported-in-this-environment" /* AuthErrorCode.OPERATION_NOT_SUPPORTED */);
|
|
1578
1578
|
};
|
|
1579
1579
|
CordovaPopupRedirectResolver.prototype._openRedirect = function (auth, provider, authType, eventId) {
|
|
1580
1580
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
@@ -1712,7 +1712,7 @@ function generateNoEvent() {
|
|
|
1712
1712
|
urlResponse: null,
|
|
1713
1713
|
postBody: null,
|
|
1714
1714
|
tenantId: null,
|
|
1715
|
-
error:
|
|
1715
|
+
error: totp._createError("no-auth-event" /* AuthErrorCode.NO_AUTH_EVENT */)
|
|
1716
1716
|
};
|
|
1717
1717
|
}
|
|
1718
1718
|
|
|
@@ -1736,98 +1736,100 @@ function generateNoEvent() {
|
|
|
1736
1736
|
// It is not intended for direct use by developer apps. NO jsdoc here to intentionally leave it out
|
|
1737
1737
|
// of autogenerated documentation pages to reduce accidental misuse.
|
|
1738
1738
|
function addFrameworkForLogging(auth, framework) {
|
|
1739
|
-
|
|
1739
|
+
totp._castAuth(auth)._logFramework(framework);
|
|
1740
1740
|
}
|
|
1741
1741
|
|
|
1742
|
-
exports.ActionCodeOperation =
|
|
1743
|
-
exports.ActionCodeURL =
|
|
1744
|
-
exports.AuthCredential =
|
|
1745
|
-
exports.AuthErrorCodes =
|
|
1746
|
-
exports.AuthImpl =
|
|
1747
|
-
exports.EmailAuthCredential =
|
|
1748
|
-
exports.EmailAuthProvider =
|
|
1749
|
-
exports.FacebookAuthProvider =
|
|
1750
|
-
exports.FactorId =
|
|
1751
|
-
exports.FetchProvider =
|
|
1752
|
-
exports.GithubAuthProvider =
|
|
1753
|
-
exports.GoogleAuthProvider =
|
|
1754
|
-
exports.OAuthCredential =
|
|
1755
|
-
exports.OAuthProvider =
|
|
1756
|
-
exports.OperationType =
|
|
1757
|
-
exports.PhoneAuthCredential =
|
|
1758
|
-
exports.PhoneAuthProvider =
|
|
1759
|
-
exports.PhoneMultiFactorGenerator =
|
|
1760
|
-
exports.ProviderId =
|
|
1761
|
-
exports.RecaptchaVerifier =
|
|
1762
|
-
exports.SAMLAuthCredential =
|
|
1763
|
-
exports.SAMLAuthProvider =
|
|
1764
|
-
exports.SignInMethod =
|
|
1765
|
-
exports.
|
|
1766
|
-
exports.
|
|
1767
|
-
exports.
|
|
1768
|
-
exports.
|
|
1769
|
-
exports.
|
|
1770
|
-
exports.
|
|
1771
|
-
exports.
|
|
1772
|
-
exports.
|
|
1773
|
-
exports.
|
|
1774
|
-
exports.
|
|
1775
|
-
exports.
|
|
1776
|
-
exports.
|
|
1777
|
-
exports.
|
|
1778
|
-
exports.
|
|
1779
|
-
exports.
|
|
1780
|
-
exports.
|
|
1781
|
-
exports.
|
|
1782
|
-
exports.
|
|
1783
|
-
exports.
|
|
1784
|
-
exports.
|
|
1785
|
-
exports.
|
|
1786
|
-
exports.
|
|
1787
|
-
exports.
|
|
1788
|
-
exports.
|
|
1789
|
-
exports.
|
|
1790
|
-
exports.
|
|
1791
|
-
exports.
|
|
1792
|
-
exports.
|
|
1793
|
-
exports.
|
|
1794
|
-
exports.
|
|
1795
|
-
exports.
|
|
1796
|
-
exports.
|
|
1797
|
-
exports.
|
|
1798
|
-
exports.
|
|
1799
|
-
exports.
|
|
1800
|
-
exports.
|
|
1801
|
-
exports.
|
|
1802
|
-
exports.
|
|
1803
|
-
exports.
|
|
1804
|
-
exports.
|
|
1805
|
-
exports.
|
|
1806
|
-
exports.
|
|
1807
|
-
exports.
|
|
1808
|
-
exports.
|
|
1809
|
-
exports.
|
|
1810
|
-
exports.
|
|
1811
|
-
exports.
|
|
1812
|
-
exports.
|
|
1813
|
-
exports.
|
|
1814
|
-
exports.
|
|
1815
|
-
exports.
|
|
1816
|
-
exports.
|
|
1817
|
-
exports.
|
|
1818
|
-
exports.
|
|
1819
|
-
exports.
|
|
1820
|
-
exports.
|
|
1821
|
-
exports.
|
|
1822
|
-
exports.
|
|
1823
|
-
exports.
|
|
1824
|
-
exports.
|
|
1825
|
-
exports.
|
|
1826
|
-
exports.
|
|
1827
|
-
exports.
|
|
1828
|
-
exports.
|
|
1829
|
-
exports.
|
|
1830
|
-
exports.
|
|
1742
|
+
exports.ActionCodeOperation = totp.ActionCodeOperation;
|
|
1743
|
+
exports.ActionCodeURL = totp.ActionCodeURL;
|
|
1744
|
+
exports.AuthCredential = totp.AuthCredential;
|
|
1745
|
+
exports.AuthErrorCodes = totp.AUTH_ERROR_CODES_MAP_DO_NOT_USE_INTERNALLY;
|
|
1746
|
+
exports.AuthImpl = totp.AuthImpl;
|
|
1747
|
+
exports.EmailAuthCredential = totp.EmailAuthCredential;
|
|
1748
|
+
exports.EmailAuthProvider = totp.EmailAuthProvider;
|
|
1749
|
+
exports.FacebookAuthProvider = totp.FacebookAuthProvider;
|
|
1750
|
+
exports.FactorId = totp.FactorId;
|
|
1751
|
+
exports.FetchProvider = totp.FetchProvider;
|
|
1752
|
+
exports.GithubAuthProvider = totp.GithubAuthProvider;
|
|
1753
|
+
exports.GoogleAuthProvider = totp.GoogleAuthProvider;
|
|
1754
|
+
exports.OAuthCredential = totp.OAuthCredential;
|
|
1755
|
+
exports.OAuthProvider = totp.OAuthProvider;
|
|
1756
|
+
exports.OperationType = totp.OperationType;
|
|
1757
|
+
exports.PhoneAuthCredential = totp.PhoneAuthCredential;
|
|
1758
|
+
exports.PhoneAuthProvider = totp.PhoneAuthProvider;
|
|
1759
|
+
exports.PhoneMultiFactorGenerator = totp.PhoneMultiFactorGenerator;
|
|
1760
|
+
exports.ProviderId = totp.ProviderId;
|
|
1761
|
+
exports.RecaptchaVerifier = totp.RecaptchaVerifier;
|
|
1762
|
+
exports.SAMLAuthCredential = totp.SAMLAuthCredential;
|
|
1763
|
+
exports.SAMLAuthProvider = totp.SAMLAuthProvider;
|
|
1764
|
+
exports.SignInMethod = totp.SignInMethod;
|
|
1765
|
+
exports.TotpMultiFactorGenerator = totp.TotpMultiFactorGenerator;
|
|
1766
|
+
exports.TotpSecret = totp.TotpSecret;
|
|
1767
|
+
exports.TwitterAuthProvider = totp.TwitterAuthProvider;
|
|
1768
|
+
exports.UserImpl = totp.UserImpl;
|
|
1769
|
+
exports._assert = totp._assert;
|
|
1770
|
+
exports._castAuth = totp._castAuth;
|
|
1771
|
+
exports._fail = totp._fail;
|
|
1772
|
+
exports._getClientVersion = totp._getClientVersion;
|
|
1773
|
+
exports._getInstance = totp._getInstance;
|
|
1774
|
+
exports._persistenceKeyName = totp._persistenceKeyName;
|
|
1775
|
+
exports.applyActionCode = totp.applyActionCode;
|
|
1776
|
+
exports.beforeAuthStateChanged = totp.beforeAuthStateChanged;
|
|
1777
|
+
exports.browserLocalPersistence = totp.browserLocalPersistence;
|
|
1778
|
+
exports.browserPopupRedirectResolver = totp.browserPopupRedirectResolver;
|
|
1779
|
+
exports.browserSessionPersistence = totp.browserSessionPersistence;
|
|
1780
|
+
exports.checkActionCode = totp.checkActionCode;
|
|
1781
|
+
exports.confirmPasswordReset = totp.confirmPasswordReset;
|
|
1782
|
+
exports.connectAuthEmulator = totp.connectAuthEmulator;
|
|
1783
|
+
exports.createUserWithEmailAndPassword = totp.createUserWithEmailAndPassword;
|
|
1784
|
+
exports.debugErrorMap = totp.debugErrorMap;
|
|
1785
|
+
exports.deleteUser = totp.deleteUser;
|
|
1786
|
+
exports.fetchSignInMethodsForEmail = totp.fetchSignInMethodsForEmail;
|
|
1787
|
+
exports.getAdditionalUserInfo = totp.getAdditionalUserInfo;
|
|
1788
|
+
exports.getAuth = totp.getAuth;
|
|
1789
|
+
exports.getIdToken = totp.getIdToken;
|
|
1790
|
+
exports.getIdTokenResult = totp.getIdTokenResult;
|
|
1791
|
+
exports.getMultiFactorResolver = totp.getMultiFactorResolver;
|
|
1792
|
+
exports.getRedirectResult = totp.getRedirectResult;
|
|
1793
|
+
exports.inMemoryPersistence = totp.inMemoryPersistence;
|
|
1794
|
+
exports.indexedDBLocalPersistence = totp.indexedDBLocalPersistence;
|
|
1795
|
+
exports.initializeAuth = totp.initializeAuth;
|
|
1796
|
+
exports.isSignInWithEmailLink = totp.isSignInWithEmailLink;
|
|
1797
|
+
exports.linkWithCredential = totp.linkWithCredential;
|
|
1798
|
+
exports.linkWithPhoneNumber = totp.linkWithPhoneNumber;
|
|
1799
|
+
exports.linkWithPopup = totp.linkWithPopup;
|
|
1800
|
+
exports.linkWithRedirect = totp.linkWithRedirect;
|
|
1801
|
+
exports.multiFactor = totp.multiFactor;
|
|
1802
|
+
exports.onAuthStateChanged = totp.onAuthStateChanged;
|
|
1803
|
+
exports.onIdTokenChanged = totp.onIdTokenChanged;
|
|
1804
|
+
exports.parseActionCodeURL = totp.parseActionCodeURL;
|
|
1805
|
+
exports.prodErrorMap = totp.prodErrorMap;
|
|
1806
|
+
exports.reauthenticateWithCredential = totp.reauthenticateWithCredential;
|
|
1807
|
+
exports.reauthenticateWithPhoneNumber = totp.reauthenticateWithPhoneNumber;
|
|
1808
|
+
exports.reauthenticateWithPopup = totp.reauthenticateWithPopup;
|
|
1809
|
+
exports.reauthenticateWithRedirect = totp.reauthenticateWithRedirect;
|
|
1810
|
+
exports.reload = totp.reload;
|
|
1811
|
+
exports.sendEmailVerification = totp.sendEmailVerification;
|
|
1812
|
+
exports.sendPasswordResetEmail = totp.sendPasswordResetEmail;
|
|
1813
|
+
exports.sendSignInLinkToEmail = totp.sendSignInLinkToEmail;
|
|
1814
|
+
exports.setPersistence = totp.setPersistence;
|
|
1815
|
+
exports.signInAnonymously = totp.signInAnonymously;
|
|
1816
|
+
exports.signInWithCredential = totp.signInWithCredential;
|
|
1817
|
+
exports.signInWithCustomToken = totp.signInWithCustomToken;
|
|
1818
|
+
exports.signInWithEmailAndPassword = totp.signInWithEmailAndPassword;
|
|
1819
|
+
exports.signInWithEmailLink = totp.signInWithEmailLink;
|
|
1820
|
+
exports.signInWithPhoneNumber = totp.signInWithPhoneNumber;
|
|
1821
|
+
exports.signInWithPopup = totp.signInWithPopup;
|
|
1822
|
+
exports.signInWithRedirect = totp.signInWithRedirect;
|
|
1823
|
+
exports.signOut = totp.signOut;
|
|
1824
|
+
exports.unlink = totp.unlink;
|
|
1825
|
+
exports.updateCurrentUser = totp.updateCurrentUser;
|
|
1826
|
+
exports.updateEmail = totp.updateEmail;
|
|
1827
|
+
exports.updatePassword = totp.updatePassword;
|
|
1828
|
+
exports.updatePhoneNumber = totp.updatePhoneNumber;
|
|
1829
|
+
exports.updateProfile = totp.updateProfile;
|
|
1830
|
+
exports.useDeviceLanguage = totp.useDeviceLanguage;
|
|
1831
|
+
exports.verifyBeforeUpdateEmail = totp.verifyBeforeUpdateEmail;
|
|
1832
|
+
exports.verifyPasswordResetCode = totp.verifyPasswordResetCode;
|
|
1831
1833
|
exports.AuthPopup = AuthPopup;
|
|
1832
1834
|
exports._generateEventId = _generateEventId;
|
|
1833
1835
|
exports._getRedirectResult = _getRedirectResult;
|