@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/index.cjs CHANGED
@@ -19356,6 +19356,23 @@ var _TinyCloudNode = class _TinyCloudNode {
19356
19356
  transport,
19357
19357
  node: {
19358
19358
  fetchByNetworkId: (networkId) => this.getEncryptionNetwork(networkId)
19359
+ },
19360
+ wellKnown: {
19361
+ fetchWellKnown: async (principal, discoveryKey) => {
19362
+ if (!this._address || principal !== this.did) {
19363
+ return null;
19364
+ }
19365
+ if (!this.config.host) {
19366
+ return null;
19367
+ }
19368
+ const publicSpaceId = (0, import_sdk_core5.makePublicSpaceId)(this._address, this._chainId);
19369
+ const result = await import_sdk_core5.TinyCloud.readPublicSpace(this.config.host, publicSpaceId, discoveryKey);
19370
+ if (!result.ok) {
19371
+ return null;
19372
+ }
19373
+ const body = result.data;
19374
+ return "descriptor" in body && body.descriptor ? body.descriptor : body;
19375
+ }
19359
19376
  }
19360
19377
  });
19361
19378
  }
@@ -19998,7 +20015,12 @@ var _TinyCloudNode = class _TinyCloudNode {
19998
20015
  if (delegation.expiry.getTime() <= Date.now()) {
19999
20016
  throw new import_sdk_core5.SessionExpiredError(delegation.expiry);
20000
20017
  }
20001
- const expectedDids = /* @__PURE__ */ new Set([session.verificationMethod, this.sessionDid]);
20018
+ const expectedDids = /* @__PURE__ */ new Set([
20019
+ session.verificationMethod,
20020
+ this.didWithoutFragment(session.verificationMethod),
20021
+ this.sessionDid,
20022
+ this.didWithoutFragment(this.sessionDid)
20023
+ ]);
20002
20024
  if (!expectedDids.has(delegation.delegateDID)) {
20003
20025
  throw new Error(
20004
20026
  `Runtime delegation targets ${delegation.delegateDID} but this session key is ${session.verificationMethod}.`
@@ -20834,6 +20856,10 @@ var _TinyCloudNode = class _TinyCloudNode {
20834
20856
  expiresAt: delegation.expiry
20835
20857
  };
20836
20858
  }
20859
+ didWithoutFragment(did) {
20860
+ const fragment = did.indexOf("#");
20861
+ return fragment === -1 ? did : did.slice(0, fragment);
20862
+ }
20837
20863
  installRuntimeGrantFromServiceSession(delegation, session, expiresAt) {
20838
20864
  const operations = this.operationsFromDelegation(delegation);
20839
20865
  if (operations.length === 0) {