@firebase/auth 0.21.5 → 0.21.6-canary.a8d6499b1
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 +137 -4
- package/dist/auth.d.ts +149 -4
- package/dist/browser-cjs/{index-ff477525.js → index-a031a7c0.js} +180 -5
- package/dist/browser-cjs/index-a031a7c0.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-69cff576.js} +31 -6
- package/dist/cordova/popup_redirect-69cff576.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-33f309f3.js} +179 -6
- package/dist/esm2017/index-33f309f3.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-588c4d42.js} +207 -6
- package/dist/esm5/index-588c4d42.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-4f539e73.js} +243 -6
- package/dist/node/totp-4f539e73.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-aec70fa2.js} +213 -7
- package/dist/node-esm/totp-aec70fa2.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-a38a417c.js} +37 -5
- package/dist/rn/phone-a38a417c.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/cordova/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getApp, _getProvider } from '@firebase/app';
|
|
2
|
-
import { _ as _signInWithRedirect, a as _reauthenticateWithRedirect, b as _linkWithRedirect, r as registerAuth, i as initializeAuth, c as indexedDBLocalPersistence, d as cordovaPopupRedirectResolver } from './popup_redirect-
|
|
3
|
-
export { A as ActionCodeOperation, a3 as ActionCodeURL, v as AuthCredential, q as AuthErrorCodes, E as EmailAuthCredential, z as EmailAuthProvider, B as FacebookAuthProvider, F as FactorId, C as GithubAuthProvider, G as GoogleAuthProvider, w as OAuthCredential, D as OAuthProvider, O as OperationType, x as PhoneAuthCredential, P as ProviderId, H as SAMLAuthProvider, S as SignInMethod, T as TwitterAuthProvider, R as applyActionCode, h as beforeAuthStateChanged, e as browserLocalPersistence, f as browserSessionPersistence, U as checkActionCode, Q as confirmPasswordReset, t as connectAuthEmulator, d as cordovaPopupRedirectResolver, W as createUserWithEmailAndPassword, n as debugErrorMap, m as deleteUser, a0 as fetchSignInMethodsForEmail, ab as getAdditionalUserInfo, a8 as getIdToken, a9 as getIdTokenResult, ad as getMultiFactorResolver, g as getRedirectResult, y as inMemoryPersistence, c as indexedDBLocalPersistence, i as initializeAuth, Z as isSignInWithEmailLink, K as linkWithCredential, ae as multiFactor, j as onAuthStateChanged, o as onIdTokenChanged, a4 as parseActionCodeURL, p as prodErrorMap, L as reauthenticateWithCredential, ac as reload, a1 as sendEmailVerification, N as sendPasswordResetEmail, Y as sendSignInLinkToEmail, s as setPersistence, I as signInAnonymously, J as signInWithCredential, M as signInWithCustomToken, X as signInWithEmailAndPassword, $ as signInWithEmailLink, l as signOut, aa as unlink, k as updateCurrentUser, a6 as updateEmail, a7 as updatePassword, a5 as updateProfile, u as useDeviceLanguage, a2 as verifyBeforeUpdateEmail, V as verifyPasswordResetCode } from './popup_redirect-
|
|
2
|
+
import { _ as _signInWithRedirect, a as _reauthenticateWithRedirect, b as _linkWithRedirect, r as registerAuth, i as initializeAuth, c as indexedDBLocalPersistence, d as cordovaPopupRedirectResolver } from './popup_redirect-69cff576.js';
|
|
3
|
+
export { A as ActionCodeOperation, a3 as ActionCodeURL, v as AuthCredential, q as AuthErrorCodes, E as EmailAuthCredential, z as EmailAuthProvider, B as FacebookAuthProvider, F as FactorId, C as GithubAuthProvider, G as GoogleAuthProvider, w as OAuthCredential, D as OAuthProvider, O as OperationType, x as PhoneAuthCredential, P as ProviderId, H as SAMLAuthProvider, S as SignInMethod, T as TwitterAuthProvider, R as applyActionCode, h as beforeAuthStateChanged, e as browserLocalPersistence, f as browserSessionPersistence, U as checkActionCode, Q as confirmPasswordReset, t as connectAuthEmulator, d as cordovaPopupRedirectResolver, W as createUserWithEmailAndPassword, n as debugErrorMap, m as deleteUser, a0 as fetchSignInMethodsForEmail, ab as getAdditionalUserInfo, a8 as getIdToken, a9 as getIdTokenResult, ad as getMultiFactorResolver, g as getRedirectResult, y as inMemoryPersistence, c as indexedDBLocalPersistence, i as initializeAuth, Z as isSignInWithEmailLink, K as linkWithCredential, ae as multiFactor, j as onAuthStateChanged, o as onIdTokenChanged, a4 as parseActionCodeURL, p as prodErrorMap, L as reauthenticateWithCredential, ac as reload, a1 as sendEmailVerification, N as sendPasswordResetEmail, Y as sendSignInLinkToEmail, s as setPersistence, I as signInAnonymously, J as signInWithCredential, M as signInWithCustomToken, X as signInWithEmailAndPassword, $ as signInWithEmailLink, l as signOut, aa as unlink, k as updateCurrentUser, a6 as updateEmail, a7 as updatePassword, a5 as updateProfile, u as useDeviceLanguage, a2 as verifyBeforeUpdateEmail, V as verifyPasswordResetCode } from './popup_redirect-69cff576.js';
|
|
4
4
|
import 'tslib';
|
|
5
5
|
import '@firebase/util';
|
|
6
6
|
import '@firebase/component';
|
package/dist/cordova/internal.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { af as _performApiRequest, ag as _addTidIfNecessary, ah as _createError, ai as _assert, aj as Delay, ak as _window, al as _isHttpOrHttps, am as _isWorker, an as _castAuth, J as signInWithCredential, K as linkWithCredential, ao as _assertLinkedStatus, L as reauthenticateWithCredential, ap as sendPhoneVerificationCode, aq as startEnrollPhoneMfa, ar as _link, x as PhoneAuthCredential, as as debugAssert, at as _generateEventId, au as AbstractPopupRedirectOperation, av as _assertInstanceOf, aw as _withDefaultResolver, ax as FederatedAuthProvider, ay as _fail, az as _getProjectConfig, aA as _getCurrentUrl, aB as _emulatorUrl, aC as _isChromeIOS, aD as _isFirefox, aE as _isIOSStandalone, aF as _getRedirectUrl, aG as _setWindowLocation, aH as _isMobileBrowser, aI as _isSafari, aJ as _isIOS, f as browserSessionPersistence, aK as _getRedirectResult, aL as _overrideRedirectResult, aM as AuthEventManager, aN as debugFail, aO as finalizeEnrollPhoneMfa, r as registerAuth, i as initializeAuth, c as indexedDBLocalPersistence, e as browserLocalPersistence, h as beforeAuthStateChanged, o as onIdTokenChanged, t as connectAuthEmulator } from './popup_redirect-
|
|
2
|
-
export { A as ActionCodeOperation, a3 as ActionCodeURL, v as AuthCredential, q as AuthErrorCodes,
|
|
1
|
+
import { af as _performApiRequest, ag as _addTidIfNecessary, ah as _createError, ai as _assert, aj as Delay, ak as _window, al as _isHttpOrHttps, am as _isWorker, an as _castAuth, J as signInWithCredential, K as linkWithCredential, ao as _assertLinkedStatus, L as reauthenticateWithCredential, ap as sendPhoneVerificationCode, aq as startEnrollPhoneMfa, ar as _link, x as PhoneAuthCredential, as as debugAssert, at as _generateEventId, au as AbstractPopupRedirectOperation, av as _assertInstanceOf, aw as _withDefaultResolver, ax as FederatedAuthProvider, ay as _fail, az as _getProjectConfig, aA as _getCurrentUrl, aB as _emulatorUrl, aC as _isChromeIOS, aD as _isFirefox, aE as _isIOSStandalone, aF as _getRedirectUrl, aG as _setWindowLocation, aH as _isMobileBrowser, aI as _isSafari, aJ as _isIOS, f as browserSessionPersistence, aK as _getRedirectResult, aL as _overrideRedirectResult, aM as AuthEventManager, aN as debugFail, aO as finalizeEnrollPhoneMfa, aP as finalizeEnrollTotpMfa, aQ as startEnrollTotpMfa, r as registerAuth, i as initializeAuth, c as indexedDBLocalPersistence, e as browserLocalPersistence, h as beforeAuthStateChanged, o as onIdTokenChanged, t as connectAuthEmulator } from './popup_redirect-69cff576.js';
|
|
2
|
+
export { A as ActionCodeOperation, a3 as ActionCodeURL, v as AuthCredential, q as AuthErrorCodes, aU as AuthImpl, E as EmailAuthCredential, z as EmailAuthProvider, B as FacebookAuthProvider, F as FactorId, aW as FetchProvider, C as GithubAuthProvider, G as GoogleAuthProvider, w as OAuthCredential, D as OAuthProvider, O as OperationType, x as PhoneAuthCredential, P as ProviderId, aX as SAMLAuthCredential, H as SAMLAuthProvider, S as SignInMethod, T as TwitterAuthProvider, aS as UserImpl, ai as _assert, an as _castAuth, ay as _fail, at as _generateEventId, aV as _getClientVersion, aT as _getInstance, aK as _getRedirectResult, aL as _overrideRedirectResult, aR as _persistenceKeyName, R as applyActionCode, h as beforeAuthStateChanged, e as browserLocalPersistence, f as browserSessionPersistence, U as checkActionCode, Q as confirmPasswordReset, t as connectAuthEmulator, d as cordovaPopupRedirectResolver, W as createUserWithEmailAndPassword, n as debugErrorMap, m as deleteUser, a0 as fetchSignInMethodsForEmail, ab as getAdditionalUserInfo, a8 as getIdToken, a9 as getIdTokenResult, ad as getMultiFactorResolver, g as getRedirectResult, y as inMemoryPersistence, c as indexedDBLocalPersistence, i as initializeAuth, Z as isSignInWithEmailLink, K as linkWithCredential, aZ as linkWithRedirect, ae as multiFactor, j as onAuthStateChanged, o as onIdTokenChanged, a4 as parseActionCodeURL, p as prodErrorMap, L as reauthenticateWithCredential, a_ as reauthenticateWithRedirect, ac as reload, a1 as sendEmailVerification, N as sendPasswordResetEmail, Y as sendSignInLinkToEmail, s as setPersistence, I as signInAnonymously, J as signInWithCredential, M as signInWithCustomToken, X as signInWithEmailAndPassword, $ as signInWithEmailLink, aY as signInWithRedirect, l as signOut, aa as unlink, k as updateCurrentUser, a6 as updateEmail, a7 as updatePassword, a5 as updateProfile, u as useDeviceLanguage, a2 as verifyBeforeUpdateEmail, V as verifyPasswordResetCode } from './popup_redirect-69cff576.js';
|
|
3
3
|
import { __awaiter, __generator, __assign, __extends, __spreadArray } from 'tslib';
|
|
4
4
|
import { querystring, getModularInstance, getUA, getExperimentalSetting, getDefaultEmulatorHost } from '@firebase/util';
|
|
5
5
|
import { SDK_VERSION, getApp, _getProvider } from '@firebase/app';
|
|
@@ -27,6 +27,9 @@ function startSignInPhoneMfa(auth, request) {
|
|
|
27
27
|
}
|
|
28
28
|
function finalizeSignInPhoneMfa(auth, request) {
|
|
29
29
|
return _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v2/accounts/mfaSignIn:finalize" /* Endpoint.FINALIZE_MFA_SIGN_IN */, _addTidIfNecessary(auth, request));
|
|
30
|
+
}
|
|
31
|
+
function finalizeSignInTotpMfa(auth, request) {
|
|
32
|
+
return _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v2/accounts/mfaSignIn:finalize" /* Endpoint.FINALIZE_MFA_SIGN_IN */, _addTidIfNecessary(auth, request));
|
|
30
33
|
}
|
|
31
34
|
|
|
32
35
|
/**
|
|
@@ -1852,6 +1855,179 @@ var PhoneMultiFactorGenerator = /** @class */ (function () {
|
|
|
1852
1855
|
return PhoneMultiFactorGenerator;
|
|
1853
1856
|
}());
|
|
1854
1857
|
|
|
1858
|
+
/**
|
|
1859
|
+
* Provider for generating a {@link TotpMultiFactorAssertion}.
|
|
1860
|
+
*
|
|
1861
|
+
* @public
|
|
1862
|
+
*/
|
|
1863
|
+
var TotpMultiFactorGenerator = /** @class */ (function () {
|
|
1864
|
+
function TotpMultiFactorGenerator() {
|
|
1865
|
+
}
|
|
1866
|
+
/**
|
|
1867
|
+
* Provides a {@link TotpMultiFactorAssertion} to confirm ownership of
|
|
1868
|
+
* the TOTP (time-based one-time password) second factor.
|
|
1869
|
+
* This assertion is used to complete enrollment in TOTP second factor.
|
|
1870
|
+
*
|
|
1871
|
+
* @param secret A {@link TotpSecret} containing the shared secret key and other TOTP parameters.
|
|
1872
|
+
* @param oneTimePassword One-time password from TOTP App.
|
|
1873
|
+
* @returns A {@link TotpMultiFactorAssertion} which can be used with
|
|
1874
|
+
* {@link MultiFactorUser.enroll}.
|
|
1875
|
+
*/
|
|
1876
|
+
TotpMultiFactorGenerator.assertionForEnrollment = function (secret, oneTimePassword) {
|
|
1877
|
+
return TotpMultiFactorAssertionImpl._fromSecret(secret, oneTimePassword);
|
|
1878
|
+
};
|
|
1879
|
+
/**
|
|
1880
|
+
* Provides a {@link TotpMultiFactorAssertion} to confirm ownership of the TOTP second factor.
|
|
1881
|
+
* This assertion is used to complete signIn with TOTP as the second factor.
|
|
1882
|
+
*
|
|
1883
|
+
* @param enrollmentId identifies the enrolled TOTP second factor.
|
|
1884
|
+
* @param oneTimePassword One-time password from TOTP App.
|
|
1885
|
+
* @returns A {@link TotpMultiFactorAssertion} which can be used with
|
|
1886
|
+
* {@link MultiFactorResolver.resolveSignIn}.
|
|
1887
|
+
*/
|
|
1888
|
+
TotpMultiFactorGenerator.assertionForSignIn = function (enrollmentId, oneTimePassword) {
|
|
1889
|
+
return TotpMultiFactorAssertionImpl._fromEnrollmentId(enrollmentId, oneTimePassword);
|
|
1890
|
+
};
|
|
1891
|
+
/**
|
|
1892
|
+
* Returns a promise to {@link TotpSecret} which contains the TOTP shared secret key and other parameters.
|
|
1893
|
+
* Creates a TOTP secret as part of enrolling a TOTP second factor.
|
|
1894
|
+
* Used for generating a QR code URL or inputting into a TOTP app.
|
|
1895
|
+
* This method uses the auth instance corresponding to the user in the multiFactorSession.
|
|
1896
|
+
*
|
|
1897
|
+
* @param session The {@link MultiFactorSession} that the user is part of.
|
|
1898
|
+
* @returns A promise to {@link TotpSecret}.
|
|
1899
|
+
*/
|
|
1900
|
+
TotpMultiFactorGenerator.generateSecret = function (session) {
|
|
1901
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1902
|
+
var mfaSession, response;
|
|
1903
|
+
return __generator(this, function (_a) {
|
|
1904
|
+
switch (_a.label) {
|
|
1905
|
+
case 0:
|
|
1906
|
+
mfaSession = session;
|
|
1907
|
+
_assert(typeof mfaSession.auth !== 'undefined', "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1908
|
+
return [4 /*yield*/, startEnrollTotpMfa(mfaSession.auth, {
|
|
1909
|
+
idToken: mfaSession.credential,
|
|
1910
|
+
totpEnrollmentInfo: {}
|
|
1911
|
+
})];
|
|
1912
|
+
case 1:
|
|
1913
|
+
response = _a.sent();
|
|
1914
|
+
return [2 /*return*/, TotpSecret._fromStartTotpMfaEnrollmentResponse(response, mfaSession.auth)];
|
|
1915
|
+
}
|
|
1916
|
+
});
|
|
1917
|
+
});
|
|
1918
|
+
};
|
|
1919
|
+
/**
|
|
1920
|
+
* The identifier of the TOTP second factor: `totp`.
|
|
1921
|
+
*/
|
|
1922
|
+
TotpMultiFactorGenerator.FACTOR_ID = "totp" /* FactorId.TOTP */;
|
|
1923
|
+
return TotpMultiFactorGenerator;
|
|
1924
|
+
}());
|
|
1925
|
+
var TotpMultiFactorAssertionImpl = /** @class */ (function (_super) {
|
|
1926
|
+
__extends(TotpMultiFactorAssertionImpl, _super);
|
|
1927
|
+
function TotpMultiFactorAssertionImpl(otp, enrollmentId, secret) {
|
|
1928
|
+
var _this = _super.call(this, "totp" /* FactorId.TOTP */) || this;
|
|
1929
|
+
_this.otp = otp;
|
|
1930
|
+
_this.enrollmentId = enrollmentId;
|
|
1931
|
+
_this.secret = secret;
|
|
1932
|
+
return _this;
|
|
1933
|
+
}
|
|
1934
|
+
/** @internal */
|
|
1935
|
+
TotpMultiFactorAssertionImpl._fromSecret = function (secret, otp) {
|
|
1936
|
+
return new TotpMultiFactorAssertionImpl(otp, undefined, secret);
|
|
1937
|
+
};
|
|
1938
|
+
/** @internal */
|
|
1939
|
+
TotpMultiFactorAssertionImpl._fromEnrollmentId = function (enrollmentId, otp) {
|
|
1940
|
+
return new TotpMultiFactorAssertionImpl(otp, enrollmentId);
|
|
1941
|
+
};
|
|
1942
|
+
/** @internal */
|
|
1943
|
+
TotpMultiFactorAssertionImpl.prototype._finalizeEnroll = function (auth, idToken, displayName) {
|
|
1944
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1945
|
+
return __generator(this, function (_a) {
|
|
1946
|
+
_assert(typeof this.secret !== 'undefined', auth, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
1947
|
+
return [2 /*return*/, finalizeEnrollTotpMfa(auth, {
|
|
1948
|
+
idToken: idToken,
|
|
1949
|
+
displayName: displayName,
|
|
1950
|
+
totpVerificationInfo: this.secret._makeTotpVerificationInfo(this.otp)
|
|
1951
|
+
})];
|
|
1952
|
+
});
|
|
1953
|
+
});
|
|
1954
|
+
};
|
|
1955
|
+
/** @internal */
|
|
1956
|
+
TotpMultiFactorAssertionImpl.prototype._finalizeSignIn = function (auth, mfaPendingCredential) {
|
|
1957
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1958
|
+
var totpVerificationInfo;
|
|
1959
|
+
return __generator(this, function (_a) {
|
|
1960
|
+
_assert(this.enrollmentId !== undefined && this.otp !== undefined, auth, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
1961
|
+
totpVerificationInfo = { verificationCode: this.otp };
|
|
1962
|
+
return [2 /*return*/, finalizeSignInTotpMfa(auth, {
|
|
1963
|
+
mfaPendingCredential: mfaPendingCredential,
|
|
1964
|
+
mfaEnrollmentId: this.enrollmentId,
|
|
1965
|
+
totpVerificationInfo: totpVerificationInfo
|
|
1966
|
+
})];
|
|
1967
|
+
});
|
|
1968
|
+
});
|
|
1969
|
+
};
|
|
1970
|
+
return TotpMultiFactorAssertionImpl;
|
|
1971
|
+
}(MultiFactorAssertionImpl));
|
|
1972
|
+
/**
|
|
1973
|
+
* Provider for generating a {@link TotpMultiFactorAssertion}.
|
|
1974
|
+
*
|
|
1975
|
+
* Stores the shared secret key and other parameters to generate time-based OTPs.
|
|
1976
|
+
* Implements methods to retrieve the shared secret key and generate a QR code URL.
|
|
1977
|
+
* @public
|
|
1978
|
+
*/
|
|
1979
|
+
var TotpSecret = /** @class */ (function () {
|
|
1980
|
+
// The public members are declared outside the constructor so the docs can be generated.
|
|
1981
|
+
function TotpSecret(secretKey, hashingAlgorithm, codeLength, codeIntervalSeconds, enrollmentCompletionDeadline, sessionInfo, auth) {
|
|
1982
|
+
this.sessionInfo = sessionInfo;
|
|
1983
|
+
this.auth = auth;
|
|
1984
|
+
this.secretKey = secretKey;
|
|
1985
|
+
this.hashingAlgorithm = hashingAlgorithm;
|
|
1986
|
+
this.codeLength = codeLength;
|
|
1987
|
+
this.codeIntervalSeconds = codeIntervalSeconds;
|
|
1988
|
+
this.enrollmentCompletionDeadline = enrollmentCompletionDeadline;
|
|
1989
|
+
}
|
|
1990
|
+
/** @internal */
|
|
1991
|
+
TotpSecret._fromStartTotpMfaEnrollmentResponse = function (response, auth) {
|
|
1992
|
+
return new TotpSecret(response.totpSessionInfo.sharedSecretKey, response.totpSessionInfo.hashingAlgorithm, response.totpSessionInfo.verificationCodeLength, response.totpSessionInfo.periodSec, new Date(response.totpSessionInfo.finalizeEnrollmentTime).toUTCString(), response.totpSessionInfo.sessionInfo, auth);
|
|
1993
|
+
};
|
|
1994
|
+
/** @internal */
|
|
1995
|
+
TotpSecret.prototype._makeTotpVerificationInfo = function (otp) {
|
|
1996
|
+
return { sessionInfo: this.sessionInfo, verificationCode: otp };
|
|
1997
|
+
};
|
|
1998
|
+
/**
|
|
1999
|
+
* Returns a QR code URL as described in
|
|
2000
|
+
* https://github.com/google/google-authenticator/wiki/Key-Uri-Format
|
|
2001
|
+
* This can be displayed to the user as a QR code to be scanned into a TOTP app like Google Authenticator.
|
|
2002
|
+
* If the optional parameters are unspecified, an accountName of <userEmail> and issuer of <firebaseAppName> are used.
|
|
2003
|
+
*
|
|
2004
|
+
* @param accountName the name of the account/app along with a user identifier.
|
|
2005
|
+
* @param issuer issuer of the TOTP (likely the app name).
|
|
2006
|
+
* @returns A QR code URL string.
|
|
2007
|
+
*/
|
|
2008
|
+
TotpSecret.prototype.generateQrCodeUrl = function (accountName, issuer) {
|
|
2009
|
+
var _a;
|
|
2010
|
+
var useDefaults = false;
|
|
2011
|
+
if (_isEmptyString(accountName) || _isEmptyString(issuer)) {
|
|
2012
|
+
useDefaults = true;
|
|
2013
|
+
}
|
|
2014
|
+
if (useDefaults) {
|
|
2015
|
+
if (_isEmptyString(accountName)) {
|
|
2016
|
+
accountName = ((_a = this.auth.currentUser) === null || _a === void 0 ? void 0 : _a.email) || 'unknownuser';
|
|
2017
|
+
}
|
|
2018
|
+
if (_isEmptyString(issuer)) {
|
|
2019
|
+
issuer = this.auth.name;
|
|
2020
|
+
}
|
|
2021
|
+
}
|
|
2022
|
+
return "otpauth://totp/".concat(issuer, ":").concat(accountName, "?secret=").concat(this.secretKey, "&issuer=").concat(issuer, "&algorithm=").concat(this.hashingAlgorithm, "&digits=").concat(this.codeLength);
|
|
2023
|
+
};
|
|
2024
|
+
return TotpSecret;
|
|
2025
|
+
}());
|
|
2026
|
+
/** @internal */
|
|
2027
|
+
function _isEmptyString(input) {
|
|
2028
|
+
return typeof input === 'undefined' || (input === null || input === void 0 ? void 0 : input.length) === 0;
|
|
2029
|
+
}
|
|
2030
|
+
|
|
1855
2031
|
/**
|
|
1856
2032
|
* @license
|
|
1857
2033
|
* Copyright 2021 Google LLC
|
|
@@ -1969,5 +2145,5 @@ function addFrameworkForLogging(auth, framework) {
|
|
|
1969
2145
|
_castAuth(auth)._logFramework(framework);
|
|
1970
2146
|
}
|
|
1971
2147
|
|
|
1972
|
-
export { AuthPopup, PhoneAuthProvider, PhoneMultiFactorGenerator, RecaptchaVerifier, addFrameworkForLogging, browserPopupRedirectResolver, getAuth, linkWithPhoneNumber, linkWithPopup, reauthenticateWithPhoneNumber, reauthenticateWithPopup, signInWithPhoneNumber, signInWithPopup, updatePhoneNumber };
|
|
2148
|
+
export { AuthPopup, PhoneAuthProvider, PhoneMultiFactorGenerator, RecaptchaVerifier, TotpMultiFactorGenerator, TotpSecret, addFrameworkForLogging, browserPopupRedirectResolver, getAuth, linkWithPhoneNumber, linkWithPopup, reauthenticateWithPhoneNumber, reauthenticateWithPopup, signInWithPhoneNumber, signInWithPopup, updatePhoneNumber };
|
|
1973
2149
|
//# sourceMappingURL=internal.js.map
|