@labacacia/nps-sdk 1.0.0-alpha.2 → 1.0.0-alpha.4

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.
Files changed (315) hide show
  1. package/CHANGELOG.cn.md +73 -2
  2. package/CHANGELOG.md +82 -2
  3. package/README.cn.md +8 -2
  4. package/README.md +8 -2
  5. package/dist/core/anchor-cache.d.ts +0 -0
  6. package/dist/core/anchor-cache.d.ts.map +0 -0
  7. package/dist/core/anchor-cache.js +0 -0
  8. package/dist/core/anchor-cache.js.map +0 -0
  9. package/dist/core/cache.d.ts +0 -0
  10. package/dist/core/cache.d.ts.map +0 -0
  11. package/dist/core/cache.js +0 -0
  12. package/dist/core/cache.js.map +0 -0
  13. package/dist/core/canonical-json.d.ts +0 -0
  14. package/dist/core/canonical-json.d.ts.map +0 -0
  15. package/dist/core/canonical-json.js +0 -0
  16. package/dist/core/canonical-json.js.map +0 -0
  17. package/dist/core/codec.d.ts +0 -0
  18. package/dist/core/codec.d.ts.map +0 -0
  19. package/dist/core/codec.js +0 -0
  20. package/dist/core/codec.js.map +0 -0
  21. package/dist/core/codecs/index.d.ts +0 -0
  22. package/dist/core/codecs/index.d.ts.map +0 -0
  23. package/dist/core/codecs/index.js +0 -0
  24. package/dist/core/codecs/index.js.map +0 -0
  25. package/dist/core/codecs/ncp-codec.d.ts +0 -0
  26. package/dist/core/codecs/ncp-codec.d.ts.map +0 -0
  27. package/dist/core/codecs/ncp-codec.js +0 -0
  28. package/dist/core/codecs/ncp-codec.js.map +0 -0
  29. package/dist/core/codecs/tier1-json-codec.d.ts +0 -0
  30. package/dist/core/codecs/tier1-json-codec.d.ts.map +0 -0
  31. package/dist/core/codecs/tier1-json-codec.js +0 -0
  32. package/dist/core/codecs/tier1-json-codec.js.map +0 -0
  33. package/dist/core/codecs/tier2-msgpack-codec.d.ts +0 -0
  34. package/dist/core/codecs/tier2-msgpack-codec.d.ts.map +0 -0
  35. package/dist/core/codecs/tier2-msgpack-codec.js +0 -0
  36. package/dist/core/codecs/tier2-msgpack-codec.js.map +0 -0
  37. package/dist/core/crypto-provider.d.ts +0 -0
  38. package/dist/core/crypto-provider.d.ts.map +0 -0
  39. package/dist/core/crypto-provider.js +0 -0
  40. package/dist/core/crypto-provider.js.map +0 -0
  41. package/dist/core/exceptions.d.ts +0 -0
  42. package/dist/core/exceptions.d.ts.map +0 -0
  43. package/dist/core/exceptions.js +0 -0
  44. package/dist/core/exceptions.js.map +0 -0
  45. package/dist/core/frame-header.d.ts +0 -0
  46. package/dist/core/frame-header.d.ts.map +0 -0
  47. package/dist/core/frame-header.js +0 -0
  48. package/dist/core/frame-header.js.map +0 -0
  49. package/dist/core/frame-registry.d.ts +0 -0
  50. package/dist/core/frame-registry.d.ts.map +0 -0
  51. package/dist/core/frame-registry.js +0 -0
  52. package/dist/core/frame-registry.js.map +0 -0
  53. package/dist/core/frames.d.ts +0 -0
  54. package/dist/core/frames.d.ts.map +0 -0
  55. package/dist/core/frames.js +0 -0
  56. package/dist/core/frames.js.map +0 -0
  57. package/dist/core/index.d.ts +0 -0
  58. package/dist/core/index.d.ts.map +0 -0
  59. package/dist/core/index.js +0 -0
  60. package/dist/core/index.js.map +0 -0
  61. package/dist/core/registry.d.ts +0 -0
  62. package/dist/core/registry.d.ts.map +0 -0
  63. package/dist/core/registry.js +0 -0
  64. package/dist/core/registry.js.map +0 -0
  65. package/dist/core/status-codes.d.ts +0 -0
  66. package/dist/core/status-codes.d.ts.map +0 -0
  67. package/dist/core/status-codes.js +0 -0
  68. package/dist/core/status-codes.js.map +0 -0
  69. package/dist/index.d.ts +0 -0
  70. package/dist/index.d.ts.map +0 -0
  71. package/dist/index.js +0 -0
  72. package/dist/index.js.map +0 -0
  73. package/dist/ncp/frames/anchor-frame.d.ts +0 -0
  74. package/dist/ncp/frames/anchor-frame.d.ts.map +0 -0
  75. package/dist/ncp/frames/anchor-frame.js +0 -0
  76. package/dist/ncp/frames/anchor-frame.js.map +0 -0
  77. package/dist/ncp/frames/caps-frame.d.ts +0 -0
  78. package/dist/ncp/frames/caps-frame.d.ts.map +0 -0
  79. package/dist/ncp/frames/caps-frame.js +0 -0
  80. package/dist/ncp/frames/caps-frame.js.map +0 -0
  81. package/dist/ncp/frames/diff-frame.d.ts +0 -0
  82. package/dist/ncp/frames/diff-frame.d.ts.map +0 -0
  83. package/dist/ncp/frames/diff-frame.js +0 -0
  84. package/dist/ncp/frames/diff-frame.js.map +0 -0
  85. package/dist/ncp/frames/error-frame.d.ts +0 -0
  86. package/dist/ncp/frames/error-frame.d.ts.map +0 -0
  87. package/dist/ncp/frames/error-frame.js +0 -0
  88. package/dist/ncp/frames/error-frame.js.map +0 -0
  89. package/dist/ncp/frames/hello-frame.d.ts +0 -0
  90. package/dist/ncp/frames/hello-frame.d.ts.map +0 -0
  91. package/dist/ncp/frames/hello-frame.js +0 -0
  92. package/dist/ncp/frames/hello-frame.js.map +0 -0
  93. package/dist/ncp/frames/stream-frame.d.ts +0 -0
  94. package/dist/ncp/frames/stream-frame.d.ts.map +0 -0
  95. package/dist/ncp/frames/stream-frame.js +0 -0
  96. package/dist/ncp/frames/stream-frame.js.map +0 -0
  97. package/dist/ncp/frames.d.ts +0 -0
  98. package/dist/ncp/frames.d.ts.map +0 -0
  99. package/dist/ncp/frames.js +0 -0
  100. package/dist/ncp/frames.js.map +0 -0
  101. package/dist/ncp/handshake.d.ts +0 -0
  102. package/dist/ncp/handshake.d.ts.map +0 -0
  103. package/dist/ncp/handshake.js +0 -0
  104. package/dist/ncp/handshake.js.map +0 -0
  105. package/dist/ncp/index.d.ts +1 -0
  106. package/dist/ncp/index.d.ts.map +1 -1
  107. package/dist/ncp/index.js +1 -0
  108. package/dist/ncp/index.js.map +1 -1
  109. package/dist/ncp/ncp-error-codes.d.ts +1 -0
  110. package/dist/ncp/ncp-error-codes.d.ts.map +1 -1
  111. package/dist/ncp/ncp-error-codes.js +2 -0
  112. package/dist/ncp/ncp-error-codes.js.map +1 -1
  113. package/dist/ncp/ncp-patch-format.d.ts +0 -0
  114. package/dist/ncp/ncp-patch-format.d.ts.map +0 -0
  115. package/dist/ncp/ncp-patch-format.js +0 -0
  116. package/dist/ncp/ncp-patch-format.js.map +0 -0
  117. package/dist/ncp/preamble.d.ts +47 -0
  118. package/dist/ncp/preamble.d.ts.map +1 -0
  119. package/dist/ncp/preamble.js +74 -0
  120. package/dist/ncp/preamble.js.map +1 -0
  121. package/dist/ncp/registry.d.ts +0 -0
  122. package/dist/ncp/registry.d.ts.map +0 -0
  123. package/dist/ncp/registry.js +0 -0
  124. package/dist/ncp/registry.js.map +0 -0
  125. package/dist/ncp/stream-manager.d.ts +0 -0
  126. package/dist/ncp/stream-manager.d.ts.map +0 -0
  127. package/dist/ncp/stream-manager.js +0 -0
  128. package/dist/ncp/stream-manager.js.map +0 -0
  129. package/dist/ndp/frames.d.ts +0 -0
  130. package/dist/ndp/frames.d.ts.map +0 -0
  131. package/dist/ndp/frames.js +0 -0
  132. package/dist/ndp/frames.js.map +0 -0
  133. package/dist/ndp/index.d.ts +0 -0
  134. package/dist/ndp/index.d.ts.map +0 -0
  135. package/dist/ndp/index.js +0 -0
  136. package/dist/ndp/index.js.map +0 -0
  137. package/dist/ndp/ndp-registry.d.ts +0 -0
  138. package/dist/ndp/ndp-registry.d.ts.map +0 -0
  139. package/dist/ndp/ndp-registry.js +0 -0
  140. package/dist/ndp/ndp-registry.js.map +0 -0
  141. package/dist/ndp/registry.d.ts +0 -0
  142. package/dist/ndp/registry.d.ts.map +0 -0
  143. package/dist/ndp/registry.js +0 -0
  144. package/dist/ndp/registry.js.map +0 -0
  145. package/dist/ndp/validator.d.ts +0 -0
  146. package/dist/ndp/validator.d.ts.map +0 -0
  147. package/dist/ndp/validator.js +0 -0
  148. package/dist/ndp/validator.js.map +0 -0
  149. package/dist/nip/acme/client.d.ts +31 -0
  150. package/dist/nip/acme/client.d.ts.map +1 -0
  151. package/dist/nip/acme/client.js +136 -0
  152. package/dist/nip/acme/client.js.map +1 -0
  153. package/dist/nip/acme/index.d.ts +6 -0
  154. package/dist/nip/acme/index.d.ts.map +1 -0
  155. package/dist/nip/acme/index.js +8 -0
  156. package/dist/nip/acme/index.js.map +1 -0
  157. package/dist/nip/acme/jws.d.ts +31 -0
  158. package/dist/nip/acme/jws.d.ts.map +1 -0
  159. package/dist/nip/acme/jws.js +76 -0
  160. package/dist/nip/acme/jws.js.map +1 -0
  161. package/dist/nip/acme/messages.d.ts +71 -0
  162. package/dist/nip/acme/messages.d.ts.map +1 -0
  163. package/dist/nip/acme/messages.js +4 -0
  164. package/dist/nip/acme/messages.js.map +1 -0
  165. package/dist/nip/acme/server.d.ts +41 -0
  166. package/dist/nip/acme/server.d.ts.map +1 -0
  167. package/dist/nip/acme/server.js +458 -0
  168. package/dist/nip/acme/server.js.map +1 -0
  169. package/dist/nip/acme/wire.d.ts +19 -0
  170. package/dist/nip/acme/wire.d.ts.map +1 -0
  171. package/dist/nip/acme/wire.js +21 -0
  172. package/dist/nip/acme/wire.js.map +1 -0
  173. package/dist/nip/assurance-level.d.ts +14 -0
  174. package/dist/nip/assurance-level.d.ts.map +1 -0
  175. package/dist/nip/assurance-level.js +33 -0
  176. package/dist/nip/assurance-level.js.map +1 -0
  177. package/dist/nip/cert-format.d.ts +5 -0
  178. package/dist/nip/cert-format.d.ts.map +1 -0
  179. package/dist/nip/cert-format.js +6 -0
  180. package/dist/nip/cert-format.js.map +1 -0
  181. package/dist/nip/error-codes.d.ts +23 -0
  182. package/dist/nip/error-codes.d.ts.map +1 -0
  183. package/dist/nip/error-codes.js +30 -0
  184. package/dist/nip/error-codes.js.map +1 -0
  185. package/dist/nip/frames.d.ts +10 -1
  186. package/dist/nip/frames.d.ts.map +1 -1
  187. package/dist/nip/frames.js +29 -4
  188. package/dist/nip/frames.js.map +1 -1
  189. package/dist/nip/identity.d.ts +0 -0
  190. package/dist/nip/identity.d.ts.map +0 -0
  191. package/dist/nip/identity.js +0 -0
  192. package/dist/nip/identity.js.map +0 -0
  193. package/dist/nip/index.d.ts +6 -0
  194. package/dist/nip/index.d.ts.map +1 -1
  195. package/dist/nip/index.js +7 -0
  196. package/dist/nip/index.js.map +1 -1
  197. package/dist/nip/registry.d.ts +0 -0
  198. package/dist/nip/registry.d.ts.map +0 -0
  199. package/dist/nip/registry.js +0 -0
  200. package/dist/nip/registry.js.map +0 -0
  201. package/dist/nip/verifier.d.ts +23 -0
  202. package/dist/nip/verifier.d.ts.map +1 -0
  203. package/dist/nip/verifier.js +90 -0
  204. package/dist/nip/verifier.js.map +1 -0
  205. package/dist/nip/x509/builder.d.ts +35 -0
  206. package/dist/nip/x509/builder.d.ts.map +1 -0
  207. package/dist/nip/x509/builder.js +59 -0
  208. package/dist/nip/x509/builder.js.map +1 -0
  209. package/dist/nip/x509/index.d.ts +4 -0
  210. package/dist/nip/x509/index.d.ts.map +1 -0
  211. package/dist/nip/x509/index.js +6 -0
  212. package/dist/nip/x509/index.js.map +1 -0
  213. package/dist/nip/x509/oids.d.ts +17 -0
  214. package/dist/nip/x509/oids.d.ts.map +1 -0
  215. package/dist/nip/x509/oids.js +23 -0
  216. package/dist/nip/x509/oids.js.map +1 -0
  217. package/dist/nip/x509/verifier.d.ts +26 -0
  218. package/dist/nip/x509/verifier.d.ts.map +1 -0
  219. package/dist/nip/x509/verifier.js +171 -0
  220. package/dist/nip/x509/verifier.js.map +1 -0
  221. package/dist/nop/client.d.ts +0 -0
  222. package/dist/nop/client.d.ts.map +0 -0
  223. package/dist/nop/client.js +0 -0
  224. package/dist/nop/client.js.map +0 -0
  225. package/dist/nop/frames.d.ts +0 -0
  226. package/dist/nop/frames.d.ts.map +0 -0
  227. package/dist/nop/frames.js +0 -0
  228. package/dist/nop/frames.js.map +0 -0
  229. package/dist/nop/index.d.ts +0 -0
  230. package/dist/nop/index.d.ts.map +0 -0
  231. package/dist/nop/index.js +0 -0
  232. package/dist/nop/index.js.map +0 -0
  233. package/dist/nop/models.d.ts +0 -0
  234. package/dist/nop/models.d.ts.map +0 -0
  235. package/dist/nop/models.js +0 -0
  236. package/dist/nop/models.js.map +0 -0
  237. package/dist/nop/nop-types.d.ts +0 -0
  238. package/dist/nop/nop-types.d.ts.map +0 -0
  239. package/dist/nop/nop-types.js +0 -0
  240. package/dist/nop/nop-types.js.map +0 -0
  241. package/dist/nop/registry.d.ts +0 -0
  242. package/dist/nop/registry.d.ts.map +0 -0
  243. package/dist/nop/registry.js +0 -0
  244. package/dist/nop/registry.js.map +0 -0
  245. package/dist/nwp/client.d.ts +0 -0
  246. package/dist/nwp/client.d.ts.map +0 -0
  247. package/dist/nwp/client.js +0 -0
  248. package/dist/nwp/client.js.map +0 -0
  249. package/dist/nwp/frames.d.ts +0 -0
  250. package/dist/nwp/frames.d.ts.map +0 -0
  251. package/dist/nwp/frames.js +0 -0
  252. package/dist/nwp/frames.js.map +0 -0
  253. package/dist/nwp/index.d.ts +0 -0
  254. package/dist/nwp/index.d.ts.map +0 -0
  255. package/dist/nwp/index.js +0 -0
  256. package/dist/nwp/index.js.map +0 -0
  257. package/dist/nwp/registry.d.ts +0 -0
  258. package/dist/nwp/registry.d.ts.map +0 -0
  259. package/dist/nwp/registry.js +0 -0
  260. package/dist/nwp/registry.js.map +0 -0
  261. package/dist/setup.d.ts +0 -0
  262. package/dist/setup.d.ts.map +0 -0
  263. package/dist/setup.js +0 -0
  264. package/dist/setup.js.map +0 -0
  265. package/package.json +2 -1
  266. package/src/index.ts +0 -0
  267. package/src/ncp/index.ts +1 -0
  268. package/src/ncp/ncp-error-codes.ts +2 -0
  269. package/src/ncp/preamble.ts +79 -0
  270. package/src/nip/acme/client.ts +185 -0
  271. package/src/nip/acme/index.ts +8 -0
  272. package/src/nip/acme/jws.ts +109 -0
  273. package/src/nip/acme/messages.ts +85 -0
  274. package/src/nip/acme/server.ts +480 -0
  275. package/src/nip/acme/wire.ts +24 -0
  276. package/src/nip/assurance-level.ts +35 -0
  277. package/src/nip/cert-format.ts +9 -0
  278. package/src/nip/error-codes.ts +36 -0
  279. package/src/nip/frames.ts +35 -3
  280. package/src/nip/index.ts +8 -0
  281. package/src/nip/verifier.ts +122 -0
  282. package/src/nip/x509/builder.ts +91 -0
  283. package/src/nip/x509/index.ts +6 -0
  284. package/src/nip/x509/oids.ts +28 -0
  285. package/src/nip/x509/verifier.ts +214 -0
  286. package/tests/_rfc0002-keys.ts +57 -0
  287. package/tests/ncp/preamble.test.ts +93 -0
  288. package/tests/nip-acme-agent01.test.ts +192 -0
  289. package/tests/nip-x509.test.ts +280 -0
  290. package/.npmrc.publish +0 -1
  291. package/dist/codec-CmHeovTV.d.cts +0 -120
  292. package/dist/codec-CmHeovTV.d.ts +0 -120
  293. package/dist/core/index.cjs +0 -371
  294. package/dist/core/index.cjs.map +0 -1
  295. package/dist/core/index.d.cts +0 -41
  296. package/dist/frames-B3qLdl_g.d.cts +0 -77
  297. package/dist/frames-Ff7-ZPUl.d.ts +0 -77
  298. package/dist/index.cjs +0 -1556
  299. package/dist/index.cjs.map +0 -1
  300. package/dist/index.d.cts +0 -21
  301. package/dist/ncp/index.cjs +0 -188
  302. package/dist/ncp/index.cjs.map +0 -1
  303. package/dist/ncp/index.d.cts +0 -6
  304. package/dist/ndp/index.cjs +0 -252
  305. package/dist/ndp/index.cjs.map +0 -1
  306. package/dist/ndp/index.d.cts +0 -86
  307. package/dist/nip/index.cjs +0 -214
  308. package/dist/nip/index.cjs.map +0 -1
  309. package/dist/nip/index.d.cts +0 -65
  310. package/dist/nop/index.cjs +0 -762
  311. package/dist/nop/index.cjs.map +0 -1
  312. package/dist/nop/index.d.cts +0 -155
  313. package/dist/nwp/index.cjs +0 -658
  314. package/dist/nwp/index.cjs.map +0 -1
  315. package/dist/nwp/index.d.cts +0 -65
