@firebase/app-check 0.11.3 → 0.11.4

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.
package/dist/index.cjs.js CHANGED
@@ -854,12 +854,14 @@ async function getLimitedUseToken$1(appCheck) {
854
854
  const { provider } = getStateReference(app);
855
855
  if (isDebugMode()) {
856
856
  const debugToken = await getDebugToken();
857
- const { token } = await exchangeToken(getExchangeDebugTokenRequest(app, debugToken), appCheck.heartbeatServiceProvider);
857
+ const request = getExchangeDebugTokenRequest(app, debugToken);
858
+ request.body['limited_use'] = true;
859
+ const { token } = await exchangeToken(request, appCheck.heartbeatServiceProvider);
858
860
  return { token };
859
861
  }
860
862
  else {
861
863
  // provider is definitely valid since we ensure AppCheck was activated
862
- const { token } = await provider.getToken();
864
+ const { token } = await provider.getToken(true /* isLimitedUse */);
863
865
  return { token };
864
866
  }
865
867
  }
@@ -1055,7 +1057,7 @@ function internalFactory(appCheck) {
1055
1057
  }
1056
1058
 
1057
1059
  const name = "@firebase/app-check";
1058
- const version = "0.11.3";
1060
+ const version = "0.11.4";
1059
1061
 
1060
1062
  /**
1061
1063
  * @license
@@ -1233,7 +1235,7 @@ class ReCaptchaV3Provider {
1233
1235
  * Returns an App Check token.
1234
1236
  * @internal
1235
1237
  */
1236
- async getToken() {
1238
+ async getToken(isLimitedUse = false) {
1237
1239
  throwIfThrottled(this._throttleData);
1238
1240
  // Top-level `getToken()` has already checked that App Check is initialized
1239
1241
  // and therefore this._app and this._heartbeatServiceProvider are available.
@@ -1247,7 +1249,11 @@ class ReCaptchaV3Provider {
1247
1249
  }
1248
1250
  let result;
1249
1251
  try {
1250
- result = await exchangeToken(getExchangeRecaptchaV3TokenRequest(this._app, attestedClaimsToken), this._heartbeatServiceProvider);
1252
+ const request = getExchangeRecaptchaV3TokenRequest(this._app, attestedClaimsToken);
1253
+ if (isLimitedUse) {
1254
+ request.body['limited_use'] = true;
1255
+ }
1256
+ result = await exchangeToken(request, this._heartbeatServiceProvider);
1251
1257
  }
1252
1258
  catch (e) {
1253
1259
  if (e.code?.includes("fetch-status-error" /* AppCheckError.FETCH_STATUS_ERROR */)) {
@@ -1310,7 +1316,7 @@ class ReCaptchaEnterpriseProvider {
1310
1316
  * Returns an App Check token.
1311
1317
  * @internal
1312
1318
  */
1313
- async getToken() {
1319
+ async getToken(isLimitedUse = false) {
1314
1320
  throwIfThrottled(this._throttleData);
1315
1321
  // Top-level `getToken()` has already checked that App Check is initialized
1316
1322
  // and therefore this._app and this._heartbeatServiceProvider are available.
@@ -1324,7 +1330,11 @@ class ReCaptchaEnterpriseProvider {
1324
1330
  }
1325
1331
  let result;
1326
1332
  try {
1327
- result = await exchangeToken(getExchangeRecaptchaEnterpriseTokenRequest(this._app, attestedClaimsToken), this._heartbeatServiceProvider);
1333
+ const request = getExchangeRecaptchaEnterpriseTokenRequest(this._app, attestedClaimsToken);
1334
+ if (isLimitedUse) {
1335
+ request.body['limited_use'] = true;
1336
+ }
1337
+ result = await exchangeToken(request, this._heartbeatServiceProvider);
1328
1338
  }
1329
1339
  catch (e) {
1330
1340
  if (e.code?.includes("fetch-status-error" /* AppCheckError.FETCH_STATUS_ERROR */)) {