@tinycloud/web-sdk 3.12.0-beta.9 → 3.12.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.
Files changed (49) hide show
  1. package/README.md +30 -8
  2. package/dist/adapters/BrowserSessionStorage.d.ts +13 -3
  3. package/dist/adapters/BrowserWasmBindings.d.ts +2 -0
  4. package/dist/delegations-issued.cjs +2 -1
  5. package/dist/delegations-issued.cjs.LICENSE.txt +5 -0
  6. package/dist/delegations-issued.mjs +2 -1
  7. package/dist/delegations-issued.mjs.LICENSE.txt +5 -0
  8. package/dist/delegations-renewal-entry.d.ts +3 -0
  9. package/dist/delegations-renewal.cjs +2 -0
  10. package/dist/delegations-renewal.cjs.LICENSE.txt +21 -0
  11. package/dist/delegations-renewal.mjs +2 -0
  12. package/dist/delegations-renewal.mjs.LICENSE.txt +21 -0
  13. package/dist/encryption-keys.cjs +1 -1
  14. package/dist/encryption-keys.cjs.LICENSE.txt +4 -0
  15. package/dist/encryption-keys.mjs +1 -1
  16. package/dist/encryption-keys.mjs.LICENSE.txt +4 -0
  17. package/dist/index.cjs +1 -1
  18. package/dist/index.cjs.LICENSE.txt +2 -0
  19. package/dist/index.d.ts +2 -0
  20. package/dist/index.mjs +1 -1
  21. package/dist/index.mjs.LICENSE.txt +2 -0
  22. package/dist/modals.cjs +1 -1
  23. package/dist/modals.mjs +1 -1
  24. package/dist/modules/Storage/tinycloud/module.d.ts +1 -0
  25. package/dist/modules/Storage/tinycloud/types.schema.d.ts +10 -10
  26. package/dist/modules/requestPermissionsCore.d.ts +0 -7
  27. package/dist/modules/restoreAccount.d.ts +13 -0
  28. package/dist/modules/runtimeGrantPersistence.d.ts +4 -2
  29. package/dist/modules/tcw.d.ts +27 -6
  30. package/dist/panel.cjs +1 -1
  31. package/dist/panel.mjs +1 -1
  32. package/dist/registry-verdict-cache-entry.d.ts +2 -0
  33. package/dist/registry-verdict-cache.cjs +1 -0
  34. package/dist/registry-verdict-cache.mjs +1 -0
  35. package/dist/replica.cjs +1 -1
  36. package/dist/replica.mjs +1 -1
  37. package/dist/share-placement-core-bridge.d.ts +2 -0
  38. package/dist/share-placement-core.d.ts +13 -0
  39. package/dist/share-placement-entry.d.ts +2 -0
  40. package/dist/share-placement.cjs +2 -0
  41. package/dist/share-placement.cjs.LICENSE.txt +3 -0
  42. package/dist/share-placement.mjs +2 -0
  43. package/dist/share-placement.mjs.LICENSE.txt +3 -0
  44. package/dist/space-hosting-entry.d.ts +1 -1
  45. package/dist/space-hosting.cjs +1 -1
  46. package/dist/space-hosting.mjs +1 -1
  47. package/dist/ui/pending.d.ts +1 -1
  48. package/dist/ui/strings.d.ts +2 -0
  49. package/package.json +7 -7
@@ -0,0 +1,13 @@
1
+ import { type PersistedSessionData } from "@tinycloud/sdk-core";
2
+ export declare class SessionAccountMismatchError extends Error {
3
+ readonly code = "ACCOUNT_MISMATCH";
4
+ constructor();
5
+ }
6
+ /** Address-only callers retain their existing chain selection; DID/CAIP callers pin it. */
7
+ export declare function requestedRestoreAccount(account: string): {
8
+ address: string;
9
+ chainId?: number;
10
+ };
11
+ /** Bind the request to the verified CACAO owner before restoring any session state. */
12
+ export declare function assertRequestedRestoreAccount(requested: string, session: Pick<PersistedSessionData, "address" | "chainId" | "tinycloudSession">): Promise<void>;
13
+ //# sourceMappingURL=restoreAccount.d.ts.map
@@ -3,7 +3,9 @@ export interface RuntimeGrantStore {
3
3
  loadRuntimeGrants(address: string): Promise<PortableDelegation[]>;
4
4
  saveRuntimeGrants(address: string, grants: readonly PortableDelegation[]): Promise<void>;
5
5
  }
