@firebase/auth 1.3.1-canary.f27baf423 → 1.3.1

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.
Files changed (41) hide show
  1. package/dist/browser-cjs/{index-5f919eaf.js → index-eb1e5841.js} +2 -2
  2. package/dist/browser-cjs/{index-5f919eaf.js.map → index-eb1e5841.js.map} +1 -1
  3. package/dist/browser-cjs/index.js +1 -1
  4. package/dist/browser-cjs/index.rn.d.ts +0 -1
  5. package/dist/browser-cjs/internal.js +1 -1
  6. package/dist/cordova/index.js +2 -2
  7. package/dist/cordova/index.rn.d.ts +0 -1
  8. package/dist/cordova/internal.js +2 -2
  9. package/dist/cordova/{popup_redirect-db60a2aa.js → popup_redirect-813a1061.js} +2 -2
  10. package/dist/cordova/{popup_redirect-db60a2aa.js.map → popup_redirect-813a1061.js.map} +1 -1
  11. package/dist/esm2017/{index-f42808e0.js → index-ff60bc4f.js} +2 -2
  12. package/dist/esm2017/{index-f42808e0.js.map → index-ff60bc4f.js.map} +1 -1
  13. package/dist/esm2017/index.js +1 -1
  14. package/dist/esm2017/index.rn.d.ts +0 -1
  15. package/dist/esm2017/internal.js +2 -2
  16. package/dist/esm5/{index-c95ac6e6.js → index-41b32683.js} +2 -2
  17. package/dist/esm5/{index-c95ac6e6.js.map → index-41b32683.js.map} +1 -1
  18. package/dist/esm5/index.js +1 -1
  19. package/dist/esm5/index.rn.d.ts +0 -1
  20. package/dist/esm5/internal.js +2 -2
  21. package/dist/index.rn.d.ts +0 -1
  22. package/dist/index.webworker.esm5.js +1 -1
  23. package/dist/node/index.js +1 -1
  24. package/dist/node/index.rn.d.ts +0 -1
  25. package/dist/node/internal.js +1 -1
  26. package/dist/node/{totp-69436477.js → totp-3322e904.js} +2 -2
  27. package/dist/node/{totp-69436477.js.map → totp-3322e904.js.map} +1 -1
  28. package/dist/node-esm/index.js +1 -1
  29. package/dist/node-esm/index.rn.d.ts +0 -1
  30. package/dist/node-esm/internal.js +2 -2
  31. package/dist/node-esm/{totp-ab85c185.js → totp-36756419.js} +2 -2
  32. package/dist/node-esm/{totp-ab85c185.js.map → totp-36756419.js.map} +1 -1
  33. package/dist/rn/{index-84929b39.js → index-97e8af35.js} +6 -178
  34. package/dist/rn/index-97e8af35.js.map +1 -0
  35. package/dist/rn/index.js +1 -3
  36. package/dist/rn/index.js.map +1 -1
  37. package/dist/rn/index.rn.d.ts +0 -1
  38. package/dist/rn/internal.js +177 -3
  39. package/dist/rn/internal.js.map +1 -1
  40. package/package.json +6 -6
  41. package/dist/rn/index-84929b39.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-84929b39.js');
6
+ var index = require('./index-97e8af35.js');
7
7
  var tslib = require('tslib');
8
8
  require('@firebase/util');
9
9
  require('@firebase/component');
@@ -163,8 +163,6 @@ 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;
168
166
  exports.TwitterAuthProvider = index.TwitterAuthProvider;
169
167
  exports.applyActionCode = index.applyActionCode;
170
168
  exports.beforeAuthStateChanged = index.beforeAuthStateChanged;
@@ -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';\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":";;;;;;;;;;;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,aAA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AmB,GAAAC,UAAM,EAAE,CAAA,EAAA;IACjD,IAAM,QAAQ,GAAGC,gBAAY,CAACF,KAAG,EAAE,MAAM,CAAC,CAAC;AAE3C,IAAA,IAAI,QAAQ,CAAC,aAAa,EAAE,EAAE;AAC5B,QAAA,OAAO,QAAQ,CAAC,YAAY,EAAE,CAAC;AAChC,KAAA;;IAGDG,cAAQ,CAAC,sBAAsB,CAAC,CAAC;AAEjC,IAAA,OAAOC,oBAAsB,CAACJ,KAAG,CAAC,CAAC;AACrC,CAAC;AAED;;;;;;;AAOG;AACa,SAAA,cAAc,CAAC,GAAgB,EAAE,IAAmB,EAAA;IAClE,IAAI,EAAC,IAAI,KAAJ,IAAA,IAAA,IAAI,uBAAJ,IAAI,CAAE,WAAW,CAAA,EAAE;QACtBG,cAAQ,CAAC,sBAAsB,CAAC,CAAC;AAClC,KAAA;AACD,IAAA,OAAOC,oBAAsB,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;AAC3C,CAAC;AAEDC,kBAAY,iDAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
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,CA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C,IAAA,OAAOC,oBAAsB,CAACJ,KAAG,CAAC,CAAC;AACrC,CAAC;AAED;;;;;;;AAOG;AACa,SAAA,cAAc,CAAC,GAAgB,EAAE,IAAmB,EAAA;IAClE,IAAI,EAAC,IAAI,KAAJ,IAAA,IAAA,IAAI,uBAAJ,IAAI,CAAE,WAAW,CAAA,EAAE;QACtBG,cAAQ,CAAC,sBAAsB,CAAC,CAAC;AAClC,KAAA;AACD,IAAA,OAAOC,oBAAsB,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;AAC3C,CAAC;AAEDC,kBAAY,iDAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -26,7 +26,6 @@ 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';
30
29
  export { getReactNativePersistence } from './src/platform_react_native/persistence/react_native';
31
30
  export declare function getAuth(app?: FirebaseApp): Auth;
32
31
  /**
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var index = require('./index-84929b39.js');
5
+ var index = require('./index-97e8af35.js');
6
6
  var tslib = require('tslib');
7
7
  var util = require('@firebase/util');
8
8
  var app = require('@firebase/app');
@@ -2929,6 +2929,180 @@ 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
+
2932
3106
  /**
2933
3107
  * @license
2934
3108
  * Copyright 2021 Google LLC
@@ -3718,8 +3892,6 @@ exports.RecaptchaVerifier = index.RecaptchaVerifier;
3718
3892
  exports.SAMLAuthCredential = index.SAMLAuthCredential;
3719
3893
  exports.SAMLAuthProvider = index.SAMLAuthProvider;
3720
3894
  exports.SignInMethod = index.SignInMethod;
3721
- exports.TotpMultiFactorGenerator = index.TotpMultiFactorGenerator;
3722
- exports.TotpSecret = index.TotpSecret;
3723
3895
  exports.TwitterAuthProvider = index.TwitterAuthProvider;
3724
3896
  exports.UserImpl = index.UserImpl;
3725
3897
  exports._assert = index._assert;
@@ -3777,6 +3949,8 @@ exports.validatePassword = index.validatePassword;
3777
3949
  exports.verifyBeforeUpdateEmail = index.verifyBeforeUpdateEmail;
3778
3950
  exports.verifyPasswordResetCode = index.verifyPasswordResetCode;
3779
3951
  exports.AuthPopup = AuthPopup;
3952
+ exports.TotpMultiFactorGenerator = TotpMultiFactorGenerator;
3953
+ exports.TotpSecret = TotpSecret;
3780
3954
  exports._generateEventId = _generateEventId;
3781
3955
  exports._getRedirectResult = _getRedirectResult;
3782
3956
  exports._overrideRedirectResult = _overrideRedirectResult;