@firebase/auth 0.23.2-canary.e642fc7cd → 0.23.2-canary.f1c8d3806

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 (87) hide show
  1. package/dist/auth-public.d.ts +3 -4
  2. package/dist/auth.d.ts +3 -4
  3. package/dist/browser-cjs/{index-35a8d5c2.js → index-cbaaa869.js} +29 -13
  4. package/dist/browser-cjs/index-cbaaa869.js.map +1 -0
  5. package/dist/browser-cjs/index.doc.d.ts +1 -1
  6. package/dist/browser-cjs/index.js +1 -1
  7. package/dist/browser-cjs/index.rn.d.ts +7 -8
  8. package/dist/browser-cjs/internal.js +1 -1
  9. package/dist/browser-cjs/src/mfa/mfa_session.d.ts +3 -3
  10. package/dist/browser-cjs/src/model/public_types.d.ts +1 -1
  11. package/dist/browser-cjs/src/platform_browser/recaptcha/recaptcha_verifier.d.ts +2 -3
  12. package/dist/browser-cjs/test/helpers/integration/helpers.d.ts +1 -0
  13. package/dist/cordova/index.doc.d.ts +1 -1
  14. package/dist/cordova/index.js +2 -2
  15. package/dist/cordova/index.rn.d.ts +7 -8
  16. package/dist/cordova/internal.js +11 -11
  17. package/dist/cordova/internal.js.map +1 -1
  18. package/dist/cordova/{popup_redirect-e88eb743.js → popup_redirect-0c43a717.js} +23 -7
  19. package/dist/cordova/{popup_redirect-e88eb743.js.map → popup_redirect-0c43a717.js.map} +1 -1
  20. package/dist/cordova/src/mfa/mfa_session.d.ts +3 -3
  21. package/dist/cordova/src/model/public_types.d.ts +1 -1
  22. package/dist/cordova/src/platform_browser/recaptcha/recaptcha_verifier.d.ts +2 -3
  23. package/dist/cordova/test/helpers/integration/helpers.d.ts +1 -0
  24. package/dist/esm2017/{index-14ccc5f3.js → index-2e66d7ed.js} +29 -13
  25. package/dist/esm2017/index-2e66d7ed.js.map +1 -0
  26. package/dist/esm2017/index.doc.d.ts +1 -1
  27. package/dist/esm2017/index.js +1 -1
  28. package/dist/esm2017/index.rn.d.ts +7 -8
  29. package/dist/esm2017/internal.js +2 -2
  30. package/dist/esm2017/src/mfa/mfa_session.d.ts +3 -3
  31. package/dist/esm2017/src/model/public_types.d.ts +1 -1
  32. package/dist/esm2017/src/platform_browser/recaptcha/recaptcha_verifier.d.ts +2 -3
  33. package/dist/esm2017/test/helpers/integration/helpers.d.ts +1 -0
  34. package/dist/esm5/{index-f5d14f2f.js → index-72cf0233.js} +32 -16
  35. package/dist/esm5/index-72cf0233.js.map +1 -0
  36. package/dist/esm5/index.doc.d.ts +1 -1
  37. package/dist/esm5/index.js +1 -1
  38. package/dist/esm5/index.rn.d.ts +7 -8
  39. package/dist/esm5/internal.js +2 -2
  40. package/dist/esm5/src/mfa/mfa_session.d.ts +3 -3
  41. package/dist/esm5/src/model/public_types.d.ts +1 -1
  42. package/dist/esm5/src/platform_browser/recaptcha/recaptcha_verifier.d.ts +2 -3
  43. package/dist/esm5/test/helpers/integration/helpers.d.ts +1 -0
  44. package/dist/index.doc.d.ts +1 -1
  45. package/dist/index.rn.d.ts +7 -8
  46. package/dist/index.webworker.esm5.js +22 -6
  47. package/dist/index.webworker.esm5.js.map +1 -1
  48. package/dist/node/index.doc.d.ts +1 -1
  49. package/dist/node/index.js +1 -1
  50. package/dist/node/index.rn.d.ts +7 -8
  51. package/dist/node/internal.js +1 -1
  52. package/dist/node/src/mfa/mfa_session.d.ts +3 -3
  53. package/dist/node/src/model/public_types.d.ts +1 -1
  54. package/dist/node/src/platform_browser/recaptcha/recaptcha_verifier.d.ts +2 -3
  55. package/dist/node/test/helpers/integration/helpers.d.ts +1 -0
  56. package/dist/node/{totp-0ccc129a.js → totp-ea92812c.js} +30 -13
  57. package/dist/node/{totp-0ccc129a.js.map → totp-ea92812c.js.map} +1 -1
  58. package/dist/node-esm/index.doc.d.ts +1 -1
  59. package/dist/node-esm/index.js +1 -1
  60. package/dist/node-esm/index.rn.d.ts +7 -8
  61. package/dist/node-esm/internal.js +2 -2
  62. package/dist/node-esm/src/mfa/mfa_session.d.ts +3 -3
  63. package/dist/node-esm/src/model/public_types.d.ts +1 -1
  64. package/dist/node-esm/src/platform_browser/recaptcha/recaptcha_verifier.d.ts +2 -3
  65. package/dist/node-esm/test/helpers/integration/helpers.d.ts +1 -0
  66. package/dist/node-esm/{totp-d6b703d1.js → totp-c453433c.js} +27 -10
  67. package/dist/node-esm/{totp-d6b703d1.js.map → totp-c453433c.js.map} +1 -1
  68. package/dist/rn/index.doc.d.ts +1 -1
  69. package/dist/rn/index.js +5 -57
  70. package/dist/rn/index.js.map +1 -1
  71. package/dist/rn/index.rn.d.ts +7 -8
  72. package/dist/rn/internal.js +8 -7
  73. package/dist/rn/internal.js.map +1 -1
  74. package/dist/rn/{phone-a8d96168.js → phone-52a61d69.js} +25 -10
  75. package/dist/rn/{phone-a8d96168.js.map → phone-52a61d69.js.map} +1 -1
  76. package/dist/rn/src/mfa/mfa_session.d.ts +3 -3
  77. package/dist/rn/src/model/public_types.d.ts +1 -1
  78. package/dist/rn/src/platform_browser/recaptcha/recaptcha_verifier.d.ts +2 -3
  79. package/dist/rn/test/helpers/integration/helpers.d.ts +1 -0
  80. package/dist/src/mfa/mfa_session.d.ts +3 -3
  81. package/dist/src/model/public_types.d.ts +1 -1
  82. package/dist/src/platform_browser/recaptcha/recaptcha_verifier.d.ts +2 -3
  83. package/dist/test/helpers/integration/helpers.d.ts +1 -0
  84. package/package.json +10 -9
  85. package/dist/browser-cjs/index-35a8d5c2.js.map +0 -1
  86. package/dist/esm2017/index-14ccc5f3.js.map +0 -1
  87. package/dist/esm5/index-f5d14f2f.js.map +0 -1