package/CHANGELOG.cn.md CHANGED
@@ -8,6 +8,75 @@
8
8
 
9
9
  ---
10
10
 
11
+ ## [1.0.0-alpha.4] —— 2026-04-30
12
+
13
+ ### 新增
14
+
15
+ - **NPS-RFC-0001 Phase 2 —— NCP 连接前导(TypeScript helper 跟进)。**
16
+ `src/ncp/preamble.ts` 暴露 `writePreamble(stream)` /
17
+ `readPreamble(stream)`,往返字面量 `b"NPS/1.0\n"` 哨兵;
18
+ `tests/ncp/preamble.test.ts` 覆盖。让 TypeScript SDK 与 .NET /
19
+ Python / Go / Java 在 alpha.4 的 preamble helper 持平。
20
+ - **NPS-RFC-0002 Phase A/B —— X.509 NID 证书 + ACME `agent-01`
21
+ (TypeScript 端口)。** 新增 `src/nip/` 子模块:
22
+ - `nip/x509/` —— X.509 NID 证书 builder + verifier
23
+ (`x509.Builder`、`x509.Verifier`)。
24
+ - `nip/acme/` —— ACME `agent-01` 客户端 + 服务端参考实现
25
+ (`AcmeServer`、`AcmeClient`);按 NPS-RFC-0002 Phase B 的 JWS
26
+ 签名 wire 包络。
27
+ - `nip/assurance-level.ts` —— Agent 身份保证等级
28
+ (`anonymous` / `attested` / `verified`),承接 NPS-RFC-0003。
29
+ - `nip/cert-format.ts` —— IdentFrame `cert_format` 判别器
30
+ (`v1` Ed25519 vs. `x509`)。
31
+ - `nip/error-codes.ts` —— NIP 错误码命名空间。
32
+ - `nip/verifier.ts` —— dual-trust IdentFrame 验证器(v1 + X.509)。
33
+ - 20 个新测试覆盖 preamble 往返、X.509 签发 + 解析、dual-trust 验证、
34
+ ACME agent-01 全流程。总数:284 tests 全绿(alpha.3 时 264)。
35
+
36
+ ### 变更
37
+
38
+ - 分发版本升至 `1.0.0-alpha.4`。
39
+ - `src/nip/frames.ts` —— IdentFrame wire 形状扩展,可携带可选的
40
+ `cert_format` 判别器 + `x509_chain` 字段,与 v1 Ed25519 字段并存。
41
+ alpha.3 写出的 v1 IdentFrame 仍可被 alpha.4 验签。
42
+
43
+ ### npm 发布说明
44
+
45
+ - 本仓库 / tag 是 `@labacacia/nps-sdk` `1.0.0-alpha.4` 的权威参考。
46
+ 延续 alpha.3 的情况,npm publish 可能需要带 2FA-bypass 的 granular
47
+ access token —— 如果 npm registry 上的版本暂时落后于本仓库 tag,
48
+ 以 tag 为准;下一次 registry cut 后 `npm install` 即可解析到本
49
+ commit。
50
+
51
+ ### 套件级 alpha.4 要点
52
+
53
+ - **NPS-RFC-0002 X.509 + ACME** —— 完整跨 SDK 端口波(.NET / Java /
54
+ Python / TypeScript / Go / Rust)。
55
+ - **NPS-CR-0002 —— Anchor Node topology 查询** —— `topology.snapshot`
56
+ / `topology.stream`(.NET 参考 + L2 conformance)。TypeScript 消费
57
+ 侧 helper 后续版本跟进。
58
+ - **`nps-registry` SQLite 实仓** + **`nps-ledger` Phase 2**
59
+ (RFC 9162 Merkle + STH + inclusion proof)已在 daemon 仓库交付。
60
+
61
+ ---
62
+
63
+ ## [1.0.0-alpha.3] —— 2026-04-25
64
+
65
+ ### Changed
66
+
67
+ - 版本升级至 `1.0.0-alpha.3`,与 NPS `v1.0.0-alpha.3` 套件同步。本次 TypeScript SDK 无功能变更。
68
+ - 264 tests, ≥98% 覆盖率仍全绿。
69
+
70
+ ### 套件级 alpha.3 要点(各语言 helper 在 alpha.4 跟进)
71
+
72
+ - **NPS-RFC-0001 —— NCP 连接前导**(Accepted)。原生模式连接现以字面量 `b"NPS/1.0\n"`(8 字节)开头。.NET SDK 已落地参考实现;TypeScript helper 在 alpha.4 跟进。
73
+ - **NPS-RFC-0003 —— Agent 身份保证等级**(Accepted)。NIP IdentFrame 与 NWM 新增三态 `assurance_level`(`anonymous`/`attested`/`verified`)。.NET 参考类型已落地;TypeScript 同步在 alpha.4。
74
+ - **NPS-RFC-0004 —— NID 声誉日志(CT 风格)**(Accepted)。append-only Merkle 日志条目结构发布;.NET 参考签名器已落地(并以 `nps-ledger` daemon Phase 1 形态发布)。TypeScript helper 在 alpha.4 跟进。
75
+ - **NPS-CR-0001 —— Anchor / Bridge 节点拆分。** 旧的 "Gateway Node" 角色更名为 **Anchor Node**;"NPS↔外部协议翻译" 单独成为 **Bridge Node** 类型。AnnounceFrame 新增 `node_kind` / `cluster_anchor` / `bridge_protocols`。源代码层面变更落在 `spec/` + .NET 参考实现。
76
+ - **6 个 NPS 常驻 daemon。** NPS-Dev 新建 `daemons/` 目录,定义 `npsd` / `nps-runner` / `nps-gateway` / `nps-registry` / `nps-cloud-ca` / `nps-ledger`;其中 `npsd` 提供 L1 功能性参考实现,其余为 Phase 1 骨架。
77
+
78
+ ---
79
+
11
80
  ## [1.0.0-alpha.2] —— 2026-04-19
