@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/index.cjs
CHANGED
|
@@ -9000,6 +9000,13 @@ async function showShare(input) {
|
|
|
9000
9000
|
var import_ed255195 = require("@noble/curves/ed25519");
|
|
9001
9001
|
var import_sha2566 = require("@noble/hashes/sha256");
|
|
9002
9002
|
|
|
9003
|
+
// src/encryption-origin.ts
|
|
9004
|
+
var TEE_NODE_ORIGIN = "https://tee.node.tinycloud.xyz";
|
|
9005
|
+
var PRODUCTION_NODE_ORIGINS = /* @__PURE__ */ new Set(["https://node.tinycloud.xyz", TEE_NODE_ORIGIN]);
|
|
9006
|
+
function encryptionNodeOrigin(nodeOrigin) {
|
|
9007
|
+
return PRODUCTION_NODE_ORIGINS.has(nodeOrigin) ? TEE_NODE_ORIGIN : nodeOrigin;
|
|
9008
|
+
}
|
|
9009
|
+
|
|
9003
9010
|
// src/protocol.ts
|
|
9004
9011
|
var SHARE_V2_PROTOCOL = Object.freeze({
|
|
9005
9012
|
challengeDomain: "xyz.tinycloud.share/policy-challenge/v2\0",
|
|
@@ -9368,7 +9375,7 @@ var ShareRecipientClient = class {
|
|
|
9368
9375
|
});
|
|
9369
9376
|
try {
|
|
9370
9377
|
this.options.onStage?.("decryption");
|
|
9371
|
-
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 } });
|
|
9378
|
+
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 } });
|
|
9372
9379
|
if (!response.ok) throw await recipientHttpError(response, "v3 decrypt invocation rejected");
|
|
9373
9380
|
const value = object3(await response.json(), "v3 decrypt response");
|
|
9374
9381
|
const allowed = ["type", "targetNode", "networkId", "invocationCid", "encryptedSymmetricKeyHash", "receiverPublicKeyHash", "wrappedKey", "alg", "keyVersion", "requestHash", "nodeId", "nodeSignature"];
|