@relai-team/access-sdk 0.11.0 → 0.11.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/README.md CHANGED
@@ -144,6 +144,39 @@ Server-side (secret key), `relai.overrideLinks.request({ nodeId })` mints a
144
144
  single-use override code that opens a node with no paywall (10 free per org per
145
145
  month, then $1.00 each). Redeem via `overrideCode` on the open.
146
146
 
147
+ ### Guest mode: no account, no sign-in call
148
+
149
+ **There is no `signInAsGuest()`, and there is nothing missing.** A guest is not
150
+ a kind of session, it is the absence of one: a request counts as a guest request
151
+ when it carries your publishable key and no end-user bearer token. That is
152
+ exactly what this client sends before anyone calls `auth.verifyOtp(...)`, so a
153
+ fresh `RelaiClient` is already making guest calls.
154
+
155
+ ```ts
156
+ const relai = new RelaiClient({ publishableKey: "pk_sandbox_..." });
157
+ // No auth.startOtp, no auth.verifyOtp. That is the whole trick.
158
+
159
+ const order = await relai.orders.create({ exchangeZoneId: ez.id });
160
+ const drop = await relai.unlock({ orderId: order.id, intent: Intents.Occupy, transport });
161
+ const code = drop.access_link.code; // hand this to whoever picks up
162
+
163
+ // Any device, still no account:
164
+ await relai.unlock({ orderId: order.id, intent: Intents.MakeAvailable, accessLink: code, transport });
165
+ ```
166
+
167
+ Guest mode is a **per-app setting** you turn on in the Relai portal, not
168
+ something the SDK can enable, and it requires open access plus the open handoff
169
+ mode. With it off, every call without a bearer token answers `401 unauthorized`
170
+ ("Missing end-user bearer token (and guest mode is off for this app)"). If your
171
+ anonymous calls are failing, check that message before your code.
172
+
173
+ Everyone using your app anonymously shares **one** guest identity, so the access
174
+ link is the only thing that tells two guests apart, and it is the only thing that
175
+ authorizes a guest pick-up. A guest cannot pick up without one (even on an order
176
+ a guest created), be a directed recipient, re-open a node, start a
177
+ pay-as-you-go hold, or cancel an order. Late fees on a guest pick-up bill your
178
+ organization, since there is no individual to charge.
179
+
147
180
  ## Your end users (server only)
148
181
 
149
182
  `relai.endUsers` reads the people using your app: name, email, and access tag.
package/dist/index.d.cts CHANGED
@@ -304,6 +304,22 @@ declare class MemoryTokenStorage implements TokenStorage {
304
304
  set(tokens: TokenPair): void;
305
305
  clear(): void;
306
306
  }
307
+ /**
308
+ * End-user identity: email OTP in, tokens held, tokens refreshed.
309
+ *
310
+ * GUEST MODE. There is deliberately no `signInAsGuest()`. A guest is not a kind
311
+ * of session, it is the absence of one: a request counts as a guest request when
312
+ * it carries the publishable key and NO end-user bearer token, which is exactly
313
+ * what this client sends while `isSignedIn` is false. So on an app with guest
314
+ * mode enabled (a portal setting, requiring open access and the open handoff
315
+ * mode), orders, unlocks, access-link resolution and telemetry all work without
316
+ * calling anything here at all. With guest mode off, those calls answer
317
+ * `401 unauthorized`.
318
+ *
319
+ * Every anonymous caller on an app shares ONE guest identity, so the single-use
320
+ * access link is the only credential that distinguishes two guests, and it is
321
+ * required for a guest pick-up even on an order a guest created.
322
+ */
307
323
  declare class AuthModule {
308
324
  private readonly http;
309
325
  private readonly storage;
package/dist/index.d.ts CHANGED
@@ -304,6 +304,22 @@ declare class MemoryTokenStorage implements TokenStorage {
304
304
  set(tokens: TokenPair): void;
305
305
  clear(): void;
306
306
  }
307
+ /**
308
+ * End-user identity: email OTP in, tokens held, tokens refreshed.
309
+ *
310
+ * GUEST MODE. There is deliberately no `signInAsGuest()`. A guest is not a kind
311
+ * of session, it is the absence of one: a request counts as a guest request when
312
+ * it carries the publishable key and NO end-user bearer token, which is exactly
313
+ * what this client sends while `isSignedIn` is false. So on an app with guest
314
+ * mode enabled (a portal setting, requiring open access and the open handoff
315
+ * mode), orders, unlocks, access-link resolution and telemetry all work without
316
+ * calling anything here at all. With guest mode off, those calls answer
317
+ * `401 unauthorized`.
318
+ *
319
+ * Every anonymous caller on an app shares ONE guest identity, so the single-use
320
+ * access link is the only credential that distinguishes two guests, and it is
321
+ * required for a guest pick-up even on an order a guest created.
322
+ */
307
323
  declare class AuthModule {
308
324
  private readonly http;
309
325
  private readonly storage;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@relai-team/access-sdk",
3
- "version": "0.11.0",
3
+ "version": "0.11.1",
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",