@tinycloud/node-sdk 2.11.0-beta.0 → 2.11.0-beta.3
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-B_i2KfID.d.cts → core-DfcWH9i4.d.cts} +69 -15
- package/dist/{core-B_i2KfID.d.ts → core-DfcWH9i4.d.ts} +69 -15
- package/dist/core.cjs +173 -25
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.cts +2 -2
- package/dist/core.d.ts +2 -2
- package/dist/core.js +173 -25
- package/dist/core.js.map +1 -1
- package/dist/index.cjs +173 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +173 -25
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/core.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { ACCOUNT_REGISTRY_PATH, ACCOUNT_REGISTRY_SPACE, AccountApplication, AccountApplicationListOptions, 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, OwnerSharePolicyRegistrationReceipt, PermissionEntry, PermissionNotInManifestError, PersistedSessionData, PkhDidParts, PrefixedKVService, ProtocolMismatchError, QueryOptions, QueryResponse, ReceiveOptions, RegisterOwnerSharePolicyParams, ResolvedCapabilities, ResolvedDelegate, ResolvedSecretPath, ResourceCapability, SECRET_NAME_RE, SQLAction, SQLActionType, SQLService, SQLServiceConfig, SchemaInfo, 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, parseSpaceUri, pkhDid, principalDid, principalDidEquals, resolveManifest, resolveSecretListPrefix, resolveSecretPath, resourceCapabilitiesToSpaceAbilitiesMap, tinyCloudDebugLogger, validateManifest } from '@tinycloud/sdk-core';
|
|
2
|
-
export { C as CreateOwnerDelegationParams, D as DelegateToOptions, b as DelegateToResult, c as DelegatedAccess, F as FileSessionStorage, M as MemorySessionStorage, N as NodeEventEmitterStrategy, e as NodeUserAuthorization, f as NodeUserAuthorizationConfig, O as OwnerDelegationReceipt, P as PortableDelegation, h as RuntimePermissionGrantOptions, S as SecretPermissionHint, i as SecretReadInput, j as SecretReadResult, k as SignStrategy, T as TinyCloudNode, l as TinyCloudNodeConfig, U as UnsupportedSessionRestoreError, W as WasmKeyProvider, m as WasmKeyProviderConfig, o as createWasmKeyProvider, p as defaultSignStrategy, q as deserializeDelegation, s as serializeDelegation } from './core-
|
|
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, OwnerSharePolicyRegistrationReceipt, PermissionEntry, PermissionNotInManifestError, PersistedSessionData, PkhDidParts, PrefixedKVService, ProtocolMismatchError, QueryOptions, QueryResponse, ReceiveOptions, RegisterOwnerSharePolicyParams, ResolvedCapabilities, ResolvedDelegate, ResolvedSecretPath, ResourceCapability, SECRET_NAME_RE, SQLAction, SQLActionType, SQLService, SQLServiceConfig, SchemaInfo, 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, parseSpaceUri, pkhDid, principalDid, principalDidEquals, resolveManifest, resolveSecretListPrefix, resolveSecretPath, resourceCapabilitiesToSpaceAbilitiesMap, tinyCloudDebugLogger, validateManifest } from '@tinycloud/sdk-core';
|
|
2
|
+
export { C as CreateOwnerDelegationParams, D as DelegateToOptions, b as DelegateToResult, c as DelegatedAccess, E as EnsureEncryptionNetworkOptions, F as FileSessionStorage, M as MemorySessionStorage, N as NodeEventEmitterStrategy, e as NodeUserAuthorization, f as NodeUserAuthorizationConfig, O as OwnerDelegationReceipt, P as PortableDelegation, h as RuntimePermissionGrantOptions, S as SecretPermissionHint, i as SecretReadInput, j as SecretReadResult, k as SignStrategy, T as TinyCloudNode, l as TinyCloudNodeConfig, U as UnsupportedSessionRestoreError, W as WasmKeyProvider, m as WasmKeyProviderConfig, o as createWasmKeyProvider, p as defaultSignStrategy, q as deserializeDelegation, s as serializeDelegation } from './core-DfcWH9i4.cjs';
|
|
3
3
|
import 'events';
|
|
4
4
|
import '@tinycloud/sdk-services';
|
package/dist/core.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { ACCOUNT_REGISTRY_PATH, ACCOUNT_REGISTRY_SPACE, AccountApplication, AccountApplicationListOptions, 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, OwnerSharePolicyRegistrationReceipt, PermissionEntry, PermissionNotInManifestError, PersistedSessionData, PkhDidParts, PrefixedKVService, ProtocolMismatchError, QueryOptions, QueryResponse, ReceiveOptions, RegisterOwnerSharePolicyParams, ResolvedCapabilities, ResolvedDelegate, ResolvedSecretPath, ResourceCapability, SECRET_NAME_RE, SQLAction, SQLActionType, SQLService, SQLServiceConfig, SchemaInfo, 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, parseSpaceUri, pkhDid, principalDid, principalDidEquals, resolveManifest, resolveSecretListPrefix, resolveSecretPath, resourceCapabilitiesToSpaceAbilitiesMap, tinyCloudDebugLogger, validateManifest } from '@tinycloud/sdk-core';
|
|
2
|
-
export { C as CreateOwnerDelegationParams, D as DelegateToOptions, b as DelegateToResult, c as DelegatedAccess, F as FileSessionStorage, M as MemorySessionStorage, N as NodeEventEmitterStrategy, e as NodeUserAuthorization, f as NodeUserAuthorizationConfig, O as OwnerDelegationReceipt, P as PortableDelegation, h as RuntimePermissionGrantOptions, S as SecretPermissionHint, i as SecretReadInput, j as SecretReadResult, k as SignStrategy, T as TinyCloudNode, l as TinyCloudNodeConfig, U as UnsupportedSessionRestoreError, W as WasmKeyProvider, m as WasmKeyProviderConfig, o as createWasmKeyProvider, p as defaultSignStrategy, q as deserializeDelegation, s as serializeDelegation } from './core-
|
|
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, OwnerSharePolicyRegistrationReceipt, PermissionEntry, PermissionNotInManifestError, PersistedSessionData, PkhDidParts, PrefixedKVService, ProtocolMismatchError, QueryOptions, QueryResponse, ReceiveOptions, RegisterOwnerSharePolicyParams, ResolvedCapabilities, ResolvedDelegate, ResolvedSecretPath, ResourceCapability, SECRET_NAME_RE, SQLAction, SQLActionType, SQLService, SQLServiceConfig, SchemaInfo, 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, parseSpaceUri, pkhDid, principalDid, principalDidEquals, resolveManifest, resolveSecretListPrefix, resolveSecretPath, resourceCapabilitiesToSpaceAbilitiesMap, tinyCloudDebugLogger, validateManifest } from '@tinycloud/sdk-core';
|
|
2
|
+
export { C as CreateOwnerDelegationParams, D as DelegateToOptions, b as DelegateToResult, c as DelegatedAccess, E as EnsureEncryptionNetworkOptions, F as FileSessionStorage, M as MemorySessionStorage, N as NodeEventEmitterStrategy, e as NodeUserAuthorization, f as NodeUserAuthorizationConfig, O as OwnerDelegationReceipt, P as PortableDelegation, h as RuntimePermissionGrantOptions, S as SecretPermissionHint, i as SecretReadInput, j as SecretReadResult, k as SignStrategy, T as TinyCloudNode, l as TinyCloudNodeConfig, U as UnsupportedSessionRestoreError, W as WasmKeyProvider, m as WasmKeyProviderConfig, o as createWasmKeyProvider, p as defaultSignStrategy, q as deserializeDelegation, s as serializeDelegation } from './core-DfcWH9i4.js';
|
|
3
3
|
import 'events';
|
|
4
4
|
import '@tinycloud/sdk-services';
|
package/dist/core.js
CHANGED
|
@@ -473,6 +473,15 @@ var NodeUserAuthorization = class {
|
|
|
473
473
|
get nodeFeatures() {
|
|
474
474
|
return this._nodeFeatures;
|
|
475
475
|
}
|
|
476
|
+
/**
|
|
477
|
+
* The node DID reported by `GET /info` for `host`, if the sign-in (or
|
|
478
|
+
* restore) that populated it targeted that same host. Returns `undefined`
|
|
479
|
+
* for any other host, and for nodes whose `/info` omits `nodeId`, so callers
|
|
480
|
+
* fall back to fetching it themselves rather than using a foreign node's DID.
|
|
481
|
+
*/
|
|
482
|
+
nodeIdForHost(host) {
|
|
483
|
+
return this._nodeInfoIdentity?.host === host ? this._nodeInfoIdentity.nodeId : void 0;
|
|
484
|
+
}
|
|
476
485
|
get lastActivationSkippedSpaceIds() {
|
|
477
486
|
return [...this._lastActivationSkippedSpaceIds];
|
|
478
487
|
}
|
|
@@ -942,11 +951,13 @@ var NodeUserAuthorization = class {
|
|
|
942
951
|
this._tinyCloudSession = tinyCloudSession;
|
|
943
952
|
this._address = address;
|
|
944
953
|
this._chainId = chainId;
|
|
954
|
+
const infoHost = this.primaryTinyCloudHost;
|
|
945
955
|
const nodeInfo = await checkNodeInfo(
|
|
946
|
-
|
|
956
|
+
infoHost,
|
|
947
957
|
this.wasm.protocolVersion()
|
|
948
958
|
);
|
|
949
959
|
this._nodeFeatures = nodeInfo.features;
|
|
960
|
+
this._nodeInfoIdentity = nodeInfo.nodeId ? { host: infoHost, nodeId: nodeInfo.nodeId } : void 0;
|
|
950
961
|
for (const ext of this.extensions) {
|
|
951
962
|
if (ext.afterSignIn) {
|
|
952
963
|
await ext.afterSignIn(clientSession);
|
|
@@ -1112,11 +1123,13 @@ var NodeUserAuthorization = class {
|
|
|
1112
1123
|
this._tinyCloudSession = tinyCloudSession;
|
|
1113
1124
|
this._address = address;
|
|
1114
1125
|
this._chainId = chainId;
|
|
1126
|
+
const infoHost = this.primaryTinyCloudHost;
|
|
1115
1127
|
const nodeInfo = await checkNodeInfo(
|
|
1116
|
-
|
|
1128
|
+
infoHost,
|
|
1117
1129
|
this.wasm.protocolVersion()
|
|
1118
1130
|
);
|
|
1119
1131
|
this._nodeFeatures = nodeInfo.features;
|
|
1132
|
+
this._nodeInfoIdentity = nodeInfo.nodeId ? { host: infoHost, nodeId: nodeInfo.nodeId } : void 0;
|
|
1120
1133
|
for (const ext of this.extensions) {
|
|
1121
1134
|
if (ext.afterSignIn) {
|
|
1122
1135
|
await ext.afterSignIn(clientSession);
|
|
@@ -1883,19 +1896,87 @@ function persistedExpiry(value) {
|
|
|
1883
1896
|
function sameInstant(left, right) {
|
|
1884
1897
|
return left.getTime() === right.getTime();
|
|
1885
1898
|
}
|
|
1886
|
-
function
|
|
1887
|
-
|
|
1899
|
+
function ownerDelegationPermissions(params) {
|
|
1900
|
+
const hasPermissions = Object.prototype.hasOwnProperty.call(params, "permissions");
|
|
1901
|
+
const hasLegacy = Object.prototype.hasOwnProperty.call(params, "path") || Object.prototype.hasOwnProperty.call(params, "actions");
|
|
1902
|
+
if (hasPermissions === hasLegacy) {
|
|
1903
|
+
throw new Error("Owner delegation requires exactly one authority shape: path/actions or permissions");
|
|
1904
|
+
}
|
|
1905
|
+
const permissions = [];
|
|
1906
|
+
if (hasPermissions) {
|
|
1907
|
+
if (!Array.isArray(params.permissions)) {
|
|
1908
|
+
throw new Error("Owner delegation permissions are invalid");
|
|
1909
|
+
}
|
|
1910
|
+
permissions.push(...params.permissions.map((permission) => ({
|
|
1911
|
+
service: permission.service,
|
|
1912
|
+
path: permission.path,
|
|
1913
|
+
actions: [...permission.actions]
|
|
1914
|
+
})));
|
|
1915
|
+
} else {
|
|
1916
|
+
if (typeof params.path !== "string" || !Array.isArray(params.actions)) {
|
|
1917
|
+
throw new Error("Owner delegation requires bounded capabilities");
|
|
1918
|
+
}
|
|
1919
|
+
const byService = /* @__PURE__ */ new Map();
|
|
1920
|
+
for (const action of params.actions) {
|
|
1921
|
+
if (typeof action !== "string") {
|
|
1922
|
+
throw new Error("Owner delegation capabilities are unsupported");
|
|
1923
|
+
}
|
|
1924
|
+
const slash = action.indexOf("/");
|
|
1925
|
+
const service = slash === -1 ? "" : action.slice(0, slash);
|
|
1926
|
+
if (SERVICE_LONG_TO_SHORT[service] === void 0) {
|
|
1927
|
+
throw new Error("Owner delegation capabilities are unsupported");
|
|
1928
|
+
}
|
|
1929
|
+
const actions = byService.get(service) ?? [];
|
|
1930
|
+
actions.push(action);
|
|
1931
|
+
byService.set(service, actions);
|
|
1932
|
+
}
|
|
1933
|
+
for (const [service, actions] of byService) {
|
|
1934
|
+
permissions.push({ service, path: params.path, actions });
|
|
1935
|
+
}
|
|
1936
|
+
}
|
|
1937
|
+
if (permissions.length === 0 || permissions.length > 16) {
|
|
1938
|
+
throw new Error("Owner delegation requires bounded capabilities");
|
|
1939
|
+
}
|
|
1940
|
+
const resources = /* @__PURE__ */ new Set();
|
|
1941
|
+
for (const permission of permissions) {
|
|
1942
|
+
if (typeof permission.service !== "string" || SERVICE_LONG_TO_SHORT[permission.service] === void 0 || typeof permission.path !== "string" || permission.path.length === 0 || permission.path.trim() !== permission.path || /[\u0000-\u001f\u007f\\*]/.test(permission.path) || !Array.isArray(permission.actions) || permission.actions.length === 0 || permission.actions.length > 32) {
|
|
1943
|
+
throw new Error("Owner delegation requires bounded capabilities");
|
|
1944
|
+
}
|
|
1945
|
+
const resourceKey = `${permission.service}\0${permission.path}`;
|
|
1946
|
+
if (resources.has(resourceKey)) {
|
|
1947
|
+
throw new Error("Owner delegation permissions contain duplicate resources");
|
|
1948
|
+
}
|
|
1949
|
+
resources.add(resourceKey);
|
|
1950
|
+
const actions = /* @__PURE__ */ new Set();
|
|
1951
|
+
for (const action of permission.actions) {
|
|
1952
|
+
if (typeof action !== "string" || !action.startsWith(`${permission.service}/`) || action.length === permission.service.length + 1 || actions.has(action)) {
|
|
1953
|
+
throw new Error("Owner delegation capabilities are unsupported");
|
|
1954
|
+
}
|
|
1955
|
+
actions.add(action);
|
|
1956
|
+
}
|
|
1957
|
+
if (permission.service === ENCRYPTION_PERMISSION_SERVICE2) {
|
|
1958
|
+
try {
|
|
1959
|
+
parseNetworkId2(permission.path);
|
|
1960
|
+
} catch {
|
|
1961
|
+
throw new Error("Owner delegation encryption permission requires a canonical network URN");
|
|
1962
|
+
}
|
|
1963
|
+
}
|
|
1964
|
+
}
|
|
1965
|
+
return permissions;
|
|
1966
|
+
}
|
|
1967
|
+
function ownerPermissionsToAbilities(permissions) {
|
|
1888
1968
|
const abilities = {};
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
if (
|
|
1892
|
-
|
|
1893
|
-
|
|
1969
|
+
const rawAbilities = {};
|
|
1970
|
+
for (const permission of permissions) {
|
|
1971
|
+
if (permission.service === ENCRYPTION_PERMISSION_SERVICE2) {
|
|
1972
|
+
rawAbilities[permission.path] = [...permission.actions];
|
|
1973
|
+
continue;
|
|
1974
|
+
}
|
|
1975
|
+
const shortService = SERVICE_LONG_TO_SHORT[permission.service];
|
|
1894
1976
|
abilities[shortService] ?? (abilities[shortService] = {});
|
|
1895
|
-
|
|
1896
|
-
abilities[shortService][path].push(action);
|
|
1977
|
+
abilities[shortService][permission.path] = [...permission.actions];
|
|
1897
1978
|
}
|
|
1898
|
-
return
|
|
1979
|
+
return { abilities, rawAbilities };
|
|
1899
1980
|
}
|
|
1900
1981
|
function base64UrlEncode(bytes) {
|
|
1901
1982
|
const alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
|
|
@@ -2013,6 +2094,12 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
2013
2094
|
this._baseSecrets = /* @__PURE__ */ new Map();
|
|
2014
2095
|
this._secrets = /* @__PURE__ */ new Map();
|
|
2015
2096
|
this.runtimePermissionGrants = [];
|
|
2097
|
+
/**
|
|
2098
|
+
* Owned space ids this sign-in has already confirmed are hosted. Consulted by
|
|
2099
|
+
* {@link ensureOwnedSpaceHostedById}; cleared on every {@link signIn} because
|
|
2100
|
+
* hosting is confirmed against the session that was active at the time.
|
|
2101
|
+
*/
|
|
2102
|
+
this.confirmedHostedSpaceIds = /* @__PURE__ */ new Set();
|
|
2016
2103
|
/**
|
|
2017
2104
|
* True when the last signIn() detected an interactive signer and skipped
|
|
2018
2105
|
* client-side bootstrap. Apps can read this to know whether bootstrap was
|
|
@@ -2409,6 +2496,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
2409
2496
|
this._spaceService = void 0;
|
|
2410
2497
|
this._serviceContext = void 0;
|
|
2411
2498
|
this.runtimePermissionGrants = [];
|
|
2499
|
+
this.confirmedHostedSpaceIds.clear();
|
|
2412
2500
|
await this.tc.signIn(options);
|
|
2413
2501
|
this.syncResolvedHostFromAuth();
|
|
2414
2502
|
const oldGraph = this._serviceGraph;
|
|
@@ -2591,14 +2679,18 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
2591
2679
|
}
|
|
2592
2680
|
if (step.kind === "seed-applications") {
|
|
2593
2681
|
const registered = await this.account.applications.register(
|
|
2594
|
-
step.manifests.length > 0 ? [...step.manifests] : TINYCLOUD_SECRETS_BOOTSTRAP_MANIFEST
|
|
2682
|
+
step.manifests.length > 0 ? [...step.manifests] : TINYCLOUD_SECRETS_BOOTSTRAP_MANIFEST,
|
|
2683
|
+
// Bootstrap only runs on an account with no registry records, so the
|
|
2684
|
+
// manifest-hash pre-read is definitionally a miss. Skip it; the write
|
|
2685
|
+
// it guards is an INSERT OR REPLACE and is safe to repeat.
|
|
2686
|
+
{ assumeUnregistered: true }
|
|
2595
2687
|
);
|
|
2596
2688
|
if (!registered.ok) {
|
|
2597
2689
|
throw new Error(`Failed to seed bootstrap applications: ${registered.error.message}`);
|
|
2598
2690
|
}
|
|
2599
2691
|
}
|
|
2600
2692
|
if (step.kind === "encryption-network-create") {
|
|
2601
|
-
await this.ensureEncryptionNetwork(step.networkId);
|
|
2693
|
+
await this.ensureEncryptionNetwork(step.networkId, { assumeMissing: true });
|
|
2602
2694
|
}
|
|
2603
2695
|
if (step.kind === "secret-records-schema") {
|
|
2604
2696
|
const db = this.sqlForSpace(step.spaceId).db(step.database);
|
|
@@ -2877,6 +2969,22 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
2877
2969
|
await this.ensureEncryptionNetwork(networkId);
|
|
2878
2970
|
}
|
|
2879
2971
|
}
|
|
2972
|
+
/**
|
|
2973
|
+
* Ensure one of this user's owned spaces is hosted, at most once per space
|
|
2974
|
+
* per sign-in.
|
|
2975
|
+
*
|
|
2976
|
+
* Account bootstrap funnels six calls through here (via
|
|
2977
|
+
* `AccountService.ensureAccountSpaceHosted`), and each one re-submits
|
|
2978
|
+
* `activateSessionWithHost` with the *primary* session. That session's recap
|
|
2979
|
+
* covers only `default` and `secrets`, so the account space appears in
|
|
2980
|
+
* neither `activated` nor `skipped` and the guard below returns immediately
|
|
2981
|
+
* — the repeat calls cannot change the outcome, they only cost round trips.
|
|
2982
|
+
*
|
|
2983
|
+
* The memo is per sign-in ({@link confirmedHostedSpaceIds} is cleared in
|
|
2984
|
+
* `signIn`) and only records confirmed successes. A wrong skip is
|
|
2985
|
+
* self-revealing: the next write to the space fails immediately and loudly
|
|
2986
|
+
* with `404 Space not found`.
|
|
2987
|
+
*/
|
|
2880
2988
|
async ensureOwnedSpaceHostedById(spaceId) {
|
|
2881
2989
|
if (!this.auth) {
|
|
2882
2990
|
throw new Error("Owned space hosting requires wallet mode");
|
|
@@ -2885,12 +2993,16 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
2885
2993
|
if (!session) {
|
|
2886
2994
|
throw new Error("Owned space hosting requires an active session");
|
|
2887
2995
|
}
|
|
2996
|
+
if (this.confirmedHostedSpaceIds.has(spaceId)) {
|
|
2997
|
+
return;
|
|
2998
|
+
}
|
|
2888
2999
|
const host = this.hosts[0] ?? this.config.host;
|
|
2889
3000
|
if (!host) {
|
|
2890
3001
|
throw new Error("Owned space hosting requires a TinyCloud host");
|
|
2891
3002
|
}
|
|
2892
3003
|
const activation = await activateSessionWithHost2(host, session.delegationHeader);
|
|
2893
3004
|
if (activation.success && !activation.skipped?.includes(spaceId)) {
|
|
3005
|
+
this.confirmedHostedSpaceIds.add(spaceId);
|
|
2894
3006
|
return;
|
|
2895
3007
|
}
|
|
2896
3008
|
if (!activation.success && activation.status !== 404) {
|
|
@@ -2909,6 +3021,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
2909
3021
|
`Failed to activate session after creating owned space ${spaceId}: ${retry.error ?? "space was skipped"}`
|
|
2910
3022
|
);
|
|
2911
3023
|
}
|
|
3024
|
+
this.confirmedHostedSpaceIds.add(spaceId);
|
|
2912
3025
|
}
|
|
2913
3026
|
/**
|
|
2914
3027
|
* Host one of this user's owned spaces by name (e.g. `"applications"`).
|
|
@@ -3231,6 +3344,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
3231
3344
|
this.tc = stagedGraph.core;
|
|
3232
3345
|
this._recapOperationsCache = stagedPrimary.cache;
|
|
3233
3346
|
this.runtimePermissionGrants = stagedPrimary.grants;
|
|
3347
|
+
this.confirmedHostedSpaceIds.clear();
|
|
3234
3348
|
if (this.auth) {
|
|
3235
3349
|
this.auth.installRestoredSession(stagedManager, stagedTcSession, [stagedHost]);
|
|
3236
3350
|
this._restoredTcSession = void 0;
|
|
@@ -3813,7 +3927,17 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
3813
3927
|
verifyNodeSignature: (nodeId, message, signature) => verifyDidKeyEd25519Signature(nodeId, message, signature)
|
|
3814
3928
|
};
|
|
3815
3929
|
}
|
|
3930
|
+
/**
|
|
3931
|
+
* The node DID for {@link config.host}.
|
|
3932
|
+
*
|
|
3933
|
+
* Sign-in already performs `GET /info` for the protocol-version check, and
|
|
3934
|
+
* that response carries `nodeId`, so reuse it rather than fetching `/info` a
|
|
3935
|
+
* second time. Only a value recorded for this exact host qualifies; older
|
|
3936
|
+
* nodes that omit `nodeId` fall through to the fetch.
|
|
3937
|
+
*/
|
|
3816
3938
|
async fetchNodeId() {
|
|
3939
|
+
const cached = this.auth?.nodeIdForHost(this.config.host);
|
|
3940
|
+
if (cached) return cached;
|
|
3817
3941
|
const response = await fetch(`${this.config.host}/info`);
|
|
3818
3942
|
if (!response.ok) {
|
|
3819
3943
|
throw new Error(`Failed to fetch node info: HTTP ${response.status}`);
|
|
@@ -4269,21 +4393,29 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
4269
4393
|
async createOwnerDelegation(params, assertActive) {
|
|
4270
4394
|
const assertOwnerGraphActive = assertActive ?? this._serviceGraph.assertActive.bind(this._serviceGraph);
|
|
4271
4395
|
assertOwnerGraphActive();
|
|
4272
|
-
if (!params.delegateDid.startsWith("did:key:")
|
|
4396
|
+
if (!params.delegateDid.startsWith("did:key:")) {
|
|
4273
4397
|
throw new Error("Owner delegation requires an external did:key audience and bounded capabilities");
|
|
4274
4398
|
}
|
|
4399
|
+
const permissions = ownerDelegationPermissions(params);
|
|
4275
4400
|
const now = /* @__PURE__ */ new Date();
|
|
4276
|
-
if (params.expiresAt.getTime() <= now.getTime() || params.expiresAt.getTime() - now.getTime() > EXPIRY3.MAX_MS) {
|
|
4401
|
+
if (!(params.expiresAt instanceof Date) || params.expiresAt.getTime() <= now.getTime() || params.expiresAt.getTime() - now.getTime() > EXPIRY3.MAX_MS) {
|
|
4277
4402
|
throw new Error("Owner delegation expiry must be explicit, future, and within EXPIRY.MAX_MS");
|
|
4278
4403
|
}
|
|
4279
4404
|
if (!this.signer) throw new Error("Owner wallet signer is required");
|
|
4280
4405
|
const session = this.currentTinyCloudSession();
|
|
4281
4406
|
if (!session) throw new Error("Owner session is required");
|
|
4282
|
-
const
|
|
4283
|
-
|
|
4407
|
+
const ownerDid = pkhDid2(session.address, session.chainId);
|
|
4408
|
+
for (const permission of permissions) {
|
|
4409
|
+
if (permission.service === ENCRYPTION_PERMISSION_SERVICE2 && !principalDidEquals2(parseNetworkId2(permission.path).ownerDid, ownerDid)) {
|
|
4410
|
+
throw new Error("Owner delegation cannot grant a foreign encryption network");
|
|
4411
|
+
}
|
|
4412
|
+
}
|
|
4413
|
+
const { abilities, rawAbilities } = ownerPermissionsToAbilities(permissions);
|
|
4414
|
+
const primary = permissions[0];
|
|
4284
4415
|
const host = this.config.host;
|
|
4285
4416
|
const prepared = this.wasmBindings.prepareSession({
|
|
4286
4417
|
abilities,
|
|
4418
|
+
...Object.keys(rawAbilities).length === 0 ? {} : { rawAbilities },
|
|
4287
4419
|
address: this.wasmBindings.ensureEip55(session.address),
|
|
4288
4420
|
chainId: session.chainId,
|
|
4289
4421
|
domain: this.siweDomain,
|
|
@@ -4303,10 +4435,10 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
4303
4435
|
const delegation = {
|
|
4304
4436
|
cid: delegationSession.delegationCid,
|
|
4305
4437
|
delegateDID: params.delegateDid,
|
|
4306
|
-
delegatorDID:
|
|
4438
|
+
delegatorDID: ownerDid,
|
|
4307
4439
|
spaceId: params.spaceId,
|
|
4308
|
-
path:
|
|
4309
|
-
actions: [...
|
|
4440
|
+
path: primary.path,
|
|
4441
|
+
actions: [...primary.actions],
|
|
4310
4442
|
expiry: params.expiresAt,
|
|
4311
4443
|
isRevoked: false,
|
|
4312
4444
|
allowSubDelegation: true,
|
|
@@ -4317,6 +4449,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
4317
4449
|
delegation,
|
|
4318
4450
|
signedDagCbor: decodeAuthorizationBytes(delegationSession.delegationHeader.Authorization),
|
|
4319
4451
|
delegationCid: delegationSession.delegationCid,
|
|
4452
|
+
permissions,
|
|
4320
4453
|
nodeReceipt: {
|
|
4321
4454
|
commitEventCid: activation.commitEventCid,
|
|
4322
4455
|
activated: activation.activated ?? [],
|
|
@@ -4576,6 +4709,13 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
4576
4709
|
body
|
|
4577
4710
|
)
|
|
4578
4711
|
});
|
|
4712
|
+
if (response.status === 409) {
|
|
4713
|
+
const existing = await this.getEncryptionNetwork(networkId);
|
|
4714
|
+
if (existing) return existing;
|
|
4715
|
+
throw new Error(
|
|
4716
|
+
`Encryption network ${networkId} already exists but could not be read back`
|
|
4717
|
+
);
|
|
4718
|
+
}
|
|
4579
4719
|
if (!response.ok) {
|
|
4580
4720
|
throw new Error(
|
|
4581
4721
|
`Failed to create encryption network ${networkId}: HTTP ${response.status} ${await response.text()}`
|
|
@@ -4584,11 +4724,19 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
4584
4724
|
const created = await response.json();
|
|
4585
4725
|
return created.descriptor;
|
|
4586
4726
|
}
|
|
4587
|
-
|
|
4727
|
+
/**
|
|
4728
|
+
* Ensure an encryption network exists, creating it if necessary.
|
|
4729
|
+
*
|
|
4730
|
+
* @param nameOrNetworkId - Network name or full `urn:tinycloud:encryption:` id.
|
|
4731
|
+
* @param options - See {@link EnsureEncryptionNetworkOptions}.
|
|
4732
|
+
*/
|
|
4733
|
+
async ensureEncryptionNetwork(nameOrNetworkId = DEFAULT_ENCRYPTION_NETWORK_NAME, options = {}) {
|
|
4588
4734
|
const networkId = nameOrNetworkId.startsWith("urn:tinycloud:encryption:") ? nameOrNetworkId : this.getDefaultEncryptionNetworkId(nameOrNetworkId);
|
|
4589
|
-
|
|
4590
|
-
|
|
4591
|
-
|
|
4735
|
+
if (!options.assumeMissing) {
|
|
4736
|
+
const existing = await this.getEncryptionNetwork(networkId);
|
|
4737
|
+
if (existing) {
|
|
4738
|
+
return existing;
|
|
4739
|
+
}
|
|
4592
4740
|
}
|
|
4593
4741
|
const parsed = parseNetworkId2(networkId);
|
|
4594
4742
|
if (!didPrincipalMatches2(parsed.ownerDid, this.did)) {
|