@@ -21,4 +21,4 @@
21
21
  */
22
22
  export * from './index';
23
23
  export { cordovaPopupRedirectResolver } from './index.cordova';
24
- export { reactNativeLocalPersistence, getReactNativePersistence } from './index.rn';
24
+ export { getReactNativePersistence } from './index.rn';
package/dist/rn/index.js CHANGED
@@ -2,33 +2,17 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var ReactNative = require('react-native');
6
5
  var app = require('@firebase/app');
7
- var phone = require('./phone-a8d96168.js');
6
+ var phone = require('./phone-52a61d69.js');
8
7
  var tslib = require('tslib');
8
+ var ReactNativeAsyncStorage = require('@react-native-async-storage/async-storage');
9
9
  require('@firebase/util');
10
10
  require('@firebase/component');
11
11
  require('@firebase/logger');
12
12
 
13
- function _interopNamespace(e) {
14
- if (e && e.__esModule) return e;
15
- var n = Object.create(null);
16
- if (e) {
17
- Object.keys(e).forEach(function (k) {
18
- if (k !== 'default') {
19
- var d = Object.getOwnPropertyDescriptor(e, k);
20
- Object.defineProperty(n, k, d.get ? d : {
21
- enumerable: true,
22
- get: function () { return e[k]; }
23
- });
24
- }
25
- });
26
- }
27
- n["default"] = e;
28
- return Object.freeze(n);
29
- }
13
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
30
14
 
31
- var ReactNative__namespace = /*#__PURE__*/_interopNamespace(ReactNative);
15
+ var ReactNativeAsyncStorage__default = /*#__PURE__*/_interopDefaultLegacy(ReactNativeAsyncStorage);
32
16
 
33
17
  /**
34
18
  * @license
@@ -138,41 +122,6 @@ function getReactNativePersistence(storage) {
138
122
  * See the License for the specific language governing permissions and
139
123
  * limitations under the License.
140
124
  */