12
81
 
13
82
  ### Fixed
@@ -35,5 +104,7 @@
35
104
 
36
105
  作为 NPS 套件 `v1.0.0-alpha.1` 的一部分首次公开 alpha。
37
106
 
38
- [1.0.0-alpha.2]: https://github.com/LabAcacia/nps/releases/tag/v1.0.0-alpha.2
39
- [1.0.0-alpha.1]: https://github.com/LabAcacia/nps/releases/tag/v1.0.0-alpha.1
107
+ [1.0.0-alpha.4]: https://gitee.com/labacacia/NPS-sdk-ts/releases/tag/v1.0.0-alpha.4
108
+ [1.0.0-alpha.3]: https://github.com/LabAcacia/NPS-Dev/releases/tag/v1.0.0-alpha.3
109
+ [1.0.0-alpha.2]: https://github.com/LabAcacia/NPS-Dev/releases/tag/v1.0.0-alpha.2
110
+ [1.0.0-alpha.1]: https://github.com/LabAcacia/NPS-Dev/releases/tag/v1.0.0-alpha.1
package/CHANGELOG.md CHANGED
@@ -8,6 +8,84 @@ Until NPS reaches v1.0 stable, every repository in the suite is synchronized to
8
8
 
9
9
  ---
10
10
 
