@tinycloud/sdk-core 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/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
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, ISecretsService, 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, SecretPayload, SecretsError, SecretsService, 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';
2
+ import { InvokeFunction, InvokeAnyFunction, ServiceError, Result as Result$1, ServiceSession, FetchFunction, ServiceConstructor, RetryPolicy, IServiceContext, IService, IKVService, ISQLService, IDuckDbService, IHooksService, IDataVaultService, IEncryptionService } from '@tinycloud/sdk-services';
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, VaultCrypto, VaultEntry, VaultError, VaultGetOptions, VaultGrantOptions, VaultHeaders, VaultListOptions, VaultPublicSpaceKVActions, VaultPutOptions, VerifyDecryptResponseInput, ViewInfo, WasmVaultFunctions, WellKnownDescriptorFetcher, buildCanonicalDecryptRequest, buildDecryptAttenuation, buildDecryptFacts, buildDecryptInvocation, buildNetworkId, canonicalHashHex, canonicalSignedResponse, canonicalizeEncryptionJson, canonicalizeSecretScope, checkDecryptInvocationInput, createVaultCrypto, decryptEnvelopeWithKey, defaultRetryPolicy, deriveSignedReceiverKey, discoverNetwork, encryptToNetwork, base64Decode as encryptionBase64Decode, base64Encode as encryptionBase64Encode, encryptionError, utf8Decode as encryptionUtf8Decode, utf8Encode as encryptionUtf8Encode, ensureNetworkUsableForDecrypt, err, generateRandomReceiverKey, hexDecode, hexEncode, isNetworkId, networkDiscoveryKey, ok, openWrappedKey, parseNetworkId, resolveSecretListPrefix, resolveSecretPath, serviceError, validateEnvelope, verifyDecryptResponse } 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". */
@@ -230,6 +231,10 @@ interface PermissionEntry {
230
231
  description?: string;
231
232
  }
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;
233
238
  actions?: string | string[];
234
239
  expiry?: string;
235
240
  description?: string;
@@ -379,7 +384,12 @@ declare class ManifestValidationError extends Error {
379
384
  }
380
385
  /**
381
386
  * Default expiry when neither the manifest, delegation, nor permission
382
- * 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.
383
393
  */
384
394
  declare const DEFAULT_EXPIRY = "30d";
385
395
  /**
@@ -394,6 +404,8 @@ declare const DEFAULT_MANIFEST_SPACE = "applications";
394
404
  declare const ACCOUNT_REGISTRY_SPACE = "account";
395
405
  /** Account-space KV prefix used for installed-application registry records. */
396
406
  declare const ACCOUNT_REGISTRY_PATH = "applications/";
407
+ /** SDK-only permission service for encrypted vault resources. */
408
+ declare const VAULT_PERMISSION_SERVICE = "tinycloud.vault";
397
409
  /**
398
410
  * Known services and their short-form (recap URI) names. The TinyCloud
399
411
  * node encodes the recap resource URI with the short service name, while
@@ -401,6 +413,22 @@ declare const ACCOUNT_REGISTRY_PATH = "applications/";
401
413
  * This table is the canonical bridge between the two.
402
414
  */
403
415
  declare const SERVICE_SHORT_TO_LONG: Readonly<Record<string, string>>;
416
+ /**
417
+ * Manifest service identifier for TinyCloud encryption network grants.
418
+ *
419
+ * Encryption permissions live on a network id URN
420
+ * (`urn:tinycloud:encryption:<principal>:<network>`), not on a space.
421
+ * The `path` field is the literal networkId; `actions` are
422
+ * `["decrypt"]` (expanded to `["tinycloud.encryption/decrypt"]`).
423
+ *
424
+ * Apps should omit `space` for encryption permissions. The SDK may emit
425
+ * an internal `"encryption"` compatibility label after expansion so the
426
+ * older `PermissionEntry`/`ResourceCapability` shape can still carry the
427
+ * raw network URN through subset checks.
428
+ */
429
+ declare const ENCRYPTION_PERMISSION_SERVICE = "tinycloud.encryption";
430
+ /** Synthetic space label used by encryption manifest entries. */
431
+ declare const ENCRYPTION_MANIFEST_SPACE = "encryption";
404
432
  /**
405
433
  * Inverse of {@link SERVICE_SHORT_TO_LONG}.
406
434
  */
