@firebase/auth 0.18.3 → 0.19.0

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 (89) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/auth-public.d.ts +28 -19
  3. package/dist/auth.d.ts +29 -20
  4. package/dist/cordova/index.js +2 -2
  5. package/dist/cordova/index.rn.d.ts +3 -0
  6. package/dist/cordova/internal.js +7 -3
  7. package/dist/cordova/internal.js.map +1 -1
  8. package/dist/cordova/{popup_redirect-f608cd47.js → popup_redirect-c65b3459.js} +46 -26
  9. package/dist/cordova/popup_redirect-c65b3459.js.map +1 -0
  10. package/dist/cordova/src/core/errors.d.ts +2 -2
  11. package/dist/cordova/src/core/strategies/abstract_popup_redirect_operation.d.ts +1 -1
  12. package/dist/cordova/src/mfa/mfa_error.d.ts +4 -5
  13. package/dist/cordova/src/model/public_types.d.ts +25 -19
  14. package/dist/cordova/src/platform_browser/persistence/browser.d.ts +4 -3
  15. package/dist/cordova/src/platform_browser/persistence/browser.test.d.ts +17 -0
  16. package/dist/cordova/src/platform_browser/strategies/phone.d.ts +3 -0
  17. package/dist/cordova/test/helpers/erroring_unavailable_persistence.d.ts +36 -0
  18. package/dist/esm2017/{index-f41a0691.js → index-238d6fa9.js} +41 -24
  19. package/dist/esm2017/index-238d6fa9.js.map +1 -0
  20. package/dist/esm2017/index.js +1 -1
  21. package/dist/esm2017/index.rn.d.ts +3 -0
  22. package/dist/esm2017/internal.js +2 -2
  23. package/dist/esm2017/src/core/errors.d.ts +2 -2
  24. package/dist/esm2017/src/core/strategies/abstract_popup_redirect_operation.d.ts +1 -1
  25. package/dist/esm2017/src/mfa/mfa_error.d.ts +4 -5
  26. package/dist/esm2017/src/model/public_types.d.ts +25 -19
  27. package/dist/esm2017/src/platform_browser/persistence/browser.d.ts +4 -3
  28. package/dist/esm2017/src/platform_browser/persistence/browser.test.d.ts +17 -0
  29. package/dist/esm2017/src/platform_browser/strategies/phone.d.ts +3 -0
  30. package/dist/esm2017/test/helpers/erroring_unavailable_persistence.d.ts +36 -0
  31. package/dist/esm5/{index-fd8b7af5.js → index-47dd1018.js} +51 -27
  32. package/dist/esm5/index-47dd1018.js.map +1 -0
  33. package/dist/esm5/index.js +1 -1
  34. package/dist/esm5/index.rn.d.ts +3 -0
  35. package/dist/esm5/internal.js +2 -2
  36. package/dist/esm5/src/core/errors.d.ts +2 -2
  37. package/dist/esm5/src/core/strategies/abstract_popup_redirect_operation.d.ts +1 -1
  38. package/dist/esm5/src/mfa/mfa_error.d.ts +4 -5
  39. package/dist/esm5/src/model/public_types.d.ts +25 -19
  40. package/dist/esm5/src/platform_browser/persistence/browser.d.ts +4 -3
  41. package/dist/esm5/src/platform_browser/persistence/browser.test.d.ts +17 -0
  42. package/dist/esm5/src/platform_browser/strategies/phone.d.ts +3 -0
  43. package/dist/esm5/test/helpers/erroring_unavailable_persistence.d.ts +36 -0
  44. package/dist/index.rn.d.ts +3 -0
  45. package/dist/index.webworker.esm5.js +17 -16
  46. package/dist/index.webworker.esm5.js.map +1 -1
  47. package/dist/node/{index-358613ec.js → index-da4673cf.js} +18 -17
  48. package/dist/node/index-da4673cf.js.map +1 -0
  49. package/dist/node/index.js +1 -1
  50. package/dist/node/index.rn.d.ts +3 -0
  51. package/dist/node/internal.js +29 -10
  52. package/dist/node/internal.js.map +1 -1
  53. package/dist/node/src/core/errors.d.ts +2 -2
  54. package/dist/node/src/core/strategies/abstract_popup_redirect_operation.d.ts +1 -1
  55. package/dist/node/src/mfa/mfa_error.d.ts +4 -5
  56. package/dist/node/src/model/public_types.d.ts +25 -19
  57. package/dist/node/src/platform_browser/persistence/browser.d.ts +4 -3
  58. package/dist/node/src/platform_browser/persistence/browser.test.d.ts +17 -0
  59. package/dist/node/src/platform_browser/strategies/phone.d.ts +3 -0
  60. package/dist/node/test/helpers/erroring_unavailable_persistence.d.ts +36 -0
  61. package/dist/rn/index.js +70 -64
  62. package/dist/rn/index.js.map +1 -1
  63. package/dist/rn/index.rn.d.ts +3 -0
  64. package/dist/rn/internal.js +338 -1465
  65. package/dist/rn/internal.js.map +1 -1
  66. package/dist/rn/{enum_maps-81db3ff6.js → phone-e3d3bcce.js} +1187 -27
  67. package/dist/rn/phone-e3d3bcce.js.map +1 -0
  68. package/dist/rn/src/core/errors.d.ts +2 -2
  69. package/dist/rn/src/core/strategies/abstract_popup_redirect_operation.d.ts +1 -1
  70. package/dist/rn/src/mfa/mfa_error.d.ts +4 -5
  71. package/dist/rn/src/model/public_types.d.ts +25 -19
  72. package/dist/rn/src/platform_browser/persistence/browser.d.ts +4 -3
  73. package/dist/rn/src/platform_browser/persistence/browser.test.d.ts +17 -0
  74. package/dist/rn/src/platform_browser/strategies/phone.d.ts +3 -0
  75. package/dist/rn/test/helpers/erroring_unavailable_persistence.d.ts +36 -0
  76. package/dist/src/core/errors.d.ts +2 -2
  77. package/dist/src/core/strategies/abstract_popup_redirect_operation.d.ts +1 -1
  78. package/dist/src/mfa/mfa_error.d.ts +4 -5
  79. package/dist/src/model/public_types.d.ts +25 -19
  80. package/dist/src/platform_browser/persistence/browser.d.ts +4 -3
  81. package/dist/src/platform_browser/persistence/browser.test.d.ts +17 -0
  82. package/dist/src/platform_browser/strategies/phone.d.ts +3 -0
  83. package/dist/test/helpers/erroring_unavailable_persistence.d.ts +36 -0
  84. package/package.json +2 -2
  85. package/dist/cordova/popup_redirect-f608cd47.js.map +0 -1
  86. package/dist/esm2017/index-f41a0691.js.map +0 -1
  87. package/dist/esm5/index-fd8b7af5.js.map +0 -1
  88. package/dist/node/index-358613ec.js.map +0 -1
  89. package/dist/rn/enum_maps-81db3ff6.js.map +0 -1
