@tinycloud/sdk-core 2.2.0-beta.0 → 2.2.0-beta.10

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.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { InvokeFunction, InvokeAnyFunction, ServiceError, Result as Result$1, ServiceSession, FetchFunction, ServiceConstructor, RetryPolicy, IServiceContext, IService, IKVService, ISQLService, IDuckDbService, IHooksService, IDataVaultService } from '@tinycloud/sdk-services';
3
- export { BatchOptions, BatchResponse, ColumnInfo, DataVaultConfig, DataVaultService, DatabaseHandle, DuckDbAction, DuckDbActionType, DuckDbBatchOptions, DuckDbBatchResponse, DuckDbDatabaseHandle, DuckDbExecuteOptions, DuckDbExecuteResponse, DuckDbOptions, DuckDbQueryOptions, DuckDbQueryResponse, DuckDbService, DuckDbServiceConfig, DuckDbStatement, DuckDbValue, ErrorCode, ErrorCodes, ExecuteOptions, ExecuteResponse, FetchFunction, HookEvent, HookServiceName, HookStreamEvent, HookSubscription, HookWebhookListOptions, HookWebhookRecord, HookWebhookRegistration, HookWebhookScope, HookWebhookUnregisterOptions, HooksService, HooksServiceConfig, IDataVaultService, IDatabaseHandle, IDuckDbDatabaseHandle, IDuckDbService, IHooksService, IKVService, IPrefixedKVService, ISQLService, IService, IServiceContext, InvokeAnyEntry, InvokeAnyFunction, InvokeFunction, KVDeleteOptions, KVGetOptions, KVHeadOptions, KVListOptions, KVListResponse, KVPutOptions, KVResponse, KVResponseHeaders, KVService, KVServiceConfig, PrefixedKVService, QueryOptions, QueryResponse, Result, RetryPolicy, SQLAction, SQLActionType, SQLService, SQLServiceConfig, SchemaInfo, ServiceContext, ServiceContextConfig, ServiceError, ServiceSession, SqlStatement, SqlValue, SubscribeOptions, TableInfo, VaultCrypto, VaultEntry, VaultError, VaultGetOptions, VaultGrantOptions, VaultHeaders, VaultListOptions, VaultPublicSpaceKVActions, VaultPutOptions, ViewInfo, WasmVaultFunctions, createVaultCrypto, defaultRetryPolicy, err, ok, serviceError } from '@tinycloud/sdk-services';
3
+ export { BatchOptions, BatchResponse, ColumnInfo, DataVaultConfig, DataVaultService, DatabaseHandle, DuckDbAction, DuckDbActionType, DuckDbBatchOptions, DuckDbBatchResponse, DuckDbDatabaseHandle, DuckDbExecuteOptions, DuckDbExecuteResponse, DuckDbOptions, DuckDbQueryOptions, DuckDbQueryResponse, DuckDbService, DuckDbServiceConfig, DuckDbStatement, DuckDbValue, ErrorCode, ErrorCodes, ExecuteOptions, ExecuteResponse, FetchFunction, HookEvent, HookServiceName, HookStreamEvent, HookSubscription, HookWebhookListOptions, HookWebhookRecord, HookWebhookRegistration, HookWebhookScope, HookWebhookUnregisterOptions, HooksService, HooksServiceConfig, IDataVaultService, IDatabaseHandle, IDuckDbDatabaseHandle, IDuckDbService, IHooksService, IKVService, IPrefixedKVService, ISQLService, ISecretsService, IService, IServiceContext, InvokeAnyEntry, InvokeAnyFunction, InvokeFunction, KVDeleteOptions, KVGetOptions, KVHeadOptions, KVListOptions, KVListResponse, KVPutOptions, KVResponse, KVResponseHeaders, KVService, KVServiceConfig, PrefixedKVService, QueryOptions, QueryResponse, ResolvedSecretPath, Result, RetryPolicy, SECRET_NAME_RE, SQLAction, SQLActionType, SQLService, SQLServiceConfig, SchemaInfo, SecretPayload, SecretScopeOptions, SecretsError, SecretsService, ServiceContext, ServiceContextConfig, ServiceError, ServiceSession, SqlStatement, SqlValue, SubscribeOptions, TableInfo, VaultCrypto, VaultEntry, VaultError, VaultGetOptions, VaultGrantOptions, VaultHeaders, VaultListOptions, VaultPublicSpaceKVActions, VaultPutOptions, ViewInfo, WasmVaultFunctions, canonicalizeSecretScope, createVaultCrypto, defaultRetryPolicy, err, ok, resolveSecretPath, serviceError } from '@tinycloud/sdk-services';
4
4
  export { SiweMessage } from 'siwe';
