@reactor-team/js-sdk 2.0.0 → 2.0.1

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.mjs CHANGED
@@ -2087,6 +2087,27 @@ function WebcamStream({
2087
2087
  }
2088
2088
  );
2089
2089
  }
2090
+
2091
+ // src/utils/tokens.ts
2092
+ function fetchInsecureJwtToken(_0) {
2093
+ return __async(this, arguments, function* (apiKey, coordinatorUrl = PROD_COORDINATOR_URL) {
2094
+ console.warn(
2095
+ "[Reactor] \u26A0\uFE0F SECURITY WARNING: fetchInsecureJwtToken() exposes your API key in client-side code. This should ONLY be used for local development or testing. In production, fetch tokens from your server instead."
2096
+ );
2097
+ const response = yield fetch(`${coordinatorUrl}/tokens`, {
2098
+ method: "GET",
2099
+ headers: {
2100
+ "X-API-Key": apiKey
2101
+ }
2102
+ });
2103
+ if (!response.ok) {
2104
+ const error = yield response.text();
2105
+ throw new Error(`Failed to create token: ${response.status} ${error}`);
2106
+ }
2107
+ const { jwt } = yield response.json();
2108
+ return jwt;
2109
+ });
2110
+ }
2090
2111
  export {
2091
2112
  PROD_COORDINATOR_URL,
2092
2113
  Reactor,
@@ -2094,6 +2115,7 @@ export {
2094
2115
  ReactorProvider,
2095
2116
  ReactorView,
2096
2117
  WebcamStream,
2118
+ fetchInsecureJwtToken,
2097
2119
  useReactor,
2098
2120
  useReactorMessage,
2099
2121
  useReactorStore