@firebase/auth 0.22.0-canary.852ded64d → 0.22.0-canary.ea3849fff

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 (91) hide show
  1. package/dist/auth.d.ts +1 -0
  2. package/dist/browser-cjs/{index-845ba5cf.js → index-a4932583.js} +62 -26
  3. package/dist/browser-cjs/index-a4932583.js.map +1 -0
  4. package/dist/browser-cjs/index.js +1 -1
  5. package/dist/browser-cjs/internal.js +1 -1
  6. package/dist/browser-cjs/src/api/index.d.ts +2 -1
  7. package/dist/browser-cjs/src/core/auth/auth_impl.d.ts +4 -1
  8. package/dist/browser-cjs/src/core/util/handler.d.ts +1 -1
  9. package/dist/browser-cjs/src/core/util/log.d.ts +1 -0
  10. package/dist/browser-cjs/src/model/auth.d.ts +1 -0
  11. package/dist/browser-cjs/test/helpers/mock_auth.d.ts +5 -0
  12. package/dist/cordova/index.js +2 -2
  13. package/dist/cordova/internal.js +15 -6
  14. package/dist/cordova/internal.js.map +1 -1
  15. package/dist/cordova/{popup_redirect-77fcd73a.js → popup_redirect-e2867f33.js} +120 -64
  16. package/dist/cordova/popup_redirect-e2867f33.js.map +1 -0
  17. package/dist/cordova/src/api/index.d.ts +2 -1
  18. package/dist/cordova/src/core/auth/auth_impl.d.ts +4 -1
  19. package/dist/cordova/src/core/util/handler.d.ts +1 -1
  20. package/dist/cordova/src/core/util/log.d.ts +1 -0
  21. package/dist/cordova/src/model/auth.d.ts +1 -0
  22. package/dist/cordova/test/helpers/mock_auth.d.ts +5 -0
  23. package/dist/esm2017/{index-c088f05c.js → index-5eca8e8e.js} +62 -26
  24. package/dist/esm2017/index-5eca8e8e.js.map +1 -0
  25. package/dist/esm2017/index.js +1 -1
  26. package/dist/esm2017/internal.js +2 -2
  27. package/dist/esm2017/src/api/index.d.ts +2 -1
  28. package/dist/esm2017/src/core/auth/auth_impl.d.ts +4 -1
  29. package/dist/esm2017/src/core/util/handler.d.ts +1 -1
  30. package/dist/esm2017/src/core/util/log.d.ts +1 -0
  31. package/dist/esm2017/src/model/auth.d.ts +1 -0
  32. package/dist/esm2017/test/helpers/mock_auth.d.ts +5 -0
  33. package/dist/esm5/{index-7119ea16.js → index-ea49ccf6.js} +133 -68
  34. package/dist/esm5/index-ea49ccf6.js.map +1 -0
  35. package/dist/esm5/index.js +1 -1
  36. package/dist/esm5/internal.js +2 -2
  37. package/dist/esm5/src/api/index.d.ts +2 -1
  38. package/dist/esm5/src/core/auth/auth_impl.d.ts +4 -1
  39. package/dist/esm5/src/core/util/handler.d.ts +1 -1
  40. package/dist/esm5/src/core/util/log.d.ts +1 -0
  41. package/dist/esm5/src/model/auth.d.ts +1 -0
  42. package/dist/esm5/test/helpers/mock_auth.d.ts +5 -0
  43. package/dist/index.webworker.esm5.js +59 -22
  44. package/dist/index.webworker.esm5.js.map +1 -1
  45. package/dist/node/index.js +1 -1
  46. package/dist/node/internal.js +61 -42
  47. package/dist/node/internal.js.map +1 -1
  48. package/dist/node/src/api/index.d.ts +2 -1
  49. package/dist/node/src/core/auth/auth_impl.d.ts +4 -1
  50. package/dist/node/src/core/util/handler.d.ts +1 -1
  51. package/dist/node/src/core/util/log.d.ts +1 -0
  52. package/dist/node/src/model/auth.d.ts +1 -0
  53. package/dist/node/test/helpers/mock_auth.d.ts +5 -0
  54. package/dist/node/{totp-220d9279.js → totp-e4b57fc2.js} +60 -23
  55. package/dist/node/totp-e4b57fc2.js.map +1 -0
  56. package/dist/node-esm/index.js +1 -1
  57. package/dist/node-esm/internal.js +16 -4
  58. package/dist/node-esm/internal.js.map +1 -1
  59. package/dist/node-esm/src/api/index.d.ts +2 -1
  60. package/dist/node-esm/src/core/auth/auth_impl.d.ts +4 -1
  61. package/dist/node-esm/src/core/util/handler.d.ts +1 -1
  62. package/dist/node-esm/src/core/util/log.d.ts +1 -0
  63. package/dist/node-esm/src/model/auth.d.ts +1 -0
  64. package/dist/node-esm/test/helpers/mock_auth.d.ts +5 -0
  65. package/dist/node-esm/{totp-3a805e5d.js → totp-3a67b88c.js} +45 -22
  66. package/dist/node-esm/totp-3a67b88c.js.map +1 -0
  67. package/dist/rn/index.js +1 -1
  68. package/dist/rn/internal.js +74 -46
  69. package/dist/rn/internal.js.map +1 -1
  70. package/dist/rn/{phone-a751cf13.js → phone-6ea1b9dd.js} +60 -23
  71. package/dist/rn/phone-6ea1b9dd.js.map +1 -0
  72. package/dist/rn/src/api/index.d.ts +2 -1
  73. package/dist/rn/src/core/auth/auth_impl.d.ts +4 -1
  74. package/dist/rn/src/core/util/handler.d.ts +1 -1
  75. package/dist/rn/src/core/util/log.d.ts +1 -0
  76. package/dist/rn/src/model/auth.d.ts +1 -0
  77. package/dist/rn/test/helpers/mock_auth.d.ts +5 -0
  78. package/dist/src/api/index.d.ts +2 -1
  79. package/dist/src/core/auth/auth_impl.d.ts +4 -1
  80. package/dist/src/core/util/handler.d.ts +1 -1
  81. package/dist/src/core/util/log.d.ts +1 -0
  82. package/dist/src/model/auth.d.ts +1 -0
  83. package/dist/test/helpers/mock_auth.d.ts +5 -0
  84. package/package.json +6 -6
  85. package/dist/browser-cjs/index-845ba5cf.js.map +0 -1
  86. package/dist/cordova/popup_redirect-77fcd73a.js.map +0 -1
  87. package/dist/esm2017/index-c088f05c.js.map +0 -1
  88. package/dist/esm5/index-7119ea16.js.map +0 -1
  89. package/dist/node/totp-220d9279.js.map +0 -1
  90. package/dist/node-esm/totp-3a805e5d.js.map +0 -1
  91. package/dist/rn/phone-a751cf13.js.map +0 -1
