@firebase/auth 1.4.0-canary.a89e05bfc → 1.4.0-canary.b782bb270

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 (80) hide show
  1. package/dist/auth-public.d.ts +14 -2
  2. package/dist/auth.d.ts +15 -3
  3. package/dist/browser-cjs/{index-45eace57.js → index-0a8f190c.js} +23 -8
  4. package/dist/browser-cjs/index-0a8f190c.js.map +1 -0
  5. package/dist/browser-cjs/index.js +1 -1
  6. package/dist/browser-cjs/internal.js +1 -1
  7. package/dist/browser-cjs/src/api/errors.d.ts +1 -0
  8. package/dist/browser-cjs/src/core/errors.d.ts +2 -1
  9. package/dist/browser-cjs/src/core/strategies/email.d.ts +5 -1
  10. package/dist/browser-cjs/src/core/strategies/email_and_password.d.ts +5 -1
  11. package/dist/browser-cjs/src/core/user/account_info.d.ts +3 -0
  12. package/dist/cordova/index.js +2 -2
  13. package/dist/cordova/internal.js +2 -2
  14. package/dist/cordova/{popup_redirect-b9561938.js → popup_redirect-6895ce5c.js} +23 -8
  15. package/dist/cordova/popup_redirect-6895ce5c.js.map +1 -0
  16. package/dist/cordova/src/api/errors.d.ts +1 -0
  17. package/dist/cordova/src/core/errors.d.ts +2 -1
  18. package/dist/cordova/src/core/strategies/email.d.ts +5 -1
  19. package/dist/cordova/src/core/strategies/email_and_password.d.ts +5 -1
  20. package/dist/cordova/src/core/user/account_info.d.ts +3 -0
  21. package/dist/esm2017/{index-7cf9b6e6.js → index-51a11e45.js} +23 -8
  22. package/dist/esm2017/index-51a11e45.js.map +1 -0
  23. package/dist/esm2017/index.js +1 -1
  24. package/dist/esm2017/internal.js +2 -2
  25. package/dist/esm2017/src/api/errors.d.ts +1 -0
  26. package/dist/esm2017/src/core/errors.d.ts +2 -1
  27. package/dist/esm2017/src/core/strategies/email.d.ts +5 -1
  28. package/dist/esm2017/src/core/strategies/email_and_password.d.ts +5 -1
  29. package/dist/esm2017/src/core/user/account_info.d.ts +3 -0
  30. package/dist/esm5/{index-13ceeca9.js → index-918b712b.js} +23 -8
  31. package/dist/esm5/index-918b712b.js.map +1 -0
  32. package/dist/esm5/index.js +1 -1
  33. package/dist/esm5/internal.js +2 -2
  34. package/dist/esm5/src/api/errors.d.ts +1 -0
  35. package/dist/esm5/src/core/errors.d.ts +2 -1
  36. package/dist/esm5/src/core/strategies/email.d.ts +5 -1
  37. package/dist/esm5/src/core/strategies/email_and_password.d.ts +5 -1
  38. package/dist/esm5/src/core/user/account_info.d.ts +3 -0
  39. package/dist/index.webworker.esm5.js +22 -7
  40. package/dist/index.webworker.esm5.js.map +1 -1
  41. package/dist/node/index.js +2 -2
  42. package/dist/node/internal.js +2 -2
  43. package/dist/node/src/api/errors.d.ts +1 -0
  44. package/dist/node/src/core/errors.d.ts +2 -1
  45. package/dist/node/src/core/strategies/email.d.ts +5 -1
  46. package/dist/node/src/core/strategies/email_and_password.d.ts +5 -1
  47. package/dist/node/src/core/user/account_info.d.ts +3 -0
  48. package/dist/node/{totp-e8b77416.js → totp-8934ca02.js} +25 -30
  49. package/dist/node/totp-8934ca02.js.map +1 -0
  50. package/dist/node-esm/index.js +2 -2
  51. package/dist/node-esm/internal.js +3 -3
  52. package/dist/node-esm/src/api/errors.d.ts +1 -0
  53. package/dist/node-esm/src/core/errors.d.ts +2 -1
  54. package/dist/node-esm/src/core/strategies/email.d.ts +5 -1
  55. package/dist/node-esm/src/core/strategies/email_and_password.d.ts +5 -1
  56. package/dist/node-esm/src/core/user/account_info.d.ts +3 -0
  57. package/dist/node-esm/{totp-caa6c436.js → totp-b1e989f6.js} +25 -10
  58. package/dist/node-esm/totp-b1e989f6.js.map +1 -0
  59. package/dist/rn/{index-b0222f52.js → index-89cbfb20.js} +23 -8
  60. package/dist/rn/index-89cbfb20.js.map +1 -0
  61. package/dist/rn/index.js +1 -1
  62. package/dist/rn/internal.js +1 -1
  63. package/dist/rn/src/api/errors.d.ts +1 -0
  64. package/dist/rn/src/core/errors.d.ts +2 -1
  65. package/dist/rn/src/core/strategies/email.d.ts +5 -1
  66. package/dist/rn/src/core/strategies/email_and_password.d.ts +5 -1
  67. package/dist/rn/src/core/user/account_info.d.ts +3 -0
  68. package/dist/src/api/errors.d.ts +1 -0
  69. package/dist/src/core/errors.d.ts +2 -1
  70. package/dist/src/core/strategies/email.d.ts +5 -1
  71. package/dist/src/core/strategies/email_and_password.d.ts +5 -1
  72. package/dist/src/core/user/account_info.d.ts +3 -0
  73. package/package.json +7 -7
  74. package/dist/browser-cjs/index-45eace57.js.map +0 -1
  75. package/dist/cordova/popup_redirect-b9561938.js.map +0 -1
  76. package/dist/esm2017/index-7cf9b6e6.js.map +0 -1
  77. package/dist/esm5/index-13ceeca9.js.map +0 -1
  78. package/dist/node/totp-e8b77416.js.map +0 -1
  79. package/dist/node-esm/totp-caa6c436.js.map +0 -1
  80. package/dist/rn/index-b0222f52.js.map +0 -1
