@tinycloud/node-sdk 2.2.1-beta.0 → 2.3.0-beta.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/{core-CNyXnUx9.d.cts → core-CWdCZ8q6.d.cts} +1 -0
- package/dist/{core-CNyXnUx9.d.ts → core-CWdCZ8q6.d.ts} +1 -0
- package/dist/core.cjs +14 -5
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.cts +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.js +14 -5
- package/dist/core.js.map +1 -1
- package/dist/index.cjs +14 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +14 -5
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -19358,8 +19358,8 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
19358
19358
|
fetchByNetworkId: (networkId) => this.getEncryptionNetwork(networkId)
|
|
19359
19359
|
},
|
|
19360
19360
|
wellKnown: {
|
|
19361
|
-
fetchWellKnown: async (
|
|
19362
|
-
if (!this._address ||
|
|
19361
|
+
fetchWellKnown: async (ownerDid, discoveryKey) => {
|
|
19362
|
+
if (!this._address || ownerDid !== this.did) {
|
|
19363
19363
|
return null;
|
|
19364
19364
|
}
|
|
19365
19365
|
if (!this.config.host) {
|
|
@@ -19821,11 +19821,11 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
19821
19821
|
}
|
|
19822
19822
|
async createEncryptionNetwork(name = DEFAULT_ENCRYPTION_NETWORK_NAME) {
|
|
19823
19823
|
const targetNode = await this.fetchNodeId();
|
|
19824
|
-
const
|
|
19824
|
+
const ownerDid = this.did;
|
|
19825
19825
|
const networkId = this.getDefaultEncryptionNetworkId(name);
|
|
19826
19826
|
const body = {
|
|
19827
19827
|
name,
|
|
19828
|
-
|
|
19828
|
+
ownerDid,
|
|
19829
19829
|
threshold: { n: 1, t: 1 }
|
|
19830
19830
|
};
|
|
19831
19831
|
const crypto2 = this.createEncryptionCrypto();
|
|
@@ -20015,7 +20015,12 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
20015
20015
|
if (delegation.expiry.getTime() <= Date.now()) {
|
|
20016
20016
|
throw new import_sdk_core5.SessionExpiredError(delegation.expiry);
|
|
20017
20017
|
}
|
|
20018
|
-
const expectedDids = /* @__PURE__ */ new Set([
|
|
20018
|
+
const expectedDids = /* @__PURE__ */ new Set([
|
|
20019
|
+
session.verificationMethod,
|
|
20020
|
+
this.didWithoutFragment(session.verificationMethod),
|
|
20021
|
+
this.sessionDid,
|
|
20022
|
+
this.didWithoutFragment(this.sessionDid)
|
|
20023
|
+
]);
|
|
20019
20024
|
if (!expectedDids.has(delegation.delegateDID)) {
|
|
20020
20025
|
throw new Error(
|
|
20021
20026
|
`Runtime delegation targets ${delegation.delegateDID} but this session key is ${session.verificationMethod}.`
|
|
@@ -20851,6 +20856,10 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
20851
20856
|
expiresAt: delegation.expiry
|
|
20852
20857
|
};
|
|
20853
20858
|
}
|
|
20859
|
+
didWithoutFragment(did) {
|
|
20860
|
+
const fragment = did.indexOf("#");
|
|
20861
|
+
return fragment === -1 ? did : did.slice(0, fragment);
|
|
20862
|
+
}
|
|
20854
20863
|
installRuntimeGrantFromServiceSession(delegation, session, expiresAt) {
|
|
20855
20864
|
const operations = this.operationsFromDelegation(delegation);
|
|
20856
20865
|
if (operations.length === 0) {
|