@labacacia/nps-sdk 1.0.0-alpha.6 → 1.0.0-alpha.8

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 (369) hide show
  1. package/CHANGELOG.cn.md +126 -0
  2. package/CHANGELOG.md +135 -0
  3. package/README.cn.md +9 -2
  4. package/README.md +9 -2
  5. package/dist/core/anchor-cache.d.ts +42 -0
  6. package/dist/core/anchor-cache.d.ts.map +1 -0
  7. package/dist/core/anchor-cache.js +104 -0
  8. package/dist/core/anchor-cache.js.map +1 -0
  9. package/dist/core/cache.d.ts +14 -0
  10. package/dist/core/cache.d.ts.map +1 -0
  11. package/dist/core/cache.js +80 -0
  12. package/dist/core/cache.js.map +1 -0
  13. package/dist/core/canonical-json.d.ts +12 -0
  14. package/dist/core/canonical-json.d.ts.map +1 -0
  15. package/dist/core/canonical-json.js +44 -0
  16. package/dist/core/canonical-json.js.map +1 -0
  17. package/dist/core/codec.d.ts +32 -0
  18. package/dist/core/codec.d.ts.map +1 -0
  19. package/dist/core/codec.js +119 -0
  20. package/dist/core/codec.js.map +1 -0
  21. package/dist/core/codecs/index.d.ts +4 -0
  22. package/dist/core/codecs/index.d.ts.map +1 -0
  23. package/{src/core/codecs/index.ts → dist/core/codecs/index.js} +1 -0
  24. package/dist/core/codecs/index.js.map +1 -0
  25. package/dist/core/codecs/ncp-codec.d.ts +39 -0
  26. package/dist/core/codecs/ncp-codec.d.ts.map +1 -0
  27. package/dist/core/codecs/ncp-codec.js +93 -0
  28. package/dist/core/codecs/ncp-codec.js.map +1 -0
  29. package/dist/core/codecs/tier1-json-codec.d.ts +10 -0
  30. package/dist/core/codecs/tier1-json-codec.d.ts.map +1 -0
  31. package/{src/core/codecs/tier1-json-codec.ts → dist/core/codecs/tier1-json-codec.js} +11 -16
  32. package/dist/core/codecs/tier1-json-codec.js.map +1 -0
  33. package/dist/core/codecs/tier2-msgpack-codec.d.ts +10 -0
  34. package/dist/core/codecs/tier2-msgpack-codec.d.ts.map +1 -0
  35. package/{src/core/codecs/tier2-msgpack-codec.ts → dist/core/codecs/tier2-msgpack-codec.js} +10 -14
  36. package/dist/core/codecs/tier2-msgpack-codec.js.map +1 -0
  37. package/dist/core/crypto-provider.d.ts +31 -0
  38. package/dist/core/crypto-provider.d.ts.map +1 -0
  39. package/dist/core/crypto-provider.js +10 -0
  40. package/dist/core/crypto-provider.js.map +1 -0
  41. package/dist/core/exceptions.d.ts +27 -0
  42. package/dist/core/exceptions.d.ts.map +1 -0
  43. package/dist/core/exceptions.js +52 -0
  44. package/dist/core/exceptions.js.map +1 -0
  45. package/dist/core/frame-header.d.ts +87 -0
  46. package/dist/core/frame-header.d.ts.map +1 -0
  47. package/dist/core/frame-header.js +185 -0
  48. package/dist/core/frame-header.js.map +1 -0
  49. package/dist/core/frame-registry.d.ts +35 -0
  50. package/dist/core/frame-registry.d.ts.map +1 -0
  51. package/dist/core/frame-registry.js +63 -0
  52. package/dist/core/frame-registry.js.map +1 -0
  53. package/dist/core/frames.d.ts +82 -0
  54. package/dist/core/frames.d.ts.map +1 -0
  55. package/dist/core/frames.js +155 -0
  56. package/dist/core/frames.js.map +1 -0
  57. package/dist/core/index.d.ts +11 -0
  58. package/dist/core/index.d.ts.map +1 -0
  59. package/{src/core/index.ts → dist/core/index.js} +3 -23
  60. package/dist/core/index.js.map +1 -0
  61. package/dist/core/registry.d.ts +11 -0
  62. package/dist/core/registry.d.ts.map +1 -0
  63. package/dist/core/registry.js +17 -0
  64. package/dist/core/registry.js.map +1 -0
  65. package/dist/core/status-codes.d.ts +29 -0
  66. package/dist/core/status-codes.d.ts.map +1 -0
  67. package/dist/core/status-codes.js +39 -0
  68. package/dist/core/status-codes.js.map +1 -0
  69. package/dist/index.d.ts +2 -0
  70. package/dist/index.d.ts.map +1 -0
  71. package/{src/index.ts → dist/index.js} +1 -1
  72. package/dist/index.js.map +1 -0
  73. package/dist/ncp/frames/anchor-frame.d.ts +29 -0
  74. package/dist/ncp/frames/anchor-frame.d.ts.map +1 -0
  75. package/dist/ncp/frames/anchor-frame.js +54 -0
  76. package/dist/ncp/frames/anchor-frame.js.map +1 -0
  77. package/dist/ncp/frames/caps-frame.d.ts +29 -0
  78. package/dist/ncp/frames/caps-frame.d.ts.map +1 -0
  79. package/dist/ncp/frames/caps-frame.js +29 -0
  80. package/dist/ncp/frames/caps-frame.js.map +1 -0
  81. package/dist/ncp/frames/diff-frame.d.ts +32 -0
  82. package/dist/ncp/frames/diff-frame.d.ts.map +1 -0
  83. package/dist/ncp/frames/diff-frame.js +37 -0
  84. package/dist/ncp/frames/diff-frame.js.map +1 -0
  85. package/dist/ncp/frames/error-frame.d.ts +16 -0
  86. package/dist/ncp/frames/error-frame.d.ts.map +1 -0
  87. package/dist/ncp/frames/error-frame.js +13 -0
  88. package/dist/ncp/frames/error-frame.js.map +1 -0
  89. package/dist/ncp/frames/hello-frame.d.ts +21 -0
  90. package/dist/ncp/frames/hello-frame.d.ts.map +1 -0
  91. package/dist/ncp/frames/hello-frame.js +25 -0
  92. package/dist/ncp/frames/hello-frame.js.map +1 -0
  93. package/dist/ncp/frames/stream-frame.d.ts +16 -0
  94. package/dist/ncp/frames/stream-frame.d.ts.map +1 -0
  95. package/dist/ncp/frames/stream-frame.js +18 -0
  96. package/dist/ncp/frames/stream-frame.js.map +1 -0
  97. package/dist/ncp/frames.d.ts +94 -0
  98. package/dist/ncp/frames.d.ts.map +1 -0
  99. package/dist/ncp/frames.js +192 -0
  100. package/dist/ncp/frames.js.map +1 -0
  101. package/dist/ncp/handshake.d.ts +30 -0
  102. package/dist/ncp/handshake.d.ts.map +1 -0
  103. package/dist/ncp/handshake.js +80 -0
  104. package/dist/ncp/handshake.js.map +1 -0
  105. package/dist/ncp/index.d.ts +12 -0
  106. package/dist/ncp/index.d.ts.map +1 -0
  107. package/{src/ncp/index.ts → dist/ncp/index.js} +1 -0
  108. package/dist/ncp/index.js.map +1 -0
  109. package/dist/ncp/ncp-error-codes.d.ts +23 -0
  110. package/dist/ncp/ncp-error-codes.d.ts.map +1 -0
  111. package/dist/ncp/ncp-error-codes.js +34 -0
  112. package/dist/ncp/ncp-error-codes.js.map +1 -0
  113. package/dist/ncp/ncp-patch-format.d.ts +7 -0
  114. package/dist/ncp/ncp-patch-format.d.ts.map +1 -0
  115. package/dist/ncp/ncp-patch-format.js +13 -0
  116. package/dist/ncp/ncp-patch-format.js.map +1 -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 +3 -0
  122. package/dist/ncp/registry.d.ts.map +1 -0
  123. package/dist/ncp/registry.js +13 -0
  124. package/dist/ncp/registry.js.map +1 -0
  125. package/dist/ncp/stream-manager.d.ts +57 -0
  126. package/dist/ncp/stream-manager.d.ts.map +1 -0
  127. package/dist/ncp/stream-manager.js +163 -0
  128. package/dist/ncp/stream-manager.js.map +1 -0
  129. package/dist/ndp/dns-txt.d.ts +35 -0
  130. package/dist/ndp/dns-txt.d.ts.map +1 -0
  131. package/dist/ndp/dns-txt.js +67 -0
  132. package/dist/ndp/dns-txt.js.map +1 -0
  133. package/dist/ndp/frames.d.ts +56 -0
  134. package/dist/ndp/frames.d.ts.map +1 -0
  135. package/dist/ndp/frames.js +87 -0
  136. package/dist/ndp/frames.js.map +1 -0
  137. package/dist/ndp/index.d.ts +6 -0
  138. package/dist/ndp/index.d.ts.map +1 -0
  139. package/{src/ndp/index.ts → dist/ndp/index.js} +1 -1
  140. package/dist/ndp/index.js.map +1 -0
  141. package/dist/ndp/ndp-registry.d.ts +13 -0
  142. package/dist/ndp/ndp-registry.d.ts.map +1 -0
  143. package/dist/ndp/ndp-registry.js +104 -0
  144. package/dist/ndp/ndp-registry.js.map +1 -0
  145. package/dist/ndp/registry.d.ts +3 -0
  146. package/dist/ndp/registry.d.ts.map +1 -0
  147. package/dist/ndp/registry.js +10 -0
  148. package/dist/ndp/registry.js.map +1 -0
  149. package/dist/ndp/validator.d.ts +18 -0
  150. package/dist/ndp/validator.d.ts.map +1 -0
  151. package/dist/ndp/validator.js +48 -0
  152. package/dist/ndp/validator.js.map +1 -0
  153. package/dist/nip/acme/client.d.ts +31 -0
  154. package/dist/nip/acme/client.d.ts.map +1 -0
  155. package/dist/nip/acme/client.js +136 -0
  156. package/dist/nip/acme/client.js.map +1 -0
  157. package/dist/nip/acme/index.d.ts +6 -0
  158. package/dist/nip/acme/index.d.ts.map +1 -0
  159. package/{src/nip/acme/index.ts → dist/nip/acme/index.js} +1 -1
  160. package/dist/nip/acme/index.js.map +1 -0
  161. package/dist/nip/acme/jws.d.ts +31 -0
  162. package/dist/nip/acme/jws.d.ts.map +1 -0
  163. package/dist/nip/acme/jws.js +76 -0
  164. package/dist/nip/acme/jws.js.map +1 -0
  165. package/dist/nip/acme/messages.d.ts +71 -0
  166. package/dist/nip/acme/messages.d.ts.map +1 -0
  167. package/dist/nip/acme/messages.js +4 -0
  168. package/dist/nip/acme/messages.js.map +1 -0
  169. package/dist/nip/acme/server.d.ts +41 -0
  170. package/dist/nip/acme/server.d.ts.map +1 -0
  171. package/dist/nip/acme/server.js +458 -0
  172. package/dist/nip/acme/server.js.map +1 -0
  173. package/dist/nip/acme/wire.d.ts +19 -0
  174. package/dist/nip/acme/wire.d.ts.map +1 -0
  175. package/dist/nip/acme/wire.js +21 -0
  176. package/dist/nip/acme/wire.js.map +1 -0
  177. package/dist/nip/assurance-level.d.ts +19 -0
  178. package/dist/nip/assurance-level.d.ts.map +1 -0
  179. package/dist/nip/assurance-level.js +38 -0
  180. package/dist/nip/assurance-level.js.map +1 -0
  181. package/dist/nip/cert-format.d.ts +5 -0
  182. package/dist/nip/cert-format.d.ts.map +1 -0
  183. package/dist/nip/cert-format.js +6 -0
  184. package/dist/nip/cert-format.js.map +1 -0
  185. package/dist/nip/error-codes.d.ts +25 -0
  186. package/dist/nip/error-codes.d.ts.map +1 -0
  187. package/{src/nip/error-codes.ts → dist/nip/error-codes.js} +19 -25
  188. package/dist/nip/error-codes.js.map +1 -0
  189. package/dist/nip/frames.d.ts +53 -0
  190. package/dist/nip/frames.d.ts.map +1 -0
  191. package/dist/nip/frames.js +106 -0
  192. package/dist/nip/frames.js.map +1 -0
  193. package/dist/nip/identity.d.ts +18 -0
  194. package/dist/nip/identity.d.ts.map +1 -0
  195. package/dist/nip/identity.js +94 -0
  196. package/dist/nip/identity.js.map +1 -0
  197. package/dist/nip/index.d.ts +11 -0
  198. package/dist/nip/index.d.ts.map +1 -0
  199. package/{src/nip/index.ts → dist/nip/index.js} +3 -2
  200. package/dist/nip/index.js.map +1 -0
  201. package/dist/nip/registry.d.ts +3 -0
  202. package/dist/nip/registry.d.ts.map +1 -0
  203. package/dist/nip/registry.js +10 -0
  204. package/dist/nip/registry.js.map +1 -0
  205. package/dist/nip/reputation-client.d.ts +116 -0
  206. package/dist/nip/reputation-client.d.ts.map +1 -0
  207. package/dist/nip/reputation-client.js +261 -0
  208. package/dist/nip/reputation-client.js.map +1 -0
  209. package/dist/nip/verifier.d.ts +23 -0
  210. package/dist/nip/verifier.d.ts.map +1 -0
  211. package/dist/nip/verifier.js +90 -0
  212. package/dist/nip/verifier.js.map +1 -0
  213. package/dist/nip/x509/builder.d.ts +35 -0
  214. package/dist/nip/x509/builder.d.ts.map +1 -0
  215. package/dist/nip/x509/builder.js +59 -0
  216. package/dist/nip/x509/builder.js.map +1 -0
  217. package/dist/nip/x509/index.d.ts +4 -0
  218. package/dist/nip/x509/index.d.ts.map +1 -0
  219. package/{src/nip/x509/index.ts → dist/nip/x509/index.js} +1 -1
  220. package/dist/nip/x509/index.js.map +1 -0
  221. package/dist/nip/x509/oids.d.ts +16 -0
  222. package/dist/nip/x509/oids.d.ts.map +1 -0
  223. package/{src/nip/x509/oids.ts → dist/nip/x509/oids.js} +5 -10
  224. package/dist/nip/x509/oids.js.map +1 -0
  225. package/dist/nip/x509/verifier.d.ts +26 -0
  226. package/dist/nip/x509/verifier.d.ts.map +1 -0
  227. package/dist/nip/x509/verifier.js +171 -0
  228. package/dist/nip/x509/verifier.js.map +1 -0
  229. package/dist/nop/client.d.ts +34 -0
  230. package/dist/nop/client.d.ts.map +1 -0
  231. package/dist/nop/client.js +90 -0
  232. package/dist/nop/client.js.map +1 -0
  233. package/dist/nop/frames.d.ts +65 -0
  234. package/dist/nop/frames.d.ts.map +1 -0
  235. package/dist/nop/frames.js +148 -0
  236. package/dist/nop/frames.js.map +1 -0
  237. package/dist/nop/index.d.ts +5 -0
  238. package/dist/nop/index.d.ts.map +1 -0
  239. package/{src/nop/index.ts → dist/nop/index.js} +1 -1
  240. package/dist/nop/index.js.map +1 -0
  241. package/dist/nop/models.d.ts +58 -0
  242. package/dist/nop/models.d.ts.map +1 -0
  243. package/dist/nop/models.js +50 -0
  244. package/dist/nop/models.js.map +1 -0
  245. package/dist/nop/nop-types.d.ts +136 -0
  246. package/dist/nop/nop-types.d.ts.map +1 -0
  247. package/dist/nop/nop-types.js +44 -0
  248. package/dist/nop/nop-types.js.map +1 -0
  249. package/dist/nop/registry.d.ts +3 -0
  250. package/dist/nop/registry.d.ts.map +1 -0
  251. package/dist/nop/registry.js +11 -0
  252. package/dist/nop/registry.js.map +1 -0
  253. package/dist/nwp/anchor-client.d.ts +109 -0
  254. package/dist/nwp/anchor-client.d.ts.map +1 -0
  255. package/dist/nwp/anchor-client.js +279 -0
  256. package/dist/nwp/anchor-client.js.map +1 -0
  257. package/dist/nwp/client.d.ts +28 -0
  258. package/dist/nwp/client.d.ts.map +1 -0
  259. package/dist/nwp/client.js +142 -0
  260. package/dist/nwp/client.js.map +1 -0
  261. package/dist/nwp/frames.d.ts +107 -0
  262. package/dist/nwp/frames.d.ts.map +1 -0
  263. package/dist/nwp/frames.js +198 -0
  264. package/dist/nwp/frames.js.map +1 -0
  265. package/dist/nwp/index.d.ts +6 -0
  266. package/dist/nwp/index.d.ts.map +1 -0
  267. package/{src/nwp/index.ts → dist/nwp/index.js} +3 -1
  268. package/dist/nwp/index.js.map +1 -0
  269. package/dist/nwp/manifest.d.ts +69 -0
  270. package/dist/nwp/manifest.d.ts.map +1 -0
  271. package/dist/nwp/manifest.js +4 -0
  272. package/dist/nwp/manifest.js.map +1 -0
  273. package/dist/nwp/registry.d.ts +3 -0
  274. package/dist/nwp/registry.d.ts.map +1 -0
  275. package/dist/nwp/registry.js +10 -0
  276. package/dist/nwp/registry.js.map +1 -0
  277. package/dist/setup.d.ts +10 -0
  278. package/dist/setup.d.ts.map +1 -0
  279. package/{src/setup.ts → dist/setup.js} +13 -16
  280. package/dist/setup.js.map +1 -0
  281. package/package.json +12 -1
  282. package/CONTRIBUTING.cn.md +0 -35
  283. package/CONTRIBUTING.md +0 -35
  284. package/nip-ca-server/Dockerfile +0 -27
  285. package/nip-ca-server/README.md +0 -45
  286. package/nip-ca-server/db/001_init.sql +0 -25
  287. package/nip-ca-server/docker-compose.yml +0 -29
  288. package/nip-ca-server/package.json +0 -23
  289. package/nip-ca-server/src/ca.ts +0 -155
  290. package/nip-ca-server/src/db.ts +0 -104
  291. package/nip-ca-server/src/index.ts +0 -157
  292. package/nip-ca-server/tsconfig.json +0 -13
  293. package/src/core/anchor-cache.ts +0 -129
  294. package/src/core/cache.ts +0 -93
  295. package/src/core/canonical-json.ts +0 -50
  296. package/src/core/codec.ts +0 -158
  297. package/src/core/codecs/ncp-codec.ts +0 -170
  298. package/src/core/crypto-provider.ts +0 -47
  299. package/src/core/exceptions.ts +0 -57
  300. package/src/core/frame-header.ts +0 -282
  301. package/src/core/frame-registry.ts +0 -91
  302. package/src/core/frames.ts +0 -184
  303. package/src/core/registry.ts +0 -28
  304. package/src/core/status-codes.ts +0 -47
  305. package/src/ncp/frames/anchor-frame.ts +0 -87
  306. package/src/ncp/frames/caps-frame.ts +0 -59
  307. package/src/ncp/frames/diff-frame.ts +0 -69
  308. package/src/ncp/frames/error-frame.ts +0 -26
  309. package/src/ncp/frames/hello-frame.ts +0 -50
  310. package/src/ncp/frames/stream-frame.ts +0 -35
  311. package/src/ncp/frames.ts +0 -251
  312. package/src/ncp/handshake.ts +0 -95
  313. package/src/ncp/ncp-error-codes.ts +0 -36
  314. package/src/ncp/ncp-patch-format.ts +0 -16
  315. package/src/ncp/preamble.ts +0 -79
  316. package/src/ncp/registry.ts +0 -15
  317. package/src/ncp/stream-manager.ts +0 -212
  318. package/src/ndp/dns-txt.ts +0 -86
  319. package/src/ndp/frames.ts +0 -124
  320. package/src/ndp/ndp-registry.ts +0 -116
  321. package/src/ndp/registry.ts +0 -12
  322. package/src/ndp/validator.ts +0 -64
  323. package/src/nip/acme/client.ts +0 -185
  324. package/src/nip/acme/jws.ts +0 -109
  325. package/src/nip/acme/messages.ts +0 -85
  326. package/src/nip/acme/server.ts +0 -480
  327. package/src/nip/acme/wire.ts +0 -24
  328. package/src/nip/assurance-level.ts +0 -40
  329. package/src/nip/cert-format.ts +0 -9
  330. package/src/nip/frames.ts +0 -138
  331. package/src/nip/identity.ts +0 -113
  332. package/src/nip/registry.ts +0 -12
  333. package/src/nip/verifier.ts +0 -122
  334. package/src/nip/x509/builder.ts +0 -91
  335. package/src/nip/x509/verifier.ts +0 -214
  336. package/src/nop/client.ts +0 -103
  337. package/src/nop/frames.ts +0 -181
  338. package/src/nop/models.ts +0 -79
  339. package/src/nop/nop-types.ts +0 -208
  340. package/src/nop/registry.ts +0 -13
  341. package/src/nwp/client.ts +0 -114
  342. package/src/nwp/frames.ts +0 -116
  343. package/src/nwp/registry.ts +0 -11
  344. package/tests/_rfc0002-keys.ts +0 -57
  345. package/tests/core/anchor-cache.test.ts +0 -242
  346. package/tests/core/codec.test.ts +0 -205
  347. package/tests/core/frame-registry.test.ts +0 -46
  348. package/tests/core.test.ts +0 -327
  349. package/tests/ncp/diff-binary-bitset.test.ts +0 -107
  350. package/tests/ncp/e2e-enc-reject.test.ts +0 -93
  351. package/tests/ncp/err-error-frame.test.ts +0 -152
  352. package/tests/ncp/frames.test.ts +0 -359
  353. package/tests/ncp/framing.test.ts +0 -233
  354. package/tests/ncp/hello-frame.test.ts +0 -122
  355. package/tests/ncp/inline-anchor.test.ts +0 -88
  356. package/tests/ncp/preamble.test.ts +0 -93
  357. package/tests/ncp/security.test.ts +0 -184
  358. package/tests/ncp/stream-window.test.ts +0 -167
  359. package/tests/ncp/stream.test.ts +0 -242
  360. package/tests/ncp/version-negotiation.test.ts +0 -123
  361. package/tests/ndp.test.ts +0 -377
  362. package/tests/nip-acme-agent01.test.ts +0 -192
  363. package/tests/nip-x509.test.ts +0 -280
  364. package/tests/nip.test.ts +0 -184
  365. package/tests/nop.test.ts +0 -344
  366. package/tests/nwp.test.ts +0 -237
  367. package/tsconfig.json +0 -20
  368. package/tsup.config.ts +0 -20
  369. package/vitest.config.ts +0 -10