@@ -1,4 +1,4 @@
1
- export { A as ActionCodeOperation, ac as ActionCodeURL, G as AuthCredential, C as AuthErrorCodes, H as EmailAuthCredential, L as EmailAuthProvider, M as FacebookAuthProvider, F as FactorId, Q as GithubAuthProvider, N as GoogleAuthProvider, I as OAuthCredential, T as OAuthProvider, O as OperationType, J as PhoneAuthCredential, P as PhoneAuthProvider, m as PhoneMultiFactorGenerator, o as ProviderId, R as RecaptchaVerifier, U as SAMLAuthProvider, S as SignInMethod, V as TwitterAuthProvider, a1 as applyActionCode, b as browserLocalPersistence, k as browserPopupRedirectResolver, a as browserSessionPersistence, a2 as checkActionCode, a0 as confirmPasswordReset, E as connectAuthEmulator, a4 as createUserWithEmailAndPassword, z as debugErrorMap, y as deleteUser, a9 as fetchSignInMethodsForEmail, ak as getAdditionalUserInfo, n as getAuth, ah as getIdToken, ai as getIdTokenResult, am as getMultiFactorResolver, j as getRedirectResult, K as inMemoryPersistence, i as indexedDBLocalPersistence, D as initializeAuth, a7 as isSignInWithEmailLink, Y as linkWithCredential, l as linkWithPhoneNumber, d as linkWithPopup, g as linkWithRedirect, an as multiFactor, t as onAuthStateChanged, q as onIdTokenChanged, ad as parseActionCodeURL, B as prodErrorMap, Z as reauthenticateWithCredential, r as reauthenticateWithPhoneNumber, e as reauthenticateWithPopup, h as reauthenticateWithRedirect, al as reload, aa as sendEmailVerification, $ as sendPasswordResetEmail, a6 as sendSignInLinkToEmail, p as setPersistence, W as signInAnonymously, X as signInWithCredential, _ as signInWithCustomToken, a5 as signInWithEmailAndPassword, a8 as signInWithEmailLink, s as signInWithPhoneNumber, c as signInWithPopup, f as signInWithRedirect, x as signOut, aj as unlink, w as updateCurrentUser, af as updateEmail, ag as updatePassword, u as updatePhoneNumber, ae as updateProfile, v as useDeviceLanguage, ab as verifyBeforeUpdateEmail, a3 as verifyPasswordResetCode } from './index-fd8b7af5.js';
1
+ export { A as ActionCodeOperation, ac as ActionCodeURL, G as AuthCredential, C as AuthErrorCodes, H as EmailAuthCredential, L as EmailAuthProvider, M as FacebookAuthProvider, F as FactorId, Q as GithubAuthProvider, N as GoogleAuthProvider, I as OAuthCredential, T as OAuthProvider, O as OperationType, J as PhoneAuthCredential, P as PhoneAuthProvider, m as PhoneMultiFactorGenerator, o as ProviderId, R as RecaptchaVerifier, U as SAMLAuthProvider, S as SignInMethod, V as TwitterAuthProvider, a1 as applyActionCode, b as browserLocalPersistence, k as browserPopupRedirectResolver, a as browserSessionPersistence, a2 as checkActionCode, a0 as confirmPasswordReset, E as connectAuthEmulator, a4 as createUserWithEmailAndPassword, z as debugErrorMap, y as deleteUser, a9 as fetchSignInMethodsForEmail, ak as getAdditionalUserInfo, n as getAuth, ah as getIdToken, ai as getIdTokenResult, am as getMultiFactorResolver, j as getRedirectResult, K as inMemoryPersistence, i as indexedDBLocalPersistence, D as initializeAuth, a7 as isSignInWithEmailLink, Y as linkWithCredential, l as linkWithPhoneNumber, d as linkWithPopup, g as linkWithRedirect, an as multiFactor, t as onAuthStateChanged, q as onIdTokenChanged, ad as parseActionCodeURL, B as prodErrorMap, Z as reauthenticateWithCredential, r as reauthenticateWithPhoneNumber, e as reauthenticateWithPopup, h as reauthenticateWithRedirect, al as reload, aa as sendEmailVerification, $ as sendPasswordResetEmail, a6 as sendSignInLinkToEmail, p as setPersistence, W as signInAnonymously, X as signInWithCredential, _ as signInWithCustomToken, a5 as signInWithEmailAndPassword, a8 as signInWithEmailLink, s as signInWithPhoneNumber, c as signInWithPopup, f as signInWithRedirect, x as signOut, aj as unlink, w as updateCurrentUser, af as updateEmail, ag as updatePassword, u as updatePhoneNumber, ae as updateProfile, v as useDeviceLanguage, ab as verifyBeforeUpdateEmail, a3 as verifyPasswordResetCode } from './index-47dd1018.js';
2
2
  import 'tslib';
