@tinycloud/web-sdk 2.11.0-beta.9 → 2.11.1-beta.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.
@@ -9,12 +9,13 @@
9
9
  *
10
10
  * @packageDocumentation
11
11
  */
12
- import { TinyCloudNode, type BootstrapWarning, type DelegateToOptions, type DelegateToResult, type ISessionStorage, type SignStrategy } from "@tinycloud/node-sdk/core";
12
+ import { TinyCloudNode, type BootstrapWarning, type DelegateToOptions, type DelegateToResult, type ISessionStorage, type SignStrategy, type ValidatedRuntimeDelegation, type UnifiedOwnerRootInput, type UnifiedOwnerRootReceipt } from "@tinycloud/node-sdk/core";
13
13
  import { IKVService, ISQLService, IDuckDbService, IDataVaultService, ISecretsService, ISpaceService, ISpace, ISharingService, ICapabilityKeyRegistry, IHooksService, IEncryptionService, DelegationManager, Delegation, DelegationRevocationReceipt, CreateDelegationParams, Result, DelegationError, ClientSession, Extension, type TelemetryConfig, ISpaceCreationHandler, type Manifest, type ComposedManifestRequest, type AccountService, type ResolvedDelegate, type PermissionEntry, type NetworkDescriptor, type CreateOwnerDelegationParams, type OwnerDelegationReceipt, type RegisterOwnerSharePolicyParams, type OwnerSharePolicyRegistrationReceipt, type LocalNodeIdentityStore, SignInOptions } from "@tinycloud/sdk-core";
14
14
  import type { providers } from "ethers";
15
15
  import { RPCProviders, ClientConfig } from "../providers";
16
16
  import type { NotificationConfig } from "../notifications/types";
17
17
  import type { PortableDelegation, DelegatedAccess } from "@tinycloud/node-sdk/core";