@@ -0,0 +1,5 @@
1
+ /** Wire-form constants for `IdentFrame.cert_format` (NPS-RFC-0002 §4.5). */
2
+ export declare const V1_PROPRIETARY: "v1-proprietary";
3
+ export declare const V2_X509: "v2-x509";
4
+ export type CertFormat = typeof V1_PROPRIETARY | typeof V2_X509;
5
+ //# sourceMappingURL=cert-format.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cert-format.d.ts","sourceRoot":"","sources":["../../src/nip/cert-format.ts"],"names":[],"mappings":"AAGA,4EAA4E;AAE5E,eAAO,MAAM,cAAc,EAAG,gBAAyB,CAAC;AACxD,eAAO,MAAM,OAAO,EAAU,SAAyB,CAAC;AAExD,MAAM,MAAM,UAAU,GAAG,OAAO,cAAc,GAAG,OAAO,OAAO,CAAC"}
@@ -0,0 +1,6 @@
1
+ // Copyright 2026 INNO LOTUS PTY LTD
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ /** Wire-form constants for `IdentFrame.cert_format` (NPS-RFC-0002 §4.5). */
4
+ export const V1_PROPRIETARY = "v1-proprietary";
5
+ export const V2_X509 = "v2-x509";
6
+ //# sourceMappingURL=cert-format.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cert-format.js","sourceRoot":"","sources":["../../src/nip/cert-format.ts"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,sCAAsC;AAEtC,4EAA4E;AAE5E,MAAM,CAAC,MAAM,cAAc,GAAG,gBAAyB,CAAC;AACxD,MAAM,CAAC,MAAM,OAAO,GAAU,SAAyB,CAAC"}
@@ -0,0 +1,25 @@
1
+ /** NIP error code wire constants — mirror of `spec/error-codes.md` NIP section. */
2
+ export declare const CERT_EXPIRED = "NIP-CERT-EXPIRED";
3
+ export declare const CERT_REVOKED = "NIP-CERT-REVOKED";
4
+ export declare const CERT_SIGNATURE_INVALID = "NIP-CERT-SIGNATURE-INVALID";
5
+ export declare const CERT_UNTRUSTED_ISSUER = "NIP-CERT-UNTRUSTED-ISSUER";
6
+ export declare const CERT_CAPABILITY_MISSING = "NIP-CERT-CAPABILITY-MISSING";
7
+ export declare const CERT_SCOPE_VIOLATION = "NIP-CERT-SCOPE-VIOLATION";
8
+ export declare const CA_NID_NOT_FOUND = "NIP-CA-NID-NOT-FOUND";
9
+ export declare const CA_NID_ALREADY_EXISTS = "NIP-CA-NID-ALREADY-EXISTS";
10
+ export declare const CA_SERIAL_DUPLICATE = "NIP-CA-SERIAL-DUPLICATE";
11
+ export declare const CA_RENEWAL_TOO_EARLY = "NIP-CA-RENEWAL-TOO-EARLY";
12
+ export declare const CA_SCOPE_EXPANSION_DENIED = "NIP-CA-SCOPE-EXPANSION-DENIED";
13
+ export declare const OCSP_UNAVAILABLE = "NIP-OCSP-UNAVAILABLE";
14
+ export declare const TRUST_FRAME_INVALID = "NIP-TRUST-FRAME-INVALID";
15
+ export declare const ASSURANCE_MISMATCH = "NIP-ASSURANCE-MISMATCH";
16
+ export declare const ASSURANCE_UNKNOWN = "NIP-ASSURANCE-UNKNOWN";
17
+ export declare const REPUTATION_ENTRY_INVALID = "NIP-REPUTATION-ENTRY-INVALID";
18
+ export declare const REPUTATION_LOG_UNREACHABLE = "NIP-REPUTATION-LOG-UNREACHABLE";
19
+ export declare const REPUTATION_GOSSIP_FORK = "NIP-REPUTATION-GOSSIP-FORK";
20
+ export declare const REPUTATION_GOSSIP_SIG_INVALID = "NIP-REPUTATION-GOSSIP-SIG-INVALID";
21
+ export declare const CERT_FORMAT_INVALID = "NIP-CERT-FORMAT-INVALID";
22
+ export declare const CERT_EKU_MISSING = "NIP-CERT-EKU-MISSING";
23
+ export declare const CERT_SUBJECT_NID_MISMATCH = "NIP-CERT-SUBJECT-NID-MISMATCH";
24
+ export declare const ACME_CHALLENGE_FAILED = "NIP-ACME-CHALLENGE-FAILED";
25
+ //# sourceMappingURL=error-codes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-codes.d.ts","sourceRoot":"","sources":["../../src/nip/error-codes.ts"],"names":[],"mappings":"AAGA,mFAAmF;AAGnF,eAAO,MAAM,YAAY,qBAAgC,CAAC;AAC1D,eAAO,MAAM,YAAY,qBAAgC,CAAC;AAC1D,eAAO,MAAM,sBAAsB,+BAAgC,CAAC;AACpE,eAAO,MAAM,qBAAqB,8BAAgC,CAAC;AACnE,eAAO,MAAM,uBAAuB,gCAAgC,CAAC;AACrE,eAAO,MAAM,oBAAoB,6BAAgC,CAAC;AAGlE,eAAO,MAAM,gBAAgB,yBAAkC,CAAC;AAChE,eAAO,MAAM,qBAAqB,8BAAkC,CAAC;AACrE,eAAO,MAAM,mBAAmB,4BAAkC,CAAC;AACnE,eAAO,MAAM,oBAAoB,6BAAkC,CAAC;AACpE,eAAO,MAAM,yBAAyB,kCAAkC,CAAC;AAEzE,eAAO,MAAM,gBAAgB,yBAA6B,CAAC;AAC3D,eAAO,MAAM,mBAAmB,4BAA6B,CAAC;AAG9D,eAAO,MAAM,kBAAkB,2BAA2B,CAAC;AAC3D,eAAO,MAAM,iBAAiB,0BAA2B,CAAC;AAG1D,eAAO,MAAM,wBAAwB,iCAAsC,CAAC;AAC5E,eAAO,MAAM,0BAA0B,mCAAsC,CAAC;AAC9E,eAAO,MAAM,sBAAsB,+BAAsC,CAAC;AAC1E,eAAO,MAAM,6BAA6B,sCAAsC,CAAC;AAGjF,eAAO,MAAM,mBAAmB,4BAAkC,CAAC;AACnE,eAAO,MAAM,gBAAgB,yBAAkC,CAAC;AAChE,eAAO,MAAM,yBAAyB,kCAAkC,CAAC;AACzE,eAAO,MAAM,qBAAqB,8BAAkC,CAAC"}
@@ -1,38 +1,32 @@
1
1
  // Copyright 2026 INNO LOTUS PTY LTD