@@ -2,12 +2,12 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var totp = require('./totp-e8b77416.js');
5
+ var totp = require('./totp-8934ca02.js');
6
6
  require('tslib');
7
7
  require('@firebase/util');
8
8
  require('@firebase/app');
9
9
  require('@firebase/component');
10
- require('node-fetch');
10
+ require('undici');
11
11
  require('@firebase/logger');
12
12
 
13
13
 
@@ -2,12 +2,12 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var totp = require('./totp-e8b77416.js');
5
+ var totp = require('./totp-8934ca02.js');
6
6
  var tslib = require('tslib');
7
7
  var util = require('@firebase/util');
8
8
  var app = require('@firebase/app');
9
9
  require('@firebase/component');
10
- require('node-fetch');
10
+ require('undici');
11
11
  require('@firebase/logger');
12
12
 
13
13
  /**
@@ -42,6 +42,7 @@ export declare const enum ServerError {
42
42
  INVALID_ID_TOKEN = "INVALID_ID_TOKEN",
43
43
  INVALID_IDP_RESPONSE = "INVALID_IDP_RESPONSE",
44
44
  INVALID_IDENTIFIER = "INVALID_IDENTIFIER",
45
+ INVALID_LOGIN_CREDENTIALS = "INVALID_LOGIN_CREDENTIALS",
45
46
  INVALID_MESSAGE_PAYLOAD = "INVALID_MESSAGE_PAYLOAD",
46
47
  INVALID_MFA_PENDING_CREDENTIAL = "INVALID_MFA_PENDING_CREDENTIAL",
47
48
  INVALID_OAUTH_CLIENT_ID = "INVALID_OAUTH_CLIENT_ID",
@@ -57,7 +57,7 @@ export declare const enum AuthErrorCode {
57
57
  INVALID_DYNAMIC_LINK_DOMAIN = "invalid-dynamic-link-domain",
58
58
  INVALID_EMAIL = "invalid-email",
59
59
  INVALID_EMULATOR_SCHEME = "invalid-emulator-scheme",
60
- INVALID_IDP_RESPONSE = "invalid-credential",
60
+ INVALID_CREDENTIAL = "invalid-credential",
61
61
  INVALID_MESSAGE_PAYLOAD = "invalid-message-payload",
62
62
  INVALID_MFA_SESSION = "invalid-multi-factor-session",
63
63
  INVALID_OAUTH_CLIENT_ID = "invalid-oauth-client-id",
@@ -250,6 +250,7 @@ export declare const AUTH_ERROR_CODES_MAP_DO_NOT_USE_INTERNALLY: {
250
250
  readonly INVALID_EMAIL: "auth/invalid-email";
251
251
  readonly INVALID_EMULATOR_SCHEME: "auth/invalid-emulator-scheme";
252
252
  readonly INVALID_IDP_RESPONSE: "auth/invalid-credential";
253
+ readonly INVALID_LOGIN_CREDENTIALS: "auth/invalid-credential";
253
254
  readonly INVALID_MESSAGE_PAYLOAD: "auth/invalid-message-payload";
254
255
  readonly INVALID_MFA_SESSION: "auth/invalid-multi-factor-session";
255
256
  readonly INVALID_OAUTH_CLIENT_ID: "auth/invalid-oauth-client-id";
@@ -16,7 +16,9 @@
16
16
  */