11
+ ## [1.0.0-alpha.4] — 2026-04-30
12
+
13
+ ### Added
14
+
15
+ - **NPS-RFC-0001 Phase 2 — NCP connection preamble (TypeScript helper
16
+ parity).** `src/ncp/preamble.ts` exposes `writePreamble(stream)` and
17
+ `readPreamble(stream)` round-tripping the literal `b"NPS/1.0\n"`
18
+ sentinel; matched by `tests/ncp/preamble.test.ts`. Brings TypeScript
19
+ in line with the .NET / Python / Go / Java preamble helpers shipped
20
+ at alpha.4.
21
+ - **NPS-RFC-0002 Phase A/B — X.509 NID certificates + ACME `agent-01`
22
+ (TypeScript port).** New surface under `src/nip/`:
23
+ - `nip/x509/` — X.509 NID certificate builder + verifier
24
+ (`x509.Builder`, `x509.Verifier`).
25
+ - `nip/acme/` — ACME `agent-01` client + server reference
26
+ (`AcmeServer`, `AcmeClient`); JWS-signed wire envelope per
27
+ NPS-RFC-0002 Phase B.
28
+ - `nip/assurance-level.ts` — agent identity assurance levels
29
+ (`anonymous` / `attested` / `verified`) per NPS-RFC-0003.
30
+ - `nip/cert-format.ts` — IdentFrame `cert_format` discriminator
31
+ (`v1` Ed25519 vs. `x509`).
32
+ - `nip/error-codes.ts` — NIP error code namespace strings.
33
+ - `nip/verifier.ts` — dual-trust IdentFrame verifier (v1 + X.509).
34
+ - 20 new tests covering preamble round-trip, X.509 issuance + parsing,
35
+ dual-trust verification, and ACME agent-01 round-trip. Total: 284
36
+ tests green (was 264 at alpha.3).
37
+
38
+ ### Changed
39
+
40
+ - Distribution version bumped to `1.0.0-alpha.4`.
41
+ - `src/nip/frames.ts` — IdentFrame wire shape extended with optional
42
+ `cert_format` discriminator + `x509_chain` field alongside the
43
+ existing v1 Ed25519 fields. v1 IdentFrames written by alpha.3
44
+ consumers continue to verify unchanged.
45
+
46
+ ### Note: npm publish status
47
+
48
+ - This repo / tag is the canonical `1.0.0-alpha.4` reference for
49
+ `@labacacia/nps-sdk`. As at the alpha.3 ship cycle, npm publish
50
+ may require a granular access token with 2FA-bypass enabled — if
51
+ the registry version lags this repo's tag, the tag is the
52
+ authoritative artifact and `npm install` against the next
53
+ registry cut will resolve to this commit.
54
+
55
+ ### Suite-wide highlights at alpha.4
56
+
57
+ - **NPS-RFC-0002 X.509 + ACME** — full cross-SDK port wave (.NET /
58
+ Java / Python / TypeScript / Go / Rust). Servers can now issue
59
+ dual-trust IdentFrames (v1 Ed25519 + X.509 leaf cert chained to a
60
+ self-signed root) and self-onboard NIDs over ACME's `agent-01`
61
+ challenge type.
62
+ - **NPS-CR-0002 — Anchor Node topology queries** — `topology.snapshot`
63
+ / `topology.stream` query types (.NET reference + L2 conformance
64
+ suite). TypeScript consumer-side helpers planned for a later
65
+ release.
66
+ - **`nps-registry` SQLite-backed real registry** + **`nps-ledger`
67
+ Phase 2** (RFC 9162 Merkle + STH + inclusion proofs) shipped in the
68
+ daemon repos.
69
+
70
+ ---
71
+
72
+ ## [1.0.0-alpha.3] — 2026-04-25
73
+
74
+ ### Changed
75
+
76
+ - Version bump to `1.0.0-alpha.3` for suite-wide synchronization with the NPS `v1.0.0-alpha.3` release. No functional changes in the TypeScript SDK at this milestone.
77
+ - 264 tests, ≥98% coverage still green.
78
+
79
+ ### Suite-wide highlights at alpha.3 (per-language helpers planned for alpha.4)
80
+
81
+ - **NPS-RFC-0001 — NCP connection preamble** (Accepted). Native-mode connections now begin with the literal `b"NPS/1.0\n"` (8 bytes). Reference helper landed in the .NET SDK; TypeScript helper deferred to alpha.4.
82
+ - **NPS-RFC-0003 — Agent identity assurance levels** (Accepted). NIP IdentFrame and NWM gain a tri-state `assurance_level` (`anonymous`/`attested`/`verified`). Reference types landed in .NET; TypeScript parity deferred to alpha.4.
83
+ - **NPS-RFC-0004 — NID reputation log (CT-style)** (Accepted). Append-only Merkle log entry shape published; reference signer landed in .NET (and shipped as the `nps-ledger` daemon Phase 1). TypeScript helpers deferred to alpha.4.
84
+ - **NPS-CR-0001 — Anchor / Bridge node split.** The legacy "Gateway Node" role is renamed to **Anchor Node**; the "translate NPS↔external protocol" role is now its own **Bridge Node** type. AnnounceFrame gained `node_kind` / `cluster_anchor` / `bridge_protocols`. Source-of-truth changes are in `spec/` + the .NET reference implementation.
85
+ - **6 NPS resident daemons.** New `daemons/` tree in NPS-Dev defines `npsd` / `nps-runner` / `nps-gateway` / `nps-registry` / `nps-cloud-ca` / `nps-ledger`; `npsd` ships an L1-functional reference and the rest ship as Phase 1 skeletons.
86
+
87
+ ---
88
+
11
89
  ## [1.0.0-alpha.2] — 2026-04-19