2
2
  // SPDX-License-Identifier: Apache-2.0
3
-
4
3
  /** NIP error code wire constants — mirror of `spec/error-codes.md` NIP section. */
5
-
6
4
  // ── Cert verification (v1 + v2) ──────────────────────────────────────────────
7
- export const CERT_EXPIRED = "NIP-CERT-EXPIRED";
8
- export const CERT_REVOKED = "NIP-CERT-REVOKED";
9
- export const CERT_SIGNATURE_INVALID = "NIP-CERT-SIGNATURE-INVALID";
10
- export const CERT_UNTRUSTED_ISSUER = "NIP-CERT-UNTRUSTED-ISSUER";
5
+ export const CERT_EXPIRED = "NIP-CERT-EXPIRED";
6
+ export const CERT_REVOKED = "NIP-CERT-REVOKED";
7
+ export const CERT_SIGNATURE_INVALID = "NIP-CERT-SIGNATURE-INVALID";
8
+ export const CERT_UNTRUSTED_ISSUER = "NIP-CERT-UNTRUSTED-ISSUER";
11
9
  export const CERT_CAPABILITY_MISSING = "NIP-CERT-CAPABILITY-MISSING";
12
- export const CERT_SCOPE_VIOLATION = "NIP-CERT-SCOPE-VIOLATION";
13
-
10
+ export const CERT_SCOPE_VIOLATION = "NIP-CERT-SCOPE-VIOLATION";
14
11
  // ── CA service ───────────────────────────────────────────────────────────────
