@tinycloud/node-sdk 3.2.6-beta.5 → 3.3.0-beta.7
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/{WasmKeyProvider-DEdSyQ0I.d.cts → TinyCloudNode-BchWB_zv.d.cts} +162 -283
- package/dist/{WasmKeyProvider-DEdSyQ0I.d.ts → TinyCloudNode-BchWB_zv.d.ts} +162 -283
- package/dist/WasmKeyProvider-5Ee7fcAw.d.cts +217 -0
- package/dist/WasmKeyProvider-5Ee7fcAw.d.ts +217 -0
- package/dist/authority-4HXYteKF.d.ts +118 -0
- package/dist/authority-lrA-698X.d.cts +118 -0
- package/dist/core.cjs +368 -147
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.cts +37 -4
- package/dist/core.d.ts +37 -4
- package/dist/core.js +374 -155
- package/dist/core.js.map +1 -1
- package/dist/gated-network-BEF2XSTC.d.cts +16 -0
- package/dist/gated-network-BEF2XSTC.d.ts +16 -0
- package/dist/index.cjs +2702 -524
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +35 -89
- package/dist/index.d.ts +35 -89
- package/dist/index.js +2702 -530
- package/dist/index.js.map +1 -1
- package/dist/replication/authority.cjs +153 -15
- package/dist/replication/authority.cjs.map +1 -1
- package/dist/replication/authority.d.cts +4 -1
- package/dist/replication/authority.d.ts +4 -1
- package/dist/replication/authority.js +147 -14
- package/dist/replication/authority.js.map +1 -1
- package/dist/replication/gated-network.cjs +90 -0
- package/dist/replication/gated-network.cjs.map +1 -0
- package/dist/replication/gated-network.d.cts +2 -0
- package/dist/replication/gated-network.d.ts +2 -0
- package/dist/replication/gated-network.js +65 -0
- package/dist/replication/gated-network.js.map +1 -0
- package/dist/replication/runtime.cjs +84 -6
- package/dist/replication/runtime.cjs.map +1 -1
- package/dist/replication/runtime.d.cts +2 -1
- package/dist/replication/runtime.d.ts +2 -1
- package/dist/replication/runtime.js +84 -6
- package/dist/replication/runtime.js.map +1 -1
- package/dist/{runtime-B5P5SRpC.d.ts → runtime-D1o9Eybt.d.cts} +14 -3
- package/dist/{runtime-B5P5SRpC.d.cts → runtime-v62FzQHz.d.ts} +14 -3
- package/package.json +14 -4
- package/dist/authority-DDGtccBK.d.cts +0 -96
- package/dist/authority-DDGtccBK.d.ts +0 -96
package/dist/index.d.cts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import { ISigner, Bytes,
|
|
1
|
+
import { ISigner, Bytes, 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, AuthorityRefusal, 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, IStorageService, IUserAuthorization, IWasmBindings, IdentityParseError, IngestOptions, InlineEncryptedEnvelope, InvokeFunction, JWK, KVBatchReadResponse, KVCreateSignedReadUrlOptions, KVListPage, KVReadThrough, KVReplicaHandle, KVReplicaSpec, KVReplicaStorage, KVReplicationController, KVReplicationDeps, KVResponse, KVService, KVServiceConfig, KVSignedReadUrlResponse, KeyInfo, KeyProvider, KeyType, LocalGetResult, LocalListResult, LocalReadMeta, LocalReplicaStatus, LocalSyncResult, MAX_SECRET_SCOPE_LENGTH, Manifest, ManifestDefaults, ManifestRegistryRecord, ManifestSecretActions, ManifestValidationError, NETWORK_NAME_PATTERN, NetworkDescriptor, NetworkIdError, NodeDescriptorFetcher, OpenKeyCallbackStrategy, OpenKeySigningRequestBody, OpenKeySigningResponseBody, OpenKeySigningStrategyOptions, OwnerDelegationPermission, ParsedNetworkId, ParsedSecretCatalogKey, PendingWriteRecord, PendingWriteState, PendingWriteStore, PermissionEntry, PermissionNotInManifestError, PersistedSessionData, PinnedKey, PkhDidParts, PrefixedKVService, ProtocolMismatchError, PurgeTarget, QueryOptions, QueryResponse, RandomReceiverKeyInput, ReceiveOptions, ReceiverKeyPair, ReceiverKeySigner, RegisterBatchSuccess, RegisterPolicyV3Input, RegisterPolicyV3Receipt, ReplicaAuthorityState, ReplicaCoverage, ReplicaDevice, ReplicaGatedHandle, ReplicaGrantInfo, ReplicaInspectedStatus, ReplicaState, ReplicaStatusEntry, ReplicationAuthority, ReplicationControl, ReplicationEvent, ReplicationIdentity, ReplicationOptions, ReplicationPurgeReport, ReplicationReason, ReplicationScheduler, ResolvedCapabilities, ResolvedDelegate, ResolvedReplicationOptions, ResolvedSecretPath, ResourceCapability, SECRET_NAME_RE, SECRET_SCOPE_RE, SQLAction, SQLActionType, SQLService, SQLServiceConfig, STORAGE_FULL_MESSAGE, STORAGE_MANAGE_URL, STORAGE_WRITE_TOO_LARGE_MESSAGE, SchemaInfo, SecretCatalogEntry, SecretPayload, SecretPutOptions, 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, StorageAccountUsage, StorageFullEvent, StorageStatus, StorageStatusOptions, StorageUsage, StorageUsageState, StoredDelegationChain, SubscribeOptions, TC832_RESERVED_SCOPES, 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, appSecretScope, 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, isStorageFullError, loadManifest, makePkhSpaceId, makePublicSpaceId, networkDiscoveryKey, openWrappedKey, parseCanonicalNetworkId, parseExpiry, parseNetworkId, parsePkhDid, parseSecretCatalogKey, parseSpaceUri, pkhDid, principalDid, principalDidEquals, resolveManifest, resolveSecretListPrefix, resolveSecretPath, resourceCapabilitiesToSpaceAbilitiesMap, storageUsageState, tinyCloudDebugLogger, validateEnvelope, validateManifest, verifyDecryptResponse } from '@tinycloud/sdk-core';
|
|
3
|
-
export {
|
|
3
|
+
export { F as FileSessionStorage, M as MemorySessionStorage, W as WasmKeyProvider, a as WasmKeyProviderConfig, c as createWasmKeyProvider } from './WasmKeyProvider-5Ee7fcAw.cjs';
|
|
4
|
+
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, I as InvalidRestoredSessionError, N as NodeEventEmitterStrategy, j as NodeUserAuthorization, k as NodeUserAuthorizationAuthorizeFn, l as NodeUserAuthorizationConfig, O as OpenKeyAuthorizationResultV1, m as OpenKeyAuthorizeInput, n as OpenKeyAuthorizeTinyCloud, o as OpenKeyBridgeInput, p as OwnerDelegationReceipt, P as PortableDelegation, R as RUNTIME_DELEGATION_REJECTIONS, q as RestorableSession, r as RuntimeDelegationActivator, s as RuntimeDelegationRejectedError, t as RuntimeDelegationRejection, u as RuntimePermissionGrantOptions, S as SecretPermissionHint, v as SecretReadInput, w as SecretReadResult, x as SessionGrantProof, y as SignStrategy, T as TinyCloudNode, z as TinyCloudNodeConfig, U as UnifiedOwnerRootInput, F as UnifiedOwnerRootReceipt, G as UnsupportedSessionRestoreError, V as ValidatedRuntimeDelegation, H as VerifiedSessionGrant, J as activateCompactRuntimeDelegation, K as activateValidatedRuntimeDelegation, L as defaultSignStrategy, M as deserializeDelegation, Q as grantAuthRequest, W as serializeDelegation, X as signedCompactUcanExpiry, Y as siweRuntimeDelegation, Z as wireOpenKeyAuthorize } from './TinyCloudNode-BchWB_zv.cjs';
|
|
4
5
|
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
6
|
import { KVReplicaStorage } from '@tinycloud/sdk-services';
|
|
7
|
+
import { ProfileReplicaPurge } from '@tinycloud/sdk-services/kv/replication';
|
|
8
|
+
export { ProfileReplicaDeferredToken, ProfileReplicaPurge } from '@tinycloud/sdk-services/kv/replication';
|
|
6
9
|
import 'events';
|
|
7
10
|
|
|
8
11
|
/**
|
|
@@ -51,88 +54,6 @@ declare class PrivateKeySigner implements ISigner {
|
|
|
51
54
|
signMessage(message: Bytes | string): Promise<string>;
|
|
52
55
|
}
|
|
53
56
|
|
|
54
|
-
/**
|
|
55
|
-
* Structural shape of the OpenKey SDK's `authorizeTinyCloud()` method.
|
|
56
|
-
* Callers pass any object that conforms to this shape — typically an
|
|
57
|
-
* `OpenKey` instance from `@openkey/sdk` — without either package
|
|
58
|
-
* needing to import from the other.
|
|
59
|
-
*/
|
|
60
|
-
interface OpenKeyAuthorizeTinyCloud {
|
|
61
|
-
authorizeTinyCloud(request: {
|
|
62
|
-
protocolVersion: 1;
|
|
63
|
-
siwe: string;
|
|
64
|
-
keyId?: string;
|
|
65
|
-
jwk?: Record<string, unknown>;
|
|
66
|
-
host?: string;
|
|
67
|
-
/**
|
|
68
|
-
* Display-only presentation envelope. Forwarded to the OpenKey
|
|
69
|
-
* widget review UI. The envelope MUST NEVER expand authority — the
|
|
70
|
-
* ReCap payload remains the sole gate — and the widget/server
|
|
71
|
-
* validates and size-bounds it before use.
|
|
72
|
-
*/
|
|
73
|
-
presentation?: CapabilityPresentationEnvelopeV1;
|
|
74
|
-
}): Promise<{
|
|
75
|
-
protocolVersion: 1;
|
|
76
|
-
address: string;
|
|
77
|
-
signature: string;
|
|
78
|
-
signedMessage: string;
|
|
79
|
-
selectedActionKeys: string[];
|
|
80
|
-
permissions: Array<{
|
|
81
|
-
service: string;
|
|
82
|
-
space: string;
|
|
83
|
-
path: string;
|
|
84
|
-
actions: string[];
|
|
85
|
-
}>;
|
|
86
|
-
}>;
|
|
87
|
-
}
|
|
88
|
-
interface OpenKeyBridgeInput {
|
|
89
|
-
protocolVersion: 1;
|
|
90
|
-
siwe: string;
|
|
91
|
-
jwk: Record<string, unknown>;
|
|
92
|
-
host?: string;
|
|
93
|
-
/** Optional keyId hint the caller wants OpenKey to bind to. */
|
|
94
|
-
keyId?: string;
|
|
95
|
-
/**
|
|
96
|
-
* Optional presentation envelope built by `NodeUserAuthorization`
|
|
97
|
-
* from its `_manifest`. Passed through to `authorizeTinyCloud` so the
|
|
98
|
-
* widget can render honest provenance labels and the OpenKey server
|
|
99
|
-
* can origin-bind the browser origin against the app's well-known
|
|
100
|
-
* manifest. Display-only.
|
|
101
|
-
*/
|
|
102
|
-
presentation?: CapabilityPresentationEnvelopeV1;
|
|
103
|
-
}
|
|
104
|
-
type NodeUserAuthorizationAuthorizeFn = (input: OpenKeyBridgeInput) => Promise<{
|
|
105
|
-
protocolVersion: 1;
|
|
106
|
-
address: string;
|
|
107
|
-
signature: string;
|
|
108
|
-
signedMessage: string;
|
|
109
|
-
selectedActionKeys: string[];
|
|
110
|
-
permissions: Array<{
|
|
111
|
-
service: string;
|
|
112
|
-
space: string;
|
|
113
|
-
path: string;
|
|
114
|
-
actions: string[];
|
|
115
|
-
}>;
|
|
116
|
-
}>;
|
|
117
|
-
/**
|
|
118
|
-
* Wire a concrete OpenKey-shaped SDK object into the `authorizeFn`
|
|
119
|
-
* `NodeUserAuthorization.signInWithOpenKey` expects. Rejects any
|
|
120
|
-
* response that does not carry the canonical rich-result shape so
|
|
121
|
-
* wire drift shows up at the bridge boundary rather than deep inside
|
|
122
|
-
* `signInWithOpenKeyResult`.
|
|
123
|
-
*
|
|
124
|
-
* @example
|
|
125
|
-
* ```ts
|
|
126
|
-
* import { OpenKey } from '@openkey/sdk';
|
|
127
|
-
* import { wireOpenKeyAuthorize } from '@tinycloud/node-sdk';
|
|
128
|
-
* const openkey = new OpenKey({ appName: 'my-app' });
|
|
129
|
-
* await openkey.connect();
|
|
130
|
-
* const authorize = wireOpenKeyAuthorize(openkey);
|
|
131
|
-
* const clientSession = await nodeAuth.signInWithOpenKey(authorize);
|
|
132
|
-
* ```
|
|
133
|
-
*/
|
|
134
|
-
declare function wireOpenKeyAuthorize(openkey: OpenKeyAuthorizeTinyCloud): NodeUserAuthorizationAuthorizeFn;
|
|
135
|
-
|
|
136
57
|
/**
|
|
137
58
|
* Internal helpers for TinyCloudNode.delegateTo and the legacy
|
|
138
59
|
* createDelegation compatibility shim. Exported from their own module so
|
|
@@ -201,10 +122,8 @@ declare class NodeWasmBindings implements IWasmBindings {
|
|
|
201
122
|
type MutationGuard = <T>(section: () => Promise<T>) => Promise<T>;
|
|
202
123
|
|
|
203
124
|
/**
|
|
204
|
-
* `sqliteReplicaStorage`
|
|
205
|
-
*
|
|
206
|
-
* durable file pending store when a `guard` serializes mutations, a per-
|
|
207
|
-
* replica `syncedThroughEpoch` fence, and purge across the device union.
|
|
125
|
+
* `sqliteReplicaStorage` — Node/CLI SQLite replicas with a mandatory
|
|
126
|
+
* profile lifecycle gate and durable identity-scoped pending file.
|
|
208
127
|
*
|
|
209
128
|
* `@tinycloud/replica`, `@tinycloud/replica/sqlite` and
|
|
210
129
|
* `@tinycloud/node-sdk-wasm` load lazily — only inside `open`, `purge`,
|
|
@@ -216,6 +135,29 @@ type MutationGuard = <T>(section: () => Promise<T>) => Promise<T>;
|
|
|
216
135
|
* pins the declarations against the real modules wherever replica IS built.
|
|
217
136
|
*/
|
|
218
137
|
|
|
138
|
+
/** CLI-only crash fence; generic SQLite stores do not opt in to this path. */
|
|
139
|
+
declare const REPLICA_LOGOUT_PENDING_FILE = "replica-logout-pending.json";
|
|
140
|
+
/** Every CLI read path, including legacy replica commands, checks this marker before delivery. */
|
|
141
|
+
declare function assertProfileLogoutClear(profileDir: string): void;
|
|
142
|
+
/** The domain-separated owner binding persisted as a logout marker's `principalDigest`. */
|
|
143
|
+
declare function logoutPrincipalDigest(principal: string): string;
|
|
144
|
+
/** Exported for the CLI, which shows the same route for a recovery report's `gate_restored`. */
|
|
145
|
+
declare const RESTORED_GATE_MESSAGE: string;
|
|
146
|
+
/** Directory-fsync boundary: durable renames for the pending store (a test seam lets a unit test observe the code path). */
|
|
147
|
+
type DirSync = (dir: string) => Promise<void>;
|
|
148
|
+
/**
|
|
149
|
+
* CLI-facing profile lifecycle. `guard` is the same profile lock as CLI
|
|
150
|
+
* session/key writes and MUST be reentrant within one async call chain: the CLI
|
|
151
|
+
* calls this facade while it already holds that lock.
|
|
152
|
+
*/
|
|
153
|
+
declare function createProfileReplicaPurge(options: {
|
|
154
|
+
profileDir: string;
|
|
155
|
+
guard: MutationGuard;
|
|
156
|
+
/** Exact regular diagnostics file names the CLI writes directly under `replication/`. */
|
|
157
|
+
diagnosticFiles?: readonly string[];
|
|
158
|
+
/** Observe directory-fsync ordering in tests; production uses fsyncDir. @internal */
|
|
159
|
+
dirSync?: DirSync;
|
|
160
|
+
}): ProfileReplicaPurge;
|
|
219
161
|
/**
|
|
220
162
|
* The public Node-entry adapter (§2.5): durable SQLite replicas partitioned
|
|
221
163
|
* by canonical identity, and ALWAYS the durable partitioned pending-write
|
|
@@ -226,6 +168,10 @@ type MutationGuard = <T>(section: () => Promise<T>) => Promise<T>;
|
|
|
226
168
|
declare function sqliteReplicaStorage(options: {
|
|
227
169
|
dir: string;
|
|
228
170
|
guard?: MutationGuard;
|
|
171
|
+
gateFile?: string;
|
|
172
|
+
logoutPendingFile?: string;
|
|
173
|
+
/** CLI opt-in; see `SqliteReplicaStorageOptions.diagnosticFiles`. */
|
|
174
|
+
diagnosticFiles?: readonly string[];
|
|
229
175
|
}): KVReplicaStorage;
|
|
230
176
|
|
|
231
|
-
export {
|
|
177
|
+
export { NodeWasmBindings, PrivateKeySigner, REPLICA_LOGOUT_PENDING_FILE, RESTORED_GATE_MESSAGE, assertProfileLogoutClear, createProfileReplicaPurge, extractSiweExpiration, logoutPrincipalDigest, sqliteReplicaStorage };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import { ISigner, Bytes,
|
|
1
|
+
import { ISigner, Bytes, 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, AuthorityRefusal, 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, IStorageService, IUserAuthorization, IWasmBindings, IdentityParseError, IngestOptions, InlineEncryptedEnvelope, InvokeFunction, JWK, KVBatchReadResponse, KVCreateSignedReadUrlOptions, KVListPage, KVReadThrough, KVReplicaHandle, KVReplicaSpec, KVReplicaStorage, KVReplicationController, KVReplicationDeps, KVResponse, KVService, KVServiceConfig, KVSignedReadUrlResponse, KeyInfo, KeyProvider, KeyType, LocalGetResult, LocalListResult, LocalReadMeta, LocalReplicaStatus, LocalSyncResult, MAX_SECRET_SCOPE_LENGTH, Manifest, ManifestDefaults, ManifestRegistryRecord, ManifestSecretActions, ManifestValidationError, NETWORK_NAME_PATTERN, NetworkDescriptor, NetworkIdError, NodeDescriptorFetcher, OpenKeyCallbackStrategy, OpenKeySigningRequestBody, OpenKeySigningResponseBody, OpenKeySigningStrategyOptions, OwnerDelegationPermission, ParsedNetworkId, ParsedSecretCatalogKey, PendingWriteRecord, PendingWriteState, PendingWriteStore, PermissionEntry, PermissionNotInManifestError, PersistedSessionData, PinnedKey, PkhDidParts, PrefixedKVService, ProtocolMismatchError, PurgeTarget, QueryOptions, QueryResponse, RandomReceiverKeyInput, ReceiveOptions, ReceiverKeyPair, ReceiverKeySigner, RegisterBatchSuccess, RegisterPolicyV3Input, RegisterPolicyV3Receipt, ReplicaAuthorityState, ReplicaCoverage, ReplicaDevice, ReplicaGatedHandle, ReplicaGrantInfo, ReplicaInspectedStatus, ReplicaState, ReplicaStatusEntry, ReplicationAuthority, ReplicationControl, ReplicationEvent, ReplicationIdentity, ReplicationOptions, ReplicationPurgeReport, ReplicationReason, ReplicationScheduler, ResolvedCapabilities, ResolvedDelegate, ResolvedReplicationOptions, ResolvedSecretPath, ResourceCapability, SECRET_NAME_RE, SECRET_SCOPE_RE, SQLAction, SQLActionType, SQLService, SQLServiceConfig, STORAGE_FULL_MESSAGE, STORAGE_MANAGE_URL, STORAGE_WRITE_TOO_LARGE_MESSAGE, SchemaInfo, SecretCatalogEntry, SecretPayload, SecretPutOptions, 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, StorageAccountUsage, StorageFullEvent, StorageStatus, StorageStatusOptions, StorageUsage, StorageUsageState, StoredDelegationChain, SubscribeOptions, TC832_RESERVED_SCOPES, 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, appSecretScope, 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, isStorageFullError, loadManifest, makePkhSpaceId, makePublicSpaceId, networkDiscoveryKey, openWrappedKey, parseCanonicalNetworkId, parseExpiry, parseNetworkId, parsePkhDid, parseSecretCatalogKey, parseSpaceUri, pkhDid, principalDid, principalDidEquals, resolveManifest, resolveSecretListPrefix, resolveSecretPath, resourceCapabilitiesToSpaceAbilitiesMap, storageUsageState, tinyCloudDebugLogger, validateEnvelope, validateManifest, verifyDecryptResponse } from '@tinycloud/sdk-core';
|
|
3
|
-
export {
|
|
3
|
+
export { F as FileSessionStorage, M as MemorySessionStorage, W as WasmKeyProvider, a as WasmKeyProviderConfig, c as createWasmKeyProvider } from './WasmKeyProvider-5Ee7fcAw.js';
|
|
4
|
+
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, I as InvalidRestoredSessionError, N as NodeEventEmitterStrategy, j as NodeUserAuthorization, k as NodeUserAuthorizationAuthorizeFn, l as NodeUserAuthorizationConfig, O as OpenKeyAuthorizationResultV1, m as OpenKeyAuthorizeInput, n as OpenKeyAuthorizeTinyCloud, o as OpenKeyBridgeInput, p as OwnerDelegationReceipt, P as PortableDelegation, R as RUNTIME_DELEGATION_REJECTIONS, q as RestorableSession, r as RuntimeDelegationActivator, s as RuntimeDelegationRejectedError, t as RuntimeDelegationRejection, u as RuntimePermissionGrantOptions, S as SecretPermissionHint, v as SecretReadInput, w as SecretReadResult, x as SessionGrantProof, y as SignStrategy, T as TinyCloudNode, z as TinyCloudNodeConfig, U as UnifiedOwnerRootInput, F as UnifiedOwnerRootReceipt, G as UnsupportedSessionRestoreError, V as ValidatedRuntimeDelegation, H as VerifiedSessionGrant, J as activateCompactRuntimeDelegation, K as activateValidatedRuntimeDelegation, L as defaultSignStrategy, M as deserializeDelegation, Q as grantAuthRequest, W as serializeDelegation, X as signedCompactUcanExpiry, Y as siweRuntimeDelegation, Z as wireOpenKeyAuthorize } from './TinyCloudNode-BchWB_zv.js';
|
|
4
5
|
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
6
|
import { KVReplicaStorage } from '@tinycloud/sdk-services';
|
|
7
|
+
import { ProfileReplicaPurge } from '@tinycloud/sdk-services/kv/replication';
|
|
8
|
+
export { ProfileReplicaDeferredToken, ProfileReplicaPurge } from '@tinycloud/sdk-services/kv/replication';
|
|
6
9
|
import 'events';
|
|
7
10
|
|
|
8
11
|
/**
|
|
@@ -51,88 +54,6 @@ declare class PrivateKeySigner implements ISigner {
|
|
|
51
54
|
signMessage(message: Bytes | string): Promise<string>;
|
|
52
55
|
}
|
|
53
56
|
|
|
54
|
-
/**
|
|
55
|
-
* Structural shape of the OpenKey SDK's `authorizeTinyCloud()` method.
|
|
56
|
-
* Callers pass any object that conforms to this shape — typically an
|
|
57
|
-
* `OpenKey` instance from `@openkey/sdk` — without either package
|
|
58
|
-
* needing to import from the other.
|
|
59
|
-
*/
|
|
60
|
-
interface OpenKeyAuthorizeTinyCloud {
|
|
61
|
-
authorizeTinyCloud(request: {
|
|
62
|
-
protocolVersion: 1;
|
|
63
|
-
siwe: string;
|
|
64
|
-
keyId?: string;
|
|
65
|
-
jwk?: Record<string, unknown>;
|
|
66
|
-
host?: string;
|
|
67
|
-
/**
|
|
68
|
-
* Display-only presentation envelope. Forwarded to the OpenKey
|
|
69
|
-
* widget review UI. The envelope MUST NEVER expand authority — the
|
|
70
|
-
* ReCap payload remains the sole gate — and the widget/server
|
|
71
|
-
* validates and size-bounds it before use.
|
|
72
|
-
*/
|
|
73
|
-
presentation?: CapabilityPresentationEnvelopeV1;
|
|
74
|
-
}): Promise<{
|
|
75
|
-
protocolVersion: 1;
|
|
76
|
-
address: string;
|
|
77
|
-
signature: string;
|
|
78
|
-
signedMessage: string;
|
|
79
|
-
selectedActionKeys: string[];
|
|
80
|
-
permissions: Array<{
|
|
81
|
-
service: string;
|
|
82
|
-
space: string;
|
|
83
|
-
path: string;
|
|
84
|
-
actions: string[];
|
|
85
|
-
}>;
|
|
86
|
-
}>;
|
|
87
|
-
}
|
|
88
|
-
interface OpenKeyBridgeInput {
|
|
89
|
-
protocolVersion: 1;
|
|
90
|
-
siwe: string;
|
|
91
|
-
jwk: Record<string, unknown>;
|
|
92
|
-
host?: string;
|
|
93
|
-
/** Optional keyId hint the caller wants OpenKey to bind to. */
|
|
94
|
-
keyId?: string;
|
|
95
|
-
/**
|
|
96
|
-
* Optional presentation envelope built by `NodeUserAuthorization`
|
|
97
|
-
* from its `_manifest`. Passed through to `authorizeTinyCloud` so the
|
|
98
|
-
* widget can render honest provenance labels and the OpenKey server
|
|
99
|
-
* can origin-bind the browser origin against the app's well-known
|
|
100
|
-
* manifest. Display-only.
|
|
101
|
-
*/
|
|
102
|
-
presentation?: CapabilityPresentationEnvelopeV1;
|
|
103
|
-
}
|
|
104
|
-
type NodeUserAuthorizationAuthorizeFn = (input: OpenKeyBridgeInput) => Promise<{
|
|
105
|
-
protocolVersion: 1;
|
|
106
|
-
address: string;
|
|
107
|
-
signature: string;
|
|
108
|
-
signedMessage: string;
|
|
109
|
-
selectedActionKeys: string[];
|
|
110
|
-
permissions: Array<{
|
|
111
|
-
service: string;
|
|
112
|
-
space: string;
|
|
113
|
-
path: string;
|
|
114
|
-
actions: string[];
|
|
115
|
-
}>;
|
|
116
|
-
}>;
|
|
117
|
-
/**
|
|
118
|
-
* Wire a concrete OpenKey-shaped SDK object into the `authorizeFn`
|
|
119
|
-
* `NodeUserAuthorization.signInWithOpenKey` expects. Rejects any
|
|
120
|
-
* response that does not carry the canonical rich-result shape so
|
|
121
|
-
* wire drift shows up at the bridge boundary rather than deep inside
|
|
122
|
-
* `signInWithOpenKeyResult`.
|
|
123
|
-
*
|
|
124
|
-
* @example
|
|
125
|
-
* ```ts
|
|
126
|
-
* import { OpenKey } from '@openkey/sdk';
|
|
127
|
-
* import { wireOpenKeyAuthorize } from '@tinycloud/node-sdk';
|
|
128
|
-
* const openkey = new OpenKey({ appName: 'my-app' });
|
|
129
|
-
* await openkey.connect();
|
|
130
|
-
* const authorize = wireOpenKeyAuthorize(openkey);
|
|
131
|
-
* const clientSession = await nodeAuth.signInWithOpenKey(authorize);
|
|
132
|
-
* ```
|
|
133
|
-
*/
|
|
134
|
-
declare function wireOpenKeyAuthorize(openkey: OpenKeyAuthorizeTinyCloud): NodeUserAuthorizationAuthorizeFn;
|
|
135
|
-
|
|
136
57
|
/**
|
|
137
58
|
* Internal helpers for TinyCloudNode.delegateTo and the legacy
|
|
138
59
|
* createDelegation compatibility shim. Exported from their own module so
|
|
@@ -201,10 +122,8 @@ declare class NodeWasmBindings implements IWasmBindings {
|
|
|
201
122
|
type MutationGuard = <T>(section: () => Promise<T>) => Promise<T>;
|
|
202
123
|
|
|
203
124
|
/**
|
|
204
|
-
* `sqliteReplicaStorage`
|
|
205
|
-
*
|
|
206
|
-
* durable file pending store when a `guard` serializes mutations, a per-
|
|
207
|
-
* replica `syncedThroughEpoch` fence, and purge across the device union.
|
|
125
|
+
* `sqliteReplicaStorage` — Node/CLI SQLite replicas with a mandatory
|
|
126
|
+
* profile lifecycle gate and durable identity-scoped pending file.
|
|
208
127
|
*
|
|
209
128
|
* `@tinycloud/replica`, `@tinycloud/replica/sqlite` and
|
|
210
129
|
* `@tinycloud/node-sdk-wasm` load lazily — only inside `open`, `purge`,
|
|
@@ -216,6 +135,29 @@ type MutationGuard = <T>(section: () => Promise<T>) => Promise<T>;
|
|
|
216
135
|
* pins the declarations against the real modules wherever replica IS built.
|
|
217
136
|
*/
|
|
218
137
|
|
|
138
|
+
/** CLI-only crash fence; generic SQLite stores do not opt in to this path. */
|
|
139
|
+
declare const REPLICA_LOGOUT_PENDING_FILE = "replica-logout-pending.json";
|
|
140
|
+
/** Every CLI read path, including legacy replica commands, checks this marker before delivery. */
|
|
141
|
+
declare function assertProfileLogoutClear(profileDir: string): void;
|
|
142
|
+
/** The domain-separated owner binding persisted as a logout marker's `principalDigest`. */
|
|
143
|
+
declare function logoutPrincipalDigest(principal: string): string;
|
|
144
|
+
/** Exported for the CLI, which shows the same route for a recovery report's `gate_restored`. */
|
|
145
|
+
declare const RESTORED_GATE_MESSAGE: string;
|
|
146
|
+
/** Directory-fsync boundary: durable renames for the pending store (a test seam lets a unit test observe the code path). */
|
|
147
|
+
type DirSync = (dir: string) => Promise<void>;
|
|
148
|
+
/**
|
|
149
|
+
* CLI-facing profile lifecycle. `guard` is the same profile lock as CLI
|
|
150
|
+
* session/key writes and MUST be reentrant within one async call chain: the CLI
|
|
151
|
+
* calls this facade while it already holds that lock.
|
|
152
|
+
*/
|
|
153
|
+
declare function createProfileReplicaPurge(options: {
|
|
154
|
+
profileDir: string;
|
|
155
|
+
guard: MutationGuard;
|
|
156
|
+
/** Exact regular diagnostics file names the CLI writes directly under `replication/`. */
|
|
157
|
+
diagnosticFiles?: readonly string[];
|
|
158
|
+
/** Observe directory-fsync ordering in tests; production uses fsyncDir. @internal */
|
|
159
|
+
dirSync?: DirSync;
|
|
160
|
+
}): ProfileReplicaPurge;
|
|
219
161
|
/**
|
|
220
162
|
* The public Node-entry adapter (§2.5): durable SQLite replicas partitioned
|
|
221
163
|
* by canonical identity, and ALWAYS the durable partitioned pending-write
|
|
@@ -226,6 +168,10 @@ type MutationGuard = <T>(section: () => Promise<T>) => Promise<T>;
|
|
|
226
168
|
declare function sqliteReplicaStorage(options: {
|
|
227
169
|
dir: string;
|
|
228
170
|
guard?: MutationGuard;
|
|
171
|
+
gateFile?: string;
|
|
172
|
+
logoutPendingFile?: string;
|
|
173
|
+
/** CLI opt-in; see `SqliteReplicaStorageOptions.diagnosticFiles`. */
|
|
174
|
+
diagnosticFiles?: readonly string[];
|
|
229
175
|
}): KVReplicaStorage;
|
|
230
176
|
|
|
231
|
-
export {
|
|
177
|
+
export { NodeWasmBindings, PrivateKeySigner, REPLICA_LOGOUT_PENDING_FILE, RESTORED_GATE_MESSAGE, assertProfileLogoutClear, createProfileReplicaPurge, extractSiweExpiration, logoutPrincipalDigest, sqliteReplicaStorage };
|