@openkey/sdk 0.10.1 → 0.10.2

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
@@ -552,14 +552,13 @@ var OpenKey = class {
552
552
  popup = null;
553
553
  lastAuth = null;
554
554
  discoveredProviders = [];
555
- sessionToken = null;
556
555
  /** Cancels widget flows that could outlive a sign-out on this instance. */
557
556
  activeFlowCancellations = /* @__PURE__ */ new Set();
558
557
  /**
559
558
  * Nostr identity custody + signing (secp256k1 Schnorr / BIP-340). Kept
560
559
  * fully separate from the Ethereum flows above: it never reuses
561
- * `lastAuth`/`sessionToken`, and its widget messages never carry a
562
- * sessionToken - the OpenKey session and any signing grants stay inside
560
+ * `lastAuth`, and its widget messages never carry a session token -
561
+ * the OpenKey session and any signing grants stay inside
563
562
  * the OpenKey-origin iframe for the whole lifetime of this client.
564
563
  */
565
564
  nostr;
@@ -641,25 +640,22 @@ var OpenKey = class {
641
640
  /**
642
641
  * Signs the active OpenKey account out through the OpenKey-owned widget.
643
642
  *
644
- * The SDK passes its Better Auth bearer through the OpenKey-owned widget
645
- * protocol so applications do not have to implement revocation themselves.
646
- * Local SDK session state is cleared before opening the widget, including
647
- * when remote revocation is unavailable.
643
+ * The OpenKey-owned widget revokes the OpenKey session it holds itself;
644
+ * the SDK never holds an OpenKey session token. Local SDK state is cleared
645
+ * before opening the widget, including when remote revocation is
646
+ * unavailable.
648
647
  */
649
648
  async signOut(opts) {
650
649
  const requestId = `ok-signout-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
651
- const sessionToken = this.sessionToken || void 0;
652
650
  const mode = this.resolveMode(opts?.mode) === "redirect" ? "popup" : opts?.mode;
653
651
  this.cancelActiveFlows();
654
652
  this.lastAuth = null;
655
- this.sessionToken = null;
656
653
  const acknowledgement = await this.openFlow(
657
654
  "sign-out",
658
655
  {
659
656
  type: "openkey:sign-out:request",
660
657
  requestId,
661
- protocolVersion: 1,
662
- sessionToken
658
+ protocolVersion: 1
663
659
  },
664
660
  mode
665
661
  );
@@ -669,22 +665,26 @@ var OpenKey = class {
669
665
  return acknowledgement;
670
666
  }
671
667
  /**
672
- * Better-auth session token relayed during connect(), or null if the
673
- * flow did not provide one. Use as a bearer token for API calls made
674
- * on the user's behalf (e.g. TinyCloud auto-sign bootstrap signing).
668
+ * Always null. OpenKey no longer gives its session token to the embedding
669
+ * page (TC-688): the token unlocked OpenKey's key and account APIs, not
670
+ * just the requesting app's flows.
671
+ *
672
+ * @deprecated Kept so existing callers compile. Third-party server-side
673
+ * signing uses an OAuth access token from the OpenKey OAuth flow.
675
674
  */
676
675
  getSessionToken() {
677
- return this.sessionToken;
676
+ return null;
678
677
  }
679
678
  /**
680
- * Endpoint + bearer token for a TinyCloud auto-sign signing strategy.
681
- * The endpoint is on the OpenKey API host and only signs requests the
682
- * server-side bootstrap allowlist permits.
679
+ * Endpoint for a TinyCloud auto-sign signing strategy. `token` is always
680
+ * null; see {@link OpenKey.getSessionToken}.
681
+ *
682
+ * @deprecated The endpoint accepts an OAuth access token as its bearer.
683
683
  */
684
684
  tinycloudSigningOptions() {
685
685
  return {
686
686
  endpoint: `${this.oauthHost}/api/delegate/sign`,
687
- token: this.sessionToken
687
+ token: null
688
688
  };
689
689
  }
690
690
  /**
@@ -769,8 +769,7 @@ var OpenKey = class {
769
769
  // context. The envelope is display-only; the widget transport
770
770
  // validates and size-bounds it before use and NEVER treats it as
771
771
  // verified unless the server actually origin-binds a manifest.
772
- presentation: request.presentation,
773
- sessionToken: this.sessionToken || void 0
772
+ presentation: request.presentation
774
773
  },
775
774
  opts?.mode
776
775
  );
@@ -847,7 +846,6 @@ var OpenKey = class {
847
846
  // bounded at the transport, never treated as verified without
848
847
  // server-side origin-binding.
849
848
  presentation: request.presentation,
850
- sessionToken: this.sessionToken || void 0,
851
849
  // Sol MAJOR-3 (continuation): tell the widget to hand us back
852
850
  // the previewApproval instead of asking OpenKey to sign
853
851
  // server-side with a managed key. The widget will still render
@@ -1001,15 +999,13 @@ var OpenKey = class {
1001
999
  return this.openFlow("sign", {
1002
1000
  type: "openkey:sign:request",
1003
1001
  message: request.message,
1004
- keyId: request.keyId,
1005
- sessionToken: this.sessionToken || void 0
1002
+ keyId: request.keyId
1006
1003
  }, mode);
1007
1004
  }
1008
1005
  signTypedDataWithOpenKey(request, mode) {
1009
1006
  return this.openFlow("sign-typed-data", {
1010
1007
  type: "openkey:signTypedData:request",
1011
- data: request,
1012
- sessionToken: this.sessionToken || void 0
1008
+ data: request
1013
1009
  }, mode);
1014
1010
  }
1015
1011
  toHex(str) {
@@ -1295,7 +1291,6 @@ var OpenKey = class {
1295
1291
  cleanup();
1296
1292
  if (data.success) {
1297
1293
  if (data.type === "openkey:auth:response") {
1298
- if (data.sessionToken) this.sessionToken = data.sessionToken;
1299
1294
  resolve({ address: data.address, keyId: data.keyId, keyType: data.keyType || "MANAGED" });
1300
1295
  } else if (data.type === "openkey:link-wallet:response") {
1301
1296
  resolve({ address: data.address, keyId: data.keyId });
@@ -1518,7 +1513,6 @@ var OpenKey = class {
1518
1513
  popup.close();
1519
1514
  if (data.success) {
1520
1515
  if (data.type === "openkey:auth:response") {
1521
- if (data.sessionToken) this.sessionToken = data.sessionToken;
1522
1516
  resolve({ address: data.address, keyId: data.keyId, keyType: data.keyType || "MANAGED" });
1523
1517
  } else if (data.type === "openkey:link-wallet:response") {
1524
1518
  resolve({ address: data.address, keyId: data.keyId });