3
3
  import '@firebase/util';
4
4
  import '@firebase/app';
@@ -17,6 +17,9 @@
17
17
  import { FirebaseApp } from '@firebase/app';
18
18
  import { Auth, Persistence } from './src/model/public_types';
19
19
  export * from './index.shared';
20
+ export { PhoneAuthProvider } from './src/platform_browser/providers/phone';
21
+ export { signInWithPhoneNumber, linkWithPhoneNumber, reauthenticateWithPhoneNumber, updatePhoneNumber } from './src/platform_browser/strategies/phone';
22
+ export { PhoneMultiFactorGenerator } from './src/platform_browser/mfa/assertions/phone';
20
23
  /**
21
24
  * An implementation of {@link Persistence} of type 'LOCAL' for use in React
22
25
  * Native environments.
@@ -1,5 +1,5 @@
1
- import { ao as _isAndroid, ap as _isIOS7Or8, aq as _isIOS, ar as _fail, as as _getRedirectUrl, at as debugAssert, au as _getProjectConfig, av as _createError, aw as _assert, ax as AuthEventManager, ay as _getInstance, b as browserLocalPersistence, az as _persistenceKeyName, aA as _clearRedirectOutcomes, a as browserSessionPersistence, aB as _getRedirectResult, aC as _castAuth } from './index-fd8b7af5.js';
2
- export { A as ActionCodeOperation, ac as ActionCodeURL, G as AuthCredential, C as AuthErrorCodes, aE as AuthImpl, aH as AuthPopup, H as EmailAuthCredential, L as EmailAuthProvider, M as FacebookAuthProvider, F as FactorId, aI as FetchProvider, Q as GithubAuthProvider, N as GoogleAuthProvider, I as OAuthCredential, T as OAuthProvider, O as OperationType, J as PhoneAuthCredential, P as PhoneAuthProvider, m as PhoneMultiFactorGenerator, o as ProviderId, R as RecaptchaVerifier, aJ as SAMLAuthCredential, U as SAMLAuthProvider, S as SignInMethod, V as TwitterAuthProvider, aD as UserImpl, aw as _assert, aC as _castAuth, ar as _fail, aG as _generateEventId, aF as _getClientVersion, ay as _getInstance, aB as _getRedirectResult, az as _persistenceKeyName, a1 as applyActionCode, b as browserLocalPersistence, k as browserPopupRedirectResolver, a as browserSessionPersistence, a2 as checkActionCode, a0 as confirmPasswordReset, E as connectAuthEmulator, a4 as createUserWithEmailAndPassword, z as debugErrorMap, y as deleteUser, a9 as fetchSignInMethodsForEmail, ak as getAdditionalUserInfo, n as getAuth, ah as getIdToken, ai as getIdTokenResult, am as getMultiFactorResolver, j as getRedirectResult, K as inMemoryPersistence, i as indexedDBLocalPersistence, D as initializeAuth, a7 as isSignInWithEmailLink, Y as linkWithCredential, l as linkWithPhoneNumber, d as linkWithPopup, g as linkWithRedirect, an as multiFactor, t as onAuthStateChanged, q as onIdTokenChanged, ad as parseActionCodeURL, B as prodErrorMap, Z as reauthenticateWithCredential, r as reauthenticateWithPhoneNumber, e as reauthenticateWithPopup, h as reauthenticateWithRedirect, al as reload, aa as sendEmailVerification, $ as sendPasswordResetEmail, a6 as sendSignInLinkToEmail, p as setPersistence, W as signInAnonymously, X as signInWithCredential, _ as signInWithCustomToken, a5 as signInWithEmailAndPassword, a8 as signInWithEmailLink, s as signInWithPhoneNumber, c as signInWithPopup, f as signInWithRedirect, x as signOut, aj as unlink, w as updateCurrentUser, af as updateEmail, ag as updatePassword, u as updatePhoneNumber, ae as updateProfile, v as useDeviceLanguage, ab as verifyBeforeUpdateEmail, a3 as verifyPasswordResetCode } from './index-fd8b7af5.js';
1
+ import { ao as _isAndroid, ap as _isIOS7Or8, aq as _isIOS, ar as _fail, as as _getRedirectUrl, at as debugAssert, au as _getProjectConfig, av as _createError, aw as _assert, ax as AuthEventManager, ay as _getInstance, b as browserLocalPersistence, az as _persistenceKeyName, aA as _clearRedirectOutcomes, a as browserSessionPersistence, aB as _getRedirectResult, aC as _castAuth } from './index-47dd1018.js';
2
+ export { A as ActionCodeOperation, ac as ActionCodeURL, G as AuthCredential, C as AuthErrorCodes, aE as AuthImpl, aH as AuthPopup, H as EmailAuthCredential, L as EmailAuthProvider, M as FacebookAuthProvider, F as FactorId, aI as FetchProvider, Q as GithubAuthProvider, N as GoogleAuthProvider, I as OAuthCredential, T as OAuthProvider, O as OperationType, J as PhoneAuthCredential, P as PhoneAuthProvider, m as PhoneMultiFactorGenerator, o as ProviderId, R as RecaptchaVerifier, aJ as SAMLAuthCredential, U as SAMLAuthProvider, S as SignInMethod, V as TwitterAuthProvider, aD as UserImpl, aw as _assert, aC as _castAuth, ar as _fail, aG as _generateEventId, aF as _getClientVersion, ay as _getInstance, aB as _getRedirectResult, az as _persistenceKeyName, a1 as applyActionCode, b as browserLocalPersistence, k as browserPopupRedirectResolver, a as browserSessionPersistence, a2 as checkActionCode, a0 as confirmPasswordReset, E as connectAuthEmulator, a4 as createUserWithEmailAndPassword, z as debugErrorMap, y as deleteUser, a9 as fetchSignInMethodsForEmail, ak as getAdditionalUserInfo, n as getAuth, ah as getIdToken, ai as getIdTokenResult, am as getMultiFactorResolver, j as getRedirectResult, K as inMemoryPersistence, i as indexedDBLocalPersistence, D as initializeAuth, a7 as isSignInWithEmailLink, Y as linkWithCredential, l as linkWithPhoneNumber, d as linkWithPopup, g as linkWithRedirect, an as multiFactor, t as onAuthStateChanged, q as onIdTokenChanged, ad as parseActionCodeURL, B as prodErrorMap, Z as reauthenticateWithCredential, r as reauthenticateWithPhoneNumber, e as reauthenticateWithPopup, h as reauthenticateWithRedirect, al as reload, aa as sendEmailVerification, $ as sendPasswordResetEmail, a6 as sendSignInLinkToEmail, p as setPersistence, W as signInAnonymously, X as signInWithCredential, _ as signInWithCustomToken, a5 as signInWithEmailAndPassword, a8 as signInWithEmailLink, s as signInWithPhoneNumber, c as signInWithPopup, f as signInWithRedirect, x as signOut, aj as unlink, w as updateCurrentUser, af as updateEmail, ag as updatePassword, u as updatePhoneNumber, ae as updateProfile, v as useDeviceLanguage, ab as verifyBeforeUpdateEmail, a3 as verifyPasswordResetCode } from './index-47dd1018.js';
3
3
  import { __awaiter, __generator, __extends } from 'tslib';
4
4
  import { querystringDecode } from '@firebase/util';
5
5
  import '@firebase/app';
@@ -147,7 +147,7 @@ export interface NamedErrorParams {
147
147
  phoneNumber?: string;
148
148
  tenantId?: string;
149
149
  user?: User;
150
- serverResponse?: object;
150
+ _serverResponse?: object;
151
151
  }
152
152
  /**
153
153
  * @internal
@@ -180,7 +180,7 @@ export interface AuthErrorParams extends GenericAuthErrorParams {
180
180
  };
181
181
  [AuthErrorCode.MFA_REQUIRED]: {
182
182
  appName: AppName;
183
- serverResponse: IdTokenMfaResponse;
183
+ _serverResponse: IdTokenMfaResponse;
184
184
  };
185
185
  [AuthErrorCode.INVALID_CORDOVA_CONFIGURATION]: {
186
186
  appName: AppName;
@@ -26,7 +26,7 @@ export declare abstract class AbstractPopupRedirectOperation implements AuthEven
26
26
  protected readonly auth: AuthInternal;
27
27
  protected readonly resolver: PopupRedirectResolverInternal;
28
28
  protected user?: UserInternal | undefined;
29
- private readonly bypassAuthState;
29
+ protected readonly bypassAuthState: boolean;
30
30
  private pendingPromise;
31
31
  private eventManager;
32
32
  readonly filter: AuthEventType[];
@@ -22,14 +22,13 @@ import { UserInternal } from '../model/user';
22
22
  import { AuthCredential } from '../core/credentials';
23
23
  import { IdTokenMfaResponse } from '../api/authentication/mfa';
24
24
  import { OperationType } from '../model/enums';
25
+ export declare type MultiFactorErrorData = MultiFactorErrorPublic['customData'] & {
26
+ _serverResponse: IdTokenMfaResponse;
27
+ };
25
28
  export declare class MultiFactorError extends FirebaseError implements MultiFactorErrorPublic {
26
29
  readonly operationType: OperationType;
27
30
  readonly user?: UserInternal | undefined;
28
- readonly name = "FirebaseError";
29
- readonly code: string;
30
- readonly appName: string;
31
- readonly serverResponse: IdTokenMfaResponse;
32
- readonly tenantId?: string;
31
+ readonly customData: MultiFactorErrorData;
33
32
  private constructor();
34
33
  static _fromErrorAndOperation(auth: AuthInternal, error: FirebaseError, operationType: OperationType, user?: UserInternal): MultiFactorError;
35
34
  }
@@ -101,21 +101,24 @@ export declare type NextOrObserver<T> = NextFn<T | null> | Observer<T | null>;
101
101
  * @public
102
102
  */