15
- export const CA_NID_NOT_FOUND = "NIP-CA-NID-NOT-FOUND";
16
- export const CA_NID_ALREADY_EXISTS = "NIP-CA-NID-ALREADY-EXISTS";
17
- export const CA_SERIAL_DUPLICATE = "NIP-CA-SERIAL-DUPLICATE";
18
- export const CA_RENEWAL_TOO_EARLY = "NIP-CA-RENEWAL-TOO-EARLY";
12
+ export const CA_NID_NOT_FOUND = "NIP-CA-NID-NOT-FOUND";
13
+ export const CA_NID_ALREADY_EXISTS = "NIP-CA-NID-ALREADY-EXISTS";
14
+ export const CA_SERIAL_DUPLICATE = "NIP-CA-SERIAL-DUPLICATE";
15
+ export const CA_RENEWAL_TOO_EARLY = "NIP-CA-RENEWAL-TOO-EARLY";
19
16
  export const CA_SCOPE_EXPANSION_DENIED = "NIP-CA-SCOPE-EXPANSION-DENIED";
20
-
21
- export const OCSP_UNAVAILABLE = "NIP-OCSP-UNAVAILABLE";
22
- export const TRUST_FRAME_INVALID = "NIP-TRUST-FRAME-INVALID";
23
-
17
+ export const OCSP_UNAVAILABLE = "NIP-OCSP-UNAVAILABLE";
18
+ export const TRUST_FRAME_INVALID = "NIP-TRUST-FRAME-INVALID";
24
19
  // ── RFC-0003 (assurance level) ───────────────────────────────────────────────
