@tinycloud/node-sdk 3.0.0-beta.19 → 3.0.0-beta.20
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-fgqq1_NV.d.cts → core-DufYfxi-.d.cts} +7 -3
- package/dist/{core-fgqq1_NV.d.ts → core-DufYfxi-.d.ts} +7 -3
- package/dist/core.cjs +54 -44
- 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 +54 -44
- package/dist/core.js.map +1 -1
- package/dist/index.cjs +54 -44
- 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 +54 -44
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/core.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { ACCOUNT_REGISTRY_PATH, ACCOUNT_REGISTRY_SPACE, AccountApplication, AccountApplicationListOptions, AccountApplicationRegisterOptions, AccountDelegation, AccountDelegationListOptions, AccountDelegationRevokeOptions, AccountIndexEnsureResult, AccountIndexRebuildResult, AccountIndexStatus, AccountIndexedReadOptions, AccountService, AccountServiceConfig, AccountSpace, AccountSpaceListOptions, AccountStatus, 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, KVResponse, KVService, KVServiceConfig, KVSignedReadUrlResponse, KeyInfo, KeyProvider, KeyType, Manifest, ManifestDefaults, ManifestRegistryRecord, ManifestSecretActions, ManifestValidationError, OpenKeyCallbackStrategy, OpenKeySigningRequestBody, OpenKeySigningResponseBody, OpenKeySigningStrategyOptions, ParsedSecretCatalogKey, PermissionEntry, PermissionNotInManifestError, PersistedSessionData, PkhDidParts, PrefixedKVService, ProtocolMismatchError, QueryOptions, QueryResponse, ReceiveOptions, RegisterBatchSuccess, RegisterPolicyV3Input, RegisterPolicyV3Receipt, ResolvedCapabilities, ResolvedDelegate, 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';
|
|
2
|
-
export { e as BootstrapWarning, C as CompactRuntimeDelegationInput, f as CreateOwnerDelegationParams, D as DelegateToOptions, g as DelegateToResult, h as DelegatedAccess, E as EnsureEncryptionNetworkOptions, F as FileSessionStorage, I as InvalidRestoredSessionError, M as MemorySessionStorage, N as NodeEventEmitterStrategy, j as NodeUserAuthorization, k as NodeUserAuthorizationConfig, O as OwnerDelegationReceipt, P as PortableDelegation, m as RuntimePermissionGrantOptions, S as SecretPermissionHint, n as SecretReadInput, o as SecretReadResult, p as SignStrategy, T as TinyCloudNode, q as TinyCloudNodeConfig, U as UnifiedOwnerRootInput, r as UnifiedOwnerRootReceipt, s as UnsupportedSessionRestoreError, V as ValidatedRuntimeDelegation, W as WasmKeyProvider, t as WasmKeyProviderConfig, u as activateCompactRuntimeDelegation, w as createWasmKeyProvider, x as defaultSignStrategy, y as deserializeDelegation, G as serializeDelegation } from './core-
|
|
2
|
+
export { e as BootstrapWarning, C as CompactRuntimeDelegationInput, f as CreateOwnerDelegationParams, D as DelegateToOptions, g as DelegateToResult, h as DelegatedAccess, E as EnsureEncryptionNetworkOptions, F as FileSessionStorage, I as InvalidRestoredSessionError, M as MemorySessionStorage, N as NodeEventEmitterStrategy, j as NodeUserAuthorization, k as NodeUserAuthorizationConfig, O as OwnerDelegationReceipt, P as PortableDelegation, m as RuntimePermissionGrantOptions, S as SecretPermissionHint, n as SecretReadInput, o as SecretReadResult, p as SignStrategy, T as TinyCloudNode, q as TinyCloudNodeConfig, U as UnifiedOwnerRootInput, r as UnifiedOwnerRootReceipt, s as UnsupportedSessionRestoreError, V as ValidatedRuntimeDelegation, W as WasmKeyProvider, t as WasmKeyProviderConfig, u as activateCompactRuntimeDelegation, w as createWasmKeyProvider, x as defaultSignStrategy, y as deserializeDelegation, G as serializeDelegation } from './core-DufYfxi-.cjs';
|
|
3
3
|
import 'events';
|
|
4
4
|
import '@tinycloud/sdk-services';
|
package/dist/core.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { ACCOUNT_REGISTRY_PATH, ACCOUNT_REGISTRY_SPACE, AccountApplication, AccountApplicationListOptions, AccountApplicationRegisterOptions, AccountDelegation, AccountDelegationListOptions, AccountDelegationRevokeOptions, AccountIndexEnsureResult, AccountIndexRebuildResult, AccountIndexStatus, AccountIndexedReadOptions, AccountService, AccountServiceConfig, AccountSpace, AccountSpaceListOptions, AccountStatus, 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, KVResponse, KVService, KVServiceConfig, KVSignedReadUrlResponse, KeyInfo, KeyProvider, KeyType, Manifest, ManifestDefaults, ManifestRegistryRecord, ManifestSecretActions, ManifestValidationError, OpenKeyCallbackStrategy, OpenKeySigningRequestBody, OpenKeySigningResponseBody, OpenKeySigningStrategyOptions, ParsedSecretCatalogKey, PermissionEntry, PermissionNotInManifestError, PersistedSessionData, PkhDidParts, PrefixedKVService, ProtocolMismatchError, QueryOptions, QueryResponse, ReceiveOptions, RegisterBatchSuccess, RegisterPolicyV3Input, RegisterPolicyV3Receipt, ResolvedCapabilities, ResolvedDelegate, 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';
|
|
2
|
-
export { e as BootstrapWarning, C as CompactRuntimeDelegationInput, f as CreateOwnerDelegationParams, D as DelegateToOptions, g as DelegateToResult, h as DelegatedAccess, E as EnsureEncryptionNetworkOptions, F as FileSessionStorage, I as InvalidRestoredSessionError, M as MemorySessionStorage, N as NodeEventEmitterStrategy, j as NodeUserAuthorization, k as NodeUserAuthorizationConfig, O as OwnerDelegationReceipt, P as PortableDelegation, m as RuntimePermissionGrantOptions, S as SecretPermissionHint, n as SecretReadInput, o as SecretReadResult, p as SignStrategy, T as TinyCloudNode, q as TinyCloudNodeConfig, U as UnifiedOwnerRootInput, r as UnifiedOwnerRootReceipt, s as UnsupportedSessionRestoreError, V as ValidatedRuntimeDelegation, W as WasmKeyProvider, t as WasmKeyProviderConfig, u as activateCompactRuntimeDelegation, w as createWasmKeyProvider, x as defaultSignStrategy, y as deserializeDelegation, G as serializeDelegation } from './core-
|
|
2
|
+
export { e as BootstrapWarning, C as CompactRuntimeDelegationInput, f as CreateOwnerDelegationParams, D as DelegateToOptions, g as DelegateToResult, h as DelegatedAccess, E as EnsureEncryptionNetworkOptions, F as FileSessionStorage, I as InvalidRestoredSessionError, M as MemorySessionStorage, N as NodeEventEmitterStrategy, j as NodeUserAuthorization, k as NodeUserAuthorizationConfig, O as OwnerDelegationReceipt, P as PortableDelegation, m as RuntimePermissionGrantOptions, S as SecretPermissionHint, n as SecretReadInput, o as SecretReadResult, p as SignStrategy, T as TinyCloudNode, q as TinyCloudNodeConfig, U as UnifiedOwnerRootInput, r as UnifiedOwnerRootReceipt, s as UnsupportedSessionRestoreError, V as ValidatedRuntimeDelegation, W as WasmKeyProvider, t as WasmKeyProviderConfig, u as activateCompactRuntimeDelegation, w as createWasmKeyProvider, x as defaultSignStrategy, y as deserializeDelegation, G as serializeDelegation } from './core-DufYfxi-.js';
|
|
3
3
|
import 'events';
|
|
4
4
|
import '@tinycloud/sdk-services';
|
package/dist/core.js
CHANGED
|
@@ -2936,16 +2936,26 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
2936
2936
|
*/
|
|
2937
2937
|
getVerifiedSessionCapabilities() {
|
|
2938
2938
|
const session = this.currentTinyCloudSession();
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
).map((entry) =>
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2939
|
+
return session?.siwe ? this.projectSignedRecapCapabilities(session.siwe) : [];
|
|
2940
|
+
}
|
|
2941
|
+
/** Normalize signed capabilities without collapsing nested encryption into raw authority. */
|
|
2942
|
+
projectSignedRecapCapabilities(siwe) {
|
|
2943
|
+
const projected = this.parseRecapWithCaveats(siwe).map((entry) => {
|
|
2944
|
+
const normalized = parseRecapCapabilities(() => [entry], siwe)[0];
|
|
2945
|
+
if (normalized.service !== "tinycloud.encryption") return normalized;
|
|
2946
|
+
if (!this.isEncryptionNetworkOperation("encryption", entry.path, entry.space)) {
|
|
2947
|
+
return { ...normalized, space: entry.space };
|
|
2948
|
+
}
|
|
2949
|
+
return {
|
|
2950
|
+
service: normalized.service,
|
|
2951
|
+
path: normalized.path,
|
|
2952
|
+
actions: normalized.actions,
|
|
2953
|
+
...normalized.caveats === void 0 ? {} : { caveats: normalized.caveats }
|
|
2954
|
+
};
|
|
2955
|
+
});
|
|
2956
|
+
return projected.sort(
|
|
2957
|
+
(left, right) => (left.space ?? "").localeCompare(right.space ?? "") || left.service.localeCompare(right.service) || left.path.localeCompare(right.path)
|
|
2958
|
+
);
|
|
2949
2959
|
}
|
|
2950
2960
|
/**
|
|
2951
2961
|
* Get the Ethereum address for this user.
|
|
@@ -3400,9 +3410,9 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
3400
3410
|
* We must keep the full owner-scoped URI so a synthetic primary grant can
|
|
3401
3411
|
* never cover an operation on a different owner's space.
|
|
3402
3412
|
*
|
|
3403
|
-
*
|
|
3404
|
-
*
|
|
3405
|
-
*
|
|
3413
|
+
* Only top-level encryption network entries (`space: "encryption"` or
|
|
3414
|
+
* absent) become `resource` ops. A network-shaped path nested under a
|
|
3415
|
+
* data space remains a `spaceId` op, not raw network authority.
|
|
3406
3416
|
* One op per action.
|
|
3407
3417
|
*
|
|
3408
3418
|
* Returns `[]` for session-only / restored-without-siwe modes and for any
|
|
@@ -3423,7 +3433,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
3423
3433
|
operations = entries.flatMap((entry) => {
|
|
3424
3434
|
const service = this.invocationServiceName(entry.service);
|
|
3425
3435
|
return entry.actions.map((action) => ({
|
|
3426
|
-
...this.isEncryptionNetworkOperation(service, entry.path) ? { resource: entry.path } : { spaceId: entry.space },
|
|
3436
|
+
...this.isEncryptionNetworkOperation(service, entry.path, entry.space) ? { resource: entry.path } : { spaceId: entry.space },
|
|
3427
3437
|
service,
|
|
3428
3438
|
path: entry.path,
|
|
3429
3439
|
action,
|
|
@@ -4037,7 +4047,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
4037
4047
|
operations = recap.flatMap((entry) => {
|
|
4038
4048
|
const service = this.invocationServiceName(entry.service);
|
|
4039
4049
|
return entry.actions.map((action) => ({
|
|
4040
|
-
...this.isEncryptionNetworkOperation(service, entry.path) ? { resource: entry.path } : { spaceId: entry.space },
|
|
4050
|
+
...this.isEncryptionNetworkOperation(service, entry.path, entry.space) ? { resource: entry.path } : { spaceId: entry.space },
|
|
4041
4051
|
service,
|
|
4042
4052
|
path: entry.path,
|
|
4043
4053
|
action,
|
|
@@ -4823,16 +4833,11 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
4823
4833
|
);
|
|
4824
4834
|
graph.assertActive();
|
|
4825
4835
|
if (!response.ok) {
|
|
4826
|
-
|
|
4827
|
-
|
|
4828
|
-
|
|
4829
|
-
|
|
4830
|
-
|
|
4831
|
-
const nested = typeof record?.error === "object" && record.error !== null ? record.error : void 0;
|
|
4832
|
-
permissionHint = parsePermissionHint(record?.permissionHint) ?? parsePermissionHint(nested?.permissionHint);
|
|
4833
|
-
} catch {
|
|
4834
|
-
}
|
|
4835
|
-
}
|
|
4836
|
+
const permissionHint = response.status === 401 || response.status === 403 ? parsePermissionHint({
|
|
4837
|
+
service: "tinycloud.encryption",
|
|
4838
|
+
path: networkId,
|
|
4839
|
+
actions: ["tinycloud.encryption/decrypt"]
|
|
4840
|
+
}) : void 0;
|
|
4836
4841
|
throw new DecryptTransportResponseError(response.status, permissionHint);
|
|
4837
4842
|
}
|
|
4838
4843
|
return await response.json();
|
|
@@ -5767,7 +5772,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
5767
5772
|
continue;
|
|
5768
5773
|
}
|
|
5769
5774
|
let space;
|
|
5770
|
-
if (service !== "tinycloud.encryption") {
|
|
5775
|
+
if (service !== "tinycloud.encryption" || operation.resource === void 0) {
|
|
5771
5776
|
if (typeof operation.spaceId !== "string") continue;
|
|
5772
5777
|
try {
|
|
5773
5778
|
space = this.resolvePermissionSpace(operation.spaceId, session);
|
|
@@ -6312,11 +6317,8 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
6312
6317
|
);
|
|
6313
6318
|
return { delegation: delegation2, prompted: true };
|
|
6314
6319
|
}
|
|
6315
|
-
const granted =
|
|
6316
|
-
|
|
6317
|
-
session.siwe
|
|
6318
|
-
);
|
|
6319
|
-
const { subset, missing } = isCapabilitySubset(expandedEntries, granted);
|
|
6320
|
+
const granted = this.projectSignedRecapCapabilities(session.siwe);
|
|
6321
|
+
const { subset, missing } = this.signedCapabilitySubset(expandedEntries, granted);
|
|
6320
6322
|
if (!subset) {
|
|
6321
6323
|
const runtimeOperations = this.permissionEntriesToOperations(expandedEntries, session);
|
|
6322
6324
|
const runtimeGrant = this.findGrantForOperations(
|
|
@@ -6636,7 +6638,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
6636
6638
|
return abilities;
|
|
6637
6639
|
}
|
|
6638
6640
|
isEncryptionPermissionEntry(entry) {
|
|
6639
|
-
return entry.service === ENCRYPTION_PERMISSION_SERVICE2 &&
|
|
6641
|
+
return entry.service === ENCRYPTION_PERMISSION_SERVICE2 && this.isEncryptionNetworkOperation("encryption", entry.path, entry.space);
|
|
6640
6642
|
}
|
|
6641
6643
|
permissionsToRawAbilities(entries) {
|
|
6642
6644
|
const rawAbilities = {};
|
|
@@ -6660,7 +6662,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
6660
6662
|
return entries.flatMap((entry) => {
|
|
6661
6663
|
const service = this.shortServiceName(entry.service);
|
|
6662
6664
|
return entry.actions.map((action) => ({
|
|
6663
|
-
...this.isEncryptionNetworkOperation(service, entry.path) ? { resource: entry.path } : { spaceId },
|
|
6665
|
+
...this.isEncryptionNetworkOperation(service, entry.path, entry.space) ? { resource: entry.path } : { spaceId },
|
|
6664
6666
|
service,
|
|
6665
6667
|
path: entry.path,
|
|
6666
6668
|
action,
|
|
@@ -6668,13 +6670,21 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
6668
6670
|
}));
|
|
6669
6671
|
});
|
|
6670
6672
|
}
|
|
6673
|
+
/** Raw network authority cannot be covered by a nested encryption space. */
|
|
6674
|
+
signedCapabilitySubset(requested, granted) {
|
|
6675
|
+
const rawGranted = granted.filter((entry) => this.isEncryptionPermissionEntry(entry)).map((entry) => ({ ...entry, space: "encryption" }));
|
|
6676
|
+
const spaceGranted = granted.filter((entry) => !this.isEncryptionPermissionEntry(entry));
|
|
6677
|
+
const missing = requested.filter((entry) => {
|
|
6678
|
+
const raw = this.isEncryptionPermissionEntry(entry);
|
|
6679
|
+
const comparable = raw ? { ...entry, space: "encryption" } : entry;
|
|
6680
|
+
return !isCapabilitySubset([comparable], raw ? rawGranted : spaceGranted).subset;
|
|
6681
|
+
});
|
|
6682
|
+
return { subset: missing.length === 0, missing };
|
|
6683
|
+
}
|
|
6671
6684
|
sessionCoversPermissionEntries(session, entries) {
|
|
6672
6685
|
try {
|
|
6673
|
-
const granted =
|
|
6674
|
-
|
|
6675
|
-
session.siwe
|
|
6676
|
-
);
|
|
6677
|
-
return isCapabilitySubset(entries, granted).subset;
|
|
6686
|
+
const granted = this.projectSignedRecapCapabilities(session.siwe);
|
|
6687
|
+
return this.signedCapabilitySubset(entries, granted).subset;
|
|
6678
6688
|
} catch {
|
|
6679
6689
|
return false;
|
|
6680
6690
|
}
|
|
@@ -6684,7 +6694,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
6684
6694
|
const spaceId = this.resolvePermissionSpace(entry.space, session);
|
|
6685
6695
|
const service = this.shortServiceName(entry.service);
|
|
6686
6696
|
return entry.actions.map((action) => ({
|
|
6687
|
-
...this.isEncryptionNetworkOperation(service, entry.path) ? { resource: entry.path } : { spaceId },
|
|
6697
|
+
...this.isEncryptionNetworkOperation(service, entry.path, entry.space) ? { resource: entry.path } : { spaceId },
|
|
6688
6698
|
service,
|
|
6689
6699
|
path: entry.path,
|
|
6690
6700
|
action,
|
|
@@ -6773,7 +6783,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
6773
6783
|
return resources.flatMap((resource) => {
|
|
6774
6784
|
const service = this.invocationServiceName(resource.service);
|
|
6775
6785
|
return resource.actions.map((action) => ({
|
|
6776
|
-
...this.isEncryptionNetworkOperation(service, resource.path) ? { resource: resource.path } : { spaceId: resource.space },
|
|
6786
|
+
...this.isEncryptionNetworkOperation(service, resource.path, resource.space) ? { resource: resource.path } : { spaceId: resource.space },
|
|
6777
6787
|
service,
|
|
6778
6788
|
path: resource.path,
|
|
6779
6789
|
action,
|
|
@@ -6834,7 +6844,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
6834
6844
|
};
|
|
6835
6845
|
for (const resource of resources) {
|
|
6836
6846
|
const service = this.invocationServiceName(resource.service);
|
|
6837
|
-
if (this.isEncryptionNetworkOperation(service, resource.path)) {
|
|
6847
|
+
if (this.isEncryptionNetworkOperation(service, resource.path, resource.space)) {
|
|
6838
6848
|
rawAbilities[_a = resource.path] ?? (rawAbilities[_a] = []);
|
|
6839
6849
|
addActions(rawAbilities[resource.path], resource.actions);
|
|
6840
6850
|
continue;
|
|
@@ -6931,8 +6941,8 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
6931
6941
|
const verified = this.wasmBindings.parseVerifiedRecapFromSiwe?.(siwe);
|
|
6932
6942
|
return verified == null ? this.wasmBindings.parseRecapFromSiwe(siwe) : verifierRecapEntries(verified);
|
|
6933
6943
|
}
|
|
6934
|
-
isEncryptionNetworkOperation(service, path) {
|
|
6935
|
-
return service === "encryption" && path.startsWith("urn:tinycloud:encryption:");
|
|
6944
|
+
isEncryptionNetworkOperation(service, path, space) {
|
|
6945
|
+
return service === "encryption" && (space === void 0 || space === "encryption") && path.startsWith("urn:tinycloud:encryption:");
|
|
6936
6946
|
}
|
|
6937
6947
|
operationFromInvokeAnyEntry(entry) {
|
|
6938
6948
|
const service = this.invocationServiceName(entry.service);
|
|
@@ -6945,7 +6955,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
6945
6955
|
...entry.caveats === void 0 ? {} : { caveats: cloneRecapCaveats(entry.caveats) }
|
|
6946
6956
|
};
|
|
6947
6957
|
}
|
|
6948
|
-
if (this.isEncryptionNetworkOperation(service, entry.path)) {
|
|
6958
|
+
if (entry.spaceId === void 0 && this.isEncryptionNetworkOperation(service, entry.path)) {
|
|
6949
6959
|
return {
|
|
6950
6960
|
resource: entry.path,
|
|
6951
6961
|
service,
|