@tinycloud/sdk-services 2.2.0-beta.7 → 2.2.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/{BaseService-BiS6HRwE.d.cts → BaseService-C_iXlTeN.d.cts} +6 -1
- package/dist/{BaseService-BiS6HRwE.d.ts → BaseService-C_iXlTeN.d.ts} +6 -1
- package/dist/encryption/index.cjs +1340 -0
- package/dist/encryption/index.cjs.map +1 -0
- package/dist/encryption/index.d.cts +802 -0
- package/dist/encryption/index.d.ts +802 -0
- package/dist/encryption/index.js +1274 -0
- package/dist/encryption/index.js.map +1 -0
- package/dist/index.cjs +1555 -46
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +55 -12
- package/dist/index.d.ts +55 -12
- package/dist/index.js +1510 -46
- package/dist/index.js.map +1 -1
- package/dist/kv/index.cjs +116 -0
- package/dist/kv/index.cjs.map +1 -1
- package/dist/kv/index.d.cts +100 -2
- package/dist/kv/index.d.ts +100 -2
- package/dist/kv/index.js +115 -0
- package/dist/kv/index.js.map +1 -1
- package/dist/sql/index.cjs.map +1 -1
- package/dist/sql/index.d.cts +1 -1
- package/dist/sql/index.d.ts +1 -1
- package/dist/sql/index.js.map +1 -1
- package/package.json +7 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { I as IServiceContext, a as InvokeFunction, b as InvokeAnyFunction, F as FetchFunction, S as ServiceSession, R as RetryPolicy, c as IService, d as ServiceError, e as Result, B as BaseService, f as StorageQuotaInfo } from './BaseService-
|
|
2
|
-
export { E as ErrorCode, g as ErrorCodes, h as EventHandler, i as FetchRequestInit, j as FetchResponse, k as InvocationFact, l as InvocationFacts, m as InvokeAnyEntry, n as ServiceErrorEvent, o as ServiceHeaders, p as ServiceRequestEvent, q as ServiceResponseEvent, r as ServiceRetryEvent, T as TelemetryEvents, s as defaultRetryPolicy, t as err, u as ok, v as serviceError } from './BaseService-
|
|
1
|
+
import { I as IServiceContext, a as InvokeFunction, b as InvokeAnyFunction, F as FetchFunction, S as ServiceSession, R as RetryPolicy, c as IService, d as ServiceError, e as Result, B as BaseService, f as StorageQuotaInfo } from './BaseService-C_iXlTeN.cjs';
|
|
2
|
+
export { E as ErrorCode, g as ErrorCodes, h as EventHandler, i as FetchRequestInit, j as FetchResponse, k as InvocationFact, l as InvocationFacts, m as InvokeAnyEntry, n as ServiceErrorEvent, o as ServiceHeaders, p as ServiceRequestEvent, q as ServiceResponseEvent, r as ServiceRetryEvent, T as TelemetryEvents, s as defaultRetryPolicy, t as err, u as ok, v as serviceError } from './BaseService-C_iXlTeN.cjs';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
import { IKVService } from './kv/index.cjs';
|
|
5
|
-
export { IPrefixedKVService, KVAction, KVActionType, KVDeleteOptions, KVGetOptions, KVHeadOptions, KVListOptions, KVListResponse, KVPutOptions, KVResponse, KVResponseHeaders, KVService, KVServiceConfig, PrefixedKVService } from './kv/index.cjs';
|
|
5
|
+
export { DEFAULT_SIGNED_READ_URL_EXPIRY_MS, IPrefixedKVService, KVAction, KVActionType, KVCreateSignedReadUrlOptions, KVDeleteOptions, KVGetOptions, KVHeadOptions, KVListOptions, KVListResponse, KVPutOptions, KVResponse, KVResponseHeaders, KVService, KVServiceConfig, KVSignedReadUrlResponse, PrefixedKVService } from './kv/index.cjs';
|
|
6
6
|
export { BatchOptions, BatchResponse, DatabaseHandle, ExecuteOptions, ExecuteResponse, IDatabaseHandle, ISQLService, QueryOptions, QueryResponse, SQLAction, SQLActionType, SQLService, SQLServiceConfig, SqlStatement, SqlValue } from './sql/index.cjs';
|
|
7
|
+
import { IEncryptionService, DecryptCapabilityProof } from './encryption/index.cjs';
|
|
8
|
+
export { BuildCanonicalDecryptRequestInput, BuildDecryptFactsInput, BuildDecryptInvocationInput, BuiltDecryptInvocation, CanonicalDecryptRequest, CanonicalJson, DECRYPT_ACTION, DECRYPT_FACT_TYPE, DECRYPT_RESULT_TYPE, DEFAULT_ENCRYPTION_ALG, DEFAULT_KEY_VERSION, DecryptEnvelopeOptions, DecryptInvocationFact, DecryptInvocationSigner, DecryptRequestBody, DecryptResponseBody, DecryptTransport, DiscoverNetworkInput, DiscoveredNetwork, DiscoverySource, ENCRYPTION_NETWORK_URN_PREFIX, ENCRYPTION_SERVICE, ENCRYPTION_SERVICE_SHORT, ENVELOPE_VERSION, EncryptToNetworkInput, EncryptToNetworkOptions, EncryptToNetworkResult, EncryptionCrypto, EncryptionError, EncryptionErrorInput, EncryptionService, EncryptionServiceConfig, InlineEncryptedEnvelope, Json, NETWORK_NAME_PATTERN, NetworkDescriptor, NetworkIdError, NodeDescriptorFetcher, ParsedNetworkId, RandomReceiverKeyInput, ReceiverKeyPair, ReceiverKeySigner, SignedReceiverKeyInput, VerifyDecryptResponseInput, WellKnownDescriptorFetcher, base64Decode, base64Encode, buildCanonicalDecryptRequest, buildDecryptAttenuation, buildDecryptFacts, buildDecryptInvocation, buildNetworkId, canonicalHashHex, canonicalSignedResponse, canonicalize as canonicalizeEncryptionJson, checkDecryptInvocationInput, decryptEnvelopeWithKey, deriveSignedReceiverKey, discoverNetwork, encryptToNetwork, encryptionError, ensureNetworkUsableForDecrypt, generateRandomReceiverKey, hexDecode, hexEncode, isNetworkId, networkDiscoveryKey, openWrappedKey, parseNetworkId, utf8Decode, utf8Encode, validateEnvelope, verifyDecryptResponse } from './encryption/index.cjs';
|
|
7
9
|
|
|
8
10
|
/**
|
|
9
11
|
* Zod schemas for SDK Services API response types.
|
|
@@ -1375,6 +1377,15 @@ declare class TinyCloudQuota {
|
|
|
1375
1377
|
*
|
|
1376
1378
|
* Type definitions for the Data Vault (encrypted KV) service operations.
|
|
1377
1379
|
*/
|
|
1380
|
+
|
|
1381
|
+
interface VaultNetworkEncryptionConfig {
|
|
1382
|
+
/** Default encryption network used for inline vault envelopes. */
|
|
1383
|
+
networkId: string;
|
|
1384
|
+
/** TinyCloud encryption module used for local encrypt and node-mediated decrypt. */
|
|
1385
|
+
service: IEncryptionService;
|
|
1386
|
+
/** Proof material presented to the encryption module for decrypt requests. */
|
|
1387
|
+
decryptCapabilityProof?: DecryptCapabilityProof | (() => DecryptCapabilityProof | Promise<DecryptCapabilityProof>);
|
|
1388
|
+
}
|
|
1378
1389
|
/**
|
|
1379
1390
|
* Configuration for DataVaultService.
|
|
1380
1391
|
*/
|
|
@@ -1383,6 +1394,8 @@ interface DataVaultConfig {
|
|
|
1383
1394
|
spaceId: string;
|
|
1384
1395
|
/** Key rotation policy */
|
|
1385
1396
|
keyRotation?: "per-write" | "per-key";
|
|
1397
|
+
/** Network-envelope encryption mode. When set, vault.unlock/key grants are not used. */
|
|
1398
|
+
encryption?: VaultNetworkEncryptionConfig;
|
|
1386
1399
|
}
|
|
1387
1400
|
/**
|
|
1388
1401
|
* Options for vault put operations.
|
|
@@ -1747,6 +1760,7 @@ declare class DataVaultService extends BaseService implements IDataVaultService
|
|
|
1747
1760
|
private encryptionIdentity;
|
|
1748
1761
|
private _isUnlocked;
|
|
1749
1762
|
private vaultConfig;
|
|
1763
|
+
private unlockInFlight;
|
|
1750
1764
|
/**
|
|
1751
1765
|
* Create a new DataVaultService instance.
|
|
1752
1766
|
*
|
|
@@ -1774,10 +1788,15 @@ declare class DataVaultService extends BaseService implements IDataVaultService
|
|
|
1774
1788
|
* Convenience accessor for TinyCloud instance.
|
|
1775
1789
|
*/
|
|
1776
1790
|
private get tc();
|
|
1791
|
+
private get networkEncryption();
|
|
1792
|
+
private get usesNetworkEncryption();
|
|
1777
1793
|
/**
|
|
1778
1794
|
* Get the host URL.
|
|
1779
1795
|
*/
|
|
1780
1796
|
private get host();
|
|
1797
|
+
private decryptCapabilityProof;
|
|
1798
|
+
private serializeValue;
|
|
1799
|
+
private deserializeValue;
|
|
1781
1800
|
/**
|
|
1782
1801
|
* Unlock the vault. Derives keys from two wallet signatures:
|
|
1783
1802
|
* 1. Master signature (per-space) — used to derive the master encryption key
|
|
@@ -1807,6 +1826,9 @@ declare class DataVaultService extends BaseService implements IDataVaultService
|
|
|
1807
1826
|
* Called when SDK signs out. Locks the vault and aborts operations.
|
|
1808
1827
|
*/
|
|
1809
1828
|
onSignOut(): void;
|
|
1829
|
+
private putNetworkEncrypted;
|
|
1830
|
+
private getNetworkEncrypted;
|
|
1831
|
+
private headNetworkEncrypted;
|
|
1810
1832
|
/**
|
|
1811
1833
|
* Encrypt and store a value at the given key.
|
|
1812
1834
|
*
|
|
@@ -1937,6 +1959,27 @@ interface WasmVaultFunctions {
|
|
|
1937
1959
|
}
|
|
1938
1960
|
declare function createVaultCrypto(wasm: WasmVaultFunctions): VaultCrypto;
|
|
1939
1961
|
|
|
1962
|
+
declare const SECRET_NAME_RE: RegExp;
|
|
1963
|
+
interface SecretScopeOptions {
|
|
1964
|
+
/** Optional logical scope. Omit for the global secret namespace. */
|
|
1965
|
+
scope?: string;
|
|
1966
|
+
}
|
|
1967
|
+
interface ResolvedSecretPath {
|
|
1968
|
+
/** Canonical env-style secret name. */
|
|
1969
|
+
name: string;
|
|
1970
|
+
/** Canonical scope. Undefined means global. */
|
|
1971
|
+
scope?: string;
|
|
1972
|
+
/** Key passed to the data vault service. */
|
|
1973
|
+
vaultKey: string;
|
|
1974
|
+
/** KV permission path that backs the encrypted vault entry. */
|
|
1975
|
+
permissionPaths: {
|
|
1976
|
+
vault: string;
|
|
1977
|
+
};
|
|
1978
|
+
}
|
|
1979
|
+
declare function canonicalizeSecretScope(scope: string | undefined): string | undefined;
|
|
1980
|
+
declare function resolveSecretPath(name: string, options?: SecretScopeOptions): ResolvedSecretPath;
|
|
1981
|
+
declare function resolveSecretListPrefix(options?: SecretScopeOptions): string;
|
|
1982
|
+
|
|
1940
1983
|
interface SecretPayload {
|
|
1941
1984
|
value: string;
|
|
1942
1985
|
createdAt: string;
|
|
@@ -1948,10 +1991,10 @@ interface ISecretsService {
|
|
|
1948
1991
|
unlock(signer?: unknown): Promise<Result<void, VaultError>>;
|
|
1949
1992
|
lock(): void;
|
|
1950
1993
|
readonly isUnlocked: boolean;
|
|
1951
|
-
get(name: string): Promise<Result<string, SecretsError>>;
|
|
1952
|
-
put(name: string, value: string): Promise<Result<void, SecretsError>>;
|
|
1953
|
-
delete(name: string): Promise<Result<void, SecretsError>>;
|
|
1954
|
-
list(): Promise<Result<string[], SecretsError>>;
|
|
1994
|
+
get(name: string, options?: SecretScopeOptions): Promise<Result<string, SecretsError>>;
|
|
1995
|
+
put(name: string, value: string, options?: SecretScopeOptions): Promise<Result<void, SecretsError>>;
|
|
1996
|
+
delete(name: string, options?: SecretScopeOptions): Promise<Result<void, SecretsError>>;
|
|
1997
|
+
list(options?: SecretScopeOptions): Promise<Result<string[], SecretsError>>;
|
|
1955
1998
|
}
|
|
1956
1999
|
|
|
1957
2000
|
declare class SecretsService implements ISecretsService {
|
|
@@ -1961,10 +2004,10 @@ declare class SecretsService implements ISecretsService {
|
|
|
1961
2004
|
get isUnlocked(): boolean;
|
|
1962
2005
|
unlock(signer?: unknown): Promise<Result<void, VaultError>>;
|
|
1963
2006
|
lock(): void;
|
|
1964
|
-
get(name: string): Promise<Result<string, SecretsError>>;
|
|
1965
|
-
put(name: string, value: string): Promise<Result<void, SecretsError>>;
|
|
1966
|
-
delete(name: string): Promise<Result<void, SecretsError>>;
|
|
1967
|
-
list(): Promise<Result<string[], SecretsError>>;
|
|
2007
|
+
get(name: string, options?: SecretScopeOptions): Promise<Result<string, SecretsError>>;
|
|
2008
|
+
put(name: string, value: string, options?: SecretScopeOptions): Promise<Result<void, SecretsError>>;
|
|
2009
|
+
delete(name: string, options?: SecretScopeOptions): Promise<Result<void, SecretsError>>;
|
|
2010
|
+
list(options?: SecretScopeOptions): Promise<Result<string[], SecretsError>>;
|
|
1968
2011
|
}
|
|
1969
2012
|
|
|
1970
|
-
export { BaseService, type BaseServiceOptions, type ColumnInfo, type DataVaultConfig, DataVaultService, DuckDbAction, type DuckDbActionType, type DuckDbBatchOptions, type BatchResponse as DuckDbBatchResponse, DuckDbDatabaseHandle, type DuckDbExecuteOptions, type ExecuteResponse as DuckDbExecuteResponse, type DuckDbOptions, type DuckDbQueryOptions, type QueryResponse as DuckDbQueryResponse, DuckDbService, type DuckDbServiceConfig, type DuckDbStatement, type DuckDbValue, FetchFunction, GenericKVResponseSchema, type GenericKVResponseType, GenericResultSchema, type HookEvent, type HookServiceName, type HookStreamEvent, type HookSubscription, type HookWebhookListOptions, type HookWebhookRecord, type HookWebhookRegistration, type HookWebhookScope, type HookWebhookUnregisterOptions, HooksService, type HooksServiceConfig, type IDataVaultService, type IDuckDbDatabaseHandle, type IDuckDbService, type IHooksService, IKVService, type ISecretsService, IService, IServiceContext, InvokeAnyFunction, InvokeFunction, KVListResponseSchema, type KVListResponseType, KVListResultSchema, type KVListResultType, KVResponseHeadersSchema, type KVResponseHeadersType, type QuotaConfig, type QuotaStatus, Result, RetryPolicy, RetryPolicySchema, type RetryPolicyType, type SchemaInfo, type SecretPayload, type SecretsError, SecretsService, type ServiceConstructor, ServiceContext, type ServiceContextConfig, ServiceError, ServiceErrorEventSchema, type ServiceErrorEventType, ServiceErrorSchema, type ServiceErrorType, type ServiceRegistration, ServiceRequestEventSchema, type ServiceRequestEventType, ServiceResponseEventSchema, type ServiceResponseEventType, ServiceRetryEventSchema, type ServiceRetryEventType, ServiceSession, ServiceSessionSchema, type ServiceSessionType, StorageQuotaInfo, type SubscribeOptions, type TableInfo, TinyCloudQuota, type ValidationError, type VaultCrypto, type VaultEntry, type VaultError, type VaultGetOptions, type VaultGrantOptions, VaultHeaders, type VaultListOptions, VaultPublicSpaceKVActions, type VaultPutOptions, type ViewInfo, type WasmVaultFunctions, abortedError, authExpiredError, authRequiredError, authUnauthorizedError, createKVResponseSchema, createResultSchema, createVaultCrypto, errorResult, networkError, notFoundError, parseAuthError, permissionDeniedError, storageLimitReachedError, storageQuotaExceededError, timeoutError, validateKVListResponse, validateKVResponseHeaders, validateRetryPolicy, validateServiceError, validateServiceRequestEvent, validateServiceResponseEvent, validateServiceSession, wrapError };
|
|
2013
|
+
export { BaseService, type BaseServiceOptions, type ColumnInfo, type DataVaultConfig, DataVaultService, DecryptCapabilityProof, DuckDbAction, type DuckDbActionType, type DuckDbBatchOptions, type BatchResponse as DuckDbBatchResponse, DuckDbDatabaseHandle, type DuckDbExecuteOptions, type ExecuteResponse as DuckDbExecuteResponse, type DuckDbOptions, type DuckDbQueryOptions, type QueryResponse as DuckDbQueryResponse, DuckDbService, type DuckDbServiceConfig, type DuckDbStatement, type DuckDbValue, FetchFunction, GenericKVResponseSchema, type GenericKVResponseType, GenericResultSchema, type HookEvent, type HookServiceName, type HookStreamEvent, type HookSubscription, type HookWebhookListOptions, type HookWebhookRecord, type HookWebhookRegistration, type HookWebhookScope, type HookWebhookUnregisterOptions, HooksService, type HooksServiceConfig, type IDataVaultService, type IDuckDbDatabaseHandle, type IDuckDbService, IEncryptionService, type IHooksService, IKVService, type ISecretsService, IService, IServiceContext, InvokeAnyFunction, InvokeFunction, KVListResponseSchema, type KVListResponseType, KVListResultSchema, type KVListResultType, KVResponseHeadersSchema, type KVResponseHeadersType, type QuotaConfig, type QuotaStatus, type ResolvedSecretPath, Result, RetryPolicy, RetryPolicySchema, type RetryPolicyType, SECRET_NAME_RE, type SchemaInfo, type SecretPayload, type SecretScopeOptions, type SecretsError, SecretsService, type ServiceConstructor, ServiceContext, type ServiceContextConfig, ServiceError, ServiceErrorEventSchema, type ServiceErrorEventType, ServiceErrorSchema, type ServiceErrorType, type ServiceRegistration, ServiceRequestEventSchema, type ServiceRequestEventType, ServiceResponseEventSchema, type ServiceResponseEventType, ServiceRetryEventSchema, type ServiceRetryEventType, ServiceSession, ServiceSessionSchema, type ServiceSessionType, StorageQuotaInfo, type SubscribeOptions, type TableInfo, TinyCloudQuota, type ValidationError, type VaultCrypto, type VaultEntry, type VaultError, type VaultGetOptions, type VaultGrantOptions, VaultHeaders, type VaultListOptions, VaultPublicSpaceKVActions, type VaultPutOptions, type ViewInfo, type WasmVaultFunctions, abortedError, authExpiredError, authRequiredError, authUnauthorizedError, canonicalizeSecretScope, createKVResponseSchema, createResultSchema, createVaultCrypto, errorResult, networkError, notFoundError, parseAuthError, permissionDeniedError, resolveSecretListPrefix, resolveSecretPath, storageLimitReachedError, storageQuotaExceededError, timeoutError, validateKVListResponse, validateKVResponseHeaders, validateRetryPolicy, validateServiceError, validateServiceRequestEvent, validateServiceResponseEvent, validateServiceSession, wrapError };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { I as IServiceContext, a as InvokeFunction, b as InvokeAnyFunction, F as FetchFunction, S as ServiceSession, R as RetryPolicy, c as IService, d as ServiceError, e as Result, B as BaseService, f as StorageQuotaInfo } from './BaseService-
|
|
2
|
-
export { E as ErrorCode, g as ErrorCodes, h as EventHandler, i as FetchRequestInit, j as FetchResponse, k as InvocationFact, l as InvocationFacts, m as InvokeAnyEntry, n as ServiceErrorEvent, o as ServiceHeaders, p as ServiceRequestEvent, q as ServiceResponseEvent, r as ServiceRetryEvent, T as TelemetryEvents, s as defaultRetryPolicy, t as err, u as ok, v as serviceError } from './BaseService-
|
|
1
|
+
import { I as IServiceContext, a as InvokeFunction, b as InvokeAnyFunction, F as FetchFunction, S as ServiceSession, R as RetryPolicy, c as IService, d as ServiceError, e as Result, B as BaseService, f as StorageQuotaInfo } from './BaseService-C_iXlTeN.js';
|
|
2
|
+
export { E as ErrorCode, g as ErrorCodes, h as EventHandler, i as FetchRequestInit, j as FetchResponse, k as InvocationFact, l as InvocationFacts, m as InvokeAnyEntry, n as ServiceErrorEvent, o as ServiceHeaders, p as ServiceRequestEvent, q as ServiceResponseEvent, r as ServiceRetryEvent, T as TelemetryEvents, s as defaultRetryPolicy, t as err, u as ok, v as serviceError } from './BaseService-C_iXlTeN.js';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
import { IKVService } from './kv/index.js';
|
|
5
|
-
export { IPrefixedKVService, KVAction, KVActionType, KVDeleteOptions, KVGetOptions, KVHeadOptions, KVListOptions, KVListResponse, KVPutOptions, KVResponse, KVResponseHeaders, KVService, KVServiceConfig, PrefixedKVService } from './kv/index.js';
|
|
5
|
+
export { DEFAULT_SIGNED_READ_URL_EXPIRY_MS, IPrefixedKVService, KVAction, KVActionType, KVCreateSignedReadUrlOptions, KVDeleteOptions, KVGetOptions, KVHeadOptions, KVListOptions, KVListResponse, KVPutOptions, KVResponse, KVResponseHeaders, KVService, KVServiceConfig, KVSignedReadUrlResponse, PrefixedKVService } from './kv/index.js';
|
|
6
6
|
export { BatchOptions, BatchResponse, DatabaseHandle, ExecuteOptions, ExecuteResponse, IDatabaseHandle, ISQLService, QueryOptions, QueryResponse, SQLAction, SQLActionType, SQLService, SQLServiceConfig, SqlStatement, SqlValue } from './sql/index.js';
|
|
7
|
+
import { IEncryptionService, DecryptCapabilityProof } from './encryption/index.js';
|
|
8
|
+
export { BuildCanonicalDecryptRequestInput, BuildDecryptFactsInput, BuildDecryptInvocationInput, BuiltDecryptInvocation, CanonicalDecryptRequest, CanonicalJson, DECRYPT_ACTION, DECRYPT_FACT_TYPE, DECRYPT_RESULT_TYPE, DEFAULT_ENCRYPTION_ALG, DEFAULT_KEY_VERSION, DecryptEnvelopeOptions, DecryptInvocationFact, DecryptInvocationSigner, DecryptRequestBody, DecryptResponseBody, DecryptTransport, DiscoverNetworkInput, DiscoveredNetwork, DiscoverySource, ENCRYPTION_NETWORK_URN_PREFIX, ENCRYPTION_SERVICE, ENCRYPTION_SERVICE_SHORT, ENVELOPE_VERSION, EncryptToNetworkInput, EncryptToNetworkOptions, EncryptToNetworkResult, EncryptionCrypto, EncryptionError, EncryptionErrorInput, EncryptionService, EncryptionServiceConfig, InlineEncryptedEnvelope, Json, NETWORK_NAME_PATTERN, NetworkDescriptor, NetworkIdError, NodeDescriptorFetcher, ParsedNetworkId, RandomReceiverKeyInput, ReceiverKeyPair, ReceiverKeySigner, SignedReceiverKeyInput, VerifyDecryptResponseInput, WellKnownDescriptorFetcher, base64Decode, base64Encode, buildCanonicalDecryptRequest, buildDecryptAttenuation, buildDecryptFacts, buildDecryptInvocation, buildNetworkId, canonicalHashHex, canonicalSignedResponse, canonicalize as canonicalizeEncryptionJson, checkDecryptInvocationInput, decryptEnvelopeWithKey, deriveSignedReceiverKey, discoverNetwork, encryptToNetwork, encryptionError, ensureNetworkUsableForDecrypt, generateRandomReceiverKey, hexDecode, hexEncode, isNetworkId, networkDiscoveryKey, openWrappedKey, parseNetworkId, utf8Decode, utf8Encode, validateEnvelope, verifyDecryptResponse } from './encryption/index.js';
|
|
7
9
|
|
|
8
10
|
/**
|
|
9
11
|
* Zod schemas for SDK Services API response types.
|
|
@@ -1375,6 +1377,15 @@ declare class TinyCloudQuota {
|
|
|
1375
1377
|
*
|
|
1376
1378
|
* Type definitions for the Data Vault (encrypted KV) service operations.
|
|
1377
1379
|
*/
|
|
1380
|
+
|
|
1381
|
+
interface VaultNetworkEncryptionConfig {
|
|
1382
|
+
/** Default encryption network used for inline vault envelopes. */
|
|
1383
|
+
networkId: string;
|
|
1384
|
+
/** TinyCloud encryption module used for local encrypt and node-mediated decrypt. */
|
|
1385
|
+
service: IEncryptionService;
|
|
1386
|
+
/** Proof material presented to the encryption module for decrypt requests. */
|
|
1387
|
+
decryptCapabilityProof?: DecryptCapabilityProof | (() => DecryptCapabilityProof | Promise<DecryptCapabilityProof>);
|
|
1388
|
+
}
|
|
1378
1389
|
/**
|
|
1379
1390
|
* Configuration for DataVaultService.
|
|
1380
1391
|
*/
|
|
@@ -1383,6 +1394,8 @@ interface DataVaultConfig {
|
|
|
1383
1394
|
spaceId: string;
|
|
1384
1395
|
/** Key rotation policy */
|
|
1385
1396
|
keyRotation?: "per-write" | "per-key";
|
|
1397
|
+
/** Network-envelope encryption mode. When set, vault.unlock/key grants are not used. */
|
|
1398
|
+
encryption?: VaultNetworkEncryptionConfig;
|
|
1386
1399
|
}
|
|
1387
1400
|
/**
|
|
1388
1401
|
* Options for vault put operations.
|
|
@@ -1747,6 +1760,7 @@ declare class DataVaultService extends BaseService implements IDataVaultService
|
|
|
1747
1760
|
private encryptionIdentity;
|
|
1748
1761
|
private _isUnlocked;
|
|
1749
1762
|
private vaultConfig;
|
|
1763
|
+
private unlockInFlight;
|
|
1750
1764
|
/**
|
|
1751
1765
|
* Create a new DataVaultService instance.
|
|
1752
1766
|
*
|
|
@@ -1774,10 +1788,15 @@ declare class DataVaultService extends BaseService implements IDataVaultService
|
|
|
1774
1788
|
* Convenience accessor for TinyCloud instance.
|
|
1775
1789
|
*/
|
|
1776
1790
|
private get tc();
|
|
1791
|
+
private get networkEncryption();
|
|
1792
|
+
private get usesNetworkEncryption();
|
|
1777
1793
|
/**
|
|
1778
1794
|
* Get the host URL.
|
|
1779
1795
|
*/
|
|
1780
1796
|
private get host();
|
|
1797
|
+
private decryptCapabilityProof;
|
|
1798
|
+
private serializeValue;
|
|
1799
|
+
private deserializeValue;
|
|
1781
1800
|
/**
|
|
1782
1801
|
* Unlock the vault. Derives keys from two wallet signatures:
|
|
1783
1802
|
* 1. Master signature (per-space) — used to derive the master encryption key
|
|
@@ -1807,6 +1826,9 @@ declare class DataVaultService extends BaseService implements IDataVaultService
|
|
|
1807
1826
|
* Called when SDK signs out. Locks the vault and aborts operations.
|
|
1808
1827
|
*/
|
|
1809
1828
|
onSignOut(): void;
|
|
1829
|
+
private putNetworkEncrypted;
|
|
1830
|
+
private getNetworkEncrypted;
|
|
1831
|
+
private headNetworkEncrypted;
|
|
1810
1832
|
/**
|
|
1811
1833
|
* Encrypt and store a value at the given key.
|
|
1812
1834
|
*
|
|
@@ -1937,6 +1959,27 @@ interface WasmVaultFunctions {
|
|
|
1937
1959
|
}
|
|
1938
1960
|
declare function createVaultCrypto(wasm: WasmVaultFunctions): VaultCrypto;
|
|
1939
1961
|
|
|
1962
|
+
declare const SECRET_NAME_RE: RegExp;
|
|
1963
|
+
interface SecretScopeOptions {
|
|
1964
|
+
/** Optional logical scope. Omit for the global secret namespace. */
|
|
1965
|
+
scope?: string;
|
|
1966
|
+
}
|
|
1967
|
+
interface ResolvedSecretPath {
|
|
1968
|
+
/** Canonical env-style secret name. */
|
|
1969
|
+
name: string;
|
|
1970
|
+
/** Canonical scope. Undefined means global. */
|
|
1971
|
+
scope?: string;
|
|
1972
|
+
/** Key passed to the data vault service. */
|
|
1973
|
+
vaultKey: string;
|
|
1974
|
+
/** KV permission path that backs the encrypted vault entry. */
|
|
1975
|
+
permissionPaths: {
|
|
1976
|
+
vault: string;
|
|
1977
|
+
};
|
|
1978
|
+
}
|
|
1979
|
+
declare function canonicalizeSecretScope(scope: string | undefined): string | undefined;
|
|
1980
|
+
declare function resolveSecretPath(name: string, options?: SecretScopeOptions): ResolvedSecretPath;
|
|
1981
|
+
declare function resolveSecretListPrefix(options?: SecretScopeOptions): string;
|
|
1982
|
+
|
|
1940
1983
|
interface SecretPayload {
|
|
1941
1984
|
value: string;
|
|
1942
1985
|
createdAt: string;
|
|
@@ -1948,10 +1991,10 @@ interface ISecretsService {
|
|
|
1948
1991
|
unlock(signer?: unknown): Promise<Result<void, VaultError>>;
|
|
1949
1992
|
lock(): void;
|
|
1950
1993
|
readonly isUnlocked: boolean;
|
|
1951
|
-
get(name: string): Promise<Result<string, SecretsError>>;
|
|
1952
|
-
put(name: string, value: string): Promise<Result<void, SecretsError>>;
|
|
1953
|
-
delete(name: string): Promise<Result<void, SecretsError>>;
|
|
1954
|
-
list(): Promise<Result<string[], SecretsError>>;
|
|
1994
|
+
get(name: string, options?: SecretScopeOptions): Promise<Result<string, SecretsError>>;
|
|
1995
|
+
put(name: string, value: string, options?: SecretScopeOptions): Promise<Result<void, SecretsError>>;
|
|
1996
|
+
delete(name: string, options?: SecretScopeOptions): Promise<Result<void, SecretsError>>;
|
|
1997
|
+
list(options?: SecretScopeOptions): Promise<Result<string[], SecretsError>>;
|
|
1955
1998
|
}
|
|
1956
1999
|
|
|
1957
2000
|
declare class SecretsService implements ISecretsService {
|
|
@@ -1961,10 +2004,10 @@ declare class SecretsService implements ISecretsService {
|
|
|
1961
2004
|
get isUnlocked(): boolean;
|
|
1962
2005
|
unlock(signer?: unknown): Promise<Result<void, VaultError>>;
|
|
1963
2006
|
lock(): void;
|
|
1964
|
-
get(name: string): Promise<Result<string, SecretsError>>;
|
|
1965
|
-
put(name: string, value: string): Promise<Result<void, SecretsError>>;
|
|
1966
|
-
delete(name: string): Promise<Result<void, SecretsError>>;
|
|
1967
|
-
list(): Promise<Result<string[], SecretsError>>;
|
|
2007
|
+
get(name: string, options?: SecretScopeOptions): Promise<Result<string, SecretsError>>;
|
|
2008
|
+
put(name: string, value: string, options?: SecretScopeOptions): Promise<Result<void, SecretsError>>;
|
|
2009
|
+
delete(name: string, options?: SecretScopeOptions): Promise<Result<void, SecretsError>>;
|
|
2010
|
+
list(options?: SecretScopeOptions): Promise<Result<string[], SecretsError>>;
|
|
1968
2011
|
}
|
|
1969
2012
|
|
|
1970
|
-
export { BaseService, type BaseServiceOptions, type ColumnInfo, type DataVaultConfig, DataVaultService, DuckDbAction, type DuckDbActionType, type DuckDbBatchOptions, type BatchResponse as DuckDbBatchResponse, DuckDbDatabaseHandle, type DuckDbExecuteOptions, type ExecuteResponse as DuckDbExecuteResponse, type DuckDbOptions, type DuckDbQueryOptions, type QueryResponse as DuckDbQueryResponse, DuckDbService, type DuckDbServiceConfig, type DuckDbStatement, type DuckDbValue, FetchFunction, GenericKVResponseSchema, type GenericKVResponseType, GenericResultSchema, type HookEvent, type HookServiceName, type HookStreamEvent, type HookSubscription, type HookWebhookListOptions, type HookWebhookRecord, type HookWebhookRegistration, type HookWebhookScope, type HookWebhookUnregisterOptions, HooksService, type HooksServiceConfig, type IDataVaultService, type IDuckDbDatabaseHandle, type IDuckDbService, type IHooksService, IKVService, type ISecretsService, IService, IServiceContext, InvokeAnyFunction, InvokeFunction, KVListResponseSchema, type KVListResponseType, KVListResultSchema, type KVListResultType, KVResponseHeadersSchema, type KVResponseHeadersType, type QuotaConfig, type QuotaStatus, Result, RetryPolicy, RetryPolicySchema, type RetryPolicyType, type SchemaInfo, type SecretPayload, type SecretsError, SecretsService, type ServiceConstructor, ServiceContext, type ServiceContextConfig, ServiceError, ServiceErrorEventSchema, type ServiceErrorEventType, ServiceErrorSchema, type ServiceErrorType, type ServiceRegistration, ServiceRequestEventSchema, type ServiceRequestEventType, ServiceResponseEventSchema, type ServiceResponseEventType, ServiceRetryEventSchema, type ServiceRetryEventType, ServiceSession, ServiceSessionSchema, type ServiceSessionType, StorageQuotaInfo, type SubscribeOptions, type TableInfo, TinyCloudQuota, type ValidationError, type VaultCrypto, type VaultEntry, type VaultError, type VaultGetOptions, type VaultGrantOptions, VaultHeaders, type VaultListOptions, VaultPublicSpaceKVActions, type VaultPutOptions, type ViewInfo, type WasmVaultFunctions, abortedError, authExpiredError, authRequiredError, authUnauthorizedError, createKVResponseSchema, createResultSchema, createVaultCrypto, errorResult, networkError, notFoundError, parseAuthError, permissionDeniedError, storageLimitReachedError, storageQuotaExceededError, timeoutError, validateKVListResponse, validateKVResponseHeaders, validateRetryPolicy, validateServiceError, validateServiceRequestEvent, validateServiceResponseEvent, validateServiceSession, wrapError };
|
|
2013
|
+
export { BaseService, type BaseServiceOptions, type ColumnInfo, type DataVaultConfig, DataVaultService, DecryptCapabilityProof, DuckDbAction, type DuckDbActionType, type DuckDbBatchOptions, type BatchResponse as DuckDbBatchResponse, DuckDbDatabaseHandle, type DuckDbExecuteOptions, type ExecuteResponse as DuckDbExecuteResponse, type DuckDbOptions, type DuckDbQueryOptions, type QueryResponse as DuckDbQueryResponse, DuckDbService, type DuckDbServiceConfig, type DuckDbStatement, type DuckDbValue, FetchFunction, GenericKVResponseSchema, type GenericKVResponseType, GenericResultSchema, type HookEvent, type HookServiceName, type HookStreamEvent, type HookSubscription, type HookWebhookListOptions, type HookWebhookRecord, type HookWebhookRegistration, type HookWebhookScope, type HookWebhookUnregisterOptions, HooksService, type HooksServiceConfig, type IDataVaultService, type IDuckDbDatabaseHandle, type IDuckDbService, IEncryptionService, type IHooksService, IKVService, type ISecretsService, IService, IServiceContext, InvokeAnyFunction, InvokeFunction, KVListResponseSchema, type KVListResponseType, KVListResultSchema, type KVListResultType, KVResponseHeadersSchema, type KVResponseHeadersType, type QuotaConfig, type QuotaStatus, type ResolvedSecretPath, Result, RetryPolicy, RetryPolicySchema, type RetryPolicyType, SECRET_NAME_RE, type SchemaInfo, type SecretPayload, type SecretScopeOptions, type SecretsError, SecretsService, type ServiceConstructor, ServiceContext, type ServiceContextConfig, ServiceError, ServiceErrorEventSchema, type ServiceErrorEventType, ServiceErrorSchema, type ServiceErrorType, type ServiceRegistration, ServiceRequestEventSchema, type ServiceRequestEventType, ServiceResponseEventSchema, type ServiceResponseEventType, ServiceRetryEventSchema, type ServiceRetryEventType, ServiceSession, ServiceSessionSchema, type ServiceSessionType, StorageQuotaInfo, type SubscribeOptions, type TableInfo, TinyCloudQuota, type ValidationError, type VaultCrypto, type VaultEntry, type VaultError, type VaultGetOptions, type VaultGrantOptions, VaultHeaders, type VaultListOptions, VaultPublicSpaceKVActions, type VaultPutOptions, type ViewInfo, type WasmVaultFunctions, abortedError, authExpiredError, authRequiredError, authUnauthorizedError, canonicalizeSecretScope, createKVResponseSchema, createResultSchema, createVaultCrypto, errorResult, networkError, notFoundError, parseAuthError, permissionDeniedError, resolveSecretListPrefix, resolveSecretPath, storageLimitReachedError, storageQuotaExceededError, timeoutError, validateKVListResponse, validateKVResponseHeaders, validateRetryPolicy, validateServiceError, validateServiceRequestEvent, validateServiceResponseEvent, validateServiceSession, wrapError };
|