@relai-team/access-sdk 0.12.2 → 0.12.3

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/README.md CHANGED
@@ -376,7 +376,14 @@ them (delivery is enabled server-side per app):
376
376
  ```ts
377
377
  await fetch(`${baseUrl}/push/tokens`, {
378
378
  method: "POST",
379
- headers: { authorization: `Bearer ${endUserAccessToken}`, "content-type": "application/json" },
379
+ headers: {
380
+ // BOTH headers. The route authenticates the app with the API key first and
381
+ // the person with the bearer second, so a bearer alone answers
382
+ // 401 missing_publishable_key while your token is perfectly valid.
383
+ "x-relai-key": publishableKey,
384
+ authorization: `Bearer ${endUserAccessToken}`,
385
+ "content-type": "application/json",
386
+ },
380
387
  body: JSON.stringify({ token: expoPushToken, platform: "expo" }),
381
388
  });
382
389
  // DELETE the same route on sign-out.
package/dist/index.cjs CHANGED
@@ -917,7 +917,14 @@ var SimAuthenticatedTransport = class {
917
917
  method: "POST",
918
918
  headers: {
919
919
  "content-type": "application/json",
920
- authorization: `Bearer ${this.publishableKey}`
920
+ // `x-relai-key`, NOT an Authorization bearer. The sim-Parent endpoints
921
+ // authenticate with the API key like every other /v1 route
922
+ // (`requireApiKey` reads this header and nothing else); the bearer
923
+ // scheme is for END-USER JWTs, which a Parent endpoint has no concept
924
+ // of. Sending the bearer meant every call here 401'd with
925
+ // `missing_publishable_key`, so this transport had never worked, in any
926
+ // released version, despite both docs pages recommending it.
927
+ "x-relai-key": this.publishableKey
921
928
  },
922
929
  body: JSON.stringify(body ?? {})
923
930
  });
package/dist/index.js CHANGED
@@ -789,7 +789,14 @@ var SimAuthenticatedTransport = class {
789
789
  method: "POST",
790
790
  headers: {
791
791
  "content-type": "application/json",
792
- authorization: `Bearer ${this.publishableKey}`
792
+ // `x-relai-key`, NOT an Authorization bearer. The sim-Parent endpoints
793
+ // authenticate with the API key like every other /v1 route
794
+ // (`requireApiKey` reads this header and nothing else); the bearer
795
+ // scheme is for END-USER JWTs, which a Parent endpoint has no concept
796
+ // of. Sending the bearer meant every call here 401'd with
797
+ // `missing_publishable_key`, so this transport had never worked, in any
798
+ // released version, despite both docs pages recommending it.
799
+ "x-relai-key": this.publishableKey
793
800
  },
794
801
  body: JSON.stringify(body ?? {})
795
802
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@relai-team/access-sdk",
3
- "version": "0.12.2",
3
+ "version": "0.12.3",
4
4
  "description": "Official Relai Access SDK, open Relai Exchange Zone nodes over BLE, backed by the Relai Access platform (server-owns-trust).",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "type": "module",