25
20
  export const ASSURANCE_MISMATCH = "NIP-ASSURANCE-MISMATCH";
26
- export const ASSURANCE_UNKNOWN = "NIP-ASSURANCE-UNKNOWN";
27
-
21
+ export const ASSURANCE_UNKNOWN = "NIP-ASSURANCE-UNKNOWN";
28
22
  // ── RFC-0004 (reputation log) ────────────────────────────────────────────────
29
- export const REPUTATION_ENTRY_INVALID = "NIP-REPUTATION-ENTRY-INVALID";
30
- export const REPUTATION_LOG_UNREACHABLE = "NIP-REPUTATION-LOG-UNREACHABLE";
31
- export const REPUTATION_GOSSIP_FORK = "NIP-REPUTATION-GOSSIP-FORK";
23
+ export const REPUTATION_ENTRY_INVALID = "NIP-REPUTATION-ENTRY-INVALID";
24
+ export const REPUTATION_LOG_UNREACHABLE = "NIP-REPUTATION-LOG-UNREACHABLE";
25
+ export const REPUTATION_GOSSIP_FORK = "NIP-REPUTATION-GOSSIP-FORK";
32
26
  export const REPUTATION_GOSSIP_SIG_INVALID = "NIP-REPUTATION-GOSSIP-SIG-INVALID";
33
-
34
27
  // ── RFC-0002 (X.509 + ACME) ──────────────────────────────────────────────────
35
- export const CERT_FORMAT_INVALID = "NIP-CERT-FORMAT-INVALID";
36
- export const CERT_EKU_MISSING = "NIP-CERT-EKU-MISSING";
28
+ export const CERT_FORMAT_INVALID = "NIP-CERT-FORMAT-INVALID";
29
+ export const CERT_EKU_MISSING = "NIP-CERT-EKU-MISSING";
37
30
  export const CERT_SUBJECT_NID_MISMATCH = "NIP-CERT-SUBJECT-NID-MISMATCH";
