@dotrino/remote-agent 0.2.0 → 0.2.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 (2) hide show
  1. package/package.json +2 -2
  2. package/src/link.js +5 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dotrino/remote-agent",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Middleware compartido del ecosistema Dotrino para apps de agente remoto cifrado punto a punto (handshake E2E, emparejamiento SAS con vault, revocación, descubrimiento). Lo consumen dotrino-terminal (PTY) y dotrino-ia (chat con IA).",
5
5
  "type": "module",
6
6
  "main": "./index.js",
@@ -22,7 +22,7 @@
22
22
  "test": "node -e \"import('@dotrino/remote-agent').then(()=>console.log('ok'))\""
23
23
  },
24
24
  "dependencies": {
25
- "@dotrino/identity": "0.21.0",
25
+ "@dotrino/identity": "0.23.0",
26
26
  "@dotrino/proxy-client": "0.6.4",
27
27
  "ws": "8.21.0"
28
28
  },
package/src/link.js CHANGED
@@ -17,7 +17,7 @@ import fs from 'node:fs'
17
17
  import path from 'node:path'
18
18
  import os from 'node:os'
19
19
  import {
20
- makeDeviceKey, signWithDevice, verifyDelegation, makePairingCode, pubkeyId
20
+ makeDeviceKey, signWithDevice, verifyDelegation, makePairingCode, commitCode, pubkeyId
21
21
  } from '@dotrino/identity/capabilities'
22
22
  import { installNodeGlobals } from '../node-globals.js'
23
23
 
@@ -101,7 +101,10 @@ export async function enroll ({ qr, label = 'remote-agent', dir = dataDir(), onC
101
101
  // lo mostramos y NO lo enviamos. La bóveda lo aprende solo cuando un humano lo tipea
102
102
  // y nos lo ECHA de vuelta → así aprobar exige TENER esta máquina (de aquí sale el código).
103
103
  const code = makePairingCode()
104
- const data = { op: 'enroll', dpub: device.publickey, token: qr.token, sn: qr.sn, label, ts: Date.now() }
104
+ // El COMPROMISO del código (nunca el código): la bóveda lo recompone con lo que
105
+ // tipeas y solo entonces firma el cert → aprobar exige haber leído esta pantalla.
106
+ const commit = await commitCode({ code, dpub: device.publickey, sn: qr.sn })
107
+ const data = { op: 'enroll', dpub: device.publickey, token: qr.token, sn: qr.sn, commit, label, ts: Date.now() }
105
108
  const { signature } = await signWithDevice({ privateJwk: device.privateJwk, data })
106
109
 
107
110
  const done = new Promise((resolve, reject) => {