@swal/edge-mesh 0.0.0-stage → 0.1.1

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 (464) hide show
  1. package/LICENSE +128 -0
  2. package/NOTICE +37 -0
  3. package/README.md +470 -2
  4. package/dist/adapters/gpu-agent/index.d.ts +61 -0
  5. package/dist/adapters/gpu-agent/index.d.ts.map +1 -0
  6. package/dist/adapters/gpu-agent/index.js +364 -0
  7. package/dist/adapters/gpu-agent/index.js.map +1 -0
  8. package/dist/adapters/maloca-salud/citas-distribuidas.d.ts +19 -0
  9. package/dist/adapters/maloca-salud/citas-distribuidas.d.ts.map +1 -0
  10. package/dist/adapters/maloca-salud/citas-distribuidas.js +51 -0
  11. package/dist/adapters/maloca-salud/citas-distribuidas.js.map +1 -0
  12. package/dist/adapters/maloca-salud/eps-bridge.d.ts +15 -0
  13. package/dist/adapters/maloca-salud/eps-bridge.d.ts.map +1 -0
  14. package/dist/adapters/maloca-salud/eps-bridge.js +27 -0
  15. package/dist/adapters/maloca-salud/eps-bridge.js.map +1 -0
  16. package/dist/adapters/maloca-salud/patient-profile.d.ts +20 -0
  17. package/dist/adapters/maloca-salud/patient-profile.d.ts.map +1 -0
  18. package/dist/adapters/maloca-salud/patient-profile.js +36 -0
  19. package/dist/adapters/maloca-salud/patient-profile.js.map +1 -0
  20. package/dist/adapters/maloca-salud/types.d.ts +40 -0
  21. package/dist/adapters/maloca-salud/types.d.ts.map +1 -0
  22. package/dist/adapters/maloca-salud/types.js +2 -0
  23. package/dist/adapters/maloca-salud/types.js.map +1 -0
  24. package/dist/adapters/maloca-veeduria/contract-bridge.d.ts +31 -0
  25. package/dist/adapters/maloca-veeduria/contract-bridge.d.ts.map +1 -0
  26. package/dist/adapters/maloca-veeduria/contract-bridge.js +103 -0
  27. package/dist/adapters/maloca-veeduria/contract-bridge.js.map +1 -0
  28. package/dist/adapters/maloca-veeduria/evidentia-veeduria.d.ts +14 -0
  29. package/dist/adapters/maloca-veeduria/evidentia-veeduria.d.ts.map +1 -0
  30. package/dist/adapters/maloca-veeduria/evidentia-veeduria.js +40 -0
  31. package/dist/adapters/maloca-veeduria/evidentia-veeduria.js.map +1 -0
  32. package/dist/adapters/maloca-veeduria/licitante-profile.d.ts +21 -0
  33. package/dist/adapters/maloca-veeduria/licitante-profile.d.ts.map +1 -0
  34. package/dist/adapters/maloca-veeduria/licitante-profile.js +58 -0
  35. package/dist/adapters/maloca-veeduria/licitante-profile.js.map +1 -0
  36. package/dist/adapters/maloca-veeduria/types.d.ts +30 -0
  37. package/dist/adapters/maloca-veeduria/types.d.ts.map +1 -0
  38. package/dist/adapters/maloca-veeduria/types.js +2 -0
  39. package/dist/adapters/maloca-veeduria/types.js.map +1 -0
  40. package/dist/adapters/maloca-xavier/agent-profile.d.ts +32 -0
  41. package/dist/adapters/maloca-xavier/agent-profile.d.ts.map +1 -0
  42. package/dist/adapters/maloca-xavier/agent-profile.js +56 -0
  43. package/dist/adapters/maloca-xavier/agent-profile.js.map +1 -0
  44. package/dist/adapters/maloca-xavier/codegraph-bridge.d.ts +27 -0
  45. package/dist/adapters/maloca-xavier/codegraph-bridge.d.ts.map +1 -0
  46. package/dist/adapters/maloca-xavier/codegraph-bridge.js +58 -0
  47. package/dist/adapters/maloca-xavier/codegraph-bridge.js.map +1 -0
  48. package/dist/adapters/maloca-xavier/llm-router.d.ts +25 -0
  49. package/dist/adapters/maloca-xavier/llm-router.d.ts.map +1 -0
  50. package/dist/adapters/maloca-xavier/llm-router.js +58 -0
  51. package/dist/adapters/maloca-xavier/llm-router.js.map +1 -0
  52. package/dist/authz/index.d.ts +81 -0
  53. package/dist/authz/index.d.ts.map +1 -0
  54. package/dist/authz/index.js +271 -0
  55. package/dist/authz/index.js.map +1 -0
  56. package/dist/chat/index.d.ts +138 -0
  57. package/dist/chat/index.d.ts.map +1 -0
  58. package/dist/chat/index.js +394 -0
  59. package/dist/chat/index.js.map +1 -0
  60. package/dist/chat/offline-queue.d.ts +32 -0
  61. package/dist/chat/offline-queue.d.ts.map +1 -0
  62. package/dist/chat/offline-queue.js +93 -0
  63. package/dist/chat/offline-queue.js.map +1 -0
  64. package/dist/core/DefaultEdgeMeshNode.d.ts +17 -0
  65. package/dist/core/DefaultEdgeMeshNode.d.ts.map +1 -0
  66. package/dist/core/DefaultEdgeMeshNode.js +57 -0
  67. package/dist/core/DefaultEdgeMeshNode.js.map +1 -0
  68. package/dist/core/node.d.ts +26 -0
  69. package/dist/core/node.d.ts.map +1 -0
  70. package/dist/core/node.js +16 -0
  71. package/dist/core/node.js.map +1 -0
  72. package/dist/edge-mesh.d.ts +139 -0
  73. package/dist/edge-mesh.d.ts.map +1 -0
  74. package/dist/edge-mesh.js +1146 -0
  75. package/dist/edge-mesh.js.map +1 -0
  76. package/dist/gos/GosBridge.d.ts +49 -0
  77. package/dist/gos/GosBridge.d.ts.map +1 -0
  78. package/dist/gos/GosBridge.js +133 -0
  79. package/dist/gos/GosBridge.js.map +1 -0
  80. package/dist/governance/authority.d.ts +44 -0
  81. package/dist/governance/authority.d.ts.map +1 -0
  82. package/dist/governance/authority.js +123 -0
  83. package/dist/governance/authority.js.map +1 -0
  84. package/dist/governance/index.d.ts +66 -0
  85. package/dist/governance/index.d.ts.map +1 -0
  86. package/dist/governance/index.js +210 -0
  87. package/dist/governance/index.js.map +1 -0
  88. package/dist/governance/merge.d.ts +31 -0
  89. package/dist/governance/merge.d.ts.map +1 -0
  90. package/dist/governance/merge.js +167 -0
  91. package/dist/governance/merge.js.map +1 -0
  92. package/dist/identity/index.d.ts +199 -0
  93. package/dist/identity/index.d.ts.map +1 -0
  94. package/dist/identity/index.js +415 -0
  95. package/dist/identity/index.js.map +1 -0
  96. package/dist/index.d.ts +71 -0
  97. package/dist/index.d.ts.map +1 -0
  98. package/dist/index.js +56 -0
  99. package/dist/index.js.map +1 -0
  100. package/dist/maloca/backoffice.d.ts +31 -0
  101. package/dist/maloca/backoffice.d.ts.map +1 -0
  102. package/dist/maloca/backoffice.js +40 -0
  103. package/dist/maloca/backoffice.js.map +1 -0
  104. package/dist/maloca/event-bus.d.ts +60 -0
  105. package/dist/maloca/event-bus.d.ts.map +1 -0
  106. package/dist/maloca/event-bus.js +175 -0
  107. package/dist/maloca/event-bus.js.map +1 -0
  108. package/dist/maloca/evidentia.d.ts +136 -0
  109. package/dist/maloca/evidentia.d.ts.map +1 -0
  110. package/dist/maloca/evidentia.js +447 -0
  111. package/dist/maloca/evidentia.js.map +1 -0
  112. package/dist/maloca/gateway/api.d.ts +146 -0
  113. package/dist/maloca/gateway/api.d.ts.map +1 -0
  114. package/dist/maloca/gateway/api.js +228 -0
  115. package/dist/maloca/gateway/api.js.map +1 -0
  116. package/dist/maloca/gateway/auth.d.ts +20 -0
  117. package/dist/maloca/gateway/auth.d.ts.map +1 -0
  118. package/dist/maloca/gateway/auth.js +115 -0
  119. package/dist/maloca/gateway/auth.js.map +1 -0
  120. package/dist/maloca/gateway/dashboard.d.ts +42 -0
  121. package/dist/maloca/gateway/dashboard.d.ts.map +1 -0
  122. package/dist/maloca/gateway/dashboard.js +67 -0
  123. package/dist/maloca/gateway/dashboard.js.map +1 -0
  124. package/dist/maloca/gateway/websocket.d.ts +34 -0
  125. package/dist/maloca/gateway/websocket.d.ts.map +1 -0
  126. package/dist/maloca/gateway/websocket.js +71 -0
  127. package/dist/maloca/gateway/websocket.js.map +1 -0
  128. package/dist/maloca/karma.d.ts +165 -0
  129. package/dist/maloca/karma.d.ts.map +1 -0
  130. package/dist/maloca/karma.js +307 -0
  131. package/dist/maloca/karma.js.map +1 -0
  132. package/dist/maloca/kernel.d.ts +20 -0
  133. package/dist/maloca/kernel.d.ts.map +1 -0
  134. package/dist/maloca/kernel.js +76 -0
  135. package/dist/maloca/kernel.js.map +1 -0
  136. package/dist/maloca/metadata.d.ts +30 -0
  137. package/dist/maloca/metadata.d.ts.map +1 -0
  138. package/dist/maloca/metadata.js +80 -0
  139. package/dist/maloca/metadata.js.map +1 -0
  140. package/dist/maloca/perfil.d.ts +57 -0
  141. package/dist/maloca/perfil.d.ts.map +1 -0
  142. package/dist/maloca/perfil.js +113 -0
  143. package/dist/maloca/perfil.js.map +1 -0
  144. package/dist/maloca/plugin-registry.d.ts +27 -0
  145. package/dist/maloca/plugin-registry.d.ts.map +1 -0
  146. package/dist/maloca/plugin-registry.js +76 -0
  147. package/dist/maloca/plugin-registry.js.map +1 -0
  148. package/dist/maloca/polygon-bridge.d.ts +63 -0
  149. package/dist/maloca/polygon-bridge.d.ts.map +1 -0
  150. package/dist/maloca/polygon-bridge.js +198 -0
  151. package/dist/maloca/polygon-bridge.js.map +1 -0
  152. package/dist/maloca/types.d.ts +44 -0
  153. package/dist/maloca/types.d.ts.map +1 -0
  154. package/dist/maloca/types.js +2 -0
  155. package/dist/maloca/types.js.map +1 -0
  156. package/dist/medico/aval.d.ts +149 -0
  157. package/dist/medico/aval.d.ts.map +1 -0
  158. package/dist/medico/aval.js +281 -0
  159. package/dist/medico/aval.js.map +1 -0
  160. package/dist/medico/canonica.d.ts +96 -0
  161. package/dist/medico/canonica.d.ts.map +1 -0
  162. package/dist/medico/canonica.js +148 -0
  163. package/dist/medico/canonica.js.map +1 -0
  164. package/dist/medico/credencial.d.ts +160 -0
  165. package/dist/medico/credencial.d.ts.map +1 -0
  166. package/dist/medico/credencial.js +240 -0
  167. package/dist/medico/credencial.js.map +1 -0
  168. package/dist/medico/index.d.ts +36 -0
  169. package/dist/medico/index.d.ts.map +1 -0
  170. package/dist/medico/index.js +39 -0
  171. package/dist/medico/index.js.map +1 -0
  172. package/dist/medico/malla.d.ts +218 -0
  173. package/dist/medico/malla.d.ts.map +1 -0
  174. package/dist/medico/malla.js +347 -0
  175. package/dist/medico/malla.js.map +1 -0
  176. package/dist/medico/registro-profesional.d.ts +84 -0
  177. package/dist/medico/registro-profesional.d.ts.map +1 -0
  178. package/dist/medico/registro-profesional.js +135 -0
  179. package/dist/medico/registro-profesional.js.map +1 -0
  180. package/dist/medico/registro.d.ts +149 -0
  181. package/dist/medico/registro.d.ts.map +1 -0
  182. package/dist/medico/registro.js +173 -0
  183. package/dist/medico/registro.js.map +1 -0
  184. package/dist/medico/types.d.ts +287 -0
  185. package/dist/medico/types.d.ts.map +1 -0
  186. package/dist/medico/types.js +135 -0
  187. package/dist/medico/types.js.map +1 -0
  188. package/dist/medico/verificacion-registro.d.ts +300 -0
  189. package/dist/medico/verificacion-registro.d.ts.map +1 -0
  190. package/dist/medico/verificacion-registro.js +319 -0
  191. package/dist/medico/verificacion-registro.js.map +1 -0
  192. package/dist/mesh/index.d.ts +457 -0
  193. package/dist/mesh/index.d.ts.map +1 -0
  194. package/dist/mesh/index.js +929 -0
  195. package/dist/mesh/index.js.map +1 -0
  196. package/dist/namespaces/encrypted-plugin.d.ts +56 -0
  197. package/dist/namespaces/encrypted-plugin.d.ts.map +1 -0
  198. package/dist/namespaces/encrypted-plugin.js +173 -0
  199. package/dist/namespaces/encrypted-plugin.js.map +1 -0
  200. package/dist/namespaces/index.d.ts +52 -0
  201. package/dist/namespaces/index.d.ts.map +1 -0
  202. package/dist/namespaces/index.js +134 -0
  203. package/dist/namespaces/index.js.map +1 -0
  204. package/dist/namespaces/ivn-proofs.d.ts +54 -0
  205. package/dist/namespaces/ivn-proofs.d.ts.map +1 -0
  206. package/dist/namespaces/ivn-proofs.js +162 -0
  207. package/dist/namespaces/ivn-proofs.js.map +1 -0
  208. package/dist/namespaces/offers-gossip.d.ts +95 -0
  209. package/dist/namespaces/offers-gossip.d.ts.map +1 -0
  210. package/dist/namespaces/offers-gossip.js +213 -0
  211. package/dist/namespaces/offers-gossip.js.map +1 -0
  212. package/dist/node-memory/idb-store.d.ts +22 -0
  213. package/dist/node-memory/idb-store.d.ts.map +1 -0
  214. package/dist/node-memory/idb-store.js +157 -0
  215. package/dist/node-memory/idb-store.js.map +1 -0
  216. package/dist/node-memory/index.d.ts +14 -0
  217. package/dist/node-memory/index.d.ts.map +1 -0
  218. package/dist/node-memory/index.js +159 -0
  219. package/dist/node-memory/index.js.map +1 -0
  220. package/dist/node-memory/sync-flush.d.ts +11 -0
  221. package/dist/node-memory/sync-flush.d.ts.map +1 -0
  222. package/dist/node-memory/sync-flush.js +37 -0
  223. package/dist/node-memory/sync-flush.js.map +1 -0
  224. package/dist/node-memory/types.d.ts +34 -0
  225. package/dist/node-memory/types.d.ts.map +1 -0
  226. package/dist/node-memory/types.js +2 -0
  227. package/dist/node-memory/types.js.map +1 -0
  228. package/dist/node-memory/xavier-store.d.ts +12 -0
  229. package/dist/node-memory/xavier-store.d.ts.map +1 -0
  230. package/dist/node-memory/xavier-store.js +75 -0
  231. package/dist/node-memory/xavier-store.js.map +1 -0
  232. package/dist/op-log/index.d.ts +49 -0
  233. package/dist/op-log/index.d.ts.map +1 -0
  234. package/dist/op-log/index.js +190 -0
  235. package/dist/op-log/index.js.map +1 -0
  236. package/dist/presence/health.d.ts +54 -0
  237. package/dist/presence/health.d.ts.map +1 -0
  238. package/dist/presence/health.js +139 -0
  239. package/dist/presence/health.js.map +1 -0
  240. package/dist/presence/index.d.ts +85 -0
  241. package/dist/presence/index.d.ts.map +1 -0
  242. package/dist/presence/index.js +255 -0
  243. package/dist/presence/index.js.map +1 -0
  244. package/dist/presence/peer-health.d.ts +40 -0
  245. package/dist/presence/peer-health.d.ts.map +1 -0
  246. package/dist/presence/peer-health.js +118 -0
  247. package/dist/presence/peer-health.js.map +1 -0
  248. package/dist/protocol/canonical.d.ts +10 -0
  249. package/dist/protocol/canonical.d.ts.map +1 -0
  250. package/dist/protocol/canonical.js +32 -0
  251. package/dist/protocol/canonical.js.map +1 -0
  252. package/dist/protocol/crypto.d.ts +299 -0
  253. package/dist/protocol/crypto.d.ts.map +1 -0
  254. package/dist/protocol/crypto.js +739 -0
  255. package/dist/protocol/crypto.js.map +1 -0
  256. package/dist/protocol/index.d.ts +30 -0
  257. package/dist/protocol/index.d.ts.map +1 -0
  258. package/dist/protocol/index.js +116 -0
  259. package/dist/protocol/index.js.map +1 -0
  260. package/dist/protocol/utils.d.ts +5 -0
  261. package/dist/protocol/utils.d.ts.map +1 -0
  262. package/dist/protocol/utils.js +27 -0
  263. package/dist/protocol/utils.js.map +1 -0
  264. package/dist/salones/manager.d.ts +100 -0
  265. package/dist/salones/manager.d.ts.map +1 -0
  266. package/dist/salones/manager.js +240 -0
  267. package/dist/salones/manager.js.map +1 -0
  268. package/dist/security/rate-limiter.d.ts +13 -0
  269. package/dist/security/rate-limiter.d.ts.map +1 -0
  270. package/dist/security/rate-limiter.js +32 -0
  271. package/dist/security/rate-limiter.js.map +1 -0
  272. package/dist/snapshot/index.d.ts +90 -0
  273. package/dist/snapshot/index.d.ts.map +1 -0
  274. package/dist/snapshot/index.js +189 -0
  275. package/dist/snapshot/index.js.map +1 -0
  276. package/dist/storage/index.d.ts +49 -0
  277. package/dist/storage/index.d.ts.map +1 -0
  278. package/dist/storage/index.js +192 -0
  279. package/dist/storage/index.js.map +1 -0
  280. package/dist/storage/optimizer.d.ts +28 -0
  281. package/dist/storage/optimizer.d.ts.map +1 -0
  282. package/dist/storage/optimizer.js +71 -0
  283. package/dist/storage/optimizer.js.map +1 -0
  284. package/dist/storage/ydoc-persistence.d.ts +27 -0
  285. package/dist/storage/ydoc-persistence.d.ts.map +1 -0
  286. package/dist/storage/ydoc-persistence.js +128 -0
  287. package/dist/storage/ydoc-persistence.js.map +1 -0
  288. package/dist/sync/ChunkSyncManager.d.ts +41 -0
  289. package/dist/sync/ChunkSyncManager.d.ts.map +1 -0
  290. package/dist/sync/ChunkSyncManager.js +115 -0
  291. package/dist/sync/ChunkSyncManager.js.map +1 -0
  292. package/dist/sync/conflict-resolver.d.ts +33 -0
  293. package/dist/sync/conflict-resolver.d.ts.map +1 -0
  294. package/dist/sync/conflict-resolver.js +54 -0
  295. package/dist/sync/conflict-resolver.js.map +1 -0
  296. package/dist/sync/engine.d.ts +168 -0
  297. package/dist/sync/engine.d.ts.map +1 -0
  298. package/dist/sync/engine.js +315 -0
  299. package/dist/sync/engine.js.map +1 -0
  300. package/dist/sync/index.d.ts +3 -0
  301. package/dist/sync/index.d.ts.map +1 -0
  302. package/dist/sync/index.js +3 -0
  303. package/dist/sync/index.js.map +1 -0
  304. package/dist/transport/TorTransportAdapter.d.ts +70 -0
  305. package/dist/transport/TorTransportAdapter.d.ts.map +1 -0
  306. package/dist/transport/TorTransportAdapter.js +192 -0
  307. package/dist/transport/TorTransportAdapter.js.map +1 -0
  308. package/dist/transport/memory.d.ts +31 -0
  309. package/dist/transport/memory.d.ts.map +1 -0
  310. package/dist/transport/memory.js +114 -0
  311. package/dist/transport/memory.js.map +1 -0
  312. package/dist/transport/peerjs.d.ts +52 -0
  313. package/dist/transport/peerjs.d.ts.map +1 -0
  314. package/dist/transport/peerjs.js +336 -0
  315. package/dist/transport/peerjs.js.map +1 -0
  316. package/dist/transport/pqc-handshake.d.ts +72 -0
  317. package/dist/transport/pqc-handshake.d.ts.map +1 -0
  318. package/dist/transport/pqc-handshake.js +129 -0
  319. package/dist/transport/pqc-handshake.js.map +1 -0
  320. package/dist/transport/relay-config.d.ts +11 -0
  321. package/dist/transport/relay-config.d.ts.map +1 -0
  322. package/dist/transport/relay-config.js +48 -0
  323. package/dist/transport/relay-config.js.map +1 -0
  324. package/dist/transport/relay-server.d.ts +37 -0
  325. package/dist/transport/relay-server.d.ts.map +1 -0
  326. package/dist/transport/relay-server.js +246 -0
  327. package/dist/transport/relay-server.js.map +1 -0
  328. package/dist/transport/tor.d.ts +47 -0
  329. package/dist/transport/tor.d.ts.map +1 -0
  330. package/dist/transport/tor.js +158 -0
  331. package/dist/transport/tor.js.map +1 -0
  332. package/dist/transport/types.d.ts +34 -0
  333. package/dist/transport/types.d.ts.map +1 -0
  334. package/dist/transport/types.js +2 -0
  335. package/dist/transport/types.js.map +1 -0
  336. package/dist/types/index.d.ts +293 -0
  337. package/dist/types/index.d.ts.map +1 -0
  338. package/dist/types/index.js +73 -0
  339. package/dist/types/index.js.map +1 -0
  340. package/dist/web/admission.d.ts +24 -0
  341. package/dist/web/admission.d.ts.map +1 -0
  342. package/dist/web/admission.js +41 -0
  343. package/dist/web/admission.js.map +1 -0
  344. package/dist/web/crypto.d.ts +18 -0
  345. package/dist/web/crypto.d.ts.map +1 -0
  346. package/dist/web/crypto.js +78 -0
  347. package/dist/web/crypto.js.map +1 -0
  348. package/dist/web/exchange.d.ts +23 -0
  349. package/dist/web/exchange.d.ts.map +1 -0
  350. package/dist/web/exchange.js +54 -0
  351. package/dist/web/exchange.js.map +1 -0
  352. package/dist/web/fragment.d.ts +58 -0
  353. package/dist/web/fragment.d.ts.map +1 -0
  354. package/dist/web/fragment.js +198 -0
  355. package/dist/web/fragment.js.map +1 -0
  356. package/dist/web/index.d.ts +25 -0
  357. package/dist/web/index.d.ts.map +1 -0
  358. package/dist/web/index.js +14 -0
  359. package/dist/web/index.js.map +1 -0
  360. package/dist/web/merge/index.d.ts +104 -0
  361. package/dist/web/merge/index.d.ts.map +1 -0
  362. package/dist/web/merge/index.js +236 -0
  363. package/dist/web/merge/index.js.map +1 -0
  364. package/dist/web/oplog/hlc.d.ts +19 -0
  365. package/dist/web/oplog/hlc.d.ts.map +1 -0
  366. package/dist/web/oplog/hlc.js +39 -0
  367. package/dist/web/oplog/hlc.js.map +1 -0
  368. package/dist/web/oplog/index.d.ts +10 -0
  369. package/dist/web/oplog/index.d.ts.map +1 -0
  370. package/dist/web/oplog/index.js +6 -0
  371. package/dist/web/oplog/index.js.map +1 -0
  372. package/dist/web/oplog/log.d.ts +182 -0
  373. package/dist/web/oplog/log.d.ts.map +1 -0
  374. package/dist/web/oplog/log.js +693 -0
  375. package/dist/web/oplog/log.js.map +1 -0
  376. package/dist/web/oplog/store.d.ts +40 -0
  377. package/dist/web/oplog/store.d.ts.map +1 -0
  378. package/dist/web/oplog/store.js +85 -0
  379. package/dist/web/oplog/store.js.map +1 -0
  380. package/dist/web/oplog/sync.d.ts +54 -0
  381. package/dist/web/oplog/sync.d.ts.map +1 -0
  382. package/dist/web/oplog/sync.js +162 -0
  383. package/dist/web/oplog/sync.js.map +1 -0
  384. package/dist/web/oplog/types.d.ts +119 -0
  385. package/dist/web/oplog/types.d.ts.map +1 -0
  386. package/dist/web/oplog/types.js +2 -0
  387. package/dist/web/oplog/types.js.map +1 -0
  388. package/dist/web/pairing.d.ts +186 -0
  389. package/dist/web/pairing.d.ts.map +1 -0
  390. package/dist/web/pairing.js +395 -0
  391. package/dist/web/pairing.js.map +1 -0
  392. package/dist/web/pq.d.ts +36 -0
  393. package/dist/web/pq.d.ts.map +1 -0
  394. package/dist/web/pq.js +59 -0
  395. package/dist/web/pq.js.map +1 -0
  396. package/dist/web/provider.d.ts +188 -0
  397. package/dist/web/provider.d.ts.map +1 -0
  398. package/dist/web/provider.js +2042 -0
  399. package/dist/web/provider.js.map +1 -0
  400. package/dist/web/rooms.d.ts +20 -0
  401. package/dist/web/rooms.d.ts.map +1 -0
  402. package/dist/web/rooms.js +51 -0
  403. package/dist/web/rooms.js.map +1 -0
  404. package/dist/web/rotation.d.ts +73 -0
  405. package/dist/web/rotation.d.ts.map +1 -0
  406. package/dist/web/rotation.js +130 -0
  407. package/dist/web/rotation.js.map +1 -0
  408. package/dist/web/secstate.d.ts +213 -0
  409. package/dist/web/secstate.d.ts.map +1 -0
  410. package/dist/web/secstate.js +789 -0
  411. package/dist/web/secstate.js.map +1 -0
  412. package/dist/web/store.d.ts +9 -0
  413. package/dist/web/store.d.ts.map +1 -0
  414. package/dist/web/store.js +32 -0
  415. package/dist/web/store.js.map +1 -0
  416. package/dist/web/transports/loopback.d.ts +11 -0
  417. package/dist/web/transports/loopback.d.ts.map +1 -0
  418. package/dist/web/transports/loopback.js +97 -0
  419. package/dist/web/transports/loopback.js.map +1 -0
  420. package/dist/web/transports/qr-sdp.d.ts +27 -0
  421. package/dist/web/transports/qr-sdp.d.ts.map +1 -0
  422. package/dist/web/transports/qr-sdp.js +131 -0
  423. package/dist/web/transports/qr-sdp.js.map +1 -0
  424. package/dist/web/transports/ws.d.ts +12 -0
  425. package/dist/web/transports/ws.d.ts.map +1 -0
  426. package/dist/web/transports/ws.js +139 -0
  427. package/dist/web/transports/ws.js.map +1 -0
  428. package/dist/web/trust/canonical.d.ts +8 -0
  429. package/dist/web/trust/canonical.d.ts.map +1 -0
  430. package/dist/web/trust/canonical.js +27 -0
  431. package/dist/web/trust/canonical.js.map +1 -0
  432. package/dist/web/trust/docs.d.ts +51 -0
  433. package/dist/web/trust/docs.d.ts.map +1 -0
  434. package/dist/web/trust/docs.js +170 -0
  435. package/dist/web/trust/docs.js.map +1 -0
  436. package/dist/web/trust/index.d.ts +10 -0
  437. package/dist/web/trust/index.d.ts.map +1 -0
  438. package/dist/web/trust/index.js +7 -0
  439. package/dist/web/trust/index.js.map +1 -0
  440. package/dist/web/trust/keys.d.ts +37 -0
  441. package/dist/web/trust/keys.d.ts.map +1 -0
  442. package/dist/web/trust/keys.js +75 -0
  443. package/dist/web/trust/keys.js.map +1 -0
  444. package/dist/web/trust/store.d.ts +150 -0
  445. package/dist/web/trust/store.d.ts.map +1 -0
  446. package/dist/web/trust/store.js +587 -0
  447. package/dist/web/trust/store.js.map +1 -0
  448. package/dist/web/trust/types.d.ts +134 -0
  449. package/dist/web/trust/types.d.ts.map +1 -0
  450. package/dist/web/trust/types.js +4 -0
  451. package/dist/web/trust/types.js.map +1 -0
  452. package/dist/web/types.d.ts +115 -0
  453. package/dist/web/types.d.ts.map +1 -0
  454. package/dist/web/types.js +2 -0
  455. package/dist/web/types.js.map +1 -0
  456. package/dist/web/util.d.ts +12 -0
  457. package/dist/web/util.d.ts.map +1 -0
  458. package/dist/web/util.js +54 -0
  459. package/dist/web/util.js.map +1 -0
  460. package/dist/web/webrtc.d.ts +35 -0
  461. package/dist/web/webrtc.d.ts.map +1 -0
  462. package/dist/web/webrtc.js +304 -0
  463. package/dist/web/webrtc.js.map +1 -0
  464. package/package.json +139 -4