5
5
 
6
6
  /**
@@ -200,8 +200,9 @@ interface IENSResolver {
200
200
  * in their `manifest.json` and the shape we compare against when performing
201
201
  * the capability-subset derivability check in the delegation flow.
202
202
  *
203
- * `service` uses the long form (e.g. `"tinycloud.kv"`, `"tinycloud.sql"`)
204
- * which matches the ability-namespace half of the full action URN.
203
+ * `service` uses the long form (e.g. `"tinycloud.kv"`, `"tinycloud.sql"`).
204
+ * `"tinycloud.vault"` is an SDK-only shorthand that expands to the KV
205
+ * resources the vault service uses; it is never encoded as a recap service.
205
206
  */
206
207
  interface PermissionEntry {
207
208
  /** Service namespace, e.g. "tinycloud.kv", "tinycloud.sql", "tinycloud.duckdb", "tinycloud.capabilities". */
@@ -226,13 +227,24 @@ interface PermissionEntry {
226
227
  skipPrefix?: boolean;
227
228
  /** Per-entry expiry override, ms-format. */
228
229
  expiry?: string;
230
+ /** User/agent-facing context for why this permission is requested. */
231
+ description?: string;
229
232
  }
233
+ type ManifestSecretActions = true | string | string[] | {
234
+ /** Actual vault secret name. Defaults to the manifest object key. */
235
+ name?: string;
236
+ /** Optional scoped secret namespace. Omit for global secrets. */
237
+ scope?: string;
238
+ actions?: string | string[];
239
+ expiry?: string;
240
+ description?: string;
241
+ };
230
242
  /**
231
243
  * The valid values for `Manifest.defaults`.
232
244
  *
233
245
  * - `false` → no auto-included permissions
234
246
  * - `true` → standard tier (KV + SQL read/write + capabilities:read)
235
- * - `"admin"` → standard + SQL ddl + capabilities:admin
247
+ * - `"admin"` → standard + SQL ddl
236
248
  * - `"all"` → everything the SDK supports (including DuckDB)
237
249
  *
238
250
  * Unknown string values silently fall back to `true`. Values are normalized
@@ -279,6 +291,11 @@ interface Manifest {
279
291
  * DuckDB (opt-in), or `skipPrefix: true` entries.
280
292
  */
281
293
  permissions?: PermissionEntry[];
294
+ /**
295
+ * Secret name shorthand. Entries resolve to encrypted vault KV resources in
296
+ * the `secrets` space.
297
+ */
298
+ secrets?: Record<string, ManifestSecretActions>;
282
299
  }
283
300
  /**
284
301
  * A resolved permission entry with fully-expanded paths and action URNs.
@@ -296,6 +313,8 @@ interface ResourceCapability {
296
313
  actions: string[];
297
314
  /** Per-entry expiry override in milliseconds. */
298
315
  expiryMs?: number;
316
+ /** User/agent-facing context copied from the source permission entry. */
317
+ description?: string;
299
318
  }
300
319
  /**
301
320
  * A resolved delegation entry with fully-expanded permissions.
@@ -380,6 +399,8 @@ declare const DEFAULT_MANIFEST_SPACE = "applications";
380
399
  declare const ACCOUNT_REGISTRY_SPACE = "account";
381
400
  /** Account-space KV prefix used for installed-application registry records. */
382
401
  declare const ACCOUNT_REGISTRY_PATH = "applications/";
