@tinycloud/web-sdk 2.11.0-beta.9 → 2.11.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/dist/credentials/browser.d.ts +33 -0
- package/dist/credentials/index.d.ts +8 -0
- package/dist/credentials/interpreter.d.ts +20 -0
- package/dist/credentials/renderer.d.ts +23 -0
- package/dist/credentials/service.d.ts +25 -0
- package/dist/credentials/storage.d.ts +21 -0
- package/dist/credentials/transport.d.ts +37 -0
- package/dist/credentials/types.d.ts +126 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +1 -1
- package/dist/modules/tcw.d.ts +18 -1
- package/dist/openkey-session.d.ts +4 -2
- package/package.json +4 -4
package/dist/modules/tcw.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ 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
|
|
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,15 @@ 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
|
+
autoSignCredentialBytes(bytes: Uint8Array): Promise<Uint8Array | undefined>;
|
|
279
|
+
approveCredentialBytes(bytes: Uint8Array): Promise<Uint8Array>;
|
|
280
|
+
credentialSpaceOwnerDid(spaceId: string): string;
|
|
270
281
|
extend(_extension: Extension): void;
|
|
271
282
|
cleanup(): void;
|
|
272
283
|
connectWallet(provider: providers.ExternalProvider | providers.Web3Provider, options?: {
|
|
@@ -345,6 +356,12 @@ export declare class TinyCloudWeb {
|
|
|
345
356
|
delegateDID: string;
|
|
346
357
|
disableSubDelegation?: boolean;
|
|
347
358
|
expiryMs?: number;
|
|
359
|
+
resources?: Array<{
|
|
360
|
+
service: string;
|
|
361
|
+
space?: string;
|
|
362
|
+
path: string;
|
|
363
|
+
actions: string[];
|
|
364
|
+
}>;
|
|
348
365
|
}): Promise<PortableDelegation>;
|
|
349
366
|
delegate(params: CreateDelegationParams): Promise<Result<Delegation, DelegationError>>;
|
|
350
367
|
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
|
|
3
|
+
"version": "2.11.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
|
|
48
|
-
"@tinycloud/sdk-core": "2.11.0
|
|
49
|
-
"@tinycloud/web-sdk-wasm": "1.7.6
|
|
47
|
+
"@tinycloud/node-sdk": "2.11.0",
|
|
48
|
+
"@tinycloud/sdk-core": "2.11.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",
|