@tinycloud/web-sdk 3.8.0-beta.1 → 3.8.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/README.md CHANGED
@@ -71,6 +71,7 @@ Duplicate registration throws immediately; enabling replication without
71
71
  registration throws at construction. Replication off requires no plugin, and a
72
72
  refused local replica does not end an otherwise valid network session.
73
73
  Set `replication.syncScope: 'prefixes'` to request sign-in sync only on the declared prefixes.
74
+ Set `replication.contentFetch: 'lazy'` to sync entry names without downloading values; reads of values the replica does not hold go to the network. The default is `'eager'`.
74
75
 
75
76
  Use the same module format for registration and the client: importing both
76
77
  ESM and CJS root bundles in one process creates independent module registries.
@@ -1,4 +1,5 @@
1
1
  import { ISessionStorage, PersistedSessionData } from "@tinycloud/sdk-core";
2
+ import type { PortableDelegation } from "@tinycloud/node-sdk/core";
2
3
  export type BrowserSessionLoadStatus = "loaded" | "missing" | "expired" | "corrupt" | "storage-unavailable";
3
4
  export type BrowserSessionLoadResult = {
4
5
  status: "loaded";
@@ -29,6 +30,22 @@ export declare class BrowserSessionStorage implements ISessionStorage {
29
30
  private validateForNetworkRestore;
30
31
  loadWithStatus(address: string): Promise<BrowserSessionLoadResult>;
31
32
  clear(address: string): Promise<void>;
33
+ private grantsKey;
34
+ /**
35
+ * Stores `grants` (runtime delegations to the stored session's key) beside the session record, in the same storage.
36
+ * They are bearer proofs for that key, so they live and die with the session record: `save` of a new session,
37
+ * `clear` and sign-out remove them, and `loadRuntimeGrants` returns none once the session is missing or expired.
38
+ * An empty list removes the entry. A storage that refuses the write (quota, blocked) leaves the grants unsaved:
39
+ * the grant then lasts until the page reloads. Never rejects.
40
+ */
41
+ saveRuntimeGrants(address: string, grants: readonly PortableDelegation[]): Promise<void>;
42
+ private writeRuntimeGrants;
43
+ /**
44
+ * The unexpired, well-formed grants saved for `address` while its session record is valid. Expired or malformed ones
45
+ * are removed. Never rejects: an unreadable storage answers none.
46
+ */
47
+ loadRuntimeGrants(address: string): Promise<PortableDelegation[]>;
48
+ private readRuntimeGrants;
32
49
  exists(address: string): boolean;
33
50
  isAvailable(): boolean;
34
51
  }