402
+ /** SDK-only permission service for encrypted vault resources. */
403
+ declare const VAULT_PERMISSION_SERVICE = "tinycloud.vault";
383
404
  /**
384
405
  * Known services and their short-form (recap URI) names. The TinyCloud
385
406
  * node encodes the recap resource URI with the short service name, while
@@ -410,6 +431,22 @@ declare function parseExpiry(duration: string): number;
410
431
  * → `["tinycloud.kv/get"]` (passed through unchanged)
411
432
  */
412
433
  declare function expandActionShortNames(service: string, actions: readonly string[]): string[];
434
+ /**
435
+ * Expand SDK virtual permission services into concrete recap-capable services.
436
+ *
437
+ * Today this handles `"tinycloud.vault"`, which is backed by KV resources:
438
+ * - read/get: `keys/<path>` + `vault/<path>` with `tinycloud.kv/get`
439
+ * - write/put: `keys/<path>` + `vault/<path>` with `tinycloud.kv/put`
440
+ * - delete/del: `keys/<path>` + `vault/<path>` with `tinycloud.kv/del`
441
+ * - list: `vault/<path>` with `tinycloud.kv/list`
442
+ * - head: `vault/<path>` with `tinycloud.kv/get`
443
+ * - metadata: `vault/<path>` with `tinycloud.kv/metadata`
444
+ */
445
+ declare function expandPermissionEntry(entry: PermissionEntry): PermissionEntry[];
446
+ /**
447
+ * Expand a list of permission entries using {@link expandPermissionEntry}.
448
+ */
449
+ declare function expandPermissionEntries(entries: readonly PermissionEntry[]): PermissionEntry[];
413
450
  /**
414
451
  * Apply the manifest prefix to a permission path per the spec rules.
415
452
  *
@@ -2029,15 +2066,15 @@ declare const SpaceInfoSchema: z.ZodObject<{
2029
2066
  type: "owned" | "delegated";
2030
2067
  id: string;
2031
2068
  owner: string;
2032
- expiresAt?: Date | undefined;
2033
2069
  name?: string | undefined;
2070
+ expiresAt?: Date | undefined;
2034
2071
  permissions?: string[] | undefined;
2035
2072
  }, {
2036
2073
  type: "owned" | "delegated";
2037
2074
  id: string;
2038
2075
  owner: string;
2039
- expiresAt?: Date | undefined;
2040
2076
  name?: string | undefined;
2077
+ expiresAt?: Date | undefined;
2041
2078
  permissions?: string[] | undefined;
2042
2079
  }>;
2043
2080
  type SpaceInfo = z.infer<typeof SpaceInfoSchema>;
@@ -2131,8 +2168,8 @@ declare const ShareLinkSchema: z.ZodObject<{
2131
2168
  };
2132
2169
  token: string;
2133
2170
  schema: "base64" | "compact" | "ipfs";
2134
- expiresAt?: Date | undefined;
2135
2171
  description?: string | undefined;
2172
+ expiresAt?: Date | undefined;
2136
2173
  }, {
2137
2174
  url: string;
2138
2175
  delegation: {
@@ -2151,8 +2188,8 @@ declare const ShareLinkSchema: z.ZodObject<{
2151
2188
  };
2152
2189
  token: string;
2153
2190
  schema: "base64" | "compact" | "ipfs";
2154
- expiresAt?: Date | undefined;
2155
2191
  description?: string | undefined;
2192
+ expiresAt?: Date | undefined;
2156
2193
  }>;
2157
2194
  type ShareLink = z.infer<typeof ShareLinkSchema>;
2158
2195
  type ShareLinkData<T = unknown> = {
@@ -2209,15 +2246,15 @@ declare const GenerateShareParamsSchema: z.ZodObject<{
2209
2246
  path: string;
2210
2247
  actions?: string[] | undefined;
2211
2248
  expiry?: Date | undefined;
2212
- schema?: "base64" | "compact" | "ipfs" | undefined;
2213
2249
  description?: string | undefined;
2250
+ schema?: "base64" | "compact" | "ipfs" | undefined;
2214
2251
  baseUrl?: string | undefined;
2215
2252
  }, {
2216
2253
  path: string;
2217
2254
  actions?: string[] | undefined;
2218
2255
  expiry?: Date | undefined;
2219
- schema?: "base64" | "compact" | "ipfs" | undefined;
2220
2256
  description?: string | undefined;
2257
+ schema?: "base64" | "compact" | "ipfs" | undefined;
2221
2258
  baseUrl?: string | undefined;
2222
2259
  }>;
2223
2260
  type GenerateShareParams = z.infer<typeof GenerateShareParamsSchema>;
@@ -2314,14 +2351,14 @@ declare const DelegatedResourceSchema: z.ZodObject<{
2314
2351
  actions: z.ZodArray<z.ZodString, "many">;
2315
2352
  }, "strip", z.ZodTypeAny, {
2316
2353
  path: string;
2317
- service: string;
2318
- space: string;
2319
2354
  actions: string[];
2355
+ space: string;
2356
+ service: string;
2320
2357
  }, {
2321
2358
  path: string;
2322
- service: string;
2323
- space: string;
2324
2359
  actions: string[];
2360
+ space: string;
2361
+ service: string;
2325
2362
  }>;
2326
2363
  type DelegatedResource = z.infer<typeof DelegatedResourceSchema>;
2327
2364
  /**
@@ -2412,21 +2449,21 @@ declare const CreateDelegationWasmResultSchema: z.ZodObject<{
2412
2449
  actions: z.ZodArray<z.ZodString, "many">;
2413
2450
  }, "strip", z.ZodTypeAny, {
2414
2451
  path: string;
2415
- service: string;
2416
- space: string;
2417
2452
  actions: string[];
2453
+ space: string;
2454
+ service: string;
2418
2455
  }, {
2419
2456
  path: string;
2420
- service: string;
2421
- space: string;
2422
2457
  actions: string[];
2458
+ space: string;
2459
+ service: string;
2423
2460
  }>, "many">;
2424
2461
  }, "strip", z.ZodTypeAny, {
2425
2462
  resources: {
2426
2463
  path: string;
2427
- service: string;
2428
- space: string;
2429
2464
  actions: string[];
2465
+ space: string;
2466
+ service: string;
2430
2467
  }[];
2431
2468
  expiry: Date;
2432
2469
  delegation: string;
@@ -2435,9 +2472,9 @@ declare const CreateDelegationWasmResultSchema: z.ZodObject<{
2435
2472
  }, {
2436
2473
  resources: {
2437
2474
  path: string;
2438
- service: string;
2439
- space: string;
2440
2475
  actions: string[];
2476
+ space: string;
2477
+ service: string;
2441
2478
  }[];
2442
2479
  expiry: Date;
2443
2480
  delegation: string;
@@ -4009,6 +4046,10 @@ interface ISpace {
4009
4046
  * KV operations scoped to this space.
4010
4047
  */