12
90
 
13
91
  ### Fixed
@@ -35,5 +113,7 @@ Until NPS reaches v1.0 stable, every repository in the suite is synchronized to
35
113
 
36
114
  First public alpha as part of the NPS suite `v1.0.0-alpha.1` release.
37
115
 
38
- [1.0.0-alpha.2]: https://github.com/LabAcacia/nps/releases/tag/v1.0.0-alpha.2
39
- [1.0.0-alpha.1]: https://github.com/LabAcacia/nps/releases/tag/v1.0.0-alpha.1
116
+ [1.0.0-alpha.4]: https://github.com/labacacia/NPS-sdk-ts/releases/tag/v1.0.0-alpha.4
117
+ [1.0.0-alpha.3]: https://github.com/LabAcacia/NPS-Dev/releases/tag/v1.0.0-alpha.3
118
+ [1.0.0-alpha.2]: https://github.com/LabAcacia/NPS-Dev/releases/tag/v1.0.0-alpha.2
119
+ [1.0.0-alpha.1]: https://github.com/LabAcacia/NPS-Dev/releases/tag/v1.0.0-alpha.1
package/README.cn.md CHANGED
@@ -7,16 +7,22 @@
7
7
 
8
8
  ## 状态
9
9
 
10
- **v1.0.0-alpha.2Phase 2** · 5 个协议 · 264 个测试 · 覆盖率 ≥ 98%
10
+ **v1.0.0-alpha.4RFC-0002 SDK 端口波(第三棒)** · 5 个协议 · 271 个测试 · 覆盖率 ≥ 98%
11
11
 