103
103
  export interface AuthError extends FirebaseError {
104
- /** The name of the Firebase App which triggered this error. */
105
- readonly appName: string;
106
- /** The email of the user's account, used for sign-in/linking. */
107
- readonly email?: string;
108
- /** The phone number of the user's account, used for sign-in/linking. */
109
- readonly phoneNumber?: string;
110
- /**
111
- * The tenant ID being used for sign-in/linking.
112
- *
113
- * @remarks
114
- * If you use {@link signInWithRedirect} to sign in,
115
- * you have to set the tenant ID on {@link Auth} instance again as the tenant ID is not persisted
116
- * after redirection.
117
- */
118
- readonly tenantid?: string;
104
+ /** Details about the Firebase Auth error. */
105
+ readonly customData: {
106
+ /** The name of the Firebase App which triggered this error. */
107
+ readonly appName: string;
108
+ /** The email address of the user's account, used for sign-in and linking. */
109
+ readonly email?: string;
110
+ /** The phone number of the user's account, used for sign-in and linking. */
111
+ readonly phoneNumber?: string;
112
+ /**
113
+ * The tenant ID being used for sign-in and linking.
114
+ *
115
+ * @remarks
116
+ * If you use {@link signInWithRedirect} to sign in,
117
+ * you have to set the tenant ID on the {@link Auth} instance again as the tenant ID is not persisted
118
+ * after redirection.
119
+ */
120
+ readonly tenantId?: string;
121
+ };
119
122
  }