17
17
  import { ActionCodeSettings, Auth, User } from '../../model/public_types';
18
18
  /**
19
- * Gets the list of possible sign in methods for the given email address.
19
+ * Gets the list of possible sign in methods for the given email address. This method returns an
20
+ * empty list when [Email Enumeration Protection](https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection) is enabled, irrespective of the number of
21
+ * authentication methods available for the given email.
20
22
  *
21
23
  * @remarks
22
24
  * This is useful to differentiate methods of sign-in for the same provider, eg.
@@ -27,6 +29,8 @@ import { ActionCodeSettings, Auth, User } from '../../model/public_types';
27
29
  * @param auth - The {@link Auth} instance.
28
30
  * @param email - The user's email address.
29
31
  *
32
+ * Deprecated. Migrating off of this method is recommended as a security best-practice.
33
+ * Learn more in the Identity Platform documentation for [Email Enumeration Protection](https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection).
30
34
  * @public
31
35
  */
32
36
  export declare function fetchSignInMethodsForEmail(auth: Auth, email: string): Promise<string[]>;
@@ -16,7 +16,9 @@
16
16
  */
17
17
  import { ActionCodeInfo, ActionCodeSettings, Auth, UserCredential } from '../../model/public_types';
18
18
  /**
19
- * Sends a password reset email to the given email address.
19
+ * Sends a password reset email to the given email address. This method does not throw an error when
20
+ * there's no user account with the given email address and
21
+ * [Email Enumeration Protection](https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection) is enabled.
20
22
  *
21
23
  * @remarks
22
24
  * To complete the password reset, call {@link confirmPasswordReset} with the code supplied in
@@ -112,6 +114,8 @@ export declare function createUserWithEmailAndPassword(auth: Auth, email: string
112
114
  *
113
115
  * @remarks
114
116
  * Fails with an error if the email address and password do not match.
117
+ * When [Email Enumeration Protection](https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection) is enabled,
118
+ * this method fails with "auth/invalid-credential" in case of an invalid email/password.
115
119
  *
116
120
  * Note: The user's password is NOT the password used to access the user's email account. The
117
121
  * email address serves as a unique identifier for the user, and the password is used to access
@@ -41,6 +41,9 @@ export declare function updateProfile(user: User, { displayName, photoURL: photo
41
41
  * @param user - The user.
42
42
  * @param newEmail - The new email address.
43
43
  *
44
+ * Throws "auth/operation-not-allowed" error when [Email Enumeration Protection](https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection) is enabled.
45
+ * Deprecated - Use {@link verifyBeforeUpdateEmail} instead.
46
+ *
44
47
  * @public
45
48
  */