12
12
  | 协议 | 类 | 状态 |
13
13
  |------|----|------|
14
14
  | NCP — Neural Communication Protocol | 帧、编解码器 | ✅ |
15
15
  | NWP — Neural Web Protocol | `NwpClient` | ✅ |
16
- | NIP — Neural Identity Protocol | `NipIdentity` | ✅ |
16
+ | NIP — Neural Identity Protocol | `NipIdentity`、`NipIdentVerifier`(RFC-0002 §8.1 双信任)、`AssuranceLevel`(RFC-0003)、`nip.x509` + `nip.acme` | ✅ |
17
17
  | NDP — Neural Discovery Protocol | `InMemoryNdpRegistry`、`NdpAnnounceValidator` | ✅ |
18
18
  | NOP — Neural Orchestration Protocol | `NopClient` | ✅ |
19
19
 
20
+ **alpha.4 新增** —— 完整的 NPS-RFC-0002 X.509 + ACME `agent-01` NID 证书原语:
21
+
22
+ - `nip.x509` —— `issueLeaf` / `issueRoot` / `verify`(基于 `@peculiar/x509` + 原生 Web Crypto Ed25519)。
23
+ - `nip.acme` —— `AcmeClient` + 进程内 `AcmeServer` + JWS / messages helpers(RFC 8555 + RFC 8037 EdDSA)。
24
+ - `IdentFrame` 扩展非破坏性可选构造参数 `assuranceLevel` / `certFormat` / `certChain`;v1 verifier 忽略新字段。
25
+
20
26
  ## 安装
21
27
 