38
- export const ACME_CHALLENGE_FAILED = "NIP-ACME-CHALLENGE-FAILED";
31
+ export const ACME_CHALLENGE_FAILED = "NIP-ACME-CHALLENGE-FAILED";
32
+ //# sourceMappingURL=error-codes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-codes.js","sourceRoot":"","sources":["../../src/nip/error-codes.ts"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,sCAAsC;AAEtC,mFAAmF;AAEnF,gFAAgF;AAChF,MAAM,CAAC,MAAM,YAAY,GAAc,kBAAkB,CAAC;AAC1D,MAAM,CAAC,MAAM,YAAY,GAAc,kBAAkB,CAAC;AAC1D,MAAM,CAAC,MAAM,sBAAsB,GAAI,4BAA4B,CAAC;AACpE,MAAM,CAAC,MAAM,qBAAqB,GAAK,2BAA2B,CAAC;AACnE,MAAM,CAAC,MAAM,uBAAuB,GAAG,6BAA6B,CAAC;AACrE,MAAM,CAAC,MAAM,oBAAoB,GAAM,0BAA0B,CAAC;AAElE,gFAAgF;AAChF,MAAM,CAAC,MAAM,gBAAgB,GAAY,sBAAsB,CAAC;AAChE,MAAM,CAAC,MAAM,qBAAqB,GAAO,2BAA2B,CAAC;AACrE,MAAM,CAAC,MAAM,mBAAmB,GAAS,yBAAyB,CAAC;AACnE,MAAM,CAAC,MAAM,oBAAoB,GAAQ,0BAA0B,CAAC;AACpE,MAAM,CAAC,MAAM,yBAAyB,GAAG,+BAA+B,CAAC;AAEzE,MAAM,CAAC,MAAM,gBAAgB,GAAO,sBAAsB,CAAC;AAC3D,MAAM,CAAC,MAAM,mBAAmB,GAAI,yBAAyB,CAAC;AAE9D,gFAAgF;AAChF,MAAM,CAAC,MAAM,kBAAkB,GAAG,wBAAwB,CAAC;AAC3D,MAAM,CAAC,MAAM,iBAAiB,GAAI,uBAAuB,CAAC;AAE1D,gFAAgF;AAChF,MAAM,CAAC,MAAM,wBAAwB,GAAQ,8BAA8B,CAAC;AAC5E,MAAM,CAAC,MAAM,0BAA0B,GAAM,gCAAgC,CAAC;AAC9E,MAAM,CAAC,MAAM,sBAAsB,GAAU,4BAA4B,CAAC;AAC1E,MAAM,CAAC,MAAM,6BAA6B,GAAG,mCAAmC,CAAC;AAEjF,gFAAgF;AAChF,MAAM,CAAC,MAAM,mBAAmB,GAAS,yBAAyB,CAAC;AACnE,MAAM,CAAC,MAAM,gBAAgB,GAAY,sBAAsB,CAAC;AAChE,MAAM,CAAC,MAAM,yBAAyB,GAAG,+BAA+B,CAAC;AACzE,MAAM,CAAC,MAAM,qBAAqB,GAAO,2BAA2B,CAAC"}
@@ -0,0 +1,53 @@
1
+ import { EncodingTier, FrameType } from "../core/frames.js";
2
+ import type { NpsFrame } from "../core/codec.js";
3
+ import { AssuranceLevel } from "./assurance-level.js";
4
+ export interface IdentMetadata {
5
+ issuer: string;
6
+ issuedAt: string;
7
+ expiresAt?: string;
8
+ capabilities?: readonly string[];
9
+ scopes?: readonly string[];
10
+ }
11
+ export interface IdentFrameOptions {
12
+ assuranceLevel?: AssuranceLevel | null;
13
+ certFormat?: string | null;
14
+ certChain?: readonly string[] | null;
15
+ }
16
+ export declare class IdentFrame implements NpsFrame {
17
+ readonly nid: string;
18
+ readonly pubKey: string;
19
+ readonly metadata: IdentMetadata;
20
+ readonly signature: string;
21
+ readonly frameType = FrameType.IDENT;
22
+ readonly preferredTier = EncodingTier.MSGPACK;
23
+ readonly assuranceLevel: AssuranceLevel | null;
24
+ readonly certFormat: string | null;
25
+ readonly certChain: readonly string[] | null;
26
+ constructor(nid: string, pubKey: string, metadata: IdentMetadata, signature: string, options?: IdentFrameOptions);
27
+ unsignedDict(): Record<string, unknown>;
28
+ toDict(): Record<string, unknown>;
29
+ static fromDict(data: Record<string, unknown>): IdentFrame;
30
+ }
31
+ export declare class TrustFrame implements NpsFrame {
32
+ readonly issuerNid: string;
33
+ readonly subjectNid: string;
34
+ readonly scopes: readonly string[];
35
+ readonly expiresAt: string;
36
+ readonly signature: string;
37
+ readonly frameType = FrameType.TRUST;
38
+ readonly preferredTier = EncodingTier.MSGPACK;
39
+ constructor(issuerNid: string, subjectNid: string, scopes: readonly string[], expiresAt: string, signature: string);
40
+ toDict(): Record<string, unknown>;
41
+ static fromDict(data: Record<string, unknown>): TrustFrame;
42
+ }
43
+ export declare class RevokeFrame implements NpsFrame {
44
+ readonly nid: string;
45
+ readonly reason?: string | undefined;
46
+ readonly revokedAt?: string | undefined;
47
+ readonly frameType = FrameType.REVOKE;
48
+ readonly preferredTier = EncodingTier.MSGPACK;
49
+ constructor(nid: string, reason?: string | undefined, revokedAt?: string | undefined);
50
+ toDict(): Record<string, unknown>;
51
+ static fromDict(data: Record<string, unknown>): RevokeFrame;
52
+ }
53
+ //# sourceMappingURL=frames.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"frames.d.ts","sourceRoot":"","sources":["../../src/nip/frames.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAQ,MAAM,CAAC;IACrB,QAAQ,EAAM,MAAM,CAAC;IACrB,SAAS,CAAC,EAAI,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,MAAM,CAAC,EAAQ,SAAS,MAAM,EAAE,CAAC;CAClC;AAED,MAAM,WAAW,iBAAiB;IAChC,cAAc,CAAC,EAAE,cAAc,GAAG,IAAI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MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAUjC,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,UAAU;CAS3D;AAED,qBAAa,WAAY,YAAW,QAAQ;aAKxB,GAAG,EAAQ,MAAM;aACjB,MAAM,CAAC,EAAI,MAAM;aACjB,SAAS,CAAC,EAAE,MAAM;IANpC,QAAQ,CAAC,SAAS,oBAAwB;IAC1C,QAAQ,CAAC,aAAa,wBAAwB;gBAG5B,GAAG,EAAQ,MAAM,EACjB,MAAM,CAAC,EAAI,MAAM,YAAA,EACjB,SAAS,CAAC,EAAE,MAAM,YAAA;IAGpC,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAQjC,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,WAAW;CAO5D"}
@@ -0,0 +1,106 @@
1
+ // Copyright 2026 INNO LOTUS PTY LTD
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import { EncodingTier, FrameType } from "../core/frames.js";
4
+ import { AssuranceLevel } from "./assurance-level.js";
5
+ export class IdentFrame {
6
+ nid;
7
+ pubKey;
8
+ metadata;
9
+ signature;
10
+ frameType = FrameType.IDENT;
11
+ preferredTier = EncodingTier.MSGPACK;
12
+ assuranceLevel;
13
+ certFormat;
14
+ certChain;
15
+ constructor(nid, pubKey, metadata, signature, options = {}) {
16
+ this.nid = nid;
17
+ this.pubKey = pubKey;
18
+ this.metadata = metadata;
19
+ this.signature = signature;
20
+ this.assuranceLevel = options.assuranceLevel ?? null;
21
+ this.certFormat = options.certFormat ?? null;
22
+ this.certChain = options.certChain ?? null;
23
+ }
24
+ unsignedDict() {
25
+ const out = {
26
+ nid: this.nid,
27
+ pub_key: this.pubKey,
28
+ metadata: this.metadata,
29
+ };
30
+ if (this.assuranceLevel !== null)
31
+ out["assurance_level"] = this.assuranceLevel.wire;
32
+ // cert_format / cert_chain deliberately excluded from the signed payload —
33
+ // the v1 Ed25519 signature covers only (nid, pub_key, metadata, [assurance_level]).
34
+ return out;
35
+ }
36
+ toDict() {
37
+ const out = { ...this.unsignedDict(), signature: this.signature };
38
+ if (this.certFormat !== null)
39
+ out["cert_format"] = this.certFormat;
40
+ if (this.certChain !== null)
41
+ out["cert_chain"] = [...this.certChain];
42
+ return out;
43
+ }
44
+ static fromDict(data) {
45
+ const lvl = data["assurance_level"];
46
+ const assuranceLevel = typeof lvl === "string" ? AssuranceLevel.fromWire(lvl) : null;
47
+ const chainRaw = data["cert_chain"];
48
+ const certChain = Array.isArray(chainRaw) ? chainRaw : null;
49
+ return new IdentFrame(data["nid"], data["pub_key"], data["metadata"], data["signature"], {
50
+ assuranceLevel,
51
+ certFormat: data["cert_format"] ?? null,
52
+ certChain,
53
+ });
54
+ }
55
+ }
56
+ export class TrustFrame {
57
+ issuerNid;
58
+ subjectNid;
59
+ scopes;
60
+ expiresAt;
61
+ signature;
62
+ frameType = FrameType.TRUST;
63
+ preferredTier = EncodingTier.MSGPACK;
64
+ constructor(issuerNid, subjectNid, scopes, expiresAt, signature) {
65
+ this.issuerNid = issuerNid;
66
+ this.subjectNid = subjectNid;
67
+ this.scopes = scopes;
68
+ this.expiresAt = expiresAt;
69
+ this.signature = signature;
70
+ }
71
+ toDict() {
72
+ return {
73
+ issuer_nid: this.issuerNid,
74
+ subject_nid: this.subjectNid,
75
+ scopes: this.scopes,
76
+ expires_at: this.expiresAt,
77
+ signature: this.signature,
78
+ };
79
+ }
80
+ static fromDict(data) {
81
+ return new TrustFrame(data["issuer_nid"], data["subject_nid"], data["scopes"], data["expires_at"], data["signature"]);
82
+ }
83
+ }
84
+ export class RevokeFrame {
85
+ nid;
86
+ reason;
87
+ revokedAt;
88
+ frameType = FrameType.REVOKE;
89
+ preferredTier = EncodingTier.MSGPACK;
90
+ constructor(nid, reason, revokedAt) {
91
+ this.nid = nid;
92
+ this.reason = reason;
93
+ this.revokedAt = revokedAt;
94
+ }
95
+ toDict() {
96
+ return {
97
+ nid: this.nid,
98
+ reason: this.reason ?? null,
99
+ revoked_at: this.revokedAt ?? null,
100
+ };
101
+ }
102
+ static fromDict(data) {
103
+ return new RevokeFrame(data["nid"], data["reason"] ?? undefined, data["revoked_at"] ?? undefined);
104
+ }
105
+ }
106
+ //# sourceMappingURL=frames.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"frames.js","sourceRoot":"","sources":["../../src/nip/frames.ts"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,sCAAsC;AAEtC,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE5D,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAgBtD,MAAM,OAAO,UAAU;IASH;IACA;IACA;IACA;IAXT,SAAS,GAAO,SAAS,CAAC,KAAK,CAAC;IAChC,aAAa,GAAG,YAAY,CAAC,OAAO,CAAC;IAErC,cAAc,CAAwB;IACtC,UAAU,CAAoB;IAC9B,SAAS,CAAgC;IAElD,YACkB,GAAiB,EACjB,MAAiB,EACjB,QAAwB,EACxB,SAAiB,EACjC,UAAgD,EAAE;QAJlC,QAAG,GAAH,GAAG,CAAc;QACjB,WAAM,GAAN,MAAM,CAAW;QACjB,aAAQ,GAAR,QAAQ,CAAgB;QACxB,cAAS,GAAT,SAAS,CAAQ;QAGjC,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC,cAAc,IAAI,IAAI,CAAC;QACrD,IAAI,CAAC,UAAU,GAAO,OAAO,CAAC,UAAU,IAAQ,IAAI,CAAC;QACrD,IAAI,CAAC,SAAS,GAAQ,OAAO,CAAC,SAAS,IAAS,IAAI,CAAC;IACvD,CAAC;IAED,YAAY;QACV,MAAM,GAAG,GAA4B;YACnC,GAAG,EAAO,IAAI,CAAC,GAAG;YAClB,OAAO,EAAG,IAAI,CAAC,MAAM;YACrB,QAAQ,EAAE,IAAI,CAAC,QAAQ;SACxB,CAAC;Q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I;YACnC,UAAU,EAAE,IAAI,CAAC,SAAS,IAAK,IAAI;SACpC,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,QAAQ,CAAC,IAA6B;QAC3C,OAAO,IAAI,WAAW,CACpB,IAAI,CAAC,KAAK,CAAkB,EAC3B,IAAI,CAAC,QAAQ,CAAuB,IAAI,SAAS,EACjD,IAAI,CAAC,YAAY,CAAmB,IAAI,SAAS,CACnD,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,18 @@
1
+ export declare class NipIdentity {
2
+ private readonly _privKey;
3
+ readonly pubKey: Uint8Array;
4
+ private constructor();
5
+ static generate(): NipIdentity;
6
+ static fromPrivateKey(privKey: Uint8Array): NipIdentity;
7
+ /** Load from an AES-256-GCM encrypted key file. */
8
+ static load(path: string, passphrase: string): NipIdentity;
9
+ /** Save to an AES-256-GCM encrypted key file. */
10
+ save(path: string, passphrase: string): void;
11
+ /** Sign a dict payload. Returns `ed25519:<base64url>`. */
12
+ sign(payload: Record<string, unknown>): string;
13
+ /** Verify a signature string against a dict payload. */
14
+ verify(payload: Record<string, unknown>, signature: string): boolean;
15
+ /** Public key as `ed25519:<hex>` string. */
16
+ get pubKeyString(): string;
17
+ }
18
+ //# sourceMappingURL=identity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../../src/nip/identity.ts"],"names":[],"mappings":"AA8BA,qBAAa,WAAW;IAEpB,OAAO,CAAC,QAAQ,CAAC,QAAQ;aACR,MAAM,EAAI,UAAU;IAFvC,OAAO;IAOP,MAAM,CAAC,QAAQ,IAAI,WAAW;IAM9B,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,UAAU,GAAG,WAAW;IAKvD,mDAAmD;IACnD,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,WAAW;IAgB1D,iDAAiD;IACjD,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI;IAoB5C,0DAA0D;IAC1D,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM;IAO9C,wDAAwD;IACxD,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO;IAYpE,4CAA4C;IAC5C,IAAI,YAAY,IAAI,MAAM,CAEzB;CACF"}
@@ -0,0 +1,94 @@
1
+ // Copyright 2026 INNO LOTUS PTY LTD
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ /**
4
+ * NipIdentity — Ed25519 key management and signing for NPS NID identity.
5
+ * Uses @noble/ed25519 for signing; node:crypto for key storage encryption.
6
+ */
7
+ import * as ed25519 from "@noble/ed25519";
8
+ import { sha512 } from "@noble/hashes/sha512";
9
+ import { createCipheriv, createDecipheriv, pbkdf2Sync, randomBytes } from "node:crypto";
10
+ import { readFileSync, writeFileSync } from "node:fs";
11
+ // noble/ed25519 requires sha512 to be set explicitly in Node environments
12
+ ed25519.etc.sha512Sync = (...m) => sha512(ed25519.etc.concatBytes(...m));
13
+ const KEY_FILE_VERSION = 1;
14
+ const PBKDF2_ITERS = 600_000;
15
+ const SALT_BYTES = 16;
16
+ const IV_BYTES = 12;
17
+ const KEY_BYTES = 32;
18
+ export class NipIdentity {
19
+ _privKey;
20
+ pubKey;
21
+ constructor(_privKey, pubKey) {
22
+ this._privKey = _privKey;
23
+ this.pubKey = pubKey;
24
+ }
25
+ // ── Factory ───────────────────────────────────────────────────────────────
26
+ static generate() {
27
+ const priv = ed25519.utils.randomPrivateKey();
28
+ const pub = ed25519.getPublicKey(priv);
29
+ return new NipIdentity(priv, pub);
30
+ }
31
+ static fromPrivateKey(privKey) {
32
+ const pub = ed25519.getPublicKey(privKey);
33
+ return new NipIdentity(privKey, pub);
34
+ }
35
+ /** Load from an AES-256-GCM encrypted key file. */
36
+ static load(path, passphrase) {
37
+ const envelope = JSON.parse(readFileSync(path, "utf8"));
38
+ const salt = Buffer.from(envelope.salt, "hex");
39
+ const iv = Buffer.from(envelope.iv, "hex");
40
+ const ct = Buffer.from(envelope.ciphertext, "hex");
41
+ const dk = pbkdf2Sync(passphrase, salt, PBKDF2_ITERS, KEY_BYTES, "sha256");
42
+ const decipher = createDecipheriv("aes-256-gcm", dk, iv);
43
+ // Last 16 bytes of ciphertext are the GCM auth tag
44
+ const authTag = ct.slice(ct.length - 16);
45
+ const body = ct.slice(0, ct.length - 16);
46
+ decipher.setAuthTag(authTag);
47
+ const priv = Buffer.concat([decipher.update(body), decipher.final()]);
48
+ return NipIdentity.fromPrivateKey(new Uint8Array(priv));
49
+ }
50
+ /** Save to an AES-256-GCM encrypted key file. */
51
+ save(path, passphrase) {
52
+ const salt = randomBytes(SALT_BYTES);
53
+ const iv = randomBytes(IV_BYTES);
54
+ const dk = pbkdf2Sync(passphrase, salt, PBKDF2_ITERS, KEY_BYTES, "sha256");
55
+ const cipher = createCipheriv("aes-256-gcm", dk, iv);
56
+ const body = Buffer.concat([cipher.update(Buffer.from(this._privKey)), cipher.final()]);
57
+ const tag = cipher.getAuthTag();
58
+ const envelope = {
59
+ version: KEY_FILE_VERSION,
60
+ salt: salt.toString("hex"),
61
+ iv: iv.toString("hex"),
62
+ ciphertext: Buffer.concat([body, tag]).toString("hex"),
63
+ pubKey: Buffer.from(this.pubKey).toString("hex"),
64
+ };
65
+ writeFileSync(path, JSON.stringify(envelope, null, 2), "utf8");
66
+ }
67
+ // ── Signing ───────────────────────────────────────────────────────────────
68
+ /** Sign a dict payload. Returns `ed25519:<base64url>`. */
69
+ sign(payload) {
70
+ const canonical = JSON.stringify(payload, Object.keys(payload).sort());
71
+ const bytes = new TextEncoder().encode(canonical);
72
+ const sig = ed25519.sign(bytes, this._privKey);
73
+ return `ed25519:${Buffer.from(sig).toString("base64")}`;
74
+ }
75
+ /** Verify a signature string against a dict payload. */
76
+ verify(payload, signature) {
77
+ if (!signature.startsWith("ed25519:"))
78
+ return false;
79
+ try {
80
+ const canonical = JSON.stringify(payload, Object.keys(payload).sort());
81
+ const bytes = new TextEncoder().encode(canonical);
82
+ const sigBytes = Buffer.from(signature.slice("ed25519:".length), "base64");
83
+ return ed25519.verify(sigBytes, bytes, this.pubKey);
84
+ }
85
+ catch {
86
+ return false;
87
+ }
88
+ }
89
+ /** Public key as `ed25519:<hex>` string. */
90
+ get pubKeyString() {
91
+ return `ed25519:${Buffer.from(this.pubKey).toString("hex")}`;
92
+ }
93
+ }
94
+ //# sourceMappingURL=identity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identity.js","sourceRoot":"","sources":["../../src/nip/identity.ts"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,sCAAsC;AAEtC;;;GAGG;AAEH,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACxF,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAEtD,0EAA0E;AAC1E,OAAO,CAAC,GAAG,CAAC,UAAU,GAAG,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAEzE,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAC3B,MAAM,YAAY,GAAO,OAAO,CAAC;AACjC,MAAM,UAAU,GAAS,EAAE,CAAC;AAC5B,MAAM,QAAQ,GAAW,EAAE,CAAC;AAC5B,MAAM,SAAS,GAAU,EAAE,CAAC;AAU5B,MAAM,OAAO,WAAW;IAEH;IACA;IAFnB,YACmB,QAAoB,EACpB,MAAoB;QADpB,aAAQ,GAAR,QAAQ,CAAY;QACpB,WAAM,GAAN,MAAM,CAAc;IACpC,CAAC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AAC;YACP,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IAED,4CAA4C;IAC5C,IAAI,YAAY;QACd,OAAO,WAAW,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;IAC/D,CAAC;CACF"}
@@ -0,0 +1,11 @@
1
+ export * from "./frames.js";
2
+ export * from "./identity.js";
3
+ export { registerNipFrames } from "./registry.js";
4
+ export * from "./assurance-level.js";
5
+ export * from "./cert-format.js";
6
+ export * from "./error-codes.js";
7
+ export * from "./verifier.js";
8
+ export * as x509 from "./x509/index.js";
9
+ export * as acme from "./acme/index.js";
10
+ export * from "./reputation-client.js";
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/nip/index.ts"],"names":[],"mappings":"AAGA,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAGlD,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AACxC,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AAGxC,cAAc,wBAAwB,CAAC"}
@@ -1,10 +1,8 @@
1
1
  // Copyright 2026 INNO LOTUS PTY LTD
