@tinycloud/node-sdk 2.11.0 → 3.0.0-beta.0
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-Bq8TMY7Y.d.cts → core-C6Czyr52.d.cts} +47 -2
- package/dist/{core-Bq8TMY7Y.d.ts → core-C6Czyr52.d.ts} +47 -2
- package/dist/core.cjs +446 -31
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.cts +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.js +448 -32
- package/dist/core.js.map +1 -1
- package/dist/index.cjs +152 -33
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +154 -34
- 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, CapabilityPresentationEnvelopeV1, IWasmBindings, PersistedSessionProof, ISessionManager } from '@tinycloud/sdk-core';
|
|
2
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, RegisterBatchSuccess, 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 ACCEPTED_MARKER_VERSIONS, a as AuthDelegationArtifact, b as AuthRequestArtifact, B as BOOTSTRAP_COMPLETION_MARKER_KEY, c as BOOTSTRAP_COMPLETION_MARKER_VERSION, d as BootstrapCompletionMarker, e as BootstrapWarning, C as CreateOwnerDelegationParams, D as DelegateToOptions,
|
|
3
|
+
export { A as ACCEPTED_MARKER_VERSIONS, a as AuthDelegationArtifact, b as AuthRequestArtifact, B as BOOTSTRAP_COMPLETION_MARKER_KEY, c as BOOTSTRAP_COMPLETION_MARKER_VERSION, d as BootstrapCompletionMarker, e as BootstrapWarning, C as CompactRuntimeDelegationInput, f as CreateOwnerDelegationParams, D as DelegateToOptions, g as DelegateToResult, h as DelegatedAccess, i as DelegationAuthority, E as EnsureEncryptionNetworkOptions, F as FileSessionStorage, M as MemorySessionStorage, N as NodeEventEmitterStrategy, j as NodeUserAuthorization, k as NodeUserAuthorizationConfig, O as OwnerDelegationReceipt, P as PortableDelegation, R as RestorableSession, l as RuntimeDelegationActivator, m as RuntimePermissionGrantOptions, S as SecretPermissionHint, n as SecretReadInput, o as SecretReadResult, p as SignStrategy, T as TinyCloudNode, q as TinyCloudNodeConfig, U as UnifiedOwnerRootInput, r as UnifiedOwnerRootReceipt, s as UnsupportedSessionRestoreError, V as ValidatedRuntimeDelegation, W as WasmKeyProvider, t as WasmKeyProviderConfig, u as activateCompactRuntimeDelegation, v as activateValidatedRuntimeDelegation, w as createWasmKeyProvider, x as defaultSignStrategy, y as deserializeDelegation, z as grantAuthRequest, G as serializeDelegation } from './core-C6Czyr52.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, CapabilityPresentationEnvelopeV1, IWasmBindings, PersistedSessionProof, ISessionManager } from '@tinycloud/sdk-core';
|
|
2
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, RegisterBatchSuccess, 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 ACCEPTED_MARKER_VERSIONS, a as AuthDelegationArtifact, b as AuthRequestArtifact, B as BOOTSTRAP_COMPLETION_MARKER_KEY, c as BOOTSTRAP_COMPLETION_MARKER_VERSION, d as BootstrapCompletionMarker, e as BootstrapWarning, C as CreateOwnerDelegationParams, D as DelegateToOptions,
|
|
3
|
+
export { A as ACCEPTED_MARKER_VERSIONS, a as AuthDelegationArtifact, b as AuthRequestArtifact, B as BOOTSTRAP_COMPLETION_MARKER_KEY, c as BOOTSTRAP_COMPLETION_MARKER_VERSION, d as BootstrapCompletionMarker, e as BootstrapWarning, C as CompactRuntimeDelegationInput, f as CreateOwnerDelegationParams, D as DelegateToOptions, g as DelegateToResult, h as DelegatedAccess, i as DelegationAuthority, E as EnsureEncryptionNetworkOptions, F as FileSessionStorage, M as MemorySessionStorage, N as NodeEventEmitterStrategy, j as NodeUserAuthorization, k as NodeUserAuthorizationConfig, O as OwnerDelegationReceipt, P as PortableDelegation, R as RestorableSession, l as RuntimeDelegationActivator, m as RuntimePermissionGrantOptions, S as SecretPermissionHint, n as SecretReadInput, o as SecretReadResult, p as SignStrategy, T as TinyCloudNode, q as TinyCloudNodeConfig, U as UnifiedOwnerRootInput, r as UnifiedOwnerRootReceipt, s as UnsupportedSessionRestoreError, V as ValidatedRuntimeDelegation, W as WasmKeyProvider, t as WasmKeyProviderConfig, u as activateCompactRuntimeDelegation, v as activateValidatedRuntimeDelegation, w as createWasmKeyProvider, x as defaultSignStrategy, y as deserializeDelegation, z as grantAuthRequest, G as serializeDelegation } from './core-C6Czyr52.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
|
@@ -17214,7 +17214,8 @@ import {
|
|
|
17214
17214
|
resolveSecretPath as resolveSecretPath2,
|
|
17215
17215
|
validateOwnerSharePolicyRegistrationBytes,
|
|
17216
17216
|
validateShareDeliveryAuthorizationBytes,
|
|
17217
|
-
verifyEip191MessageSignature
|
|
17217
|
+
verifyEip191MessageSignature,
|
|
17218
|
+
signCompactUcanRootAuthorization
|
|
17218
17219
|
} from "@tinycloud/sdk-core";
|
|
17219
17220
|
import {
|
|
17220
17221
|
parsePermissionHint
|
|
@@ -19192,6 +19193,18 @@ var ROOT_DELEGATION_ACTIONS = [
|
|
|
19192
19193
|
DUCKDB2.ALL
|
|
19193
19194
|
];
|
|
19194
19195
|
var DEFAULT_SESSION_EXPIRATION_MS = EXPIRY3.SESSION_MS;
|
|
19196
|
+
function unifiedRootAttenuation(capabilities) {
|
|
19197
|
+
const attenuation = {};
|
|
19198
|
+
for (const capability of capabilities) {
|
|
19199
|
+
if (attenuation[capability.resource] !== void 0) throw new Error("unified owner root contains a duplicate resource");
|
|
19200
|
+
attenuation[capability.resource] = capability.kind === "encryption" ? { [capability.action]: [{}] } : Object.fromEntries(capability.actions.map((action) => [action, [{
|
|
19201
|
+
type: "xyz.tinycloud.resource/selector",
|
|
19202
|
+
kind: capability.selector,
|
|
19203
|
+
value: capability.resource
|
|
19204
|
+
}]]));
|
|
19205
|
+
}
|
|
19206
|
+
return attenuation;
|
|
19207
|
+
}
|
|
19195
19208
|
function decodeAuthorizationBytes(authorization) {
|
|
19196
19209
|
const encoded = authorization.replace(/^Bearer /i, "");
|
|
19197
19210
|
const match = /^([A-Za-z0-9_-]+)(={1,2})?$/.exec(encoded);
|
|
@@ -19571,6 +19584,8 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
19571
19584
|
* hosting is confirmed against the session that was active at the time.
|
|
19572
19585
|
*/
|
|
19573
19586
|
this.confirmedHostedSpaceIds = /* @__PURE__ */ new Set();
|
|
19587
|
+
/** Serializes account-registry writes for the active node instance. */
|
|
19588
|
+
this.accountRegistryTail = Promise.resolve();
|
|
19574
19589
|
/**
|
|
19575
19590
|
* True when the last signIn() detected an interactive signer and skipped
|
|
19576
19591
|
* client-side bootstrap. Apps can read this to know whether bootstrap was
|
|
@@ -19967,6 +19982,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
19967
19982
|
"Cannot signIn() in session-only mode. Provide a privateKey in config to create your own space."
|
|
19968
19983
|
);
|
|
19969
19984
|
}
|
|
19985
|
+
await this.accountRegistryTail;
|
|
19970
19986
|
await this.wasmBindings.ensureInitialized?.();
|
|
19971
19987
|
this._address = canonicalizeAddress2(await this.signer.getAddress());
|
|
19972
19988
|
this._chainId = await this.signer.getChainId();
|
|
@@ -20448,16 +20464,48 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
20448
20464
|
}
|
|
20449
20465
|
}
|
|
20450
20466
|
scheduleAccountRegistrySync() {
|
|
20451
|
-
|
|
20452
|
-
|
|
20453
|
-
|
|
20454
|
-
|
|
20455
|
-
|
|
20456
|
-
|
|
20457
|
-
|
|
20467
|
+
const session = this.currentTinyCloudSession();
|
|
20468
|
+
if (!session || this.pendingAccountRegistrySync?.session === session) {
|
|
20469
|
+
return;
|
|
20470
|
+
}
|
|
20471
|
+
const promise = this.enqueueAccountRegistryOperation(session, async () => {
|
|
20472
|
+
await this.withAccountRegistryRetry(async () => {
|
|
20473
|
+
if (this.currentTinyCloudSession() !== session) {
|
|
20474
|
+
return;
|
|
20475
|
+
}
|
|
20476
|
+
await this.account.index.ensure();
|
|
20477
|
+
if (this.currentTinyCloudSession() !== session) {
|
|
20478
|
+
return;
|
|
20479
|
+
}
|
|
20480
|
+
await this.writeManifestRegistryRecords();
|
|
20481
|
+
if (this.currentTinyCloudSession() !== session) {
|
|
20482
|
+
return;
|
|
20458
20483
|
}
|
|
20484
|
+
if (this.currentSessionCanListSpaces()) {
|
|
20485
|
+
const spaces = await this.account.spaces.syncAccessible();
|
|
20486
|
+
if (!spaces.ok) {
|
|
20487
|
+
throw new Error(`Failed to sync account spaces: ${spaces.error.message}`);
|
|
20488
|
+
}
|
|
20489
|
+
}
|
|
20490
|
+
});
|
|
20491
|
+
});
|
|
20492
|
+
this.pendingAccountRegistrySync = { session, promise };
|
|
20493
|
+
const clearPendingSync = () => {
|
|
20494
|
+
if (this.pendingAccountRegistrySync?.promise === promise) {
|
|
20495
|
+
this.pendingAccountRegistrySync = void 0;
|
|
20496
|
+
}
|
|
20497
|
+
};
|
|
20498
|
+
void promise.then(clearPendingSync, clearPendingSync);
|
|
20499
|
+
}
|
|
20500
|
+
enqueueAccountRegistryOperation(session, task) {
|
|
20501
|
+
const operation = this.accountRegistryTail.then(async () => {
|
|
20502
|
+
if (this.currentTinyCloudSession() === session) {
|
|
20503
|
+
await task();
|
|
20459
20504
|
}
|
|
20460
20505
|
});
|
|
20506
|
+
this.accountRegistryTail = operation.catch(() => {
|
|
20507
|
+
});
|
|
20508
|
+
return operation;
|
|
20461
20509
|
}
|
|
20462
20510
|
/**
|
|
20463
20511
|
* Whether the current primary session may invoke `tinycloud.space/list`.
|
|
@@ -20610,7 +20658,8 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
20610
20658
|
* @returns The hosted space URI.
|
|
20611
20659
|
*/
|
|
20612
20660
|
async hostOwnedSpace(name) {
|
|
20613
|
-
|
|
20661
|
+
const session = this.auth?.tinyCloudSession;
|
|
20662
|
+
if (!this.auth || !session) {
|
|
20614
20663
|
throw new Error("Not signed in. Call signIn() first.");
|
|
20615
20664
|
}
|
|
20616
20665
|
const spaceId = this.ownedSpaceId(name);
|
|
@@ -20626,22 +20675,26 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
20626
20675
|
}
|
|
20627
20676
|
const activation = await activateSessionWithHost2(
|
|
20628
20677
|
host,
|
|
20629
|
-
|
|
20678
|
+
session.delegationHeader
|
|
20630
20679
|
);
|
|
20631
20680
|
if (!activation.success || activation.skipped?.includes(spaceId)) {
|
|
20632
20681
|
throw new Error(
|
|
20633
20682
|
`Failed to activate session for owned space ${spaceId}: ${activation.error ?? "space was skipped"}`
|
|
20634
20683
|
);
|
|
20635
20684
|
}
|
|
20636
|
-
|
|
20637
|
-
|
|
20638
|
-
|
|
20639
|
-
|
|
20640
|
-
|
|
20641
|
-
|
|
20642
|
-
|
|
20643
|
-
|
|
20644
|
-
|
|
20685
|
+
try {
|
|
20686
|
+
await this.enqueueAccountRegistryOperation(session, async () => {
|
|
20687
|
+
await this.account.spaces.register({
|
|
20688
|
+
spaceId,
|
|
20689
|
+
name,
|
|
20690
|
+
ownerDid: this.did,
|
|
20691
|
+
type: "owned",
|
|
20692
|
+
permissions: ["*"],
|
|
20693
|
+
status: "active"
|
|
20694
|
+
});
|
|
20695
|
+
});
|
|
20696
|
+
} catch {
|
|
20697
|
+
}
|
|
20645
20698
|
return spaceId;
|
|
20646
20699
|
}
|
|
20647
20700
|
/**
|
|
@@ -20676,23 +20729,12 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
20676
20729
|
if (!this.auth || !this.auth.tinyCloudSession) {
|
|
20677
20730
|
throw new Error("Not signed in. Call signIn() first.");
|
|
20678
20731
|
}
|
|
20732
|
+
await this.accountRegistryTail;
|
|
20679
20733
|
const spaceId = this.ownedSpaceId(name);
|
|
20680
20734
|
if (await this.isOwnedSpaceRegistered(spaceId)) {
|
|
20681
20735
|
return spaceId;
|
|
20682
20736
|
}
|
|
20683
|
-
|
|
20684
|
-
try {
|
|
20685
|
-
await this.account.spaces.register({
|
|
20686
|
-
spaceId,
|
|
20687
|
-
name,
|
|
20688
|
-
ownerDid: this.did,
|
|
20689
|
-
type: "owned",
|
|
20690
|
-
permissions: ["*"],
|
|
20691
|
-
status: "active"
|
|
20692
|
-
});
|
|
20693
|
-
} catch {
|
|
20694
|
-
}
|
|
20695
|
-
return hosted;
|
|
20737
|
+
return this.hostOwnedSpace(name);
|
|
20696
20738
|
}
|
|
20697
20739
|
/** Resolve and authenticate the owner encoded by an owned-space URI. */
|
|
20698
20740
|
credentialSpaceOwnerDid(spaceId) {
|
|
@@ -21245,6 +21287,46 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
21245
21287
|
if (session === void 0) throw new Error("Not signed in. Call signIn() first.");
|
|
21246
21288
|
return signBytesWithJwk(bytes, session.jwk);
|
|
21247
21289
|
}
|
|
21290
|
+
/** Author a proofless Policy/v3 owner root with the authenticated holder key. */
|
|
21291
|
+
async createUnifiedOwnerRoot(input) {
|
|
21292
|
+
const ownerDid = this.credentialHolderDid;
|
|
21293
|
+
if (input.ownerDid !== ownerDid) throw new Error("unified owner root signer does not match owner DID");
|
|
21294
|
+
const facts = {
|
|
21295
|
+
role: input.role,
|
|
21296
|
+
mode: input.role === "policy-authority" ? "policy-source" : "conditional-mint",
|
|
21297
|
+
ownerDid,
|
|
21298
|
+
policyId: input.policyId,
|
|
21299
|
+
policyDigestHex: input.policyDigestHex,
|
|
21300
|
+
policyCid: input.policyCid,
|
|
21301
|
+
contentSourceDigestHex: input.contentSourceDigestHex,
|
|
21302
|
+
capabilityCeilingHashHex: input.capabilityCeilingHashHex,
|
|
21303
|
+
nativeProjectionHashHex: input.nativeProjectionHashHex,
|
|
21304
|
+
nodeAudience: input.nodeAudience,
|
|
21305
|
+
...input.role === "policy-enforcement" ? { enforcerDid: input.audienceDid } : {}
|
|
21306
|
+
};
|
|
21307
|
+
const root = await signCompactUcanRootAuthorization({
|
|
21308
|
+
issuerDid: ownerDid,
|
|
21309
|
+
audienceDid: input.audienceDid,
|
|
21310
|
+
attenuation: unifiedRootAttenuation(input.capabilities),
|
|
21311
|
+
facts: [facts],
|
|
21312
|
+
notBefore: Math.floor(input.notBefore.getTime() / 1e3),
|
|
21313
|
+
expiresAt: Math.floor(input.expiresAt.getTime() / 1e3),
|
|
21314
|
+
nonce: base64UrlEncode(crypto.getRandomValues(new Uint8Array(16))),
|
|
21315
|
+
sign: (bytes) => this.signSessionBytes(bytes)
|
|
21316
|
+
});
|
|
21317
|
+
const kv = input.capabilities.find((capability) => capability.kind === "kv");
|
|
21318
|
+
const resource = kv?.resource ?? "";
|
|
21319
|
+
const marker = resource.indexOf("/kv/");
|
|
21320
|
+
return {
|
|
21321
|
+
cid: root.cid,
|
|
21322
|
+
delegationHeader: { Authorization: root.authorization },
|
|
21323
|
+
delegateDID: input.audienceDid,
|
|
21324
|
+
spaceId: marker === -1 ? "" : resource.slice("tinycloud://".length, marker),
|
|
21325
|
+
path: marker === -1 ? resource : resource.slice(marker + 4),
|
|
21326
|
+
actions: kv?.actions ?? [],
|
|
21327
|
+
expiry: input.expiresAt
|
|
21328
|
+
};
|
|
21329
|
+
}
|
|
21248
21330
|
/** Apply only an already-enabled signing policy to the exact credential request. */
|
|
21249
21331
|
async autoSignCredentialBytes(bytes) {
|
|
21250
21332
|
const strategy = this.config.signStrategy;
|
|
@@ -24498,6 +24580,7 @@ import {
|
|
|
24498
24580
|
// src/delegation.ts
|
|
24499
24581
|
import {
|
|
24500
24582
|
canonicalizeRecapCaveats as canonicalizeRecapCaveats2,
|
|
24583
|
+
decodeBase64Url,
|
|
24501
24584
|
principalDidEquals as principalDidEquals3
|
|
24502
24585
|
} from "@tinycloud/sdk-core";
|
|
24503
24586
|
var SERVICE_BY_SHORT_NAME = {
|
|
@@ -24532,7 +24615,7 @@ function compactUcanPayload(authorization) {
|
|
|
24532
24615
|
}
|
|
24533
24616
|
try {
|
|
24534
24617
|
const payload = JSON.parse(
|
|
24535
|
-
|
|
24618
|
+
new TextDecoder("utf-8", { fatal: true }).decode(decodeBase64Url(parts[1]))
|
|
24536
24619
|
);
|
|
24537
24620
|
if (payload === null || typeof payload !== "object" || Array.isArray(payload)) {
|
|
24538
24621
|
throw new Error("payload is not an object");
|
|
@@ -24624,7 +24707,9 @@ function signedAuthorityFromCompactUcan(authorization) {
|
|
|
24624
24707
|
));
|
|
24625
24708
|
continue;
|
|
24626
24709
|
}
|
|
24627
|
-
const
|
|
24710
|
+
const nativeMatch = /^(tinycloud:[^/]+)\/(kv|sql|duckdb|hooks)\/(.*)$/.exec(resource);
|
|
24711
|
+
const policyMatch = /^tinycloud:\/\/([^/]+)\/(kv|sql|duckdb|hooks)\/(.*)$/.exec(resource);
|
|
24712
|
+
const match = nativeMatch ?? policyMatch;
|
|
24628
24713
|
if (!match) {
|
|
24629
24714
|
throw new Error(
|
|
24630
24715
|
`Validated runtime delegation has an unsupported signed resource '${resource}'.`
|
|
@@ -24796,6 +24881,40 @@ async function activateValidatedRuntimeDelegation(node, delegation, options) {
|
|
|
24796
24881
|
host: normalizedHost(installed.host ?? host)
|
|
24797
24882
|
};
|
|
24798
24883
|
}
|
|
24884
|
+
async function activateCompactRuntimeDelegation(node, input) {
|
|
24885
|
+
const authorization = input.authorization;
|
|
24886
|
+
const cid = node.computeDelegationCid(authorization);
|
|
24887
|
+
if (cid !== input.cid) {
|
|
24888
|
+
throw new Error("Compact runtime delegation CID does not match authorization bytes.");
|
|
24889
|
+
}
|
|
24890
|
+
const signed2 = signedAuthorityFromCompactUcan(authorization);
|
|
24891
|
+
const primary = signed2.resources[0];
|
|
24892
|
+
const signedSpace = signed2.permissions.find(
|
|
24893
|
+
(permission) => permission.service !== "tinycloud.encryption"
|
|
24894
|
+
)?.space;
|
|
24895
|
+
const delegation = {
|
|
24896
|
+
cid,
|
|
24897
|
+
delegationHeader: { Authorization: authorization },
|
|
24898
|
+
ownerAddress: input.ownerAddress,
|
|
24899
|
+
chainId: input.chainId,
|
|
24900
|
+
delegatorDID: signed2.issuer,
|
|
24901
|
+
authHeader: authorization,
|
|
24902
|
+
spaceId: signedSpace ?? primary.space,
|
|
24903
|
+
path: primary.path,
|
|
24904
|
+
actions: [...primary.actions],
|
|
24905
|
+
...primary.caveats === void 0 ? {} : { caveats: primary.caveats },
|
|
24906
|
+
resources: signed2.resources.map((resource) => ({
|
|
24907
|
+
...resource,
|
|
24908
|
+
actions: [...resource.actions]
|
|
24909
|
+
})),
|
|
24910
|
+
expiry: new Date(signed2.expiry),
|
|
24911
|
+
delegateDID: signed2.audience,
|
|
24912
|
+
host: normalizedHost(input.host)
|
|
24913
|
+
};
|
|
24914
|
+
return activateValidatedRuntimeDelegation(node, delegation, {
|
|
24915
|
+
host: input.host
|
|
24916
|
+
});
|
|
24917
|
+
}
|
|
24799
24918
|
async function grantAuthRequest(authority, request, options) {
|
|
24800
24919
|
if (request.kind !== "tinycloud.auth.request") {
|
|
24801
24920
|
throw new Error(
|
|
@@ -24999,6 +25118,7 @@ export {
|
|
|
24999
25118
|
VaultPublicSpaceKVActions,
|
|
25000
25119
|
VersionCheckError,
|
|
25001
25120
|
WasmKeyProvider,
|
|
25121
|
+
activateCompactRuntimeDelegation,
|
|
25002
25122
|
activateValidatedRuntimeDelegation,
|
|
25003
25123
|
addressStorageKey,
|
|
25004
25124
|
buildCanonicalDecryptRequest,
|