22
28
  ```bash
package/README.md CHANGED
@@ -7,16 +7,22 @@ Part of the [LabAcacia](https://github.com/LabAcacia) / INNO LOTUS PTY LTD open-
7
7
 
8
8
  ## Status
9
9
 
10
- **v1.0.0-alpha.2Phase 2** · 5 protocols · 264 tests · ≥ 98% coverage
10
+ **v1.0.0-alpha.4RFC-0002 cross-SDK port (third language)** · 5 protocols · 271 tests · ≥ 98% coverage
11
11
 
12
12
  | Protocol | Class | Status |
13
13
  |----------|-------|--------|
14
14
  | NCP — Neural Communication Protocol | Framing, codec | ✅ |
15
15
  | NWP — Neural Web Protocol | `NwpClient` | ✅ |
16
- | NIP — Neural Identity Protocol | `NipIdentity` | ✅ |
16
+ | NIP — Neural Identity Protocol | `NipIdentity`, `NipIdentVerifier` (RFC-0002 §8.1 dual-trust), `AssuranceLevel` (RFC-0003), `nip.x509` + `nip.acme` | ✅ |
17
17
  | NDP — Neural Discovery Protocol | `InMemoryNdpRegistry`, `NdpAnnounceValidator` | ✅ |
18
18
  | NOP — Neural Orchestration Protocol | `NopClient` | ✅ |
19
19
 
20
+ **alpha.4 additions** — Full NPS-RFC-0002 X.509 + ACME `agent-01` NID certificate primitives:
21
+
22
+ - `nip.x509` — `issueLeaf` / `issueRoot` / `verify` (built on `@peculiar/x509` + native Web Crypto Ed25519).
23
+ - `nip.acme` — `AcmeClient` + in-process `AcmeServer` + JWS / message helpers (RFC 8555 + EdDSA per RFC 8037).
24
+ - `IdentFrame` extended with non-breaking `assuranceLevel` / `certFormat` / `certChain` constructor options; v1 verifiers ignore the new fields.
25
+
20
26
  ## Installation
21
27
 
22
28
  ```bash
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
package/dist/index.d.ts CHANGED
File without changes
File without changes
package/dist/index.js CHANGED
File without changes
package/dist/index.js.map CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -8,4 +8,5 @@ export * from "./ncp-error-codes.js";
8
8
  export * from "./ncp-patch-format.js";
9
9
  export * from "./handshake.js";
10
10
  export * from "./stream-manager.js";
11
+ export * from "./preamble.js";
11
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ncp/index.ts"],"names":[],"mappings":"AAEA,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ncp/index.ts"],"names":[],"mappings":"AAEA,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC"}
package/dist/ncp/index.js CHANGED
@@ -10,4 +10,5 @@ export * from "./ncp-error-codes.js";
10
10
  export * from "./ncp-patch-format.js";
11
11
  export * from "./handshake.js";
12
12
  export * from "./stream-manager.js";
