@tinycloud/node-sdk 3.6.0-beta.4 → 3.6.0-beta.6

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.cjs CHANGED
@@ -2983,16 +2983,6 @@ function legacyParamsToPermissionEntries(actions, path, spaceIdOverride) {
2983
2983
  return entries;
2984
2984
  }
2985
2985
  var DEFAULT_DELEGATION_EXPIRY_MS = import_sdk_core8.EXPIRY.SESSION_MS;
2986
- var SHARE_NETWORK_NAME_RE = /^share-[a-z0-9][a-z0-9-]{15,35}$/;
2987
- function grantsCappedDecrypt(path, actions) {
2988
- if (!actions.some((action) => (0, import_sdk_core8.actionContains)(action, import_sdk_core8.ENCRYPTION.DECRYPT))) {
2989
- return false;
2990
- }
2991
- return !((0, import_sdk_core8.isNetworkId)(path) && SHARE_NETWORK_NAME_RE.test((0, import_sdk_core8.parseNetworkId)(path).name));
2992
- }
2993
- function includesDecrypt(entries) {
2994
- return entries.some((entry) => grantsCappedDecrypt(entry.path, entry.actions));
2995
- }
2996
2986
  function resolveExpiryMs(expiry) {
2997
2987
  if (expiry === void 0) {
2998
2988
  return DEFAULT_DELEGATION_EXPIRY_MS;
@@ -3176,8 +3166,7 @@ var NodeSecretsService = class {
3176
3166
  );
3177
3167
  }
3178
3168
  try {
3179
- const grant = action === "get" && this.config.grantGetPermissions !== void 0 ? this.config.grantGetPermissions : this.config.grantPermissions;
3180
- await grant(escalation);
3169
+ await this.config.grantPermissions(escalation);
3181
3170
  return this.restoreUnlockAfterEscalation();
3182
3171
  } catch (error) {
3183
3172
  return this.escalationError(action, target, error);
@@ -3595,8 +3584,6 @@ function ownerPermissionsToAbilities(permissions) {
3595
3584
  return { abilities, rawAbilities };
3596
3585
  }
3597
3586
  var TERMINAL_DELEGATION_REQUIRES_SESSION_KEY = "disableSubDelegation requires a session-key delegation to a did:key (not did:pkh); use the session-key DID or drop the flag";
3598
- var DECRYPT_GRANT_MAX_EXPIRY_MS = 60 * 60 * 1e3;
3599
- var SECRET_GET_GRANT_EXPIRY_MS = 59 * 60 * 1e3;
3600
3587
  function base64UrlEncode(bytes) {
3601
3588
  const alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
3602
3589
  let output = "";
@@ -7719,7 +7706,6 @@ var _TinyCloudNode = class _TinyCloudNode {
7719
7706
  getManifest: () => this.manifest,
7720
7707
  hasPermissions: (permissions) => this.hasRuntimePermissions(permissions),
7721
7708
  grantPermissions: (additional) => this.grantRuntimePermissions(additional),
7722
- grantGetPermissions: (additional) => this.grantRuntimePermissions(additional, { expiry: SECRET_GET_GRANT_EXPIRY_MS }),
7723
7709
  uncoveredEntries: (permissions) => permissions.filter((entry) => !this.hasRuntimePermissions([entry])),
7724
7710
  canEscalate: () => this.signer !== void 0 && this.tc !== void 0,
7725
7711
  getEncryptionNetworkId: () => this.getEncryptionNetworkIdForSpace(resolvedSpace),
@@ -8068,13 +8054,6 @@ var _TinyCloudNode = class _TinyCloudNode {
8068
8054
  }
8069
8055
  }
8070
8056
  const expanded = this.expandPermissionEntries(permissions);
8071
- const requestsDecrypt = includesDecrypt(expanded);
8072
- const requestedExpiryMs = requestsDecrypt && options?.expiry === void 0 ? DECRYPT_GRANT_MAX_EXPIRY_MS : resolveExpiryMs(options?.expiry);
8073
- if (requestsDecrypt && requestedExpiryMs > DECRYPT_GRANT_MAX_EXPIRY_MS) {
8074
- throw Object.assign(new Error("decrypt grants last at most one hour"), {
8075
- code: "DECRYPT_EXPIRY_TOO_LONG"
8076
- });
8077
- }
8078
8057
  if (this.sessionCoversPermissionEntries(session, expanded)) {
8079
8058
  return [];
8080
8059
  }
@@ -8105,6 +8084,7 @@ var _TinyCloudNode = class _TinyCloudNode {
8105
8084
  bySpace.set(session.spaceId, []);
8106
8085
  }
8107
8086
  const now = /* @__PURE__ */ new Date();
8087
+ const requestedExpiryMs = resolveExpiryMs(options?.expiry);
8108
8088
  let expiresAt = new Date(now.getTime() + requestedExpiryMs);
8109
8089
  if (sessionExpiry !== void 0 && sessionExpiry < expiresAt) {
8110
8090
  expiresAt = sessionExpiry;