@tinycloud/web-sdk 3.14.0-beta.2 → 3.14.0-beta.20

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. A port other than 80 or 443 is part of the name: `notes.example.com:8443` gets `applications/com.example.notes_8443/`. Outside a browser, set `domain`; without one, apps share `applications/xyz.tinycloud.app/` and log how to get their own. 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
@@ -566,6 +567,6 @@ The web SDK includes implicit account bootstrap permissions only at the approved
566
567
 
567
568
  `autoBootstrapAccount: false` disables account bootstrap and its implicit sign-in permissions, including in the node SDK. `includeAccountRegistryPermissions: false` omits the implicit account registry bundle. Setting either option to `true` does not enable first-party bootstrap at another origin. The policy uses the actual page origin, independently of a configured SIWE domain.
568
569
 
569
- A third-party sign-in with no registered account route returns `ACCOUNT_SETUP_REQUIRED` with `setupUrl: "https://home.tinycloud.xyz/"` before signing. Complete setup there and retry. Registry availability errors retain their existing behavior. Setup status for accounts that already have a registry record is unchanged.
570
+ A third-party sign-in with no registered account route returns `ACCOUNT_SETUP_REQUIRED` with `setupUrl: "https://tinycloud.one/"` before signing. Complete setup there and retry. Registry availability errors retain their existing behavior. Setup status for accounts that already have a registry record is unchanged.
570
571
 
571
572
  Details: TC-2931
@@ -9,6 +9,7 @@ export declare class BrowserWasmBindings implements IWasmBindings {
9
9
  get completeSessionSetup(): typeof tinycloud.completeSessionSetup;
10
10
  validatePersistedSession(proof: PersistedSessionProof): any;
11
11
  validatePersistedSessionForRenewal(proof: PersistedSessionProof): any;
12
+ validateSessionRoot(proof: PersistedSessionProof): any;
12
13
  computeCid(data: Uint8Array, codec: bigint): string;
13
14
  ensureEip55(address: string): string;
14
15
  makeSpaceId(address: string, chainId: number, prefix: string): string;