keymaster-connect 0.1.5 → 0.1.6

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.
@@ -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;
@@ -417,7 +422,7 @@ type ProtocolErrorCode =
417
422
  | "asset_not_enabled"
418
423
  /** Connect v1 明确排除的方法族(新费用池签名等)。 */
419
424
  | "unsupported_scope"
420
- /** 通用支付需要已验证 App 身份(publisher 是归属唯一基准)。 */
425
+ /** 通用支付需要已建立的可信来源会话(origin 是归属唯一基准)。 */
421
426
  | "identity_required"
422
427
  /** 当前硬件后端缺少 Connect 支付所需的受信展示/结构检查。 */
423
428
  | "hardware_connect_payment_unsupported" | "payment_not_found"
@@ -581,22 +586,23 @@ interface ConnectLoginParams {
581
586
  * 缺省 = `[]`,不返回任何 claim;通常 caller 想获取 profile.* 时必须显式列出。
582
587
  */
583
588
  claims?: string[];
584
- /** 发布者签名的 caller identity proof;缺省时建立无 storage 的普通 session。 */
585
- appIdentity?: AppIdentityProofV1;
589
+ /**
590
+ * App 入口的 URL 来源证明(SDK 从当前入口 HTML 头读取并提交)。
591
+ * 钱包验签并核对证明 origin 与可信 event.origin 是否一致;应用不能自报来源。
592
+ * 本地 Files 部署不依赖该字段(以 daemon 可信部署登记为准)。
593
+ */
594
+ publicationProof?: PublicationProof;
586
595
  }
587
596
  interface ConnectLoginResult {
588
- /** 不透明恢复凭据,绑定原钱包、应用和精确来源;不得写入日志或 URL。 */
597
+ /** 不透明恢复凭据,绑定原钱包和精确来源;不得写入日志或 URL。 */
589
598
  authorizationId: string;
590
599
  networkIdentity: NetworkIdentity;
591
600
  /** 本次 login 时一次解析的 claims 真值快照。 */
592
601
  resolvedClaims: Record<string, ResolvedClaimValue>;
593
602
  /** 本次解析时间(unix milliseconds)。 */
594
603
  resolvedAt: number;
595
- appIdentity?: AppIdentitySnapshot;
596
604
  }