4011
4048
  readonly kv: IKVService;
4049
+ /**
4050
+ * Data Vault operations scoped to this space.
4051
+ */
4052
+ readonly vault: IDataVaultService;
4012
4053
  /**
4013
4054
  * Delegation operations scoped to this space.
4014
4055
  */
@@ -4038,6 +4079,10 @@ interface SpaceConfig {
4038
4079
  * Factory function to create a space-scoped KV service.
4039
4080
  */
4040
4081
  createKV: (spaceId: string) => IKVService;
4082
+ /**
4083
+ * Factory function to create a space-scoped Data Vault service.
4084
+ */
4085
+ createVault: (spaceId: string) => IDataVaultService;
4041
4086
  /**
4042
4087
  * Factory function to create space-scoped delegations.
4043
4088
  */
@@ -4077,6 +4122,7 @@ declare class Space implements ISpace {
4077
4122
  private readonly _id;
4078
4123
  private readonly _name;
4079
4124
  private readonly _kv;
4125
+ private readonly _vault;
4080
4126
  private readonly _delegations;
4081
4127
  private readonly _sharing;
4082
4128
  private readonly _getInfo;
@@ -4098,6 +4144,10 @@ declare class Space implements ISpace {
4098
4144
  * KV operations scoped to this space.
4099
4145
  */
4100
4146
  get kv(): IKVService;
4147
+ /**
4148
+ * Data Vault operations scoped to this space.
4149
+ */
4150
+ get vault(): IDataVaultService;
4101
4151
  /**
4102
4152
  * Delegation operations scoped to this space.
4103
4153
  */
@@ -4173,6 +4223,8 @@ interface SpaceServiceConfig {
4173
4223
  capabilityRegistry?: ICapabilityKeyRegistry;
4174
4224
  /** Factory function to create a space-scoped KV service */
4175
4225
  createKVService?: (spaceId: string) => IKVService;
4226
+ /** Factory function to create a space-scoped Data Vault service */
4227
+ createVaultService?: (spaceId: string) => IDataVaultService;
4176
4228
  /** User's PKH DID (derived from address or provided explicitly) */
4177
4229
  userDid?: string;
4178
4230
  /** Optional SharingService for v2 sharing links (client-side) */
@@ -4299,6 +4351,7 @@ declare class SpaceService implements ISpaceService {
4299
4351
  private fetchFn;
4300
4352
  private capabilityRegistry?;
4301
4353
  private createKVServiceFn?;
4354
+ private createVaultServiceFn?;
4302
4355
  private _userDid?;
4303
4356
  private sharingService?;
4304
4357
  private createDelegationFn?;
@@ -4381,6 +4434,10 @@ declare class SpaceService implements ISpaceService {
4381
4434
  * Create a space-scoped KV service.
4382
4435
  */
4383
4436
  private createSpaceScopedKV;
4437
+ /**
4438
+ * Create a space-scoped Data Vault service.
4439
+ */
4440
+ private createSpaceScopedVault;
4384
4441
  /**
4385
4442
  * Create space-scoped delegation operations.
4386
4443
  */
@@ -4433,4 +4490,103 @@ interface NodeInfo {
4433
4490
  }
4434
4491
  declare function checkNodeInfo(host: string, sdkProtocol: number, fetchFn?: typeof globalThis.fetch): Promise<NodeInfo>;
4435
4492
 
4436
- export { ACCOUNT_REGISTRY_PATH, ACCOUNT_REGISTRY_SPACE, type AbilitiesMap, AutoApproveSpaceCreationHandler, type AutoRejectStrategy, type AutoSignStrategy, type Bytes, type CallbackStrategy, type CapabilityEntry, CapabilityKeyRegistry, type CapabilityKeyRegistryErrorCode, CapabilityKeyRegistryErrorCodes, type ClientSession, ClientSessionSchema, type ComposeManifestOptions, type ComposedManifestRequest, type CreateDelegationFunction, type CreateDelegationParams, type CreateDelegationWasmParams, type CreateDelegationWasmResult, DEFAULT_DEFAULTS, DEFAULT_EXPIRY, DEFAULT_MANIFEST_SPACE, DEFAULT_MANIFEST_VERSION, type DelegatedResource, type Delegation, type DelegationApiResponse, type DelegationChain, type DelegationChainV2, type DelegationDirection, type DelegationError, type DelegationErrorCode, DelegationErrorCodes, type DelegationFilters, DelegationManager, type DelegationManagerConfig, type DelegationRecord, type Result as DelegationResult, type EncodedShareData, type EnsData, EnsDataSchema, type EventEmitterStrategy, type Extension, type GenerateShareParams, type ICapabilityKeyRegistry, type IENSResolver, type INotificationHandler, type ISessionManager, type ISessionStorage, type ISharingService, type ISigner, type ISpace, type ISpaceCreationHandler, type ISpaceScopedDelegations, type ISpaceScopedSharing, type ISpaceService, type IUserAuthorization, type IWasmBindings, type IngestOptions, type JWK, type KeyInfo, type KeyProvider, type KeyType, type Manifest, type ManifestDefaults, type ManifestRegistryRecord, ManifestValidationError, type NodeInfo, type ParseRecapFromSiwe, type PartialSiweMessage, type PermissionEntry, PermissionNotInManifestError, type PersistedSessionData, type PersistedTinyCloudSession, ProtocolMismatchError, type ReceiveOptions, type ResolvedCapabilities, type ResolvedDelegate, type ResourceCapability, SERVICE_LONG_TO_SHORT, SERVICE_SHORT_TO_LONG, type ServerHost, SessionExpiredError, type ShareAccess, type ShareLink, type ShareLinkData, type ShareSchema, SharingService, type SharingServiceConfig, type SignCallback, type SignInOptions, type SignRequest, type SignResponse, type SignStrategy, SilentNotificationHandler, type SiweConfig, SiweConfigSchema, Space, type SpaceAbilitiesMap, type SpaceConfig, type SpaceCreationContext, type SpaceDelegationParams, type SpaceErrorCode, SpaceErrorCodes, type SpaceHostResult, type SpaceInfo, type SpaceOwnership, SpaceService, type SpaceServiceConfig, type StoredDelegationChain, type SubsetCheckResult, TinyCloud, type TinyCloudConfig, type TinyCloudSession, UnsupportedFeatureError, type UserAuthorizationConfig, type ValidationError, VersionCheckError, type WasmRecapEntry, activateSessionWithHost, applyPrefix, buildSpaceUri, checkNodeInfo, composeManifestRequest, createCapabilityKeyRegistry, createSharingService, createSpaceService, defaultSignStrategy, defaultSpaceCreationHandler, expandActionShortNames, fetchPeerId, isCapabilitySubset, loadManifest, makePublicSpaceId, manifestAbilitiesUnion, normalizeDefaults, parseExpiry, parseRecapCapabilities, parseSpaceUri, resolveManifest, resourceCapabilitiesToAbilitiesMap, resourceCapabilitiesToSpaceAbilitiesMap, submitHostDelegation, validateClientSession, validateManifest, validatePersistedSessionData };
4493
+ /**
4494
+ * TinyCloud location registry helpers.
4495
+ *
4496
+ * The registry maps a DID to one or more multiaddrs. Registry records are
4497
+ * signed by the DID subject; centralized storage is only a discovery cache.
4498
+ */
4499
+ interface LocationRecordPayload {
4500
+ version: 1;
4501
+ subject: string;
4502
+ multiaddrs: string[];
4503
+ updated_at: string;
4504
+ sequence: number;
4505
+ }
4506
+ interface LocationRecord extends LocationRecordPayload {
4507
+ signature: string;
4508
+ }
4509
+ type LocationSource = "explicit" | "blockchain" | "centralized" | "fallback";
4510
+ declare const DEFAULT_TINYCLOUD_LOCATION_REGISTRY_URL = "https://registry.tinycloud.xyz";
4511
+ declare const DEFAULT_TINYCLOUD_FALLBACK_HOST = "https://node.tinycloud.xyz";
4512
+ interface LocationCandidate {
4513
+ source: LocationSource;
4514
+ multiaddrs: string[];
4515
+ record?: LocationRecord;
4516
+ }
4517
+ interface LocationResolutionAttempt {
4518
+ source: LocationSource;
4519
+ candidate?: LocationCandidate;
4520
+ error?: Error;
4521
+ }
4522
+ interface ResolvedCloudLocation {
4523
+ subject: string;
4524
+ source: LocationSource;
4525
+ multiaddrs: string[];
4526
+ record?: LocationRecord;
4527
+ attempts: LocationResolutionAttempt[];
4528
+ resolvedAt: string;
4529
+ }
4530
+ interface ResolveCloudLocationOptions {
4531
+ /** Highest-priority location supplied directly by the caller. */
4532
+ explicitMultiaddrs?: string[];
4533
+ /** Optional blockchain resolver adapter. */
4534
+ blockchain?: (subject: string) => Promise<LocationCandidateInput | null | undefined>;
4535
+ /** Centralized location registry base URL, e.g. https://registry.tinycloud.xyz. */
4536
+ centralizedRegistryUrl?: string;
4537
+ /** Lowest-priority fallback location. */
4538
+ fallbackMultiaddrs?: string[];
4539
+ /** Custom fetch implementation. Defaults to globalThis.fetch. */
4540
+ fetch?: typeof fetch;
4541
+ /** Verify centralized/blockchain record signatures. Default true. */
4542
+ verifyRecords?: boolean;
4543
+ }
4544
+ interface ResolvedTinyCloudHosts {
4545
+ hosts: string[];
4546
+ location: ResolvedCloudLocation;
4547
+ }
4548
+ interface ResolveTinyCloudHostsOptions {
4549
+ /** Highest-priority TinyCloud HTTP host URLs or multiaddrs supplied directly. */
4550
+ explicitHosts?: string[];
4551
+ /** Optional blockchain resolver adapter. */
4552
+ blockchain?: ResolveCloudLocationOptions["blockchain"];
4553
+ /** Centralized location registry URL. Default https://registry.tinycloud.xyz. */
4554
+ registryUrl?: string | null;
4555
+ /** Lowest-priority fallback HTTP host URLs or multiaddrs. Default hosted TinyCloud node. */
4556
+ fallbackHosts?: string[] | null;
4557
+ /** Custom fetch implementation. Defaults to globalThis.fetch. */
4558
+ fetch?: typeof fetch;
4559
+ /** Verify centralized/blockchain record signatures. Default true. */
4560
+ verifyRecords?: boolean;
4561
+ }
4562
+ type LocationCandidateInput = string[] | LocationRecord | {
4563
+ multiaddrs: string[];
4564
+ record?: LocationRecord;
4565
+ };
4566
+ type LocationRecordSigner = {
4567
+ type: "did:pkh";
4568
+ signMessage(message: string): Promise<string>;
4569
+ } | {
4570
+ type: "did:key";
4571
+ signBytes(bytes: Uint8Array): Promise<Uint8Array>;
4572
+ };
4573
+ declare class LocationRecordValidationError extends Error {
4574
+ constructor(message: string);
4575
+ }
4576
+ declare class CloudLocationResolutionError extends Error {
4577
+ readonly attempts: LocationResolutionAttempt[];
4578
+ constructor(subject: string, attempts: LocationResolutionAttempt[]);
4579
+ }
4580
+ declare function locationPayloadForRecord(record: LocationRecord): LocationRecordPayload;
4581
+ declare function canonicalLocationPayload(payload: LocationRecordPayload): string;
4582
+ declare function signLocationRecord(payload: LocationRecordPayload, signer: LocationRecordSigner): Promise<LocationRecord>;
4583
+ declare function validateLocationRecordPayload(input: unknown): LocationRecordPayload;
4584
+ declare function validateLocationRecord(input: unknown): LocationRecord;
4585
+ declare function verifyLocationRecord(input: LocationRecord): Promise<boolean>;
4586
+ declare function fetchLocationRecord(registryUrl: string, subject: string, fetchFn?: typeof fetch): Promise<LocationRecord | null>;
4587
+ declare function resolveCloudLocation(subject: string, options?: ResolveCloudLocationOptions): Promise<ResolvedCloudLocation>;
4588
+ declare function resolveTinyCloudHosts(subject: string, options?: ResolveTinyCloudHostsOptions): Promise<ResolvedTinyCloudHosts>;
4589
+ declare function multiaddrToHttpUrl(input: string): string;
4590
+ declare function httpUrlToMultiaddr(input: string): string;
4591
+
4592
+ export { ACCOUNT_REGISTRY_PATH, ACCOUNT_REGISTRY_SPACE, type AbilitiesMap, AutoApproveSpaceCreationHandler, type AutoRejectStrategy, type AutoSignStrategy, type Bytes, type CallbackStrategy, type CapabilityEntry, CapabilityKeyRegistry, type CapabilityKeyRegistryErrorCode, CapabilityKeyRegistryErrorCodes, type ClientSession, ClientSessionSchema, CloudLocationResolutionError, type ComposeManifestOptions, type ComposedManifestRequest, type CreateDelegationFunction, type CreateDelegationParams, type CreateDelegationWasmParams, type CreateDelegationWasmResult, DEFAULT_DEFAULTS, DEFAULT_EXPIRY, DEFAULT_MANIFEST_SPACE, DEFAULT_MANIFEST_VERSION, DEFAULT_TINYCLOUD_FALLBACK_HOST, DEFAULT_TINYCLOUD_LOCATION_REGISTRY_URL, type DelegatedResource, type Delegation, type DelegationApiResponse, type DelegationChain, type DelegationChainV2, type DelegationDirection, type DelegationError, type DelegationErrorCode, DelegationErrorCodes, type DelegationFilters, DelegationManager, type DelegationManagerConfig, type DelegationRecord, type Result as DelegationResult, type EncodedShareData, type EnsData, EnsDataSchema, type EventEmitterStrategy, type Extension, type GenerateShareParams, type ICapabilityKeyRegistry, type IENSResolver, type INotificationHandler, type ISessionManager, type ISessionStorage, type ISharingService, type ISigner, type ISpace, type ISpaceCreationHandler, type ISpaceScopedDelegations, type ISpaceScopedSharing, type ISpaceService, type IUserAuthorization, type IWasmBindings, type IngestOptions, type JWK, type KeyInfo, type KeyProvider, type KeyType, type LocationCandidate, type LocationCandidateInput, type LocationRecord, type LocationRecordPayload, type LocationRecordSigner, LocationRecordValidationError, type LocationResolutionAttempt, type LocationSource, type Manifest, type ManifestDefaults, type ManifestRegistryRecord, type ManifestSecretActions, ManifestValidationError, type NodeInfo, type ParseRecapFromSiwe, type PartialSiweMessage, type PermissionEntry, PermissionNotInManifestError, type PersistedSessionData, type PersistedTinyCloudSession, ProtocolMismatchError, type ReceiveOptions, type ResolveCloudLocationOptions, type ResolveTinyCloudHostsOptions, type ResolvedCapabilities, type ResolvedCloudLocation, type ResolvedDelegate, type ResolvedTinyCloudHosts, type ResourceCapability, SERVICE_LONG_TO_SHORT, SERVICE_SHORT_TO_LONG, type ServerHost, SessionExpiredError, type ShareAccess, type ShareLink, type ShareLinkData, type ShareSchema, SharingService, type SharingServiceConfig, type SignCallback, type SignInOptions, type SignRequest, type SignResponse, type SignStrategy, SilentNotificationHandler, type SiweConfig, SiweConfigSchema, Space, type SpaceAbilitiesMap, type SpaceConfig, type SpaceCreationContext, type SpaceDelegationParams, type SpaceErrorCode, SpaceErrorCodes, type SpaceHostResult, type SpaceInfo, type SpaceOwnership, SpaceService, type SpaceServiceConfig, type StoredDelegationChain, type SubsetCheckResult, TinyCloud, type TinyCloudConfig, type TinyCloudSession, UnsupportedFeatureError, type UserAuthorizationConfig, VAULT_PERMISSION_SERVICE, type ValidationError, VersionCheckError, type WasmRecapEntry, activateSessionWithHost, applyPrefix, buildSpaceUri, canonicalLocationPayload, checkNodeInfo, composeManifestRequest, createCapabilityKeyRegistry, createSharingService, createSpaceService, defaultSignStrategy, defaultSpaceCreationHandler, expandActionShortNames, expandPermissionEntries, expandPermissionEntry, fetchLocationRecord, fetchPeerId, httpUrlToMultiaddr, isCapabilitySubset, loadManifest, locationPayloadForRecord, makePublicSpaceId, manifestAbilitiesUnion, multiaddrToHttpUrl, normalizeDefaults, parseExpiry, parseRecapCapabilities, parseSpaceUri, resolveCloudLocation, resolveManifest, resolveTinyCloudHosts, resourceCapabilitiesToAbilitiesMap, resourceCapabilitiesToSpaceAbilitiesMap, signLocationRecord, submitHostDelegation, validateClientSession, validateLocationRecord, validateLocationRecordPayload, validateManifest, validatePersistedSessionData, verifyLocationRecord };