18
+ import { CredentialsService } from "../credentials";
18
19
  declare global {
19
20
  interface Window {
20
21
  ethereum?: any;
@@ -78,6 +79,8 @@ export interface Config extends ClientConfig {
78
79
  persistSession?: boolean;
79
80
  /** Custom session storage implementation. */
80
81
  sessionStorage?: ISessionStorage;
82
+ /** Whether to run node-sdk's canonical first-account bootstrap after sign-in. */
83
+ autoBootstrapAccount?: boolean;
81
84
  /** Browser storage key prefix for isolating apps/environments. */
82
85
  sessionStorageKeyPrefix?: string;
83
86
  /** SIWE domain (default: window.location.hostname in browser, app.tinycloud.xyz otherwise) */
@@ -102,7 +105,7 @@ export interface Config extends ClientConfig {
102
105
  capabilityRequest?: ComposedManifestRequest;
103
106
  /** Strategy for TinyCloud root signature requests. */
104
107
  signStrategy?: SignStrategy;
105
- /** Include implicit account registry permissions when composing `manifest`. Default true. */
108
+ /** Include canonical account registry read/create-update/list permissions in plain sessions and composed manifests. Default true. */
106
109
  includeAccountRegistryPermissions?: boolean;
107
110
  /** Default-off service telemetry. */
108
111
  telemetry?: TelemetryConfig;
@@ -148,6 +151,7 @@ export declare class TinyCloudWeb {
148
151
  private sessionStorage?;
149
152
  private _sessionRestoreStatus;
150
153
  private _secrets;
154
+ private _credentialsService?;
151
155
  /** Promise that resolves when WASM + node are ready */
152
156
  private _initPromise;
153
157
  /** User config */
@@ -224,6 +228,8 @@ export declare class TinyCloudWeb {
224
228
  get account(): AccountService;
225
229
  get hosts(): string[];
226
230
  get sessionRestoreStatus(): SessionRestoreStatus;
231
+ /** Holder-bound OpenCredentials issuance using the active TinyCloud session. */
232
+ get credentials(): CredentialsService;
227
233
  space(nameOrUri: string): ISpace;
228
234
  get kvPrefix(): string;
229
235
  getEncryptionNetwork(nameOrNetworkId?: string): Promise<NetworkDescriptor | null>;
@@ -263,10 +269,23 @@ export declare class TinyCloudWeb {
263
269
  chainId: () => number | undefined;
264
270
  get did(): string;
265
271
  get sessionDid(): string;
272
+ get credentialHolderDid(): string;
273
+ get credentialHolderKid(): string;
266
274
  get isSessionOnly(): boolean;
267
275
  get isWalletConnected(): boolean;
268
276
  /** Sign protocol bytes with the established session key without exposing key material. */
269
277
  signSessionBytes(bytes: Uint8Array): Promise<Uint8Array>;
278
+ createUnifiedOwnerRoot(input: UnifiedOwnerRootInput): Promise<UnifiedOwnerRootReceipt>;
279
+ autoSignCredentialBytes(bytes: Uint8Array): Promise<Uint8Array | undefined>;
280
+ approveCredentialBytes(bytes: Uint8Array): Promise<Uint8Array>;
281
+ activateCompactRuntimeDelegation(input: {
282
+ readonly authorization: string;
283
+ readonly cid: string;
284
+ readonly host: string;
285
+ }): Promise<ValidatedRuntimeDelegation>;
286
+ credentialSpaceOwnerDid(spaceId: string): string;
287
+ /** Root authorization CID of the active session, which {@link session} omits. */
288
+ accountAuthorizationCid(): string;
270
289
  extend(_extension: Extension): void;
271
290
  cleanup(): void;
272
291
  connectWallet(provider: providers.ExternalProvider | providers.Web3Provider, options?: {
@@ -345,6 +364,12 @@ export declare class TinyCloudWeb {
345
364
  delegateDID: string;
346
365
  disableSubDelegation?: boolean;
347
366
  expiryMs?: number;
367
+ resources?: Array<{
368
+ service: string;
369
+ space?: string;
370
+ path: string;
371
+ actions: string[];
372
+ }>;
348
373
  }): Promise<PortableDelegation>;
349
374
  delegate(params: CreateDelegationParams): Promise<Result<Delegation, DelegationError>>;
350
375
  revokeDelegation(cid: string): Promise<Result<DelegationRevocationReceipt, DelegationError>>;
@@ -1,8 +1,8 @@
1
- import type { ClientSession, Manifest } from "@tinycloud/sdk-core";
1
+ import type { ClientSession, Manifest, SignCallback } from "@tinycloud/sdk-core";
2
2
  import { TinyCloudWeb, type Config } from "./modules/tcw";
3
3
  declare const SESSION_EXPIRATION_MS: 3600000;
4
4
  declare const SESSION_STORAGE_KEY_PREFIX: "coordinationos:tinycloud:session:v1:";
5
- type CoordinationOsControlledConfig = "provider" | "providers" | "signStrategy" | "manifest" | "capabilityRequest" | "siweConfig" | "nonce" | "domain" | "persistSession" | "sessionStorage" | "sessionExpirationMs" | "sessionStorageKeyPrefix" | "includeAccountRegistryPermissions" | "autoCreateSpace" | "spaceCreationHandler" | "spacePrefix" | "kvPrefix";
5
+ type CoordinationOsControlledConfig = "provider" | "providers" | "signStrategy" | "manifest" | "capabilityRequest" | "siweConfig" | "nonce" | "domain" | "persistSession" | "sessionStorage" | "sessionExpirationMs" | "sessionStorageKeyPrefix" | "includeAccountRegistryPermissions" | "autoCreateSpace" | "autoBootstrapAccount" | "spaceCreationHandler" | "spacePrefix" | "kvPrefix";
6
6
  export type EstablishOpenKeySessionStatus = "established" | "restored" | "missing" | "expired" | "corrupt" | "storage-unavailable" | "restore-failed" | "stale" | "disabled";
7
7
  export interface EstablishOpenKeySessionOptions {
8
8
  providerToken?: string;
@@ -18,6 +18,8 @@ export interface EstablishOpenKeySessionOptions {
18
18
  sessionStorageKeyPrefix: typeof SESSION_STORAGE_KEY_PREFIX;
19
19
  tinycloud?: Omit<Config, CoordinationOsControlledConfig>;
20
20
  fetch?: typeof fetch;
21
+ /** Normal OpenKey consent surface for credential bindings outside Auto-Sign policy. */
22
+ requestCredentialApproval?: SignCallback;
21
23
  }
22
24
  export interface EstablishOpenKeySessionResult {
23
25
  client: TinyCloudWeb;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tinycloud/web-sdk",
3
- "version": "2.11.0-beta.9",
3
+ "version": "2.11.1-beta.0",
4
4
  "description": "A set of tools and utilities to help you build your app with TinyCloud.",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",
@@ -44,9 +44,9 @@
44
44
  "@metamask/detect-provider": "^1.2.0",
45
45
  "@multiformats/multiaddr": "^13.0.1",
46
46
  "@multiformats/multiaddr-to-uri": "^12.0.0",
47
- "@tinycloud/node-sdk": "2.11.0-beta.9",
48
- "@tinycloud/sdk-core": "2.11.0-beta.9",
49
- "@tinycloud/web-sdk-wasm": "1.7.6-beta.0",
47
+ "@tinycloud/node-sdk": "2.11.1-beta.0",
48
+ "@tinycloud/sdk-core": "2.11.1-beta.0",
49
+ "@tinycloud/web-sdk-wasm": "1.7.6",
50
50
  "axios": "^1.7.9",
51
51
  "ethers": "^5.7.2",
52
52
  "lodash.merge": "^4.6.2",