@@ -326,6 +326,15 @@ var AUTH_ERROR_CODES_MAP_DO_NOT_USE_INTERNALLY = {
326
326
  * limitations under the License.
327
327
  */
328
328
  var logClient = new logger.Logger('@firebase/auth');
329
+ function _logWarn(msg) {
330
+ var args = [];
331
+ for (var _i = 1; _i < arguments.length; _i++) {
332
+ args[_i - 1] = arguments[_i];
333
+ }
334
+ if (logClient.logLevel <= logger.LogLevel.WARN) {
335
+ logClient.warn.apply(logClient, tslib.__spreadArray(["Auth (".concat(app.SDK_VERSION, "): ").concat(msg)], args, false));
336
+ }
337
+ }
329
338
  function _logError(msg) {
330
339
  var args = [];
331
340
  for (var _i = 1; _i < arguments.length; _i++) {
@@ -2499,9 +2508,10 @@ var AuthMiddlewareQueue = /** @class */ (function () {
2499
2508
  * limitations under the License.
2500
2509
  */
2501
2510
  var AuthImpl = /** @class */ (function () {
2502
- function AuthImpl(app, heartbeatServiceProvider, config) {
2511
+ function AuthImpl(app, heartbeatServiceProvider, appCheckServiceProvider, config) {
2503
2512
  this.app = app;
2504
2513
  this.heartbeatServiceProvider = heartbeatServiceProvider;
2514
+ this.appCheckServiceProvider = appCheckServiceProvider;
2505
2515
  this.config = config;
2506
2516
  this.currentUser = null;
2507
2517
  this.emulatorConfig = null;
@@ -3075,7 +3085,7 @@ var AuthImpl = /** @class */ (function () {
3075
3085
  AuthImpl.prototype._getAdditionalHeaders = function () {
3076
3086
  var _a;
3077
3087
  return tslib.__awaiter(this, void 0, void 0, function () {
3078
- var headers, heartbeatsHeader;
3088
+ var headers, heartbeatsHeader, appCheckToken;
3079
3089
  var _b;
3080
3090
  return tslib.__generator(this, function (_c) {
3081
3091
  switch (_c.label) {
@@ -3095,11 +3105,39 @@ var AuthImpl = /** @class */ (function () {
3095
3105
  if (heartbeatsHeader) {
3096
3106
  headers["X-Firebase-Client" /* HttpHeader.X_FIREBASE_CLIENT */] = heartbeatsHeader;
3097
3107
  }
3108
+ return [4 /*yield*/, this._getAppCheckToken()];
3109
+ case 2:
3110
+ appCheckToken = _c.sent();
3111
+ if (appCheckToken) {
3112
+ headers["X-Firebase-AppCheck" /* HttpHeader.X_FIREBASE_APP_CHECK */] = appCheckToken;
3113
+ }
3098
3114
  return [2 /*return*/, headers];
3099
3115
  }
3100
3116
  });
3101
3117
  });
3102
3118
  };
3119
+ AuthImpl.prototype._getAppCheckToken = function () {
3120
+ var _a;
3121
+ return tslib.__awaiter(this, void 0, void 0, function () {
3122
+ var appCheckTokenResult;
3123
+ return tslib.__generator(this, function (_b) {
3124
+ switch (_b.label) {
3125
+ case 0: return [4 /*yield*/, ((_a = this.appCheckServiceProvider
3126
+ .getImmediate({ optional: true })) === null || _a === void 0 ? void 0 : _a.getToken())];
3127
+ case 1:
3128
+ appCheckTokenResult = _b.sent();
3129
+ if (appCheckTokenResult === null || appCheckTokenResult === void 0 ? void 0 : appCheckTokenResult.error) {
3130
+ // Context: appCheck.getToken() will never throw even if an error happened.
3131
+ // In the error case, a dummy token will be returned along with an error field describing
3132
+ // the error. In general, we shouldn't care about the error condition and just use
3133
+ // the token (actual or dummy) to send requests.
3134
+ _logWarn("Error while retrieving App Check token: ".concat(appCheckTokenResult.error));
3135
+ }
3136
+ return [2 /*return*/, appCheckTokenResult === null || appCheckTokenResult === void 0 ? void 0 : appCheckTokenResult.token];
3137
+ }
3138
+ });
3139
+ });
3140
+ };
3103
3141
  return AuthImpl;
3104
3142
  }());
3105
3143
  /**
@@ -6999,7 +7037,7 @@ function multiFactor(user) {
6999
7037
  }
7000
7038
 
7001
7039
  var name = "@firebase/auth";
7002
- var version = "0.22.0-canary.852ded64d";
7040
+ var version = "0.22.0-canary.ea3849fff";
7003
7041
 
7004
7042
  /**
7005
7043
  * @license
@@ -7119,26 +7157,25 @@ function registerAuth(clientPlatform) {
7119
7157
  var deps = _a.options;
7120
7158
  var app = container.getProvider('app').getImmediate();
7121
7159
  var heartbeatServiceProvider = container.getProvider('heartbeat');
7160
+ var appCheckServiceProvider = container.getProvider('app-check-internal');
7122
7161
  var _b = app.options, apiKey = _b.apiKey, authDomain = _b.authDomain;
7123
- return (function (app, heartbeatServiceProvider) {
7124
- _assert(apiKey && !apiKey.includes(':'), "invalid-api-key" /* AuthErrorCode.INVALID_API_KEY */, { appName: app.name });
7125
- // Auth domain is optional if IdP sign in isn't being used
7126
- _assert(!(authDomain === null || authDomain === void 0 ? void 0 : authDomain.includes(':')), "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */, {
7127
- appName: app.name
7128
- });
7129
- var config = {
7130
- apiKey: apiKey,
7131
- authDomain: authDomain,
7132
- clientPlatform: clientPlatform,
7133
- apiHost: "identitytoolkit.googleapis.com" /* DefaultConfig.API_HOST */,
7134
- tokenApiHost: "securetoken.googleapis.com" /* DefaultConfig.TOKEN_API_HOST */,
7135
- apiScheme: "https" /* DefaultConfig.API_SCHEME */,
7136
- sdkClientVersion: _getClientVersion(clientPlatform)
7137
- };
7138
- var authInstance = new AuthImpl(app, heartbeatServiceProvider, config);
7139
- _initializeAuthInstance(authInstance, deps);
7140
- return authInstance;
7141
- })(app, heartbeatServiceProvider);
7162
+ _assert(apiKey && !apiKey.includes(':'), "invalid-api-key" /* AuthErrorCode.INVALID_API_KEY */, { appName: app.name });
7163
+ // Auth domain is optional if IdP sign in isn't being used
7164
+ _assert(!(authDomain === null || authDomain === void 0 ? void 0 : authDomain.includes(':')), "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */, {
7165
+ appName: app.name
7166
+ });
7167
+ var config = {
7168
+ apiKey: apiKey,
7169
+ authDomain: authDomain,
7170
+ clientPlatform: clientPlatform,
7171
+ apiHost: "identitytoolkit.googleapis.com" /* DefaultConfig.API_HOST */,
7172
+ tokenApiHost: "securetoken.googleapis.com" /* DefaultConfig.TOKEN_API_HOST */,
7173
+ apiScheme: "https" /* DefaultConfig.API_SCHEME */,
7174
+ sdkClientVersion: _getClientVersion(clientPlatform)
7175
+ };
7176
+ var authInstance = new AuthImpl(app, heartbeatServiceProvider, appCheckServiceProvider, config);
7177
+ _initializeAuthInstance(authInstance, deps);
7178
+ return authInstance;
7142
7179
  }, "PUBLIC" /* ComponentType.PUBLIC */)
7143
7180
  /**
7144
7181
  * Auth can only be initialized by explicitly calling getAuth() or initializeAuth()
@@ -8534,4 +8571,4 @@ exports.updateProfile = updateProfile;
8534
8571
  exports.useDeviceLanguage = useDeviceLanguage;
8535
8572
  exports.verifyBeforeUpdateEmail = verifyBeforeUpdateEmail;
8536
8573
  exports.verifyPasswordResetCode = verifyPasswordResetCode;
8537
- //# sourceMappingURL=phone-a751cf13.js.map
8574
+ //# sourceMappingURL=phone-6ea1b9dd.js.map