@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/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ISigner, Bytes, IWasmBindings, PersistedSessionProof, ISessionManager } from '@tinycloud/sdk-core';
|
|
2
|
-
export { ACCOUNT_REGISTRY_PATH, ACCOUNT_REGISTRY_SPACE, AccountApplication, AccountApplicationListOptions, AccountDelegation, AccountDelegationListOptions, AccountDelegationPage, AccountDelegationQueryOptions, AccountDelegationRecord, AccountDelegationResource, AccountDelegationRevokeOptions, AccountIndexEnsureResult, AccountIndexRebuildResult, AccountIndexStatus, AccountIndexedReadOptions, AccountService, AccountServiceConfig, AccountSpace, AccountSpaceListOptions, AccountStatus, AutoApproveSpaceCreationHandler, AutoRejectStrategy, AutoSignStrategy, BatchOptions, BatchResponse, BuildCanonicalDecryptRequestInput, BuildDecryptFactsInput, BuildDecryptInvocationInput, BuiltDecryptInvocation, CallbackStrategy, CanonicalAddress, CanonicalDecryptRequest, CanonicalJson, CanonicalParsedNetworkId, CapabilityEntry, CapabilityKeyRegistry, CapabilityKeyRegistryErrorCode, CapabilityKeyRegistryErrorCodes, CaveatedDelegationUnsupportedError, ClientSession, ColumnInfo, ComposeManifestOptions, ComposedManifestRequest, CreateDelegationParams, DECRYPT_ACTION, DECRYPT_FACT_TYPE, DECRYPT_RESULT_TYPE, DEFAULT_ENCRYPTION_ALG, DEFAULT_KEY_VERSION, DEFAULT_MANIFEST_SPACE, DEFAULT_MANIFEST_VERSION, DEFAULT_SIGNED_READ_URL_EXPIRY_MS, DataVaultConfig, DataVaultService, DatabaseHandle, DecryptCapabilityProof, DecryptEnvelopeOptions, DecryptInvocationFact, DecryptInvocationSigner, DecryptRequestBody, DecryptResponseBody, DecryptTransport, DecryptTransportResponseError, DelegateReceivedShareParams, DelegatedShareAccess, Delegation, DelegationChain, DelegationChainV2, DelegationDirection, DelegationError, DelegationErrorCode, DelegationErrorCodes, DelegationFilters, DelegationManager, DelegationManagerConfig, DelegationRecord, DelegationResult, DelegationRevocationReceipt, DidCacheKeyOptions, DidEqualsOptions, DiscoverNetworkInput, DiscoveredNetwork, DiscoverySource, DuckDbAction, DuckDbActionType, DuckDbBatchOptions, DuckDbBatchResponse, DuckDbDatabaseHandle, DuckDbExecuteOptions, DuckDbExecuteResponse, DuckDbOptions, DuckDbQueryOptions, DuckDbQueryResponse, DuckDbService, DuckDbServiceConfig, DuckDbStatement, DuckDbValue, ENCRYPTION_NETWORK_URN_PREFIX, ENCRYPTION_SERVICE, ENCRYPTION_SERVICE_SHORT, ENVELOPE_VERSION, EncodedShareData, EncryptToNetworkInput, EncryptToNetworkOptions, EncryptToNetworkResult, EncryptionCrypto, EncryptionError, EncryptionErrorInput, EncryptionService, EncryptionServiceConfig, ExecuteOptions, ExecuteResponse, Extension, FetchFunction, GenerateShareParams, HookEvent, HookServiceName, HookStreamEvent, HookSubscription, HookWebhookListOptions, HookWebhookRecord, HookWebhookRegistration, HookWebhookScope, HookWebhookUnregisterOptions, HooksService, HooksServiceConfig, ICapabilityKeyRegistry, IDataVaultService, IDatabaseHandle, IDuckDbDatabaseHandle, IDuckDbService, IENSResolver, IEncryptionService, IHooksService, IKVService, INotificationHandler, IPrefixedKVService, ISQLService, ISecretsService, ISessionManager, ISessionStorage, ISharingService, ISigner, ISpace, ISpaceCreationHandler, ISpaceScopedDelegations, ISpaceScopedSharing, ISpaceService, IUserAuthorization, IWasmBindings, IdentityParseError, IngestOptions, InlineEncryptedEnvelope, InvokeFunction, JWK, KVBatchReadResponse, KVCreateSignedReadUrlOptions, KVResponse, KVService, KVServiceConfig, KVSignedReadUrlResponse, KeyInfo, KeyProvider, KeyType, Manifest, ManifestDefaults, ManifestRegistryRecord, ManifestSecretActions, ManifestValidationError, NETWORK_NAME_PATTERN, NetworkDescriptor, NetworkIdError, NodeDescriptorFetcher, OpenKeyCallbackStrategy, OpenKeySigningRequestBody, OpenKeySigningResponseBody, OpenKeySigningStrategyOptions, OwnerSharePolicyRegistrationReceipt, ParsedNetworkId, PermissionEntry, PermissionNotInManifestError, PersistedSessionData, PkhDidParts, PrefixedKVService, ProtocolMismatchError, QueryOptions, QueryResponse, RandomReceiverKeyInput, ReceiveOptions, ReceiverKeyPair, ReceiverKeySigner, 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, SignedReceiverKeyInput, SilentNotificationHandler, Space, SpaceAbilitiesMap, SpaceConfig, SpaceCreationContext, SpaceErrorCode, SpaceErrorCodes, SpaceInfo, SpaceOwnership, SpaceService, SpaceServiceConfig, SqlStatement, SqlValue, StoredDelegationChain, SubscribeOptions, 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, VerifyDecryptResponseInput, VersionCheckError, ViewInfo, WasmVaultFunctions, WellKnownDescriptorFetcher, addressStorageKey, buildCanonicalDecryptRequest, buildDecryptAttenuation, buildDecryptFacts, buildDecryptInvocation, buildNetworkId, buildSpaceUri, canonicalHashHex, canonicalSignedResponse, canonicalizeAddress, canonicalizeDid, canonicalizeDidUrl, canonicalizeEncryptionJson, canonicalizeNetworkId, canonicalizeSecretScope, checkDecryptInvocationInput, checkNodeInfo, clearTinyCloudDebugLogs, composeManifestRequest, createCapabilityKeyRegistry, createOpenKeyCallbackSigningStrategy, createSharingService, createSpaceService, createVaultCrypto, decryptEnvelopeWithKey, defaultSpaceCreationHandler, deriveSignedReceiverKey, didCacheKey, didEquals, disableTinyCloudDebug, discoverNetwork, enableTinyCloudDebug, encryptToNetwork, encryptionBase64Decode, encryptionBase64Encode, encryptionError, encryptionUtf8Decode, encryptionUtf8Encode, ensureNetworkUsableForDecrypt, expandActionShortNames, expandPermissionEntries, expandPermissionEntry, generateRandomReceiverKey, getTinyCloudDebugLogs, hexDecode, hexEncode, installTinyCloudDebugGlobals, isCapabilitySubset, isEvmAddress, isNetworkId, loadManifest, makePkhSpaceId, makePublicSpaceId, networkDiscoveryKey, openWrappedKey, parseCanonicalNetworkId, parseExpiry, parseNetworkId, parsePkhDid, parseSpaceUri, pkhDid, principalDid, principalDidEquals, resolveManifest, resolveSecretListPrefix, resolveSecretPath, resourceCapabilitiesToSpaceAbilitiesMap, tinyCloudDebugLogger, validateEnvelope, validateManifest, verifyDecryptResponse } from '@tinycloud/sdk-core';
|
|
3
|
-
export { A as AuthDelegationArtifact, a as AuthRequestArtifact, C as CreateOwnerDelegationParams, D as DelegateToOptions, b as DelegateToResult, c as DelegatedAccess, d as DelegationAuthority, F as FileSessionStorage, M as MemorySessionStorage, N as NodeEventEmitterStrategy, e as NodeUserAuthorization, f as NodeUserAuthorizationConfig, O as OwnerDelegationReceipt, P as PortableDelegation, R as RestorableSession, g as RuntimeDelegationActivator, h as RuntimePermissionGrantOptions, S as SecretPermissionHint, i as SecretReadInput, j as SecretReadResult, k as SignStrategy, T as TinyCloudNode, l as TinyCloudNodeConfig, U as UnsupportedSessionRestoreError, V as ValidatedRuntimeDelegation, W as WasmKeyProvider, m as WasmKeyProviderConfig, n as activateValidatedRuntimeDelegation, o as createWasmKeyProvider, p as defaultSignStrategy, q as deserializeDelegation, r as grantAuthRequest, s as serializeDelegation } from './core-
|
|
2
|
+
export { ACCOUNT_REGISTRY_PATH, ACCOUNT_REGISTRY_SPACE, AccountApplication, AccountApplicationListOptions, AccountApplicationRegisterOptions, AccountDelegation, AccountDelegationListOptions, AccountDelegationPage, AccountDelegationQueryOptions, AccountDelegationRecord, AccountDelegationResource, AccountDelegationRevokeOptions, AccountIndexEnsureResult, AccountIndexRebuildResult, AccountIndexStatus, AccountIndexedReadOptions, AccountService, AccountServiceConfig, AccountSpace, AccountSpaceListOptions, AccountStatus, AutoApproveSpaceCreationHandler, AutoRejectStrategy, AutoSignStrategy, BatchOptions, BatchResponse, BuildCanonicalDecryptRequestInput, BuildDecryptFactsInput, BuildDecryptInvocationInput, BuiltDecryptInvocation, CallbackStrategy, CanonicalAddress, CanonicalDecryptRequest, CanonicalJson, CanonicalParsedNetworkId, CapabilityEntry, CapabilityKeyRegistry, CapabilityKeyRegistryErrorCode, CapabilityKeyRegistryErrorCodes, CaveatedDelegationUnsupportedError, ClientSession, ColumnInfo, ComposeManifestOptions, ComposedManifestRequest, CreateDelegationParams, DECRYPT_ACTION, DECRYPT_FACT_TYPE, DECRYPT_RESULT_TYPE, DEFAULT_ENCRYPTION_ALG, DEFAULT_KEY_VERSION, DEFAULT_MANIFEST_SPACE, DEFAULT_MANIFEST_VERSION, DEFAULT_SIGNED_READ_URL_EXPIRY_MS, DataVaultConfig, DataVaultService, DatabaseHandle, DecryptCapabilityProof, DecryptEnvelopeOptions, DecryptInvocationFact, DecryptInvocationSigner, DecryptRequestBody, DecryptResponseBody, DecryptTransport, DecryptTransportResponseError, DelegateReceivedShareParams, DelegatedShareAccess, Delegation, DelegationChain, DelegationChainV2, DelegationDirection, DelegationError, DelegationErrorCode, DelegationErrorCodes, DelegationFilters, DelegationManager, DelegationManagerConfig, DelegationRecord, DelegationResult, DelegationRevocationReceipt, DidCacheKeyOptions, DidEqualsOptions, DiscoverNetworkInput, DiscoveredNetwork, DiscoverySource, DuckDbAction, DuckDbActionType, DuckDbBatchOptions, DuckDbBatchResponse, DuckDbDatabaseHandle, DuckDbExecuteOptions, DuckDbExecuteResponse, DuckDbOptions, DuckDbQueryOptions, DuckDbQueryResponse, DuckDbService, DuckDbServiceConfig, DuckDbStatement, DuckDbValue, ENCRYPTION_NETWORK_URN_PREFIX, ENCRYPTION_SERVICE, ENCRYPTION_SERVICE_SHORT, ENVELOPE_VERSION, EncodedShareData, EncryptToNetworkInput, EncryptToNetworkOptions, EncryptToNetworkResult, EncryptionCrypto, EncryptionError, EncryptionErrorInput, EncryptionService, EncryptionServiceConfig, ExecuteOptions, ExecuteResponse, Extension, FetchFunction, GenerateShareParams, HookEvent, HookServiceName, HookStreamEvent, HookSubscription, HookWebhookListOptions, HookWebhookRecord, HookWebhookRegistration, HookWebhookScope, HookWebhookUnregisterOptions, HooksService, HooksServiceConfig, ICapabilityKeyRegistry, IDataVaultService, IDatabaseHandle, IDuckDbDatabaseHandle, IDuckDbService, IENSResolver, IEncryptionService, IHooksService, IKVService, INotificationHandler, IPrefixedKVService, ISQLService, ISecretsService, ISessionManager, ISessionStorage, ISharingService, ISigner, ISpace, ISpaceCreationHandler, ISpaceScopedDelegations, ISpaceScopedSharing, ISpaceService, IUserAuthorization, IWasmBindings, IdentityParseError, IngestOptions, InlineEncryptedEnvelope, InvokeFunction, JWK, KVBatchReadResponse, KVCreateSignedReadUrlOptions, KVResponse, KVService, KVServiceConfig, KVSignedReadUrlResponse, KeyInfo, KeyProvider, KeyType, Manifest, ManifestDefaults, ManifestRegistryRecord, ManifestSecretActions, ManifestValidationError, NETWORK_NAME_PATTERN, NetworkDescriptor, NetworkIdError, NodeDescriptorFetcher, OpenKeyCallbackStrategy, OpenKeySigningRequestBody, OpenKeySigningResponseBody, OpenKeySigningStrategyOptions, OwnerDelegationPermission, OwnerSharePolicyRegistrationReceipt, ParsedNetworkId, PermissionEntry, PermissionNotInManifestError, PersistedSessionData, PkhDidParts, PrefixedKVService, ProtocolMismatchError, QueryOptions, QueryResponse, RandomReceiverKeyInput, ReceiveOptions, ReceiverKeyPair, ReceiverKeySigner, 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, SignedReceiverKeyInput, SilentNotificationHandler, Space, SpaceAbilitiesMap, SpaceConfig, SpaceCreationContext, SpaceErrorCode, SpaceErrorCodes, SpaceInfo, SpaceOwnership, SpaceService, SpaceServiceConfig, SqlStatement, SqlValue, StoredDelegationChain, SubscribeOptions, 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, VerifyDecryptResponseInput, VersionCheckError, ViewInfo, WasmVaultFunctions, WellKnownDescriptorFetcher, addressStorageKey, buildCanonicalDecryptRequest, buildDecryptAttenuation, buildDecryptFacts, buildDecryptInvocation, buildNetworkId, buildSpaceUri, canonicalHashHex, canonicalSignedResponse, canonicalizeAddress, canonicalizeDid, canonicalizeDidUrl, canonicalizeEncryptionJson, canonicalizeNetworkId, canonicalizeSecretScope, checkDecryptInvocationInput, checkNodeInfo, clearTinyCloudDebugLogs, composeManifestRequest, createCapabilityKeyRegistry, createOpenKeyCallbackSigningStrategy, createSharingService, createSpaceService, createVaultCrypto, decryptEnvelopeWithKey, defaultSpaceCreationHandler, deriveSignedReceiverKey, didCacheKey, didEquals, disableTinyCloudDebug, discoverNetwork, enableTinyCloudDebug, encryptToNetwork, encryptionBase64Decode, encryptionBase64Encode, encryptionError, encryptionUtf8Decode, encryptionUtf8Encode, ensureNetworkUsableForDecrypt, expandActionShortNames, expandPermissionEntries, expandPermissionEntry, generateRandomReceiverKey, getTinyCloudDebugLogs, hexDecode, hexEncode, installTinyCloudDebugGlobals, isCapabilitySubset, isEvmAddress, isNetworkId, loadManifest, makePkhSpaceId, makePublicSpaceId, networkDiscoveryKey, openWrappedKey, parseCanonicalNetworkId, parseExpiry, parseNetworkId, parsePkhDid, parseSpaceUri, pkhDid, principalDid, principalDidEquals, resolveManifest, resolveSecretListPrefix, resolveSecretPath, resourceCapabilitiesToSpaceAbilitiesMap, tinyCloudDebugLogger, validateEnvelope, validateManifest, verifyDecryptResponse } from '@tinycloud/sdk-core';
|
|
3
|
+
export { A as AuthDelegationArtifact, a as AuthRequestArtifact, C as CreateOwnerDelegationParams, D as DelegateToOptions, b as DelegateToResult, c as DelegatedAccess, d as DelegationAuthority, E as EnsureEncryptionNetworkOptions, F as FileSessionStorage, M as MemorySessionStorage, N as NodeEventEmitterStrategy, e as NodeUserAuthorization, f as NodeUserAuthorizationConfig, O as OwnerDelegationReceipt, P as PortableDelegation, R as RestorableSession, g as RuntimeDelegationActivator, h as RuntimePermissionGrantOptions, S as SecretPermissionHint, i as SecretReadInput, j as SecretReadResult, k as SignStrategy, T as TinyCloudNode, l as TinyCloudNodeConfig, U as UnsupportedSessionRestoreError, V as ValidatedRuntimeDelegation, W as WasmKeyProvider, m as WasmKeyProviderConfig, n as activateValidatedRuntimeDelegation, o as createWasmKeyProvider, p as defaultSignStrategy, q as deserializeDelegation, r as grantAuthRequest, s as serializeDelegation } from './core-DfcWH9i4.cjs';
|
|
4
4
|
import { invoke, invokeAny, computeCid, prepareSession, completeSessionSetup, ensureEip55, makeSpaceId, createDelegation, parseRecapFromSiwe, parseVerifiedRecapFromSiwe, generateHostSIWEMessage, siweToDelegationHeaders, protocolVersion, vault_encrypt, vault_decrypt, vault_derive_key, vault_x25519_from_seed, vault_x25519_dh, vault_random_bytes, vault_sha256 } from '@tinycloud/node-sdk-wasm';
|
|
5
5
|
import 'events';
|
|
6
6
|
import '@tinycloud/sdk-services';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ISigner, Bytes, IWasmBindings, PersistedSessionProof, ISessionManager } from '@tinycloud/sdk-core';
|
|
2
|
-
export { ACCOUNT_REGISTRY_PATH, ACCOUNT_REGISTRY_SPACE, AccountApplication, AccountApplicationListOptions, AccountDelegation, AccountDelegationListOptions, AccountDelegationPage, AccountDelegationQueryOptions, AccountDelegationRecord, AccountDelegationResource, AccountDelegationRevokeOptions, AccountIndexEnsureResult, AccountIndexRebuildResult, AccountIndexStatus, AccountIndexedReadOptions, AccountService, AccountServiceConfig, AccountSpace, AccountSpaceListOptions, AccountStatus, AutoApproveSpaceCreationHandler, AutoRejectStrategy, AutoSignStrategy, BatchOptions, BatchResponse, BuildCanonicalDecryptRequestInput, BuildDecryptFactsInput, BuildDecryptInvocationInput, BuiltDecryptInvocation, CallbackStrategy, CanonicalAddress, CanonicalDecryptRequest, CanonicalJson, CanonicalParsedNetworkId, CapabilityEntry, CapabilityKeyRegistry, CapabilityKeyRegistryErrorCode, CapabilityKeyRegistryErrorCodes, CaveatedDelegationUnsupportedError, ClientSession, ColumnInfo, ComposeManifestOptions, ComposedManifestRequest, CreateDelegationParams, DECRYPT_ACTION, DECRYPT_FACT_TYPE, DECRYPT_RESULT_TYPE, DEFAULT_ENCRYPTION_ALG, DEFAULT_KEY_VERSION, DEFAULT_MANIFEST_SPACE, DEFAULT_MANIFEST_VERSION, DEFAULT_SIGNED_READ_URL_EXPIRY_MS, DataVaultConfig, DataVaultService, DatabaseHandle, DecryptCapabilityProof, DecryptEnvelopeOptions, DecryptInvocationFact, DecryptInvocationSigner, DecryptRequestBody, DecryptResponseBody, DecryptTransport, DecryptTransportResponseError, DelegateReceivedShareParams, DelegatedShareAccess, Delegation, DelegationChain, DelegationChainV2, DelegationDirection, DelegationError, DelegationErrorCode, DelegationErrorCodes, DelegationFilters, DelegationManager, DelegationManagerConfig, DelegationRecord, DelegationResult, DelegationRevocationReceipt, DidCacheKeyOptions, DidEqualsOptions, DiscoverNetworkInput, DiscoveredNetwork, DiscoverySource, DuckDbAction, DuckDbActionType, DuckDbBatchOptions, DuckDbBatchResponse, DuckDbDatabaseHandle, DuckDbExecuteOptions, DuckDbExecuteResponse, DuckDbOptions, DuckDbQueryOptions, DuckDbQueryResponse, DuckDbService, DuckDbServiceConfig, DuckDbStatement, DuckDbValue, ENCRYPTION_NETWORK_URN_PREFIX, ENCRYPTION_SERVICE, ENCRYPTION_SERVICE_SHORT, ENVELOPE_VERSION, EncodedShareData, EncryptToNetworkInput, EncryptToNetworkOptions, EncryptToNetworkResult, EncryptionCrypto, EncryptionError, EncryptionErrorInput, EncryptionService, EncryptionServiceConfig, ExecuteOptions, ExecuteResponse, Extension, FetchFunction, GenerateShareParams, HookEvent, HookServiceName, HookStreamEvent, HookSubscription, HookWebhookListOptions, HookWebhookRecord, HookWebhookRegistration, HookWebhookScope, HookWebhookUnregisterOptions, HooksService, HooksServiceConfig, ICapabilityKeyRegistry, IDataVaultService, IDatabaseHandle, IDuckDbDatabaseHandle, IDuckDbService, IENSResolver, IEncryptionService, IHooksService, IKVService, INotificationHandler, IPrefixedKVService, ISQLService, ISecretsService, ISessionManager, ISessionStorage, ISharingService, ISigner, ISpace, ISpaceCreationHandler, ISpaceScopedDelegations, ISpaceScopedSharing, ISpaceService, IUserAuthorization, IWasmBindings, IdentityParseError, IngestOptions, InlineEncryptedEnvelope, InvokeFunction, JWK, KVBatchReadResponse, KVCreateSignedReadUrlOptions, KVResponse, KVService, KVServiceConfig, KVSignedReadUrlResponse, KeyInfo, KeyProvider, KeyType, Manifest, ManifestDefaults, ManifestRegistryRecord, ManifestSecretActions, ManifestValidationError, NETWORK_NAME_PATTERN, NetworkDescriptor, NetworkIdError, NodeDescriptorFetcher, OpenKeyCallbackStrategy, OpenKeySigningRequestBody, OpenKeySigningResponseBody, OpenKeySigningStrategyOptions, OwnerSharePolicyRegistrationReceipt, ParsedNetworkId, PermissionEntry, PermissionNotInManifestError, PersistedSessionData, PkhDidParts, PrefixedKVService, ProtocolMismatchError, QueryOptions, QueryResponse, RandomReceiverKeyInput, ReceiveOptions, ReceiverKeyPair, ReceiverKeySigner, 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, SignedReceiverKeyInput, SilentNotificationHandler, Space, SpaceAbilitiesMap, SpaceConfig, SpaceCreationContext, SpaceErrorCode, SpaceErrorCodes, SpaceInfo, SpaceOwnership, SpaceService, SpaceServiceConfig, SqlStatement, SqlValue, StoredDelegationChain, SubscribeOptions, 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, VerifyDecryptResponseInput, VersionCheckError, ViewInfo, WasmVaultFunctions, WellKnownDescriptorFetcher, addressStorageKey, buildCanonicalDecryptRequest, buildDecryptAttenuation, buildDecryptFacts, buildDecryptInvocation, buildNetworkId, buildSpaceUri, canonicalHashHex, canonicalSignedResponse, canonicalizeAddress, canonicalizeDid, canonicalizeDidUrl, canonicalizeEncryptionJson, canonicalizeNetworkId, canonicalizeSecretScope, checkDecryptInvocationInput, checkNodeInfo, clearTinyCloudDebugLogs, composeManifestRequest, createCapabilityKeyRegistry, createOpenKeyCallbackSigningStrategy, createSharingService, createSpaceService, createVaultCrypto, decryptEnvelopeWithKey, defaultSpaceCreationHandler, deriveSignedReceiverKey, didCacheKey, didEquals, disableTinyCloudDebug, discoverNetwork, enableTinyCloudDebug, encryptToNetwork, encryptionBase64Decode, encryptionBase64Encode, encryptionError, encryptionUtf8Decode, encryptionUtf8Encode, ensureNetworkUsableForDecrypt, expandActionShortNames, expandPermissionEntries, expandPermissionEntry, generateRandomReceiverKey, getTinyCloudDebugLogs, hexDecode, hexEncode, installTinyCloudDebugGlobals, isCapabilitySubset, isEvmAddress, isNetworkId, loadManifest, makePkhSpaceId, makePublicSpaceId, networkDiscoveryKey, openWrappedKey, parseCanonicalNetworkId, parseExpiry, parseNetworkId, parsePkhDid, parseSpaceUri, pkhDid, principalDid, principalDidEquals, resolveManifest, resolveSecretListPrefix, resolveSecretPath, resourceCapabilitiesToSpaceAbilitiesMap, tinyCloudDebugLogger, validateEnvelope, validateManifest, verifyDecryptResponse } from '@tinycloud/sdk-core';
|
|
3
|
-
export { A as AuthDelegationArtifact, a as AuthRequestArtifact, C as CreateOwnerDelegationParams, D as DelegateToOptions, b as DelegateToResult, c as DelegatedAccess, d as DelegationAuthority, F as FileSessionStorage, M as MemorySessionStorage, N as NodeEventEmitterStrategy, e as NodeUserAuthorization, f as NodeUserAuthorizationConfig, O as OwnerDelegationReceipt, P as PortableDelegation, R as RestorableSession, g as RuntimeDelegationActivator, h as RuntimePermissionGrantOptions, S as SecretPermissionHint, i as SecretReadInput, j as SecretReadResult, k as SignStrategy, T as TinyCloudNode, l as TinyCloudNodeConfig, U as UnsupportedSessionRestoreError, V as ValidatedRuntimeDelegation, W as WasmKeyProvider, m as WasmKeyProviderConfig, n as activateValidatedRuntimeDelegation, o as createWasmKeyProvider, p as defaultSignStrategy, q as deserializeDelegation, r as grantAuthRequest, s as serializeDelegation } from './core-
|
|
2
|
+
export { ACCOUNT_REGISTRY_PATH, ACCOUNT_REGISTRY_SPACE, AccountApplication, AccountApplicationListOptions, AccountApplicationRegisterOptions, AccountDelegation, AccountDelegationListOptions, AccountDelegationPage, AccountDelegationQueryOptions, AccountDelegationRecord, AccountDelegationResource, AccountDelegationRevokeOptions, AccountIndexEnsureResult, AccountIndexRebuildResult, AccountIndexStatus, AccountIndexedReadOptions, AccountService, AccountServiceConfig, AccountSpace, AccountSpaceListOptions, AccountStatus, AutoApproveSpaceCreationHandler, AutoRejectStrategy, AutoSignStrategy, BatchOptions, BatchResponse, BuildCanonicalDecryptRequestInput, BuildDecryptFactsInput, BuildDecryptInvocationInput, BuiltDecryptInvocation, CallbackStrategy, CanonicalAddress, CanonicalDecryptRequest, CanonicalJson, CanonicalParsedNetworkId, CapabilityEntry, CapabilityKeyRegistry, CapabilityKeyRegistryErrorCode, CapabilityKeyRegistryErrorCodes, CaveatedDelegationUnsupportedError, ClientSession, ColumnInfo, ComposeManifestOptions, ComposedManifestRequest, CreateDelegationParams, DECRYPT_ACTION, DECRYPT_FACT_TYPE, DECRYPT_RESULT_TYPE, DEFAULT_ENCRYPTION_ALG, DEFAULT_KEY_VERSION, DEFAULT_MANIFEST_SPACE, DEFAULT_MANIFEST_VERSION, DEFAULT_SIGNED_READ_URL_EXPIRY_MS, DataVaultConfig, DataVaultService, DatabaseHandle, DecryptCapabilityProof, DecryptEnvelopeOptions, DecryptInvocationFact, DecryptInvocationSigner, DecryptRequestBody, DecryptResponseBody, DecryptTransport, DecryptTransportResponseError, DelegateReceivedShareParams, DelegatedShareAccess, Delegation, DelegationChain, DelegationChainV2, DelegationDirection, DelegationError, DelegationErrorCode, DelegationErrorCodes, DelegationFilters, DelegationManager, DelegationManagerConfig, DelegationRecord, DelegationResult, DelegationRevocationReceipt, DidCacheKeyOptions, DidEqualsOptions, DiscoverNetworkInput, DiscoveredNetwork, DiscoverySource, DuckDbAction, DuckDbActionType, DuckDbBatchOptions, DuckDbBatchResponse, DuckDbDatabaseHandle, DuckDbExecuteOptions, DuckDbExecuteResponse, DuckDbOptions, DuckDbQueryOptions, DuckDbQueryResponse, DuckDbService, DuckDbServiceConfig, DuckDbStatement, DuckDbValue, ENCRYPTION_NETWORK_URN_PREFIX, ENCRYPTION_SERVICE, ENCRYPTION_SERVICE_SHORT, ENVELOPE_VERSION, EncodedShareData, EncryptToNetworkInput, EncryptToNetworkOptions, EncryptToNetworkResult, EncryptionCrypto, EncryptionError, EncryptionErrorInput, EncryptionService, EncryptionServiceConfig, ExecuteOptions, ExecuteResponse, Extension, FetchFunction, GenerateShareParams, HookEvent, HookServiceName, HookStreamEvent, HookSubscription, HookWebhookListOptions, HookWebhookRecord, HookWebhookRegistration, HookWebhookScope, HookWebhookUnregisterOptions, HooksService, HooksServiceConfig, ICapabilityKeyRegistry, IDataVaultService, IDatabaseHandle, IDuckDbDatabaseHandle, IDuckDbService, IENSResolver, IEncryptionService, IHooksService, IKVService, INotificationHandler, IPrefixedKVService, ISQLService, ISecretsService, ISessionManager, ISessionStorage, ISharingService, ISigner, ISpace, ISpaceCreationHandler, ISpaceScopedDelegations, ISpaceScopedSharing, ISpaceService, IUserAuthorization, IWasmBindings, IdentityParseError, IngestOptions, InlineEncryptedEnvelope, InvokeFunction, JWK, KVBatchReadResponse, KVCreateSignedReadUrlOptions, KVResponse, KVService, KVServiceConfig, KVSignedReadUrlResponse, KeyInfo, KeyProvider, KeyType, Manifest, ManifestDefaults, ManifestRegistryRecord, ManifestSecretActions, ManifestValidationError, NETWORK_NAME_PATTERN, NetworkDescriptor, NetworkIdError, NodeDescriptorFetcher, OpenKeyCallbackStrategy, OpenKeySigningRequestBody, OpenKeySigningResponseBody, OpenKeySigningStrategyOptions, OwnerDelegationPermission, OwnerSharePolicyRegistrationReceipt, ParsedNetworkId, PermissionEntry, PermissionNotInManifestError, PersistedSessionData, PkhDidParts, PrefixedKVService, ProtocolMismatchError, QueryOptions, QueryResponse, RandomReceiverKeyInput, ReceiveOptions, ReceiverKeyPair, ReceiverKeySigner, 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, SignedReceiverKeyInput, SilentNotificationHandler, Space, SpaceAbilitiesMap, SpaceConfig, SpaceCreationContext, SpaceErrorCode, SpaceErrorCodes, SpaceInfo, SpaceOwnership, SpaceService, SpaceServiceConfig, SqlStatement, SqlValue, StoredDelegationChain, SubscribeOptions, 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, VerifyDecryptResponseInput, VersionCheckError, ViewInfo, WasmVaultFunctions, WellKnownDescriptorFetcher, addressStorageKey, buildCanonicalDecryptRequest, buildDecryptAttenuation, buildDecryptFacts, buildDecryptInvocation, buildNetworkId, buildSpaceUri, canonicalHashHex, canonicalSignedResponse, canonicalizeAddress, canonicalizeDid, canonicalizeDidUrl, canonicalizeEncryptionJson, canonicalizeNetworkId, canonicalizeSecretScope, checkDecryptInvocationInput, checkNodeInfo, clearTinyCloudDebugLogs, composeManifestRequest, createCapabilityKeyRegistry, createOpenKeyCallbackSigningStrategy, createSharingService, createSpaceService, createVaultCrypto, decryptEnvelopeWithKey, defaultSpaceCreationHandler, deriveSignedReceiverKey, didCacheKey, didEquals, disableTinyCloudDebug, discoverNetwork, enableTinyCloudDebug, encryptToNetwork, encryptionBase64Decode, encryptionBase64Encode, encryptionError, encryptionUtf8Decode, encryptionUtf8Encode, ensureNetworkUsableForDecrypt, expandActionShortNames, expandPermissionEntries, expandPermissionEntry, generateRandomReceiverKey, getTinyCloudDebugLogs, hexDecode, hexEncode, installTinyCloudDebugGlobals, isCapabilitySubset, isEvmAddress, isNetworkId, loadManifest, makePkhSpaceId, makePublicSpaceId, networkDiscoveryKey, openWrappedKey, parseCanonicalNetworkId, parseExpiry, parseNetworkId, parsePkhDid, parseSpaceUri, pkhDid, principalDid, principalDidEquals, resolveManifest, resolveSecretListPrefix, resolveSecretPath, resourceCapabilitiesToSpaceAbilitiesMap, tinyCloudDebugLogger, validateEnvelope, validateManifest, verifyDecryptResponse } from '@tinycloud/sdk-core';
|
|
3
|
+
export { A as AuthDelegationArtifact, a as AuthRequestArtifact, C as CreateOwnerDelegationParams, D as DelegateToOptions, b as DelegateToResult, c as DelegatedAccess, d as DelegationAuthority, E as EnsureEncryptionNetworkOptions, F as FileSessionStorage, M as MemorySessionStorage, N as NodeEventEmitterStrategy, e as NodeUserAuthorization, f as NodeUserAuthorizationConfig, O as OwnerDelegationReceipt, P as PortableDelegation, R as RestorableSession, g as RuntimeDelegationActivator, h as RuntimePermissionGrantOptions, S as SecretPermissionHint, i as SecretReadInput, j as SecretReadResult, k as SignStrategy, T as TinyCloudNode, l as TinyCloudNodeConfig, U as UnsupportedSessionRestoreError, V as ValidatedRuntimeDelegation, W as WasmKeyProvider, m as WasmKeyProviderConfig, n as activateValidatedRuntimeDelegation, o as createWasmKeyProvider, p as defaultSignStrategy, q as deserializeDelegation, r as grantAuthRequest, s as serializeDelegation } from './core-DfcWH9i4.js';
|
|
4
4
|
import { invoke, invokeAny, computeCid, prepareSession, completeSessionSetup, ensureEip55, makeSpaceId, createDelegation, parseRecapFromSiwe, parseVerifiedRecapFromSiwe, generateHostSIWEMessage, siweToDelegationHeaders, protocolVersion, vault_encrypt, vault_decrypt, vault_derive_key, vault_x25519_from_seed, vault_x25519_dh, vault_random_bytes, vault_sha256 } from '@tinycloud/node-sdk-wasm';
|
|
5
5
|
import 'events';
|
|
6
6
|
import '@tinycloud/sdk-services';
|
package/dist/index.js
CHANGED
|
@@ -17542,6 +17542,15 @@ var NodeUserAuthorization = class {
|
|
|
17542
17542
|
get nodeFeatures() {
|
|
17543
17543
|
return this._nodeFeatures;
|
|
17544
17544
|
}
|
|
17545
|
+
/**
|
|
17546
|
+
* The node DID reported by `GET /info` for `host`, if the sign-in (or
|
|
17547
|
+
* restore) that populated it targeted that same host. Returns `undefined`
|
|
17548
|
+
* for any other host, and for nodes whose `/info` omits `nodeId`, so callers
|
|
17549
|
+
* fall back to fetching it themselves rather than using a foreign node's DID.
|
|
17550
|
+
*/
|
|
17551
|
+
nodeIdForHost(host) {
|
|
17552
|
+
return this._nodeInfoIdentity?.host === host ? this._nodeInfoIdentity.nodeId : void 0;
|
|
17553
|
+
}
|
|
17545
17554
|
get lastActivationSkippedSpaceIds() {
|
|
17546
17555
|
return [...this._lastActivationSkippedSpaceIds];
|
|
17547
17556
|
}
|
|
@@ -18011,11 +18020,13 @@ var NodeUserAuthorization = class {
|
|
|
18011
18020
|
this._tinyCloudSession = tinyCloudSession;
|
|
18012
18021
|
this._address = address;
|
|
18013
18022
|
this._chainId = chainId;
|
|
18023
|
+
const infoHost = this.primaryTinyCloudHost;
|
|
18014
18024
|
const nodeInfo = await checkNodeInfo(
|
|
18015
|
-
|
|
18025
|
+
infoHost,
|
|
18016
18026
|
this.wasm.protocolVersion()
|
|
18017
18027
|
);
|
|
18018
18028
|
this._nodeFeatures = nodeInfo.features;
|
|
18029
|
+
this._nodeInfoIdentity = nodeInfo.nodeId ? { host: infoHost, nodeId: nodeInfo.nodeId } : void 0;
|
|
18019
18030
|
for (const ext of this.extensions) {
|
|
18020
18031
|
if (ext.afterSignIn) {
|
|
18021
18032
|
await ext.afterSignIn(clientSession);
|
|
@@ -18181,11 +18192,13 @@ var NodeUserAuthorization = class {
|
|
|
18181
18192
|
this._tinyCloudSession = tinyCloudSession;
|
|
18182
18193
|
this._address = address;
|
|
18183
18194
|
this._chainId = chainId;
|
|
18195
|
+
const infoHost = this.primaryTinyCloudHost;
|
|
18184
18196
|
const nodeInfo = await checkNodeInfo(
|
|
18185
|
-
|
|
18197
|
+
infoHost,
|
|
18186
18198
|
this.wasm.protocolVersion()
|
|
18187
18199
|
);
|
|
18188
18200
|
this._nodeFeatures = nodeInfo.features;
|
|
18201
|
+
this._nodeInfoIdentity = nodeInfo.nodeId ? { host: infoHost, nodeId: nodeInfo.nodeId } : void 0;
|
|
18189
18202
|
for (const ext of this.extensions) {
|
|
18190
18203
|
if (ext.afterSignIn) {
|
|
18191
18204
|
await ext.afterSignIn(clientSession);
|
|
@@ -18893,19 +18906,87 @@ function persistedExpiry(value) {
|
|
|
18893
18906
|
function sameInstant(left, right) {
|
|
18894
18907
|
return left.getTime() === right.getTime();
|
|
18895
18908
|
}
|
|
18896
|
-
function
|
|
18897
|
-
|
|
18909
|
+
function ownerDelegationPermissions(params) {
|
|
18910
|
+
const hasPermissions = Object.prototype.hasOwnProperty.call(params, "permissions");
|
|
18911
|
+
const hasLegacy = Object.prototype.hasOwnProperty.call(params, "path") || Object.prototype.hasOwnProperty.call(params, "actions");
|
|
18912
|
+
if (hasPermissions === hasLegacy) {
|
|
18913
|
+
throw new Error("Owner delegation requires exactly one authority shape: path/actions or permissions");
|
|
18914
|
+
}
|
|
18915
|
+
const permissions = [];
|
|
18916
|
+
if (hasPermissions) {
|
|
18917
|
+
if (!Array.isArray(params.permissions)) {
|
|
18918
|
+
throw new Error("Owner delegation permissions are invalid");
|
|
18919
|
+
}
|
|
18920
|
+
permissions.push(...params.permissions.map((permission) => ({
|
|
18921
|
+
service: permission.service,
|
|
18922
|
+
path: permission.path,
|
|
18923
|
+
actions: [...permission.actions]
|
|
18924
|
+
})));
|
|
18925
|
+
} else {
|
|
18926
|
+
if (typeof params.path !== "string" || !Array.isArray(params.actions)) {
|
|
18927
|
+
throw new Error("Owner delegation requires bounded capabilities");
|
|
18928
|
+
}
|
|
18929
|
+
const byService = /* @__PURE__ */ new Map();
|
|
18930
|
+
for (const action of params.actions) {
|
|
18931
|
+
if (typeof action !== "string") {
|
|
18932
|
+
throw new Error("Owner delegation capabilities are unsupported");
|
|
18933
|
+
}
|
|
18934
|
+
const slash = action.indexOf("/");
|
|
18935
|
+
const service = slash === -1 ? "" : action.slice(0, slash);
|
|
18936
|
+
if (SERVICE_LONG_TO_SHORT[service] === void 0) {
|
|
18937
|
+
throw new Error("Owner delegation capabilities are unsupported");
|
|
18938
|
+
}
|
|
18939
|
+
const actions = byService.get(service) ?? [];
|
|
18940
|
+
actions.push(action);
|
|
18941
|
+
byService.set(service, actions);
|
|
18942
|
+
}
|
|
18943
|
+
for (const [service, actions] of byService) {
|
|
18944
|
+
permissions.push({ service, path: params.path, actions });
|
|
18945
|
+
}
|
|
18946
|
+
}
|
|
18947
|
+
if (permissions.length === 0 || permissions.length > 16) {
|
|
18948
|
+
throw new Error("Owner delegation requires bounded capabilities");
|
|
18949
|
+
}
|
|
18950
|
+
const resources = /* @__PURE__ */ new Set();
|
|
18951
|
+
for (const permission of permissions) {
|
|
18952
|
+
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) {
|
|
18953
|
+
throw new Error("Owner delegation requires bounded capabilities");
|
|
18954
|
+
}
|
|
18955
|
+
const resourceKey = `${permission.service}\0${permission.path}`;
|
|
18956
|
+
if (resources.has(resourceKey)) {
|
|
18957
|
+
throw new Error("Owner delegation permissions contain duplicate resources");
|
|
18958
|
+
}
|
|
18959
|
+
resources.add(resourceKey);
|
|
18960
|
+
const actions = /* @__PURE__ */ new Set();
|
|
18961
|
+
for (const action of permission.actions) {
|
|
18962
|
+
if (typeof action !== "string" || !action.startsWith(`${permission.service}/`) || action.length === permission.service.length + 1 || actions.has(action)) {
|
|
18963
|
+
throw new Error("Owner delegation capabilities are unsupported");
|
|
18964
|
+
}
|
|
18965
|
+
actions.add(action);
|
|
18966
|
+
}
|
|
18967
|
+
if (permission.service === ENCRYPTION_PERMISSION_SERVICE2) {
|
|
18968
|
+
try {
|
|
18969
|
+
parseNetworkId2(permission.path);
|
|
18970
|
+
} catch {
|
|
18971
|
+
throw new Error("Owner delegation encryption permission requires a canonical network URN");
|
|
18972
|
+
}
|
|
18973
|
+
}
|
|
18974
|
+
}
|
|
18975
|
+
return permissions;
|
|
18976
|
+
}
|
|
18977
|
+
function ownerPermissionsToAbilities(permissions) {
|
|
18898
18978
|
const abilities = {};
|
|
18899
|
-
|
|
18900
|
-
|
|
18901
|
-
if (
|
|
18902
|
-
|
|
18903
|
-
|
|
18979
|
+
const rawAbilities = {};
|
|
18980
|
+
for (const permission of permissions) {
|
|
18981
|
+
if (permission.service === ENCRYPTION_PERMISSION_SERVICE2) {
|
|
18982
|
+
rawAbilities[permission.path] = [...permission.actions];
|
|
18983
|
+
continue;
|
|
18984
|
+
}
|
|
18985
|
+
const shortService = SERVICE_LONG_TO_SHORT[permission.service];
|
|
18904
18986
|
abilities[shortService] ?? (abilities[shortService] = {});
|
|
18905
|
-
|
|
18906
|
-
abilities[shortService][path].push(action);
|
|
18987
|
+
abilities[shortService][permission.path] = [...permission.actions];
|
|
18907
18988
|
}
|
|
18908
|
-
return
|
|
18989
|
+
return { abilities, rawAbilities };
|
|
18909
18990
|
}
|
|
18910
18991
|
function base64UrlEncode(bytes) {
|
|
18911
18992
|
const alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
|
|
@@ -19023,6 +19104,12 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
19023
19104
|
this._baseSecrets = /* @__PURE__ */ new Map();
|
|
19024
19105
|
this._secrets = /* @__PURE__ */ new Map();
|
|
19025
19106
|
this.runtimePermissionGrants = [];
|
|
19107
|
+
/**
|
|
19108
|
+
* Owned space ids this sign-in has already confirmed are hosted. Consulted by
|
|
19109
|
+
* {@link ensureOwnedSpaceHostedById}; cleared on every {@link signIn} because
|
|
19110
|
+
* hosting is confirmed against the session that was active at the time.
|
|
19111
|
+
*/
|
|
19112
|
+
this.confirmedHostedSpaceIds = /* @__PURE__ */ new Set();
|
|
19026
19113
|
/**
|
|
19027
19114
|
* True when the last signIn() detected an interactive signer and skipped
|
|
19028
19115
|
* client-side bootstrap. Apps can read this to know whether bootstrap was
|
|
@@ -19419,6 +19506,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
19419
19506
|
this._spaceService = void 0;
|
|
19420
19507
|
this._serviceContext = void 0;
|
|
19421
19508
|
this.runtimePermissionGrants = [];
|
|
19509
|
+
this.confirmedHostedSpaceIds.clear();
|
|
19422
19510
|
await this.tc.signIn(options);
|
|
19423
19511
|
this.syncResolvedHostFromAuth();
|
|
19424
19512
|
const oldGraph = this._serviceGraph;
|
|
@@ -19601,14 +19689,18 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
19601
19689
|
}
|
|
19602
19690
|
if (step.kind === "seed-applications") {
|
|
19603
19691
|
const registered = await this.account.applications.register(
|
|
19604
|
-
step.manifests.length > 0 ? [...step.manifests] : TINYCLOUD_SECRETS_BOOTSTRAP_MANIFEST
|
|
19692
|
+
step.manifests.length > 0 ? [...step.manifests] : TINYCLOUD_SECRETS_BOOTSTRAP_MANIFEST,
|
|
19693
|
+
// Bootstrap only runs on an account with no registry records, so the
|
|
19694
|
+
// manifest-hash pre-read is definitionally a miss. Skip it; the write
|
|
19695
|
+
// it guards is an INSERT OR REPLACE and is safe to repeat.
|
|
19696
|
+
{ assumeUnregistered: true }
|
|
19605
19697
|
);
|
|
19606
19698
|
if (!registered.ok) {
|
|
19607
19699
|
throw new Error(`Failed to seed bootstrap applications: ${registered.error.message}`);
|
|
19608
19700
|
}
|
|
19609
19701
|
}
|
|
19610
19702
|
if (step.kind === "encryption-network-create") {
|
|
19611
|
-
await this.ensureEncryptionNetwork(step.networkId);
|
|
19703
|
+
await this.ensureEncryptionNetwork(step.networkId, { assumeMissing: true });
|
|
19612
19704
|
}
|
|
19613
19705
|
if (step.kind === "secret-records-schema") {
|
|
19614
19706
|
const db = this.sqlForSpace(step.spaceId).db(step.database);
|
|
@@ -19887,6 +19979,22 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
19887
19979
|
await this.ensureEncryptionNetwork(networkId);
|
|
19888
19980
|
}
|
|
19889
19981
|
}
|
|
19982
|
+
/**
|
|
19983
|
+
* Ensure one of this user's owned spaces is hosted, at most once per space
|
|
19984
|
+
* per sign-in.
|
|
19985
|
+
*
|
|
19986
|
+
* Account bootstrap funnels six calls through here (via
|
|
19987
|
+
* `AccountService.ensureAccountSpaceHosted`), and each one re-submits
|
|
19988
|
+
* `activateSessionWithHost` with the *primary* session. That session's recap
|
|
19989
|
+
* covers only `default` and `secrets`, so the account space appears in
|
|
19990
|
+
* neither `activated` nor `skipped` and the guard below returns immediately
|
|
19991
|
+
* — the repeat calls cannot change the outcome, they only cost round trips.
|
|
19992
|
+
*
|
|
19993
|
+
* The memo is per sign-in ({@link confirmedHostedSpaceIds} is cleared in
|
|
19994
|
+
* `signIn`) and only records confirmed successes. A wrong skip is
|
|
19995
|
+
* self-revealing: the next write to the space fails immediately and loudly
|
|
19996
|
+
* with `404 Space not found`.
|
|
19997
|
+
*/
|
|
19890
19998
|
async ensureOwnedSpaceHostedById(spaceId) {
|
|
19891
19999
|
if (!this.auth) {
|
|
19892
20000
|
throw new Error("Owned space hosting requires wallet mode");
|
|
@@ -19895,12 +20003,16 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
19895
20003
|
if (!session) {
|
|
19896
20004
|
throw new Error("Owned space hosting requires an active session");
|
|
19897
20005
|
}
|
|
20006
|
+
if (this.confirmedHostedSpaceIds.has(spaceId)) {
|
|
20007
|
+
return;
|
|
20008
|
+
}
|
|
19898
20009
|
const host = this.hosts[0] ?? this.config.host;
|
|
19899
20010
|
if (!host) {
|
|
19900
20011
|
throw new Error("Owned space hosting requires a TinyCloud host");
|
|
19901
20012
|
}
|
|
19902
20013
|
const activation = await activateSessionWithHost2(host, session.delegationHeader);
|
|
19903
20014
|
if (activation.success && !activation.skipped?.includes(spaceId)) {
|
|
20015
|
+
this.confirmedHostedSpaceIds.add(spaceId);
|
|
19904
20016
|
return;
|
|
19905
20017
|
}
|
|
19906
20018
|
if (!activation.success && activation.status !== 404) {
|
|
@@ -19919,6 +20031,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
19919
20031
|
`Failed to activate session after creating owned space ${spaceId}: ${retry.error ?? "space was skipped"}`
|
|
19920
20032
|
);
|
|
19921
20033
|
}
|
|
20034
|
+
this.confirmedHostedSpaceIds.add(spaceId);
|
|
19922
20035
|
}
|
|
19923
20036
|
/**
|
|
19924
20037
|
* Host one of this user's owned spaces by name (e.g. `"applications"`).
|
|
@@ -20241,6 +20354,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
20241
20354
|
this.tc = stagedGraph.core;
|
|
20242
20355
|
this._recapOperationsCache = stagedPrimary.cache;
|
|
20243
20356
|
this.runtimePermissionGrants = stagedPrimary.grants;
|
|
20357
|
+
this.confirmedHostedSpaceIds.clear();
|
|
20244
20358
|
if (this.auth) {
|
|
20245
20359
|
this.auth.installRestoredSession(stagedManager, stagedTcSession, [stagedHost]);
|
|
20246
20360
|
this._restoredTcSession = void 0;
|
|
@@ -20823,7 +20937,17 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
20823
20937
|
verifyNodeSignature: (nodeId, message, signature2) => verifyDidKeyEd25519Signature(nodeId, message, signature2)
|
|
20824
20938
|
};
|
|
20825
20939
|
}
|
|
20940
|
+
/**
|
|
20941
|
+
* The node DID for {@link config.host}.
|
|
20942
|
+
*
|
|
20943
|
+
* Sign-in already performs `GET /info` for the protocol-version check, and
|
|
20944
|
+
* that response carries `nodeId`, so reuse it rather than fetching `/info` a
|
|
20945
|
+
* second time. Only a value recorded for this exact host qualifies; older
|
|
20946
|
+
* nodes that omit `nodeId` fall through to the fetch.
|
|
20947
|
+
*/
|
|
20826
20948
|
async fetchNodeId() {
|
|
20949
|
+
const cached = this.auth?.nodeIdForHost(this.config.host);
|
|
20950
|
+
if (cached) return cached;
|
|
20827
20951
|
const response = await fetch(`${this.config.host}/info`);
|
|
20828
20952
|
if (!response.ok) {
|
|
20829
20953
|
throw new Error(`Failed to fetch node info: HTTP ${response.status}`);
|
|
@@ -21279,21 +21403,29 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
21279
21403
|
async createOwnerDelegation(params, assertActive) {
|
|
21280
21404
|
const assertOwnerGraphActive = assertActive ?? this._serviceGraph.assertActive.bind(this._serviceGraph);
|
|
21281
21405
|
assertOwnerGraphActive();
|
|
21282
|
-
if (!params.delegateDid.startsWith("did:key:")
|
|
21406
|
+
if (!params.delegateDid.startsWith("did:key:")) {
|
|
21283
21407
|
throw new Error("Owner delegation requires an external did:key audience and bounded capabilities");
|
|
21284
21408
|
}
|
|
21409
|
+
const permissions = ownerDelegationPermissions(params);
|
|
21285
21410
|
const now = /* @__PURE__ */ new Date();
|
|
21286
|
-
if (params.expiresAt.getTime() <= now.getTime() || params.expiresAt.getTime() - now.getTime() > EXPIRY3.MAX_MS) {
|
|
21411
|
+
if (!(params.expiresAt instanceof Date) || params.expiresAt.getTime() <= now.getTime() || params.expiresAt.getTime() - now.getTime() > EXPIRY3.MAX_MS) {
|
|
21287
21412
|
throw new Error("Owner delegation expiry must be explicit, future, and within EXPIRY.MAX_MS");
|
|
21288
21413
|
}
|
|
21289
21414
|
if (!this.signer) throw new Error("Owner wallet signer is required");
|
|
21290
21415
|
const session = this.currentTinyCloudSession();
|
|
21291
21416
|
if (!session) throw new Error("Owner session is required");
|
|
21292
|
-
const
|
|
21293
|
-
|
|
21417
|
+
const ownerDid = pkhDid2(session.address, session.chainId);
|
|
21418
|
+
for (const permission of permissions) {
|
|
21419
|
+
if (permission.service === ENCRYPTION_PERMISSION_SERVICE2 && !principalDidEquals2(parseNetworkId2(permission.path).ownerDid, ownerDid)) {
|
|
21420
|
+
throw new Error("Owner delegation cannot grant a foreign encryption network");
|
|
21421
|
+
}
|
|
21422
|
+
}
|
|
21423
|
+
const { abilities, rawAbilities } = ownerPermissionsToAbilities(permissions);
|
|
21424
|
+
const primary = permissions[0];
|
|
21294
21425
|
const host = this.config.host;
|
|
21295
21426
|
const prepared = this.wasmBindings.prepareSession({
|
|
21296
21427
|
abilities,
|
|
21428
|
+
...Object.keys(rawAbilities).length === 0 ? {} : { rawAbilities },
|
|
21297
21429
|
address: this.wasmBindings.ensureEip55(session.address),
|
|
21298
21430
|
chainId: session.chainId,
|
|
21299
21431
|
domain: this.siweDomain,
|
|
@@ -21313,10 +21445,10 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
21313
21445
|
const delegation = {
|
|
21314
21446
|
cid: delegationSession.delegationCid,
|
|
21315
21447
|
delegateDID: params.delegateDid,
|
|
21316
|
-
delegatorDID:
|
|
21448
|
+
delegatorDID: ownerDid,
|
|
21317
21449
|
spaceId: params.spaceId,
|
|
21318
|
-
path:
|
|
21319
|
-
actions: [...
|
|
21450
|
+
path: primary.path,
|
|
21451
|
+
actions: [...primary.actions],
|
|
21320
21452
|
expiry: params.expiresAt,
|
|
21321
21453
|
isRevoked: false,
|
|
21322
21454
|
allowSubDelegation: true,
|
|
@@ -21327,6 +21459,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
21327
21459
|
delegation,
|
|
21328
21460
|
signedDagCbor: decodeAuthorizationBytes(delegationSession.delegationHeader.Authorization),
|
|
21329
21461
|
delegationCid: delegationSession.delegationCid,
|
|
21462
|
+
permissions,
|
|
21330
21463
|
nodeReceipt: {
|
|
21331
21464
|
commitEventCid: activation.commitEventCid,
|
|
21332
21465
|
activated: activation.activated ?? [],
|
|
@@ -21586,6 +21719,13 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
21586
21719
|
body
|
|
21587
21720
|
)
|
|
21588
21721
|
});
|
|
21722
|
+
if (response.status === 409) {
|
|
21723
|
+
const existing = await this.getEncryptionNetwork(networkId);
|
|
21724
|
+
if (existing) return existing;
|
|
21725
|
+
throw new Error(
|
|
21726
|
+
`Encryption network ${networkId} already exists but could not be read back`
|
|
21727
|
+
);
|
|
21728
|
+
}
|
|
21589
21729
|
if (!response.ok) {
|
|
21590
21730
|
throw new Error(
|
|
21591
21731
|
`Failed to create encryption network ${networkId}: HTTP ${response.status} ${await response.text()}`
|
|
@@ -21594,11 +21734,19 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
21594
21734
|
const created = await response.json();
|
|
21595
21735
|
return created.descriptor;
|
|
21596
21736
|
}
|
|
21597
|
-
|
|
21737
|
+
/**
|
|
21738
|
+
* Ensure an encryption network exists, creating it if necessary.
|
|
21739
|
+
*
|
|
21740
|
+
* @param nameOrNetworkId - Network name or full `urn:tinycloud:encryption:` id.
|
|
21741
|
+
* @param options - See {@link EnsureEncryptionNetworkOptions}.
|
|
21742
|
+
*/
|
|
21743
|
+
async ensureEncryptionNetwork(nameOrNetworkId = DEFAULT_ENCRYPTION_NETWORK_NAME, options = {}) {
|
|
21598
21744
|
const networkId = nameOrNetworkId.startsWith("urn:tinycloud:encryption:") ? nameOrNetworkId : this.getDefaultEncryptionNetworkId(nameOrNetworkId);
|
|
21599
|
-
|
|
21600
|
-
|
|
21601
|
-
|
|
21745
|
+
if (!options.assumeMissing) {
|
|
21746
|
+
const existing = await this.getEncryptionNetwork(networkId);
|
|
21747
|
+
if (existing) {
|
|
21748
|
+
return existing;
|
|
21749
|
+
}
|
|
21602
21750
|
}
|
|
21603
21751
|
const parsed = parseNetworkId2(networkId);
|
|
21604
21752
|
if (!didPrincipalMatches2(parsed.ownerDid, this.did)) {
|