@tinycloud/sdk-core 2.4.0 → 2.5.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/index.cjs +38 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +27 -1
- package/dist/index.d.ts +27 -1
- package/dist/index.js +38 -0
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { InvokeFunction, InvokeAnyFunction, ParsedNetworkId, ServiceError, Result as Result$1, ServiceSession, FetchFunction, ServiceConstructor, RetryPolicy, TelemetryConfig, IServiceContext, IService, IKVService, ISQLService, IDuckDbService, IHooksService, IDataVaultService, IEncryptionService, IDatabaseHandle, SqlValue, QueryResponse } from '@tinycloud/sdk-services';
|
|
2
|
+
import { InvokeFunction, InvokeAnyFunction, ParsedNetworkId, ServiceError, Result as Result$1, ServiceSession, FetchFunction, ServiceConstructor, RetryPolicy, TelemetryConfig, IServiceContext, IService, IKVService, ISQLService, IDuckDbService, IHooksService, IDataVaultService, IEncryptionService, ISecretsService, IDatabaseHandle, SqlValue, QueryResponse } from '@tinycloud/sdk-services';
|
|
3
3
|
export { BatchOptions, BatchResponse, BuildCanonicalDecryptRequestInput, BuildDecryptFactsInput, BuildDecryptInvocationInput, BuiltDecryptInvocation, CanonicalDecryptRequest, CanonicalJson, ColumnInfo, DECRYPT_ACTION, DECRYPT_FACT_TYPE, DECRYPT_RESULT_TYPE, DEFAULT_ENCRYPTION_ALG, DEFAULT_KEY_VERSION, DataVaultConfig, DataVaultService, DatabaseHandle, DecryptCapabilityProof, DecryptEnvelopeOptions, DecryptInvocationFact, DecryptInvocationSigner, DecryptRequestBody, DecryptResponseBody, DecryptTransport, 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, EncryptToNetworkInput, EncryptToNetworkOptions, EncryptToNetworkResult, EncryptionCrypto, EncryptionError, EncryptionErrorInput, EncryptionService, EncryptionServiceConfig, ErrorCode, ErrorCodes, ExecuteOptions, ExecuteResponse, FetchFunction, HookEvent, HookServiceName, HookStreamEvent, HookSubscription, HookWebhookListOptions, HookWebhookRecord, HookWebhookRegistration, HookWebhookScope, HookWebhookUnregisterOptions, HooksService, HooksServiceConfig, IDataVaultService, IDatabaseHandle, IDuckDbDatabaseHandle, IDuckDbService, IEncryptionService, IHooksService, IKVService, IPrefixedKVService, ISQLService, ISecretsService, IService, IServiceContext, InlineEncryptedEnvelope, InvokeAnyEntry, InvokeAnyFunction, InvokeFunction, KVCreateSignedReadUrlOptions, KVDeleteOptions, KVGetOptions, KVHeadOptions, KVListOptions, KVListResponse, KVPutOptions, KVResponse, KVResponseHeaders, KVService, KVServiceConfig, KVSignedReadUrlResponse, NETWORK_NAME_PATTERN, NetworkDescriptor, NetworkIdError, NodeDescriptorFetcher, ParsedNetworkId, PrefixedKVService, QueryOptions, QueryResponse, RandomReceiverKeyInput, ReceiverKeyPair, ReceiverKeySigner, ResolvedSecretPath, Result, RetryPolicy, SECRET_NAME_RE, SQLAction, SQLActionType, SQLService, SQLServiceConfig, SchemaInfo, SecretPayload, SecretScopeOptions, SecretsError, SecretsService, ServiceContext, ServiceContextConfig, ServiceError, ServiceSession, SignedReceiverKeyInput, SqlStatement, SqlValue, SubscribeOptions, TableInfo, TelemetryConfig, TelemetryEventHandler, TinyCloudDebugEnableOptions, TinyCloudDebugEvent, TinyCloudDebugLevel, TinyCloudDebugLogger, TinyCloudDebugTimer, VaultCrypto, VaultEntry, VaultError, VaultGetOptions, VaultGrantOptions, VaultHeaders, VaultListOptions, VaultPublicSpaceKVActions, VaultPutOptions, VerifyDecryptResponseInput, ViewInfo, WasmVaultFunctions, WellKnownDescriptorFetcher, buildCanonicalDecryptRequest, buildDecryptAttenuation, buildDecryptFacts, buildDecryptInvocation, buildNetworkId, canonicalHashHex, canonicalSignedResponse, canonicalizeEncryptionJson, canonicalizeSecretScope, checkDecryptInvocationInput, clearTinyCloudDebugLogs, createVaultCrypto, decryptEnvelopeWithKey, defaultRetryPolicy, deriveSignedReceiverKey, disableTinyCloudDebug, discoverNetwork, enableTinyCloudDebug, encryptToNetwork, base64Decode as encryptionBase64Decode, base64Encode as encryptionBase64Encode, encryptionError, utf8Decode as encryptionUtf8Decode, utf8Encode as encryptionUtf8Encode, ensureNetworkUsableForDecrypt, err, generateRandomReceiverKey, getTinyCloudDebugLogs, hexDecode, hexEncode, installTinyCloudDebugGlobals, isNetworkId, networkDiscoveryKey, ok, openWrappedKey, parseNetworkId, resolveSecretListPrefix, resolveSecretPath, serviceError, tinyCloudDebugLogger, validateEnvelope, verifyDecryptResponse } from '@tinycloud/sdk-services';
|
|
4
4
|
export { ACCOUNT_INDEX_SCHEMA, BOOTSTRAP_ALLOWLIST, BOOTSTRAP_DEFAULT_SPACE, BOOTSTRAP_ENCRYPTION_NETWORK_NAME, BOOTSTRAP_ENCRYPTION_NETWORK_RESOURCE_TEMPLATE, BOOTSTRAP_MANIFEST, BOOTSTRAP_PERSISTED_APPLICATION_MANIFESTS, BOOTSTRAP_PUBLIC_SPACE, BOOTSTRAP_SESSION_REQUESTS, BOOTSTRAP_SPACE_MANIFESTS, BOOTSTRAP_SPACE_NAMES, BootstrapAllowlistEntry, BootstrapAllowlistKind, BootstrapEncryptionNetworkStep, BootstrapManifest, BootstrapRawAbilityAllowlistEntry, BootstrapSchemaStep, BootstrapSeedApplicationsStep, BootstrapSeedSpacesStep, BootstrapSpaceDescriptor, BootstrapSpaceName, BootstrapSpaceStep, BootstrapStep, BootstrapStepKind, SECRET_RECORDS_SCHEMA, TINYCLOUD_ACCOUNT_SPACE_MANIFEST, TINYCLOUD_APPLICATIONS_SPACE_MANIFEST, TINYCLOUD_DEFAULT_SPACE_MANIFEST, TINYCLOUD_PUBLIC_SPACE_MANIFEST, TINYCLOUD_SECRETS_BOOTSTRAP_MANIFEST, bootstrapEncryptionNetworkId, bootstrapSpaceId, bootstrapSteps, composeBootstrapSpaceManifest } from '@tinycloud/bootstrap';
|
|
5
5
|
export { SiweMessage } from 'siwe';
|
|
@@ -2918,6 +2918,12 @@ interface SignRequest {
|
|
|
2918
2918
|
message: string;
|
|
2919
2919
|
/** Type of sign operation */
|
|
2920
2920
|
type: "siwe" | "message";
|
|
2921
|
+
/**
|
|
2922
|
+
* What the signature is for. Lets strategies apply different policies to
|
|
2923
|
+
* account-bootstrap signatures (which may be auto-signed server-side)
|
|
2924
|
+
* versus the user-initiated sign-in. Absent on requests from older SDKs.
|
|
2925
|
+
*/
|
|
2926
|
+
purpose?: "sign-in" | "bootstrap-session" | "bootstrap-host" | "message";
|
|
2921
2927
|
}
|
|
2922
2928
|
/**
|
|
2923
2929
|
* Sign response from callback or event handlers.
|
|
@@ -4149,6 +4155,10 @@ interface ISpace {
|
|
|
4149
4155
|
* Data Vault operations scoped to this space.
|
|
4150
4156
|
*/
|
|
4151
4157
|
readonly vault: IDataVaultService;
|
|
4158
|
+
/**
|
|
4159
|
+
* Secrets operations scoped to this space.
|
|
4160
|
+
*/
|
|
4161
|
+
readonly secrets: ISecretsService;
|
|
4152
4162
|
/**
|
|
4153
4163
|
* Delegation operations scoped to this space.
|
|
4154
4164
|
*/
|
|
@@ -4182,6 +4192,10 @@ interface SpaceConfig {
|
|
|
4182
4192
|
* Factory function to create a space-scoped Data Vault service.
|
|
4183
4193
|
*/
|
|
4184
4194
|
createVault: (spaceId: string) => IDataVaultService;
|
|
4195
|
+
/**
|
|
4196
|
+
* Factory function to create a space-scoped secrets service.
|
|
4197
|
+
*/
|
|
4198
|
+
createSecrets?: (spaceId: string) => ISecretsService;
|
|
4185
4199
|
/**
|
|
4186
4200
|
* Factory function to create space-scoped delegations.
|
|
4187
4201
|
*/
|
|
@@ -4222,6 +4236,7 @@ declare class Space implements ISpace {
|
|
|
4222
4236
|
private readonly _name;
|
|
4223
4237
|
private readonly _kv;
|
|
4224
4238
|
private readonly _vault;
|
|
4239
|
+
private readonly _secrets;
|
|
4225
4240
|
private readonly _delegations;
|
|
4226
4241
|
private readonly _sharing;
|
|
4227
4242
|
private readonly _getInfo;
|
|
@@ -4247,6 +4262,10 @@ declare class Space implements ISpace {
|
|
|
4247
4262
|
* Data Vault operations scoped to this space.
|
|
4248
4263
|
*/
|
|
4249
4264
|
get vault(): IDataVaultService;
|
|
4265
|
+
/**
|
|
4266
|
+
* Secrets operations scoped to this space.
|
|
4267
|
+
*/
|
|
4268
|
+
get secrets(): ISecretsService;
|
|
4250
4269
|
/**
|
|
4251
4270
|
* Delegation operations scoped to this space.
|
|
4252
4271
|
*/
|
|
@@ -4324,6 +4343,8 @@ interface SpaceServiceConfig {
|
|
|
4324
4343
|
createKVService?: (spaceId: string) => IKVService;
|
|
4325
4344
|
/** Factory function to create a space-scoped Data Vault service */
|
|
4326
4345
|
createVaultService?: (spaceId: string) => IDataVaultService;
|
|
4346
|
+
/** Factory function to create a space-scoped secrets service */
|
|
4347
|
+
createSecretsService?: (spaceId: string) => ISecretsService;
|
|
4327
4348
|
/** User's PKH DID (derived from address or provided explicitly) */
|
|
4328
4349
|
userDid?: string;
|
|
4329
4350
|
/** Optional SharingService for v2 sharing links (client-side) */
|
|
@@ -4453,6 +4474,7 @@ declare class SpaceService implements ISpaceService {
|
|
|
4453
4474
|
private capabilityRegistry?;
|
|
4454
4475
|
private createKVServiceFn?;
|
|
4455
4476
|
private createVaultServiceFn?;
|
|
4477
|
+
private createSecretsServiceFn?;
|
|
4456
4478
|
private _userDid?;
|
|
4457
4479
|
private sharingService?;
|
|
4458
4480
|
private createDelegationFn?;
|
|
@@ -4541,6 +4563,10 @@ declare class SpaceService implements ISpaceService {
|
|
|
4541
4563
|
* Create a space-scoped Data Vault service.
|
|
4542
4564
|
*/
|
|
4543
4565
|
private createSpaceScopedVault;
|
|
4566
|
+
/**
|
|
4567
|
+
* Create a space-scoped secrets service.
|
|
4568
|
+
*/
|
|
4569
|
+
private createSpaceScopedSecrets;
|
|
4544
4570
|
/**
|
|
4545
4571
|
* Create space-scoped delegation operations.
|
|
4546
4572
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { InvokeFunction, InvokeAnyFunction, ParsedNetworkId, ServiceError, Result as Result$1, ServiceSession, FetchFunction, ServiceConstructor, RetryPolicy, TelemetryConfig, IServiceContext, IService, IKVService, ISQLService, IDuckDbService, IHooksService, IDataVaultService, IEncryptionService, IDatabaseHandle, SqlValue, QueryResponse } from '@tinycloud/sdk-services';
|
|
2
|
+
import { InvokeFunction, InvokeAnyFunction, ParsedNetworkId, ServiceError, Result as Result$1, ServiceSession, FetchFunction, ServiceConstructor, RetryPolicy, TelemetryConfig, IServiceContext, IService, IKVService, ISQLService, IDuckDbService, IHooksService, IDataVaultService, IEncryptionService, ISecretsService, IDatabaseHandle, SqlValue, QueryResponse } from '@tinycloud/sdk-services';
|
|
3
3
|
export { BatchOptions, BatchResponse, BuildCanonicalDecryptRequestInput, BuildDecryptFactsInput, BuildDecryptInvocationInput, BuiltDecryptInvocation, CanonicalDecryptRequest, CanonicalJson, ColumnInfo, DECRYPT_ACTION, DECRYPT_FACT_TYPE, DECRYPT_RESULT_TYPE, DEFAULT_ENCRYPTION_ALG, DEFAULT_KEY_VERSION, DataVaultConfig, DataVaultService, DatabaseHandle, DecryptCapabilityProof, DecryptEnvelopeOptions, DecryptInvocationFact, DecryptInvocationSigner, DecryptRequestBody, DecryptResponseBody, DecryptTransport, 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, EncryptToNetworkInput, EncryptToNetworkOptions, EncryptToNetworkResult, EncryptionCrypto, EncryptionError, EncryptionErrorInput, EncryptionService, EncryptionServiceConfig, ErrorCode, ErrorCodes, ExecuteOptions, ExecuteResponse, FetchFunction, HookEvent, HookServiceName, HookStreamEvent, HookSubscription, HookWebhookListOptions, HookWebhookRecord, HookWebhookRegistration, HookWebhookScope, HookWebhookUnregisterOptions, HooksService, HooksServiceConfig, IDataVaultService, IDatabaseHandle, IDuckDbDatabaseHandle, IDuckDbService, IEncryptionService, IHooksService, IKVService, IPrefixedKVService, ISQLService, ISecretsService, IService, IServiceContext, InlineEncryptedEnvelope, InvokeAnyEntry, InvokeAnyFunction, InvokeFunction, KVCreateSignedReadUrlOptions, KVDeleteOptions, KVGetOptions, KVHeadOptions, KVListOptions, KVListResponse, KVPutOptions, KVResponse, KVResponseHeaders, KVService, KVServiceConfig, KVSignedReadUrlResponse, NETWORK_NAME_PATTERN, NetworkDescriptor, NetworkIdError, NodeDescriptorFetcher, ParsedNetworkId, PrefixedKVService, QueryOptions, QueryResponse, RandomReceiverKeyInput, ReceiverKeyPair, ReceiverKeySigner, ResolvedSecretPath, Result, RetryPolicy, SECRET_NAME_RE, SQLAction, SQLActionType, SQLService, SQLServiceConfig, SchemaInfo, SecretPayload, SecretScopeOptions, SecretsError, SecretsService, ServiceContext, ServiceContextConfig, ServiceError, ServiceSession, SignedReceiverKeyInput, SqlStatement, SqlValue, SubscribeOptions, TableInfo, TelemetryConfig, TelemetryEventHandler, TinyCloudDebugEnableOptions, TinyCloudDebugEvent, TinyCloudDebugLevel, TinyCloudDebugLogger, TinyCloudDebugTimer, VaultCrypto, VaultEntry, VaultError, VaultGetOptions, VaultGrantOptions, VaultHeaders, VaultListOptions, VaultPublicSpaceKVActions, VaultPutOptions, VerifyDecryptResponseInput, ViewInfo, WasmVaultFunctions, WellKnownDescriptorFetcher, buildCanonicalDecryptRequest, buildDecryptAttenuation, buildDecryptFacts, buildDecryptInvocation, buildNetworkId, canonicalHashHex, canonicalSignedResponse, canonicalizeEncryptionJson, canonicalizeSecretScope, checkDecryptInvocationInput, clearTinyCloudDebugLogs, createVaultCrypto, decryptEnvelopeWithKey, defaultRetryPolicy, deriveSignedReceiverKey, disableTinyCloudDebug, discoverNetwork, enableTinyCloudDebug, encryptToNetwork, base64Decode as encryptionBase64Decode, base64Encode as encryptionBase64Encode, encryptionError, utf8Decode as encryptionUtf8Decode, utf8Encode as encryptionUtf8Encode, ensureNetworkUsableForDecrypt, err, generateRandomReceiverKey, getTinyCloudDebugLogs, hexDecode, hexEncode, installTinyCloudDebugGlobals, isNetworkId, networkDiscoveryKey, ok, openWrappedKey, parseNetworkId, resolveSecretListPrefix, resolveSecretPath, serviceError, tinyCloudDebugLogger, validateEnvelope, verifyDecryptResponse } from '@tinycloud/sdk-services';
|
|
4
4
|
export { ACCOUNT_INDEX_SCHEMA, BOOTSTRAP_ALLOWLIST, BOOTSTRAP_DEFAULT_SPACE, BOOTSTRAP_ENCRYPTION_NETWORK_NAME, BOOTSTRAP_ENCRYPTION_NETWORK_RESOURCE_TEMPLATE, BOOTSTRAP_MANIFEST, BOOTSTRAP_PERSISTED_APPLICATION_MANIFESTS, BOOTSTRAP_PUBLIC_SPACE, BOOTSTRAP_SESSION_REQUESTS, BOOTSTRAP_SPACE_MANIFESTS, BOOTSTRAP_SPACE_NAMES, BootstrapAllowlistEntry, BootstrapAllowlistKind, BootstrapEncryptionNetworkStep, BootstrapManifest, BootstrapRawAbilityAllowlistEntry, BootstrapSchemaStep, BootstrapSeedApplicationsStep, BootstrapSeedSpacesStep, BootstrapSpaceDescriptor, BootstrapSpaceName, BootstrapSpaceStep, BootstrapStep, BootstrapStepKind, SECRET_RECORDS_SCHEMA, TINYCLOUD_ACCOUNT_SPACE_MANIFEST, TINYCLOUD_APPLICATIONS_SPACE_MANIFEST, TINYCLOUD_DEFAULT_SPACE_MANIFEST, TINYCLOUD_PUBLIC_SPACE_MANIFEST, TINYCLOUD_SECRETS_BOOTSTRAP_MANIFEST, bootstrapEncryptionNetworkId, bootstrapSpaceId, bootstrapSteps, composeBootstrapSpaceManifest } from '@tinycloud/bootstrap';
|
|
5
5
|
export { SiweMessage } from 'siwe';
|
|
@@ -2918,6 +2918,12 @@ interface SignRequest {
|
|
|
2918
2918
|
message: string;
|
|
2919
2919
|
/** Type of sign operation */
|
|
2920
2920
|
type: "siwe" | "message";
|
|
2921
|
+
/**
|
|
2922
|
+
* What the signature is for. Lets strategies apply different policies to
|
|
2923
|
+
* account-bootstrap signatures (which may be auto-signed server-side)
|
|
2924
|
+
* versus the user-initiated sign-in. Absent on requests from older SDKs.
|
|
2925
|
+
*/
|
|
2926
|
+
purpose?: "sign-in" | "bootstrap-session" | "bootstrap-host" | "message";
|
|
2921
2927
|
}
|
|
2922
2928
|
/**
|
|
2923
2929
|
* Sign response from callback or event handlers.
|
|
@@ -4149,6 +4155,10 @@ interface ISpace {
|
|
|
4149
4155
|
* Data Vault operations scoped to this space.
|
|
4150
4156
|
*/
|
|
4151
4157
|
readonly vault: IDataVaultService;
|
|
4158
|
+
/**
|
|
4159
|
+
* Secrets operations scoped to this space.
|
|
4160
|
+
*/
|
|
4161
|
+
readonly secrets: ISecretsService;
|
|
4152
4162
|
/**
|
|
4153
4163
|
* Delegation operations scoped to this space.
|
|
4154
4164
|
*/
|
|
@@ -4182,6 +4192,10 @@ interface SpaceConfig {
|
|
|
4182
4192
|
* Factory function to create a space-scoped Data Vault service.
|
|
4183
4193
|
*/
|
|
4184
4194
|
createVault: (spaceId: string) => IDataVaultService;
|
|
4195
|
+
/**
|
|
4196
|
+
* Factory function to create a space-scoped secrets service.
|
|
4197
|
+
*/
|
|
4198
|
+
createSecrets?: (spaceId: string) => ISecretsService;
|
|
4185
4199
|
/**
|
|
4186
4200
|
* Factory function to create space-scoped delegations.
|
|
4187
4201
|
*/
|
|
@@ -4222,6 +4236,7 @@ declare class Space implements ISpace {
|
|
|
4222
4236
|
private readonly _name;
|
|
4223
4237
|
private readonly _kv;
|
|
4224
4238
|
private readonly _vault;
|
|
4239
|
+
private readonly _secrets;
|
|
4225
4240
|
private readonly _delegations;
|
|
4226
4241
|
private readonly _sharing;
|
|
4227
4242
|
private readonly _getInfo;
|
|
@@ -4247,6 +4262,10 @@ declare class Space implements ISpace {
|
|
|
4247
4262
|
* Data Vault operations scoped to this space.
|
|
4248
4263
|
*/
|
|
4249
4264
|
get vault(): IDataVaultService;
|
|
4265
|
+
/**
|
|
4266
|
+
* Secrets operations scoped to this space.
|
|
4267
|
+
*/
|
|
4268
|
+
get secrets(): ISecretsService;
|
|
4250
4269
|
/**
|
|
4251
4270
|
* Delegation operations scoped to this space.
|
|
4252
4271
|
*/
|
|
@@ -4324,6 +4343,8 @@ interface SpaceServiceConfig {
|
|
|
4324
4343
|
createKVService?: (spaceId: string) => IKVService;
|
|
4325
4344
|
/** Factory function to create a space-scoped Data Vault service */
|
|
4326
4345
|
createVaultService?: (spaceId: string) => IDataVaultService;
|
|
4346
|
+
/** Factory function to create a space-scoped secrets service */
|
|
4347
|
+
createSecretsService?: (spaceId: string) => ISecretsService;
|
|
4327
4348
|
/** User's PKH DID (derived from address or provided explicitly) */
|
|
4328
4349
|
userDid?: string;
|
|
4329
4350
|
/** Optional SharingService for v2 sharing links (client-side) */
|
|
@@ -4453,6 +4474,7 @@ declare class SpaceService implements ISpaceService {
|
|
|
4453
4474
|
private capabilityRegistry?;
|
|
4454
4475
|
private createKVServiceFn?;
|
|
4455
4476
|
private createVaultServiceFn?;
|
|
4477
|
+
private createSecretsServiceFn?;
|
|
4456
4478
|
private _userDid?;
|
|
4457
4479
|
private sharingService?;
|
|
4458
4480
|
private createDelegationFn?;
|
|
@@ -4541,6 +4563,10 @@ declare class SpaceService implements ISpaceService {
|
|
|
4541
4563
|
* Create a space-scoped Data Vault service.
|
|
4542
4564
|
*/
|
|
4543
4565
|
private createSpaceScopedVault;
|
|
4566
|
+
/**
|
|
4567
|
+
* Create a space-scoped secrets service.
|
|
4568
|
+
*/
|
|
4569
|
+
private createSpaceScopedSecrets;
|
|
4544
4570
|
/**
|
|
4545
4571
|
* Create space-scoped delegation operations.
|
|
4546
4572
|
*/
|
package/dist/index.js
CHANGED
|
@@ -257,6 +257,15 @@ import {
|
|
|
257
257
|
import { ok, err, serviceError } from "@tinycloud/sdk-services";
|
|
258
258
|
|
|
259
259
|
// src/spaces/Space.ts
|
|
260
|
+
function unavailableSecretsService() {
|
|
261
|
+
return new Proxy({}, {
|
|
262
|
+
get: () => {
|
|
263
|
+
throw new Error(
|
|
264
|
+
"Secrets service factory not configured. Provide createSecrets in SpaceConfig."
|
|
265
|
+
);
|
|
266
|
+
}
|
|
267
|
+
});
|
|
268
|
+
}
|
|
260
269
|
var Space = class {
|
|
261
270
|
/**
|
|
262
271
|
* Create a new Space instance.
|
|
@@ -268,6 +277,7 @@ var Space = class {
|
|
|
268
277
|
this._name = config.name;
|
|
269
278
|
this._kv = config.createKV(config.id);
|
|
270
279
|
this._vault = config.createVault(config.id);
|
|
280
|
+
this._secrets = config.createSecrets?.(config.id) ?? unavailableSecretsService();
|
|
271
281
|
this._delegations = config.createDelegations(config.id);
|
|
272
282
|
this._sharing = config.createSharing(config.id);
|
|
273
283
|
this._getInfo = config.getInfo;
|
|
@@ -296,6 +306,12 @@ var Space = class {
|
|
|
296
306
|
get vault() {
|
|
297
307
|
return this._vault;
|
|
298
308
|
}
|
|
309
|
+
/**
|
|
310
|
+
* Secrets operations scoped to this space.
|
|
311
|
+
*/
|
|
312
|
+
get secrets() {
|
|
313
|
+
return this._secrets;
|
|
314
|
+
}
|
|
299
315
|
/**
|
|
300
316
|
* Delegation operations scoped to this space.
|
|
301
317
|
*/
|
|
@@ -681,6 +697,8 @@ var SpaceConfigSchema = z4.object({
|
|
|
681
697
|
createKV: z4.function(),
|
|
682
698
|
/** Factory function to create a space-scoped Data Vault service */
|
|
683
699
|
createVault: z4.function(),
|
|
700
|
+
/** Optional factory function to create a space-scoped secrets service */
|
|
701
|
+
createSecrets: z4.function().optional(),
|
|
684
702
|
/** Factory function to create space-scoped delegations */
|
|
685
703
|
createDelegations: z4.function(),
|
|
686
704
|
/** Factory function to create space-scoped sharing */
|
|
@@ -703,6 +721,8 @@ var SpaceServiceConfigSchema = z4.object({
|
|
|
703
721
|
createKVService: z4.function().optional(),
|
|
704
722
|
/** Factory function to create a space-scoped Data Vault service */
|
|
705
723
|
createVaultService: z4.function().optional(),
|
|
724
|
+
/** Factory function to create a space-scoped secrets service */
|
|
725
|
+
createSecretsService: z4.function().optional(),
|
|
706
726
|
/** User's PKH DID (derived from address or provided explicitly) */
|
|
707
727
|
userDid: z4.string().optional(),
|
|
708
728
|
/** Optional SharingService for v2 sharing links (client-side) */
|
|
@@ -975,6 +995,7 @@ var SpaceService = class {
|
|
|
975
995
|
this.capabilityRegistry = config.capabilityRegistry;
|
|
976
996
|
this.createKVServiceFn = config.createKVService;
|
|
977
997
|
this.createVaultServiceFn = config.createVaultService;
|
|
998
|
+
this.createSecretsServiceFn = config.createSecretsService;
|
|
978
999
|
this._userDid = config.userDid;
|
|
979
1000
|
this.sharingService = config.sharingService;
|
|
980
1001
|
this.createDelegationFn = config.createDelegation;
|
|
@@ -991,6 +1012,7 @@ var SpaceService = class {
|
|
|
991
1012
|
if (config.capabilityRegistry) this.capabilityRegistry = config.capabilityRegistry;
|
|
992
1013
|
if (config.createKVService) this.createKVServiceFn = config.createKVService;
|
|
993
1014
|
if (config.createVaultService) this.createVaultServiceFn = config.createVaultService;
|
|
1015
|
+
if (config.createSecretsService) this.createSecretsServiceFn = config.createSecretsService;
|
|
994
1016
|
if (config.userDid !== void 0) this._userDid = config.userDid;
|
|
995
1017
|
if (config.sharingService) this.sharingService = config.sharingService;
|
|
996
1018
|
if (config.createDelegation) this.createDelegationFn = config.createDelegation;
|
|
@@ -1284,6 +1306,7 @@ var SpaceService = class {
|
|
|
1284
1306
|
name,
|
|
1285
1307
|
createKV: this.createSpaceScopedKV.bind(this),
|
|
1286
1308
|
createVault: this.createSpaceScopedVault.bind(this),
|
|
1309
|
+
createSecrets: this.createSpaceScopedSecrets.bind(this),
|
|
1287
1310
|
createDelegations: this.createSpaceScopedDelegations.bind(this),
|
|
1288
1311
|
createSharing: this.createSpaceScopedSharing.bind(this),
|
|
1289
1312
|
getInfo: this.getSpaceInfo.bind(this)
|
|
@@ -1428,6 +1451,21 @@ var SpaceService = class {
|
|
|
1428
1451
|
}
|
|
1429
1452
|
});
|
|
1430
1453
|
}
|
|
1454
|
+
/**
|
|
1455
|
+
* Create a space-scoped secrets service.
|
|
1456
|
+
*/
|
|
1457
|
+
createSpaceScopedSecrets(spaceId) {
|
|
1458
|
+
if (this.createSecretsServiceFn) {
|
|
1459
|
+
return this.createSecretsServiceFn(spaceId);
|
|
1460
|
+
}
|
|
1461
|
+
return new Proxy({}, {
|
|
1462
|
+
get: () => {
|
|
1463
|
+
throw new Error(
|
|
1464
|
+
"Secrets service factory not configured. Provide createSecretsService in SpaceServiceConfig."
|
|
1465
|
+
);
|
|
1466
|
+
}
|
|
1467
|
+
});
|
|
1468
|
+
}
|
|
1431
1469
|
/**
|
|
1432
1470
|
* Create space-scoped delegation operations.
|
|
1433
1471
|
*/
|