@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
|
@@ -1406,6 +1406,7 @@ declare class TinyCloudNode {
|
|
|
1406
1406
|
private findRuntimeGrantsForPermissionEntries;
|
|
1407
1407
|
private runtimeDelegationFromSession;
|
|
1408
1408
|
private runtimeGrantFromDelegation;
|
|
1409
|
+
private didWithoutFragment;
|
|
1409
1410
|
private installRuntimeGrantFromServiceSession;
|
|
1410
1411
|
private delegatedResourcesForEntries;
|
|
1411
1412
|
private operationsFromDelegation;
|
|
@@ -1406,6 +1406,7 @@ declare class TinyCloudNode {
|
|
|
1406
1406
|
private findRuntimeGrantsForPermissionEntries;
|
|
1407
1407
|
private runtimeDelegationFromSession;
|
|
1408
1408
|
private runtimeGrantFromDelegation;
|
|
1409
|
+
private didWithoutFragment;
|
|
1409
1410
|
private installRuntimeGrantFromServiceSession;
|
|
1410
1411
|
private delegatedResourcesForEntries;
|
|
1411
1412
|
private operationsFromDelegation;
|
package/dist/core.cjs
CHANGED
|
@@ -2342,8 +2342,8 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
2342
2342
|
fetchByNetworkId: (networkId) => this.getEncryptionNetwork(networkId)
|
|
2343
2343
|
},
|
|
2344
2344
|
wellKnown: {
|
|
2345
|
-
fetchWellKnown: async (
|
|
2346
|
-
if (!this._address ||
|
|
2345
|
+
fetchWellKnown: async (ownerDid, discoveryKey) => {
|
|
2346
|
+
if (!this._address || ownerDid !== this.did) {
|
|
2347
2347
|
return null;
|
|
2348
2348
|
}
|
|
2349
2349
|
if (!this.config.host) {
|
|
@@ -2805,11 +2805,11 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
2805
2805
|
}
|
|
2806
2806
|
async createEncryptionNetwork(name = DEFAULT_ENCRYPTION_NETWORK_NAME) {
|
|
2807
2807
|
const targetNode = await this.fetchNodeId();
|
|
2808
|
-
const
|
|
2808
|
+
const ownerDid = this.did;
|
|
2809
2809
|
const networkId = this.getDefaultEncryptionNetworkId(name);
|
|
2810
2810
|
const body = {
|
|
2811
2811
|
name,
|
|
2812
|
-
|
|
2812
|
+
ownerDid,
|
|
2813
2813
|
threshold: { n: 1, t: 1 }
|
|
2814
2814
|
};
|
|
2815
2815
|
const crypto = this.createEncryptionCrypto();
|
|
@@ -2999,7 +2999,12 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
2999
2999
|
if (delegation.expiry.getTime() <= Date.now()) {
|
|
3000
3000
|
throw new import_sdk_core6.SessionExpiredError(delegation.expiry);
|
|
3001
3001
|
}
|
|
3002
|
-
const expectedDids = /* @__PURE__ */ new Set([
|
|
3002
|
+
const expectedDids = /* @__PURE__ */ new Set([
|
|
3003
|
+
session.verificationMethod,
|
|
3004
|
+
this.didWithoutFragment(session.verificationMethod),
|
|
3005
|
+
this.sessionDid,
|
|
3006
|
+
this.didWithoutFragment(this.sessionDid)
|
|
3007
|
+
]);
|
|
3003
3008
|
if (!expectedDids.has(delegation.delegateDID)) {
|
|
3004
3009
|
throw new Error(
|
|
3005
3010
|
`Runtime delegation targets ${delegation.delegateDID} but this session key is ${session.verificationMethod}.`
|
|
@@ -3835,6 +3840,10 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
3835
3840
|
expiresAt: delegation.expiry
|
|
3836
3841
|
};
|
|
3837
3842
|
}
|
|
3843
|
+
didWithoutFragment(did) {
|
|
3844
|
+
const fragment = did.indexOf("#");
|
|
3845
|
+
return fragment === -1 ? did : did.slice(0, fragment);
|
|
3846
|
+
}
|
|
3838
3847
|
installRuntimeGrantFromServiceSession(delegation, session, expiresAt) {
|
|
3839
3848
|
const operations = this.operationsFromDelegation(delegation);
|
|
3840
3849
|
if (operations.length === 0) {
|