@firebase/app-check 0.6.5 → 0.7.0-canary.4a86f4eb0

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
@@ -919,6 +919,35 @@ function getToken$2(appCheck, forceRefresh) {
919
919
  });
920
920
  });
921
921
  }
922
+ /**
923
+ * Internal API for limited use tokens. Skips all FAC state and simply calls
924
+ * the underlying provider.
925
+ */
926
+ function getLimitedUseToken$1(appCheck) {
927
+ return tslib.__awaiter(this, void 0, void 0, function () {
928
+ var app, provider, debugToken, token, token;
929
+ return tslib.__generator(this, function (_a) {
930
+ switch (_a.label) {
931
+ case 0:
932
+ app = appCheck.app;
933
+ ensureActivated(app);
934
+ provider = getStateReference(app).provider;
935
+ if (!isDebugMode()) return [3 /*break*/, 3];
936
+ return [4 /*yield*/, getDebugToken()];
937
+ case 1:
938
+ debugToken = _a.sent();
939
+ return [4 /*yield*/, exchangeToken(getExchangeDebugTokenRequest(app, debugToken), appCheck.heartbeatServiceProvider)];
940
+ case 2:
941
+ token = (_a.sent()).token;
942
+ return [2 /*return*/, { token: token }];
943
+ case 3: return [4 /*yield*/, provider.getToken()];
944
+ case 4:
945
+ token = (_a.sent()).token;
946
+ return [2 /*return*/, { token: token }];
947
+ }
948
+ });
949
+ });
950
+ }
922
951
  function addTokenListener(appCheck, type, listener, onError) {
923
952
  var app = appCheck.app;
924
953
  var state = getStateReference(app);
@@ -1116,6 +1145,7 @@ function factory(app, heartbeatServiceProvider) {
1116
1145
  function internalFactory(appCheck) {
1117
1146
  return {
1118
1147
  getToken: function (forceRefresh) { return getToken$2(appCheck, forceRefresh); },
1148
+ getLimitedUseToken: function () { return getLimitedUseToken$1(appCheck); },
1119
1149
  addTokenListener: function (listener) {
1120
1150
  return addTokenListener(appCheck, "INTERNAL" /* ListenerType.INTERNAL */, listener);
1121
1151
  },
@@ -1124,7 +1154,7 @@ function internalFactory(appCheck) {
1124
1154
  }
1125
1155
 
1126
1156
  var name = "@firebase/app-check";
1127
- var version = "0.6.5";
1157
+ var version = "0.7.0-canary.4a86f4eb0";
1128
1158
 
1129
1159
  /**
1130
1160
  * @license
@@ -1721,6 +1751,24 @@ function getToken(appCheckInstance, forceRefresh) {
1721
1751
  });
1722
1752
  });
1723
1753
  }
1754
+ /**
1755
+ * Requests a Firebase App Check token. This method should be used
1756
+ * only if you need to authorize requests to a non-Firebase backend.
1757
+ *
1758
+ * Returns limited-use tokens that are intended for use with your
1759
+ * non-Firebase backend endpoints that are protected with
1760
+ * <a href="https://firebase.google.com/docs/app-check/custom-resource-backend#replay-protection">
1761
+ * Replay Protection</a>. This method
1762
+ * does not affect the token generation behavior of the
1763
+ * #getAppCheckToken() method.
1764
+ *
1765
+ * @param appCheckInstance - The App Check service instance.
1766
+ * @returns The limited use token.
1767
+ * @public
1768
+ */
1769
+ function getLimitedUseToken(appCheckInstance) {
1770
+ return getLimitedUseToken$1(appCheckInstance);
1771
+ }
1724
1772
  /**
1725
1773
  * Wraps `addTokenListener`/`removeTokenListener` methods in an `Observer`
1726
1774
  * pattern for public use.
@@ -1787,6 +1835,7 @@ registerAppCheck();
1787
1835
  exports.CustomProvider = CustomProvider;
1788
1836
  exports.ReCaptchaEnterpriseProvider = ReCaptchaEnterpriseProvider;
1789
1837
  exports.ReCaptchaV3Provider = ReCaptchaV3Provider;
1838
+ exports.getLimitedUseToken = getLimitedUseToken;
1790
1839
  exports.getToken = getToken;
1791
1840
  exports.initializeAppCheck = initializeAppCheck;
1792
1841
  exports.onTokenChanged = onTokenChanged;