46
49
  export declare function updateEmail(user: User, newEmail: string): Promise<void>;
@@ -4,29 +4,9 @@ var tslib = require('tslib');
4
4
  var util = require('@firebase/util');
5
5
  var app = require('@firebase/app');
6
6
  var component = require('@firebase/component');
7
- var fetchImpl = require('node-fetch');
7
+ var undici = require('undici');
8
8
  var logger = require('@firebase/logger');
9
9
 
10
- function _interopNamespace(e) {
11
- if (e && e.__esModule) return e;
12
- var n = Object.create(null);
13
- if (e) {
14
- Object.keys(e).forEach(function (k) {
15
- if (k !== 'default') {
16
- var d = Object.getOwnPropertyDescriptor(e, k);
17
- Object.defineProperty(n, k, d.get ? d : {
18
- enumerable: true,
19
- get: function () { return e[k]; }
20
- });
21
- }
22
- });
23
- }
24
- n["default"] = e;
25
- return Object.freeze(n);
26
- }
27
-
28
- var fetchImpl__namespace = /*#__PURE__*/_interopNamespace(fetchImpl);
29
-
30
10
  /**
31
11
  * @license
32
12
  * Copyright 2021 Google LLC
@@ -198,7 +178,7 @@ function _debugErrorMap() {
198
178
  _a["invalid-emulator-scheme" /* AuthErrorCode.INVALID_EMULATOR_SCHEME */] = 'Emulator URL must start with a valid scheme (http:// or https://).',
199
179
  _a["invalid-api-key" /* AuthErrorCode.INVALID_API_KEY */] = 'Your API key is invalid, please check you have copied it correctly.',
200
180
  _a["invalid-cert-hash" /* AuthErrorCode.INVALID_CERT_HASH */] = 'The SHA-1 certificate hash provided is invalid.',
201
- _a["invalid-credential" /* AuthErrorCode.INVALID_IDP_RESPONSE */] = 'The supplied auth credential is malformed or has expired.',
181
+ _a["invalid-credential" /* AuthErrorCode.INVALID_CREDENTIAL */] = 'The supplied auth credential is incorrect, malformed or has expired.',
202
182
  _a["invalid-message-payload" /* AuthErrorCode.INVALID_MESSAGE_PAYLOAD */] = 'The email template corresponding to this action contains invalid characters in its message. ' +
203
183
  'Please fix by going to the Auth email templates section in the Firebase Console.',
204
184
  _a["invalid-multi-factor-session" /* AuthErrorCode.INVALID_MFA_SESSION */] = 'The request does not contain a valid proof of first factor successful sign-in.',