141
- /**
142
- * An implementation of {@link Persistence} of type 'LOCAL' for use in React
143
- * Native environments.
144
- *
145
- * @public
146
- */
147
- var reactNativeLocalPersistence = getReactNativePersistence({
148
- getItem: function () {
149
- var _a;
150
- var args = [];
151
- for (var _i = 0; _i < arguments.length; _i++) {
152
- args[_i] = arguments[_i];
153
- }
154
- // Called inline to avoid deprecation warnings on startup.
155
- return (_a = ReactNative__namespace.AsyncStorage).getItem.apply(_a, args);
156
- },
157
- setItem: function () {
158
- var _a;
159
- var args = [];
160
- for (var _i = 0; _i < arguments.length; _i++) {
161
- args[_i] = arguments[_i];
162
- }
163
- // Called inline to avoid deprecation warnings on startup.
164
- return (_a = ReactNative__namespace.AsyncStorage).setItem.apply(_a, args);
165
- },
166
- removeItem: function () {
167
- var _a;
168
- var args = [];
169
- for (var _i = 0; _i < arguments.length; _i++) {
170
- args[_i] = arguments[_i];
171
- }
172
- // Called inline to avoid deprecation warnings on startup.
173
- return (_a = ReactNative__namespace.AsyncStorage).removeItem.apply(_a, args);
174
- }
175
- });
176
125
  function getAuth(app$1) {
177
126
  if (app$1 === void 0) { app$1 = app.getApp(); }
178
127
  var provider = app._getProvider(app$1, 'auth');
@@ -180,7 +129,7 @@ function getAuth(app$1) {
180
129
  return provider.getImmediate();
181
130
  }
182
131
  return phone.initializeAuth(app$1, {
183
- persistence: reactNativeLocalPersistence
132
+ persistence: getReactNativePersistence(ReactNativeAsyncStorage__default["default"])
184
133
  });
185
134
  }
186
135
  phone.registerAuth("ReactNative" /* ClientPlatform.REACT_NATIVE */);
@@ -254,5 +203,4 @@ exports.verifyBeforeUpdateEmail = phone.verifyBeforeUpdateEmail;
254
203
  exports.verifyPasswordResetCode = phone.verifyPasswordResetCode;
255
204
  exports.getAuth = getAuth;
256
205
  exports.getReactNativePersistence = getReactNativePersistence;
257
- exports.reactNativeLocalPersistence = reactNativeLocalPersistence;
258
206
  //# sourceMappingURL=index.js.map