@@ -424,6 +452,23 @@ declare function parseExpiry(duration: string): number;
424
452
  * → `["tinycloud.kv/get"]` (passed through unchanged)
425
453
  */
426
454
  declare function expandActionShortNames(service: string, actions: readonly string[]): string[];
455
+ /**
456
+ * Expand SDK virtual permission services into concrete recap-capable services.
457
+ *
458
+ * Today this handles `"tinycloud.vault"`, which is backed by inline
459
+ * network-encrypted KV records:
460
+ * - read/get: `vault/<path>` with `tinycloud.kv/get`
461
+ * - write/put: `vault/<path>` with `tinycloud.kv/put`
462
+ * - delete/del: `vault/<path>` with `tinycloud.kv/del`
463
+ * - list: `vault/<path>` with `tinycloud.kv/list`
464
+ * - head: `vault/<path>` with `tinycloud.kv/get`
465
+ * - metadata: `vault/<path>` with `tinycloud.kv/metadata`
466
+ */
467
+ declare function expandPermissionEntry(entry: PermissionEntry): PermissionEntry[];
468
+ /**
469
+ * Expand a list of permission entries using {@link expandPermissionEntry}.
470
+ */
471
+ declare function expandPermissionEntries(entries: readonly PermissionEntry[]): PermissionEntry[];
427
472
  /**
428
473
  * Apply the manifest prefix to a permission path per the spec rules.
429
474
  *
@@ -667,6 +712,8 @@ interface IWasmBindings {
667
712
  invoke: InvokeFunction;
668
713
  /** Invoke multiple TinyCloud capabilities in one authorization header */
669
714
  invokeAny?: InvokeAnyFunction;
715
+ /** Compute a CID for signed invocation bytes. */
716
+ computeCid?: (data: Uint8Array, codec: bigint) => string;
670
717
  /** Prepare a session (generate session key, build SIWE message) */
671
718
  prepareSession: (params: any) => any;
672
719
  /** Complete session setup (create delegation) */
