@tinycloud/sdk-core 2.2.0-beta.1 → 2.2.0-beta.11
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 +775 -57
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +204 -20
- package/dist/index.d.ts +204 -20
- package/dist/index.js +732 -33
- package/dist/index.js.map +1 -1
- package/package.json +9 -3
package/dist/index.d.cts
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
|
-
*
|
|
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". */
|
|
@@ -229,12 +230,21 @@ interface PermissionEntry {
|
|
|
229
230
|
/** User/agent-facing context for why this permission is requested. */
|
|
230
231
|
description?: string;
|
|
231
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
|
+
};
|
|
232
242
|
/**
|
|
233
243
|
* The valid values for `Manifest.defaults`.
|
|
234
244
|
*
|
|
235
245
|
* - `false` → no auto-included permissions
|
|
236
246
|
* - `true` → standard tier (KV + SQL read/write + capabilities:read)
|
|
237
|
-
* - `"admin"` → standard + SQL ddl
|
|
247
|
+
* - `"admin"` → standard + SQL ddl
|
|
238
248
|
* - `"all"` → everything the SDK supports (including DuckDB)
|
|
239
249
|
*
|
|
240
250
|
* Unknown string values silently fall back to `true`. Values are normalized
|
|
@@ -281,6 +291,11 @@ interface Manifest {
|
|
|
281
291
|
* DuckDB (opt-in), or `skipPrefix: true` entries.
|
|
282
292
|
*/
|
|
283
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>;
|
|
284
299
|
}
|
|
285
300
|
/**
|
|
286
301
|
* A resolved permission entry with fully-expanded paths and action URNs.
|
|
@@ -369,7 +384,12 @@ declare class ManifestValidationError extends Error {
|
|
|
369
384
|
}
|
|
370
385
|
/**
|
|
371
386
|
* Default expiry when neither the manifest, delegation, nor permission
|
|
372
|
-
* specifies one. Spec: 30 days.
|
|
387
|
+
* specifies one. APP tier — see `expiry.ts`. Spec: 30 days.
|
|
388
|
+
*
|
|
389
|
+
* Kept as an ms-format string because the manifest schema stores expiry
|
|
390
|
+
* as a string and the parser is shared between this default and
|
|
391
|
+
* caller-provided values; converting `EXPIRY.APP_MS` back to a string
|
|
392
|
+
* here would duplicate that same `30d` literal in another form.
|
|
373
393
|
*/
|
|
374
394
|
declare const DEFAULT_EXPIRY = "30d";
|
|
375
395
|
/**
|
|
@@ -384,6 +404,8 @@ declare const DEFAULT_MANIFEST_SPACE = "applications";
|
|
|
384
404
|
declare const ACCOUNT_REGISTRY_SPACE = "account";
|
|
385
405
|
/** Account-space KV prefix used for installed-application registry records. */
|
|
386
406
|
declare const ACCOUNT_REGISTRY_PATH = "applications/";
|
|
407
|
+
/** SDK-only permission service for encrypted vault resources. */
|
|
408
|
+
declare const VAULT_PERMISSION_SERVICE = "tinycloud.vault";
|
|
387
409
|
/**
|
|
388
410
|
* Known services and their short-form (recap URI) names. The TinyCloud
|
|
389
411
|
* node encodes the recap resource URI with the short service name, while
|
|
@@ -414,6 +436,22 @@ declare function parseExpiry(duration: string): number;
|
|
|
414
436
|
* → `["tinycloud.kv/get"]` (passed through unchanged)
|
|
415
437
|
*/
|
|
416
438
|
declare function expandActionShortNames(service: string, actions: readonly string[]): string[];
|
|
439
|
+
/**
|
|
440
|
+
* Expand SDK virtual permission services into concrete recap-capable services.
|
|
441
|
+
*
|
|
442
|
+
* Today this handles `"tinycloud.vault"`, which is backed by KV resources:
|
|
443
|
+
* - read/get: `keys/<path>` + `vault/<path>` with `tinycloud.kv/get`
|
|
444
|
+
* - write/put: `keys/<path>` + `vault/<path>` with `tinycloud.kv/put`
|
|
445
|
+
* - delete/del: `keys/<path>` + `vault/<path>` with `tinycloud.kv/del`
|
|
446
|
+
* - list: `vault/<path>` with `tinycloud.kv/list`
|
|
447
|
+
* - head: `vault/<path>` with `tinycloud.kv/get`
|
|
448
|
+
* - metadata: `vault/<path>` with `tinycloud.kv/metadata`
|
|
449
|
+
*/
|
|
450
|
+
declare function expandPermissionEntry(entry: PermissionEntry): PermissionEntry[];
|
|
451
|
+
/**
|
|
452
|
+
* Expand a list of permission entries using {@link expandPermissionEntry}.
|
|
453
|
+
*/
|
|
454
|
+
declare function expandPermissionEntries(entries: readonly PermissionEntry[]): PermissionEntry[];
|
|
417
455
|
/**
|
|
418
456
|
* Apply the manifest prefix to a permission path per the spec rules.
|
|
419
457
|
*
|
|
@@ -2033,15 +2071,15 @@ declare const SpaceInfoSchema: z.ZodObject<{
|
|
|
2033
2071
|
type: "owned" | "delegated";
|
|
2034
2072
|
id: string;
|
|
2035
2073
|
owner: string;
|
|
2036
|
-
expiresAt?: Date | undefined;
|
|
2037
2074
|
name?: string | undefined;
|
|
2075
|
+
expiresAt?: Date | undefined;
|
|
2038
2076
|
permissions?: string[] | undefined;
|
|
2039
2077
|
}, {
|
|
2040
2078
|
type: "owned" | "delegated";
|
|
2041
2079
|
id: string;
|
|
2042
2080
|
owner: string;
|
|
2043
|
-
expiresAt?: Date | undefined;
|
|
2044
2081
|
name?: string | undefined;
|
|
2082
|
+
expiresAt?: Date | undefined;
|
|
2045
2083
|
permissions?: string[] | undefined;
|
|
2046
2084
|
}>;
|
|
2047
2085
|
type SpaceInfo = z.infer<typeof SpaceInfoSchema>;
|
|
@@ -2318,14 +2356,14 @@ declare const DelegatedResourceSchema: z.ZodObject<{
|
|
|
2318
2356
|
actions: z.ZodArray<z.ZodString, "many">;
|
|
2319
2357
|
}, "strip", z.ZodTypeAny, {
|
|
2320
2358
|
path: string;
|
|
2321
|
-
service: string;
|
|
2322
|
-
space: string;
|
|
2323
2359
|
actions: string[];
|
|
2360
|
+
space: string;
|
|
2361
|
+
service: string;
|
|
2324
2362
|
}, {
|
|
2325
2363
|
path: string;
|
|
2326
|
-
service: string;
|
|
2327
|
-
space: string;
|
|
2328
2364
|
actions: string[];
|
|
2365
|
+
space: string;
|
|
2366
|
+
service: string;
|
|
2329
2367
|
}>;
|
|
2330
2368
|
type DelegatedResource = z.infer<typeof DelegatedResourceSchema>;
|
|
2331
2369
|
/**
|
|
@@ -2416,21 +2454,21 @@ declare const CreateDelegationWasmResultSchema: z.ZodObject<{
|
|
|
2416
2454
|
actions: z.ZodArray<z.ZodString, "many">;
|
|
2417
2455
|
}, "strip", z.ZodTypeAny, {
|
|
2418
2456
|
path: string;
|
|
2419
|
-
service: string;
|
|
2420
|
-
space: string;
|
|
2421
2457
|
actions: string[];
|
|
2458
|
+
space: string;
|
|
2459
|
+
service: string;
|
|
2422
2460
|
}, {
|
|
2423
2461
|
path: string;
|
|
2424
|
-
service: string;
|
|
2425
|
-
space: string;
|
|
2426
2462
|
actions: string[];
|
|
2463
|
+
space: string;
|
|
2464
|
+
service: string;
|
|
2427
2465
|
}>, "many">;
|
|
2428
2466
|
}, "strip", z.ZodTypeAny, {
|
|
2429
2467
|
resources: {
|
|
2430
2468
|
path: string;
|
|
2431
|
-
service: string;
|
|
2432
|
-
space: string;
|
|
2433
2469
|
actions: string[];
|
|
2470
|
+
space: string;
|
|
2471
|
+
service: string;
|
|
2434
2472
|
}[];
|
|
2435
2473
|
expiry: Date;
|
|
2436
2474
|
delegation: string;
|
|
@@ -2439,9 +2477,9 @@ declare const CreateDelegationWasmResultSchema: z.ZodObject<{
|
|
|
2439
2477
|
}, {
|
|
2440
2478
|
resources: {
|
|
2441
2479
|
path: string;
|
|
2442
|
-
service: string;
|
|
2443
|
-
space: string;
|
|
2444
2480
|
actions: string[];
|
|
2481
|
+
space: string;
|
|
2482
|
+
service: string;
|
|
2445
2483
|
}[];
|
|
2446
2484
|
expiry: Date;
|
|
2447
2485
|
delegation: string;
|
|
@@ -4013,6 +4051,10 @@ interface ISpace {
|
|
|
4013
4051
|
* KV operations scoped to this space.
|
|
4014
4052
|
*/
|
|
4015
4053
|
readonly kv: IKVService;
|
|
4054
|
+
/**
|
|
4055
|
+
* Data Vault operations scoped to this space.
|
|
4056
|
+
*/
|
|
4057
|
+
readonly vault: IDataVaultService;
|
|
4016
4058
|
/**
|
|
4017
4059
|
* Delegation operations scoped to this space.
|
|
4018
4060
|
*/
|
|
@@ -4042,6 +4084,10 @@ interface SpaceConfig {
|
|
|
4042
4084
|
* Factory function to create a space-scoped KV service.
|
|
4043
4085
|
*/
|
|
4044
4086
|
createKV: (spaceId: string) => IKVService;
|
|
4087
|
+
/**
|
|
4088
|
+
* Factory function to create a space-scoped Data Vault service.
|
|
4089
|
+
*/
|
|
4090
|
+
createVault: (spaceId: string) => IDataVaultService;
|
|
4045
4091
|
/**
|
|
4046
4092
|
* Factory function to create space-scoped delegations.
|
|
4047
4093
|
*/
|
|
@@ -4081,6 +4127,7 @@ declare class Space implements ISpace {
|
|
|
4081
4127
|
private readonly _id;
|
|
4082
4128
|
private readonly _name;
|
|
4083
4129
|
private readonly _kv;
|
|
4130
|
+
private readonly _vault;
|
|
4084
4131
|
private readonly _delegations;
|
|
4085
4132
|
private readonly _sharing;
|
|
4086
4133
|
private readonly _getInfo;
|
|
@@ -4102,6 +4149,10 @@ declare class Space implements ISpace {
|
|
|
4102
4149
|
* KV operations scoped to this space.
|
|
4103
4150
|
*/
|
|
4104
4151
|
get kv(): IKVService;
|
|
4152
|
+
/**
|
|
4153
|
+
* Data Vault operations scoped to this space.
|
|
4154
|
+
*/
|
|
4155
|
+
get vault(): IDataVaultService;
|
|
4105
4156
|
/**
|
|
4106
4157
|
* Delegation operations scoped to this space.
|
|
4107
4158
|
*/
|
|
@@ -4177,6 +4228,8 @@ interface SpaceServiceConfig {
|
|
|
4177
4228
|
capabilityRegistry?: ICapabilityKeyRegistry;
|
|
4178
4229
|
/** Factory function to create a space-scoped KV service */
|
|
4179
4230
|
createKVService?: (spaceId: string) => IKVService;
|
|
4231
|
+
/** Factory function to create a space-scoped Data Vault service */
|
|
4232
|
+
createVaultService?: (spaceId: string) => IDataVaultService;
|
|
4180
4233
|
/** User's PKH DID (derived from address or provided explicitly) */
|
|
4181
4234
|
userDid?: string;
|
|
4182
4235
|
/** Optional SharingService for v2 sharing links (client-side) */
|
|
@@ -4303,6 +4356,7 @@ declare class SpaceService implements ISpaceService {
|
|
|
4303
4356
|
private fetchFn;
|
|
4304
4357
|
private capabilityRegistry?;
|
|
4305
4358
|
private createKVServiceFn?;
|
|
4359
|
+
private createVaultServiceFn?;
|
|
4306
4360
|
private _userDid?;
|
|
4307
4361
|
private sharingService?;
|
|
4308
4362
|
private createDelegationFn?;
|
|
@@ -4385,6 +4439,10 @@ declare class SpaceService implements ISpaceService {
|
|
|
4385
4439
|
* Create a space-scoped KV service.
|
|
4386
4440
|
*/
|
|
4387
4441
|
private createSpaceScopedKV;
|
|
4442
|
+
/**
|
|
4443
|
+
* Create a space-scoped Data Vault service.
|
|
4444
|
+
*/
|
|
4445
|
+
private createSpaceScopedVault;
|
|
4388
4446
|
/**
|
|
4389
4447
|
* Create space-scoped delegation operations.
|
|
4390
4448
|
*/
|
|
@@ -4437,4 +4495,130 @@ interface NodeInfo {
|
|
|
4437
4495
|
}
|
|
4438
4496
|
declare function checkNodeInfo(host: string, sdkProtocol: number, fetchFn?: typeof globalThis.fetch): Promise<NodeInfo>;
|
|
4439
4497
|
|
|
4440
|
-
|
|
4498
|
+
/**
|
|
4499
|
+
* TinyCloud location registry helpers.
|
|
4500
|
+
*
|
|
4501
|
+
* The registry maps a DID to one or more multiaddrs. Registry records are
|
|
4502
|
+
* signed by the DID subject; centralized storage is only a discovery cache.
|
|
4503
|
+
*/
|
|
4504
|
+
interface LocationRecordPayload {
|
|
4505
|
+
version: 1;
|
|
4506
|
+
subject: string;
|
|
4507
|
+
multiaddrs: string[];
|
|
4508
|
+
updated_at: string;
|
|
4509
|
+
sequence: number;
|
|
4510
|
+
}
|
|
4511
|
+
interface LocationRecord extends LocationRecordPayload {
|
|
4512
|
+
signature: string;
|
|
4513
|
+
}
|
|
4514
|
+
type LocationSource = "explicit" | "blockchain" | "centralized" | "fallback";
|
|
4515
|
+
declare const DEFAULT_TINYCLOUD_LOCATION_REGISTRY_URL = "https://registry.tinycloud.xyz";
|
|
4516
|
+
declare const DEFAULT_TINYCLOUD_FALLBACK_HOST = "https://node.tinycloud.xyz";
|
|
4517
|
+
interface LocationCandidate {
|
|
4518
|
+
source: LocationSource;
|
|
4519
|
+
multiaddrs: string[];
|
|
4520
|
+
record?: LocationRecord;
|
|
4521
|
+
}
|
|
4522
|
+
interface LocationResolutionAttempt {
|
|
4523
|
+
source: LocationSource;
|
|
4524
|
+
candidate?: LocationCandidate;
|
|
4525
|
+
error?: Error;
|
|
4526
|
+
}
|
|
4527
|
+
interface ResolvedCloudLocation {
|
|
4528
|
+
subject: string;
|
|
4529
|
+
source: LocationSource;
|
|
4530
|
+
multiaddrs: string[];
|
|
4531
|
+
record?: LocationRecord;
|
|
4532
|
+
attempts: LocationResolutionAttempt[];
|
|
4533
|
+
resolvedAt: string;
|
|
4534
|
+
}
|
|
4535
|
+
interface ResolveCloudLocationOptions {
|
|
4536
|
+
/** Highest-priority location supplied directly by the caller. */
|
|
4537
|
+
explicitMultiaddrs?: string[];
|
|
4538
|
+
/** Optional blockchain resolver adapter. */
|
|
4539
|
+
blockchain?: (subject: string) => Promise<LocationCandidateInput | null | undefined>;
|
|
4540
|
+
/** Centralized location registry base URL, e.g. https://registry.tinycloud.xyz. */
|
|
4541
|
+
centralizedRegistryUrl?: string;
|
|
4542
|
+
/** Lowest-priority fallback location. */
|
|
4543
|
+
fallbackMultiaddrs?: string[];
|
|
4544
|
+
/** Custom fetch implementation. Defaults to globalThis.fetch. */
|
|
4545
|
+
fetch?: typeof fetch;
|
|
4546
|
+
/** Verify centralized/blockchain record signatures. Default true. */
|
|
4547
|
+
verifyRecords?: boolean;
|
|
4548
|
+
}
|
|
4549
|
+
interface ResolvedTinyCloudHosts {
|
|
4550
|
+
hosts: string[];
|
|
4551
|
+
location: ResolvedCloudLocation;
|
|
4552
|
+
}
|
|
4553
|
+
interface ResolveTinyCloudHostsOptions {
|
|
4554
|
+
/** Highest-priority TinyCloud HTTP host URLs or multiaddrs supplied directly. */
|
|
4555
|
+
explicitHosts?: string[];
|
|
4556
|
+
/** Optional blockchain resolver adapter. */
|
|
4557
|
+
blockchain?: ResolveCloudLocationOptions["blockchain"];
|
|
4558
|
+
/** Centralized location registry URL. Default https://registry.tinycloud.xyz. */
|
|
4559
|
+
registryUrl?: string | null;
|
|
4560
|
+
/** Lowest-priority fallback HTTP host URLs or multiaddrs. Default hosted TinyCloud node. */
|
|
4561
|
+
fallbackHosts?: string[] | null;
|
|
4562
|
+
/** Custom fetch implementation. Defaults to globalThis.fetch. */
|
|
4563
|
+
fetch?: typeof fetch;
|
|
4564
|
+
/** Verify centralized/blockchain record signatures. Default true. */
|
|
4565
|
+
verifyRecords?: boolean;
|
|
4566
|
+
}
|
|
4567
|
+
type LocationCandidateInput = string[] | LocationRecord | {
|
|
4568
|
+
multiaddrs: string[];
|
|
4569
|
+
record?: LocationRecord;
|
|
4570
|
+
};
|
|
4571
|
+
type LocationRecordSigner = {
|
|
4572
|
+
type: "did:pkh";
|
|
4573
|
+
signMessage(message: string): Promise<string>;
|
|
4574
|
+
} | {
|
|
4575
|
+
type: "did:key";
|
|
4576
|
+
signBytes(bytes: Uint8Array): Promise<Uint8Array>;
|
|
4577
|
+
};
|
|
4578
|
+
declare class LocationRecordValidationError extends Error {
|
|
4579
|
+
constructor(message: string);
|
|
4580
|
+
}
|
|
4581
|
+
declare class CloudLocationResolutionError extends Error {
|
|
4582
|
+
readonly attempts: LocationResolutionAttempt[];
|
|
4583
|
+
constructor(subject: string, attempts: LocationResolutionAttempt[]);
|
|
4584
|
+
}
|
|
4585
|
+
declare function locationPayloadForRecord(record: LocationRecord): LocationRecordPayload;
|
|
4586
|
+
declare function canonicalLocationPayload(payload: LocationRecordPayload): string;
|
|
4587
|
+
declare function signLocationRecord(payload: LocationRecordPayload, signer: LocationRecordSigner): Promise<LocationRecord>;
|
|
4588
|
+
declare function validateLocationRecordPayload(input: unknown): LocationRecordPayload;
|
|
4589
|
+
declare function validateLocationRecord(input: unknown): LocationRecord;
|
|
4590
|
+
declare function verifyLocationRecord(input: LocationRecord): Promise<boolean>;
|
|
4591
|
+
declare function fetchLocationRecord(registryUrl: string, subject: string, fetchFn?: typeof fetch): Promise<LocationRecord | null>;
|
|
4592
|
+
declare function resolveCloudLocation(subject: string, options?: ResolveCloudLocationOptions): Promise<ResolvedCloudLocation>;
|
|
4593
|
+
declare function resolveTinyCloudHosts(subject: string, options?: ResolveTinyCloudHostsOptions): Promise<ResolvedTinyCloudHosts>;
|
|
4594
|
+
declare function multiaddrToHttpUrl(input: string): string;
|
|
4595
|
+
declare function httpUrlToMultiaddr(input: string): string;
|
|
4596
|
+
|
|
4597
|
+
/**
|
|
4598
|
+
* Default lifetimes for the various delegation shapes the SDK mints.
|
|
4599
|
+
*
|
|
4600
|
+
* The SDK has many delegation flows (session sign-in, runtime grants,
|
|
4601
|
+
* share links, manifest installs, public-space sub-delegations, …) and
|
|
4602
|
+
* each one used to pick its own number freehand. That made it hard to
|
|
4603
|
+
* tell whether a chosen value was deliberate or copy-pasted, and made
|
|
4604
|
+
* silent inconsistencies easy to ship.
|
|
4605
|
+
*
|
|
4606
|
+
* Every default below answers two questions:
|
|
4607
|
+
* - Who recovers if the delegation leaks? (re-auth, revocation, no one)
|
|
4608
|
+
* - Who is the principal at use time? (issuer, third party)
|
|
4609
|
+
*
|
|
4610
|
+
* The five tiers fall out of those answers. Pick a tier, not a number,
|
|
4611
|
+
* when introducing a new delegation surface.
|
|
4612
|
+
*
|
|
4613
|
+
* @packageDocumentation
|
|
4614
|
+
*/
|
|
4615
|
+
declare const EXPIRY: {
|
|
4616
|
+
readonly EPHEMERAL_MS: number;
|
|
4617
|
+
readonly SESSION_MS: number;
|
|
4618
|
+
readonly SHARE_MS: number;
|
|
4619
|
+
readonly APP_MS: number;
|
|
4620
|
+
readonly MAX_MS: number;
|
|
4621
|
+
};
|
|
4622
|
+
type ExpiryTier = keyof typeof EXPIRY;
|
|
4623
|
+
|
|
4624
|
+
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, EXPIRY, type EncodedShareData, type EnsData, EnsDataSchema, type EventEmitterStrategy, type ExpiryTier, 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 };
|