@@ -375,6 +355,7 @@ var AUTH_ERROR_CODES_MAP_DO_NOT_USE_INTERNALLY = {
375
355
  INVALID_EMAIL: 'auth/invalid-email',
376
356
  INVALID_EMULATOR_SCHEME: 'auth/invalid-emulator-scheme',
377
357
  INVALID_IDP_RESPONSE: 'auth/invalid-credential',
358
+ INVALID_LOGIN_CREDENTIALS: 'auth/invalid-credential',
378
359
  INVALID_MESSAGE_PAYLOAD: 'auth/invalid-message-payload',
379
360
  INVALID_MFA_SESSION: 'auth/invalid-multi-factor-session',
380
361
  INVALID_OAUTH_CLIENT_ID: 'auth/invalid-oauth-client-id',
@@ -830,12 +811,15 @@ var SERVER_ERROR_MAP = (_a$1 = {},
830
811
  _a$1["INVALID_PASSWORD" /* ServerError.INVALID_PASSWORD */] = "wrong-password" /* AuthErrorCode.INVALID_PASSWORD */,
831
812
  // This can only happen if the SDK sends a bad request.
832
813
  _a$1["MISSING_PASSWORD" /* ServerError.MISSING_PASSWORD */] = "missing-password" /* AuthErrorCode.MISSING_PASSWORD */,
814
+ // Thrown if Email Enumeration Protection is enabled in the project and the email or password is
815
+ // invalid.
816
+ _a$1["INVALID_LOGIN_CREDENTIALS" /* ServerError.INVALID_LOGIN_CREDENTIALS */] = "invalid-credential" /* AuthErrorCode.INVALID_CREDENTIAL */,
833
817
  // Sign up with email and password errors.
834
818
  _a$1["EMAIL_EXISTS" /* ServerError.EMAIL_EXISTS */] = "email-already-in-use" /* AuthErrorCode.EMAIL_EXISTS */,
835
819
  _a$1["PASSWORD_LOGIN_DISABLED" /* ServerError.PASSWORD_LOGIN_DISABLED */] = "operation-not-allowed" /* AuthErrorCode.OPERATION_NOT_ALLOWED */,
836
820
  // Verify assertion for sign in with credential errors:
837
- _a$1["INVALID_IDP_RESPONSE" /* ServerError.INVALID_IDP_RESPONSE */] = "invalid-credential" /* AuthErrorCode.INVALID_IDP_RESPONSE */,
838
- _a$1["INVALID_PENDING_TOKEN" /* ServerError.INVALID_PENDING_TOKEN */] = "invalid-credential" /* AuthErrorCode.INVALID_IDP_RESPONSE */,
821
+ _a$1["INVALID_IDP_RESPONSE" /* ServerError.INVALID_IDP_RESPONSE */] = "invalid-credential" /* AuthErrorCode.INVALID_CREDENTIAL */,
822
+ _a$1["INVALID_PENDING_TOKEN" /* ServerError.INVALID_PENDING_TOKEN */] = "invalid-credential" /* AuthErrorCode.INVALID_CREDENTIAL */,
839
823
  _a$1["FEDERATED_USER_ID_ALREADY_LINKED" /* ServerError.FEDERATED_USER_ID_ALREADY_LINKED */] = "credential-already-in-use" /* AuthErrorCode.CREDENTIAL_ALREADY_IN_USE */,
840
824
  // This can only happen if the SDK sends a bad request.
841
825
  _a$1["MISSING_REQ_TYPE" /* ServerError.MISSING_REQ_TYPE */] = "internal-error" /* AuthErrorCode.INTERNAL_ERROR */,
@@ -857,7 +841,7 @@ var SERVER_ERROR_MAP = (_a$1 = {},
857
841
  // Phone Auth related errors.
858
842
  _a$1["INVALID_CODE" /* ServerError.INVALID_CODE */] = "invalid-verification-code" /* AuthErrorCode.INVALID_CODE */,
859
843
  _a$1["INVALID_SESSION_INFO" /* ServerError.INVALID_SESSION_INFO */] = "invalid-verification-id" /* AuthErrorCode.INVALID_SESSION_INFO */,
860
- _a$1["INVALID_TEMPORARY_PROOF" /* ServerError.INVALID_TEMPORARY_PROOF */] = "invalid-credential" /* AuthErrorCode.INVALID_IDP_RESPONSE */,
844
+ _a$1["INVALID_TEMPORARY_PROOF" /* ServerError.INVALID_TEMPORARY_PROOF */] = "invalid-credential" /* AuthErrorCode.INVALID_CREDENTIAL */,
861
845
  _a$1["MISSING_SESSION_INFO" /* ServerError.MISSING_SESSION_INFO */] = "missing-verification-id" /* AuthErrorCode.MISSING_SESSION_INFO */,
862
846
  _a$1["SESSION_EXPIRED" /* ServerError.SESSION_EXPIRED */] = "code-expired" /* AuthErrorCode.CODE_EXPIRED */,
863
847
  // Other action code errors when additional settings passed.
@@ -6593,7 +6577,9 @@ function recachePasswordPolicy(auth) {
6593
6577
  });
6594
6578
  }
6595
6579
  /**
6596
- * Sends a password reset email to the given email address.
6580
+ * Sends a password reset email to the given email address. This method does not throw an error when
6581
+ * there's no user account with the given email address and
6582
+ * [Email Enumeration Protection](https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection) is enabled.
6597
6583
  *
6598
6584
  * @remarks
6599
6585
  * To complete the password reset, call {@link confirmPasswordReset} with the code supplied in
@@ -6834,6 +6820,8 @@ function createUserWithEmailAndPassword(auth, email, password) {
6834
6820
  *
6835
6821
  * @remarks
6836
6822
  * Fails with an error if the email address and password do not match.
6823
+ * When [Email Enumeration Protection](https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection) is enabled,
6824
+ * this method fails with "auth/invalid-credential" in case of an invalid email/password.
6837
6825
  *
6838
6826
  * Note: The user's password is NOT the password used to access the user's email account. The
6839
6827
  * email address serves as a unique identifier for the user, and the password is used to access
@@ -7042,7 +7030,9 @@ function createAuthUri(auth, request) {
7042
7030
  * limitations under the License.
7043
7031
  */
7044
7032
  /**
7045
- * Gets the list of possible sign in methods for the given email address.
7033
+ * Gets the list of possible sign in methods for the given email address. This method returns an
7034
+ * empty list when [Email Enumeration Protection](https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection) is enabled, irrespective of the number of
7035
+ * authentication methods available for the given email.
7046
7036
  *
7047
7037
  * @remarks
7048
7038
  * This is useful to differentiate methods of sign-in for the same provider, eg.
@@ -7053,6 +7043,8 @@ function createAuthUri(auth, request) {
7053
7043
  * @param auth - The {@link Auth} instance.
7054
7044
  * @param email - The user's email address.
7055
7045
  *
7046
+ * Deprecated. Migrating off of this method is recommended as a security best-practice.
7047
+ * Learn more in the Identity Platform documentation for [Email Enumeration Protection](https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection).
7056
7048
  * @public
7057
7049
  */
7058
7050
  function fetchSignInMethodsForEmail(auth, email) {
@@ -7307,6 +7299,9 @@ function updateProfile(user, _a) {
7307
7299
  * @param user - The user.
7308
7300
  * @param newEmail - The new email address.
7309
7301
  *
7302
+ * Throws "auth/operation-not-allowed" error when [Email Enumeration Protection](https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection) is enabled.
7303
+ * Deprecated - Use {@link verifyBeforeUpdateEmail} instead.
7304
+ *
7310
7305
  * @public
7311
7306
  */
7312
7307
  function updateEmail(user, newEmail) {
@@ -8019,7 +8014,7 @@ function multiFactor(user) {
8019
8014
  }
8020
8015
 
8021
8016
  var name = "@firebase/auth";
8022
- var version = "1.4.0-canary.a89e05bfc";
8017
+ var version = "1.4.0-canary.b782bb270";
8023
8018
 
8024
8019
  /**
8025
8020
  * @license
@@ -8194,7 +8189,7 @@ function registerAuth(clientPlatform) {
8194
8189
  * limitations under the License.
8195
8190
  */
8196
8191
  // Initialize the fetch polyfill, the types are slightly off so just cast and hope for the best
8197
- FetchProvider.initialize(fetchImpl__namespace.default, fetchImpl__namespace.Headers, fetchImpl__namespace.Response);
8192
+ FetchProvider.initialize(undici.fetch, undici.Headers, undici.Response);
8198
8193
  // First, we set up the various platform-specific features for Node (register
8199
8194
  // the version and declare the Node getAuth function)
8200
8195
  function getAuth(app$1) {
@@ -8591,4 +8586,4 @@ exports.useDeviceLanguage = useDeviceLanguage;
8591
8586
  exports.validatePassword = validatePassword;
8592
8587
  exports.verifyBeforeUpdateEmail = verifyBeforeUpdateEmail;
8593
8588
  exports.verifyPasswordResetCode = verifyPasswordResetCode;
8594
- //# sourceMappingURL=totp-e8b77416.js.map
8589
+ //# sourceMappingURL=totp-8934ca02.js.map