13
+ export * from "./preamble.js";
13
14
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ncp/index.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,oDAAoD;AACpD,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ncp/index.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,oDAAoD;AACpD,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC"}
@@ -1,6 +1,7 @@
1
1
  export declare const NCP_ERROR_CODES: {
2
2
  readonly NCP_FRAME_PARSE_ERROR: "NCP-FRAME-PARSE-ERROR";
3
3
  readonly NCP_FRAME_INCOMPLETE: "NCP-FRAME-INCOMPLETE";
4
+ readonly NCP_PREAMBLE_INVALID: "NCP-PREAMBLE-INVALID";
4
5
  readonly NCP_FRAME_UNKNOWN_TYPE: "NCP-FRAME-UNKNOWN-TYPE";
5
6
  readonly NCP_FRAME_PAYLOAD_TOO_LARGE: "NCP-FRAME-PAYLOAD-TOO-LARGE";
6
7
  readonly NCP_FRAME_FLAGS_INVALID: "NCP-FRAME-FLAGS-INVALID";
@@ -1 +1 @@
1
- {"version":3,"file":"ncp-error-codes.d.ts","sourceRoot":"","sources":["../../src/ncp/ncp-error-codes.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;CAqBlB,CAAC;AAEX,MAAM,MAAM,YAAY,GAAG,OAAO,eAAe,CAAC,MAAM,OAAO,eAAe,CAAC,CAAC"}
1
+ {"version":3,"file":"ncp-error-codes.d.ts","sourceRoot":"","sources":["../../src/ncp/ncp-error-codes.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;CAuBlB,CAAC;AAEX,MAAM,MAAM,YAAY,GAAG,OAAO,eAAe,CAAC,MAAM,OAAO,eAAe,CAAC,CAAC"}
@@ -11,6 +11,8 @@ export const NCP_ERROR_CODES = {
11
11
  // Implementation-only codes (not in spec §6 — see test_results.md spec question 2)
12
12
  NCP_FRAME_PARSE_ERROR: "NCP-FRAME-PARSE-ERROR",
13
13
  NCP_FRAME_INCOMPLETE: "NCP-FRAME-INCOMPLETE",
14
+ // NPS-RFC-0001 — native-mode preamble
15
+ NCP_PREAMBLE_INVALID: "NCP-PREAMBLE-INVALID",
14
16
  // Spec-defined codes
15
17
  NCP_FRAME_UNKNOWN_TYPE: "NCP-FRAME-UNKNOWN-TYPE",
16
18
  NCP_FRAME_PAYLOAD_TOO_LARGE: "NCP-FRAME-PAYLOAD-TOO-LARGE",
@@ -1 +1 @@
1
- {"version":3,"file":"ncp-error-codes.js","sourceRoot":"","sources":["../../src/ncp/ncp-error-codes.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,oDAAoD;AACpD,EAAE;AACF,kDAAkD;AAClD,kBAAkB;AAClB,EAAE;AACF,gFAAgF;AAChF,8EAA8E;AAC9E,yDAAyD;AAEzD,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,mFAAmF;IACnF,qBAAqB,EAAE,uBAAuB;IAC9C,oBAAoB,EAAE,sBAAsB;IAC5C,qBAAqB;IACrB,sBAAsB,EAAE,wBAAwB;IAChD,2BAA2B,EAAE,6BAA6B;IAC1D,uBAAuB,EAAE,yBAAyB;IAClD,oBAAoB,EAAE,sBAAsB;IAC5C,yBAAyB,EAAE,2BAA2B;IACtD,sBAAsB,EAAE,wBAAwB;IAChD,gBAAgB,EAAE,kBAAkB;IACpC,kBAAkB,EAAE,oBAAoB;IACxC,oBAAoB,EAAE,sBAAsB;IAC5C,yBAAyB,EAAE,2BAA2B;IACtD,0BAA0B,EAAE,4BAA4B;IACxD,wBAAwB,EAAE,0BAA0B;IACpD,2BAA2B,EAAE,6BAA6B;IAC1D,wBAAwB,EAAE,0BAA0B;IACpD,sBAAsB,EAAE,wBAAwB;IAChD,mBAAmB,EAAE,qBAAqB;CAClC,CAAC"}
1
+ {"version":3,"file":"ncp-error-codes.js","sourceRoot":"","sources":["../../src/ncp/ncp-error-codes.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,oDAAoD;AACpD,EAAE;AACF,kDAAkD;AAClD,kBAAkB;AAClB,EAAE;AACF,gFAAgF;AAChF,8EAA8E;AAC9E,yDAAyD;AAEzD,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,mFAAmF;IACnF,qBAAqB,EAAE,uBAAuB;IAC9C,oBAAoB,EAAE,sBAAsB;IAC5C,sCAAsC;IACtC,oBAAoB,EAAE,sBAAsB;IAC5C,qBAAqB;IACrB,sBAAsB,EAAE,wBAAwB;IAChD,2BAA2B,EAAE,6BAA6B;IAC1D,uBAAuB,EAAE,yBAAyB;IAClD,oBAAoB,EAAE,sBAAsB;IAC5C,yBAAyB,EAAE,2BAA2B;IACtD,sBAAsB,EAAE,wBAAwB;IAChD,gBAAgB,EAAE,kBAAkB;IACpC,kBAAkB,EAAE,oBAAoB;IACxC,oBAAoB,EAAE,sBAAsB;IAC5C,yBAAyB,EAAE,2BAA2B;IACtD,0BAA0B,EAAE,4BAA4B;IACxD,wBAAwB,EAAE,0BAA0B;IACpD,2BAA2B,EAAE,6BAA6B;IAC1D,wBAAwB,EAAE,0BAA0B;IACpD,sBAAsB,EAAE,wBAAwB;IAChD,mBAAmB,EAAE,qBAAqB;CAClC,CAAC"}
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,47 @@
1
+ /**
2
+ * NCP native-mode connection preamble — the 8-byte ASCII constant
3
+ * `"NPS/1.0\n"` that every native-mode client MUST emit immediately
4
+ * after the transport handshake and before its first HelloFrame.
5
+ * Defined by NPS-RFC-0001 and NPS-1 NCP §2.6.1.
6
+ *
7
+ * HTTP-mode connections do not use the preamble.
8
+ */
9
+ export declare const PREAMBLE_LITERAL = "NPS/1.0\n";
10
+ export declare const PREAMBLE_LENGTH = 8;
11
+ export declare const PREAMBLE_BYTES: Uint8Array;
12
+ /** Validation timeout in milliseconds (NPS-RFC-0001 §4.1). */
13
+ export declare const PREAMBLE_READ_TIMEOUT_MS = 10000;
14
+ /** Maximum delay before closing after a mismatch, in milliseconds. */
15
+ export declare const PREAMBLE_CLOSE_DEADLINE_MS = 500;
16
+ export declare const PREAMBLE_ERROR_CODE = "NCP-PREAMBLE-INVALID";
17
+ export declare const PREAMBLE_STATUS_CODE = "NPS-PROTO-PREAMBLE-INVALID";
18
+ export declare class NcpPreambleInvalidError extends Error {
19
+ readonly errorCode = "NCP-PREAMBLE-INVALID";
20
+ readonly statusCode = "NPS-PROTO-PREAMBLE-INVALID";
21
+ constructor(reason: string);
22
+ }
23
+ /**
24
+ * Returns `true` iff `buf` starts with the 8-byte NPS/1.0 preamble.
25
+ * Safe to call with shorter buffers.
26
+ */
27
+ export declare function preambleMatches(buf: Uint8Array): boolean;
28
+ /**
29
+ * Validates a presumed-preamble buffer.
30
+ * Returns `{ valid: true, reason: "" }` on success or `{ valid: false, reason }` on failure.
31
+ */
32
+ export declare function tryValidatePreamble(buf: Uint8Array): {
33
+ valid: boolean;
34
+ reason: string;
35
+ };
36
+ /**
37
+ * Validates a presumed-preamble buffer, throwing {@link NcpPreambleInvalidError} on mismatch.
38
+ */
39
+ export declare function validatePreamble(buf: Uint8Array): void;
40
+ /**
41
+ * Writes the preamble bytes to `writer`.
42
+ * `writer` must expose a `write(buf: Uint8Array): void` method (e.g. Node.js `net.Socket`).
43
+ */
44
+ export declare function writePreamble(writer: {
45
+ write(buf: Uint8Array): void;
46
+ }): void;
47
+ //# sourceMappingURL=preamble.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"preamble.d.ts","sourceRoot":"","sources":["../../src/ncp/preamble.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AAEH,eAAO,MAAM,gBAAgB,cAAc,CAAC;AAC5C,eAAO,MAAM,eAAe,IAAI,CAAC;AACjC,eAAO,MAAM,cAAc,EAAE,UAAuD,CAAC;AACrF,8DAA8D;AAC9D,eAAO,MAAM,wBAAwB,QAAS,CAAC;AAC/C,sEAAsE;AACtE,eAAO,MAAM,0BAA0B,MAAM,CAAC;AAE9C,eAAO,MAAM,mBAAmB,yBAA0B,CAAC;AAC3D,eAAO,MAAM,oBAAoB,+BAA+B,CAAC;AAEjE,qBAAa,uBAAwB,SAAQ,KAAK;IAChD,QAAQ,CAAC,SAAS,0BAAwB;IAC1C,QAAQ,CAAC,UAAU,gCAAwB;gBAE/B,MAAM,EAAE,MAAM;CAI3B;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,UAAU,GAAG,OAAO,CAMxD;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,UAAU,GAAG;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAavF;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,UAAU,GAAG,IAAI,CAGtD;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE;IAAE,KAAK,CAAC,GAAG,EAAE,UAAU,GAAG,IAAI,CAAA;CAAE,GAAG,IAAI,CAE5E"}