@tinycloud/web-sdk 3.14.0-beta.8 → 3.14.0-beta.9
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.
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The presentation OpenKey shows beside the requesting origin when it signs a runtime permission grant. It is display-only:
|
|
3
|
+
* the signed bytes never include it, and the names are the app's own claims, which OpenKey renders as such.
|
|
4
|
+
*/
|
|
5
|
+
export interface OpenKeySignPresentation {
|
|
6
|
+
protocolVersion: 1;
|
|
7
|
+
displayName?: string;
|
|
8
|
+
onBehalfOf?: string;
|
|
9
|
+
iconUrl?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* The presentation for a grant the app asks for. `iconUrl` is sent only as a small png, jpeg or webp `data:` URI, so OpenKey
|
|
13
|
+
* never fetches a URL the app chose; any other icon is left out.
|
|
14
|
+
*/
|
|
15
|
+
export declare function openKeySignPresentation(manifest: {
|
|
16
|
+
name: string;
|
|
17
|
+
icon?: string;
|
|
18
|
+
}, onBehalfOf: string | undefined): OpenKeySignPresentation;
|
|
19
|
+
//# sourceMappingURL=openKeySignPresentation.d.ts.map
|
|
@@ -30,6 +30,8 @@ export interface RequestPermissionsCoreDeps {
|
|
|
30
30
|
approved: boolean;
|
|
31
31
|
suppressPromptFor30Days?: boolean;
|
|
32
32
|
}>;
|
|
33
|
+
/** True when the signer shows the request itself (OpenKey): the SDK prompt is skipped and no opt-out is read or stored. */
|
|
34
|
+
skipPrompt?: boolean;
|
|
33
35
|
/** Whether this page/app has opted out of the SDK explainer prompt. */
|
|
34
36
|
isPromptSuppressed?: () => boolean;
|
|
35
37
|
/** Persist a successful opt-out from the SDK explainer prompt. */
|
package/dist/modules/tcw.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ import type { NodeSignOutStatus } from "@tinycloud/node-sdk";
|
|
|
14
14
|
import { type LocalCopyPurgeFailedEvent } from "./replica-wiring";
|
|
15
15
|
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 RegistrySequenceStore, SignInOptions, type RegistryCacheStore, type StorageFullEvent, type IStorageService } from "@tinycloud/sdk-core";
|
|
16
16
|
import { type RequestPermissionsOptions } from "./requestPermissionsCore";
|
|
17
|
+
import { type OpenKeySignPresentation } from "./openKeySignPresentation";
|
|
17
18
|
import { type BrowserProvider, type BrowserWalletProvider } from "../adapters/browserProvider";
|
|
18
19
|
import { type TinyCloudUI, type UiConfig } from "../ui";
|
|
19
20
|
import { RPCProviders, ClientConfig } from "../providers";
|
|
@@ -26,9 +27,12 @@ declare global {
|
|
|
26
27
|
ethereum?: any;
|
|
27
28
|
}
|
|
28
29
|
}
|
|
29
|
-
/**
|
|
30
|
+
/**
|
|
31
|
+
* Signs a message for a runtime permission grant; see `TinyCloudWeb.setRuntimePermissionSigner`. A signer set with
|
|
32
|
+
* `{ openKey: true }` also receives the `presentation` to pass on to OpenKey's approval; display-only, never signed.
|
|
33
|
+
*/
|
|
30
34
|
export interface RuntimePermissionSigner {
|
|
31
|
-
signMessage(message: string): Promise<string>;
|
|
35
|
+
signMessage(message: string, presentation?: OpenKeySignPresentation): Promise<string>;
|
|
32
36
|
}
|
|
33
37
|
/**
|
|
34
38
|
* Configuration for TinyCloudWeb.
|
|
@@ -568,12 +572,27 @@ export declare class TinyCloudWeb {
|
|
|
568
572
|
* always shows the prompt, ignoring an earlier 30-day opt-out, and offers none.
|
|
569
573
|
*/
|
|
570
574
|
requestPermissions(additional: PermissionEntry[], options?: RequestPermissionsOptions): Promise<RequestPermissionsResult>;
|
|
575
|
+
/**
|
|
576
|
+
* The signer a valid `setRuntimePermissionSigner` call bound to the current session, or undefined. A signer bound to a
|
|
577
|
+
* session that has ended or been replaced is cleared.
|
|
578
|
+
*/
|
|
579
|
+
private boundRuntimeSigner;
|
|
580
|
+
/** Whether OpenKey signs the runtime grants: the bound signer declared itself OpenKey, or none is bound and `openkey` is configured. */
|
|
581
|
+
private runtimeSignedByOpenKey;
|
|
582
|
+
/**
|
|
583
|
+
* Whether OpenKey's own approval shows the request, so the SDK prompt is skipped: a bound signer that declared itself
|
|
584
|
+
* OpenKey passes the presentation on; the configured OpenKey client accepts one (`signMessagePresentation` is 1) and
|
|
585
|
+
* reports its approval screen shows the request (`signMessageShowsApproval` is true, which an external-wallet key is not).
|
|
586
|
+
* Otherwise the SDK prompt is shown as it is for any other signer, with its 30-day option.
|
|
587
|
+
*/
|
|
588
|
+
private openKeyShowsApp;
|
|
571
589
|
/**
|
|
572
590
|
* Signs the SIWE of a runtime permission grant. Precedence: the signer set with `setRuntimePermissionSigner`, then
|
|
573
591
|
* the configured OpenKey client's byte-exact `signMessage` (an OpenKey session's wallet provider does not implement
|
|
574
592
|
* `personal_sign`), signing with the keyId of the connected account after connecting the client first when it is not
|
|
575
593
|
* connected; a missing or ambiguous key throws `OpenKeySigningKeyError`. Without an OpenKey client or a session account,
|
|
576
594
|
* undefined: the connected wallet signs. Only `requestPermissions` calls this; sign-in and session setup never do.
|
|
595
|
+
* `presentation` names the app beside the requesting origin in the OpenKey approval.
|
|
577
596
|
*/
|
|
578
597
|
private runtimeMessageSigner;
|
|
579
598
|
/**
|
|
@@ -585,8 +604,14 @@ export declare class TinyCloudWeb {
|
|
|
585
604
|
* Call it after the session is established; it throws without one. It is bound to that session: sign-out, a new
|
|
586
605
|
* sign-in, a restore, or a session for another account clear it. It is never used for sign-in or session setup.
|
|
587
606
|
* Without it, grants sign through the `openkey` client when configured, else the connected wallet.
|
|
607
|
+
*
|
|
608
|
+
* `options.openKey: true` declares that the signer signs through OpenKey and passes the `presentation` it receives with
|
|
609
|
+
* the message on to OpenKey's approval. Permission requests then skip the SDK's own prompt, which OpenKey's approval replaces.
|
|
610
|
+
* Set it only for a signer that shows its own approval screen for every request; it is read from this call alone.
|
|
588
611
|
*/
|
|
589
|
-
setRuntimePermissionSigner(signer?: RuntimePermissionSigner
|
|
612
|
+
setRuntimePermissionSigner(signer?: RuntimePermissionSigner, options?: {
|
|
613
|
+
openKey?: boolean;
|
|
614
|
+
}): void;
|
|
590
615
|
/** True when the panel may ask for a permission: a manifest, a page signer and a live session exist. */
|
|
591
616
|
private canRequestPanelPermissions;
|
|
592
617
|
/**
|
package/package.json
CHANGED