@tinycloud/web-sdk 3.0.0-beta.18 → 3.0.0-beta.19
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.
|
@@ -39,8 +39,8 @@ export declare const SessionConfigSchema: z.ZodObject<{
|
|
|
39
39
|
address?: string;
|
|
40
40
|
chainId?: number;
|
|
41
41
|
issuedAt?: string;
|
|
42
|
-
jwk?: Record<string, unknown>;
|
|
43
42
|
notBefore?: string;
|
|
43
|
+
jwk?: Record<string, unknown>;
|
|
44
44
|
expirationTime?: string;
|
|
45
45
|
parents?: string[];
|
|
46
46
|
}, {
|
|
@@ -50,8 +50,8 @@ export declare const SessionConfigSchema: z.ZodObject<{
|
|
|
50
50
|
address?: string;
|
|
51
51
|
chainId?: number;
|
|
52
52
|
issuedAt?: string;
|
|
53
|
-
jwk?: Record<string, unknown>;
|
|
54
53
|
notBefore?: string;
|
|
54
|
+
jwk?: Record<string, unknown>;
|
|
55
55
|
expirationTime?: string;
|
|
56
56
|
parents?: string[];
|
|
57
57
|
}>;
|
package/dist/share/service.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { type ShareMetadata } from "@tinycloud/share-sdk";
|
|
|
3
3
|
import { type ShareEnvelopeV3 } from "@tinycloud/share-envelope";
|
|
4
4
|
import { CredentialsService } from "../credentials";
|
|
5
5
|
import { type ReceiverSessionStorage } from "./receiver-session";
|
|
6
|
-
import type { ReceivedShare, ShareImportAccountClient, ShareImportOptions, ShareImportResult, ShareReceiveOptions, ShareReceivedContent, ShareReceiverClient, ShareReceiverIdentity, ShareReceiverRecipient } from "./types";
|
|
6
|
+
import type { ReceivedShare, ShareDelegateOptions, ShareDelegation, ShareImportAccountClient, ShareImportOptions, ShareImportResult, ShareReceiveOptions, ShareReceivedContent, ShareReceiverClient, ShareReceiverIdentity, ShareReceiverRecipient } from "./types";
|
|
7
7
|
export interface ShareReceiverServiceOptions {
|
|
8
8
|
readonly origin?: string;
|
|
9
9
|
readonly sessionStorage?: ReceiverSessionStorage;
|
|
@@ -25,7 +25,6 @@ export declare function selectShareReceiverAccountSession(client: ShareReceiverC
|
|
|
25
25
|
* committed requirement is rejected before anything is displayed or sent.
|
|
26
26
|
*/
|
|
27
27
|
export declare function verifiedShareRequirement(envelope: ShareEnvelopeV3): Promise<CredentialRequirement>;
|
|
28
|
-
/** @internal */
|
|
29
28
|
export declare class ReceivedShareImpl implements ReceivedShare {
|
|
30
29
|
readonly identity: ShareReceiverIdentity;
|
|
31
30
|
readonly metadata: ShareMetadata;
|
|
@@ -38,11 +37,19 @@ export declare class ReceivedShareImpl implements ReceivedShare {
|
|
|
38
37
|
private readonly credentialDiscoveryUrl;
|
|
39
38
|
private content?;
|
|
40
39
|
private getPromise?;
|
|
40
|
+
private accessPromise?;
|
|
41
|
+
private stage?;
|
|
41
42
|
readonly recipient: ShareReceiverRecipient;
|
|
42
43
|
constructor(identity: ShareReceiverIdentity, metadata: ShareMetadata, envelope: ShareEnvelopeV3, requirement: CredentialRequirement, credentials: CredentialsService, sign: (bytes: Uint8Array) => Promise<Uint8Array>, options: ShareReceiveOptions, fetchFn: typeof fetch, credentialDiscoveryUrl: string);
|
|
43
44
|
get shareId(): string;
|
|
44
45
|
get(): Promise<ShareReceivedContent>;
|
|
46
|
+
/** The admitted access, admitted again once its chain has expired. */
|
|
47
|
+
private access;
|
|
48
|
+
/** Forget `access` so the next request admits again, unless it was already replaced. */
|
|
49
|
+
private forget;
|
|
50
|
+
private admit;
|
|
45
51
|
private load;
|
|
52
|
+
delegate(options: ShareDelegateOptions): Promise<ShareDelegation>;
|
|
46
53
|
importInto(accountClient: ShareImportAccountClient, options: ShareImportOptions): Promise<ShareImportResult>;
|
|
47
54
|
}
|
|
48
55
|
export declare class ShareReceiverService {
|
package/dist/share/types.d.ts
CHANGED
|
@@ -45,6 +45,34 @@ export interface ShareReceiveOptions {
|
|
|
45
45
|
};
|
|
46
46
|
readonly signal?: AbortSignal;
|
|
47
47
|
readonly onProgress?: (event: ShareReceiveProgress) => void;
|
|
48
|
+
/**
|
|
49
|
+
* Open through access another recipient delegated to this identity's key,
|
|
50
|
+
* instead of proving a credential.
|
|
51
|
+
*/
|
|
52
|
+
readonly delegation?: ShareDelegation;
|
|
53
|
+
}
|
|
54
|
+
/** One signed link of a share's delegation chain. The owner's Node holds it too. */
|
|
55
|
+
export interface ShareDelegationLink {
|
|
56
|
+
readonly authorization: string;
|
|
57
|
+
readonly cid: string;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* A share's access re-delegated to another key: the admitted session first,
|
|
61
|
+
* then each re-delegation in order. It holds no secret; only the key it names
|
|
62
|
+
* can use it.
|
|
63
|
+
*/
|
|
64
|
+
export interface ShareDelegation {
|
|
65
|
+
readonly shareId: string;
|
|
66
|
+
readonly delegateDid: string;
|
|
67
|
+
readonly expiresAt: string;
|
|
68
|
+
readonly chain: readonly ShareDelegationLink[];
|
|
69
|
+
}
|
|
70
|
+
export interface ShareDelegateOptions {
|
|
71
|
+
/** DID of the key that should hold this share's access, such as an account session key. */
|
|
72
|
+
readonly to: string;
|
|
73
|
+
/** Defaults to the longest the current access allows. */
|
|
74
|
+
readonly expiresAt?: Date;
|
|
75
|
+
readonly signal?: AbortSignal;
|
|
48
76
|
}
|
|
49
77
|
export interface ShareReceivedContent {
|
|
50
78
|
readonly bytes: Uint8Array;
|
|
@@ -91,6 +119,12 @@ export interface ReceivedShare {
|
|
|
91
119
|
readonly shareId: string;
|
|
92
120
|
get(): Promise<ShareReceivedContent>;
|
|
93
121
|
importInto(accountClient: ShareImportAccountClient, options: ShareImportOptions): Promise<ShareImportResult>;
|
|
122
|
+
/**
|
|
123
|
+
* Re-delegate this share's access, including decryption, to another key.
|
|
124
|
+
* Proves the credential first if this share has not been opened yet. The
|
|
125
|
+
* delegate opens it with `receive(url, { delegation })`.
|
|
126
|
+
*/
|
|
127
|
+
delegate(options: ShareDelegateOptions): Promise<ShareDelegation>;
|
|
94
128
|
}
|
|
95
129
|
export interface ShareReceiverClient extends ShareImportAccountClient {
|
|
96
130
|
readonly credentialHolderDid: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tinycloud/web-sdk",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.19",
|
|
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",
|
|
@@ -43,10 +43,10 @@
|
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@multiformats/multiaddr": "^13.0.1",
|
|
45
45
|
"@multiformats/multiaddr-to-uri": "^12.0.0",
|
|
46
|
-
"@tinycloud/node-sdk": "3.0.0-beta.
|
|
47
|
-
"@tinycloud/sdk-core": "3.0.0-beta.
|
|
46
|
+
"@tinycloud/node-sdk": "3.0.0-beta.19",
|
|
47
|
+
"@tinycloud/sdk-core": "3.0.0-beta.19",
|
|
48
48
|
"@tinycloud/share-envelope": "1.0.0-beta.5",
|
|
49
|
-
"@tinycloud/share-sdk": "1.0.0-beta.
|
|
49
|
+
"@tinycloud/share-sdk": "1.0.0-beta.9",
|
|
50
50
|
"@tinycloud/web-sdk-wasm": "1.7.6",
|
|
51
51
|
"axios": "^1.7.9",
|
|
52
52
|
"viem": "^2.45.0",
|