@tinycloud/node-sdk 3.6.0-beta.7 → 3.6.0-beta.8
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 +412 -390
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.cts +9 -2
- package/dist/core.d.ts +9 -2
- package/dist/core.js +38 -14
- package/dist/core.js.map +1 -1
- package/dist/index.cjs +470 -450
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +37 -14
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/core.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReplicationOptions } from '@tinycloud/sdk-core';
|
|
1
|
+
import { ReplicationOptions, Manifest, PermissionEntry } from '@tinycloud/sdk-core';
|
|
2
2
|
export { ACCOUNT_REGISTRY_PATH, ACCOUNT_REGISTRY_SPACE, AccountApplication, AccountApplicationListOptions, AccountApplicationRegisterOptions, AccountDelegation, AccountDelegationListOptions, AccountDelegationRevokeOptions, AccountIndexEnsureResult, AccountIndexRebuildResult, AccountIndexStatus, AccountIndexedReadOptions, AccountService, AccountServiceConfig, AccountSpace, AccountSpaceListOptions, AccountStatus, AuthorityRefusal, AutoApproveSpaceCreationHandler, AutoRejectStrategy, AutoSignStrategy, BatchOptions, BatchResponse, CallbackStrategy, CanonicalAddress, CanonicalParsedNetworkId, CapabilityEntry, CapabilityKeyRegistry, CapabilityKeyRegistryErrorCode, CapabilityKeyRegistryErrorCodes, CaveatedDelegationUnsupportedError, ClientSession, ColumnInfo, ComposeManifestOptions, ComposedManifestRequest, CreateDelegationParams, DEFAULT_MANIFEST_SPACE, DEFAULT_MANIFEST_VERSION, DEFAULT_SIGNED_READ_URL_EXPIRY_MS, DataVaultConfig, DataVaultService, DatabaseHandle, DelegateReceivedShareParams, DelegatedShareAccess, Delegation, DelegationChain, DelegationChainV2, DelegationDirection, DelegationError, DelegationErrorCode, DelegationErrorCodes, DelegationFilters, DelegationManager, DelegationManagerConfig, DelegationRecord, DelegationResult, DidCacheKeyOptions, DidEqualsOptions, DuckDbAction, DuckDbActionType, DuckDbBatchOptions, DuckDbBatchResponse, DuckDbDatabaseHandle, DuckDbExecuteOptions, DuckDbExecuteResponse, DuckDbOptions, DuckDbQueryOptions, DuckDbQueryResponse, DuckDbService, DuckDbServiceConfig, DuckDbStatement, DuckDbValue, EncodedShareData, ExecuteOptions, ExecuteResponse, Extension, FetchFunction, GenerateShareParams, ICapabilityKeyRegistry, IDataVaultService, IDatabaseHandle, IDuckDbDatabaseHandle, IDuckDbService, IENSResolver, IKVService, INotificationHandler, IPrefixedKVService, ISQLService, ISecretsService, ISessionManager, ISessionStorage, ISharingService, ISigner, ISpace, ISpaceCreationHandler, ISpaceScopedDelegations, ISpaceScopedSharing, ISpaceService, IUserAuthorization, IWasmBindings, IdentityParseError, IngestOptions, InvokeFunction, JWK, KVBatchReadResponse, KVCreateSignedReadUrlOptions, KVListPage, KVReadThrough, KVReplicaHandle, KVReplicaSpec, KVReplicaStorage, KVReplicationController, KVReplicationDeps, KVResponse, KVService, KVServiceConfig, KVSignedReadUrlResponse, KeyInfo, KeyProvider, KeyType, LocalGetResult, LocalListResult, LocalReadMeta, LocalReplicaStatus, LocalSyncResult, Manifest, ManifestDefaults, ManifestRegistryRecord, ManifestSecretActions, ManifestValidationError, OpenKeyCallbackStrategy, OpenKeySigningRequestBody, OpenKeySigningResponseBody, OpenKeySigningStrategyOptions, ParsedSecretCatalogKey, PendingWriteRecord, PendingWriteState, PendingWriteStore, PermissionEntry, PermissionNotInManifestError, PersistedSessionData, PinnedKey, PkhDidParts, PrefixedKVService, ProtocolMismatchError, PurgeTarget, QueryOptions, QueryResponse, ReceiveOptions, RegisterBatchSuccess, RegisterPolicyV3Input, RegisterPolicyV3Receipt, ReplicaAuthorityState, ReplicaCoverage, ReplicaDevice, ReplicaGatedHandle, ReplicaGrantInfo, ReplicaInspectedStatus, ReplicaState, ReplicaStatusEntry, ReplicationAuthority, ReplicationControl, ReplicationEvent, ReplicationIdentity, ReplicationOptions, ReplicationPurgeReport, ReplicationReason, ReplicationScheduler, ResolvedCapabilities, ResolvedDelegate, ResolvedReplicationOptions, ResolvedSecretPath, ResourceCapability, SECRET_NAME_RE, SQLAction, SQLActionType, SQLService, SQLServiceConfig, SchemaInfo, SecretCatalogEntry, SecretPayload, SecretScopeOptions, SecretsError, SecretsService, ServiceContext, ServiceContextConfig, ServiceSession, SessionExpiredError, ShareAccess, ShareLink, ShareLinkData, ShareSchema, SharingService, SharingServiceConfig, SignCallback, SignInOptions, SignRequest, SignResponse, SilentNotificationHandler, Space, SpaceAbilitiesMap, SpaceConfig, SpaceCreationContext, SpaceErrorCode, SpaceErrorCodes, SpaceInfo, SpaceOwnership, SpaceService, SpaceServiceConfig, SqlStatement, SqlValue, StoredDelegationChain, TableInfo, TelemetryConfig, TelemetryEventHandler, TinyCloud, TinyCloudConfig, TinyCloudDebugEnableOptions, TinyCloudDebugEvent, TinyCloudDebugLevel, TinyCloudDebugLogger, TinyCloudDebugTimer, TinyCloudSession, UnsupportedFeatureError, VAULT_PERMISSION_SERVICE, VaultCrypto, VaultEntry, VaultError, VaultGetOptions, VaultGrantOptions, VaultHeaders, VaultListOptions, VaultNetworkReadResult, VaultPublicSpaceKVActions, VaultPutOptions, VersionCheckError, ViewInfo, WasmVaultFunctions, addressStorageKey, buildSpaceUri, canonicalizeAddress, canonicalizeDid, canonicalizeDidUrl, canonicalizeNetworkId, canonicalizeSecretScope, checkNodeInfo, clearTinyCloudDebugLogs, composeManifestRequest, createCapabilityKeyRegistry, createOpenKeyCallbackSigningStrategy, createSharingService, createSpaceService, createVaultCrypto, defaultSpaceCreationHandler, didCacheKey, didEquals, disableTinyCloudDebug, enableTinyCloudDebug, expandActionShortNames, expandPermissionEntries, expandPermissionEntry, getTinyCloudDebugLogs, installTinyCloudDebugGlobals, isCapabilitySubset, isEvmAddress, loadManifest, makePkhSpaceId, makePublicSpaceId, parseCanonicalNetworkId, parseExpiry, parsePkhDid, parseSecretCatalogKey, parseSpaceUri, pkhDid, principalDid, principalDidEquals, resolveManifest, resolveSecretListPrefix, resolveSecretPath, resourceCapabilitiesToSpaceAbilitiesMap, tinyCloudDebugLogger, validateManifest } from '@tinycloud/sdk-core';
|
|
3
3
|
import { _ as __gated_network } from './gated-network-BEF2XSTC.cjs';
|
|
4
4
|
import { _ as __authority } from './authority-Beg1WM2U.cjs';
|
|
@@ -45,4 +45,11 @@ type ReplicationModuleLoaders = {
|
|
|
45
45
|
declare function registerReplicationLoaders(loaders: ReplicationModuleLoaders): void;
|
|
46
46
|
declare function getNodeReplicationLoaders(): ReplicationModuleLoaders;
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
/**
|
|
49
|
+
* Throws `CaveatedDelegationUnsupportedError` for permission entries, or the
|
|
50
|
+
* permissions of manifests, that carry a caveat. Only absent, `[]` and `[{}]`
|
|
51
|
+
* pass; `null` and malformed caveats fail closed.
|
|
52
|
+
*/
|
|
53
|
+
declare function refuseCaveated(input: Manifest | readonly (Manifest | PermissionEntry)[] | undefined): void;
|
|
54
|
+
|
|
55
|
+
export { type ReplicationModuleLoaders, getNodeReplicationLoaders, refuseCaveated, registerReplicationLoaders };
|
package/dist/core.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReplicationOptions } from '@tinycloud/sdk-core';
|
|
1
|
+
import { ReplicationOptions, Manifest, PermissionEntry } from '@tinycloud/sdk-core';
|
|
2
2
|
export { ACCOUNT_REGISTRY_PATH, ACCOUNT_REGISTRY_SPACE, AccountApplication, AccountApplicationListOptions, AccountApplicationRegisterOptions, AccountDelegation, AccountDelegationListOptions, AccountDelegationRevokeOptions, AccountIndexEnsureResult, AccountIndexRebuildResult, AccountIndexStatus, AccountIndexedReadOptions, AccountService, AccountServiceConfig, AccountSpace, AccountSpaceListOptions, AccountStatus, AuthorityRefusal, AutoApproveSpaceCreationHandler, AutoRejectStrategy, AutoSignStrategy, BatchOptions, BatchResponse, CallbackStrategy, CanonicalAddress, CanonicalParsedNetworkId, CapabilityEntry, CapabilityKeyRegistry, CapabilityKeyRegistryErrorCode, CapabilityKeyRegistryErrorCodes, CaveatedDelegationUnsupportedError, ClientSession, ColumnInfo, ComposeManifestOptions, ComposedManifestRequest, CreateDelegationParams, DEFAULT_MANIFEST_SPACE, DEFAULT_MANIFEST_VERSION, DEFAULT_SIGNED_READ_URL_EXPIRY_MS, DataVaultConfig, DataVaultService, DatabaseHandle, DelegateReceivedShareParams, DelegatedShareAccess, Delegation, DelegationChain, DelegationChainV2, DelegationDirection, DelegationError, DelegationErrorCode, DelegationErrorCodes, DelegationFilters, DelegationManager, DelegationManagerConfig, DelegationRecord, DelegationResult, DidCacheKeyOptions, DidEqualsOptions, DuckDbAction, DuckDbActionType, DuckDbBatchOptions, DuckDbBatchResponse, DuckDbDatabaseHandle, DuckDbExecuteOptions, DuckDbExecuteResponse, DuckDbOptions, DuckDbQueryOptions, DuckDbQueryResponse, DuckDbService, DuckDbServiceConfig, DuckDbStatement, DuckDbValue, EncodedShareData, ExecuteOptions, ExecuteResponse, Extension, FetchFunction, GenerateShareParams, ICapabilityKeyRegistry, IDataVaultService, IDatabaseHandle, IDuckDbDatabaseHandle, IDuckDbService, IENSResolver, IKVService, INotificationHandler, IPrefixedKVService, ISQLService, ISecretsService, ISessionManager, ISessionStorage, ISharingService, ISigner, ISpace, ISpaceCreationHandler, ISpaceScopedDelegations, ISpaceScopedSharing, ISpaceService, IUserAuthorization, IWasmBindings, IdentityParseError, IngestOptions, InvokeFunction, JWK, KVBatchReadResponse, KVCreateSignedReadUrlOptions, KVListPage, KVReadThrough, KVReplicaHandle, KVReplicaSpec, KVReplicaStorage, KVReplicationController, KVReplicationDeps, KVResponse, KVService, KVServiceConfig, KVSignedReadUrlResponse, KeyInfo, KeyProvider, KeyType, LocalGetResult, LocalListResult, LocalReadMeta, LocalReplicaStatus, LocalSyncResult, Manifest, ManifestDefaults, ManifestRegistryRecord, ManifestSecretActions, ManifestValidationError, OpenKeyCallbackStrategy, OpenKeySigningRequestBody, OpenKeySigningResponseBody, OpenKeySigningStrategyOptions, ParsedSecretCatalogKey, PendingWriteRecord, PendingWriteState, PendingWriteStore, PermissionEntry, PermissionNotInManifestError, PersistedSessionData, PinnedKey, PkhDidParts, PrefixedKVService, ProtocolMismatchError, PurgeTarget, QueryOptions, QueryResponse, ReceiveOptions, RegisterBatchSuccess, RegisterPolicyV3Input, RegisterPolicyV3Receipt, ReplicaAuthorityState, ReplicaCoverage, ReplicaDevice, ReplicaGatedHandle, ReplicaGrantInfo, ReplicaInspectedStatus, ReplicaState, ReplicaStatusEntry, ReplicationAuthority, ReplicationControl, ReplicationEvent, ReplicationIdentity, ReplicationOptions, ReplicationPurgeReport, ReplicationReason, ReplicationScheduler, ResolvedCapabilities, ResolvedDelegate, ResolvedReplicationOptions, ResolvedSecretPath, ResourceCapability, SECRET_NAME_RE, SQLAction, SQLActionType, SQLService, SQLServiceConfig, SchemaInfo, SecretCatalogEntry, SecretPayload, SecretScopeOptions, SecretsError, SecretsService, ServiceContext, ServiceContextConfig, ServiceSession, SessionExpiredError, ShareAccess, ShareLink, ShareLinkData, ShareSchema, SharingService, SharingServiceConfig, SignCallback, SignInOptions, SignRequest, SignResponse, SilentNotificationHandler, Space, SpaceAbilitiesMap, SpaceConfig, SpaceCreationContext, SpaceErrorCode, SpaceErrorCodes, SpaceInfo, SpaceOwnership, SpaceService, SpaceServiceConfig, SqlStatement, SqlValue, StoredDelegationChain, TableInfo, TelemetryConfig, TelemetryEventHandler, TinyCloud, TinyCloudConfig, TinyCloudDebugEnableOptions, TinyCloudDebugEvent, TinyCloudDebugLevel, TinyCloudDebugLogger, TinyCloudDebugTimer, TinyCloudSession, UnsupportedFeatureError, VAULT_PERMISSION_SERVICE, VaultCrypto, VaultEntry, VaultError, VaultGetOptions, VaultGrantOptions, VaultHeaders, VaultListOptions, VaultNetworkReadResult, VaultPublicSpaceKVActions, VaultPutOptions, VersionCheckError, ViewInfo, WasmVaultFunctions, addressStorageKey, buildSpaceUri, canonicalizeAddress, canonicalizeDid, canonicalizeDidUrl, canonicalizeNetworkId, canonicalizeSecretScope, checkNodeInfo, clearTinyCloudDebugLogs, composeManifestRequest, createCapabilityKeyRegistry, createOpenKeyCallbackSigningStrategy, createSharingService, createSpaceService, createVaultCrypto, defaultSpaceCreationHandler, didCacheKey, didEquals, disableTinyCloudDebug, enableTinyCloudDebug, expandActionShortNames, expandPermissionEntries, expandPermissionEntry, getTinyCloudDebugLogs, installTinyCloudDebugGlobals, isCapabilitySubset, isEvmAddress, loadManifest, makePkhSpaceId, makePublicSpaceId, parseCanonicalNetworkId, parseExpiry, parsePkhDid, parseSecretCatalogKey, parseSpaceUri, pkhDid, principalDid, principalDidEquals, resolveManifest, resolveSecretListPrefix, resolveSecretPath, resourceCapabilitiesToSpaceAbilitiesMap, tinyCloudDebugLogger, validateManifest } from '@tinycloud/sdk-core';
|
|
3
3
|
import { _ as __gated_network } from './gated-network-BEF2XSTC.js';
|
|
4
4
|
import { _ as __authority } from './authority-Vh7ike0I.js';
|
|
@@ -45,4 +45,11 @@ type ReplicationModuleLoaders = {
|
|
|
45
45
|
declare function registerReplicationLoaders(loaders: ReplicationModuleLoaders): void;
|
|
46
46
|
declare function getNodeReplicationLoaders(): ReplicationModuleLoaders;
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
/**
|
|
49
|
+
* Throws `CaveatedDelegationUnsupportedError` for permission entries, or the
|
|
50
|
+
* permissions of manifests, that carry a caveat. Only absent, `[]` and `[{}]`
|
|
51
|
+
* pass; `null` and malformed caveats fail closed.
|
|
52
|
+
*/
|
|
53
|
+
declare function refuseCaveated(input: Manifest | readonly (Manifest | PermissionEntry)[] | undefined): void;
|
|
54
|
+
|
|
55
|
+
export { type ReplicationModuleLoaders, getNodeReplicationLoaders, refuseCaveated, registerReplicationLoaders };
|
package/dist/core.js
CHANGED
|
@@ -325,6 +325,22 @@ function augmentSignInEntriesWithReplication(input) {
|
|
|
325
325
|
return out;
|
|
326
326
|
}
|
|
327
327
|
|
|
328
|
+
// src/authorization/caveatRefusal.ts
|
|
329
|
+
import {
|
|
330
|
+
CaveatedDelegationUnsupportedError,
|
|
331
|
+
recapCaveatsEqual
|
|
332
|
+
} from "@tinycloud/sdk-core";
|
|
333
|
+
function refuseCaveated(input) {
|
|
334
|
+
const caveated = [input ?? []].flat().flatMap((item) => [item, ...item.permissions ?? []]).filter(({ caveats }) => {
|
|
335
|
+
try {
|
|
336
|
+
return caveats === null || !recapCaveatsEqual(caveats, void 0);
|
|
337
|
+
} catch {
|
|
338
|
+
return true;
|
|
339
|
+
}
|
|
340
|
+
});
|
|
341
|
+
if (caveated.length) throw new CaveatedDelegationUnsupportedError(caveated);
|
|
342
|
+
}
|
|
343
|
+
|
|
328
344
|
// src/authorization/strategies.ts
|
|
329
345
|
import { createOpenKeyCallbackSigningStrategy } from "@tinycloud/sdk-core";
|
|
330
346
|
var defaultSignStrategy = { type: "auto-sign" };
|
|
@@ -1222,6 +1238,7 @@ var NodeUserAuthorization = class {
|
|
|
1222
1238
|
this._lastActivationSkippedSpaceIds = result.status === 404 ? [primarySpaceId] : [];
|
|
1223
1239
|
}
|
|
1224
1240
|
async createBootstrapSession(options) {
|
|
1241
|
+
refuseCaveated(options.capabilityRequest.manifests);
|
|
1225
1242
|
if (!this._address || !this._chainId) {
|
|
1226
1243
|
throw new Error("Must be signed in before creating bootstrap sessions");
|
|
1227
1244
|
}
|
|
@@ -1323,6 +1340,7 @@ var NodeUserAuthorization = class {
|
|
|
1323
1340
|
* @param options - Optional per-call SIWE overrides for this sign-in only
|
|
1324
1341
|
*/
|
|
1325
1342
|
async signIn(options) {
|
|
1343
|
+
refuseCaveated(this.getCapabilityRequest()?.manifests);
|
|
1326
1344
|
const generation = this.sessionGeneration;
|
|
1327
1345
|
const address = canonicalizeAddress(await this.signer.getAddress());
|
|
1328
1346
|
const chainId = await this.signer.getChainId();
|
|
@@ -1474,6 +1492,7 @@ var NodeUserAuthorization = class {
|
|
|
1474
1492
|
* ```
|
|
1475
1493
|
*/
|
|
1476
1494
|
async prepareSessionForSigning() {
|
|
1495
|
+
refuseCaveated(this.getCapabilityRequest()?.manifests);
|
|
1477
1496
|
const address = canonicalizeAddress(await this.signer.getAddress());
|
|
1478
1497
|
const chainId = await this.signer.getChainId();
|
|
1479
1498
|
const keyId = `session-${Date.now()}`;
|
|
@@ -1605,6 +1624,7 @@ var NodeUserAuthorization = class {
|
|
|
1605
1624
|
* @param options Optional overrides for the OpenKey request.
|
|
1606
1625
|
*/
|
|
1607
1626
|
async signInWithOpenKey(authorizeFn, options) {
|
|
1627
|
+
refuseCaveated(this.getCapabilityRequest()?.manifests);
|
|
1608
1628
|
if (options?.host !== void 0) {
|
|
1609
1629
|
const overrideHost = options.host.trim();
|
|
1610
1630
|
if (!overrideHost) {
|
|
@@ -2736,11 +2756,11 @@ import {
|
|
|
2736
2756
|
bootstrapSteps,
|
|
2737
2757
|
ErrorCodes as ErrorCodes2,
|
|
2738
2758
|
ENCRYPTION_PERMISSION_SERVICE as ENCRYPTION_PERMISSION_SERVICE2,
|
|
2739
|
-
CaveatedDelegationUnsupportedError,
|
|
2759
|
+
CaveatedDelegationUnsupportedError as CaveatedDelegationUnsupportedError2,
|
|
2740
2760
|
PermissionNotInManifestError,
|
|
2741
2761
|
SessionExpiredError,
|
|
2742
2762
|
canonicalizeRecapCaveats as canonicalizeRecapCaveats2,
|
|
2743
|
-
recapCaveatsEqual,
|
|
2763
|
+
recapCaveatsEqual as recapCaveatsEqual2,
|
|
2744
2764
|
expandPermissionEntries as expandPermissionEntriesCore,
|
|
2745
2765
|
isCapabilitySubset as isCapabilitySubset2,
|
|
2746
2766
|
isExplicitOnlyAction,
|
|
@@ -3546,6 +3566,7 @@ function ownerDelegationPermissions(params) {
|
|
|
3546
3566
|
if (!Array.isArray(params.permissions)) {
|
|
3547
3567
|
throw new Error("Owner delegation permissions are invalid");
|
|
3548
3568
|
}
|
|
3569
|
+
refuseCaveated(params.permissions);
|
|
3549
3570
|
permissions.push(...params.permissions.map((permission) => ({
|
|
3550
3571
|
service: permission.service,
|
|
3551
3572
|
path: permission.path,
|
|
@@ -3920,7 +3941,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
3920
3941
|
if (!granted?.caveats?.length) {
|
|
3921
3942
|
return entry;
|
|
3922
3943
|
}
|
|
3923
|
-
if (entry.caveats !== void 0 && !
|
|
3944
|
+
if (entry.caveats !== void 0 && !recapCaveatsEqual2(entry.caveats, granted.caveats)) {
|
|
3924
3945
|
throw new Error("Invocation caveats do not match signed ReCap authority.");
|
|
3925
3946
|
}
|
|
3926
3947
|
return { ...entry, caveats: cloneRecapCaveats(granted.caveats) };
|
|
@@ -4639,6 +4660,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
4639
4660
|
await this.signInWith(() => this.auth.signInWithOpenKey(authorizeFn, options));
|
|
4640
4661
|
}
|
|
4641
4662
|
async signInWith(performSignIn) {
|
|
4663
|
+
refuseCaveated(this.auth?.capabilityRequest?.manifests);
|
|
4642
4664
|
const epoch = this.sessionEpoch;
|
|
4643
4665
|
const attempt = ++this.latestSessionAttempt;
|
|
4644
4666
|
await this.signOutInFlight;
|
|
@@ -8561,7 +8583,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
8561
8583
|
throw new SessionExpiredError(plan.expiredAt ?? sessionExpiry ?? /* @__PURE__ */ new Date(0));
|
|
8562
8584
|
}
|
|
8563
8585
|
if (plan.refused === "CAVEATED_AUTHORITY") {
|
|
8564
|
-
throw new
|
|
8586
|
+
throw new CaveatedDelegationUnsupportedError2(plan.caveated ?? []);
|
|
8565
8587
|
}
|
|
8566
8588
|
throw new PermissionNotInManifestError(plan.missing ?? [], plan.granted ?? []);
|
|
8567
8589
|
}
|
|
@@ -8602,7 +8624,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
8602
8624
|
*/
|
|
8603
8625
|
planDerivation(expandedEntries, session, effectiveExpiration, nowMs) {
|
|
8604
8626
|
const caveatedRequest = expandedEntries.filter(
|
|
8605
|
-
(entry) => !
|
|
8627
|
+
(entry) => !recapCaveatsEqual2(entry.caveats, void 0)
|
|
8606
8628
|
);
|
|
8607
8629
|
if (caveatedRequest.length > 0) {
|
|
8608
8630
|
return { refused: "CAVEATED_AUTHORITY", caveated: caveatedRequest };
|
|
@@ -8965,10 +8987,10 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
8965
8987
|
*/
|
|
8966
8988
|
assertDelegationCaveatsPreservable(entries) {
|
|
8967
8989
|
const caveated = entries.filter(
|
|
8968
|
-
(entry) => !
|
|
8990
|
+
(entry) => !recapCaveatsEqual2(entry.caveats, void 0)
|
|
8969
8991
|
);
|
|
8970
8992
|
if (caveated.length > 0) {
|
|
8971
|
-
throw new
|
|
8993
|
+
throw new CaveatedDelegationUnsupportedError2(caveated);
|
|
8972
8994
|
}
|
|
8973
8995
|
}
|
|
8974
8996
|
/**
|
|
@@ -8980,7 +9002,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
8980
9002
|
assertRuntimeGrantCaveatsPreservable(entries, requestedOperations, grant) {
|
|
8981
9003
|
const caveated = this.caveatedRuntimeGrantEntries(entries, requestedOperations, grant);
|
|
8982
9004
|
if (caveated.length > 0) {
|
|
8983
|
-
throw new
|
|
9005
|
+
throw new CaveatedDelegationUnsupportedError2(caveated);
|
|
8984
9006
|
}
|
|
8985
9007
|
}
|
|
8986
9008
|
/**
|
|
@@ -8997,7 +9019,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
8997
9019
|
const requested = requestedOperations[operationIndex++];
|
|
8998
9020
|
if (!requested) continue;
|
|
8999
9021
|
const constrained = grant.operations.find(
|
|
9000
|
-
(granted) => this.operationCovers(granted, requested) && !
|
|
9022
|
+
(granted) => this.operationCovers(granted, requested) && !recapCaveatsEqual2(granted.caveats, void 0)
|
|
9001
9023
|
);
|
|
9002
9024
|
if (constrained) {
|
|
9003
9025
|
caveated.push({
|
|
@@ -9014,7 +9036,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
9014
9036
|
assertPortableDelegationCaveatsPreservable(delegation) {
|
|
9015
9037
|
const entries = [];
|
|
9016
9038
|
const add = (service, space, path, actions, caveats) => {
|
|
9017
|
-
if (
|
|
9039
|
+
if (recapCaveatsEqual2(caveats, void 0)) return;
|
|
9018
9040
|
entries.push({
|
|
9019
9041
|
service: service.startsWith("tinycloud.") ? service : `tinycloud.${service}`,
|
|
9020
9042
|
space,
|
|
@@ -9034,7 +9056,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
9034
9056
|
add(resource.service, resource.space, resource.path, resource.actions, resource.caveats);
|
|
9035
9057
|
}
|
|
9036
9058
|
if (entries.length > 0) {
|
|
9037
|
-
throw new
|
|
9059
|
+
throw new CaveatedDelegationUnsupportedError2(entries);
|
|
9038
9060
|
}
|
|
9039
9061
|
}
|
|
9040
9062
|
shortServiceName(service) {
|
|
@@ -9360,7 +9382,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
9360
9382
|
if (granted.service !== requested.service || !this.actionContains(granted.action, requested.action)) {
|
|
9361
9383
|
return false;
|
|
9362
9384
|
}
|
|
9363
|
-
if (requested.caveats !== void 0 && !
|
|
9385
|
+
if (requested.caveats !== void 0 && !recapCaveatsEqual2(granted.caveats, requested.caveats)) {
|
|
9364
9386
|
return false;
|
|
9365
9387
|
}
|
|
9366
9388
|
if (granted.resource !== void 0 || requested.resource !== void 0) {
|
|
@@ -9785,6 +9807,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
9785
9807
|
*/
|
|
9786
9808
|
async createSubDelegation(parentDelegation, params) {
|
|
9787
9809
|
this.assertPortableDelegationCaveatsPreservable(parentDelegation);
|
|
9810
|
+
refuseCaveated(params.resources);
|
|
9788
9811
|
if (!this.signer) {
|
|
9789
9812
|
throw new Error("Cannot createSubDelegation() in session-only mode. Requires wallet mode.");
|
|
9790
9813
|
}
|
|
@@ -9906,7 +9929,7 @@ import {
|
|
|
9906
9929
|
DEFAULT_MANIFEST_SPACE as DEFAULT_MANIFEST_SPACE2,
|
|
9907
9930
|
DEFAULT_MANIFEST_VERSION,
|
|
9908
9931
|
VAULT_PERMISSION_SERVICE,
|
|
9909
|
-
CaveatedDelegationUnsupportedError as
|
|
9932
|
+
CaveatedDelegationUnsupportedError as CaveatedDelegationUnsupportedError3,
|
|
9910
9933
|
PermissionNotInManifestError as PermissionNotInManifestError2,
|
|
9911
9934
|
SessionExpiredError as SessionExpiredError2,
|
|
9912
9935
|
ManifestValidationError,
|
|
@@ -9978,7 +10001,7 @@ export {
|
|
|
9978
10001
|
AutoApproveSpaceCreationHandler2 as AutoApproveSpaceCreationHandler,
|
|
9979
10002
|
CapabilityKeyRegistry2 as CapabilityKeyRegistry,
|
|
9980
10003
|
CapabilityKeyRegistryErrorCodes,
|
|
9981
|
-
|
|
10004
|
+
CaveatedDelegationUnsupportedError3 as CaveatedDelegationUnsupportedError,
|
|
9982
10005
|
DEFAULT_MANIFEST_SPACE2 as DEFAULT_MANIFEST_SPACE,
|
|
9983
10006
|
DEFAULT_MANIFEST_VERSION,
|
|
9984
10007
|
DEFAULT_SIGNED_READ_URL_EXPIRY_MS,
|
|
@@ -10064,6 +10087,7 @@ export {
|
|
|
10064
10087
|
pkhDid3 as pkhDid,
|
|
10065
10088
|
principalDid,
|
|
10066
10089
|
principalDidEquals4 as principalDidEquals,
|
|
10090
|
+
refuseCaveated,
|
|
10067
10091
|
registerReplicationLoaders,
|
|
10068
10092
|
resolveManifest2 as resolveManifest,
|
|
10069
10093
|
resolveSecretListPrefix2 as resolveSecretListPrefix,
|