120
123
  /**
121
124
  * Interface representing an {@link Auth} instance's settings.
@@ -559,10 +562,13 @@ export interface MultiFactorAssertion {
559
562
  * @public
560
563
  */
561
564
  export interface MultiFactorError extends AuthError {
562
- /**
563
- * The type of operation (e.g., sign-in, link, or reauthenticate) during which the error was raised.
564
- */
565
- readonly operationType: typeof OperationTypeMap[keyof typeof OperationTypeMap];
565
+ /** Details about the MultiFactorError. */
566
+ readonly customData: AuthError['customData'] & {
567
+ /**
568
+ * The type of operation (sign-in, linking, or re-authentication) that raised the error.
569
+ */
570
+ readonly operationType: typeof OperationTypeMap[keyof typeof OperationTypeMap];
571
+ };
566
572
  }
567
573
  /**
568
574
  * A structure containing the information of a second factor entity.
@@ -16,11 +16,12 @@
16
16
  */
17
17
  import { PersistenceValue, PersistenceType } from '../../core/persistence';
18
18
  export declare abstract class BrowserPersistenceClass {
19
- protected readonly storage: Storage;
19
+ protected readonly storageRetriever: () => Storage;
20
20
  readonly type: PersistenceType;
21
- protected constructor(storage: Storage, type: PersistenceType);
22
- _isAvailable(this: BrowserPersistenceClass): Promise<boolean>;
21
+ protected constructor(storageRetriever: () => Storage, type: PersistenceType);
22
+ _isAvailable(): Promise<boolean>;
23
23
  _set(key: string, value: PersistenceValue): Promise<void>;
24
24
  _get<T extends PersistenceValue>(key: string): Promise<T | null>;
25
25
  _remove(key: string): Promise<void>;
26
+ protected get storage(): Storage;
26
27
  }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2021 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ export {};