2
2
  // SPDX-License-Identifier: Apache-2.0
3
-
4
3
  export * from "./frames.js";
5
4
  export * from "./identity.js";
6
5
  export { registerNipFrames } from "./registry.js";
7
-
8
6
  // RFC-0002 / RFC-0003 — X.509 + ACME + dual-trust verifier
9
7
  export * from "./assurance-level.js";
10
8
  export * from "./cert-format.js";
@@ -12,3 +10,6 @@ export * from "./error-codes.js";
12
10
  export * from "./verifier.js";
13
11
  export * as x509 from "./x509/index.js";
14
12
  export * as acme from "./acme/index.js";
13
+ // RFC-0004 — Reputation log
14
+ export * from "./reputation-client.js";
15
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/nip/index.ts"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,sCAAsC;AAEtC,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAElD,2DAA2D;AAC3D,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AACxC,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AAExC,4BAA4B;AAC5B,cAAc,wBAAwB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { FrameRegistry } from "../core/registry.js";
2
+ export declare function registerNipFrames(registry: FrameRegistry): void;
3
+ //# sourceMappingURL=registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/nip/registry.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAIpD,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,aAAa,GAAG,IAAI,CAI/D"}
@@ -0,0 +1,10 @@
1
+ // Copyright 2026 INNO LOTUS PTY LTD
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import { FrameType } from "../core/frames.js";
4
+ import { IdentFrame, TrustFrame, RevokeFrame } from "./frames.js";
5
+ export function registerNipFrames(registry) {
6
+ registry.register(FrameType.IDENT, IdentFrame);
7
+ registry.register(FrameType.TRUST, TrustFrame);
8
+ registry.register(FrameType.REVOKE, RevokeFrame);
9
+ }
10
+ //# sourceMappingURL=registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/nip/registry.ts"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,sCAAsC;AAGtC,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAElE,MAAM,UAAU,iBAAiB,CAAC,QAAuB;IACvD,QAAQ,CAAC,QAAQ,CAAC,SAAS,CAAC,KAAK,EAAG,UAAU,CAAC,CAAC;IAChD,QAAQ,CAAC,QAAQ,CAAC,SAAS,CAAC,KAAK,EAAG,UAAU,CAAC,CAAC;IAChD,QAAQ,CAAC,QAAQ,CAAC,SAAS,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;AACnD,CAAC"}
@@ -0,0 +1,116 @@
1
+ export interface ObservationWindow {
2
+ start: string;
3
+ end: string;
4
+ }
5
+ export declare const IncidentType: {
6
+ readonly Other: "other";
7
+ readonly CertRevoked: "cert-revoked";
8
+ readonly RateLimitViolation: "rate-limit-violation";
9
+ readonly TosViolation: "tos-violation";
10
+ readonly ScrapingPattern: "scraping-pattern";
11
+ readonly PaymentDefault: "payment-default";
12
+ readonly ContractDispute: "contract-dispute";
13
+ readonly ImpersonationClaim: "impersonation-claim";
14
+ readonly PositiveAttestation: "positive-attestation";
15
+ };
16
+ export type IncidentType = typeof IncidentType[keyof typeof IncidentType];
17
+ export declare const Severity: {
18
+ readonly Info: 0;
19
+ readonly Minor: 1;
20
+ readonly Moderate: 2;
21
+ readonly Major: 3;
22
+ readonly Critical: 4;
23
+ };
24
+ export type Severity = typeof Severity[keyof typeof Severity];
25
+ export interface ReputationLogEntry {
26
+ v: number;
27
+ log_id: string;
28
+ seq: number;
29
+ timestamp: string;
30
+ subject_nid: string;
31
+ incident: string;
32
+ incidentRaw?: string;
33
+ severity: string;
34
+ window?: ObservationWindow;
35
+ observation?: unknown;
36
+ evidence_ref?: string;
37
+ evidence_sha256?: string;
38
+ issuer_nid: string;
39
+ signature: string;
40
+ }
41
+ export interface SignedTreeHead {
42
+ log_id: string;
43
+ tree_size: number;
44
+ timestamp: string;
45
+ sha256_root_hash: string;
46
+ signature: string;
47
+ }
48
+ export interface InclusionProof {
49
+ seq: number;
50
+ leaf_index: number;
51
+ tree_size: number;
52
+ leaf_hash: string;
53
+ audit_path: string[];
54
+ }
55
+ /**
56
+ * Sign a ReputationLogEntry and return a new entry with `signature` set.
57
+ * The private key must be a 32-byte raw Ed25519 private key.
58
+ */
59
+ export declare function signEntry(privKey: Uint8Array, entry: ReputationLogEntry): ReputationLogEntry;
60
+ /**
61
+ * Verify the `signature` field of a ReputationLogEntry against the given
62
+ * Ed25519 public key (32-byte raw).
63
+ */
64
+ export declare function verifyEntry(pubKey: Uint8Array, entry: ReputationLogEntry): boolean;
65
+ /**
66
+ * Parse a wire severity string. Throws an Error for unknown values
67
+ * (no forward-compat — callers must upgrade to handle new severity levels).
68
+ */
69
+ export declare function parseSeverity(wire: string): Severity;
70
+ /**
71
+ * Parse a wire incident string. Unknown values map to `IncidentType.Other`
72
+ * (forward-compat); the original string is returned as `incidentRaw`.
73
+ */
74
+ export declare function parseIncident(wire: string): {
75
+ incident: IncidentType;
76
+ incidentRaw?: string;
77
+ };
78
+ export declare class ReputationLogException extends Error {
79
+ readonly nipErrorCode: string;
80
+ readonly npsStatus: string;
81
+ constructor(nipErrorCode: string, npsStatus: string, message?: string);
82
+ }
83
+ export declare class ReputationLogClient {
84
+ private readonly baseUrl;
85
+ constructor(baseUrl: string);
86
+ /**
87
+ * POST /v1/log/entries — submit a signed entry.
88
+ * Returns the server-echoed entry with seq/timestamp/log_id filled in.
89
+ */
90
+ submit(entry: ReputationLogEntry): Promise<ReputationLogEntry>;
91
+ /**
92
+ * GET /v1/log/entries — query entries.
93
+ * @param options.nid Filter by subject NID.
94
+ * @param options.sinceSeq Return only entries with seq > sinceSeq.
95
+ */
96
+ query(options?: {
97
+ nid?: string;
98
+ sinceSeq?: number;
99
+ }): Promise<ReputationLogEntry[]>;
100
+ /** GET /v1/log/sth — current SignedTreeHead. */
101
+ getSth(): Promise<SignedTreeHead>;
102
+ /** GET /v1/log/proof?seq=<seq> — InclusionProof for a log entry. */
103
+ getProof(seq: number): Promise<InclusionProof>;
104
+ /** GET /v1/log/gossip/sth — gossip SignedTreeHead. */
105
+ getGossipSth(): Promise<SignedTreeHead>;
106
+ /**
107
+ * Verify that `entry` is included in the log at the position described by
108
+ * `proof`, under the given `sth`.
109
+ *
110
+ * Merkle construction (RFC 9162):
111
+ * leaf_hash = SHA256(0x00 || utf8(canonical_all_sorted_json_of_entry))
112
+ * node_hash = SHA256(0x01 || left_bytes || right_bytes)
113
+ */
114
+ static verifyInclusion(proof: InclusionProof, sth: SignedTreeHead, entry: ReputationLogEntry): boolean;
115
+ }
116
+ //# sourceMappingURL=reputation-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reputation-client.d.ts","sourceRoot":"","sources":["../../src/nip/reputation-client.ts"],"names":[],"mappings":"AAwDA,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACb;AAED,eAAO,MAAM,YAAY;;;;;;;;;;CAUf,CAAC;AACX,MAAM,MAAM,YAAY,GAAG,OAAO,YAAY,CAAC,MAAM,OAAO,YAAY,CAAC,CAAC;AAE1E,eAAO,MAAM,QAAQ;;;;;;CAMX,CAAC;AACX,MAAM,MAAM,QAAQ,GAAG,OAAO,QAAQ,CAAC,MAAM,OAAO,QAAQ,CAAC,CAAC;AAc9D,MAAM,WAAW,kBAAkB;IACjC,CAAC,EAAc,MAAM,CAAC;IACtB,MAAM,EAAS,MAAM,CAAC;IACtB,GAAG,EAAY,MAAM,CAAC;IACtB,SAAS,EAAM,MAAM,CAAC;IACtB,WAAW,EAAI,MAAM,CAAC;IACtB,QAAQ,EAAO,MAAM,CAAC;IACtB,WAAW,CAAC,EAAG,MAAM,CAAC;IACtB,QAAQ,EAAO,MAAM,C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