@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.js
CHANGED
|
@@ -8887,6 +8887,13 @@ async function showShare(input) {
|
|
|
8887
8887
|
import { ed25519 as ed255195, x25519 } from "@noble/curves/ed25519";
|
|
8888
8888
|
import { sha256 as sha2567 } from "@noble/hashes/sha256";
|
|
8889
8889
|
|
|
8890
|
+
// src/encryption-origin.ts
|
|
8891
|
+
var TEE_NODE_ORIGIN = "https://tee.node.tinycloud.xyz";
|
|
8892
|
+
var PRODUCTION_NODE_ORIGINS = /* @__PURE__ */ new Set(["https://node.tinycloud.xyz", TEE_NODE_ORIGIN]);
|
|
8893
|
+
function encryptionNodeOrigin(nodeOrigin) {
|
|
8894
|
+
return PRODUCTION_NODE_ORIGINS.has(nodeOrigin) ? TEE_NODE_ORIGIN : nodeOrigin;
|
|
8895
|
+
}
|
|
8896
|
+
|
|
8890
8897
|
// src/protocol.ts
|
|
8891
8898
|
var SHARE_V2_PROTOCOL = Object.freeze({
|
|
8892
8899
|
challengeDomain: "xyz.tinycloud.share/policy-challenge/v2\0",
|
|
@@ -9255,7 +9262,7 @@ var ShareRecipientClient = class {
|
|
|
9255
9262
|
});
|
|
9256
9263
|
try {
|
|
9257
9264
|
this.options.onStage?.("decryption");
|
|
9258
|
-
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 } });
|
|
9265
|
+
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 } });
|
|
9259
9266
|
if (!response.ok) throw await recipientHttpError(response, "v3 decrypt invocation rejected");
|
|
9260
9267
|
const value = object3(await response.json(), "v3 decrypt response");
|
|
9261
9268
|
const allowed = ["type", "targetNode", "networkId", "invocationCid", "encryptedSymmetricKeyHash", "receiverPublicKeyHash", "wrappedKey", "alg", "keyVersion", "requestHash", "nodeId", "nodeSignature"];
|