@tinycloud/web-sdk 3.8.0-beta.9 → 3.8.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.
- package/README.md +3 -0
- package/dist/adapters/BrowserSessionStorage.d.ts +17 -0
- package/dist/credentials.cjs +1 -1
- package/dist/credentials.mjs +1 -1
- package/dist/delegations-issued-entry.d.ts +3 -0
- package/dist/delegations-issued.cjs +1 -0
- package/dist/delegations-issued.mjs +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.mjs +1 -1
- package/dist/modals.cjs +1 -1
- package/dist/modals.mjs +1 -1
- package/dist/modules/Storage/tinycloud/types.schema.d.ts +2 -2
- package/dist/modules/requestPermissionsCore.d.ts +8 -1
- package/dist/modules/runtimeGrantPersistence.d.ts +41 -0
- package/dist/modules/tcw.d.ts +52 -1
- package/dist/panel.cjs +1 -1
- package/dist/panel.mjs +1 -1
- package/dist/ui/api.d.ts +8 -0
- package/dist/ui/client.d.ts +14 -2
- package/dist/ui/config.d.ts +9 -0
- package/dist/ui/data/authority.d.ts +9 -1
- package/dist/ui/host.d.ts +2 -0
- package/dist/ui/panel-styles.d.ts +1 -1
- package/dist/ui/pending.d.ts +1 -1
- package/dist/ui/sections/delegations.strings.d.ts +5 -0
- package/dist/ui/slots.d.ts +13 -1
- package/dist/ui/styles.d.ts +1 -1
- package/package.json +6 -6
package/dist/modules/tcw.d.ts
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*
|
|
10
10
|
* @packageDocumentation
|
|
11
11
|
*/
|
|
12
|
-
import { TinyCloudNode, TinyCloudNodeConfig, type BootstrapWarning, type DelegateToOptions, type DelegateToResult, type ISessionStorage, type SignStrategy, type ValidatedRuntimeDelegation, type UnifiedOwnerRootInput, type UnifiedOwnerRootReceipt, type RegisterPolicyV3Input, type RegisterPolicyV3Receipt } from "@tinycloud/node-sdk/core";
|
|
12
|
+
import { TinyCloudNode, TinyCloudNodeConfig, type OpenKeyAuthorizeTinyCloud, type BootstrapWarning, type DelegateToOptions, type DelegateToResult, type ISessionStorage, type SignStrategy, type ValidatedRuntimeDelegation, type UnifiedOwnerRootInput, type UnifiedOwnerRootReceipt, type RegisterPolicyV3Input, type RegisterPolicyV3Receipt } from "@tinycloud/node-sdk/core";
|
|
13
13
|
import { type LocalCopyPurgeFailedEvent } from "./replica-wiring";
|
|
14
14
|
import { IKVService, ISQLService, IDuckDbService, IDataVaultService, ISecretsService, ISpaceService, ISpace, ISharingService, ICapabilityKeyRegistry, IHooksService, IEncryptionService, DelegationManager, Delegation, DelegationRevocationReceipt, Result, DelegationError, ClientSession, Extension, type TelemetryConfig, type RetryPolicy, ISpaceCreationHandler, type Manifest, type ComposedManifestRequest, type AccountService, type ResolvedDelegate, type PermissionEntry, type NetworkDescriptor, type CreateOwnerDelegationParams, type OwnerDelegationReceipt, type LocalNodeIdentityStore, type OnNodeNotFound, type RegistryPolicy, type RegistrySequenceStore, SignInOptions, type StorageFullEvent, type IStorageService } from "@tinycloud/sdk-core";
|
|
15
15
|
import { type RequestPermissionsOptions } from "./requestPermissionsCore";
|
|
@@ -25,12 +25,21 @@ declare global {
|
|
|
25
25
|
ethereum?: any;
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
+
/** Signs a message for a runtime permission grant; see `TinyCloudWeb.setRuntimePermissionSigner`. */
|
|
29
|
+
export interface RuntimePermissionSigner {
|
|
30
|
+
signMessage(message: string): Promise<string>;
|
|
31
|
+
}
|
|
28
32
|
/**
|
|
29
33
|
* Configuration for TinyCloudWeb.
|
|
30
34
|
*
|
|
31
35
|
* Extends ClientConfig with browser-specific options.
|
|
32
36
|
*/
|
|
33
37
|
export interface Config extends ClientConfig {
|
|
38
|
+
/** OpenKey authorize-sign client. Requires @openkey/sdk >=0.12.2; popup is the default mode. */
|
|
39
|
+
openkey?: {
|
|
40
|
+
client: OpenKeyAuthorizeTinyCloud;
|
|
41
|
+
mode?: "iframe" | "popup" | "redirect";
|
|
42
|
+
};
|
|
34
43
|
/** Notifications. `throwErrors` rethrows each error's raw message asynchronously, once per burst of identical errors (200 ms window). It applies unless `ui: false` or `ui.toasts: false`, which turn off toasts and throws together, as the old `popups: false` did; `ui.button: false` leaves throws on. Toast placement and visibility are set through `ui`. */
|
|
35
44
|
notifications?: NotificationConfig;
|
|
36
45
|
/** Optional prefix for KV service keys */
|
|
@@ -170,6 +179,10 @@ export interface ShareReceiveResult<T = unknown> {
|
|
|
170
179
|
host: string;
|
|
171
180
|
}
|
|
172
181
|
export declare class TinyCloudWeb {
|
|
182
|
+
private openkeySignInInFlight;
|
|
183
|
+
private prepareSignInToken;
|
|
184
|
+
private preparedSignIn?;
|
|
185
|
+
private invalidatePreparedSignIn;
|
|
173
186
|
/** The connected wallet's raw EIP-1193 provider. */
|
|
174
187
|
provider: BrowserProvider;
|
|
175
188
|
/** The normalized EIP-1193 provider used by the SDK. */
|
|
@@ -197,6 +210,8 @@ export declare class TinyCloudWeb {
|
|
|
197
210
|
private _sessionRestoreStatus;
|
|
198
211
|
/** Incremented by signOut; a sign-in that started before it does not complete. */
|
|
199
212
|
private signOutCount;
|
|
213
|
+
/** The signer set with `setRuntimePermissionSigner`, with the session it was set for. */
|
|
214
|
+
private runtimeSigner?;
|
|
200
215
|
private signOutInFlight;
|
|
201
216
|
private persistedRestoreBlocked;
|
|
202
217
|
private signOutCleanupFailed;
|
|
@@ -348,7 +363,15 @@ export declare class TinyCloudWeb {
|
|
|
348
363
|
restoreSession(address?: string): Promise<SessionRestoreResult>;
|
|
349
364
|
clearPersistedSession(address?: string): Promise<void>;
|
|
350
365
|
private configuredManifestPermissions;
|
|
366
|
+
/**
|
|
367
|
+
* Prepare an OpenKey SIWE before showing an approval button. Call after
|
|
368
|
+
* OpenKey connect(), then call signIn() from the button's click handler.
|
|
369
|
+
* A prepared request is single-use and valid for five minutes; call this
|
|
370
|
+
* method again if the approval button remains visible longer.
|
|
371
|
+
*/
|
|
372
|
+
prepareSignIn(): Promise<void>;
|
|
351
373
|
signIn: (options?: SignInOptions) => Promise<ClientSession>;
|
|
374
|
+
private performSignIn;
|
|
352
375
|
/**
|
|
353
376
|
* Sign out: end the session on this instance and clear the persisted
|
|
354
377
|
* session. Afterwards accessors return `undefined` and service calls remain
|
|
@@ -446,6 +469,8 @@ export declare class TinyCloudWeb {
|
|
|
446
469
|
* On approve, this does not mutate the manifest or force a new sign-in.
|
|
447
470
|
* The underlying node creates a secondary delegation to the current
|
|
448
471
|
* session key and records it in the invocation permission map.
|
|
472
|
+
* Exact current-owner `default/share/<id>` key creation is bound to this
|
|
473
|
+
* live signed session across consent. Native shells cannot request it.
|
|
449
474
|
*
|
|
450
475
|
* `options.expiryMs` sets the requested lifetime of the issued step-up
|
|
451
476
|
* delegation, in milliseconds. Omitted, the node's default applies. The
|
|
@@ -456,6 +481,32 @@ export declare class TinyCloudWeb {
|
|
|
456
481
|
* `expiryMs` does not apply to them.
|
|
457
482
|
*/
|
|
458
483
|
requestPermissions(additional: PermissionEntry[], options?: RequestPermissionsOptions): Promise<RequestPermissionsResult>;
|
|
484
|
+
/**
|
|
485
|
+
* Signs the SIWE of a runtime permission grant. Precedence: the signer set with `setRuntimePermissionSigner`, then
|
|
486
|
+
* the OpenKey client the session was established with (its byte-exact `signMessage`; an OpenKey session's wallet
|
|
487
|
+
* provider does not implement `personal_sign`), then undefined: the connected wallet signs. Only
|
|
488
|
+
* `requestPermissions` calls this; sign-in and session setup never do.
|
|
489
|
+
*/
|
|
490
|
+
private runtimeMessageSigner;
|
|
491
|
+
/**
|
|
492
|
+
* Sets the signer for runtime permission grants (`requestPermissions`, and the panel's "allow" buttons), or clears
|
|
493
|
+
* it with no argument. For apps whose sign-in is not the SDK's OpenKey flow, for example a restored session whose
|
|
494
|
+
* wallet provider cannot sign: the signer signs each grant's SIWE as an EIP-191 message (`personal_sign`), and the
|
|
495
|
+
* grant is refused unless the signature recovers to the session's account.
|
|
496
|
+
*
|
|
497
|
+
* Call it after the session is established; it throws without one. It is bound to that session: sign-out, a new
|
|
498
|
+
* sign-in, a restore, or a session for another account clear it. It is never used for sign-in or session setup.
|
|
499
|
+
* Without it, grants sign through the `openkey` client when configured, else the connected wallet.
|
|
500
|
+
*/
|
|
501
|
+
setRuntimePermissionSigner(signer?: RuntimePermissionSigner): void;
|
|
502
|
+
/** True when the panel may ask for a permission: a manifest, a page signer and a live session exist. */
|
|
503
|
+
private canRequestPanelPermissions;
|
|
504
|
+
/**
|
|
505
|
+
* The panel's request for one tab's entry. A grant is kept with the stored session record so it survives a reload;
|
|
506
|
+
* the entry is not stored when the user signed out while the prompt was open.
|
|
507
|
+
*/
|
|
508
|
+
private requestPanelPermissions;
|
|
509
|
+
private runtimeGrantStore;
|
|
459
510
|
getRuntimePermissionDelegations(permissions?: PermissionEntry[]): readonly PortableDelegation[];
|
|
460
511
|
useRuntimeDelegation(delegation: PortableDelegation): Promise<void>;
|
|
461
512
|
useDelegation(delegation: PortableDelegation): Promise<DelegatedAccess>;
|