@tinycloud/share-sdk 1.5.0-beta.2 → 1.5.0-beta.4

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.
@@ -6076,6 +6076,13 @@ function isLegacyV2Link(link) {
6076
6076
  import { ed25519 as ed255194, x25519 } from "@noble/curves/ed25519";
6077
6077
  import { sha256 as sha2563 } from "@noble/hashes/sha256";
6078
6078
 
6079
+ // src/encryption-origin.ts
6080
+ var TEE_NODE_ORIGIN = "https://tee.node.tinycloud.xyz";
6081
+ var PRODUCTION_NODE_ORIGINS = /* @__PURE__ */ new Set(["https://node.tinycloud.xyz", TEE_NODE_ORIGIN]);
6082
+ function encryptionNodeOrigin(nodeOrigin) {
6083
+ return PRODUCTION_NODE_ORIGINS.has(nodeOrigin) ? TEE_NODE_ORIGIN : nodeOrigin;
6084
+ }
6085
+
6079
6086
  // src/protocol.ts
6080
6087
  var SHARE_V2_PROTOCOL = Object.freeze({
6081
6088
  challengeDomain: "xyz.tinycloud.share/policy-challenge/v2\0",
@@ -6406,7 +6413,7 @@ var ShareRecipientClient = class {
6406
6413
  });
6407
6414
  try {
6408
6415
  this.options.onStage?.("decryption");
6409
- const response = await this.fetchFn(new URL("/invoke", this.options.nodeOrigin), { method: "POST", redirect: "error", headers: { accept: "application/json", "content-type": "application/json", Authorization: invocation.authorization }, body: JSON.stringify(body), ...this.options.signal === void 0 ? {} : { signal: this.options.signal } });
6416
+ const response = await this.fetchFn(new URL("/invoke", encryptionNodeOrigin(this.options.nodeOrigin)), { method: "POST", redirect: "error", headers: { accept: "application/json", "content-type": "application/json", Authorization: invocation.authorization }, body: JSON.stringify(body), ...this.options.signal === void 0 ? {} : { signal: this.options.signal } });
6410
6417
  if (!response.ok) throw await recipientHttpError(response, "v3 decrypt invocation rejected");
6411
6418
  const value = object2(await response.json(), "v3 decrypt response");
6412
6419
  const allowed = ["type", "targetNode", "networkId", "invocationCid", "encryptedSymmetricKeyHash", "receiverPublicKeyHash", "wrappedKey", "alg", "keyVersion", "requestHash", "nodeId", "nodeSignature"];