@@ -1313,8 +1360,8 @@ declare const DelegationSchema: z.ZodObject<{
1313
1360
  authHeader: z.ZodOptional<z.ZodString>;
1314
1361
  }, "strip", z.ZodTypeAny, {
1315
1362
  path: string;
1316
- actions: string[];
1317
1363
  expiry: Date;
1364
+ actions: string[];
1318
1365
  spaceId: string;
1319
1366
  cid: string;
1320
1367
  delegateDID: string;
@@ -1326,8 +1373,8 @@ declare const DelegationSchema: z.ZodObject<{
1326
1373
  authHeader?: string | undefined;
1327
1374
  }, {
1328
1375
  path: string;
1329
- actions: string[];
1330
1376
  expiry: Date;
1377
+ actions: string[];
1331
1378
  spaceId: string;
1332
1379
  cid: string;
1333
1380
  delegateDID: string;
@@ -1471,8 +1518,8 @@ declare const CapabilityEntrySchema: z.ZodObject<{
1471
1518
  authHeader: z.ZodOptional<z.ZodString>;
1472
1519
  }, "strip", z.ZodTypeAny, {
1473
1520
  path: string;
1474
- actions: string[];
1475
1521
  expiry: Date;
1522
+ actions: string[];
1476
1523
  spaceId: string;
1477
1524
  cid: string;
1478
1525
  delegateDID: string;
@@ -1484,8 +1531,8 @@ declare const CapabilityEntrySchema: z.ZodObject<{
1484
1531
  authHeader?: string | undefined;
1485
1532
  }, {
1486
1533
  path: string;
1487
- actions: string[];
1488
1534
  expiry: Date;
1535
+ actions: string[];
1489
1536
  spaceId: string;
1490
1537
  cid: string;
1491
1538
  delegateDID: string;
@@ -1520,8 +1567,8 @@ declare const CapabilityEntrySchema: z.ZodObject<{
1520
1567
  }[];
1521
1568
  delegation: {
1522
1569
  path: string;
1523
- actions: string[];
1524
1570
  expiry: Date;
1571
+ actions: string[];
1525
1572
  spaceId: string;
1526
1573
  cid: string;
1527
1574
  delegateDID: string;
@@ -1557,8 +1604,8 @@ declare const CapabilityEntrySchema: z.ZodObject<{
1557
1604
  }[];
1558
1605
  delegation: {
1559
1606
  path: string;
1560
- actions: string[];
1561
1607
  expiry: Date;
1608
+ actions: string[];
1562
1609
  spaceId: string;
1563
1610
  cid: string;
1564
1611
  delegateDID: string;
@@ -1692,8 +1739,8 @@ declare const DelegationChainSchema: z.ZodArray<z.ZodObject<{
1692
1739
  authHeader: z.ZodOptional<z.ZodString>;
1693
1740
  }, "strip", z.ZodTypeAny, {
1694
1741
  path: string;
1695
- actions: string[];
1696
1742
  expiry: Date;
1743
+ actions: string[];
1697
1744
  spaceId: string;
1698
1745
  cid: string;
1699
1746
  delegateDID: string;
@@ -1705,8 +1752,8 @@ declare const DelegationChainSchema: z.ZodArray<z.ZodObject<{
1705
1752
  authHeader?: string | undefined;
1706
1753
  }, {
1707
1754
  path: string;
1708
- actions: string[];
1709
1755
  expiry: Date;
1756
+ actions: string[];
1710
1757
  spaceId: string;
1711
1758
  cid: string;
1712
1759
  delegateDID: string;
@@ -1750,8 +1797,8 @@ declare const DelegationChainV2Schema: z.ZodObject<{
1750
1797
  authHeader: z.ZodOptional<z.ZodString>;
1751
1798
  }, "strip", z.ZodTypeAny, {
1752
1799
  path: string;
1753
- actions: string[];
1754
1800
  expiry: Date;
1801
+ actions: string[];
1755
1802
  spaceId: string;
1756
1803
  cid: string;
1757
1804
  delegateDID: string;
@@ -1763,8 +1810,8 @@ declare const DelegationChainV2Schema: z.ZodObject<{
1763
1810
  authHeader?: string | undefined;
1764
1811
  }, {
1765
1812
  path: string;
1766
- actions: string[];
1767
1813
  expiry: Date;
1814
+ actions: string[];
1768
1815
  spaceId: string;
1769
1816
  cid: string;
1770
1817
  delegateDID: string;
@@ -1803,8 +1850,8 @@ declare const DelegationChainV2Schema: z.ZodObject<{
1803
1850
  authHeader: z.ZodOptional<z.ZodString>;
1804
1851
  }, "strip", z.ZodTypeAny, {
1805
1852
  path: string;
1806
- actions: string[];
1807
1853
  expiry: Date;
1854
+ actions: string[];
1808
1855
  spaceId: string;
1809
1856
  cid: string;
1810
1857
  delegateDID: string;
@@ -1816,8 +1863,8 @@ declare const DelegationChainV2Schema: z.ZodObject<{
1816
1863
  authHeader?: string | undefined;
1817
1864
  }, {
1818
1865
  path: string;
1819
- actions: string[];
1820
1866
  expiry: Date;
1867
+ actions: string[];
1821
1868
  spaceId: string;
1822
1869
  cid: string;
1823
1870
  delegateDID: string;
@@ -1856,8 +1903,8 @@ declare const DelegationChainV2Schema: z.ZodObject<{
1856
1903
  authHeader: z.ZodOptional<z.ZodString>;
1857
1904
  }, "strip", z.ZodTypeAny, {
1858
1905
  path: string;
1859
- actions: string[];
1860
1906
  expiry: Date;
1907
+ actions: string[];
1861
1908
  spaceId: string;
1862
1909
  cid: string;
1863
1910
  delegateDID: string;
@@ -1869,8 +1916,8 @@ declare const DelegationChainV2Schema: z.ZodObject<{
1869
1916
  authHeader?: string | undefined;
1870
1917
  }, {
1871
1918
  path: string;
1872
- actions: string[];
1873
1919
  expiry: Date;
1920
+ actions: string[];
1874
1921
  spaceId: string;
1875
1922
  cid: string;
1876
1923
  delegateDID: string;
@@ -1884,8 +1931,8 @@ declare const DelegationChainV2Schema: z.ZodObject<{
1884
1931
  }, "strip", z.ZodTypeAny, {
1885
1932
  root: {
1886
1933
  path: string;
1887
- actions: string[];
1888
1934
  expiry: Date;
1935
+ actions: string[];
1889
1936
  spaceId: string;
1890
1937
  cid: string;
1891
1938
  delegateDID: string;
@@ -1898,8 +1945,8 @@ declare const DelegationChainV2Schema: z.ZodObject<{
1898
1945
  };
1899
1946
  chain: {
1900
1947
  path: string;
1901
- actions: string[];
1902
1948
  expiry: Date;
1949
+ actions: string[];
1903
1950
  spaceId: string;
1904
1951
  cid: string;
1905
1952
  delegateDID: string;
@@ -1912,8 +1959,8 @@ declare const DelegationChainV2Schema: z.ZodObject<{
1912
1959
  }[];
1913
1960
  leaf: {
1914
1961
  path: string;
1915
- actions: string[];
1916
1962
  expiry: Date;
1963
+ actions: string[];
1917
1964
  spaceId: string;
1918
1965
  cid: string;
1919
1966
  delegateDID: string;
@@ -1927,8 +1974,8 @@ declare const DelegationChainV2Schema: z.ZodObject<{
1927
1974
  }, {
1928
1975
  root: {
1929
1976
  path: string;
1930
- actions: string[];
1931
1977
  expiry: Date;
1978
+ actions: string[];
1932
1979
  spaceId: string;
1933
1980
  cid: string;
1934
1981
  delegateDID: string;
@@ -1941,8 +1988,8 @@ declare const DelegationChainV2Schema: z.ZodObject<{
1941
1988
  };
1942
1989
  chain: {
1943
1990
  path: string;
1944
- actions: string[];
1945
1991
  expiry: Date;
1992
+ actions: string[];
1946
1993
  spaceId: string;
1947
1994
  cid: string;
1948
1995
  delegateDID: string;
@@ -1955,8 +2002,8 @@ declare const DelegationChainV2Schema: z.ZodObject<{
1955
2002
  }[];
1956
2003
  leaf: {
1957
2004
  path: string;
1958
- actions: string[];
1959
2005
  expiry: Date;
2006
+ actions: string[];
1960
2007
  spaceId: string;
1961
2008
  cid: string;
1962
2009
  delegateDID: string;
@@ -2096,8 +2143,8 @@ declare const ShareLinkSchema: z.ZodObject<{
2096
2143
  authHeader: z.ZodOptional<z.ZodString>;
2097
2144
  }, "strip", z.ZodTypeAny, {
2098
2145
  path: string;
2099
- actions: string[];
2100
2146
  expiry: Date;
2147
+ actions: string[];
2101
2148
  spaceId: string;
2102
2149
  cid: string;
2103
2150
  delegateDID: string;
@@ -2109,8 +2156,8 @@ declare const ShareLinkSchema: z.ZodObject<{
2109
2156
  authHeader?: string | undefined;
2110
2157
  }, {
2111
2158
  path: string;
2112
- actions: string[];
2113
2159
  expiry: Date;
2160
+ actions: string[];
2114
2161
  spaceId: string;
2115
2162
  cid: string;
2116
2163
  delegateDID: string;
@@ -2131,8 +2178,8 @@ declare const ShareLinkSchema: z.ZodObject<{
2131
2178
  url: string;
2132
2179
  delegation: {
2133
2180
  path: string;
2134
- actions: string[];
2135
2181
  expiry: Date;
2182
+ actions: string[];
2136
2183
  spaceId: string;
2137
2184
  cid: string;
2138
2185
  delegateDID: string;
@@ -2151,8 +2198,8 @@ declare const ShareLinkSchema: z.ZodObject<{
2151
2198
  url: string;
2152
2199
  delegation: {
2153
2200
  path: string;
2154
- actions: string[];
2155
2201
  expiry: Date;
2202
+ actions: string[];
2156
2203
  spaceId: string;
2157
2204
  cid: string;
2158
2205
  delegateDID: string;
@@ -2221,16 +2268,16 @@ declare const GenerateShareParamsSchema: z.ZodObject<{
2221
2268
  baseUrl: z.ZodOptional<z.ZodString>;
2222
2269
  }, "strip", z.ZodTypeAny, {
2223
2270
  path: string;
2224
- actions?: string[] | undefined;
2225
2271
  expiry?: Date | undefined;
2226
2272
  description?: string | undefined;
2273
+ actions?: string[] | undefined;
2227
2274
  schema?: "base64" | "compact" | "ipfs" | undefined;
2228
2275
  baseUrl?: string | undefined;
2229
2276
  }, {
2230
2277
  path: string;
2231
- actions?: string[] | undefined;
2232
2278
  expiry?: Date | undefined;
2233
2279
  description?: string | undefined;
2280
+ actions?: string[] | undefined;
2234
2281
  schema?: "base64" | "compact" | "ipfs" | undefined;
2235
2282
  baseUrl?: string | undefined;
2236
2283
  }>;
@@ -3293,6 +3340,11 @@ declare class TinyCloud {
3293
3340
  * @throws Error if services are not initialized or vault service is not registered
3294
3341
  */
3295
3342
  get vault(): IDataVaultService;
3343
+ /**
3344
+ * Get the Encryption service.
3345
+ * @throws Error if services are not initialized or encryption service is not registered
3346
+ */
3347
+ get encryption(): IEncryptionService;
3296
3348
  /**
3297
3349
  * Notify services of session change.
3298
3350
  * Called internally after sign-in and sign-out.
@@ -4463,6 +4515,7 @@ declare class UnsupportedFeatureError extends Error {
4463
4515
  }
4464
4516
  interface NodeInfo {
4465
4517
  features: string[];
4518
+ nodeId?: string;
4466
4519
  quotaUrl?: string;
4467
4520
  }
4468
4521
  declare function checkNodeInfo(host: string, sdkProtocol: number, fetchFn?: typeof globalThis.fetch): Promise<NodeInfo>;
@@ -4565,5 +4618,35 @@ declare function resolveCloudLocation(subject: string, options?: ResolveCloudLoc
4565
4618
  declare function resolveTinyCloudHosts(subject: string, options?: ResolveTinyCloudHostsOptions): Promise<ResolvedTinyCloudHosts>;
4566
4619
  declare function multiaddrToHttpUrl(input: string): string;
4567
4620
  declare function httpUrlToMultiaddr(input: string): string;
4621
+ declare function verifyDidKeyEd25519Signature(did: string, payload: Uint8Array, signature: Uint8Array): boolean;
4622
+
4623
+ /**
4624
+ * Default lifetimes for the various delegation shapes the SDK mints.
4625
+ *
4626
+ * The SDK has many delegation flows (session sign-in, runtime grants,
4627
+ * share links, manifest installs, public-space sub-delegations, …) and
4628
+ * each one used to pick its own number freehand. That made it hard to
4629
+ * tell whether a chosen value was deliberate or copy-pasted, and made
4630
+ * silent inconsistencies easy to ship.
4631
+ *
4632
+ * Every default below answers two questions:
4633
+ * - Who recovers if the delegation leaks? (re-auth, revocation, no one)
4634
+ * - Who is the principal at use time? (issuer, third party)
4635
+ *
4636
+ * The five tiers fall out of those answers. Pick a tier, not a number,
4637
+ * when introducing a new delegation surface.
4638
+ *
4639
+ * @packageDocumentation
4640
+ */
4641
+ declare const EXPIRY: {
4642
+ readonly EPHEMERAL_MS: number;
4643
+ readonly SIGNED_READ_URL_MS: number;
4644
+ readonly SESSION_MS: number;
4645
+ readonly SHARE_MS: number;
4646
+ readonly APP_MS: number;
4647
+ readonly MAX_MS: number;
4648
+ };
4649
+ declare const DEFAULT_SIGNED_READ_URL_EXPIRY_MS: number;
4650
+ type ExpiryTier = keyof typeof EXPIRY;
4568
4651
 
4569
- 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, type ValidationError, VersionCheckError, type WasmRecapEntry, activateSessionWithHost, applyPrefix, buildSpaceUri, canonicalLocationPayload, checkNodeInfo, composeManifestRequest, createCapabilityKeyRegistry, createSharingService, createSpaceService, defaultSignStrategy, defaultSpaceCreationHandler, expandActionShortNames, 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 };
4652
+ 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_SIGNED_READ_URL_EXPIRY_MS, 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, ENCRYPTION_MANIFEST_SPACE, ENCRYPTION_PERMISSION_SERVICE, 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, verifyDidKeyEd25519Signature, verifyLocationRecord };