@tinycloud/node-sdk 3.3.0-beta.15 → 3.3.0-beta.16

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.
@@ -1287,7 +1287,8 @@ interface DelegateToOptions {
1287
1287
  * Mark the delegation terminal: the node refuses any delegation that cites
1288
1288
  * it as a parent (`terminal-parent-cannot-redelegate`). The delegate can
1289
1289
  * still use it directly. Only session-key UCAN delegations can carry the
1290
- * marker, so this throws with `forceWalletSign`. Default false.
1290
+ * marker, so this throws with `forceWalletSign`, and with a `did:pkh`
1291
+ * recipient (use its session-key DID). Default false.
1291
1292
  */
1292
1293
  disableSubDelegation?: boolean;
1293
1294
  }
@@ -2746,7 +2747,9 @@ declare class TinyCloudNode {
2746
2747
  * Prevent the recipient from creating sub-delegations (default: false).
2747
2748
  * The delegation carries the node's terminal marker, so the node refuses
2748
2749
  * its children. Needs capabilities the current session holds; throws
2749
- * rather than fall back to a wallet-signed delegation.
2750
+ * rather than fall back to a wallet-signed delegation, and throws for a
2751
+ * `did:pkh` recipient (a wallet-mode `useDelegation` of it is refused);
2752
+ * grant the recipient's session-key DID instead.
2750
2753
  */
2751
2754
  disableSubDelegation?: boolean;
2752
2755
  /** Expiration time in milliseconds from now (default: 1 hour) */
@@ -1287,7 +1287,8 @@ interface DelegateToOptions {
1287
1287
  * Mark the delegation terminal: the node refuses any delegation that cites
1288
1288
  * it as a parent (`terminal-parent-cannot-redelegate`). The delegate can
1289
1289
  * still use it directly. Only session-key UCAN delegations can carry the
1290
- * marker, so this throws with `forceWalletSign`. Default false.
1290
+ * marker, so this throws with `forceWalletSign`, and with a `did:pkh`
1291
+ * recipient (use its session-key DID). Default false.
1291
1292
  */
1292
1293
  disableSubDelegation?: boolean;
1293
1294
  }
@@ -2746,7 +2747,9 @@ declare class TinyCloudNode {
2746
2747
  * Prevent the recipient from creating sub-delegations (default: false).
2747
2748
  * The delegation carries the node's terminal marker, so the node refuses
2748
2749
  * its children. Needs capabilities the current session holds; throws
2749
- * rather than fall back to a wallet-signed delegation.
2750
+ * rather than fall back to a wallet-signed delegation, and throws for a
2751
+ * `did:pkh` recipient (a wallet-mode `useDelegation` of it is refused);
2752
+ * grant the recipient's session-key DID instead.
2750
2753
  */
2751
2754
  disableSubDelegation?: boolean;
2752
2755
  /** Expiration time in milliseconds from now (default: 1 hour) */
@@ -1,7 +1,7 @@
1
1
  import { ReplicationOptions, PermissionEntry, TinyCloudSession, KVReplicaStorage, ServiceContext, IWasmBindings, WasmRecapEntry } from '@tinycloud/sdk-core';
2
2
  import { ReplicaConsentAnchor, AuthorityRefusal, ReplicationAuthority } from '@tinycloud/sdk-services';
3
3
  import { ReplicaSessionStamp, ReplicaDenyInput } from '@tinycloud/sdk-services/kv/replication';
4
- import { T as TinyCloudNode } from './TinyCloudNode-CcNh20QX.js';
4
+ import { T as TinyCloudNode } from './TinyCloudNode-DmF9QUcS.js';
5
5
 
6
6
  /** Constructor-time validation; the space-dependent secrets check runs at sign-in and open. */
7
7
  declare function assertValidReplicationConfig(replication: (ReplicationOptions & {
@@ -1,7 +1,7 @@
1
1
  import { ReplicationOptions, PermissionEntry, TinyCloudSession, KVReplicaStorage, ServiceContext, IWasmBindings, WasmRecapEntry } from '@tinycloud/sdk-core';
2
2
  import { ReplicaConsentAnchor, AuthorityRefusal, ReplicationAuthority } from '@tinycloud/sdk-services';
3
3
  import { ReplicaSessionStamp, ReplicaDenyInput } from '@tinycloud/sdk-services/kv/replication';
4
- import { T as TinyCloudNode } from './TinyCloudNode-CcNh20QX.cjs';
4
+ import { T as TinyCloudNode } from './TinyCloudNode-DmF9QUcS.cjs';
5
5
 
6
6
  /** Constructor-time validation; the space-dependent secrets check runs at sign-in and open. */
7
7
  declare function assertValidReplicationConfig(replication: (ReplicationOptions & {
package/dist/core.cjs CHANGED
@@ -3347,7 +3347,7 @@ function ownerPermissionsToAbilities(permissions) {
3347
3347
  }
3348
3348
  return { abilities, rawAbilities };
3349
3349
  }
3350
- var TERMINAL_DELEGATION_REQUIRES_SESSION_KEY = "disableSubDelegation requires a session-key delegation";
3350
+ 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";
3351
3351
  function base64UrlEncode(bytes) {
3352
3352
  const alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
3353
3353
  let output = "";
@@ -8182,6 +8182,9 @@ var _TinyCloudNode = class _TinyCloudNode {
8182
8182
  "delegateTo: onPrepared cannot be combined with forceWalletSign=true; the wallet-signed path activates the delegation before it could be handed to onPrepared."
8183
8183
  );
8184
8184
  }
8185
+ if (options?.disableSubDelegation && did.startsWith("did:pkh:")) {
8186
+ throw new Error(TERMINAL_DELEGATION_REQUIRES_SESSION_KEY);
8187
+ }
8185
8188
  const session = this.currentTinyCloudSession();
8186
8189
  if (!session) {
8187
8190
  throw new import_sdk_core10.SessionExpiredError(/* @__PURE__ */ new Date(0));