@@ -0,0 +1,218 @@
1
+ /**
2
+ * Wire format for the medical layer — the seam Phase 1 left open.
3
+ *
4
+ * ─── THE HOLE THIS FILE CLOSES ─────────────────────────────────────────────
5
+ *
6
+ * `src/medico/` defined the data model and its pure validation, but a
7
+ * `CredencialMedica` could not leave the node that made it: `TIPO_MENSAJE` had
8
+ * no member for it, and nothing could put one inside an `Envolvente`. The model
9
+ * existed; the road out of it did not. This file builds the road, and only the
10
+ * road — it invents no transport and edits no mesh file.
11
+ *
12
+ * ─── WHY THE BYTES ARE RE-ENCODED AND NOT JSON-SUMMONED ─────────────────────
13
+ *
14
+ * `cifrarPayload` seals `JSON.stringify(env.payload)`. `JSON.stringify` turns a
15
+ * `Uint8Array` into `{"0":12,"1":34,…}` — an object of indices, not bytes. A
16
+ * signature sealed that way could not be reconstructed on the far side, so every
17
+ * byte field (two ML-DSA signatures and the sealed licence number) is hex-encoded
18
+ * through `canonica.ts` before it enters the payload and decoded on the way out.
19
+ * `bytesAHex`/`hexABytes` are the same primitives `canonica.ts` already signs
20
+ * with, so "the bytes the signature covers" and "the bytes that travel" come out
21
+ * of one implementation instead of two that must agree.
22
+ *
23
+ * ─── ORDER OF OPERATIONS IS NOT A STYLE CHOICE ──────────────────────────────
24
+ *
25
+ * Serialise → SEAL → SIGN. `cifrarPayload` binds the envelope header into the
26
+ * AEAD, and `signEnvelope` signs `canonicalEnvelopeBytes`, which covers
27
+ * `payload`. Signing first would leave the ciphertext outside the signature and
28
+ * let anyone re-seal a payload under the same signature; so the seal happens
29
+ * first and the returned envelope is the one that gets signed. On the receiving
30
+ * side the order inverts: shape, then envelope signature, then decrypt, then the
31
+ * record's own signature.
32
+ *
33
+ * ─── WHAT IS DELIBERATELY NOT HERE ─────────────────────────────────────────
34
+ *
35
+ * There is no `transmitirCredencial` on the mesh, because writing one means
36
+ * editing `src/mesh/index.ts` next to `transmitirKarma`, which another owner
37
+ * owns. {@link aPayloadGossipMedico} produces exactly the object
38
+ * `MeshManager.transmitirConGossip(namespace, payload)` takes, so wiring it up is
39
+ * a one-line method on the mesh rather than a redesign.
40
+ *
41
+ * Pure and testable: the clock and the randomness live inside `createEnvelope`,
42
+ * and everything else is injected, so the whole roundtrip runs on fixtures with
43
+ * no network and no filesystem.
44
+ */
45
+ import type { ParPublico, PostQuantumIdentity } from "../identity/index.js";
46
+ import { GuardiaReplay, type SesionCifrada } from "../protocol/crypto.js";
47
+ import type { Envolvente, NodoId } from "../types/index.js";
48
+ import type { InstantaneaRegistroPais } from "./registro.js";
49
+ import type { Aval, CredencialMedica } from "./types.js";
50
+ /**
51
+ * Why a medical message was refused. Every value means the record was NOT
52
+ * applied. There is no third state — the same fail-closed rule as
53
+ * `validarCredencial`: a peer must never be able to tell "malformed" from
54
+ * "unknown" and act differently on the two.
55
+ */
56
+ export declare const MOTIVO_RECHAZO_MALLA: {
57
+ /** The envelope shape itself is invalid (`validateEnvelope` failed). */
58
+ readonly ENVOLVENTE_INVALIDA: "envolvente_invalida";
59
+ /** The envelope's ML-DSA signature does not verify against the sender's key. */
60
+ readonly FIRMA_ENVOLVENTE_INVALIDA: "firma_envolvente_invalida";
61
+ /** The envelope is not a sealed payload, or the AEAD rejected it. */
62
+ readonly PAYLOAD_NO_CIFRADO: "payload_no_cifrado";
63
+ /** The plaintext payload is not the record type this message type declares. */
64
+ readonly PAYLOAD_MALFORMADO: "payload_malformado";
65
+ /** The record's own signature does not verify against its claimed issuer. */
66
+ readonly FIRMA_REGISTRO_INVALIDA: "firma_registro_invalida";
67
+ };
68
+ export type MotivoRechazoMalla = (typeof MOTIVO_RECHAZO_MALLA)[keyof typeof MOTIVO_RECHAZO_MALLA];
69
+ /** Fail-closed outcome. `ok: true` is the only way a record reaches a caller. */
70
+ export type ResultadoRecepcion<T> = {
71
+ readonly ok: true;
72
+ readonly registro: T;
73
+ } | {
74
+ readonly ok: false;
75
+ readonly motivo: MotivoRechazoMalla;
76
+ readonly detalle: string;
77
+ };
78
+ /**
79
+ * `CredencialMedica` with `Uint8Array` fields as hex. An optional field that was
80
+ * absent stays absent: `hexABytes(undefined)` throws, and an absent optional must
81
+ * not come back as a present zero-length one.
82
+ */
83
+ export interface CredencialMedicaWire {
84
+ readonly id: string;
85
+ readonly tipo: string;
86
+ readonly pais: string;
87
+ readonly autoridad: string;
88
+ readonly idLicencia: string;
89
+ readonly numeroLicenciaCifrado?: string;
90
+ readonly especialidad?: string;
91
+ readonly emitidoEn: number;
92
+ readonly vigenteHasta: number;
93
+ readonly estadoEmision: string;
94
+ readonly firma: string;
95
+ readonly emisor: NodoId;
96
+ }
97
+ export interface MetodoVerificacionWire {
98
+ readonly clase: string;
99
+ readonly pais?: string;
100
+ readonly versionRegistro?: string;
101
+ readonly ref?: string;
102
+ readonly desde?: number;
103
+ readonly hasta?: number;
104
+ }
105
+ export interface AvalWire {
106
+ readonly id: string;
107
+ readonly version: number;
108
+ readonly avalador: NodoId;
109
+ readonly avalado: NodoId;
110
+ readonly objetoAval: string;
111
+ readonly credencialRef: string;
112
+ readonly hashCredencial: string;
113
+ readonly metodoVerificacion: MetodoVerificacionWire;
114
+ readonly evidenciaHash: string;
115
+ readonly alcance: string;
116
+ readonly emitidoEn: number;
117
+ readonly vigenteHasta: number;
118
+ readonly revocable: true;
119
+ readonly firma: string;
120
+ }
121
+ /**
122
+ * A registry snapshot travels as a **sorted array of hashes**, never a `Set`.
123
+ *
124
+ * A `Set` is not JSON-serialisable, and its iteration order is insertion order —
125
+ * two nodes holding the same snapshot in a different insertion order would sign
126
+ * different bytes for identical content. Sorting is what makes the snapshot
127
+ * hash-addressable at all.
128
+ */
129
+ export interface RegistroPaisWire {
130
+ readonly pais: string;
131
+ readonly version: string;
132
+ readonly hashes: readonly string[];
133
+ }
134
+ export declare function credencialAWire(credencial: CredencialMedica): CredencialMedicaWire;
135
+ export declare function avalAWire(aval: Aval): AvalWire;
136
+ export declare function registroAWire(instantanea: InstantaneaRegistroPais): RegistroPaisWire;
137
+ /**
138
+ * Inverse of {@link credencialAWire}.
139
+ *
140
+ * Takes `unknown` on purpose. The value arrives from a decrypted payload, so it
141
+ * is attacker-influenced data: narrowing it by assertion here would push the
142
+ * check to the caller, and a caller that forgets becomes the hole. The shape
143
+ * assertion is cheap, and `validarCredencial` still runs before the record counts
144
+ * as anything.
145
+ *
146
+ * @throws TypeError on a malformed wire payload.
147
+ */
148
+ export declare function wireACredencial(wire: unknown): CredencialMedica;
149
+ /**
150
+ * Inverse of {@link avalAWire}. Takes `unknown` for the same trust-boundary
151
+ * reason as {@link wireACredencial}.
152
+ *
153
+ * @throws TypeError on a malformed wire payload.
154
+ */
155
+ export declare function wireAAval(wire: unknown): Aval;
156
+ /**
157
+ * What a sender needs: an identity to sign with and the encryption session the
158
+ * payload is sealed under. Injected rather than imported so this module never
159
+ * reaches into the mesh for a session it does not own.
160
+ */
161
+ export interface OpcionesEmitir {
162
+ /** Signs the sealed envelope. */
163
+ readonly identidad: PostQuantumIdentity;
164
+ /** Session whose AEAD key the payload is sealed under. */
165
+ readonly sesion: SesionCifrada;
166
+ /** Addressed recipient. Defaults to `'*'` (gossip: anyone may relay). */
167
+ readonly destino?: NodoId;
168
+ }
169
+ /** A sealed, signed envelope plus the session advanced past it. */
170
+ export interface EmisionMedica {
171
+ readonly env: Envolvente;
172
+ readonly sesion: SesionCifrada;
173
+ }
174
+ export declare function emitirCredencial(credencial: CredencialMedica, opciones: OpcionesEmitir): Promise<EmisionMedica>;
175
+ export declare function emitirAval(aval: Aval, opciones: OpcionesEmitir): Promise<EmisionMedica>;
176
+ export declare function emitirRegistro(instantanea: InstantaneaRegistroPais, opciones: OpcionesEmitir): Promise<EmisionMedica>;
177
+ /** What a receiver needs to check a message it did not create. */
178
+ export interface OpcionesRecibir {
179
+ readonly sesion: SesionCifrada;
180
+ /** Replay protection. Supply one to share a window across messages. */
181
+ readonly guardia?: GuardiaReplay;
182
+ /** The sender's identity, to verify the envelope signature. */
183
+ readonly identidadEmisor: PostQuantumIdentity;
184
+ readonly parPublicoEmisor: ParPublico;
185
+ }
186
+ /**
187
+ * Receive and fully verify a credential.
188
+ *
189
+ * @param verificarFirma pass `false` only when the caller has already established
190
+ * the issuer's key by another route; the default re-checks the record's own
191
+ * signature, which is what binds the claim to `emisor`.
192
+ */
193
+ export declare function recibirCredencial(env: Envolvente, opciones: OpcionesRecibir, verificarFirma?: boolean): Promise<ResultadoRecepcion<CredencialMedica>>;
194
+ /** Receive and fully verify an endorsement. Mirrors {@link recibirCredencial}. */
195
+ export declare function recibirAval(env: Envolvente, opciones: OpcionesRecibir, verificarFirma?: boolean): Promise<ResultadoRecepcion<Aval>>;
196
+ /**
197
+ * Discriminator for the gossip payload, mirroring `PAYLOAD_KARMA_TIPO` in
198
+ * `src/mesh/index.ts`. Namespaced so a medical message is never mistaken for
199
+ * another gossip payload kind by a listener that dispatches on `tipo`.
200
+ */
201
+ export declare const PAYLOAD_MEDICO_TIPO: "medico:v1";
202
+ /**
203
+ * Exactly the object `MeshManager.transmitirConGossip(namespace, payload)` already
204
+ * accepts, so wiring the medical layer into gossip is one method next to
205
+ * `transmitirKarma` — not a transport change, and not this file's job.
206
+ *
207
+ * The envelope travels **whole**, sealed and signed, because a gossip `payload`
208
+ * slot is opaque and the node that finally reads a relayed message is not
209
+ * necessarily the one the session was established with: it cannot open the
210
+ * ciphertext. Confidentiality therefore holds for the direct leg only, and a
211
+ * relayed credential arrives still sealed — which is why routing a relayed record
212
+ * needs per-hop re-sealing, not just a `transmitir` call.
213
+ */
214
+ export declare function aPayloadGossipMedico(env: Envolvente): {
215
+ readonly tipo: typeof PAYLOAD_MEDICO_TIPO;
216
+ readonly env: Envolvente;
217
+ };
218
+ //# sourceMappingURL=malla.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"malla.d.ts","sourceRoot":"","sources":["../../src/medico/malla.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EAGN,aAAa,EACb,K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OAAO,CAAC,aAAa,CAAC,CAExB;AAID,kEAAkE;AAClE,MAAM,WAAW,eAAe;IAC/B,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;IAC/B,uEAAuE;IACvE,QAAQ,CAAC,OAAO,CAAC,EAAE,aAAa,CAAC;IACjC,+DAA+D;IAC/D,QAAQ,CAAC,eAAe,EAAE,mBAAmB,CAAC;IAC9C,QAAQ,CAAC,gBAAgB,EAAE,UAAU,CAAC;CACtC;AA0ED;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CACtC,GAAG,EAAE,UAAU,EACf,QAAQ,EAAE,eAAe,EACzB,cAAc,UAAO,GACnB,OAAO,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,CAAC,CAqB/C;AAED,kFAAkF;AAClF,wBAAsB,WAAW,CAChC,GAAG,EAAE,UAAU,EACf,QAAQ,EAAE,eAAe,EACzB,cAAc,UAAO,GACnB,OAAO,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC,CAgBnC;AAID;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,EAAG,WAAoB,CAAC;AAExD;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,UAAU,GAAG;IACtD,QAAQ,CAAC,IAAI,EAAE,OAAO,mBAAmB,CAAC;IAC1C,QAAQ,CAAC,GAAG,EAAE,UAAU,CAAC;CACzB,CAEA"}
@@ -0,0 +1,347 @@
1
+ /**
2
+ * Wire format for the medical layer — the seam Phase 1 left open.
3
+ *
4
+ * ─── THE HOLE THIS FILE CLOSES ─────────────────────────────────────────────
5
+ *
6
+ * `src/medico/` defined the data model and its pure validation, but a
7
+ * `CredencialMedica` could not leave the node that made it: `TIPO_MENSAJE` had
8
+ * no member for it, and nothing could put one inside an `Envolvente`. The model
9
+ * existed; the road out of it did not. This file builds the road, and only the
10
+ * road — it invents no transport and edits no mesh file.
11
+ *
12
+ * ─── WHY THE BYTES ARE RE-ENCODED AND NOT JSON-SUMMONED ─────────────────────
13
+ *
14
+ * `cifrarPayload` seals `JSON.stringify(env.payload)`. `JSON.stringify` turns a
15
+ * `Uint8Array` into `{"0":12,"1":34,…}` — an object of indices, not bytes. A
16
+ * signature sealed that way could not be reconstructed on the far side, so every
17
+ * byte field (two ML-DSA signatures and the sealed licence number) is hex-encoded
18
+ * through `canonica.ts` before it enters the payload and decoded on the way out.
19
+ * `bytesAHex`/`hexABytes` are the same primitives `canonica.ts` already signs
20
+ * with, so "the bytes the signature covers" and "the bytes that travel" come out
21
+ * of one implementation instead of two that must agree.
22
+ *
23
+ * ─── ORDER OF OPERATIONS IS NOT A STYLE CHOICE ──────────────────────────────
24
+ *
25
+ * Serialise → SEAL → SIGN. `cifrarPayload` binds the envelope header into the
26
+ * AEAD, and `signEnvelope` signs `canonicalEnvelopeBytes`, which covers
27
+ * `payload`. Signing first would leave the ciphertext outside the signature and
28
+ * let anyone re-seal a payload under the same signature; so the seal happens
29
+ * first and the returned envelope is the one that gets signed. On the receiving
30
+ * side the order inverts: shape, then envelope signature, then decrypt, then the
31
+ * record's own signature.
32
+ *
33
+ * ─── WHAT IS DELIBERATELY NOT HERE ─────────────────────────────────────────
34
+ *
35
+ * There is no `transmitirCredencial` on the mesh, because writing one means
36
+ * editing `src/mesh/index.ts` next to `transmitirKarma`, which another owner
37
+ * owns. {@link aPayloadGossipMedico} produces exactly the object
38
+ * `MeshManager.transmitirConGossip(namespace, payload)` takes, so wiring it up is
39
+ * a one-line method on the mesh rather than a redesign.
40
+ *
41
+ * Pure and testable: the clock and the randomness live inside `createEnvelope`,
42
+ * and everything else is injected, so the whole roundtrip runs on fixtures with
43
+ * no network and no filesystem.
44
+ */
45
+ import { abrirPayload, cifrarYSiguiente, GuardiaReplay, } from "../protocol/crypto.js";
46
+ import { createEnvelope, signEnvelope, validateEnvelope, verifyEnvelopeSignature, } from "../protocol/index.js";
47
+ import { TIPO_MENSAJE } from "../types/index.js";
48
+ import { verificarFirmaAval } from "./aval.js";
49
+ import { bytesAHex, hexABytes } from "./canonica.js";
50
+ import { verificarFirmaCredencial } from "./credencial.js";
51
+ // ─── REJECTION REASONS ──────────────────────────────────────────────────────
52
+ /**
53
+ * Why a medical message was refused. Every value means the record was NOT
54
+ * applied. There is no third state — the same fail-closed rule as
55
+ * `validarCredencial`: a peer must never be able to tell "malformed" from
56
+ * "unknown" and act differently on the two.
57
+ */
58
+ export const MOTIVO_RECHAZO_MALLA = {
59
+ /** The envelope shape itself is invalid (`validateEnvelope` failed). */
60
+ ENVOLVENTE_INVALIDA: "envolvente_invalida",
61
+ /** The envelope's ML-DSA signature does not verify against the sender's key. */
62
+ FIRMA_ENVOLVENTE_INVALIDA: "firma_envolvente_invalida",
63
+ /** The envelope is not a sealed payload, or the AEAD rejected it. */
64
+ PAYLOAD_NO_CIFRADO: "payload_no_cifrado",
65
+ /** The plaintext payload is not the record type this message type declares. */
66
+ PAYLOAD_MALFORMADO: "payload_malformado",
67
+ /** The record's own signature does not verify against its claimed issuer. */
68
+ FIRMA_REGISTRO_INVALIDA: "firma_registro_invalida",
69
+ };
70
+ function fallo(motivo, detalle) {
71
+ return { ok: false, motivo, detalle };
72
+ }
73
+ export function credencialAWire(credencial) {
74
+ return {
75
+ id: credencial.id,
76
+ tipo: credencial.tipo,
77
+ pais: credencial.pais,
78
+ autoridad: credencial.autoridad,
79
+ idLicencia: credencial.idLicencia,
80
+ ...(credencial.numeroLicenciaCifrado
81
+ ? { numeroLicenciaCifrado: bytesAHex(credencial.numeroLicenciaCifrado) }
82
+ : {}),
83
+ ...(credencial.especialidad === undefined
84
+ ? {}
85
+ : { especialidad: credencial.especialidad }),
86
+ emitidoEn: credencial.emitidoEn,
87
+ vigenteHasta: credencial.vigenteHasta,
88
+ estadoEmision: credencial.estadoEmision,
89
+ firma: bytesAHex(credencial.firma),
90
+ emisor: credencial.emisor,
91
+ };
92
+ }
93
+ export function avalAWire(aval) {
94
+ return {
95
+ id: aval.id,
96
+ version: aval.version,
97
+ avalador: aval.avalador,
98
+ avalado: aval.avalado,
99
+ objetoAval: aval.objetoAval,
100
+ credencialRef: aval.credencialRef,
101
+ hashCredencial: aval.hashCredencial,
102
+ metodoVerificacion: metodoAWire(aval.metodoVerificacion),
103
+ evidenciaHash: aval.evidenciaHash,
104
+ alcance: aval.alcance,
105
+ emitidoEn: aval.emitidoEn,
106
+ vigenteHasta: aval.vigenteHasta,
107
+ revocable: true,
108
+ firma: bytesAHex(aval.firma),
109
+ };
110
+ }
111
+ export function registroAWire(instantanea) {
112
+ return {
113
+ pais: instantanea.pais,
114
+ version: instantanea.version,
115
+ hashes: Array.from(instantanea.hashes).sort(),
116
+ };
117
+ }
118
+ /**
119
+ * Rebuild the discriminated union from its wire form.
120
+ *
121
+ * An explicit switch over `clase`, not a generic key copy, so an unknown class
122
+ * fails loudly instead of silently becoming an object that still type-checks as
123
+ * `MetodoVerificacion`. A copy-through is exactly where
124
+ * `metodoVerificacion.clase: 'inventada'` would slip into a validated record.
125
+ */
126
+ function wireAMetodo(wire) {
127
+ switch (wire.clase) {
128
+ case "registro_por_pais":
129
+ return {
130
+ clase: "registro_por_pais",
131
+ pais: wire.pais ?? "",
132
+ versionRegistro: wire.versionRegistro ?? "",
133
+ };
134
+ case "colegio_directo":
135
+ return { clase: "colegio_directo", ref: wire.ref ?? "" };
136
+ case "testimonio_directo":
137
+ return { clase: "testimonio_directo" };
138
+ case "supervision":
139
+ return {
140
+ clase: "supervision",
141
+ desde: wire.desde ?? 0,
142
+ hasta: wire.hasta ?? 0,
143
+ };
144
+ default:
145
+ throw new TypeError(`wireAMetodo: clase de verificación desconocida: ${String(wire.clase)}`);
146
+ }
147
+ }
148
+ function metodoAWire(metodo) {
149
+ switch (metodo.clase) {
150
+ case "registro_por_pais":
151
+ return {
152
+ clase: metodo.clase,
153
+ pais: metodo.pais,
154
+ versionRegistro: metodo.versionRegistro,
155
+ };
156
+ case "colegio_directo":
157
+ return { clase: metodo.clase, ref: metodo.ref };
158
+ case "testimonio_directo":
159
+ return { clase: metodo.clase };
160
+ case "supervision":
161
+ return { clase: metodo.clase, desde: metodo.desde, hasta: metodo.hasta };
162
+ }
163
+ }
164
+ function hexObligatorio(valor, campo) {
165
+ if (typeof valor !== "string" || valor.length === 0) {
166
+ throw new TypeError(`${campo}: se esperaba un string hex, recibido ${typeof valor}`);
167
+ }
168
+ return hexABytes(valor);
169
+ }
170
+ /**
171
+ * Inverse of {@link credencialAWire}.
172
+ *
173
+ * Takes `unknown` on purpose. The value arrives from a decrypted payload, so it
174
+ * is attacker-influenced data: narrowing it by assertion here would push the
175
+ * check to the caller, and a caller that forgets becomes the hole. The shape
176
+ * assertion is cheap, and `validarCredencial` still runs before the record counts
177
+ * as anything.
178
+ *
179
+ * @throws TypeError on a malformed wire payload.
180
+ */
181
+ export function wireACredencial(wire) {
182
+ if (wire === null || typeof wire !== "object")
183
+ throw new TypeError("wireACredencial: payload no es un objeto");
184
+ const w = wire;
185
+ return {
186
+ id: w.id,
187
+ tipo: w.tipo,
188
+ pais: w.pais,
189
+ autoridad: w.autoridad,
190
+ idLicencia: w.idLicencia,
191
+ ...(w.numeroLicenciaCifrado
192
+ ? { numeroLicenciaCifrado: hexABytes(w.numeroLicenciaCifrado) }
193
+ : {}),
194
+ ...(w.especialidad === undefined ? {} : { especialidad: w.especialidad }),
195
+ emitidoEn: w.emitidoEn,
196
+ vigenteHasta: w.vigenteHasta,
197
+ estadoEmision: w.estadoEmision,
198
+ firma: hexObligatorio(w.firma, "credencial.firma"),
199
+ emisor: w.emisor,
200
+ };
201
+ }
202
+ /**
203
+ * Inverse of {@link avalAWire}. Takes `unknown` for the same trust-boundary
204
+ * reason as {@link wireACredencial}.
205
+ *
206
+ * @throws TypeError on a malformed wire payload.
207
+ */
208
+ export function wireAAval(wire) {
209
+ if (wire === null || typeof wire !== "object")
210
+ throw new TypeError("wireAAval: payload no es un objeto");
211
+ const w = wire;
212
+ return {
213
+ id: w.id,
214
+ version: w.version,
215
+ avalador: w.avalador,
216
+ avalado: w.avalado,
217
+ objetoAval: w.objetoAval,
218
+ credencialRef: w.credencialRef,
219
+ hashCredencial: w.hashCredencial,
220
+ metodoVerificacion: wireAMetodo(w.metodoVerificacion),
221
+ evidenciaHash: w.evidenciaHash,
222
+ alcance: w.alcance,
223
+ emitidoEn: w.emitidoEn,
224
+ vigenteHasta: w.vigenteHasta,
225
+ revocable: true,
226
+ firma: hexObligatorio(w.firma, "aval.firma"),
227
+ };
228
+ }
229
+ /**
230
+ * Seal then sign. Shared by all three record types because the ordering
231
+ * constraint is identical for each; only the message type and the wire body
232
+ * vary.
233
+ */
234
+ async function emitir(tipo, cuerpo, opciones) {
235
+ // `cifrarYSiguiente` rather than `cifrarPayload` + a manual increment: it is
236
+ // the same two lines, but it also runs `assertContadorLibre` FIRST, so a
237
+ // reused counter is refused before anything is sealed instead of after.
238
+ const { env, sesion } = cifrarYSiguiente(createEnvelope(tipo, opciones.identidad.nodoId, opciones.destino ?? "*", cuerpo), opciones.sesion);
239
+ // Sign AFTER sealing: the ML-DSA signature must cover the ciphertext, not the
240
+ // plaintext that was just replaced by it.
241
+ return { env: await signEnvelope(env, opciones.identidad), sesion };
242
+ }
243
+ export function emitirCredencial(credencial, opciones) {
244
+ return emitir(TIPO_MENSAJE.CREDENCIAL, credencialAWire(credencial), opciones);
245
+ }
246
+ export function emitirAval(aval, opciones) {
247
+ return emitir(TIPO_MENSAJE.AVAL, avalAWire(aval), opciones);
248
+ }
249
+ export function emitirRegistro(instantanea, opciones) {
250
+ return emitir(TIPO_MENSAJE.REGISTRO, registroAWire(instantanea), opciones);
251
+ }
252
+ /**
253
+ * The shared receive prologue: shape → envelope signature → decrypt → rehydrate.
254
+ *
255
+ * `aplicarGuardia: false` is deliberate. The record's own ML-DSA signature is
256
+ * checked immediately afterwards, and a record that fails that check has not been
257
+ * accepted in any sense worth burning a replay counter over — the counter is
258
+ * one-shot per direction, so spending it on an unauthenticated record is how a
259
+ * peer gets its session wedged by junk. `abrirPayload` still refuses an
260
+ * out-of-window counter when `aplicarGuardia` is left on; idempotency of the
261
+ * record itself is carried by `Aval.id`, the key `canonica.ts#idAval` exists to
262
+ * provide.
263
+ */
264
+ async function recibir(env, tipoEsperado, opciones, aRegistro) {
265
+ // 1. Shape. Cheapest, and it refuses before any PQC work.
266
+ if (!validateEnvelope(env))
267
+ return fallo(MOTIVO_RECHAZO_MALLA.ENVOLVENTE_INVALIDA, "validateEnvelope rechazó la forma");
268
+ if (env.tipo !== tipoEsperado) {
269
+ return fallo(MOTIVO_RECHAZO_MALLA.PAYLOAD_MALFORMADO, `tipo ${env.tipo} donde se esperaba ${tipoEsperado}`);
270
+ }
271
+ // 2. Envelope signature, BEFORE decryption: an unsigned or forged envelope
272
+ // must not cost a Poly1305 open, let alone reach the record.
273
+ const firmaOk = await verifyEnvelopeSignature(env, opciones.parPublicoEmisor, opciones.identidadEmisor);
274
+ if (!firmaOk) {
275
+ return fallo(MOTIVO_RECHAZO_MALLA.FIRMA_ENVOLVENTE_INVALIDA, "la firma del envolvente no verifica contra la clave del emisor");
276
+ }
277
+ // 3. Open the AEAD.
278
+ let abierto;
279
+ try {
280
+ abierto = abrirPayload(env, opciones.sesion, opciones.guardia ?? new GuardiaReplay(), { aplicarGuardia: false });
281
+ }
282
+ catch (error) {
283
+ return fallo(MOTIVO_RECHAZO_MALLA.PAYLOAD_NO_CIFRADO, error instanceof Error ? error.message : String(error));
284
+ }
285
+ // 4. Rehydrate. A malformed body is a refusal, never a partial object.
286
+ try {
287
+ return { ok: true, registro: aRegistro(abierto.payload) };
288
+ }
289
+ catch (error) {
290
+ return fallo(MOTIVO_RECHAZO_MALLA.PAYLOAD_MALFORMADO, error instanceof Error ? error.message : String(error));
291
+ }
292
+ }
293
+ /**
294
+ * Receive and fully verify a credential.
295
+ *
296
+ * @param verificarFirma pass `false` only when the caller has already established
297
+ * the issuer's key by another route; the default re-checks the record's own
298
+ * signature, which is what binds the claim to `emisor`.
299
+ */
300
+ export async function recibirCredencial(env, opciones, verificarFirma = true) {
301
+ const base = await recibir(env, TIPO_MENSAJE.CREDENCIAL, opciones, wireACredencial);
302
+ if (!base.ok)
303
+ return base;
304
+ if (!verificarFirma)
305
+ return base;
306
+ const firmaOk = await verificarFirmaCredencial(base.registro, opciones.identidadEmisor, opciones.parPublicoEmisor);
307
+ if (!firmaOk) {
308
+ return fallo(MOTIVO_RECHAZO_MALLA.FIRMA_REGISTRO_INVALIDA, `la firma de la credencial no verifica contra la clave de ${base.registro.emisor}`);
309
+ }
310
+ return base;
311
+ }
312
+ /** Receive and fully verify an endorsement. Mirrors {@link recibirCredencial}. */
313
+ export async function recibirAval(env, opciones, verificarFirma = true) {
314
+ const base = await recibir(env, TIPO_MENSAJE.AVAL, opciones, wireAAval);
315
+ if (!base.ok)
316
+ return base;
317
+ if (!verificarFirma)
318
+ return base;
319
+ const firmaOk = await verificarFirmaAval(base.registro, opciones.identidadEmisor, opciones.parPublicoEmisor);
320
+ if (!firmaOk) {
321
+ return fallo(MOTIVO_RECHAZO_MALLA.FIRMA_REGISTRO_INVALIDA, `la firma del aval no verifica contra la clave de ${base.registro.avalador}`);
322
+ }
323
+ return base;
324
+ }
325
+ // ─── GOSSIP ADAPTER (no mesh file is edited) ────────────────────────────────
326
+ /**
327
+ * Discriminator for the gossip payload, mirroring `PAYLOAD_KARMA_TIPO` in
328
+ * `src/mesh/index.ts`. Namespaced so a medical message is never mistaken for
329
+ * another gossip payload kind by a listener that dispatches on `tipo`.
330
+ */
331
+ export const PAYLOAD_MEDICO_TIPO = "medico:v1";
332
+ /**
333
+ * Exactly the object `MeshManager.transmitirConGossip(namespace, payload)` already
334
+ * accepts, so wiring the medical layer into gossip is one method next to
335
+ * `transmitirKarma` — not a transport change, and not this file's job.
336
+ *
337
+ * The envelope travels **whole**, sealed and signed, because a gossip `payload`
338
+ * slot is opaque and the node that finally reads a relayed message is not
339
+ * necessarily the one the session was established with: it cannot open the
340
+ * ciphertext. Confidentiality therefore holds for the direct leg only, and a
341
+ * relayed credential arrives still sealed — which is why routing a relayed record
342
+ * needs per-hop re-sealing, not just a `transmitir` call.
343
+ */
344
+ export function aPayloadGossipMedico(env) {
345
+ return { tipo: PAYLOAD_MEDICO_TIPO, env };
346
+ }
347
+ //# sourceMappingURL=malla.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"malla.js","sourceRoot":"","sources":["../../src/medico/malla.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AAGH,OAAO,EACN,YAAY,EACZ,gBAAgB,EAChB,aAAa,GAEb,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACN,cAAc,EACd,YAAY,EACZ,gBAAgB,EAChB,uBAAuB,GACvB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAI3D,+EAA+E;AAE/E;;;;;GAKG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG;IACnC,wEAAwE;IACxE,mBAAmB,EAAE,qBAAqB;IAC1C,gFAAgF;IAChF,yBAAyB,EAAE,2BAA2B;IACtD,qEAAqE;IACrE,kBAAkB,EAAE,oBAAoB;IACxC,+EAA+E;IAC/E,kBAAkB,EAAE,oBAAoB;IACxC,6EAA6E;IAC7E,uBAAuB,EAAE,yBAAyB;CACzC,CAAC;AAaX,SAAS,KAAK,CACb,MAA0B,EAC1B,OAAe;IAEf,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;AACvC,CAAC;AAgED,MAAM,UAAU,eAAe,CAC9B,UAA4B;IAE5B,OAAO;QACN,EAAE,EAAE,UAAU,CAAC,EAAE;QACjB,IAAI,EAAE,UAAU,CAAC,IAAI;QACrB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