keymaster-connect 0.1.5 → 0.1.7
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 +11 -21
- package/dist/{chunk-ZDIFZJYD.js → chunk-D2RL3QGR.js} +5 -17
- package/dist/chunk-D2RL3QGR.js.map +1 -0
- package/dist/{chunk-VVOTW5ZT.js → chunk-M2YEI4PG.js} +92 -3
- package/dist/chunk-M2YEI4PG.js.map +1 -0
- package/dist/index.d.ts +14 -173
- package/dist/index.js +127 -548
- package/dist/index.js.map +1 -1
- package/dist/{protocol-C8z30CKK.d.ts → protocol-B7bpi5ro.d.ts} +43 -191
- package/dist/protocol.d.ts +1 -1
- package/dist/protocol.js +1 -1
- package/dist/script.d.ts +1 -1
- package/dist/server.d.ts +24 -17
- package/dist/server.js +112 -340
- package/dist/server.js.map +1 -1
- package/package.json +45 -11
- package/dist/chunk-VVOTW5ZT.js.map +0 -1
- package/dist/chunk-ZDIFZJYD.js.map +0 -1
|
@@ -1,3 +1,30 @@
|
|
|
1
|
+
interface AppFileEntry {
|
|
2
|
+
path: string;
|
|
3
|
+
mime: string;
|
|
4
|
+
size: number;
|
|
5
|
+
seedhashhex: string;
|
|
6
|
+
}
|
|
7
|
+
interface Publication {
|
|
8
|
+
version: 1;
|
|
9
|
+
kind: 'url' | 'files' | 'both';
|
|
10
|
+
appPublicKeyHex: string;
|
|
11
|
+
name: string;
|
|
12
|
+
description: string;
|
|
13
|
+
url?: {
|
|
14
|
+
address: string;
|
|
15
|
+
icon: string;
|
|
16
|
+
};
|
|
17
|
+
files?: {
|
|
18
|
+
entrySeedhashhex: string;
|
|
19
|
+
icon: string;
|
|
20
|
+
files: AppFileEntry[];
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
interface PublicationProof {
|
|
24
|
+
publication: Publication;
|
|
25
|
+
signatureHex: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
1
28
|
/** Connect wire v1 bidirectional AI tools. Never grants wallet payment/signing authority. */
|
|
2
29
|
|
|
3
30
|
interface AiToolSchema {
|
|
@@ -84,8 +111,6 @@ type AiToolMessage = {
|
|
|
84
111
|
};
|
|
85
112
|
declare function isAiToolMessage(value: unknown): value is AiToolMessage;
|
|
86
113
|
|
|
87
|
-
/** Connect v1 公开契约。独立于钱包内部执行 DTO、能力框架和持久化。 */
|
|
88
|
-
|
|
89
114
|
/** 身份网络在创建/导入时确定;公钥相同也不能跨网复用业务身份。 */
|
|
90
115
|
type BsvNetwork = "main" | "test";
|
|
91
116
|
interface NetworkIdentity {
|
|
@@ -95,26 +120,6 @@ interface NetworkIdentity {
|
|
|
95
120
|
declare function validateBsvNetwork(value: unknown): BsvNetwork;
|
|
96
121
|
declare function validateNetworkIdentity(value: unknown): NetworkIdentity;
|
|
97
122
|
declare function sameNetworkIdentity(left: NetworkIdentity, right: NetworkIdentity): boolean;
|
|
98
|
-
type AppRequirement = "private-key" | "storage";
|
|
99
|
-
interface AppIdentityProofV1 {
|
|
100
|
-
version: 1;
|
|
101
|
-
publisherPublicKey: string;
|
|
102
|
-
app: {
|
|
103
|
-
id: string;
|
|
104
|
-
name: string;
|
|
105
|
-
description: string;
|
|
106
|
-
};
|
|
107
|
-
requirements: AppRequirement[];
|
|
108
|
-
signature: string;
|
|
109
|
-
}
|
|
110
|
-
interface VerifiedAppIdentity {
|
|
111
|
-
version: 1;
|
|
112
|
-
publisherPublicKeyHex: string;
|
|
113
|
-
appId: string;
|
|
114
|
-
appName: string;
|
|
115
|
-
identityDigestHex: string;
|
|
116
|
-
}
|
|
117
|
-
type AppIdentitySnapshot = VerifiedAppIdentity;
|
|
118
123
|
/** ChannelProtocol/SSP 共用的递归 JSON 值。 */
|
|
119
124
|
type JSONValue = null | boolean | number | string | JSONValue[] | {
|
|
120
125
|
[key: string]: JSONValue;
|
|
@@ -174,121 +179,6 @@ interface ChannelMessageReceivedEventData {
|
|
|
174
179
|
*/
|
|
175
180
|
rawEnvelope?: Uint8Array;
|
|
176
181
|
}
|
|
177
|
-
interface StorageListParams {
|
|
178
|
-
/** 目录前缀。 */
|
|
179
|
-
prefix?: string;
|
|
180
|
-
/** 分页游标。 */
|
|
181
|
-
cursor?: string;
|
|
182
|
-
/** 每页数量。 */
|
|
183
|
-
limit?: number;
|
|
184
|
-
}
|
|
185
|
-
interface StorageListEntry {
|
|
186
|
-
/** Connect 可见的相对路径。 */
|
|
187
|
-
path: string;
|
|
188
|
-
/** 当前目录下的文件名。 */
|
|
189
|
-
name: string;
|
|
190
|
-
/** 文件大小(字节)。 */
|
|
191
|
-
size: number;
|
|
192
|
-
/** 抽象版本标签。 */
|
|
193
|
-
revision?: string;
|
|
194
|
-
/** 最后修改时间。 */
|
|
195
|
-
lastModified?: string;
|
|
196
|
-
}
|
|
197
|
-
interface StorageListResult {
|
|
198
|
-
/** 当前目录前缀。 */
|
|
199
|
-
prefix: string;
|
|
200
|
-
/** 父目录前缀。 */
|
|
201
|
-
parentPrefix: string;
|
|
202
|
-
/** 虚拟目录列表。 */
|
|
203
|
-
directories: Array<{
|
|
204
|
-
path: string;
|
|
205
|
-
name: string;
|
|
206
|
-
}>;
|
|
207
|
-
/** 当前页文件。 */
|
|
208
|
-
files: StorageListEntry[];
|
|
209
|
-
/** 目录 marker 路径。 */
|
|
210
|
-
markerPath?: string;
|
|
211
|
-
/** 下一页游标。 */
|
|
212
|
-
nextCursor?: string;
|
|
213
|
-
}
|
|
214
|
-
interface StorageDirectoryParams {
|
|
215
|
-
/** 目录路径。 */
|
|
216
|
-
path: string;
|
|
217
|
-
/** 是否允许覆盖已有 marker。 */
|
|
218
|
-
overwrite?: boolean;
|
|
219
|
-
}
|
|
220
|
-
interface StorageDirectoryResult {
|
|
221
|
-
/** 目录路径。 */
|
|
222
|
-
path: string;
|
|
223
|
-
/** 是否创建。 */
|
|
224
|
-
created?: boolean;
|
|
225
|
-
/** 是否删除。 */
|
|
226
|
-
deleted?: boolean;
|
|
227
|
-
}
|
|
228
|
-
interface StoragePutParams {
|
|
229
|
-
/** 文件路径。 */
|
|
230
|
-
path: string;
|
|
231
|
-
/** 二进制文件内容。 */
|
|
232
|
-
content: BinaryField;
|
|
233
|
-
/** MIME 类型。 */
|
|
234
|
-
contentType?: string;
|
|
235
|
-
/** 是否覆盖已有对象。 */
|
|
236
|
-
overwrite?: boolean;
|
|
237
|
-
}
|
|
238
|
-
interface StoragePutResult {
|
|
239
|
-
/** 文件路径。 */
|
|
240
|
-
path: string;
|
|
241
|
-
/** 写入大小(字节)。 */
|
|
242
|
-
size: number;
|
|
243
|
-
/** 抽象版本标签。 */
|
|
244
|
-
revision?: string;
|
|
245
|
-
/** 写入时间戳(毫秒)。 */
|
|
246
|
-
updatedAt: number;
|
|
247
|
-
}
|
|
248
|
-
interface StorageGetParams {
|
|
249
|
-
/** 文件路径。 */
|
|
250
|
-
path: string;
|
|
251
|
-
/** 起始偏移(字节)。 */
|
|
252
|
-
offset?: number;
|
|
253
|
-
/** 读取长度(字节)。 */
|
|
254
|
-
length?: number;
|
|
255
|
-
/** 期望的抽象版本标签。 */
|
|
256
|
-
ifMatch?: string;
|
|
257
|
-
}
|
|
258
|
-
interface StorageGetResult {
|
|
259
|
-
/** 文件路径。 */
|
|
260
|
-
path: string;
|
|
261
|
-
/** 二进制内容。 */
|
|
262
|
-
content: BinaryField;
|
|
263
|
-
/** MIME 类型。 */
|
|
264
|
-
contentType?: string;
|
|
265
|
-
/** 实际起始偏移。 */
|
|
266
|
-
offset: number;
|
|
267
|
-
/** 文件总大小(字节)。 */
|
|
268
|
-
totalSize: number;
|
|
269
|
-
/** 是否已读到文件结尾。 */
|
|
270
|
-
eof: boolean;
|
|
271
|
-
/** 抽象版本标签。 */
|
|
272
|
-
revision?: string;
|
|
273
|
-
/** 最后修改时间。 */
|
|
274
|
-
lastModified?: string;
|
|
275
|
-
}
|
|
276
|
-
interface StorageDeleteParams {
|
|
277
|
-
/** 文件路径。 */
|
|
278
|
-
path: string;
|
|
279
|
-
}
|
|
280
|
-
interface StorageDeleteResult {
|
|
281
|
-
/** 文件路径。 */
|
|
282
|
-
path: string;
|
|
283
|
-
/** 固定成功标记。 */
|
|
284
|
-
deleted: true;
|
|
285
|
-
/** 删除时间戳(毫秒)。 */
|
|
286
|
-
updatedAt: number;
|
|
287
|
-
}
|
|
288
|
-
/** K-V 引擎的硬限制;字段名和单位均在此集中定义。 */
|
|
289
|
-
declare const STORAGE_MAX_PAYLOAD_BYTES: number;
|
|
290
|
-
declare const STORAGE_DEFAULT_LIST_LIMIT = 200;
|
|
291
|
-
declare const STORAGE_MAX_LIST_LIMIT = 1000;
|
|
292
182
|
/** libp2p protocol ID;wire 真值来自 MSFile Proxy Wire Messages v1。 */
|
|
293
183
|
declare const MSFILE_PROTOCOL_ID = "/msfile/1.0.0";
|
|
294
184
|
/** Frame / 内容硬上限。与 wire 规范一致,两层共同执行。 */
|
|
@@ -417,14 +307,14 @@ type ProtocolErrorCode =
|
|
|
417
307
|
| "asset_not_enabled"
|
|
418
308
|
/** Connect v1 明确排除的方法族(新费用池签名等)。 */
|
|
419
309
|
| "unsupported_scope"
|
|
420
|
-
/**
|
|
310
|
+
/** 通用支付需要已建立的可信来源会话(origin 是归属唯一基准)。 */
|
|
421
311
|
| "identity_required"
|
|
422
312
|
/** 当前硬件后端缺少 Connect 支付所需的受信展示/结构检查。 */
|
|
423
313
|
| "hardware_connect_payment_unsupported" | "payment_not_found"
|
|
424
314
|
/** Too many non-terminal Connect payment responsibilities. */
|
|
425
315
|
| "payment_pending_limit"
|
|
426
316
|
/** Same stable payment key with different frozen facts. */
|
|
427
|
-
| "id_conflict" | "
|
|
317
|
+
| "id_conflict" | "msfile_not_configured" | "msfile_unavailable" | "msfile_identity_required" | "msfile_supplier_not_found" | "msfile_supplier_disabled" | "msfile_invalid_hash" | "msfile_price_limit_exceeded" | "msfile_integrity_error" | "msfile_content_not_found" | "msfile_rate_limited" | "msfile_supplier_error" | "msfile_transport_error" | "msfile_protocol_error" | "internal_error";
|
|
428
318
|
interface ProtocolError {
|
|
429
319
|
code: ProtocolErrorCode;
|
|
430
320
|
message: string;
|
|
@@ -581,33 +471,21 @@ interface ConnectLoginParams {
|
|
|
581
471
|
* 缺省 = `[]`,不返回任何 claim;通常 caller 想获取 profile.* 时必须显式列出。
|
|
582
472
|
*/
|
|
583
473
|
claims?: string[];
|
|
584
|
-
/**
|
|
585
|
-
|
|
474
|
+
/**
|
|
475
|
+
* App 入口的 URL 来源证明(SDK 从当前入口 HTML 头读取并提交)。
|
|
476
|
+
* 钱包验签并核对证明 origin 与可信 event.origin 是否一致;应用不能自报来源。
|
|
477
|
+
* 本地 Files 部署不依赖该字段(以 daemon 可信部署登记为准)。
|
|
478
|
+
*/
|
|
479
|
+
publicationProof?: PublicationProof;
|
|
586
480
|
}
|
|
587
481
|
interface ConnectLoginResult {
|
|
588
|
-
/**
|
|
482
|
+
/** 不透明恢复凭据,绑定原钱包和精确来源;不得写入日志或 URL。 */
|
|
589
483
|
authorizationId: string;
|
|
590
484
|
networkIdentity: NetworkIdentity;
|
|
591
485
|
/** 本次 login 时一次解析的 claims 真值快照。 */
|
|
592
486
|
resolvedClaims: Record<string, ResolvedClaimValue>;
|
|
593
487
|
/** 本次解析时间(unix milliseconds)。 */
|
|
594
488
|
resolvedAt: number;
|
|
595
|
-
appIdentity?: AppIdentitySnapshot;
|
|
596
|
-
}
|
|
597
|
-
interface ConnectResumeParams {
|
|
598
|
-
/** 本地数据重置后重新验证已有发行人签名 proof。 */
|
|
599
|
-
appIdentity?: AppIdentityProofV1;
|
|
600
|
-
}
|
|
601
|
-
interface ConnectResumeResult {
|
|
602
|
-
authorizationId: string;
|
|
603
|
-
networkIdentity: NetworkIdentity;
|
|
604
|
-
resolvedClaims: Record<string, ResolvedClaimValue>;
|
|
605
|
-
/**
|
|
606
|
-
* 解析时间——本次 resume 时间戳,**不**是 connect.login 时的快照时间。
|
|
607
|
-
* 给 caller 用来做"是否要重新登录"的客户端超时策略。
|
|
608
|
-
*/
|
|
609
|
-
resolvedAt: number;
|
|
610
|
-
appIdentity?: AppIdentitySnapshot;
|
|
611
489
|
}
|
|
612
490
|
interface ConnectLogoutParams extends Record<string, never> {
|
|
613
491
|
}
|
|
@@ -618,18 +496,20 @@ interface ConnectLogoutResult {
|
|
|
618
496
|
interface ConnectLaunchParams {
|
|
619
497
|
/** 由 launcher 写入 client app 启动 URL 的 launchToken。一次性消费。 */
|
|
620
498
|
launchToken: string;
|
|
621
|
-
/**
|
|
622
|
-
|
|
499
|
+
/**
|
|
500
|
+
* App 入口的 URL 来源证明(可选;钱包发起的目录启动一般不需要客户端提交,
|
|
501
|
+
* 钱包从所选入口自行读取;应用提交时钱包核对一致性,不能自报来源)。
|
|
502
|
+
*/
|
|
503
|
+
publicationProof?: PublicationProof;
|
|
623
504
|
}
|
|
624
505
|
interface ConnectLaunchResult {
|
|
625
506
|
authorizationId: string;
|
|
626
507
|
networkIdentity: NetworkIdentity;
|
|
627
508
|
resolvedClaims: Record<string, ResolvedClaimValue>;
|
|
628
509
|
resolvedAt: number;
|
|
629
|
-
appIdentity?: AppIdentitySnapshot;
|
|
630
510
|
}
|
|
631
511
|
/** 协议方法名常量集合。 */
|
|
632
|
-
declare const PROTOCOL_METHODS: readonly ["identity.get", "intent.sign", "cipher.encrypt", "cipher.decrypt", "payment.pay", "payment.status", "connect.login", "connect.
|
|
512
|
+
declare const PROTOCOL_METHODS: readonly ["identity.get", "intent.sign", "cipher.encrypt", "cipher.decrypt", "payment.pay", "payment.status", "connect.login", "connect.logout", "connect.launch", "channel.publish", "channel.subscription_set", "msfile.stat", "msfile.seed.read", "msfile.block.read"];
|
|
633
513
|
type ProtocolMethod = (typeof PROTOCOL_METHODS)[number];
|
|
634
514
|
/**
|
|
635
515
|
* 方法 -> 请求参数类型 的映射。`MethodParams<M>` 是计算出的参数类型。
|
|
@@ -643,19 +523,10 @@ interface MethodParamsMap {
|
|
|
643
523
|
"payment.pay": PaymentPayParams;
|
|
644
524
|
"payment.status": PaymentStatusParams;
|
|
645
525
|
"connect.login": ConnectLoginParams;
|
|
646
|
-
"connect.resume": ConnectResumeParams;
|
|
647
526
|
"connect.logout": ConnectLogoutParams;
|
|
648
527
|
"connect.launch": ConnectLaunchParams;
|
|
649
528
|
"channel.publish": ChannelPublishParams;
|
|
650
529
|
"channel.subscription_set": ChannelSubscriptionSetParams;
|
|
651
|
-
"storage.list": StorageListParams;
|
|
652
|
-
"storage.directory.create": StorageDirectoryParams;
|
|
653
|
-
"storage.directory.delete": StorageDirectoryParams;
|
|
654
|
-
"storage.put": StoragePutParams;
|
|
655
|
-
"storage.encrypted.put": StoragePutParams;
|
|
656
|
-
"storage.get": StorageGetParams;
|
|
657
|
-
"storage.encrypted.get": StorageGetParams;
|
|
658
|
-
"storage.delete": StorageDeleteParams;
|
|
659
530
|
"msfile.stat": MsFileStatParams;
|
|
660
531
|
"msfile.seed.read": MsFileSeedReadParams;
|
|
661
532
|
"msfile.block.read": MsFileBlockReadParams;
|
|
@@ -668,19 +539,10 @@ interface MethodResultMap {
|
|
|
668
539
|
"payment.pay": PaymentPayResult;
|
|
669
540
|
"payment.status": PaymentStatusResult;
|
|
670
541
|
"connect.login": ConnectLoginResult;
|
|
671
|
-
"connect.resume": ConnectResumeResult;
|
|
672
542
|
"connect.logout": ConnectLogoutResult;
|
|
673
543
|
"connect.launch": ConnectLaunchResult;
|
|
674
544
|
"channel.publish": ChannelPublishResult;
|
|
675
545
|
"channel.subscription_set": ChannelSubscriptionSetResult;
|
|
676
|
-
"storage.list": StorageListResult;
|
|
677
|
-
"storage.directory.create": StorageDirectoryResult;
|
|
678
|
-
"storage.directory.delete": StorageDirectoryResult;
|
|
679
|
-
"storage.put": StoragePutResult;
|
|
680
|
-
"storage.encrypted.put": StoragePutResult;
|
|
681
|
-
"storage.get": StorageGetResult;
|
|
682
|
-
"storage.encrypted.get": StorageGetResult;
|
|
683
|
-
"storage.delete": StorageDeleteResult;
|
|
684
546
|
"msfile.stat": MsFileStatResult;
|
|
685
547
|
"msfile.seed.read": MsFileReadResult;
|
|
686
548
|
"msfile.block.read": MsFileReadResult;
|
|
@@ -697,16 +559,6 @@ type ProtocolEventMessage = ProtocolEventPayload & {
|
|
|
697
559
|
networkIdentity: NetworkIdentity;
|
|
698
560
|
bindingId: string;
|
|
699
561
|
};
|
|
700
|
-
/** 暂停恢复控制,不携带钱包选择参数,也不是业务请求重放。 */
|
|
701
|
-
interface ProtocolReconnectMessage {
|
|
702
|
-
v: typeof PROTOCOL_VERSION;
|
|
703
|
-
type: "reconnect";
|
|
704
|
-
id: string;
|
|
705
|
-
authorizationId: string;
|
|
706
|
-
bindingId?: string;
|
|
707
|
-
/** 刷新恢复时提交的当前入口 proof;后台心跳可省略,宿主按原授权核对。 */
|
|
708
|
-
appIdentity?: AppIdentityProofV1;
|
|
709
|
-
}
|
|
710
562
|
interface ProtocolRequestMessage<M extends ProtocolMethod = ProtocolMethod> {
|
|
711
563
|
v: typeof PROTOCOL_VERSION;
|
|
712
564
|
type: "request";
|
|
@@ -732,4 +584,4 @@ type ProtocolResultMessage = {
|
|
|
732
584
|
networkIdentity?: NetworkIdentity;
|
|
733
585
|
};
|
|
734
586
|
|
|
735
|
-
export {
|
|
587
|
+
export { MSFILE_MAX_HEADER_BYTES as $, type AiTool as A, type BinaryField as B, type ConnectLoginParams as C, type MsFileBlockReadParams as D, type ProtocolErrorCode as E, AI_TOOLS_MAX_JSON_CHARS as F, type AiToolDefinition as G, type AiToolMessage as H, type IdentityGetParams as I, type AiToolSchema as J, type BsvNetwork as K, type ChannelMessageReceivedEventData as L, type MethodParams as M, type NetworkIdentity as N, type ChannelSubscriptionErrorCode as O, type ProtocolEventMessage as P, type ChannelSubscriptionPhase as Q, type ChannelSubscriptionStatus as R, type ConnectLogoutParams as S, type ConnectPaymentStatus as T, type JSONValue as U, MSFILE_BLOCK_SIZE_BYTES as V, MSFILE_DIGEST_SIZE_BYTES as W, MSFILE_LOCAL_SOURCE_ID as X, MSFILE_MAX_BLOCK_BYTES as Y, MSFILE_MAX_CONTENT_BYTES as Z, MSFILE_MAX_ERROR_MESSAGE_BYTES as _, type AiToolsRegistered as a, MSFILE_MAX_SEED_BYTES as a0, MSFILE_PROTOCOL_ID as a1, type MethodParamsMap as a2, type MethodResultMap as a3, type MsFileLocalSourceStat as a4, type MsFileRemoteSourceStat as a5, type MsFileSatoshiAmount as a6, type MsFileSourceKind as a7, type MsFileSourceStat as a8, type MsFileStatAbsentEntry as a9, validateBsvNetwork as aA, validateNetworkIdentity as aB, validateToolArguments as aC, type MsFileStatAvailableEntry as aa, type MsFileStatDiscoveringEntry as ab, type MsFileStatNetworkErrorEntry as ac, type MsFileStatQuotedEntry as ad, type MsFileSupplierStat as ae, type P2pkhTransferAssetId as af, PROTOCOL_METHODS as ag, PROTOCOL_VERSION as ah, type PaymentOutput as ai, type PaymentReleaseSummary as aj, type ProtocolCancelMessage as ak, type ProtocolClosingMessage as al, type ProtocolError as am, type ProtocolEventName as an, type ProtocolEventPayload as ao, type ProtocolReadyMessage as ap, type ProtocolRequestMessage as aq, type ProtocolResultMessage as ar, type PublicationProof as as, type ResolvedClaimValue as at, assertToolJson as au, assertToolPayload as av, isAiToolMessage as aw, isValidMsFileSourceId as ax, parseToolDefinitions as ay, sameNetworkIdentity as az, type ProtocolMethod as b, type MethodResult as c, type ConnectLoginResult as d, type ConnectLogoutResult as e, type ConnectLaunchParams as f, type ConnectLaunchResult as g, type IdentityGetResult as h, type IntentSignParams as i, type IntentSignResult as j, type CipherEncryptParams as k, type CipherEncryptResult as l, type CipherDecryptParams as m, type CipherDecryptResult as n, type PaymentPayParams as o, type PaymentPayResult as p, type PaymentStatusParams as q, type PaymentStatusResult as r, type ChannelPublishParams as s, type ChannelPublishResult as t, type ChannelSubscriptionSetParams as u, type ChannelSubscriptionSetResult as v, type MsFileStatParams as w, type MsFileStatResult as x, type MsFileSeedReadParams as y, type MsFileReadResult as z };
|
package/dist/protocol.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { G as AiToolDefinition, H as AiToolMessage, J as AiToolSchema, a as AiToolsRegistered, B as BinaryField, K as BsvNetwork, L as ChannelMessageReceivedEventData, s as ChannelPublishParams, t as ChannelPublishResult, O as ChannelSubscriptionErrorCode, Q as ChannelSubscriptionPhase, u as ChannelSubscriptionSetParams, v as ChannelSubscriptionSetResult, R as ChannelSubscriptionStatus, m as CipherDecryptParams, n as CipherDecryptResult, k as CipherEncryptParams, l as CipherEncryptResult, f as ConnectLaunchParams, g as ConnectLaunchResult, C as ConnectLoginParams, d as ConnectLoginResult, S as ConnectLogoutParams, e as ConnectLogoutResult, T as ConnectPaymentStatus, I as IdentityGetParams, h as IdentityGetResult, i as IntentSignParams, j as IntentSignResult, U as JSONValue, V as MSFILE_BLOCK_SIZE_BYTES, W as MSFILE_DIGEST_SIZE_BYTES, X as MSFILE_LOCAL_SOURCE_ID, Y as MSFILE_MAX_BLOCK_BYTES, Z as MSFILE_MAX_CONTENT_BYTES, _ as MSFILE_MAX_ERROR_MESSAGE_BYTES, $ as MSFILE_MAX_HEADER_BYTES, a0 as MSFILE_MAX_SEED_BYTES, a1 as MSFILE_PROTOCOL_ID, M as MethodParams, a2 as MethodParamsMap, c as MethodResult, a3 as MethodResultMap, D as MsFileBlockReadParams, a4 as MsFileLocalSourceStat, z as MsFileReadResult, a5 as MsFileRemoteSourceStat, a6 as MsFileSatoshiAmount, y as MsFileSeedReadParams, a7 as MsFileSourceKind, a8 as MsFileSourceStat, a9 as MsFileStatAbsentEntry, aa as MsFileStatAvailableEntry, ab as MsFileStatDiscoveringEntry, ac as MsFileStatNetworkErrorEntry, w as MsFileStatParams, ad as MsFileStatQuotedEntry, x as MsFileStatResult, ae as MsFileSupplierStat, N as NetworkIdentity, af as P2pkhTransferAssetId, ag as PROTOCOL_METHODS, ah as PROTOCOL_VERSION, ai as PaymentOutput, o as PaymentPayParams, p as PaymentPayResult, aj as PaymentReleaseSummary, q as PaymentStatusParams, r as PaymentStatusResult, ak as ProtocolCancelMessage, al as ProtocolClosingMessage, am as ProtocolError, E as ProtocolErrorCode, P as ProtocolEventMessage, an as ProtocolEventName, ao as ProtocolEventPayload, b as ProtocolMethod, ap as ProtocolReadyMessage, aq as ProtocolRequestMessage, ar as ProtocolResultMessage, as as PublicationProof, at as ResolvedClaimValue, ax as isValidMsFileSourceId, az as sameNetworkIdentity, aA as validateBsvNetwork, aB as validateNetworkIdentity } from './protocol-B7bpi5ro.js';
|
package/dist/protocol.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { MSFILE_BLOCK_SIZE_BYTES, MSFILE_DIGEST_SIZE_BYTES, MSFILE_LOCAL_SOURCE_ID, MSFILE_MAX_BLOCK_BYTES, MSFILE_MAX_CONTENT_BYTES, MSFILE_MAX_ERROR_MESSAGE_BYTES, MSFILE_MAX_HEADER_BYTES, MSFILE_MAX_SEED_BYTES, MSFILE_PROTOCOL_ID, PROTOCOL_METHODS, PROTOCOL_VERSION,
|
|
1
|
+
export { MSFILE_BLOCK_SIZE_BYTES, MSFILE_DIGEST_SIZE_BYTES, MSFILE_LOCAL_SOURCE_ID, MSFILE_MAX_BLOCK_BYTES, MSFILE_MAX_CONTENT_BYTES, MSFILE_MAX_ERROR_MESSAGE_BYTES, MSFILE_MAX_HEADER_BYTES, MSFILE_MAX_SEED_BYTES, MSFILE_PROTOCOL_ID, PROTOCOL_METHODS, PROTOCOL_VERSION, isValidMsFileSourceId, sameNetworkIdentity, validateBsvNetwork, validateNetworkIdentity } from './chunk-D2RL3QGR.js';
|
|
2
2
|
//# sourceMappingURL=protocol.js.map
|
|
3
3
|
//# sourceMappingURL=protocol.js.map
|
package/dist/script.d.ts
CHANGED
package/dist/server.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { E as ProtocolErrorCode, af as P2pkhTransferAssetId, aq as ProtocolRequestMessage, N as NetworkIdentity, b as ProtocolMethod, M as MethodParams, H as AiToolMessage, G as AiToolDefinition, U as JSONValue, ar as ProtocolResultMessage, ap as ProtocolReadyMessage, al as ProtocolClosingMessage, c as MethodResult, am as ProtocolError, ao as ProtocolEventPayload } from './protocol-B7bpi5ro.js';
|
|
2
|
+
export { F as AI_TOOLS_MAX_JSON_CHARS, A as AiTool, J as AiToolSchema, a as AiToolsRegistered, au as assertToolJson, av as assertToolPayload, aw as isAiToolMessage, ay as parseToolDefinitions, aC as validateToolArguments } from './protocol-B7bpi5ro.js';
|
|
3
3
|
|
|
4
4
|
/** 校验失败:抛出的对象。service 会捕获并组装 ProtocolError。 */
|
|
5
5
|
declare class ProtocolValidationError extends Error {
|
|
@@ -54,18 +54,27 @@ declare function parseRequestMessage(raw: unknown, receiverIdentity: NetworkIden
|
|
|
54
54
|
params: MethodParams<ProtocolMethod>;
|
|
55
55
|
};
|
|
56
56
|
|
|
57
|
-
declare
|
|
58
|
-
declare class AppIdentityValidationError extends Error {
|
|
57
|
+
declare class OriginValidationError extends Error {
|
|
59
58
|
constructor(message: string);
|
|
60
59
|
}
|
|
61
|
-
/** RFC 8785-compatible canonical JSON for
|
|
60
|
+
/** RFC 8785-compatible canonical JSON for generic vectors. */
|
|
62
61
|
declare function canonicalizeJson(value: unknown): string;
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
declare function
|
|
62
|
+
/**
|
|
63
|
+
* 从应用入口 URL 推导 canonical origin。
|
|
64
|
+
* 入口可带路径/查询/片段;origin 取标准 URL origin(协议+主机+有效端口)。
|
|
65
|
+
* 返回规范 origin 与保留的完整启动 URL。
|
|
66
|
+
*/
|
|
67
|
+
declare function parseEntryUrl(input: unknown): {
|
|
68
|
+
origin: string;
|
|
69
|
+
url: string;
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* 校验并规范化可信 origin 输入(WHATWG URL origin 序列化规则)。
|
|
73
|
+
* 接受显式默认端口与大小写主机并归一;拒绝路径/查询/片段、凭据与非 http(s)。
|
|
74
|
+
*/
|
|
75
|
+
declare function canonicalOrigin(input: unknown): string;
|
|
76
|
+
/** 断言可信 origin 合法并返回规范形式。 */
|
|
77
|
+
declare function assertCanonicalOrigin(input: unknown, field?: string): string;
|
|
69
78
|
|
|
70
79
|
interface AiToolReceiverOptions {
|
|
71
80
|
/** Must verify the same Receiver's current binding, exact peer, origin and wallet lifecycle. */
|
|
@@ -94,6 +103,8 @@ declare class KeymasterAiToolReceiver {
|
|
|
94
103
|
dispose(): void;
|
|
95
104
|
}
|
|
96
105
|
|
|
106
|
+
/** Connect v1 接收端。只拥有协议状态,不拥有钱包授权、私钥、余额或持久业务账本。 */
|
|
107
|
+
|
|
97
108
|
/** 窗口对象只作为消息源身份与发送目标;不读取跨源页面内容。 */
|
|
98
109
|
interface ConnectPeer {
|
|
99
110
|
postMessage(message: unknown, targetOrigin: string): void;
|
|
@@ -138,14 +149,10 @@ interface ReceiverRequest<M extends ProtocolMethod = ProtocolMethod> {
|
|
|
138
149
|
readonly walletGeneration: string;
|
|
139
150
|
readonly runGeneration: string;
|
|
140
151
|
readonly bindingId?: string;
|
|
141
|
-
readonly authorizationId?: string;
|
|
142
152
|
readonly signal: AbortSignal;
|
|
143
153
|
}
|
|
144
154
|
/** 判断建立连接的方法;ready 只表示传输可用,不属于身份授权。 */
|
|
145
155
|
declare function isEstablishing(method: string): boolean;
|
|
146
|
-
/** 生产钱包与闭环测试共用同一接收端,不内置测试业务或默认自动授权。 */
|
|
147
|
-
/** 外部恢复控制只携带不透明授权引用和可选当前入口 proof,不能夹带业务参数或钱包选择器。 */
|
|
148
|
-
declare function parseReconnectMessage(data: unknown): ProtocolReconnectMessage | null;
|
|
149
156
|
declare class KeymasterConnectReceiver {
|
|
150
157
|
private readonly options;
|
|
151
158
|
private readonly bindings;
|
|
@@ -172,7 +179,7 @@ declare class KeymasterConnectReceiver {
|
|
|
172
179
|
replyError(context: ReceiverRequest, error: ProtocolError): void;
|
|
173
180
|
/** 事件只给当前有效绑定添加接收端上下文;业务发布者不能自报绑定/钱包身份。 */
|
|
174
181
|
sendEvent(target: ConnectPeer, origin: string, event: ProtocolEventPayload): void;
|
|
175
|
-
/**
|
|
182
|
+
/** 只读核对现存瞬时绑定,不创建新连接。 */
|
|
176
183
|
matchesBinding(source: ConnectPeer, origin: string, id: string | undefined): boolean;
|
|
177
184
|
/** ready/closing 只承载生命周期,不携带授权或业务结果。 */
|
|
178
185
|
sendReady(target: ConnectPeer): void;
|
|
@@ -190,4 +197,4 @@ declare class KeymasterConnectReceiver {
|
|
|
190
197
|
private send;
|
|
191
198
|
}
|
|
192
199
|
|
|
193
|
-
export {
|
|
200
|
+
export { AiToolDefinition, AiToolMessage, type AiToolReceiverOptions, type ConnectPeer, type ConnectReceiverOptions, KeymasterAiToolReceiver, KeymasterConnectReceiver, OriginValidationError, ProtocolEventPayload, ProtocolValidationError, type ReceiverLifecycle, type ReceiverMessage, type ReceiverPeerPolicy, type ReceiverRequest, assertCanonicalOrigin, assertCompressedPubkeyHex, assertMainnetP2pkhAddress, assertOriginMatches, assertP2pkhAddressForAsset, canonicalOrigin, canonicalizeJson, isEstablishing, isStructuredCloneRequestCandidate, parseCancelMessage, parseEntryUrl, parseRequestMessage, validateExactChannel };
|