@tinycloud/web-sdk 3.11.0 → 3.12.0-beta.1

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
@@ -54,9 +54,16 @@ changed its manifest (for example a new permission or prefix), the stored
54
54
  session is cleared and the user is asked again, automatically. The check is
55
55
  local: it reads the session's signed permissions (and any approved runtime
56
56
  grants), and the default browser storage does not restore a session past its
57
- expiry. It does not contact the node, so a session the node rejects (a 401
58
- after a revocation or a reset, for example) is still restored. With OpenKey,
59
- `prepareSignIn()` makes the same check.
57
+ expiry. The permission check does not contact the node, so a session the node
58
+ rejects (a 401 after a revocation or a reset, for example) is still restored.
59
+ With OpenKey, `prepareSignIn()` makes the same check.
60
+
61
+ Restoring a session makes one node read, capped at 5 seconds, to learn whether
62
+ the session's primary space is hosted. It never prompts and never fails the
63
+ restore. Read the answer from `tc.spaceHosting` (`"hosted"`, `"not-hosted"` or
64
+ `"unknown"`). At sign-in the answer comes from the node's activation of the new
65
+ session. `signIn()` on a restored session whose space is `"not-hosted"` returns
66
+ the restored session.
60
67
 
61
68
  To force a fresh consent, sign out first. `signOut()` clears the stored session
62
69
  and blocks restoring until the next sign-in succeeds, so `signIn()` prompts:
@@ -21,6 +21,14 @@ export declare class BrowserSessionStorage implements ISessionStorage {
21
21
  private defaultStorage;
22
22
  private key;
23
23
  private activeAddressKey;
24
+ private fenceKey;
25
+ /**
26
+ * Fences the session with `signature` stored for `address`, for when removing its record fails: a restore
27
+ * checks {@link isSignedOut} and refuses it. A successful `clear` lifts the fence, and so does saving a
28
+ * different session.
29
+ */
30
+ markSignedOut(address: string, signature: string): void;
31
+ isSignedOut(address: string, signature: string): boolean;
24
32
  private clearActiveAddress;
25
33
  private assertPersistable;
26
34
  save(address: string, data: PersistedSessionData): Promise<void>;