597
- interface ConnectResumeParams {
598
- /** 本地数据重置后重新验证已有发行人签名 proof。 */
599
- appIdentity?: AppIdentityProofV1;
605
+ interface ConnectResumeParams extends Record<string, never> {
600
606
  }
601
607
  interface ConnectResumeResult {
602
608
  authorizationId: string;
@@ -607,7 +613,6 @@ interface ConnectResumeResult {
607
613
  * 给 caller 用来做"是否要重新登录"的客户端超时策略。
608
614
  */
609
615
  resolvedAt: number;
610
- appIdentity?: AppIdentitySnapshot;
611
616
  }
612
617
  interface ConnectLogoutParams extends Record<string, never> {
613
618
  }
@@ -618,15 +623,17 @@ interface ConnectLogoutResult {
618
623
  interface ConnectLaunchParams {
619
624
  /** 由 launcher 写入 client app 启动 URL 的 launchToken。一次性消费。 */
620
625
  launchToken: string;
621
- /** 与 launcher 预建 session 绑定的完整签名 proof。 */
622
- appIdentity: AppIdentityProofV1;
626
+ /**
627
+ * App 入口的 URL 来源证明(可选;钱包发起的目录启动一般不需要客户端提交,
628
+ * 钱包从所选入口自行读取;应用提交时钱包核对一致性,不能自报来源)。
629
+ */
630
+ publicationProof?: PublicationProof;
623
631
  }
624
632
  interface ConnectLaunchResult {
625
633
  authorizationId: string;
626
634
  networkIdentity: NetworkIdentity;
627
635
  resolvedClaims: Record<string, ResolvedClaimValue>;
628
636
  resolvedAt: number;
629
- appIdentity?: AppIdentitySnapshot;
630
637
  }
631
638
  /** 协议方法名常量集合。 */
632
639
  declare const PROTOCOL_METHODS: readonly ["identity.get", "intent.sign", "cipher.encrypt", "cipher.decrypt", "payment.pay", "payment.status", "connect.login", "connect.resume", "connect.logout", "connect.launch", "channel.publish", "channel.subscription_set", "storage.list", "storage.directory.create", "storage.directory.delete", "storage.put", "storage.get", "storage.encrypted.put", "storage.encrypted.get", "storage.delete", "msfile.stat", "msfile.seed.read", "msfile.block.read"];
@@ -704,8 +711,6 @@ interface ProtocolReconnectMessage {
704
711
  id: string;
705
712
  authorizationId: string;
706
713
  bindingId?: string;
707
- /** 刷新恢复时提交的当前入口 proof;后台心跳可省略,宿主按原授权核对。 */
708
- appIdentity?: AppIdentityProofV1;
709
714
  }
710
715
  interface ProtocolRequestMessage<M extends ProtocolMethod = ProtocolMethod> {
711
716
  v: typeof PROTOCOL_VERSION;
@@ -732,4 +737,4 @@ type ProtocolResultMessage = {
732
737
  networkIdentity?: NetworkIdentity;
733
738
  };
734
739
 
735
- export { type AppRequirement as $, type AiTool as A, type BinaryField as B, type ConnectLoginParams as C, type StorageDirectoryResult as D, type StoragePutParams as E, type StoragePutResult as F, type StorageGetParams as G, type StorageGetResult as H, type IdentityGetParams as I, type StorageDeleteParams as J, type StorageDeleteResult as K, type MsFileStatParams as L, type MethodParams as M, type NetworkIdentity as N, type MsFileStatResult as O, type ProtocolEventMessage as P, type MsFileSeedReadParams as Q, type MsFileReadResult as R, type StorageListParams as S, type MsFileBlockReadParams as T, type ProtocolErrorCode as U, AI_TOOLS_MAX_JSON_CHARS as V, type AiToolDefinition as W, type AiToolMessage as X, type AiToolSchema as Y, type AppIdentityProofV1 as Z, type AppIdentitySnapshot as _, type AiToolsRegistered as a, type BsvNetwork as a0, type ChannelMessageReceivedEventData as a1, type ChannelSubscriptionErrorCode as a2, type ChannelSubscriptionPhase as a3, type ChannelSubscriptionStatus as a4, type ConnectLogoutParams as a5, type ConnectPaymentStatus as a6, type JSONValue as a7, MSFILE_BLOCK_SIZE_BYTES as a8, MSFILE_DIGEST_SIZE_BYTES as a9, type ProtocolClosingMessage as aA, type ProtocolError as aB, type ProtocolEventName as aC, type ProtocolEventPayload as aD, type ProtocolReadyMessage as aE, type ProtocolReconnectMessage as aF, type ProtocolRequestMessage as aG, type ProtocolResultMessage as aH, type ResolvedClaimValue as aI, STORAGE_DEFAULT_LIST_LIMIT as aJ, STORAGE_MAX_LIST_LIMIT as aK, STORAGE_MAX_PAYLOAD_BYTES as aL, type StorageListEntry as aM, type VerifiedAppIdentity as aN, assertToolJson as aO, assertToolPayload as aP, isAiToolMessage as aQ, isValidMsFileSourceId as aR, parseToolDefinitions as aS, sameNetworkIdentity as aT, validateBsvNetwork as aU, validateNetworkIdentity as aV, validateToolArguments as aW, MSFILE_LOCAL_SOURCE_ID as aa, MSFILE_MAX_BLOCK_BYTES as ab, MSFILE_MAX_CONTENT_BYTES as ac, MSFILE_MAX_ERROR_MESSAGE_BYTES as ad, MSFILE_MAX_HEADER_BYTES as ae, MSFILE_MAX_SEED_BYTES as af, MSFILE_PROTOCOL_ID as ag, type MethodParamsMap as ah, type MethodResultMap as ai, type MsFileLocalSourceStat as aj, type MsFileRemoteSourceStat as ak, type MsFileSatoshiAmount as al, type MsFileSourceKind as am, type MsFileSourceStat as an, type MsFileStatAbsentEntry as ao, type MsFileStatAvailableEntry as ap, type MsFileStatDiscoveringEntry as aq, type MsFileStatNetworkErrorEntry as ar, type MsFileStatQuotedEntry as as, type MsFileSupplierStat as at, type P2pkhTransferAssetId as au, PROTOCOL_METHODS as av, PROTOCOL_VERSION as aw, type PaymentOutput as ax, type PaymentReleaseSummary as ay, type ProtocolCancelMessage as az, type ProtocolMethod as b, type MethodResult as c, type ConnectLoginResult as d, type ConnectResumeParams as e, type ConnectResumeResult as f, type ConnectLogoutResult as g, type ConnectLaunchParams as h, type ConnectLaunchResult as i, type IdentityGetResult as j, type IntentSignParams as k, type IntentSignResult as l, type CipherEncryptParams as m, type CipherEncryptResult as n, type CipherDecryptParams as o, type CipherDecryptResult as p, type PaymentPayParams as q, type PaymentPayResult as r, type PaymentStatusParams as s, type PaymentStatusResult as t, type ChannelPublishParams as u, type ChannelPublishResult as v, type ChannelSubscriptionSetParams as w, type ChannelSubscriptionSetResult as x, type StorageListResult as y, type StorageDirectoryParams as z };
740
+ export { type ChannelSubscriptionErrorCode as $, type AiTool as A, type BinaryField as B, type ConnectLoginParams as C, type StorageDirectoryResult as D, type StoragePutParams as E, type StoragePutResult as F, type StorageGetParams as G, type StorageGetResult as H, type IdentityGetParams as I, type StorageDeleteParams as J, type StorageDeleteResult as K, type MsFileStatParams as L, type MethodParams as M, type NetworkIdentity as N, type MsFileStatResult as O, type ProtocolEventMessage as P, type MsFileSeedReadParams as Q, type MsFileReadResult as R, type StorageListParams as S, type MsFileBlockReadParams as T, type ProtocolErrorCode as U, AI_TOOLS_MAX_JSON_CHARS as V, type AiToolDefinition as W, type AiToolMessage as X, type AiToolSchema as Y, type BsvNetwork as Z, type ChannelMessageReceivedEventData as _, type AiToolsRegistered as a, type ChannelSubscriptionPhase as a0, type ChannelSubscriptionStatus as a1, type ConnectLogoutParams as a2, type ConnectPaymentStatus as a3, type JSONValue as a4, MSFILE_BLOCK_SIZE_BYTES as a5, MSFILE_DIGEST_SIZE_BYTES as a6, MSFILE_LOCAL_SOURCE_ID as a7, MSFILE_MAX_BLOCK_BYTES as a8, MSFILE_MAX_CONTENT_BYTES as a9, type ProtocolEventPayload as aA, type ProtocolReadyMessage as aB, type ProtocolReconnectMessage as aC, type ProtocolRequestMessage as aD, type ProtocolResultMessage as aE, type PublicationProof as aF, type ResolvedClaimValue as aG, STORAGE_DEFAULT_LIST_LIMIT as aH, STORAGE_MAX_LIST_LIMIT as aI, STORAGE_MAX_PAYLOAD_BYTES as aJ, type StorageListEntry as aK, assertToolJson as aL, assertToolPayload as aM, isAiToolMessage as aN, isValidMsFileSourceId as aO, parseToolDefinitions as aP, sameNetworkIdentity as aQ, validateBsvNetwork as aR, validateNetworkIdentity as aS, validateToolArguments as aT, MSFILE_MAX_ERROR_MESSAGE_BYTES as aa, MSFILE_MAX_HEADER_BYTES as ab, MSFILE_MAX_SEED_BYTES as ac, MSFILE_PROTOCOL_ID as ad, type MethodParamsMap as ae, type MethodResultMap as af, type MsFileLocalSourceStat as ag, type MsFileRemoteSourceStat as ah, type MsFileSatoshiAmount as ai, type MsFileSourceKind as aj, type MsFileSourceStat as ak, type MsFileStatAbsentEntry as al, type MsFileStatAvailableEntry as am, type MsFileStatDiscoveringEntry as an, type MsFileStatNetworkErrorEntry as ao, type MsFileStatQuotedEntry as ap, type MsFileSupplierStat as aq, type P2pkhTransferAssetId as ar, PROTOCOL_METHODS as as, PROTOCOL_VERSION as at, type PaymentOutput as au, type PaymentReleaseSummary as av, type ProtocolCancelMessage as aw, type ProtocolClosingMessage as ax, type ProtocolError as ay, type ProtocolEventName as az, type ProtocolMethod as b, type MethodResult as c, type ConnectLoginResult as d, type ConnectResumeParams as e, type ConnectResumeResult as f, type ConnectLogoutResult as g, type ConnectLaunchParams as h, type ConnectLaunchResult as i, type IdentityGetResult as j, type IntentSignParams as k, type IntentSignResult as l, type CipherEncryptParams as m, type CipherEncryptResult as n, type CipherDecryptParams as o, type CipherDecryptResult as p, type PaymentPayParams as q, type PaymentPayResult as r, type PaymentStatusParams as s, type PaymentStatusResult as t, type ChannelPublishParams as u, type ChannelPublishResult as v, type ChannelSubscriptionSetParams as w, type ChannelSubscriptionSetResult as x, type StorageListResult as y, type StorageDirectoryParams as z };
@@ -1 +1 @@
1
- export { W as AiToolDefinition, X as AiToolMessage, Y as AiToolSchema, a as AiToolsRegistered, Z as AppIdentityProofV1, _ as AppIdentitySnapshot, $ as AppRequirement, B as BinaryField, a0 as BsvNetwork, a1 as ChannelMessageReceivedEventData, u as ChannelPublishParams, v as ChannelPublishResult, a2 as ChannelSubscriptionErrorCode, a3 as ChannelSubscriptionPhase, w as ChannelSubscriptionSetParams, x as ChannelSubscriptionSetResult, a4 as ChannelSubscriptionStatus, o as CipherDecryptParams, p as CipherDecryptResult, m as CipherEncryptParams, n as CipherEncryptResult, h as ConnectLaunchParams, i as ConnectLaunchResult, C as ConnectLoginParams, d as ConnectLoginResult, a5 as ConnectLogoutParams, g as ConnectLogoutResult, a6 as ConnectPaymentStatus, e as ConnectResumeParams, f as ConnectResumeResult, I as IdentityGetParams, j as IdentityGetResult, k as IntentSignParams, l as IntentSignResult, a7 as JSONValue, a8 as MSFILE_BLOCK_SIZE_BYTES, a9 as MSFILE_DIGEST_SIZE_BYTES, aa as MSFILE_LOCAL_SOURCE_ID, ab as MSFILE_MAX_BLOCK_BYTES, ac as MSFILE_MAX_CONTENT_BYTES, ad as MSFILE_MAX_ERROR_MESSAGE_BYTES, ae as MSFILE_MAX_HEADER_BYTES, af as MSFILE_MAX_SEED_BYTES, ag as MSFILE_PROTOCOL_ID, M as MethodParams, ah as MethodParamsMap, c as MethodResult, ai as MethodResultMap, T as MsFileBlockReadParams, aj as MsFileLocalSourceStat, R as MsFileReadResult, ak as MsFileRemoteSourceStat, al as MsFileSatoshiAmount, Q as MsFileSeedReadParams, am as MsFileSourceKind, an as MsFileSourceStat, ao as MsFileStatAbsentEntry, ap as MsFileStatAvailableEntry, aq as MsFileStatDiscoveringEntry, ar as MsFileStatNetworkErrorEntry, L as MsFileStatParams, as as MsFileStatQuotedEntry, O as MsFileStatResult, at as MsFileSupplierStat, N as NetworkIdentity, au as P2pkhTransferAssetId, av as PROTOCOL_METHODS, aw as PROTOCOL_VERSION, ax as PaymentOutput, q as PaymentPayParams, r as PaymentPayResult, ay as PaymentReleaseSummary, s as PaymentStatusParams, t as PaymentStatusResult, az as ProtocolCancelMessage, aA as ProtocolClosingMessage, aB as ProtocolError, U as ProtocolErrorCode, P as ProtocolEventMessage, aC as ProtocolEventName, aD as ProtocolEventPayload, b as ProtocolMethod, aE as ProtocolReadyMessage, aF as ProtocolReconnectMessage, aG as ProtocolRequestMessage, aH as ProtocolResultMessage, aI as ResolvedClaimValue, aJ as STORAGE_DEFAULT_LIST_LIMIT, aK as STORAGE_MAX_LIST_LIMIT, aL as STORAGE_MAX_PAYLOAD_BYTES, J as StorageDeleteParams, K as StorageDeleteResult, z as StorageDirectoryParams, D as StorageDirectoryResult, G as StorageGetParams, H as StorageGetResult, aM as StorageListEntry, S as StorageListParams, y as StorageListResult, E as StoragePutParams, F as StoragePutResult, aN as VerifiedAppIdentity, aR as isValidMsFileSourceId, aT as sameNetworkIdentity, aU as validateBsvNetwork, aV as validateNetworkIdentity } from './protocol-C8z30CKK.js';
1
+ export { W as AiToolDefinition, X as AiToolMessage, Y as AiToolSchema, a as AiToolsRegistered, B as BinaryField, Z as BsvNetwork, _ as ChannelMessageReceivedEventData, u as ChannelPublishParams, v as ChannelPublishResult, $ as ChannelSubscriptionErrorCode, a0 as ChannelSubscriptionPhase, w as ChannelSubscriptionSetParams, x as ChannelSubscriptionSetResult, a1 as ChannelSubscriptionStatus, o as CipherDecryptParams, p as CipherDecryptResult, m as CipherEncryptParams, n as CipherEncryptResult, h as ConnectLaunchParams, i as ConnectLaunchResult, C as ConnectLoginParams, d as ConnectLoginResult, a2 as ConnectLogoutParams, g as ConnectLogoutResult, a3 as ConnectPaymentStatus, e as ConnectResumeParams, f as ConnectResumeResult, I as IdentityGetParams, j as IdentityGetResult, k as IntentSignParams, l as IntentSignResult, a4 as JSONValue, a5 as MSFILE_BLOCK_SIZE_BYTES, a6 as MSFILE_DIGEST_SIZE_BYTES, a7 as MSFILE_LOCAL_SOURCE_ID, a8 as MSFILE_MAX_BLOCK_BYTES, a9 as MSFILE_MAX_CONTENT_BYTES, aa as MSFILE_MAX_ERROR_MESSAGE_BYTES, ab as MSFILE_MAX_HEADER_BYTES, ac as MSFILE_MAX_SEED_BYTES, ad as MSFILE_PROTOCOL_ID, M as MethodParams, ae as MethodParamsMap, c as MethodResult, af as MethodResultMap, T as MsFileBlockReadParams, ag as MsFileLocalSourceStat, R as MsFileReadResult, ah as MsFileRemoteSourceStat, ai as MsFileSatoshiAmount, Q as MsFileSeedReadParams, aj as MsFileSourceKind, ak as MsFileSourceStat, al as MsFileStatAbsentEntry, am as MsFileStatAvailableEntry, an as MsFileStatDiscoveringEntry, ao as MsFileStatNetworkErrorEntry, L as MsFileStatParams, ap as MsFileStatQuotedEntry, O as MsFileStatResult, aq as MsFileSupplierStat, N as NetworkIdentity, ar as P2pkhTransferAssetId, as as PROTOCOL_METHODS, at as PROTOCOL_VERSION, au as PaymentOutput, q as PaymentPayParams, r as PaymentPayResult, av as PaymentReleaseSummary, s as PaymentStatusParams, t as PaymentStatusResult, aw as ProtocolCancelMessage, ax as ProtocolClosingMessage, ay as ProtocolError, U as ProtocolErrorCode, P as ProtocolEventMessage, az as ProtocolEventName, aA as ProtocolEventPayload, b as ProtocolMethod, aB as ProtocolReadyMessage, aC as ProtocolReconnectMessage, aD as ProtocolRequestMessage, aE as ProtocolResultMessage, aF as PublicationProof, aG as ResolvedClaimValue, aH as STORAGE_DEFAULT_LIST_LIMIT, aI as STORAGE_MAX_LIST_LIMIT, aJ as STORAGE_MAX_PAYLOAD_BYTES, J as StorageDeleteParams, K as StorageDeleteResult, z as StorageDirectoryParams, D as StorageDirectoryResult, G as StorageGetParams, H as StorageGetResult, aK as StorageListEntry, S as StorageListParams, y as StorageListResult, E as StoragePutParams, F as StoragePutResult, aO as isValidMsFileSourceId, aQ as sameNetworkIdentity, aR as validateBsvNetwork, aS as validateNetworkIdentity } from './protocol-GXCfd2ya.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, STORAGE_DEFAULT_LIST_LIMIT, STORAGE_MAX_LIST_LIMIT, STORAGE_MAX_PAYLOAD_BYTES, isValidMsFileSourceId, sameNetworkIdentity, validateBsvNetwork, validateNetworkIdentity } from './chunk-ZDIFZJYD.js';
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, STORAGE_DEFAULT_LIST_LIMIT, STORAGE_MAX_LIST_LIMIT, STORAGE_MAX_PAYLOAD_BYTES, isValidMsFileSourceId, sameNetworkIdentity, validateBsvNetwork, validateNetworkIdentity } from './chunk-THT6XHHY.js';
2
2
  //# sourceMappingURL=protocol.js.map
3
3
  //# sourceMappingURL=protocol.js.map
package/dist/script.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ax as PaymentOutput } from './protocol-C8z30CKK.js';
1
+ import { au as PaymentOutput } from './protocol-GXCfd2ya.js';
2
2
 
3
3
  type PaymentScriptKind = "p2pkh" | "p2pk" | "multisig" | "op_return" | "unknown";
4
4
  interface PaymentScriptP2pkh {
package/dist/server.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { U as ProtocolErrorCode, au as P2pkhTransferAssetId, aG as ProtocolRequestMessage, N as NetworkIdentity, b as ProtocolMethod, M as MethodParams, Z as AppIdentityProofV1, aN as VerifiedAppIdentity, X as AiToolMessage, W as AiToolDefinition, a7 as JSONValue, aH as ProtocolResultMessage, aE as ProtocolReadyMessage, aA as ProtocolClosingMessage, c as MethodResult, aB as ProtocolError, aD as ProtocolEventPayload, aF as ProtocolReconnectMessage } from './protocol-C8z30CKK.js';
2
- export { V as AI_TOOLS_MAX_JSON_CHARS, A as AiTool, Y as AiToolSchema, a as AiToolsRegistered, aO as assertToolJson, aP as assertToolPayload, aQ as isAiToolMessage, aS as parseToolDefinitions, aW as validateToolArguments } from './protocol-C8z30CKK.js';
1
+ import { U as ProtocolErrorCode, ar as P2pkhTransferAssetId, aD as ProtocolRequestMessage, N as NetworkIdentity, b as ProtocolMethod, M as MethodParams, X as AiToolMessage, W as AiToolDefinition, a4 as JSONValue, aE as ProtocolResultMessage, aB as ProtocolReadyMessage, ax as ProtocolClosingMessage, c as MethodResult, ay as ProtocolError, aA as ProtocolEventPayload, aC as ProtocolReconnectMessage } from './protocol-GXCfd2ya.js';
2
+ export { V as AI_TOOLS_MAX_JSON_CHARS, A as AiTool, Y as AiToolSchema, a as AiToolsRegistered, aL as assertToolJson, aM as assertToolPayload, aN as isAiToolMessage, aP as parseToolDefinitions, aT as validateToolArguments } from './protocol-GXCfd2ya.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 const APP_IDENTITY_DOMAIN_V1 = "keymaster-app-identity:v1";
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 the proof payload. */
60
+ /** RFC 8785-compatible canonical JSON for generic vectors. */
62
61
  declare function canonicalizeJson(value: unknown): string;
63
- declare function identityPayload(proof: AppIdentityProofV1): Omit<AppIdentityProofV1, "signature">;
64
- declare function identityDigestBytes(proof: AppIdentityProofV1): Uint8Array;
65
- /** 验证外部签名 proof,并返回可持久化的 digest snapshot。 */
66
- declare function verifyAppIdentityProof(raw: unknown): VerifiedAppIdentity;
67
- /** 校验 session 中已验证 proof 的不可变 snapshot。 */
68
- declare function isVerifiedAppIdentitySnapshot(value: unknown): value is VerifiedAppIdentity;
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. */
@@ -144,7 +153,7 @@ interface ReceiverRequest<M extends ProtocolMethod = ProtocolMethod> {
144
153
  /** 判断建立连接的方法;ready 只表示传输可用,不属于身份授权。 */
145
154
  declare function isEstablishing(method: string): boolean;
146
155
  /** 生产钱包与闭环测试共用同一接收端,不内置测试业务或默认自动授权。 */
147
- /** 外部恢复控制只携带不透明授权引用和可选当前入口 proof,不能夹带业务参数或钱包选择器。 */
156
+ /** 外部恢复控制只携带不透明授权引用,不能夹带业务参数或钱包选择器。 */
148
157
  declare function parseReconnectMessage(data: unknown): ProtocolReconnectMessage | null;
149
158
  declare class KeymasterConnectReceiver {
150
159
  private readonly options;
@@ -190,4 +199,4 @@ declare class KeymasterConnectReceiver {
190
199
  private send;
191
200
  }
192
201
 
193
- export { APP_IDENTITY_DOMAIN_V1, AiToolDefinition, AiToolMessage, type AiToolReceiverOptions, AppIdentityValidationError, type ConnectPeer, type ConnectReceiverOptions, KeymasterAiToolReceiver, KeymasterConnectReceiver, ProtocolEventPayload, ProtocolValidationError, type ReceiverLifecycle, type ReceiverMessage, type ReceiverPeerPolicy, type ReceiverRequest, assertCompressedPubkeyHex, assertMainnetP2pkhAddress, assertOriginMatches, assertP2pkhAddressForAsset, canonicalizeJson, identityDigestBytes, identityPayload, isEstablishing, isStructuredCloneRequestCandidate, isVerifiedAppIdentitySnapshot, parseCancelMessage, parseReconnectMessage, parseRequestMessage, validateExactChannel, verifyAppIdentityProof };
202
+ 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, parseReconnectMessage, parseRequestMessage, validateExactChannel };