@@ -29,6 +29,9 @@ import { AuthInternal } from '../../model/auth';
29
29
  *
30
30
  * For abuse prevention, this method also requires a {@link ApplicationVerifier}.
31
31
  * This SDK includes a reCAPTCHA-based implementation, {@link RecaptchaVerifier}.
32
+ * This function can work on other platforms that do not support the
33
+ * {@link RecaptchaVerifier} (like React Native), but you need to use a
34
+ * third-party {@link ApplicationVerifier} implementation.
32
35
  *
33
36
  * @example
34
37
  * ```javascript
@@ -0,0 +1,36 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2020 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { PersistenceInternal, PersistenceType, PersistenceValue } from '../../src/core/persistence';
18
+ /**
19
+ * Helper class for mocking completely broken persistence that errors when
20
+ * accessed.
21
+ *
22
+ * When disabling cookies in Chrome entirely, for example, simply reading the
23
+ * "localStorage" field in "window" will throw an error, but this can't be
24
+ * checked for by calling `'localStorage' in window`. This class simulates a
25
+ * situation where _isAvailable works correctly but all other methods fail.
26
+ */
27
+ export declare class ErroringUnavailablePersistence implements PersistenceInternal {
28
+ type: PersistenceType;
29
+ _isAvailable(): Promise<boolean>;
30
+ _set(): Promise<void>;
31
+ _get<T extends PersistenceValue>(): Promise<T | null>;
32
+ _remove(): Promise<void>;
33
+ _addListener(): void;
34
+ _removeListener(): void;
35
+ _shouldAllowMigration: boolean;
36
+ }
@@ -17,6 +17,9 @@
17
17
  import { FirebaseApp } from '@firebase/app';
18
18
  import { Auth, Persistence } from './src/model/public_types';
19
19
  export * from './index.shared';
20
+ export { PhoneAuthProvider } from './src/platform_browser/providers/phone';
21
+ export { signInWithPhoneNumber, linkWithPhoneNumber, reauthenticateWithPhoneNumber, updatePhoneNumber } from './src/platform_browser/strategies/phone';
22
+ export { PhoneMultiFactorGenerator } from './src/platform_browser/mfa/assertions/phone';
20
23
  /**
21
24
  * An implementation of {@link Persistence} of type 'LOCAL' for use in React
22
25
  * Native environments.
@@ -522,7 +522,7 @@ function _initializeAuthInstance(auth, deps) {
522
522
  }
523
523
 
524
524
  var name = "@firebase/auth";
525
- var version = "0.18.3";
525
+ var version = "0.19.0";
526
526
 
527
527
  /**
528
528
  * @license
@@ -1081,7 +1081,7 @@ function _performSignInRequest(auth, method, path, request, customErrorMap) {
1081
1081
  serverResponse = (_a.sent());
1082
1082
  if ('mfaPendingCredential' in serverResponse) {
1083
1083
  _fail(auth, "multi-factor-auth-required" /* MFA_REQUIRED */, {
1084
- serverResponse: serverResponse
1084
+ _serverResponse: serverResponse
1085
1085
  });
1086
1086
  }
1087
1087
  return [2 /*return*/, serverResponse];
@@ -6100,14 +6100,14 @@ var MultiFactorError = /** @class */ (function (_super) {
6100
6100
  var _this = _super.call(this, error.code, error.message) || this;
6101
6101
  _this.operationType = operationType;
6102
6102
  _this.user = user;
6103
- _this.name = 'FirebaseError';
6104
6103
  // https://github.com/Microsoft/TypeScript-wiki/blob/master/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work
6105
6104
  Object.setPrototypeOf(_this, MultiFactorError.prototype);
6106
- _this.appName = auth.name;
6107
- _this.code = error.code;
6108
- _this.tenantId = (_a = auth.tenantId) !== null && _a !== void 0 ? _a : undefined;
6109
- _this.serverResponse = error.customData
6110
- .serverResponse;
6105
+ _this.customData = {
6106
+ appName: auth.name,
6107
+ tenantId: (_a = auth.tenantId) !== null && _a !== void 0 ? _a : undefined,
6108
+ _serverResponse: error.customData._serverResponse,
6109
+ operationType: operationType,
6110
+ };
6111
6111
  return _this;
6112
6112
  }
6113
6113
  MultiFactorError._fromErrorAndOperation = function (auth, error, operationType, user) {
@@ -7645,11 +7645,12 @@ var MultiFactorResolverImpl = /** @class */ (function () {
7645
7645
  MultiFactorResolverImpl._fromError = function (authExtern, error) {
7646
7646
  var _this = this;
7647
7647
  var auth = _castAuth(authExtern);
7648
- var hints = (error.serverResponse.mfaInfo || []).map(function (enrollment) {
7648
+ var serverResponse = error.customData._serverResponse;
7649
+ var hints = (serverResponse.mfaInfo || []).map(function (enrollment) {
7649
7650
  return MultiFactorInfoImpl._fromServerResponse(auth, enrollment);
7650
7651
  });
7651
- _assert(error.serverResponse.mfaPendingCredential, auth, "internal-error" /* INTERNAL_ERROR */);
7652
- var session = MultiFactorSessionImpl._fromMfaPendingCredential(error.serverResponse.mfaPendingCredential);
7652
+ _assert(serverResponse.mfaPendingCredential, auth, "internal-error" /* INTERNAL_ERROR */);
7653
+ var session = MultiFactorSessionImpl._fromMfaPendingCredential(serverResponse.mfaPendingCredential);
7653
7654
  return new MultiFactorResolverImpl(session, hints, function (assertion) { return __awaiter(_this, void 0, void 0, function () {
7654
7655
  var mfaResponse, idTokenResponse, _a, userCredential;
7655
7656
  return __generator(this, function (_b) {
@@ -7658,9 +7659,9 @@ var MultiFactorResolverImpl = /** @class */ (function () {
7658
7659
  case 1:
7659
7660
  mfaResponse = _b.sent();
7660
7661
  // Clear out the unneeded fields from the old login response
7661
- delete error.serverResponse.mfaInfo;
7662
- delete error.serverResponse.mfaPendingCredential;
7663
- idTokenResponse = __assign(__assign({}, error.serverResponse), { idToken: mfaResponse.idToken, refreshToken: mfaResponse.refreshToken });
7662
+ delete serverResponse.mfaInfo;
7663
+ delete serverResponse.mfaPendingCredential;
7664
+ idTokenResponse = __assign(__assign({}, serverResponse), { idToken: mfaResponse.idToken, refreshToken: mfaResponse.refreshToken });
7664
7665
  _a = error.operationType;
7665
7666
  switch (_a) {
7666
7667
  case "signIn" /* SIGN_IN */: return [3 /*break*/, 2];
@@ -7710,8 +7711,8 @@ function getMultiFactorResolver(auth, error) {
7710
7711
  var _a;
7711
7712
  var authModular = getModularInstance(auth);
7712
7713
  var errorInternal = error;
7713
- _assert(error.operationType, authModular, "argument-error" /* ARGUMENT_ERROR */);
7714
- _assert((_a = errorInternal.serverResponse) === null || _a === void 0 ? void 0 : _a.mfaPendingCredential, authModular, "argument-error" /* ARGUMENT_ERROR */);
7714
+ _assert(error.customData.operationType, authModular, "argument-error" /* ARGUMENT_ERROR */);
7715
+ _assert((_a = errorInternal.customData._serverResponse) === null || _a === void 0 ? void 0 : _a.mfaPendingCredential, authModular, "argument-error" /* ARGUMENT_ERROR */);
7715
7716
  return MultiFactorResolverImpl._fromError(authModular, errorInternal);
7716
7717
  }
7717
7718