6
- /** How long a restore waits for stored grants to be activated before it carries on without them. */
6
+ /** Serialize short storage mutations while grant activation runs independently. */
7
+ export declare function serializeRuntimeGrantMutation<T>(store: RuntimeGrantStore | undefined, mutation: () => Promise<T>): Promise<T>;
8
+ /** Bound for the automatic post-restore grant reactivation wait. */
7
9
  export declare const RESTORE_GRANT_BUDGET_MS = 4000;
8
10
  interface Resource {
9
11
  readonly service: string;
@@ -26,7 +28,7 @@ export declare function isPanelGrant(grant: PortableDelegation, address: string)
26
28
  * Stores the panel's own grants among `grants` for `address`, replacing a stored grant with the same cid. Other
27
29
  * delegations (an app's larger grant that already covered the request) are never stored.
28
30
  */
29
- export declare function rememberRuntimeGrants(store: RuntimeGrantStore, address: string, grants: readonly PortableDelegation[]): Promise<void>;
31
+ export declare function rememberRuntimeGrants(store: RuntimeGrantStore, address: string, grants: readonly PortableDelegation[], isCurrent?: () => boolean): Promise<void>;
30
32
  /**
31
33
  * Activates each stored grant through `use` (the SDK's validated activation). A grant refused for good is removed from
32
34
  * storage; the others stay, including one whose activation failed for a transient reason. Waits at most `budgetMs`;
@@ -35,6 +35,12 @@ export interface RuntimePermissionSigner {
35
35
  * Extends ClientConfig with browser-specific options.
36
36
  */
37
37
  export interface Config extends ClientConfig {
38
+ /** Write TCW2 network-key wraps. Disabled by default. */
39
+ keyWrapV2?: boolean;
40
+ /** Require TCW2 incoming network-key wraps, not signed receiver responses. Disabled by default. */
41
+ requireKeyWrapV2?: boolean;
42
+ /** Refuse explicitly designated legacy plaintext columns. Disabled by default. */
43
+ strictEncryption?: boolean;
38
44
  /**
39
45
  * OpenKey authorize-sign client. Requires @openkey/sdk >=0.12.2; popup is the default mode.
40
46
  *
@@ -68,6 +74,8 @@ export interface Config extends ClientConfig {
68
74
  tinycloudRegistryUrl?: string | null;
69
75
  /** Host hint for owners absent from both v2 and v1 registries. Default https://node.tinycloud.xyz; null disables onboarding. */
70
76
  newUserHost?: string | null;
77
+ /** Explicit wallet-owner signing for private share placement. */
78
+ sharePlacementSigner?: (message: string) => Promise<string>;
71
79
  /** Chain ID used to distinguish a v1-only owner from an owner with no registry entry. Default 1. */
72
80
  registryChainId?: number;
73
81
  /** Highest signed v2 sequence seen per owner. Default: a `localStorage`-backed store. */
@@ -118,7 +126,7 @@ export interface Config extends ClientConfig {
118
126
  persistSession?: boolean;
119
127
  /** Custom session storage implementation. */
120
128
  sessionStorage?: ISessionStorage;
121
- /** Whether to run node-sdk's canonical first-account bootstrap after sign-in. */
129
+ /** Enable first-party account bootstrap. Defaults on only at approved first-party page origins; false also omits implicit account and capabilities-read grants. */
122
130
  autoBootstrapAccount?: boolean;
123
131
  /** Browser storage key prefix for isolating apps/environments. */
124
132
  sessionStorageKeyPrefix?: string;
@@ -144,7 +152,7 @@ export interface Config extends ClientConfig {
144
152
  capabilityRequest?: ComposedManifestRequest;
145
153
  /** Strategy for TinyCloud root signature requests. */
146
154
  signStrategy?: SignStrategy;
147
- /** Include canonical account registry read/create-update/list permissions in plain sessions and composed manifests. Default true. */
155
+ /** Include implicit account registry/bootstrap authority. First-party only; false or autoBootstrapAccount:false disables it. Third-party origins always omit it. */
148
156
  includeAccountRegistryPermissions?: boolean;
149
157
  /** Default-off service telemetry. */
150
158
  telemetry?: TelemetryConfig;
@@ -190,8 +198,9 @@ export interface ShareReceiveResult<T = unknown> {
190
198
  export declare class TinyCloudWeb {
191
199
  private openkeySignInInFlight;
192
200
  private prepareSignInToken;
193
- /** How long a restore waits for the node's hosting answer. */
201
+ /** Time bound for the background hosting probe. */
194
202
  private spaceHostingCapMs;
203
+ private restoredNetworkWork?;
195
204
  private preparedSignIn?;
196
205
  private invalidatePreparedSignIn;
197
206
  /** The connected wallet's raw EIP-1193 provider. */
@@ -224,6 +233,7 @@ export declare class TinyCloudWeb {
224
233
  /** The signer set with `setRuntimePermissionSigner`, with the session it was set for. */
225
234
  private runtimeSigner?;
226
235
  private signOutInFlight;
236
+ private signOutOperation?;
227
237
  private persistedRestoreBlocked;
228
238
  private signOutCleanupFailed;
229
239
  private remoteSignOutTimeoutMs;
@@ -259,6 +269,7 @@ export declare class TinyCloudWeb {
259
269
  */
260
270
  private _testHooks?;
261
271
  constructor(callerConfig?: Config);
272
+ private bootstrapSignInPolicy;
262
273
  /**
263
274
  * Async initialization: ensure WASM is ready, then create TinyCloudNode.
264
275
  * @internal
@@ -327,7 +338,7 @@ export declare class TinyCloudWeb {
327
338
  get delegations(): DelegationManager;
328
339
  get capabilityRegistry(): ICapabilityKeyRegistry;
329
340
  get spaceId(): string | undefined;
330
- /** The node's last answer for whether the primary space is hosted (`"unknown"` until it has answered). */
341
+ /** Hosting display hint bound to account, space and host, corrected by the automatic background probe. */
331
342
  get spaceHosting(): SpaceHosting;
332
343
  get accountSpaceId(): string | undefined;
333
344
  get account(): AccountService;
@@ -377,6 +388,14 @@ export declare class TinyCloudWeb {
377
388
  private trackRestoreAddress;
378
389
  private untrackRestoreAddress;
379
390
  restoreSession(address?: string): Promise<SessionRestoreResult>;
391
+ /**
392
+ * Restore an expired browser session only when the owner-signed lease admission
393
+ * and the node's independently verified renewal history extend its authority.
394
+ * The lease authorization must come from an owner-approved source, not storage metadata.
395
+ */
396
+ restoreSessionWithRenewal(leaseAuthorization: string, address?: string): Promise<SessionRestoreResult>;
397
+ private restoreSessionInternal;
398
+ private startRestoredNetworkWork;
380
399
  /** One node read for the restored session, held to {@link spaceHostingCapMs}; past it, or on any failure, the answer stays unknown. */
381
400
  private probeSpaceHosting;
382
401
  private spaceHostingInFlight?;
@@ -460,6 +479,10 @@ export declare class TinyCloudWeb {
460
479
  disableSubDelegation?: boolean;
461
480
  expiryMs?: number;
462
481
  }): Promise<PortableDelegation>;
482
+ /** Owner-sign and admit a bounded renewal lease for the current session. */
483
+ createRenewalLease(expiresAt: Date): Promise<Awaited<ReturnType<TinyCloudNode["createRenewalLease"]>>>;
484
+ /** Verify current node-admitted renewal authority for the current session. */
485
+ getRenewalEffectiveExpiry(leaseAuthorization: string): Promise<number>;
463
486
  /** Create and activate a wallet-rooted delegation for an ephemeral share key. */
464
487
  createOwnerDelegation(params: CreateOwnerDelegationParams extends infer PermissionShape ? PermissionShape extends CreateOwnerDelegationParams ? Omit<PermissionShape, "spaceId"> & {
465
488
  readonly spaceId?: string;
@@ -515,8 +538,6 @@ export declare class TinyCloudWeb {
515
538
  * On approve, this does not mutate the manifest or force a new sign-in.
516
539
  * The underlying node creates a secondary delegation to the current
517
540
  * session key and records it in the invocation permission map.
518
- * Exact current-owner `default/share/<id>` key creation is bound to this
519
- * live signed session across consent. Native shells cannot request it.
520
541
  *
521
542
  * `options.expiryMs` sets the requested lifetime of the issued step-up
522
543
  * delegation, in milliseconds. Omitted, the node's default applies. The