@tinycloud/share-sdk 1.5.0-beta.3 → 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.
- package/dist/index.cjs +8 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +8 -1
- package/dist/index.js.map +1 -1
- package/dist/share-root.cjs +14 -5
- package/dist/share-root.cjs.map +1 -1
- package/dist/share-root.js +14 -5
- package/dist/share-root.js.map +1 -1
- package/dist/web-recipient.cjs +8 -1
- package/dist/web-recipient.cjs.map +1 -1
- package/dist/web-recipient.js +8 -1
- package/dist/web-recipient.js.map +1 -1
- package/package.json +1 -1
package/dist/web-recipient.cjs
CHANGED
|
@@ -6107,6 +6107,13 @@ function isLegacyV2Link(link) {
|
|
|
6107
6107
|
var import_ed255194 = require("@noble/curves/ed25519");
|
|
6108
6108
|
var import_sha2562 = require("@noble/hashes/sha256");
|
|
6109
6109
|
|
|
6110
|
+
// src/encryption-origin.ts
|
|
6111
|
+
var TEE_NODE_ORIGIN = "https://tee.node.tinycloud.xyz";
|
|
6112
|
+
var PRODUCTION_NODE_ORIGINS = /* @__PURE__ */ new Set(["https://node.tinycloud.xyz", TEE_NODE_ORIGIN]);
|
|
6113
|
+
function encryptionNodeOrigin(nodeOrigin) {
|
|
6114
|
+
return PRODUCTION_NODE_ORIGINS.has(nodeOrigin) ? TEE_NODE_ORIGIN : nodeOrigin;
|
|
6115
|
+
}
|
|
6116
|
+
|
|
6110
6117
|
// src/protocol.ts
|
|
6111
6118
|
var SHARE_V2_PROTOCOL = Object.freeze({
|
|
6112
6119
|
challengeDomain: "xyz.tinycloud.share/policy-challenge/v2\0",
|
|
@@ -6437,7 +6444,7 @@ var ShareRecipientClient = class {
|
|
|
6437
6444
|
});
|
|
6438
6445
|
try {
|
|
6439
6446
|
this.options.onStage?.("decryption");
|
|
6440
|
-
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 } });
|
|
6447
|
+
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 } });
|
|
6441
6448
|
if (!response.ok) throw await recipientHttpError(response, "v3 decrypt invocation rejected");
|
|
6442
6449
|
const value = object2(await response.json(), "v3 decrypt response");
|
|
6443
6450
|
const allowed = ["type", "targetNode", "networkId", "invocationCid", "encryptedSymmetricKeyHash", "receiverPublicKeyHash", "wrappedKey", "alg", "keyVersion", "requestHash", "nodeId", "nodeSignature"];
|