@firebase/auth 1.3.1 → 1.3.2-20231027003707
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/dist/browser-cjs/{index-eb1e5841.js → index-8c5a52a3.js} +2 -2
- package/dist/browser-cjs/{index-eb1e5841.js.map → index-8c5a52a3.js.map} +1 -1
- package/dist/browser-cjs/index.js +1 -1
- package/dist/browser-cjs/index.rn.d.ts +1 -0
- package/dist/browser-cjs/internal.js +1 -1
- package/dist/cordova/index.js +2 -2
- package/dist/cordova/index.rn.d.ts +1 -0
- package/dist/cordova/internal.js +2 -2
- package/dist/cordova/{popup_redirect-813a1061.js → popup_redirect-ee25418c.js} +2 -2
- package/dist/cordova/{popup_redirect-813a1061.js.map → popup_redirect-ee25418c.js.map} +1 -1
- package/dist/esm2017/{index-ff60bc4f.js → index-5734e72a.js} +2 -2
- package/dist/esm2017/{index-ff60bc4f.js.map → index-5734e72a.js.map} +1 -1
- package/dist/esm2017/index.js +1 -1
- package/dist/esm2017/index.rn.d.ts +1 -0
- package/dist/esm2017/internal.js +2 -2
- package/dist/esm5/{index-41b32683.js → index-3b219637.js} +2 -2
- package/dist/esm5/{index-41b32683.js.map → index-3b219637.js.map} +1 -1
- package/dist/esm5/index.js +1 -1
- package/dist/esm5/index.rn.d.ts +1 -0
- package/dist/esm5/internal.js +2 -2
- package/dist/index.rn.d.ts +1 -0
- package/dist/index.webworker.esm5.js +1 -1
- package/dist/node/index.js +1 -1
- package/dist/node/index.rn.d.ts +1 -0
- package/dist/node/internal.js +1 -1
- package/dist/node/{totp-3322e904.js → totp-7121ebf6.js} +2 -2
- package/dist/node/{totp-3322e904.js.map → totp-7121ebf6.js.map} +1 -1
- package/dist/node-esm/index.js +1 -1
- package/dist/node-esm/index.rn.d.ts +1 -0
- package/dist/node-esm/internal.js +2 -2
- package/dist/node-esm/{totp-36756419.js → totp-c8e91f71.js} +2 -2
- package/dist/node-esm/{totp-36756419.js.map → totp-c8e91f71.js.map} +1 -1
- package/dist/rn/{index-97e8af35.js → index-5c316700.js} +178 -6
- package/dist/rn/index-5c316700.js.map +1 -0
- package/dist/rn/index.js +3 -1
- package/dist/rn/index.js.map +1 -1
- package/dist/rn/index.rn.d.ts +1 -0
- package/dist/rn/internal.js +3 -177
- package/dist/rn/internal.js.map +1 -1
- package/package.json +1 -1
- package/dist/rn/index-97e8af35.js.map +0 -1
package/dist/rn/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var app = require('@firebase/app');
|
|
6
|
-
var index = require('./index-
|
|
6
|
+
var index = require('./index-5c316700.js');
|
|
7
7
|
var tslib = require('tslib');
|
|
8
8
|
require('@firebase/util');
|
|
9
9
|
require('@firebase/component');
|
|
@@ -163,6 +163,8 @@ exports.PhoneMultiFactorGenerator = index.PhoneMultiFactorGenerator;
|
|
|
163
163
|
exports.ProviderId = index.ProviderId;
|
|
164
164
|
exports.SAMLAuthProvider = index.SAMLAuthProvider;
|
|
165
165
|
exports.SignInMethod = index.SignInMethod;
|
|
166
|
+
exports.TotpMultiFactorGenerator = index.TotpMultiFactorGenerator;
|
|
167
|
+
exports.TotpSecret = index.TotpSecret;
|
|
166
168
|
exports.TwitterAuthProvider = index.TwitterAuthProvider;
|
|
167
169
|
exports.applyActionCode = index.applyActionCode;
|
|
168
170
|
exports.beforeAuthStateChanged = index.beforeAuthStateChanged;
|
package/dist/rn/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/platform_react_native/persistence/react_native.ts","../../index.rn.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2019 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Persistence, ReactNativeAsyncStorage } from '../../model/public_types';\n\nimport {\n PersistenceInternal,\n PersistenceType,\n PersistenceValue,\n STORAGE_AVAILABLE_KEY,\n StorageEventListener\n} from '../../core/persistence';\n\n/**\n * Returns a persistence object that wraps `AsyncStorage` imported from\n * `react-native` or `@react-native-community/async-storage`, and can\n * be used in the persistence dependency field in {@link initializeAuth}.\n *\n * @public\n */\nexport function getReactNativePersistence(\n storage: ReactNativeAsyncStorage\n): Persistence {\n // In the _getInstance() implementation (see src/core/persistence/index.ts),\n // we expect each \"externs.Persistence\" object passed to us by the user to\n // be able to be instantiated (as a class) using \"new\". That function also\n // expects the constructor to be empty. Since ReactNativeStorage requires the\n // underlying storage layer, we need to be able to create subclasses\n // (closures, esentially) that have the storage layer but empty constructor.\n return class implements PersistenceInternal {\n static type: 'LOCAL' = 'LOCAL';\n readonly type: PersistenceType = PersistenceType.LOCAL;\n\n async _isAvailable(): Promise<boolean> {\n try {\n if (!storage) {\n return false;\n }\n await storage.setItem(STORAGE_AVAILABLE_KEY, '1');\n await storage.removeItem(STORAGE_AVAILABLE_KEY);\n return true;\n } catch {\n return false;\n }\n }\n\n _set(key: string, value: PersistenceValue): Promise<void> {\n return storage.setItem(key, JSON.stringify(value));\n }\n\n async _get<T extends PersistenceValue>(key: string): Promise<T | null> {\n const json = await storage.getItem(key);\n return json ? JSON.parse(json) : null;\n }\n\n _remove(key: string): Promise<void> {\n return storage.removeItem(key);\n }\n\n _addListener(_key: string, _listener: StorageEventListener): void {\n // Listeners are not supported for React Native storage.\n return;\n }\n\n _removeListener(_key: string, _listener: StorageEventListener): void {\n // Listeners are not supported for React Native storage.\n return;\n }\n };\n}\n","/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * This is the file that people using React Native will actually import. You\n * should only include this file if you have something specific about your\n * implementation that mandates having a separate entrypoint. Otherwise you can\n * just use index.ts\n */\n\nimport { FirebaseApp, getApp, _getProvider } from '@firebase/app';\nimport { Auth, Dependencies } from './src/model/public_types';\n\nimport { initializeAuth as initializeAuthOriginal } from './src';\nimport { registerAuth } from './src/core/auth/register';\nimport { ClientPlatform } from './src/core/util/version';\nimport { _logWarn } from './src/core/util/log';\n\n// Core functionality shared by all clients\nexport * from './index.shared';\n\n// Export some Phone symbols\n// providers\nexport { PhoneAuthProvider } from './src/platform_browser/providers/phone';\n\n// strategies\nexport {\n signInWithPhoneNumber,\n linkWithPhoneNumber,\n reauthenticateWithPhoneNumber,\n updatePhoneNumber\n} from './src/platform_browser/strategies/phone';\n\n// MFA\nexport { PhoneMultiFactorGenerator } from './src/platform_browser/mfa/assertions/phone';\n\nexport { getReactNativePersistence } from './src/platform_react_native/persistence/react_native';\n\nconst NO_PERSISTENCE_WARNING = `\nYou are initializing Firebase Auth for React Native without providing\nAsyncStorage. Auth state will default to memory persistence and will not\npersist between sessions. In order to persist auth state, install the package\n\"@react-native-async-storage/async-storage\" and provide it to\ninitializeAuth:\n\nimport { initializeAuth, getReactNativePersistence } from 'firebase/auth';\nimport ReactNativeAsyncStorage from '@react-native-async-storage/async-storage';\nconst auth = initializeAuth(app, {\n persistence: getReactNativePersistence(ReactNativeAsyncStorage)\n});\n`;\n\nexport function getAuth(app: FirebaseApp = getApp()): Auth {\n const provider = _getProvider(app, 'auth');\n\n if (provider.isInitialized()) {\n return provider.getImmediate();\n }\n\n // Only warn if getAuth() is called before initializeAuth()\n _logWarn(NO_PERSISTENCE_WARNING);\n\n return initializeAuthOriginal(app);\n}\n\n/**\n * Wrapper around base `initializeAuth()` for RN users only, which\n * shows the warning message if no persistence is provided.\n * Double-checked potential collision with `export * from './index.shared'`\n * as `./index.shared` also exports `initializeAuth()`, and the final\n * bundle does correctly export only this `initializeAuth()` function\n * and not the one from index.shared.\n */\nexport function initializeAuth(app: FirebaseApp, deps?: Dependencies): Auth {\n if (!deps?.persistence) {\n _logWarn(NO_PERSISTENCE_WARNING);\n }\n return initializeAuthOriginal(app, deps);\n}\n\nregisterAuth(ClientPlatform.REACT_NATIVE);\n"],"names":["STORAGE_AVAILABLE_KEY","app","getApp","_getProvider","_logWarn","initializeAuthOriginal","registerAuth"],"mappings":";;;;;;;;;;;AAAA;;;;;;;;;;;;;;;AAeG;AAYH;;;;;;AAMG;AACG,SAAU,yBAAyB,CACvC,OAAgC,EAAA;;;;;;;;AAQhC,IAAA,OAAA,EAAA,kBAAA,YAAA;AAAO,YAAA,SAAA,OAAA,GAAA;AAEI,gBAAA,IAAA,CAAA,IAAI,GAA0C,OAAA,6BAAA;aAqCxD;AAnCO,YAAA,OAAA,CAAA,SAAA,CAAA,YAAY,GAAlB,YAAA;;;;;;gCAEI,IAAI,CAAC,OAAO,EAAE;AACZ,oCAAA,OAAA,CAAA,CAAA,aAAO,KAAK,CAAC,CAAA;AACd,iCAAA;gCACD,OAAM,CAAA,CAAA,YAAA,OAAO,CAAC,OAAO,CAACA,2BAAqB,EAAE,GAAG,CAAC,CAAA,CAAA;;AAAjD,gCAAA,EAAA,CAAA,IAAA,EAAiD,CAAC;AAClD,gCAAA,OAAA,CAAA,CAAA,YAAM,OAAO,CAAC,UAAU,CAACA,2BAAqB,CAAC,CAAA,CAAA;;AAA/C,gCAAA,EAAA,CAAA,IAAA,EAA+C,CAAC;AAChD,gCAAA,OAAA,CAAA,CAAA,aAAO,IAAI,CAAC,CAAA;;;AAEZ,gCAAA,OAAA,CAAA,CAAA,aAAO,KAAK,CAAC,CAAA;;;;;AAEhB,aAAA,CAAA;AAED,YAAA,OAAA,CAAA,SAAA,CAAA,IAAI,GAAJ,UAAK,GAAW,EAAE,KAAuB,EAAA;AACvC,gBAAA,OAAO,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;aACpD,CAAA;YAEK,OAAI,CAAA,SAAA,CAAA,IAAA,GAAV,UAAuC,GAAW,EAAA;;;;;AACnC,4BAAA,KAAA,CAAA,EAAA,OAAA,CAAA,CAAA,YAAM,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA,CAAA;;AAAjC,gCAAA,IAAI,GAAG,EAA0B,CAAA,IAAA,EAAA,CAAA;AACvC,gCAAA,OAAA,CAAA,CAAA,aAAO,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAA;;;;AACvC,aAAA,CAAA;YAED,OAAO,CAAA,SAAA,CAAA,OAAA,GAAP,UAAQ,GAAW,EAAA;AACjB,gBAAA,OAAO,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;aAChC,CAAA;AAED,YAAA,OAAA,CAAA,SAAA,CAAA,YAAY,GAAZ,UAAa,IAAY,EAAE,SAA+B,EAAA;;gBAExD,OAAO;aACR,CAAA;AAED,YAAA,OAAA,CAAA,SAAA,CAAA,eAAe,GAAf,UAAgB,IAAY,EAAE,SAA+B,EAAA;;gBAE3D,OAAO;aACR,CAAA;YACH,OAAC,OAAA,CAAA;AAAD,SAAC,EAvCM,CAAA;AACE,QAAA,EAAA,CAAA,IAAI,GAAY,OAAQ;AAsC/B,QAAA,EAAA,CAAA;AACJ;;ACnFA;;;;;;;;;;;;;;;AAeG;
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/platform_react_native/persistence/react_native.ts","../../index.rn.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2019 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Persistence, ReactNativeAsyncStorage } from '../../model/public_types';\n\nimport {\n PersistenceInternal,\n PersistenceType,\n PersistenceValue,\n STORAGE_AVAILABLE_KEY,\n StorageEventListener\n} from '../../core/persistence';\n\n/**\n * Returns a persistence object that wraps `AsyncStorage` imported from\n * `react-native` or `@react-native-community/async-storage`, and can\n * be used in the persistence dependency field in {@link initializeAuth}.\n *\n * @public\n */\nexport function getReactNativePersistence(\n storage: ReactNativeAsyncStorage\n): Persistence {\n // In the _getInstance() implementation (see src/core/persistence/index.ts),\n // we expect each \"externs.Persistence\" object passed to us by the user to\n // be able to be instantiated (as a class) using \"new\". That function also\n // expects the constructor to be empty. Since ReactNativeStorage requires the\n // underlying storage layer, we need to be able to create subclasses\n // (closures, esentially) that have the storage layer but empty constructor.\n return class implements PersistenceInternal {\n static type: 'LOCAL' = 'LOCAL';\n readonly type: PersistenceType = PersistenceType.LOCAL;\n\n async _isAvailable(): Promise<boolean> {\n try {\n if (!storage) {\n return false;\n }\n await storage.setItem(STORAGE_AVAILABLE_KEY, '1');\n await storage.removeItem(STORAGE_AVAILABLE_KEY);\n return true;\n } catch {\n return false;\n }\n }\n\n _set(key: string, value: PersistenceValue): Promise<void> {\n return storage.setItem(key, JSON.stringify(value));\n }\n\n async _get<T extends PersistenceValue>(key: string): Promise<T | null> {\n const json = await storage.getItem(key);\n return json ? JSON.parse(json) : null;\n }\n\n _remove(key: string): Promise<void> {\n return storage.removeItem(key);\n }\n\n _addListener(_key: string, _listener: StorageEventListener): void {\n // Listeners are not supported for React Native storage.\n return;\n }\n\n _removeListener(_key: string, _listener: StorageEventListener): void {\n // Listeners are not supported for React Native storage.\n return;\n }\n };\n}\n","/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * This is the file that people using React Native will actually import. You\n * should only include this file if you have something specific about your\n * implementation that mandates having a separate entrypoint. Otherwise you can\n * just use index.ts\n */\n\nimport { FirebaseApp, getApp, _getProvider } from '@firebase/app';\nimport { Auth, Dependencies } from './src/model/public_types';\n\nimport { initializeAuth as initializeAuthOriginal } from './src';\nimport { registerAuth } from './src/core/auth/register';\nimport { ClientPlatform } from './src/core/util/version';\nimport { _logWarn } from './src/core/util/log';\n\n// Core functionality shared by all clients\nexport * from './index.shared';\n\n// Export some Phone symbols\n// providers\nexport { PhoneAuthProvider } from './src/platform_browser/providers/phone';\n\n// strategies\nexport {\n signInWithPhoneNumber,\n linkWithPhoneNumber,\n reauthenticateWithPhoneNumber,\n updatePhoneNumber\n} from './src/platform_browser/strategies/phone';\n\n// MFA\nexport { PhoneMultiFactorGenerator } from './src/platform_browser/mfa/assertions/phone';\nexport {\n TotpMultiFactorGenerator,\n TotpSecret\n} from './src/mfa/assertions/totp';\n\nexport { getReactNativePersistence } from './src/platform_react_native/persistence/react_native';\n\nconst NO_PERSISTENCE_WARNING = `\nYou are initializing Firebase Auth for React Native without providing\nAsyncStorage. Auth state will default to memory persistence and will not\npersist between sessions. In order to persist auth state, install the package\n\"@react-native-async-storage/async-storage\" and provide it to\ninitializeAuth:\n\nimport { initializeAuth, getReactNativePersistence } from 'firebase/auth';\nimport ReactNativeAsyncStorage from '@react-native-async-storage/async-storage';\nconst auth = initializeAuth(app, {\n persistence: getReactNativePersistence(ReactNativeAsyncStorage)\n});\n`;\n\nexport function getAuth(app: FirebaseApp = getApp()): Auth {\n const provider = _getProvider(app, 'auth');\n\n if (provider.isInitialized()) {\n return provider.getImmediate();\n }\n\n // Only warn if getAuth() is called before initializeAuth()\n _logWarn(NO_PERSISTENCE_WARNING);\n\n return initializeAuthOriginal(app);\n}\n\n/**\n * Wrapper around base `initializeAuth()` for RN users only, which\n * shows the warning message if no persistence is provided.\n * Double-checked potential collision with `export * from './index.shared'`\n * as `./index.shared` also exports `initializeAuth()`, and the final\n * bundle does correctly export only this `initializeAuth()` function\n * and not the one from index.shared.\n */\nexport function initializeAuth(app: FirebaseApp, deps?: Dependencies): Auth {\n if (!deps?.persistence) {\n _logWarn(NO_PERSISTENCE_WARNING);\n }\n return initializeAuthOriginal(app, deps);\n}\n\nregisterAuth(ClientPlatform.REACT_NATIVE);\n"],"names":["STORAGE_AVAILABLE_KEY","app","getApp","_getProvider","_logWarn","initializeAuthOriginal","registerAuth"],"mappings":"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"}
|
package/dist/rn/index.rn.d.ts
CHANGED
|
@@ -26,6 +26,7 @@ export * from './index.shared';
|
|
|
26
26
|
export { PhoneAuthProvider } from './src/platform_browser/providers/phone';
|
|
27
27
|
export { signInWithPhoneNumber, linkWithPhoneNumber, reauthenticateWithPhoneNumber, updatePhoneNumber } from './src/platform_browser/strategies/phone';
|
|
28
28
|
export { PhoneMultiFactorGenerator } from './src/platform_browser/mfa/assertions/phone';
|
|
29
|
+
export { TotpMultiFactorGenerator, TotpSecret } from './src/mfa/assertions/totp';
|
|
29
30
|
export { getReactNativePersistence } from './src/platform_react_native/persistence/react_native';
|
|
30
31
|
export declare function getAuth(app?: FirebaseApp): Auth;
|
|
31
32
|
/**
|
package/dist/rn/internal.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var index = require('./index-
|
|
5
|
+
var index = require('./index-5c316700.js');
|
|
6
6
|
var tslib = require('tslib');
|
|
7
7
|
var util = require('@firebase/util');
|
|
8
8
|
var app = require('@firebase/app');
|
|
@@ -2929,180 +2929,6 @@ var BrowserPopupRedirectResolver = /** @class */ (function () {
|
|
|
2929
2929
|
*/
|
|
2930
2930
|
var browserPopupRedirectResolver = BrowserPopupRedirectResolver;
|
|
2931
2931
|
|
|
2932
|
-
/**
|
|
2933
|
-
* Provider for generating a {@link TotpMultiFactorAssertion}.
|
|
2934
|
-
*
|
|
2935
|
-
* @public
|
|
2936
|
-
*/
|
|
2937
|
-
var TotpMultiFactorGenerator = /** @class */ (function () {
|
|
2938
|
-
function TotpMultiFactorGenerator() {
|
|
2939
|
-
}
|
|
2940
|
-
/**
|
|
2941
|
-
* Provides a {@link TotpMultiFactorAssertion} to confirm ownership of
|
|
2942
|
-
* the TOTP (time-based one-time password) second factor.
|
|
2943
|
-
* This assertion is used to complete enrollment in TOTP second factor.
|
|
2944
|
-
*
|
|
2945
|
-
* @param secret A {@link TotpSecret} containing the shared secret key and other TOTP parameters.
|
|
2946
|
-
* @param oneTimePassword One-time password from TOTP App.
|
|
2947
|
-
* @returns A {@link TotpMultiFactorAssertion} which can be used with
|
|
2948
|
-
* {@link MultiFactorUser.enroll}.
|
|
2949
|
-
*/
|
|
2950
|
-
TotpMultiFactorGenerator.assertionForEnrollment = function (secret, oneTimePassword) {
|
|
2951
|
-
return TotpMultiFactorAssertionImpl._fromSecret(secret, oneTimePassword);
|
|
2952
|
-
};
|
|
2953
|
-
/**
|
|
2954
|
-
* Provides a {@link TotpMultiFactorAssertion} to confirm ownership of the TOTP second factor.
|
|
2955
|
-
* This assertion is used to complete signIn with TOTP as the second factor.
|
|
2956
|
-
*
|
|
2957
|
-
* @param enrollmentId identifies the enrolled TOTP second factor.
|
|
2958
|
-
* @param oneTimePassword One-time password from TOTP App.
|
|
2959
|
-
* @returns A {@link TotpMultiFactorAssertion} which can be used with
|
|
2960
|
-
* {@link MultiFactorResolver.resolveSignIn}.
|
|
2961
|
-
*/
|
|
2962
|
-
TotpMultiFactorGenerator.assertionForSignIn = function (enrollmentId, oneTimePassword) {
|
|
2963
|
-
return TotpMultiFactorAssertionImpl._fromEnrollmentId(enrollmentId, oneTimePassword);
|
|
2964
|
-
};
|
|
2965
|
-
/**
|
|
2966
|
-
* Returns a promise to {@link TotpSecret} which contains the TOTP shared secret key and other parameters.
|
|
2967
|
-
* Creates a TOTP secret as part of enrolling a TOTP second factor.
|
|
2968
|
-
* Used for generating a QR code URL or inputting into a TOTP app.
|
|
2969
|
-
* This method uses the auth instance corresponding to the user in the multiFactorSession.
|
|
2970
|
-
*
|
|
2971
|
-
* @param session The {@link MultiFactorSession} that the user is part of.
|
|
2972
|
-
* @returns A promise to {@link TotpSecret}.
|
|
2973
|
-
*/
|
|
2974
|
-
TotpMultiFactorGenerator.generateSecret = function (session) {
|
|
2975
|
-
var _a;
|
|
2976
|
-
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
2977
|
-
var mfaSession, response;
|
|
2978
|
-
return tslib.__generator(this, function (_b) {
|
|
2979
|
-
switch (_b.label) {
|
|
2980
|
-
case 0:
|
|
2981
|
-
mfaSession = session;
|
|
2982
|
-
index._assert(typeof ((_a = mfaSession.user) === null || _a === void 0 ? void 0 : _a.auth) !== 'undefined', "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
2983
|
-
return [4 /*yield*/, index.startEnrollTotpMfa(mfaSession.user.auth, {
|
|
2984
|
-
idToken: mfaSession.credential,
|
|
2985
|
-
totpEnrollmentInfo: {}
|
|
2986
|
-
})];
|
|
2987
|
-
case 1:
|
|
2988
|
-
response = _b.sent();
|
|
2989
|
-
return [2 /*return*/, TotpSecret._fromStartTotpMfaEnrollmentResponse(response, mfaSession.user.auth)];
|
|
2990
|
-
}
|
|
2991
|
-
});
|
|
2992
|
-
});
|
|
2993
|
-
};
|
|
2994
|
-
/**
|
|
2995
|
-
* The identifier of the TOTP second factor: `totp`.
|
|
2996
|
-
*/
|
|
2997
|
-
TotpMultiFactorGenerator.FACTOR_ID = "totp" /* FactorId.TOTP */;
|
|
2998
|
-
return TotpMultiFactorGenerator;
|
|
2999
|
-
}());
|
|
3000
|
-
var TotpMultiFactorAssertionImpl = /** @class */ (function (_super) {
|
|
3001
|
-
tslib.__extends(TotpMultiFactorAssertionImpl, _super);
|
|
3002
|
-
function TotpMultiFactorAssertionImpl(otp, enrollmentId, secret) {
|
|
3003
|
-
var _this = _super.call(this, "totp" /* FactorId.TOTP */) || this;
|
|
3004
|
-
_this.otp = otp;
|
|
3005
|
-
_this.enrollmentId = enrollmentId;
|
|
3006
|
-
_this.secret = secret;
|
|
3007
|
-
return _this;
|
|
3008
|
-
}
|
|
3009
|
-
/** @internal */
|
|
3010
|
-
TotpMultiFactorAssertionImpl._fromSecret = function (secret, otp) {
|
|
3011
|
-
return new TotpMultiFactorAssertionImpl(otp, undefined, secret);
|
|
3012
|
-
};
|
|
3013
|
-
/** @internal */
|
|
3014
|
-
TotpMultiFactorAssertionImpl._fromEnrollmentId = function (enrollmentId, otp) {
|
|
3015
|
-
return new TotpMultiFactorAssertionImpl(otp, enrollmentId);
|
|
3016
|
-
};
|
|
3017
|
-
/** @internal */
|
|
3018
|
-
TotpMultiFactorAssertionImpl.prototype._finalizeEnroll = function (auth, idToken, displayName) {
|
|
3019
|
-
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
3020
|
-
return tslib.__generator(this, function (_a) {
|
|
3021
|
-
index._assert(typeof this.secret !== 'undefined', auth, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
3022
|
-
return [2 /*return*/, index.finalizeEnrollTotpMfa(auth, {
|
|
3023
|
-
idToken: idToken,
|
|
3024
|
-
displayName: displayName,
|
|
3025
|
-
totpVerificationInfo: this.secret._makeTotpVerificationInfo(this.otp)
|
|
3026
|
-
})];
|
|
3027
|
-
});
|
|
3028
|
-
});
|
|
3029
|
-
};
|
|
3030
|
-
/** @internal */
|
|
3031
|
-
TotpMultiFactorAssertionImpl.prototype._finalizeSignIn = function (auth, mfaPendingCredential) {
|
|
3032
|
-
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
3033
|
-
var totpVerificationInfo;
|
|
3034
|
-
return tslib.__generator(this, function (_a) {
|
|
3035
|
-
index._assert(this.enrollmentId !== undefined && this.otp !== undefined, auth, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
3036
|
-
totpVerificationInfo = { verificationCode: this.otp };
|
|
3037
|
-
return [2 /*return*/, index.finalizeSignInTotpMfa(auth, {
|
|
3038
|
-
mfaPendingCredential: mfaPendingCredential,
|
|
3039
|
-
mfaEnrollmentId: this.enrollmentId,
|
|
3040
|
-
totpVerificationInfo: totpVerificationInfo
|
|
3041
|
-
})];
|
|
3042
|
-
});
|
|
3043
|
-
});
|
|
3044
|
-
};
|
|
3045
|
-
return TotpMultiFactorAssertionImpl;
|
|
3046
|
-
}(index.MultiFactorAssertionImpl));
|
|
3047
|
-
/**
|
|
3048
|
-
* Provider for generating a {@link TotpMultiFactorAssertion}.
|
|
3049
|
-
*
|
|
3050
|
-
* Stores the shared secret key and other parameters to generate time-based OTPs.
|
|
3051
|
-
* Implements methods to retrieve the shared secret key and generate a QR code URL.
|
|
3052
|
-
* @public
|
|
3053
|
-
*/
|
|
3054
|
-
var TotpSecret = /** @class */ (function () {
|
|
3055
|
-
// The public members are declared outside the constructor so the docs can be generated.
|
|
3056
|
-
function TotpSecret(secretKey, hashingAlgorithm, codeLength, codeIntervalSeconds, enrollmentCompletionDeadline, sessionInfo, auth) {
|
|
3057
|
-
this.sessionInfo = sessionInfo;
|
|
3058
|
-
this.auth = auth;
|
|
3059
|
-
this.secretKey = secretKey;
|
|
3060
|
-
this.hashingAlgorithm = hashingAlgorithm;
|
|
3061
|
-
this.codeLength = codeLength;
|
|
3062
|
-
this.codeIntervalSeconds = codeIntervalSeconds;
|
|
3063
|
-
this.enrollmentCompletionDeadline = enrollmentCompletionDeadline;
|
|
3064
|
-
}
|
|
3065
|
-
/** @internal */
|
|
3066
|
-
TotpSecret._fromStartTotpMfaEnrollmentResponse = function (response, auth) {
|
|
3067
|
-
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);
|
|
3068
|
-
};
|
|
3069
|
-
/** @internal */
|
|
3070
|
-
TotpSecret.prototype._makeTotpVerificationInfo = function (otp) {
|
|
3071
|
-
return { sessionInfo: this.sessionInfo, verificationCode: otp };
|
|
3072
|
-
};
|
|
3073
|
-
/**
|
|
3074
|
-
* Returns a QR code URL as described in
|
|
3075
|
-
* https://github.com/google/google-authenticator/wiki/Key-Uri-Format
|
|
3076
|
-
* This can be displayed to the user as a QR code to be scanned into a TOTP app like Google Authenticator.
|
|
3077
|
-
* If the optional parameters are unspecified, an accountName of <userEmail> and issuer of <firebaseAppName> are used.
|
|
3078
|
-
*
|
|
3079
|
-
* @param accountName the name of the account/app along with a user identifier.
|
|
3080
|
-
* @param issuer issuer of the TOTP (likely the app name).
|
|
3081
|
-
* @returns A QR code URL string.
|
|
3082
|
-
*/
|
|
3083
|
-
TotpSecret.prototype.generateQrCodeUrl = function (accountName, issuer) {
|
|
3084
|
-
var _a;
|
|
3085
|
-
var useDefaults = false;
|
|
3086
|
-
if (_isEmptyString(accountName) || _isEmptyString(issuer)) {
|
|
3087
|
-
useDefaults = true;
|
|
3088
|
-
}
|
|
3089
|
-
if (useDefaults) {
|
|
3090
|
-
if (_isEmptyString(accountName)) {
|
|
3091
|
-
accountName = ((_a = this.auth.currentUser) === null || _a === void 0 ? void 0 : _a.email) || 'unknownuser';
|
|
3092
|
-
}
|
|
3093
|
-
if (_isEmptyString(issuer)) {
|
|
3094
|
-
issuer = this.auth.name;
|
|
3095
|
-
}
|
|
3096
|
-
}
|
|
3097
|
-
return "otpauth://totp/".concat(issuer, ":").concat(accountName, "?secret=").concat(this.secretKey, "&issuer=").concat(issuer, "&algorithm=").concat(this.hashingAlgorithm, "&digits=").concat(this.codeLength);
|
|
3098
|
-
};
|
|
3099
|
-
return TotpSecret;
|
|
3100
|
-
}());
|
|
3101
|
-
/** @internal */
|
|
3102
|
-
function _isEmptyString(input) {
|
|
3103
|
-
return typeof input === 'undefined' || (input === null || input === void 0 ? void 0 : input.length) === 0;
|
|
3104
|
-
}
|
|
3105
|
-
|
|
3106
2932
|
/**
|
|
3107
2933
|
* @license
|
|
3108
2934
|
* Copyright 2021 Google LLC
|
|
@@ -3892,6 +3718,8 @@ exports.RecaptchaVerifier = index.RecaptchaVerifier;
|
|
|
3892
3718
|
exports.SAMLAuthCredential = index.SAMLAuthCredential;
|
|
3893
3719
|
exports.SAMLAuthProvider = index.SAMLAuthProvider;
|
|
3894
3720
|
exports.SignInMethod = index.SignInMethod;
|
|
3721
|
+
exports.TotpMultiFactorGenerator = index.TotpMultiFactorGenerator;
|
|
3722
|
+
exports.TotpSecret = index.TotpSecret;
|
|
3895
3723
|
exports.TwitterAuthProvider = index.TwitterAuthProvider;
|
|
3896
3724
|
exports.UserImpl = index.UserImpl;
|
|
3897
3725
|
exports._assert = index._assert;
|
|
@@ -3949,8 +3777,6 @@ exports.validatePassword = index.validatePassword;
|
|
|
3949
3777
|
exports.verifyBeforeUpdateEmail = index.verifyBeforeUpdateEmail;
|
|
3950
3778
|
exports.verifyPasswordResetCode = index.verifyPasswordResetCode;
|
|
3951
3779
|
exports.AuthPopup = AuthPopup;
|
|
3952
|
-
exports.TotpMultiFactorGenerator = TotpMultiFactorGenerator;
|
|
3953
|
-
exports.TotpSecret = TotpSecret;
|
|
3954
3780
|
exports._generateEventId = _generateEventId;
|
|
3955
3781
|
exports._getRedirectResult = _getRedirectResult;
|
|
3956
3782
|
exports._overrideRedirectResult = _overrideRedirectResult;
|