@@ -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 * as ReactNative from 'react-native';\n\nimport { FirebaseApp, getApp, _getProvider } from '@firebase/app';\nimport { Auth, Persistence } from './src/model/public_types';\n\nimport { initializeAuth } from './src';\nimport { registerAuth } from './src/core/auth/register';\nimport { ClientPlatform } from './src/core/util/version';\nimport { getReactNativePersistence } from './src/platform_react_native/persistence/react_native';\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\n/**\n * An implementation of {@link Persistence} of type 'LOCAL' for use in React\n * Native environments.\n *\n * @public\n */\nexport const reactNativeLocalPersistence: Persistence =\n getReactNativePersistence({\n getItem(...args) {\n // Called inline to avoid deprecation warnings on startup.\n return ReactNative.AsyncStorage.getItem(...args);\n },\n setItem(...args) {\n // Called inline to avoid deprecation warnings on startup.\n return ReactNative.AsyncStorage.setItem(...args);\n },\n removeItem(...args) {\n // Called inline to avoid deprecation warnings on startup.\n return ReactNative.AsyncStorage.removeItem(...args);\n }\n });\n\nexport { getReactNativePersistence };\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 return initializeAuth(app, {\n persistence: reactNativeLocalPersistence\n });\n}\n\nregisterAuth(ClientPlatform.REACT_NATIVE);\n"],"names":["STORAGE_AVAILABLE_KEY","ReactNative","app","getApp","_getProvider","initializeAuth","registerAuth"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;AAeG;A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sBAAW,CAAC,YAAY,EAAC,OAAO,CAAI,KAAA,CAAA,EAAA,EAAA,IAAI,CAAE,CAAA;KAClD;IACD,UAAU,EAAA,YAAA;;QAAC,IAAO,IAAA,GAAA,EAAA,CAAA;aAAP,IAAO,EAAA,GAAA,CAAA,EAAP,EAAO,GAAA,SAAA,CAAA,MAAA,EAAP,EAAO,EAAA,EAAA;YAAP,IAAO,CAAA,EAAA,CAAA,GAAA,SAAA,CAAA,EAAA,CAAA,CAAA;;;QAEhB,OAAO,CAAA,EAAA,GAAAA,sBAAW,CAAC,YAAY,EAAC,UAAU,CAAI,KAAA,CAAA,EAAA,EAAA,IAAI,CAAE,CAAA;KACrD;AACF,CAAA,EAAE;AAIC,SAAU,OAAO,CAACC,KAA2B,EAAA;IAA3B,IAAAA,KAAA,KAAA,KAAA,CAAA,EAAA,EAAAA,KAAmB,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;IAED,OAAOG,oBAAc,CAACH,KAAG,EAAE;AACzB,QAAA,WAAW,EAAE,2BAA2B;AACzC,KAAA,CAAC,CAAC;AACL,CAAC;AAEDI,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 } from './src/model/public_types';\n\nimport { initializeAuth } from './src';\nimport { registerAuth } from './src/core/auth/register';\nimport { ClientPlatform } from './src/core/util/version';\nimport { getReactNativePersistence } from './src/platform_react_native/persistence/react_native';\nimport ReactNativeAsyncStorage from '@react-native-async-storage/async-storage';\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 };\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 return initializeAuth(app, {\n persistence: getReactNativePersistence(ReactNativeAsyncStorage)\n });\n}\n\nregisterAuth(ClientPlatform.REACT_NATIVE);\n"],"names":["STORAGE_AVAILABLE_KEY","app","getApp","_getProvider","initializeAuth","ReactNativeAsyncStorage","registerAuth"],"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;AAeG;AAYH;;;;;;AAMG;AACG,SAAU,yBAAyB,CACvC,OAAgC,EAAA;;;;;;;;AAQhC,IAAA,OAAA,EAAA,kBAAA,YAAA;A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A,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;AAsCG,SAAU,OAAO,CAACC,KAA2B,EAAA;IAA3B,IAAAA,KAAA,KAAA,KAAA,CAAA,EAAA,EAAAA,KAAmB,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;IAED,OAAOG,oBAAc,CAACH,KAAG,EAAE;AACzB,QAAA,WAAW,EAAE,yBAAyB,CAACI,2CAAuB,CAAC;AAChE,KAAA,CAAC,CAAC;AACL,CAAC;AAEDC,kBAAY,iDAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -14,19 +14,18 @@
14
14
  * See the License for the specific language governing permissions and
15
15
  * limitations under the License.
16
16
  */
17
+ /**
18
+ * This is the file that people using React Native will actually import. You
19
+ * should only include this file if you have something specific about your
20
+ * implementation that mandates having a separate entrypoint. Otherwise you can
21
+ * just use index.ts
22
+ */
17
23
  import { FirebaseApp } from '@firebase/app';
18
- import { Auth, Persistence } from './src/model/public_types';
24
+ import { Auth } from './src/model/public_types';
19
25
  import { getReactNativePersistence } from './src/platform_react_native/persistence/react_native';
20
26
  export * from './index.shared';
21
27
  export { PhoneAuthProvider } from './src/platform_browser/providers/phone';
22
28
  export { signInWithPhoneNumber, linkWithPhoneNumber, reauthenticateWithPhoneNumber, updatePhoneNumber } from './src/platform_browser/strategies/phone';
23
29
  export { PhoneMultiFactorGenerator } from './src/platform_browser/mfa/assertions/phone';
24
- /**
25
- * An implementation of {@link Persistence} of type 'LOCAL' for use in React
26
- * Native environments.
27
- *
28
- * @public
29
- */
30
- export declare const reactNativeLocalPersistence: Persistence;
31
30
  export { getReactNativePersistence };
32
31
  export declare function getAuth(app?: FirebaseApp): Auth;
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var phone = require('./phone-a8d96168.js');
5
+ var phone = require('./phone-52a61d69.js');
6
6
  var tslib = require('tslib');
7
7
  var util = require('@firebase/util');
8
8
  var app = require('@firebase/app');
@@ -2972,20 +2972,21 @@ var TotpMultiFactorGenerator = /** @class */ (function () {
2972
2972
  * @returns A promise to {@link TotpSecret}.
2973
2973
  */
2974
2974
  TotpMultiFactorGenerator.generateSecret = function (session) {
2975
+ var _a;
2975
2976
  return tslib.__awaiter(this, void 0, void 0, function () {
2976
2977
  var mfaSession, response;
2977
- return tslib.__generator(this, function (_a) {
2978
- switch (_a.label) {
2978
+ return tslib.__generator(this, function (_b) {
2979
+ switch (_b.label) {
2979
2980
  case 0:
2980
2981
  mfaSession = session;
2981
- phone._assert(typeof mfaSession.auth !== 'undefined', "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
2982
- return [4 /*yield*/, phone.startEnrollTotpMfa(mfaSession.auth, {
2982
+ phone._assert(typeof ((_a = mfaSession.user) === null || _a === void 0 ? void 0 : _a.auth) !== 'undefined', "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
2983
+ return [4 /*yield*/, phone.startEnrollTotpMfa(mfaSession.user.auth, {
2983
2984
  idToken: mfaSession.credential,
2984
2985
  totpEnrollmentInfo: {}
2985
2986
  })];
2986
2987
  case 1:
2987
- response = _a.sent();
2988
- return [2 /*return*/, TotpSecret._fromStartTotpMfaEnrollmentResponse(response, mfaSession.auth)];
2988
+ response = _b.sent();
2989
+ return [2 /*return*/, TotpSecret._fromStartTotpMfaEnrollmentResponse(response, mfaSession.user.auth)];
2989
2990
  }
2990
2991
  });
2991
2992
  });