@tinycloud/node-sdk 2.2.0 → 2.2.1-beta.1
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 +27 -1
- 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 +27 -1
- package/dist/core.js.map +1 -1
- package/dist/index.cjs +27 -1
- 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 +27 -1
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
|
@@ -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
|
@@ -2340,6 +2340,23 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
2340
2340
|
transport,
|
|
2341
2341
|
node: {
|
|
2342
2342
|
fetchByNetworkId: (networkId) => this.getEncryptionNetwork(networkId)
|
|
2343
|
+
},
|
|
2344
|
+
wellKnown: {
|
|
2345
|
+
fetchWellKnown: async (principal, discoveryKey) => {
|
|
2346
|
+
if (!this._address || principal !== this.did) {
|
|
2347
|
+
return null;
|
|
2348
|
+
}
|
|
2349
|
+
if (!this.config.host) {
|
|
2350
|
+
return null;
|
|
2351
|
+
}
|
|
2352
|
+
const publicSpaceId = (0, import_sdk_core6.makePublicSpaceId)(this._address, this._chainId);
|
|
2353
|
+
const result = await import_sdk_core6.TinyCloud.readPublicSpace(this.config.host, publicSpaceId, discoveryKey);
|
|
2354
|
+
if (!result.ok) {
|
|
2355
|
+
return null;
|
|
2356
|
+
}
|
|
2357
|
+
const body = result.data;
|
|
2358
|
+
return "descriptor" in body && body.descriptor ? body.descriptor : body;
|
|
2359
|
+
}
|
|
2343
2360
|
}
|
|
2344
2361
|
});
|
|
2345
2362
|
}
|
|
@@ -2982,7 +2999,12 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
2982
2999
|
if (delegation.expiry.getTime() <= Date.now()) {
|
|
2983
3000
|
throw new import_sdk_core6.SessionExpiredError(delegation.expiry);
|
|
2984
3001
|
}
|
|
2985
|
-
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
|
+
]);
|
|
2986
3008
|
if (!expectedDids.has(delegation.delegateDID)) {
|
|
2987
3009
|
throw new Error(
|
|
2988
3010
|
`Runtime delegation targets ${delegation.delegateDID} but this session key is ${session.verificationMethod}.`
|
|
@@ -3818,6 +3840,10 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
3818
3840
|
expiresAt: delegation.expiry
|
|
3819
3841
|
};
|
|
3820
3842
|
}
|
|
3843
|
+
didWithoutFragment(did) {
|
|
3844
|
+
const fragment = did.indexOf("#");
|
|
3845
|
+
return fragment === -1 ? did : did.slice(0, fragment);
|
|
3846
|
+
}
|
|
3821
3847
|
installRuntimeGrantFromServiceSession(delegation, session, expiresAt) {
|
|
3822
3848
|
const operations = this.operationsFromDelegation(delegation);
|
|
3823
3849
|
if (operations.length === 0) {
|