@tinycloud/web-sdk 3.14.0-beta.4 → 3.14.0-beta.6

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
@@ -31,19 +31,18 @@ bun add @tinycloud/web-sdk
31
31
  ## Quick Start
32
32
 
33
33
  ```typescript
34
- import { TinyCloudWeb } from '@tinycloud/web-sdk';
34
+ import { TinyCloudWeb, type Manifest } from '@tinycloud/web-sdk';
35
35
 
36
- // Initialize the SDK
37
- const tc = new TinyCloudWeb();
36
+ // The manifest names the app. With no `permissions`, the app gets
37
+ // KV and SQL under `com.example.notes/` in the `applications` space.
38
+ const manifest: Manifest = { app_id: 'com.example.notes', name: 'Notes' };
38
39
 
39
- // Connect to the user's wallet
40
- await tc.connect();
40
+ const tc = new TinyCloudWeb({ manifest });
41
+ await tc.signIn();
41
42
 
42
- // Use storage
43
- const storage = tc.storage;
44
- await storage.put('myKey', { hello: 'world' });
45
- const result = await storage.get('myKey');
46
- console.log(result.data); // { hello: 'world' }
43
+ // KV storage
44
+ await tc.kv.put('com.example.notes/myKey', { hello: 'world' });
45
+ const result = await tc.kv.get('com.example.notes/myKey');
47
46
  ```
48
47
 
49
48
  ### Stored sessions and `signIn()`
@@ -58,6 +57,8 @@ expiry. The permission check does not contact the node, so a session the node
58
57
  rejects (a 401 after a revocation or a reset, for example) is still restored.
59
58
  With OpenKey, `prepareSignIn()` makes the same check.
60
59
 
60
+ Without a `manifest`, `signIn()` asks only for the app's own folder, `applications/<your domain reversed>/` (KV and SQL), and logs a warning. Sessions last 7 days unless you set `sessionExpirationMs`.
61
+
61
62
  `restoreSession()` resolves from stored state. It automatically starts a
62
63
  background hosting probe, capped at 5 seconds, and reactivates stored panel
63
64
  grants. Read `tc.spaceHosting` (`"hosted"`, `"not-hosted"` or `"unknown"`) for