@swal/edge-mesh 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +128 -0
- package/NOTICE +37 -0
- package/README.md +470 -2
- package/dist/adapters/gpu-agent/index.d.ts +61 -0
- package/dist/adapters/gpu-agent/index.d.ts.map +1 -0
- package/dist/adapters/gpu-agent/index.js +364 -0
- package/dist/adapters/gpu-agent/index.js.map +1 -0
- package/dist/adapters/maloca-salud/citas-distribuidas.d.ts +19 -0
- package/dist/adapters/maloca-salud/citas-distribuidas.d.ts.map +1 -0
- package/dist/adapters/maloca-salud/citas-distribuidas.js +51 -0
- package/dist/adapters/maloca-salud/citas-distribuidas.js.map +1 -0
- package/dist/adapters/maloca-salud/eps-bridge.d.ts +15 -0
- package/dist/adapters/maloca-salud/eps-bridge.d.ts.map +1 -0
- package/dist/adapters/maloca-salud/eps-bridge.js +27 -0
- package/dist/adapters/maloca-salud/eps-bridge.js.map +1 -0
- package/dist/adapters/maloca-salud/patient-profile.d.ts +20 -0
- package/dist/adapters/maloca-salud/patient-profile.d.ts.map +1 -0
- package/dist/adapters/maloca-salud/patient-profile.js +36 -0
- package/dist/adapters/maloca-salud/patient-profile.js.map +1 -0
- package/dist/adapters/maloca-salud/types.d.ts +40 -0
- package/dist/adapters/maloca-salud/types.d.ts.map +1 -0
- package/dist/adapters/maloca-salud/types.js +2 -0
- package/dist/adapters/maloca-salud/types.js.map +1 -0
- package/dist/adapters/maloca-veeduria/contract-bridge.d.ts +31 -0
- package/dist/adapters/maloca-veeduria/contract-bridge.d.ts.map +1 -0
- package/dist/adapters/maloca-veeduria/contract-bridge.js +103 -0
- package/dist/adapters/maloca-veeduria/contract-bridge.js.map +1 -0
- package/dist/adapters/maloca-veeduria/evidentia-veeduria.d.ts +14 -0
- package/dist/adapters/maloca-veeduria/evidentia-veeduria.d.ts.map +1 -0
- package/dist/adapters/maloca-veeduria/evidentia-veeduria.js +40 -0
- package/dist/adapters/maloca-veeduria/evidentia-veeduria.js.map +1 -0
- package/dist/adapters/maloca-veeduria/licitante-profile.d.ts +21 -0
- package/dist/adapters/maloca-veeduria/licitante-profile.d.ts.map +1 -0
- package/dist/adapters/maloca-veeduria/licitante-profile.js +58 -0
- package/dist/adapters/maloca-veeduria/licitante-profile.js.map +1 -0
- package/dist/adapters/maloca-veeduria/types.d.ts +30 -0
- package/dist/adapters/maloca-veeduria/types.d.ts.map +1 -0
- package/dist/adapters/maloca-veeduria/types.js +2 -0
- package/dist/adapters/maloca-veeduria/types.js.map +1 -0
- package/dist/adapters/maloca-xavier/agent-profile.d.ts +32 -0
- package/dist/adapters/maloca-xavier/agent-profile.d.ts.map +1 -0
- package/dist/adapters/maloca-xavier/agent-profile.js +56 -0
- package/dist/adapters/maloca-xavier/agent-profile.js.map +1 -0
- package/dist/adapters/maloca-xavier/codegraph-bridge.d.ts +27 -0
- package/dist/adapters/maloca-xavier/codegraph-bridge.d.ts.map +1 -0
- package/dist/adapters/maloca-xavier/codegraph-bridge.js +58 -0
- package/dist/adapters/maloca-xavier/codegraph-bridge.js.map +1 -0
- package/dist/adapters/maloca-xavier/llm-router.d.ts +25 -0
- package/dist/adapters/maloca-xavier/llm-router.d.ts.map +1 -0
- package/dist/adapters/maloca-xavier/llm-router.js +58 -0
- package/dist/adapters/maloca-xavier/llm-router.js.map +1 -0
- package/dist/authz/index.d.ts +81 -0
- package/dist/authz/index.d.ts.map +1 -0
- package/dist/authz/index.js +271 -0
- package/dist/authz/index.js.map +1 -0
- package/dist/chat/index.d.ts +138 -0
- package/dist/chat/index.d.ts.map +1 -0
- package/dist/chat/index.js +394 -0
- package/dist/chat/index.js.map +1 -0
- package/dist/chat/offline-queue.d.ts +32 -0
- package/dist/chat/offline-queue.d.ts.map +1 -0
- package/dist/chat/offline-queue.js +93 -0
- package/dist/chat/offline-queue.js.map +1 -0
- package/dist/core/DefaultEdgeMeshNode.d.ts +17 -0
- package/dist/core/DefaultEdgeMeshNode.d.ts.map +1 -0
- package/dist/core/DefaultEdgeMeshNode.js +57 -0
- package/dist/core/DefaultEdgeMeshNode.js.map +1 -0
- package/dist/core/node.d.ts +26 -0
- package/dist/core/node.d.ts.map +1 -0
- package/dist/core/node.js +16 -0
- package/dist/core/node.js.map +1 -0
- package/dist/edge-mesh.d.ts +139 -0
- package/dist/edge-mesh.d.ts.map +1 -0
- package/dist/edge-mesh.js +1146 -0
- package/dist/edge-mesh.js.map +1 -0
- package/dist/gos/GosBridge.d.ts +49 -0
- package/dist/gos/GosBridge.d.ts.map +1 -0
- package/dist/gos/GosBridge.js +133 -0
- package/dist/gos/GosBridge.js.map +1 -0
- package/dist/governance/authority.d.ts +44 -0
- package/dist/governance/authority.d.ts.map +1 -0
- package/dist/governance/authority.js +123 -0
- package/dist/governance/authority.js.map +1 -0
- package/dist/governance/index.d.ts +66 -0
- package/dist/governance/index.d.ts.map +1 -0
- package/dist/governance/index.js +210 -0
- package/dist/governance/index.js.map +1 -0
- package/dist/governance/merge.d.ts +31 -0
- package/dist/governance/merge.d.ts.map +1 -0
- package/dist/governance/merge.js +167 -0
- package/dist/governance/merge.js.map +1 -0
- package/dist/identity/index.d.ts +199 -0
- package/dist/identity/index.d.ts.map +1 -0
- package/dist/identity/index.js +415 -0
- package/dist/identity/index.js.map +1 -0
- package/dist/index.d.ts +71 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +56 -0
- package/dist/index.js.map +1 -0
- package/dist/maloca/backoffice.d.ts +31 -0
- package/dist/maloca/backoffice.d.ts.map +1 -0
- package/dist/maloca/backoffice.js +40 -0
- package/dist/maloca/backoffice.js.map +1 -0
- package/dist/maloca/event-bus.d.ts +60 -0
- package/dist/maloca/event-bus.d.ts.map +1 -0
- package/dist/maloca/event-bus.js +175 -0
- package/dist/maloca/event-bus.js.map +1 -0
- package/dist/maloca/evidentia.d.ts +136 -0
- package/dist/maloca/evidentia.d.ts.map +1 -0
- package/dist/maloca/evidentia.js +447 -0
- package/dist/maloca/evidentia.js.map +1 -0
- package/dist/maloca/gateway/api.d.ts +146 -0
- package/dist/maloca/gateway/api.d.ts.map +1 -0
- package/dist/maloca/gateway/api.js +228 -0
- package/dist/maloca/gateway/api.js.map +1 -0
- package/dist/maloca/gateway/auth.d.ts +20 -0
- package/dist/maloca/gateway/auth.d.ts.map +1 -0
- package/dist/maloca/gateway/auth.js +115 -0
- package/dist/maloca/gateway/auth.js.map +1 -0
- package/dist/maloca/gateway/dashboard.d.ts +42 -0
- package/dist/maloca/gateway/dashboard.d.ts.map +1 -0
- package/dist/maloca/gateway/dashboard.js +67 -0
- package/dist/maloca/gateway/dashboard.js.map +1 -0
- package/dist/maloca/gateway/websocket.d.ts +34 -0
- package/dist/maloca/gateway/websocket.d.ts.map +1 -0
- package/dist/maloca/gateway/websocket.js +71 -0
- package/dist/maloca/gateway/websocket.js.map +1 -0
- package/dist/maloca/karma.d.ts +165 -0
- package/dist/maloca/karma.d.ts.map +1 -0
- package/dist/maloca/karma.js +307 -0
- package/dist/maloca/karma.js.map +1 -0
- package/dist/maloca/kernel.d.ts +20 -0
- package/dist/maloca/kernel.d.ts.map +1 -0
- package/dist/maloca/kernel.js +76 -0
- package/dist/maloca/kernel.js.map +1 -0
- package/dist/maloca/metadata.d.ts +30 -0
- package/dist/maloca/metadata.d.ts.map +1 -0
- package/dist/maloca/metadata.js +80 -0
- package/dist/maloca/metadata.js.map +1 -0
- package/dist/maloca/perfil.d.ts +57 -0
- package/dist/maloca/perfil.d.ts.map +1 -0
- package/dist/maloca/perfil.js +113 -0
- package/dist/maloca/perfil.js.map +1 -0
- package/dist/maloca/plugin-registry.d.ts +27 -0
- package/dist/maloca/plugin-registry.d.ts.map +1 -0
- package/dist/maloca/plugin-registry.js +76 -0
- package/dist/maloca/plugin-registry.js.map +1 -0
- package/dist/maloca/polygon-bridge.d.ts +63 -0
- package/dist/maloca/polygon-bridge.d.ts.map +1 -0
- package/dist/maloca/polygon-bridge.js +198 -0
- package/dist/maloca/polygon-bridge.js.map +1 -0
- package/dist/maloca/types.d.ts +44 -0
- package/dist/maloca/types.d.ts.map +1 -0
- package/dist/maloca/types.js +2 -0
- package/dist/maloca/types.js.map +1 -0
- package/dist/medico/aval.d.ts +149 -0
- package/dist/medico/aval.d.ts.map +1 -0
- package/dist/medico/aval.js +281 -0
- package/dist/medico/aval.js.map +1 -0
- package/dist/medico/canonica.d.ts +96 -0
- package/dist/medico/canonica.d.ts.map +1 -0
- package/dist/medico/canonica.js +148 -0
- package/dist/medico/canonica.js.map +1 -0
- package/dist/medico/credencial.d.ts +160 -0
- package/dist/medico/credencial.d.ts.map +1 -0
- package/dist/medico/credencial.js +240 -0
- package/dist/medico/credencial.js.map +1 -0
- package/dist/medico/index.d.ts +36 -0
- package/dist/medico/index.d.ts.map +1 -0
- package/dist/medico/index.js +39 -0
- package/dist/medico/index.js.map +1 -0
- package/dist/medico/malla.d.ts +218 -0
- package/dist/medico/malla.d.ts.map +1 -0
- package/dist/medico/malla.js +347 -0
- package/dist/medico/malla.js.map +1 -0
- package/dist/medico/registro-profesional.d.ts +84 -0
- package/dist/medico/registro-profesional.d.ts.map +1 -0
- package/dist/medico/registro-profesional.js +135 -0
- package/dist/medico/registro-profesional.js.map +1 -0
- package/dist/medico/registro.d.ts +149 -0
- package/dist/medico/registro.d.ts.map +1 -0
- package/dist/medico/registro.js +173 -0
- package/dist/medico/registro.js.map +1 -0
- package/dist/medico/types.d.ts +287 -0
- package/dist/medico/types.d.ts.map +1 -0
- package/dist/medico/types.js +135 -0
- package/dist/medico/types.js.map +1 -0
- package/dist/medico/verificacion-registro.d.ts +300 -0
- package/dist/medico/verificacion-registro.d.ts.map +1 -0
- package/dist/medico/verificacion-registro.js +319 -0
- package/dist/medico/verificacion-registro.js.map +1 -0
- package/dist/mesh/index.d.ts +457 -0
- package/dist/mesh/index.d.ts.map +1 -0
- package/dist/mesh/index.js +929 -0
- package/dist/mesh/index.js.map +1 -0
- package/dist/namespaces/encrypted-plugin.d.ts +56 -0
- package/dist/namespaces/encrypted-plugin.d.ts.map +1 -0
- package/dist/namespaces/encrypted-plugin.js +173 -0
- package/dist/namespaces/encrypted-plugin.js.map +1 -0
- package/dist/namespaces/index.d.ts +52 -0
- package/dist/namespaces/index.d.ts.map +1 -0
- package/dist/namespaces/index.js +134 -0
- package/dist/namespaces/index.js.map +1 -0
- package/dist/namespaces/ivn-proofs.d.ts +54 -0
- package/dist/namespaces/ivn-proofs.d.ts.map +1 -0
- package/dist/namespaces/ivn-proofs.js +162 -0
- package/dist/namespaces/ivn-proofs.js.map +1 -0
- package/dist/namespaces/offers-gossip.d.ts +95 -0
- package/dist/namespaces/offers-gossip.d.ts.map +1 -0
- package/dist/namespaces/offers-gossip.js +213 -0
- package/dist/namespaces/offers-gossip.js.map +1 -0
- package/dist/node-memory/idb-store.d.ts +22 -0
- package/dist/node-memory/idb-store.d.ts.map +1 -0
- package/dist/node-memory/idb-store.js +154 -0
- package/dist/node-memory/idb-store.js.map +1 -0
- package/dist/node-memory/index.d.ts +14 -0
- package/dist/node-memory/index.d.ts.map +1 -0
- package/dist/node-memory/index.js +159 -0
- package/dist/node-memory/index.js.map +1 -0
- package/dist/node-memory/sync-flush.d.ts +11 -0
- package/dist/node-memory/sync-flush.d.ts.map +1 -0
- package/dist/node-memory/sync-flush.js +37 -0
- package/dist/node-memory/sync-flush.js.map +1 -0
- package/dist/node-memory/types.d.ts +34 -0
- package/dist/node-memory/types.d.ts.map +1 -0
- package/dist/node-memory/types.js +2 -0
- package/dist/node-memory/types.js.map +1 -0
- package/dist/node-memory/xavier-store.d.ts +12 -0
- package/dist/node-memory/xavier-store.d.ts.map +1 -0
- package/dist/node-memory/xavier-store.js +75 -0
- package/dist/node-memory/xavier-store.js.map +1 -0
- package/dist/op-log/index.d.ts +49 -0
- package/dist/op-log/index.d.ts.map +1 -0
- package/dist/op-log/index.js +190 -0
- package/dist/op-log/index.js.map +1 -0
- package/dist/presence/health.d.ts +54 -0
- package/dist/presence/health.d.ts.map +1 -0
- package/dist/presence/health.js +139 -0
- package/dist/presence/health.js.map +1 -0
- package/dist/presence/index.d.ts +85 -0
- package/dist/presence/index.d.ts.map +1 -0
- package/dist/presence/index.js +255 -0
- package/dist/presence/index.js.map +1 -0
- package/dist/presence/peer-health.d.ts +40 -0
- package/dist/presence/peer-health.d.ts.map +1 -0
- package/dist/presence/peer-health.js +118 -0
- package/dist/presence/peer-health.js.map +1 -0
- package/dist/protocol/canonical.d.ts +10 -0
- package/dist/protocol/canonical.d.ts.map +1 -0
- package/dist/protocol/canonical.js +32 -0
- package/dist/protocol/canonical.js.map +1 -0
- package/dist/protocol/crypto.d.ts +299 -0
- package/dist/protocol/crypto.d.ts.map +1 -0
- package/dist/protocol/crypto.js +739 -0
- package/dist/protocol/crypto.js.map +1 -0
- package/dist/protocol/index.d.ts +30 -0
- package/dist/protocol/index.d.ts.map +1 -0
- package/dist/protocol/index.js +116 -0
- package/dist/protocol/index.js.map +1 -0
- package/dist/protocol/utils.d.ts +5 -0
- package/dist/protocol/utils.d.ts.map +1 -0
- package/dist/protocol/utils.js +27 -0
- package/dist/protocol/utils.js.map +1 -0
- package/dist/salones/manager.d.ts +100 -0
- package/dist/salones/manager.d.ts.map +1 -0
- package/dist/salones/manager.js +240 -0
- package/dist/salones/manager.js.map +1 -0
- package/dist/security/rate-limiter.d.ts +13 -0
- package/dist/security/rate-limiter.d.ts.map +1 -0
- package/dist/security/rate-limiter.js +32 -0
- package/dist/security/rate-limiter.js.map +1 -0
- package/dist/snapshot/index.d.ts +90 -0
- package/dist/snapshot/index.d.ts.map +1 -0
- package/dist/snapshot/index.js +189 -0
- package/dist/snapshot/index.js.map +1 -0
- package/dist/storage/index.d.ts +49 -0
- package/dist/storage/index.d.ts.map +1 -0
- package/dist/storage/index.js +176 -0
- package/dist/storage/index.js.map +1 -0
- package/dist/storage/optimizer.d.ts +28 -0
- package/dist/storage/optimizer.d.ts.map +1 -0
- package/dist/storage/optimizer.js +50 -0
- package/dist/storage/optimizer.js.map +1 -0
- package/dist/storage/ydoc-persistence.d.ts +27 -0
- package/dist/storage/ydoc-persistence.d.ts.map +1 -0
- package/dist/storage/ydoc-persistence.js +128 -0
- package/dist/storage/ydoc-persistence.js.map +1 -0
- package/dist/sync/ChunkSyncManager.d.ts +41 -0
- package/dist/sync/ChunkSyncManager.d.ts.map +1 -0
- package/dist/sync/ChunkSyncManager.js +115 -0
- package/dist/sync/ChunkSyncManager.js.map +1 -0
- package/dist/sync/conflict-resolver.d.ts +33 -0
- package/dist/sync/conflict-resolver.d.ts.map +1 -0
- package/dist/sync/conflict-resolver.js +54 -0
- package/dist/sync/conflict-resolver.js.map +1 -0
- package/dist/sync/engine.d.ts +168 -0
- package/dist/sync/engine.d.ts.map +1 -0
- package/dist/sync/engine.js +315 -0
- package/dist/sync/engine.js.map +1 -0
- package/dist/sync/index.d.ts +3 -0
- package/dist/sync/index.d.ts.map +1 -0
- package/dist/sync/index.js +3 -0
- package/dist/sync/index.js.map +1 -0
- package/dist/transport/TorTransportAdapter.d.ts +70 -0
- package/dist/transport/TorTransportAdapter.d.ts.map +1 -0
- package/dist/transport/TorTransportAdapter.js +192 -0
- package/dist/transport/TorTransportAdapter.js.map +1 -0
- package/dist/transport/memory.d.ts +31 -0
- package/dist/transport/memory.d.ts.map +1 -0
- package/dist/transport/memory.js +114 -0
- package/dist/transport/memory.js.map +1 -0
- package/dist/transport/peerjs.d.ts +45 -0
- package/dist/transport/peerjs.d.ts.map +1 -0
- package/dist/transport/peerjs.js +301 -0
- package/dist/transport/peerjs.js.map +1 -0
- package/dist/transport/pqc-handshake.d.ts +72 -0
- package/dist/transport/pqc-handshake.d.ts.map +1 -0
- package/dist/transport/pqc-handshake.js +129 -0
- package/dist/transport/pqc-handshake.js.map +1 -0
- package/dist/transport/relay-config.d.ts +11 -0
- package/dist/transport/relay-config.d.ts.map +1 -0
- package/dist/transport/relay-config.js +48 -0
- package/dist/transport/relay-config.js.map +1 -0
- package/dist/transport/relay-server.d.ts +37 -0
- package/dist/transport/relay-server.d.ts.map +1 -0
- package/dist/transport/relay-server.js +230 -0
- package/dist/transport/relay-server.js.map +1 -0
- package/dist/transport/tor.d.ts +47 -0
- package/dist/transport/tor.d.ts.map +1 -0
- package/dist/transport/tor.js +158 -0
- package/dist/transport/tor.js.map +1 -0
- package/dist/transport/types.d.ts +34 -0
- package/dist/transport/types.d.ts.map +1 -0
- package/dist/transport/types.js +2 -0
- package/dist/transport/types.js.map +1 -0
- package/dist/types/index.d.ts +293 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +73 -0
- package/dist/types/index.js.map +1 -0
- package/dist/web/admission.d.ts +24 -0
- package/dist/web/admission.d.ts.map +1 -0
- package/dist/web/admission.js +41 -0
- package/dist/web/admission.js.map +1 -0
- package/dist/web/crypto.d.ts +18 -0
- package/dist/web/crypto.d.ts.map +1 -0
- package/dist/web/crypto.js +78 -0
- package/dist/web/crypto.js.map +1 -0
- package/dist/web/exchange.d.ts +23 -0
- package/dist/web/exchange.d.ts.map +1 -0
- package/dist/web/exchange.js +54 -0
- package/dist/web/exchange.js.map +1 -0
- package/dist/web/fragment.d.ts +58 -0
- package/dist/web/fragment.d.ts.map +1 -0
- package/dist/web/fragment.js +198 -0
- package/dist/web/fragment.js.map +1 -0
- package/dist/web/index.d.ts +25 -0
- package/dist/web/index.d.ts.map +1 -0
- package/dist/web/index.js +14 -0
- package/dist/web/index.js.map +1 -0
- package/dist/web/merge/index.d.ts +104 -0
- package/dist/web/merge/index.d.ts.map +1 -0
- package/dist/web/merge/index.js +236 -0
- package/dist/web/merge/index.js.map +1 -0
- package/dist/web/oplog/hlc.d.ts +19 -0
- package/dist/web/oplog/hlc.d.ts.map +1 -0
- package/dist/web/oplog/hlc.js +39 -0
- package/dist/web/oplog/hlc.js.map +1 -0
- package/dist/web/oplog/index.d.ts +10 -0
- package/dist/web/oplog/index.d.ts.map +1 -0
- package/dist/web/oplog/index.js +6 -0
- package/dist/web/oplog/index.js.map +1 -0
- package/dist/web/oplog/log.d.ts +182 -0
- package/dist/web/oplog/log.d.ts.map +1 -0
- package/dist/web/oplog/log.js +693 -0
- package/dist/web/oplog/log.js.map +1 -0
- package/dist/web/oplog/store.d.ts +40 -0
- package/dist/web/oplog/store.d.ts.map +1 -0
- package/dist/web/oplog/store.js +85 -0
- package/dist/web/oplog/store.js.map +1 -0
- package/dist/web/oplog/sync.d.ts +54 -0
- package/dist/web/oplog/sync.d.ts.map +1 -0
- package/dist/web/oplog/sync.js +162 -0
- package/dist/web/oplog/sync.js.map +1 -0
- package/dist/web/oplog/types.d.ts +119 -0
- package/dist/web/oplog/types.d.ts.map +1 -0
- package/dist/web/oplog/types.js +2 -0
- package/dist/web/oplog/types.js.map +1 -0
- package/dist/web/pairing.d.ts +186 -0
- package/dist/web/pairing.d.ts.map +1 -0
- package/dist/web/pairing.js +395 -0
- package/dist/web/pairing.js.map +1 -0
- package/dist/web/pq.d.ts +36 -0
- package/dist/web/pq.d.ts.map +1 -0
- package/dist/web/pq.js +59 -0
- package/dist/web/pq.js.map +1 -0
- package/dist/web/provider.d.ts +188 -0
- package/dist/web/provider.d.ts.map +1 -0
- package/dist/web/provider.js +2042 -0
- package/dist/web/provider.js.map +1 -0
- package/dist/web/rooms.d.ts +20 -0
- package/dist/web/rooms.d.ts.map +1 -0
- package/dist/web/rooms.js +51 -0
- package/dist/web/rooms.js.map +1 -0
- package/dist/web/rotation.d.ts +73 -0
- package/dist/web/rotation.d.ts.map +1 -0
- package/dist/web/rotation.js +130 -0
- package/dist/web/rotation.js.map +1 -0
- package/dist/web/secstate.d.ts +213 -0
- package/dist/web/secstate.d.ts.map +1 -0
- package/dist/web/secstate.js +789 -0
- package/dist/web/secstate.js.map +1 -0
- package/dist/web/store.d.ts +9 -0
- package/dist/web/store.d.ts.map +1 -0
- package/dist/web/store.js +32 -0
- package/dist/web/store.js.map +1 -0
- package/dist/web/transports/loopback.d.ts +11 -0
- package/dist/web/transports/loopback.d.ts.map +1 -0
- package/dist/web/transports/loopback.js +97 -0
- package/dist/web/transports/loopback.js.map +1 -0
- package/dist/web/transports/qr-sdp.d.ts +27 -0
- package/dist/web/transports/qr-sdp.d.ts.map +1 -0
- package/dist/web/transports/qr-sdp.js +131 -0
- package/dist/web/transports/qr-sdp.js.map +1 -0
- package/dist/web/transports/ws.d.ts +12 -0
- package/dist/web/transports/ws.d.ts.map +1 -0
- package/dist/web/transports/ws.js +139 -0
- package/dist/web/transports/ws.js.map +1 -0
- package/dist/web/trust/canonical.d.ts +8 -0
- package/dist/web/trust/canonical.d.ts.map +1 -0
- package/dist/web/trust/canonical.js +27 -0
- package/dist/web/trust/canonical.js.map +1 -0
- package/dist/web/trust/docs.d.ts +51 -0
- package/dist/web/trust/docs.d.ts.map +1 -0
- package/dist/web/trust/docs.js +170 -0
- package/dist/web/trust/docs.js.map +1 -0
- package/dist/web/trust/index.d.ts +10 -0
- package/dist/web/trust/index.d.ts.map +1 -0
- package/dist/web/trust/index.js +7 -0
- package/dist/web/trust/index.js.map +1 -0
- package/dist/web/trust/keys.d.ts +37 -0
- package/dist/web/trust/keys.d.ts.map +1 -0
- package/dist/web/trust/keys.js +75 -0
- package/dist/web/trust/keys.js.map +1 -0
- package/dist/web/trust/store.d.ts +150 -0
- package/dist/web/trust/store.d.ts.map +1 -0
- package/dist/web/trust/store.js +587 -0
- package/dist/web/trust/store.js.map +1 -0
- package/dist/web/trust/types.d.ts +134 -0
- package/dist/web/trust/types.d.ts.map +1 -0
- package/dist/web/trust/types.js +4 -0
- package/dist/web/trust/types.js.map +1 -0
- package/dist/web/types.d.ts +115 -0
- package/dist/web/types.d.ts.map +1 -0
- package/dist/web/types.js +2 -0
- package/dist/web/types.js.map +1 -0
- package/dist/web/util.d.ts +12 -0
- package/dist/web/util.d.ts.map +1 -0
- package/dist/web/util.js +54 -0
- package/dist/web/util.js.map +1 -0
- package/dist/web/webrtc.d.ts +35 -0
- package/dist/web/webrtc.d.ts.map +1 -0
- package/dist/web/webrtc.js +304 -0
- package/dist/web/webrtc.js.map +1 -0
- package/package.json +138 -4
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `CredencialMedica` — construction, signing and validation.
|
|
3
|
+
*
|
|
4
|
+
* ─── VALIDATION FAILS CLOSED ────────────────────────────────────────────────
|
|
5
|
+
*
|
|
6
|
+
* Every refusal in this module returns a named reason and leaves the caller
|
|
7
|
+
* with no way to read "unverified but proceed" out of the result. There is no
|
|
8
|
+
* `unknown`, no tri-state, no boolean-plus-warning. The type system does not
|
|
9
|
+
* offer a value meaning "we could not check this, carry on".
|
|
10
|
+
*
|
|
11
|
+
* That is the whole point. The OrionHealth licence verifier returns
|
|
12
|
+
* `LicenseVerificationResult.unknown` when a country's registry is empty, which
|
|
13
|
+
* is correct for a local lookup UI and wrong here: a mesh node that treats
|
|
14
|
+
* `unknown` as "not refused" turns *an unsupported country* into a bypass. A
|
|
15
|
+
* physician could present a licence from a country with no registry snapshot and
|
|
16
|
+
* be waved through by any node that had not yet downloaded that registry.
|
|
17
|
+
*/
|
|
18
|
+
import type { PostQuantumIdentity } from "../identity/index.js";
|
|
19
|
+
import type { NodoId, ParPublico } from "../types/index.js";
|
|
20
|
+
import { type CredencialMedica, type EstadoEmision, type TipoCredencial, VERSION_MODELO } from "./types.js";
|
|
21
|
+
/** Why a credential was refused. Every value here means access stays closed. */
|
|
22
|
+
export declare const MOTIVO_RECHAZO_CREDENCIAL: {
|
|
23
|
+
/** A mandatory field is absent or empty. Names the field. */
|
|
24
|
+
readonly CAMPO_OBLIGATORIO_AUSENTE: "campo_obligatorio_ausente";
|
|
25
|
+
/**
|
|
26
|
+
* `vigenteHasta` absent or not a number. Kept distinct from
|
|
27
|
+
* `CREDENCIAL_CADUCADA` because this is the OrionHealth `expired`-never-returned
|
|
28
|
+
* defect: without an issuer-signed expiry a revoked licence verifies forever.
|
|
29
|
+
*/
|
|
30
|
+
readonly SIN_VIGENCIA: "sin_vigencia";
|
|
31
|
+
/** `Date.now() >= vigenteHasta`. */
|
|
32
|
+
readonly CREDENCIAL_CADUCADA: "credencial_caducada";
|
|
33
|
+
/** `vigenteHasta` is in the past at construction time. */
|
|
34
|
+
readonly VIGENCIA_EN_PASADO: "vigencia_en_pasado";
|
|
35
|
+
/** `emitidoEn` is not a plausible epoch-ms value, or is after `vigenteHasta`. */
|
|
36
|
+
readonly EMISION_INVALIDA: "emision_invalida";
|
|
37
|
+
/** `idLicencia` is not a 64-char lower-case hex SHA-256. */
|
|
38
|
+
readonly ID_LICENCIA_MAL_FORMADO: "id_licencia_mal_formado";
|
|
39
|
+
/** `pais` is not ISO 3166-1 alpha-2. */
|
|
40
|
+
readonly PAIS_INVALIDO: "pais_invalido";
|
|
41
|
+
/** `tipo` or `estadoEmision` outside the declared unions. */
|
|
42
|
+
readonly ENUM_INVALIDO: "enum_invalido";
|
|
43
|
+
/** No signature bytes. */
|
|
44
|
+
readonly FIRMA_AUSENTE: "firma_ausente";
|
|
45
|
+
/** Signature does not verify against the issuer's public key. */
|
|
46
|
+
readonly FIRMA_INVALIDA: "firma_invalida";
|
|
47
|
+
/** `estadoEmision: 'autofirmada'` whose `emisor` is not the subject. */
|
|
48
|
+
readonly AUTOEMISION_INCOHERENTE: "autoemision_incoherente";
|
|
49
|
+
};
|
|
50
|
+
export type MotivoRechazoCredencial = (typeof MOTIVO_RECHAZO_CREDENCIAL)[keyof typeof MOTIVO_RECHAZO_CREDENCIAL];
|
|
51
|
+
export type ResultadoValidacionCredencial = {
|
|
52
|
+
readonly ok: true;
|
|
53
|
+
readonly credencial: CredencialMedica;
|
|
54
|
+
} | {
|
|
55
|
+
readonly ok: false;
|
|
56
|
+
readonly motivo: MotivoRechazoCredencial;
|
|
57
|
+
readonly detalle: string;
|
|
58
|
+
/**
|
|
59
|
+
* Always `false`. Present so that a caller destructuring the discriminant
|
|
60
|
+
* cannot accidentally treat a refusal as soft information. There is no
|
|
61
|
+
* state in this module where a credential is "unverified but usable".
|
|
62
|
+
*/
|
|
63
|
+
readonly accesoPermitido: false;
|
|
64
|
+
};
|
|
65
|
+
/** Inputs for {@link crearCredencial}. The issuer signs; nothing else does. */
|
|
66
|
+
export interface BorradorCredencial {
|
|
67
|
+
readonly tipo: TipoCredencial;
|
|
68
|
+
/** ISO 3166-1 alpha-2. `CO` for Colombia. */
|
|
69
|
+
readonly pais: string;
|
|
70
|
+
/** `'minsalud-rethus'`, `'colomedico-cm'`. The source of the claim. */
|
|
71
|
+
readonly autoridad: string;
|
|
72
|
+
/** `sha256(normalize(numeroLicencia))`. The raw number must not be passed here. */
|
|
73
|
+
readonly idLicencia: string;
|
|
74
|
+
readonly especialidad?: string;
|
|
75
|
+
/** Seal of the real licence number to a specific verifier, if kept. */
|
|
76
|
+
readonly numeroLicenciaCifrado?: Uint8Array;
|
|
77
|
+
readonly emitidoEn: number;
|
|
78
|
+
/**
|
|
79
|
+
* REQUIRED. Issuer-signed expiry. There is no default and no "derive it from
|
|
80
|
+
* the registry": a membership list cannot express a validity window, so this
|
|
81
|
+
* value has to come from the issuer's signature.
|
|
82
|
+
*/
|
|
83
|
+
readonly vigenteHasta: number;
|
|
84
|
+
readonly estadoEmision: EstadoEmision;
|
|
85
|
+
/** Who signs. For `'autofirmada'` this is the subject node itself. */
|
|
86
|
+
readonly emisor: NodoId;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Structural validation, in cheap-to-expensive order. Runs no signature check.
|
|
90
|
+
*
|
|
91
|
+
* Order is deliberate: the malformed-shape refusals cost nothing, so a garbage
|
|
92
|
+
* payload never reaches a post-quantum operation. Same discipline
|
|
93
|
+
* `applyTransaction` in `src/maloca/karma.ts` uses.
|
|
94
|
+
*
|
|
95
|
+
* @param ahora - injected clock (ms epoch). Tests pass a fixed value; the
|
|
96
|
+
* function itself never reads the clock, which is what keeps it pure.
|
|
97
|
+
*/
|
|
98
|
+
export declare function validarCredencial(credencial: CredencialMedica, ahora: number): ResultadoValidacionCredencial;
|
|
99
|
+
/**
|
|
100
|
+
* Verify the issuer's signature over the canonical credential bytes.
|
|
101
|
+
*
|
|
102
|
+
* Separate from {@link validarCredencial} so a caller can run the cheap
|
|
103
|
+
* structural checks first and skip a post-quantum verification on garbage.
|
|
104
|
+
* Both are required before a credential counts as evidence; neither is
|
|
105
|
+
* sufficient alone.
|
|
106
|
+
*/
|
|
107
|
+
export declare function verificarFirmaCredencial(credencial: CredencialMedica, identidadEmisor: PostQuantumIdentity, parPublico: ParPublico): Promise<boolean>;
|
|
108
|
+
/**
|
|
109
|
+
* Full validation: structure, then signature, then the self-attestation rule.
|
|
110
|
+
*
|
|
111
|
+
* @returns `ok: true` only when the credential is well formed, unexpired and
|
|
112
|
+
* genuinely signed by `emisor`. Any other outcome is `ok: false` with
|
|
113
|
+
* `accesoPermitido: false`. There is no partial credit and no third state.
|
|
114
|
+
*/
|
|
115
|
+
export declare function validarCredencialFirmada(credencial: CredencialMedica, identidadEmisor: PostQuantumIdentity, parPublicoEmisor: ParPublico, ahora: number): Promise<ResultadoValidacionCredencial>;
|
|
116
|
+
/**
|
|
117
|
+
* A self-attested credential must be signed by the subject it rides on.
|
|
118
|
+
*
|
|
119
|
+
* Kept separate from {@link validarCredencialFirmada} because a
|
|
120
|
+
* `CredencialMedica` carries no subject field of its own — the binding is
|
|
121
|
+
* `RegistroProfesional.nodoId`, one level up. An `autofirmada` credential whose
|
|
122
|
+
* `emisor` is a different node would let a node borrow someone else's key to
|
|
123
|
+
* look institutionally verified, so the check needs both halves and neither
|
|
124
|
+
* object alone contains them.
|
|
125
|
+
*
|
|
126
|
+
* Only `autofirmada` is constrained this way: an `atestiguada_pares` credential
|
|
127
|
+
* carries the issuing node's own signature, and an `anclada_autoridad` one
|
|
128
|
+
* carries the college's, and both are expected to differ from the subject.
|
|
129
|
+
*/
|
|
130
|
+
export declare function validarVinculoEmision(credencial: CredencialMedica, nodoSujeto: NodoId): ResultadoValidacionCredencial;
|
|
131
|
+
/**
|
|
132
|
+
* Build and sign a credential.
|
|
133
|
+
*
|
|
134
|
+
* The `id` is derived from `idLicencia + tipo + pais`, so the same licence with
|
|
135
|
+
* the same type in the same country always yields the same id: the credential is
|
|
136
|
+
* identifiable across nodes without any node choosing a random identifier that
|
|
137
|
+
* two honest nodes would fail to agree on.
|
|
138
|
+
*
|
|
139
|
+
* The signature covers everything except `firma`, over the canonical bytes from
|
|
140
|
+
* `./canonica.ts`.
|
|
141
|
+
*/
|
|
142
|
+
export declare function crearCredencial(borrador: BorradorCredencial, identidad: PostQuantumIdentity): Promise<CredencialMedica>;
|
|
143
|
+
/** SHA-256 of the canonical credential bytes. Binds an `Aval` to exact bytes. */
|
|
144
|
+
export declare function hashDeCredencial(credencial: CredencialMedica): Promise<string>;
|
|
145
|
+
/** Hex form of the canonical credential bytes, for logging and debugging. */
|
|
146
|
+
export declare function volcarCredencial(credencial: CredencialMedica): string;
|
|
147
|
+
/**
|
|
148
|
+
* A "certified doctor" per the product promise: `licencia ∧ especialidad`, both
|
|
149
|
+
* with a peer-witnessed or authority-anchored state, both unexpired.
|
|
150
|
+
*
|
|
151
|
+
* Deliberately not a boolean field on the licence. A boolean cannot expire, and
|
|
152
|
+
* specialties are revoked on a different cadence from base licensure.
|
|
153
|
+
*
|
|
154
|
+
* A licensed-but-unspecialised doctor is a legitimate node with a *smaller*
|
|
155
|
+
* capability set, not an impostor (DECISIÓN A.4) — this returns `false`, and the
|
|
156
|
+
* caller decides what a lower tier grants.
|
|
157
|
+
*/
|
|
158
|
+
export declare function esMedicoCertificado(credenciales: readonly CredencialMedica[], ahora: number): boolean;
|
|
159
|
+
export { VERSION_MODELO };
|
|
160
|
+
//# sourceMappingURL=credencial.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credencial.d.ts","sourceRoot":"","sources":["../../src/medico/credencial.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,KAA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,UAAU,EAAE,gBAAgB,GAC1B,OAAO,CAAC,MAAM,CAAC,CAEjB;AAED,6EAA6E;AAC7E,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,gBAAgB,GAAG,MAAM,CAErE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CAClC,YAAY,EAAE,SAAS,gBAAgB,EAAE,EACzC,KAAK,EAAE,MAAM,GACX,OAAO,CAcT;AAED,OAAO,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `CredencialMedica` — construction, signing and validation.
|
|
3
|
+
*
|
|
4
|
+
* ─── VALIDATION FAILS CLOSED ────────────────────────────────────────────────
|
|
5
|
+
*
|
|
6
|
+
* Every refusal in this module returns a named reason and leaves the caller
|
|
7
|
+
* with no way to read "unverified but proceed" out of the result. There is no
|
|
8
|
+
* `unknown`, no tri-state, no boolean-plus-warning. The type system does not
|
|
9
|
+
* offer a value meaning "we could not check this, carry on".
|
|
10
|
+
*
|
|
11
|
+
* That is the whole point. The OrionHealth licence verifier returns
|
|
12
|
+
* `LicenseVerificationResult.unknown` when a country's registry is empty, which
|
|
13
|
+
* is correct for a local lookup UI and wrong here: a mesh node that treats
|
|
14
|
+
* `unknown` as "not refused" turns *an unsupported country* into a bypass. A
|
|
15
|
+
* physician could present a licence from a country with no registry snapshot and
|
|
16
|
+
* be waved through by any node that had not yet downloaded that registry.
|
|
17
|
+
*/
|
|
18
|
+
import { bytesAHex, bytesCredencial, hashCredencial, idCredencial, } from "./canonica.js";
|
|
19
|
+
import { CAMPOS_OBLIGATORIOS_CREDENCIAL, ESTADO_EMISION, TIPO_CREDENCIAL, VERSION_MODELO, } from "./types.js";
|
|
20
|
+
/** Why a credential was refused. Every value here means access stays closed. */
|
|
21
|
+
export const MOTIVO_RECHAZO_CREDENCIAL = {
|
|
22
|
+
/** A mandatory field is absent or empty. Names the field. */
|
|
23
|
+
CAMPO_OBLIGATORIO_AUSENTE: "campo_obligatorio_ausente",
|
|
24
|
+
/**
|
|
25
|
+
* `vigenteHasta` absent or not a number. Kept distinct from
|
|
26
|
+
* `CREDENCIAL_CADUCADA` because this is the OrionHealth `expired`-never-returned
|
|
27
|
+
* defect: without an issuer-signed expiry a revoked licence verifies forever.
|
|
28
|
+
*/
|
|
29
|
+
SIN_VIGENCIA: "sin_vigencia",
|
|
30
|
+
/** `Date.now() >= vigenteHasta`. */
|
|
31
|
+
CREDENCIAL_CADUCADA: "credencial_caducada",
|
|
32
|
+
/** `vigenteHasta` is in the past at construction time. */
|
|
33
|
+
VIGENCIA_EN_PASADO: "vigencia_en_pasado",
|
|
34
|
+
/** `emitidoEn` is not a plausible epoch-ms value, or is after `vigenteHasta`. */
|
|
35
|
+
EMISION_INVALIDA: "emision_invalida",
|
|
36
|
+
/** `idLicencia` is not a 64-char lower-case hex SHA-256. */
|
|
37
|
+
ID_LICENCIA_MAL_FORMADO: "id_licencia_mal_formado",
|
|
38
|
+
/** `pais` is not ISO 3166-1 alpha-2. */
|
|
39
|
+
PAIS_INVALIDO: "pais_invalido",
|
|
40
|
+
/** `tipo` or `estadoEmision` outside the declared unions. */
|
|
41
|
+
ENUM_INVALIDO: "enum_invalido",
|
|
42
|
+
/** No signature bytes. */
|
|
43
|
+
FIRMA_AUSENTE: "firma_ausente",
|
|
44
|
+
/** Signature does not verify against the issuer's public key. */
|
|
45
|
+
FIRMA_INVALIDA: "firma_invalida",
|
|
46
|
+
/** `estadoEmision: 'autofirmada'` whose `emisor` is not the subject. */
|
|
47
|
+
AUTOEMISION_INCOHERENTE: "autoemision_incoherente",
|
|
48
|
+
};
|
|
49
|
+
const RE_HEX64 = /^[0-9a-f]{64}$/;
|
|
50
|
+
const RE_PAIS_ALFA2 = /^[A-Z]{2}$/;
|
|
51
|
+
function fallo(motivo, detalle) {
|
|
52
|
+
return { ok: false, motivo, detalle, accesoPermitido: false };
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Structural validation, in cheap-to-expensive order. Runs no signature check.
|
|
56
|
+
*
|
|
57
|
+
* Order is deliberate: the malformed-shape refusals cost nothing, so a garbage
|
|
58
|
+
* payload never reaches a post-quantum operation. Same discipline
|
|
59
|
+
* `applyTransaction` in `src/maloca/karma.ts` uses.
|
|
60
|
+
*
|
|
61
|
+
* @param ahora - injected clock (ms epoch). Tests pass a fixed value; the
|
|
62
|
+
* function itself never reads the clock, which is what keeps it pure.
|
|
63
|
+
*/
|
|
64
|
+
export function validarCredencial(credencial, ahora) {
|
|
65
|
+
if (!credencial || typeof credencial !== "object") {
|
|
66
|
+
return fallo(MOTIVO_RECHAZO_CREDENCIAL.CAMPO_OBLIGATORIO_AUSENTE, "la credencial no es un objeto");
|
|
67
|
+
}
|
|
68
|
+
// ── 1. The five mandatory fields, by name ──
|
|
69
|
+
for (const campo of CAMPOS_OBLIGATORIOS_CREDENCIAL) {
|
|
70
|
+
const valor = credencial[campo];
|
|
71
|
+
if (valor === undefined || valor === null || valor === "") {
|
|
72
|
+
return fallo(MOTIVO_RECHAZO_CREDENCIAL.CAMPO_OBLIGATORIO_AUSENTE, `falta '${campo}'`);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
// ── 2. `vigenteHasta`, the field that closes the OrionHealth defect ──
|
|
76
|
+
// Checked before the enums because its absence is the specific bug this
|
|
77
|
+
// module exists to make impossible, and deserves the most specific reason.
|
|
78
|
+
if (typeof credencial.vigenteHasta !== "number" ||
|
|
79
|
+
!Number.isFinite(credencial.vigenteHasta)) {
|
|
80
|
+
return fallo(MOTIVO_RECHAZO_CREDENCIAL.SIN_VIGENCIA, "vigenteHasta ausente o no numérico: sin vigencia firmada por el emisor, una licencia revocada validaría para siempre");
|
|
81
|
+
}
|
|
82
|
+
if (credencial.vigenteHasta <= 0) {
|
|
83
|
+
return fallo(MOTIVO_RECHAZO_CREDENCIAL.SIN_VIGENCIA, `vigenteHasta inválido: ${credencial.vigenteHasta}`);
|
|
84
|
+
}
|
|
85
|
+
// ── 3. Enums ──
|
|
86
|
+
if (!Object.values(TIPO_CREDENCIAL).includes(credencial.tipo)) {
|
|
87
|
+
return fallo(MOTIVO_RECHAZO_CREDENCIAL.ENUM_INVALIDO, `tipo desconocido: ${String(credencial.tipo)}`);
|
|
88
|
+
}
|
|
89
|
+
if (!Object.values(ESTADO_EMISION).includes(credencial.estadoEmision)) {
|
|
90
|
+
return fallo(MOTIVO_RECHAZO_CREDENCIAL.ENUM_INVALIDO, `estadoEmision desconocido: ${String(credencial.estadoEmision)}`);
|
|
91
|
+
}
|
|
92
|
+
// ── 4. Country: alpha-2, upper case ──
|
|
93
|
+
if (!RE_PAIS_ALFA2.test(credencial.pais)) {
|
|
94
|
+
return fallo(MOTIVO_RECHAZO_CREDENCIAL.PAIS_INVALIDO, `pais debe ser ISO 3166-1 alpha-2 en mayúsculas: ${credencial.pais}`);
|
|
95
|
+
}
|
|
96
|
+
// ── 5. `idLicencia` must be a SHA-256 hex digest, not a licence number ──
|
|
97
|
+
// A raw licence number pasted into this field would be a PII leak and is
|
|
98
|
+
// refused at the boundary rather than at publication time.
|
|
99
|
+
if (!RE_HEX64.test(credencial.idLicencia)) {
|
|
100
|
+
return fallo(MOTIVO_RECHAZO_CREDENCIAL.ID_LICENCIA_MAL_FORMADO, "idLicencia debe ser sha256 hex de 64 caracteres; el número de licencia en claro no se acepta aquí");
|
|
101
|
+
}
|
|
102
|
+
// ── 6. Dates are coherent ──
|
|
103
|
+
if (typeof credencial.emitidoEn !== "number" ||
|
|
104
|
+
!Number.isFinite(credencial.emitidoEn)) {
|
|
105
|
+
return fallo(MOTIVO_RECHAZO_CREDENCIAL.EMISION_INVALIDA, `emitidoEn inválido: ${String(credencial.emitidoEn)}`);
|
|
106
|
+
}
|
|
107
|
+
if (credencial.emitidoEn > credencial.vigenteHasta) {
|
|
108
|
+
return fallo(MOTIVO_RECHAZO_CREDENCIAL.EMISION_INVALIDA, `emitidoEn (${credencial.emitidoEn}) es posterior a vigenteHasta (${credencial.vigenteHasta})`);
|
|
109
|
+
}
|
|
110
|
+
// ── 7. Expiry ──
|
|
111
|
+
if (credencial.vigenteHasta < ahora) {
|
|
112
|
+
return fallo(MOTIVO_RECHAZO_CREDENCIAL.CREDENCIAL_CADUCADA, `credencial caducada: vigente hasta ${credencial.vigenteHasta}, ahora ${ahora}`);
|
|
113
|
+
}
|
|
114
|
+
if (credencial.vigenteHasta === ahora) {
|
|
115
|
+
// `vigenteHasta` is exclusive: at the exact millisecond it lapses, it lapses.
|
|
116
|
+
return fallo(MOTIVO_RECHAZO_CREDENCIAL.CREDENCIAL_CADUCADA, `credencial caducada en el instante exacto de expiración (${ahora})`);
|
|
117
|
+
}
|
|
118
|
+
// ── 8. Signature present ──
|
|
119
|
+
if (!(credencial.firma instanceof Uint8Array) ||
|
|
120
|
+
credencial.firma.length === 0) {
|
|
121
|
+
return fallo(MOTIVO_RECHAZO_CREDENCIAL.FIRMA_AUSENTE, "firma ausente o vacía");
|
|
122
|
+
}
|
|
123
|
+
return { ok: true, credencial };
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Verify the issuer's signature over the canonical credential bytes.
|
|
127
|
+
*
|
|
128
|
+
* Separate from {@link validarCredencial} so a caller can run the cheap
|
|
129
|
+
* structural checks first and skip a post-quantum verification on garbage.
|
|
130
|
+
* Both are required before a credential counts as evidence; neither is
|
|
131
|
+
* sufficient alone.
|
|
132
|
+
*/
|
|
133
|
+
export async function verificarFirmaCredencial(credencial, identidadEmisor, parPublico) {
|
|
134
|
+
try {
|
|
135
|
+
return await identidadEmisor.verificar(bytesCredencial(credencial), credencial.firma, parPublico);
|
|
136
|
+
}
|
|
137
|
+
catch {
|
|
138
|
+
return false;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Full validation: structure, then signature, then the self-attestation rule.
|
|
143
|
+
*
|
|
144
|
+
* @returns `ok: true` only when the credential is well formed, unexpired and
|
|
145
|
+
* genuinely signed by `emisor`. Any other outcome is `ok: false` with
|
|
146
|
+
* `accesoPermitido: false`. There is no partial credit and no third state.
|
|
147
|
+
*/
|
|
148
|
+
export async function validarCredencialFirmada(credencial, identidadEmisor, parPublicoEmisor, ahora) {
|
|
149
|
+
const estructural = validarCredencial(credencial, ahora);
|
|
150
|
+
if (!estructural.ok)
|
|
151
|
+
return estructural;
|
|
152
|
+
if (!(await verificarFirmaCredencial(credencial, identidadEmisor, parPublicoEmisor))) {
|
|
153
|
+
return fallo(MOTIVO_RECHAZO_CREDENCIAL.FIRMA_INVALIDA, `la firma no verifica contra la clave pública de ${credencial.emisor}`);
|
|
154
|
+
}
|
|
155
|
+
return { ok: true, credencial };
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* A self-attested credential must be signed by the subject it rides on.
|
|
159
|
+
*
|
|
160
|
+
* Kept separate from {@link validarCredencialFirmada} because a
|
|
161
|
+
* `CredencialMedica` carries no subject field of its own — the binding is
|
|
162
|
+
* `RegistroProfesional.nodoId`, one level up. An `autofirmada` credential whose
|
|
163
|
+
* `emisor` is a different node would let a node borrow someone else's key to
|
|
164
|
+
* look institutionally verified, so the check needs both halves and neither
|
|
165
|
+
* object alone contains them.
|
|
166
|
+
*
|
|
167
|
+
* Only `autofirmada` is constrained this way: an `atestiguada_pares` credential
|
|
168
|
+
* carries the issuing node's own signature, and an `anclada_autoridad` one
|
|
169
|
+
* carries the college's, and both are expected to differ from the subject.
|
|
170
|
+
*/
|
|
171
|
+
export function validarVinculoEmision(credencial, nodoSujeto) {
|
|
172
|
+
if (credencial.estadoEmision === ESTADO_EMISION.AUTOFIRMADA &&
|
|
173
|
+
credencial.emisor !== nodoSujeto) {
|
|
174
|
+
return fallo(MOTIVO_RECHAZO_CREDENCIAL.AUTOEMISION_INCOHERENTE, `credencial autofirmada por ${credencial.emisor} pero presentada por el sujeto ${nodoSujeto}`);
|
|
175
|
+
}
|
|
176
|
+
return { ok: true, credencial };
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Build and sign a credential.
|
|
180
|
+
*
|
|
181
|
+
* The `id` is derived from `idLicencia + tipo + pais`, so the same licence with
|
|
182
|
+
* the same type in the same country always yields the same id: the credential is
|
|
183
|
+
* identifiable across nodes without any node choosing a random identifier that
|
|
184
|
+
* two honest nodes would fail to agree on.
|
|
185
|
+
*
|
|
186
|
+
* The signature covers everything except `firma`, over the canonical bytes from
|
|
187
|
+
* `./canonica.ts`.
|
|
188
|
+
*/
|
|
189
|
+
export async function crearCredencial(borrador, identidad) {
|
|
190
|
+
const id = await idCredencial(borrador.idLicencia, borrador.tipo, borrador.pais);
|
|
191
|
+
// Assemble first, then sign the assembly, so what is signed is exactly what
|
|
192
|
+
// travels — including the derived id.
|
|
193
|
+
const sinFirmar = {
|
|
194
|
+
id,
|
|
195
|
+
tipo: borrador.tipo,
|
|
196
|
+
pais: borrador.pais.toUpperCase(),
|
|
197
|
+
autoridad: borrador.autoridad,
|
|
198
|
+
idLicencia: borrador.idLicencia,
|
|
199
|
+
...(borrador.numeroLicenciaCifrado
|
|
200
|
+
? { numeroLicenciaCifrado: borrador.numeroLicenciaCifrado }
|
|
201
|
+
: {}),
|
|
202
|
+
...(borrador.especialidad ? { especialidad: borrador.especialidad } : {}),
|
|
203
|
+
emitidoEn: borrador.emitidoEn,
|
|
204
|
+
vigenteHasta: borrador.vigenteHasta,
|
|
205
|
+
estadoEmision: borrador.estadoEmision,
|
|
206
|
+
firma: new Uint8Array(0),
|
|
207
|
+
emisor: borrador.emisor,
|
|
208
|
+
};
|
|
209
|
+
const firma = await identidad.firmar(bytesCredencial(sinFirmar));
|
|
210
|
+
return { ...sinFirmar, firma };
|
|
211
|
+
}
|
|
212
|
+
/** SHA-256 of the canonical credential bytes. Binds an `Aval` to exact bytes. */
|
|
213
|
+
export function hashDeCredencial(credencial) {
|
|
214
|
+
return hashCredencial(credencial);
|
|
215
|
+
}
|
|
216
|
+
/** Hex form of the canonical credential bytes, for logging and debugging. */
|
|
217
|
+
export function volcarCredencial(credencial) {
|
|
218
|
+
return bytesAHex(bytesCredencial(credencial));
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* A "certified doctor" per the product promise: `licencia ∧ especialidad`, both
|
|
222
|
+
* with a peer-witnessed or authority-anchored state, both unexpired.
|
|
223
|
+
*
|
|
224
|
+
* Deliberately not a boolean field on the licence. A boolean cannot expire, and
|
|
225
|
+
* specialties are revoked on a different cadence from base licensure.
|
|
226
|
+
*
|
|
227
|
+
* A licensed-but-unspecialised doctor is a legitimate node with a *smaller*
|
|
228
|
+
* capability set, not an impostor (DECISIÓN A.4) — this returns `false`, and the
|
|
229
|
+
* caller decides what a lower tier grants.
|
|
230
|
+
*/
|
|
231
|
+
export function esMedicoCertificado(credenciales, ahora) {
|
|
232
|
+
const vigentes = credenciales.filter((c) => validarCredencial(c, ahora).ok);
|
|
233
|
+
const conEmisionFuerte = vigentes.filter((c) => c.estadoEmision === ESTADO_EMISION.ATESTIGUADA_PARES ||
|
|
234
|
+
c.estadoEmision === ESTADO_EMISION.ANCLADA_AUTORIDAD);
|
|
235
|
+
const tieneLicencia = conEmisionFuerte.some((c) => c.tipo === TIPO_CREDENCIAL.LICENCIA);
|
|
236
|
+
const tieneEspecialidad = conEmisionFuerte.some((c) => c.tipo === TIPO_CREDENCIAL.ESPECIALIDAD);
|
|
237
|
+
return tieneLicencia && tieneEspecialidad;
|
|
238
|
+
}
|
|
239
|
+
export { VERSION_MODELO };
|
|
240
|
+
//# sourceMappingURL=credencial.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credencial.js","sourceRoot":"","sources":["../../src/medico/credencial.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,OAAO,EACN,SAAS,EACT,eAAe,EACf,cAAc,EACd,YAAY,GACZ,MAAM,eAAe,CAAC;AACvB,OAAO,EACN,8BAA8B,EAE9B,cAAc,EAEd,eAAe,EAEf,cAAc,GACd,MAAM,YAAY,CAAC;AAEp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CAAC,CAAC;AAC/C,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,mBAAmB,CAClC,YAAyC,EACzC,KAAa;IAEb,MAAM,QAAQ,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;IAC5E,MAAM,gBAAgB,GAAG,QAAQ,CAAC,MAAM,CACvC,CAAC,CAAC,EAAE,EAAE,CACL,CAAC,CAAC,aAAa,KAAK,cAAc,CAAC,iBAAiB;QACpD,CAAC,CAAC,aAAa,KAAK,cAAc,CAAC,iBAAiB,CACrD,CAAC;IACF,MAAM,aAAa,GAAG,gBAAgB,CAAC,IAAI,CAC1C,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,eAAe,CAAC,QAAQ,CAC1C,CAAC;IACF,MAAM,iBAAiB,GAAG,gBAAgB,CAAC,IAAI,CAC9C,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,eAAe,CAAC,YAAY,CAC9C,CAAC;IACF,OAAO,aAAa,IAAI,iBAAiB,CAAC;AAC3C,CAAC;AAED,OAAO,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public surface of the medical layer.
|
|
3
|
+
*
|
|
4
|
+
* ─── SCOPE ──────────────────────────────────────────────────────────────────
|
|
5
|
+
*
|
|
6
|
+
* This directory owns the *data model*, its pure validation and its wire
|
|
7
|
+
* format: the credential type, the endorsement type, the professional record,
|
|
8
|
+
* the fail-closed registry seam, and — since `malla.ts` — the encrypted
|
|
9
|
+
* serialisation that lets a record actually travel. It does not own the mesh
|
|
10
|
+
* integration or the authz decision: `aPayloadGossipMedico` produces the object
|
|
11
|
+
* `MeshManager.transmitirConGossip` takes, but the method itself belongs to
|
|
12
|
+
* `src/mesh/index.ts`, which another owner owns.
|
|
13
|
+
*
|
|
14
|
+
* Layering, per `docs/medico/modelo-datos.md` §0:
|
|
15
|
+
*
|
|
16
|
+
* `types.ts` the four layers as types, no logic
|
|
17
|
+
* `canonica.ts` deterministic bytes + hashing (WebCrypto), no logic
|
|
18
|
+
* `credencial.ts` layer 1: build, sign, validate (fail closed)
|
|
19
|
+
* `aval.ts` layer 2: build, sign, validate, fold, adapt to karma
|
|
20
|
+
* `registro.ts` the registry seam + fail-closed licence lookup
|
|
21
|
+
* `registro-profesional.ts` the aggregate record and its rules
|
|
22
|
+
* `malla.ts` the wire format: seal, sign, verify, gossip adapter
|
|
23
|
+
*
|
|
24
|
+
* Everything is pure: no network, no filesystem, no clock read. `ahora` is always
|
|
25
|
+
* injected, and randomness for an `Aval` nonce is the caller's, so the whole
|
|
26
|
+
* layer is testable with fixtures and no I/O.
|
|
27
|
+
*/
|
|
28
|
+
export { aTransaccionKarma, avalCuentaParaPromocion, type BorradorAval, crearAval, idLicenciaDesdeNumero, MOTIVO_RECHAZO_AVAL, type MotivoRechazoAval, OBJETO_QUE_CUENTA, prepararCredencialParaAval, type ResultadoValidacionAval, resumirAvales, validarAval, validarAvalFirmado, verificarFirmaAval, } from "./aval.js";
|
|
29
|
+
export { bytesAHex, bytesAval, bytesCredencial, canonicalBytes, canonicalizarAval, canonicalizarCredencial, canonicalStringify, DOMINIO_ID_CREDENCIAL, hashCredencial, hashLicencia, hexABytes, idAval, idCredencial, normalizarLicencia, sha256, sha256Hex, } from "./canonica.js";
|
|
30
|
+
export { type BorradorCredencial, crearCredencial, esMedicoCertificado, hashDeCredencial, MOTIVO_RECHAZO_CREDENCIAL, type MotivoRechazoCredencial, type ResultadoValidacionCredencial, validarCredencial, validarCredencialFirmada, validarVinculoEmision, verificarFirmaCredencial, volcarCredencial, } from "./credencial.js";
|
|
31
|
+
export { type AvalWire, aPayloadGossipMedico, avalAWire, type CredencialMedicaWire, credencialAWire, type EmisionMedica, emitirAval, emitirCredencial, emitirRegistro, type MetodoVerificacionWire, MOTIVO_RECHAZO_MALLA, type MotivoRechazoMalla, type OpcionesEmitir, type OpcionesRecibir, PAYLOAD_MEDICO_TIPO, type RegistroPaisWire, type ResultadoRecepcion, recibirAval, recibirCredencial, registroAWire, wireAAval, wireACredencial, } from "./malla.js";
|
|
32
|
+
export { ESTADO_VERIFICACION_REGISTRO, type EstadoVerificacionRegistro, type InstantaneaRegistroPais, PAISES_SOPORTADOS, type ResultadoVerificacionRegistro, VerificadorRegistroEnMemoria, type VerificadorRegistroPais, verificarCredencialContraRegistro, verificarHashContraRegistro, verificarLicenciaContraRegistro, } from "./registro.js";
|
|
33
|
+
export { MOTIVO_RECHAZO_REGISTRO, type MotivoRechazoRegistro, type ResultadoValidacionRegistro, recalcularAvalRecibido, validarRegistroProfesional, } from "./registro-profesional.js";
|
|
34
|
+
export { ALCANCE_AVAL, type AlcanceAval, CAMPOS_OBLIGATORIOS_CREDENCIAL, CLASE_VERIFICACION, type ClaseVerificacion, type CredencialMedica, type DeclaracionNodo, ESTADO_EMISION, type Especialidad, type EstadoEmision, type MetodoVerificacion, OBJETO_AVAL, type ObjetoAval, type RegistroProfesional, type ResumenAvales, TIPO_CREDENCIAL, type TipoCredencial, VERSION_MODELO, } from "./types.js";
|
|
35
|
+
export { acreditarCon, acreditarContraRegistro, CLASES_NO_IMPLEMENTADAS, type ConsultaRegistroLicencia, type ConsultarEntradaRegistro, type EntradaRegistroLicencia, ESTADO_LICENCIA, ESTRATEGIA_REGISTRO_POR_PAIS, type EstadoLicencia, type EstrategiaAcreditacion, type FuenteAcreditacion, type MetodoVerificacionAplicado, MOTIVO_RECHAZO_CONSULTA_REGISTRO, type MotivoRechazoAcreditacion, type MotivoRechazoConsultaRegistro, metodoRegistroPorPais, RegistroLicenciasEnMemoria, type ResultadoAcreditacion, } from "./verificacion-registro.js";
|
|
36
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/medico/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EACN,iBAAiB,EACjB,uBAAuB,EACvB,KAAK,YAAY,EACjB,SAAS,EACT,qBAAqB,EACrB,mBAAmB,EACnB,KAAK,iBAAiB,EACtB,iBAAiB,EACjB,0BAA0B,EAC1B,KAAK,uBAAuB,EAC5B,aAAa,EACb,WAAW,EACX,kBAAkB,EAClB,kBAAkB,GAClB,MAAM,WAAW,CAAC;AACnB,OAAO,EACN,SAAS,EACT,SAAS,EACT,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,uBAAuB,EACvB,kBAAkB,EAClB,qBAAqB,EACrB,cAAc,EACd,YAAY,EACZ,SAAS,EACT,MAAM,EACN,YAAY,EACZ,kBAAkB,EAClB,MAAM,EACN,SAAS,GACT,MAAM,eAAe,CAAC;AACvB,OAAO,EACN,KAAK,kBAAkB,EACvB,eAAe,EACf,mBAAmB,EACnB,gBAAgB,EAChB,yBAAyB,EACzB,KAAK,uBAAuB,EAC5B,KAAK,6BAA6B,EAClC,iBAAiB,EACjB,wBAAwB,EACxB,qBAAqB,EACrB,wBAAwB,EACxB,gBAAgB,GAChB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACN,KAAK,QAAQ,EACb,oBAAoB,EACpB,SAAS,EACT,KAAK,oBAAoB,EACzB,eAAe,EACf,KAAK,aAAa,EAClB,UAAU,EACV,gBAAgB,EAChB,cAAc,EACd,KAAK,sBAAsB,EAC3B,oBAAoB,EACpB,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,mBAAmB,EACnB,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,WAAW,EACX,iBAAiB,EACjB,aAAa,EACb,SAAS,EACT,eAAe,GACf,MAAM,YAAY,CAAC;AACpB,OAAO,EACN,4BAA4B,EAC5B,KAAK,0BAA0B,EAC/B,KAAK,uBAAuB,EAC5B,iBAAiB,EACjB,KAAK,6BAA6B,EAClC,4BAA4B,EAC5B,KAAK,uBAAuB,EAC5B,iCAAiC,EACjC,2BAA2B,EAC3B,+BAA+B,GAC/B,MAAM,eAAe,CAAC;AACvB,OAAO,EACN,uBAAuB,EACvB,KAAK,qBAAqB,EAC1B,KAAK,2BAA2B,EAChC,sBAAsB,EACtB,0BAA0B,GAC1B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACN,YAAY,EACZ,KAAK,WAAW,EAChB,8BAA8B,EAC9B,kBAAkB,EAClB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,cAAc,EACd,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,WAAW,EACX,KAAK,UAAU,EACf,KAAK,mBAAmB,EACxB,KAAK,aAAa,EAClB,eAAe,EACf,KAAK,cAAc,EACnB,cAAc,GACd,MAAM,YAAY,CAAC;AAKpB,OAAO,EACN,YAAY,EACZ,uBAAuB,EACvB,uBAAuB,EACvB,KAAK,wBAAwB,EAC7B,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,EAC5B,eAAe,EACf,4BAA4B,EAC5B,KAAK,cAAc,EACnB,KAAK,sBAAsB,EAC3B,KAAK,kBAAkB,EACvB,KAAK,0BAA0B,EAC/B,gCAAgC,EAChC,KAAK,yBAAyB,EAC9B,KAAK,6BAA6B,EAClC,qBAAqB,EACrB,0BAA0B,EAC1B,KAAK,qBAAqB,GAC1B,MAAM,4BAA4B,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public surface of the medical layer.
|
|
3
|
+
*
|
|
4
|
+
* ─── SCOPE ──────────────────────────────────────────────────────────────────
|
|
5
|
+
*
|
|
6
|
+
* This directory owns the *data model*, its pure validation and its wire
|
|
7
|
+
* format: the credential type, the endorsement type, the professional record,
|
|
8
|
+
* the fail-closed registry seam, and — since `malla.ts` — the encrypted
|
|
9
|
+
* serialisation that lets a record actually travel. It does not own the mesh
|
|
10
|
+
* integration or the authz decision: `aPayloadGossipMedico` produces the object
|
|
11
|
+
* `MeshManager.transmitirConGossip` takes, but the method itself belongs to
|
|
12
|
+
* `src/mesh/index.ts`, which another owner owns.
|
|
13
|
+
*
|
|
14
|
+
* Layering, per `docs/medico/modelo-datos.md` §0:
|
|
15
|
+
*
|
|
16
|
+
* `types.ts` the four layers as types, no logic
|
|
17
|
+
* `canonica.ts` deterministic bytes + hashing (WebCrypto), no logic
|
|
18
|
+
* `credencial.ts` layer 1: build, sign, validate (fail closed)
|
|
19
|
+
* `aval.ts` layer 2: build, sign, validate, fold, adapt to karma
|
|
20
|
+
* `registro.ts` the registry seam + fail-closed licence lookup
|
|
21
|
+
* `registro-profesional.ts` the aggregate record and its rules
|
|
22
|
+
* `malla.ts` the wire format: seal, sign, verify, gossip adapter
|
|
23
|
+
*
|
|
24
|
+
* Everything is pure: no network, no filesystem, no clock read. `ahora` is always
|
|
25
|
+
* injected, and randomness for an `Aval` nonce is the caller's, so the whole
|
|
26
|
+
* layer is testable with fixtures and no I/O.
|
|
27
|
+
*/
|
|
28
|
+
export { aTransaccionKarma, avalCuentaParaPromocion, crearAval, idLicenciaDesdeNumero, MOTIVO_RECHAZO_AVAL, OBJETO_QUE_CUENTA, prepararCredencialParaAval, resumirAvales, validarAval, validarAvalFirmado, verificarFirmaAval, } from "./aval.js";
|
|
29
|
+
export { bytesAHex, bytesAval, bytesCredencial, canonicalBytes, canonicalizarAval, canonicalizarCredencial, canonicalStringify, DOMINIO_ID_CREDENCIAL, hashCredencial, hashLicencia, hexABytes, idAval, idCredencial, normalizarLicencia, sha256, sha256Hex, } from "./canonica.js";
|
|
30
|
+
export { crearCredencial, esMedicoCertificado, hashDeCredencial, MOTIVO_RECHAZO_CREDENCIAL, validarCredencial, validarCredencialFirmada, validarVinculoEmision, verificarFirmaCredencial, volcarCredencial, } from "./credencial.js";
|
|
31
|
+
export { aPayloadGossipMedico, avalAWire, credencialAWire, emitirAval, emitirCredencial, emitirRegistro, MOTIVO_RECHAZO_MALLA, PAYLOAD_MEDICO_TIPO, recibirAval, recibirCredencial, registroAWire, wireAAval, wireACredencial, } from "./malla.js";
|
|
32
|
+
export { ESTADO_VERIFICACION_REGISTRO, PAISES_SOPORTADOS, VerificadorRegistroEnMemoria, verificarCredencialContraRegistro, verificarHashContraRegistro, verificarLicenciaContraRegistro, } from "./registro.js";
|
|
33
|
+
export { MOTIVO_RECHAZO_REGISTRO, recalcularAvalRecibido, validarRegistroProfesional, } from "./registro-profesional.js";
|
|
34
|
+
export { ALCANCE_AVAL, CAMPOS_OBLIGATORIOS_CREDENCIAL, CLASE_VERIFICACION, ESTADO_EMISION, OBJETO_AVAL, TIPO_CREDENCIAL, VERSION_MODELO, } from "./types.js";
|
|
35
|
+
// The foundation-verification layer: credential → accreditation. Re-exported
|
|
36
|
+
// here so the medical layer keeps a single public surface, and so the parallel
|
|
37
|
+
// agent working on the wire protocol imports from the same place.
|
|
38
|
+
export { acreditarCon, acreditarContraRegistro, CLASES_NO_IMPLEMENTADAS, ESTADO_LICENCIA, ESTRATEGIA_REGISTRO_POR_PAIS, MOTIVO_RECHAZO_CONSULTA_REGISTRO, metodoRegistroPorPais, RegistroLicenciasEnMemoria, } from "./verificacion-registro.js";
|
|
39
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/medico/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EACN,iBAAiB,EACjB,uBAAuB,EAEvB,SAAS,EACT,qBAAqB,EACrB,mBAAmB,EAEnB,iBAAiB,EACjB,0BAA0B,EAE1B,aAAa,EACb,WAAW,EACX,kBAAkB,EAClB,kBAAkB,GAClB,MAAM,WAAW,CAAC;AACnB,OAAO,EACN,SAAS,EACT,SAAS,EACT,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,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