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

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.
@@ -820,6 +820,25 @@ async function getToken$2(appCheck, forceRefresh = false) {
820
820
  }
821
821
  return interopTokenResult;
822
822
  }
823
+ /**
824
+ * Internal API for limited use tokens. Skips all FAC state and simply calls
825
+ * the underlying provider.
826
+ */
827
+ async function getLimitedUseToken$1(appCheck) {
828
+ const app = appCheck.app;
829
+ ensureActivated(app);
830
+ const { provider } = getStateReference(app);
831
+ if (isDebugMode()) {
832
+ const debugToken = await getDebugToken();
833
+ const { token } = await exchangeToken(getExchangeDebugTokenRequest(app, debugToken), appCheck.heartbeatServiceProvider);
834
+ return { token };
835
+ }
836
+ else {
837
+ // provider is definitely valid since we ensure AppCheck was activated
838
+ const { token } = await provider.getToken();
839
+ return { token };
840
+ }
841
+ }
823
842
  function addTokenListener(appCheck, type, listener, onError) {
824
843
  const { app } = appCheck;
825
844
  const state = getStateReference(app);
@@ -1005,13 +1024,14 @@ function factory(app, heartbeatServiceProvider) {
1005
1024
  function internalFactory(appCheck) {
1006
1025
  return {
1007
1026
  getToken: forceRefresh => getToken$2(appCheck, forceRefresh),
1027
+ getLimitedUseToken: () => getLimitedUseToken$1(appCheck),
1008
1028
  addTokenListener: listener => addTokenListener(appCheck, "INTERNAL" /* ListenerType.INTERNAL */, listener),
1009
1029
  removeTokenListener: listener => removeTokenListener(appCheck.app, listener)
1010
1030
  };
1011
1031
  }
1012
1032
 
1013
1033
  const name = "@firebase/app-check";
1014
- const version = "0.6.5";
1034
+ const version = "0.7.0-canary.4c492e04d";
1015
1035
 
1016
1036
  /**
1017
1037
  * @license
@@ -1557,6 +1577,24 @@ async function getToken(appCheckInstance, forceRefresh) {
1557
1577
  }
1558
1578
  return { token: result.token };
1559
1579
  }
1580
+ /**
1581
+ * Requests a Firebase App Check token. This method should be used
1582
+ * only if you need to authorize requests to a non-Firebase backend.
1583
+ *
1584
+ * Returns limited-use tokens that are intended for use with your
1585
+ * non-Firebase backend endpoints that are protected with
1586
+ * <a href="https://firebase.google.com/docs/app-check/custom-resource-backend#replay-protection">
1587
+ * Replay Protection</a>. This method
1588
+ * does not affect the token generation behavior of the
1589
+ * #getAppCheckToken() method.
1590
+ *
1591
+ * @param appCheckInstance - The App Check service instance.
1592
+ * @returns The limited use token.
1593
+ * @public
1594
+ */
1595
+ function getLimitedUseToken(appCheckInstance) {
1596
+ return getLimitedUseToken$1(appCheckInstance);
1597
+ }
1560
1598
  /**
1561
1599
  * Wraps `addTokenListener`/`removeTokenListener` methods in an `Observer`
1562
1600
  * pattern for public use.
@@ -1620,5 +1658,5 @@ function registerAppCheck() {
1620
1658
  }
1621
1659
  registerAppCheck();
1622
1660
 
1623
- export { CustomProvider, ReCaptchaEnterpriseProvider, ReCaptchaV3Provider, getToken, initializeAppCheck, onTokenChanged, setTokenAutoRefreshEnabled };
1661
+ export { CustomProvider, ReCaptchaEnterpriseProvider, ReCaptchaV3Provider, getLimitedUseToken, getToken, initializeAppCheck, onTokenChanged, setTokenAutoRefreshEnabled };
1624
1662
  //# sourceMappingURL=index.esm2017.js.map