@dotrino/vault 0.36.0 → 0.38.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/package.json +2 -2
- package/src/enroll.js +7 -2
- package/src/service.js +3 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dotrino/vault",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.38.0",
|
|
4
4
|
"description": "Usa ESTE dispositivo (navegador) como bóveda/CA del ecosistema Dotrino: atiende enrolamientos por el proxy y firma certificados de delegación a tus máquinas. Incluye el cliente de SERVICIO (Node): un proyecto se enrola una vez y jala sus credenciales del vault en vez del .env (`import '@dotrino/vault/config'`).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"pairing"
|
|
48
48
|
],
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@dotrino/identity": ">=0.
|
|
50
|
+
"@dotrino/identity": ">=0.64.0",
|
|
51
51
|
"@dotrino/proxy-client": ">=0.13.0"
|
|
52
52
|
},
|
|
53
53
|
"license": "MIT",
|
package/src/enroll.js
CHANGED
|
@@ -277,7 +277,12 @@ export function createEnrollDesk ({
|
|
|
277
277
|
pend.continuity = (okC && d.continuity.member === d.dpub) ? d.continuity : null
|
|
278
278
|
}
|
|
279
279
|
pend.from = from // la bóveda NO conoce el código: lo aprende cuando lo tipeas
|
|
280
|
-
|
|
280
|
+
// EL NOMBRE QUE PUSISTE AQUÍ MANDA. El aparato manda el suyo al enrolarse, y hasta
|
|
281
|
+
// ahora pisaba siempre al de la bóveda — como el aparato usa por defecto el apodo del
|
|
282
|
+
// PERFIL, acababas con varios dispositivos llamados igual que tú y sin forma de saber
|
|
283
|
+
// cuál era cuál. Si en `pair` le diste un nombre, ese es el nombre; el del aparato
|
|
284
|
+
// sigue valiendo como propuesta cuando no dijiste nada.
|
|
285
|
+
if (d.label && !pend.label) pend.label = String(d.label).slice(0, 60)
|
|
281
286
|
// Camino A: de qué cuenta estamos hablando. Se guarda para poder comprobar, cuando
|
|
282
287
|
// llegue el acta sellada, que es la que este dispositivo dijo que iba a entregar.
|
|
283
288
|
if (intent === 'adopt' && typeof d.profileId === 'string') pend.profileId = d.profileId
|
|
@@ -359,7 +364,7 @@ export function createEnrollDesk ({
|
|
|
359
364
|
pend.state = 'DONE'
|
|
360
365
|
pending.delete(pend.token)
|
|
361
366
|
fire(onPendingChange)
|
|
362
|
-
log(
|
|
367
|
+
log(`[vault] device approved: ${pend.deviceId}`)
|
|
363
368
|
return { ok: true, deviceId: pend.deviceId, cert }
|
|
364
369
|
}
|
|
365
370
|
|
package/src/service.js
CHANGED
|
@@ -23,8 +23,7 @@ import path from 'node:path'
|
|
|
23
23
|
import { createHash } from 'node:crypto'
|
|
24
24
|
import {
|
|
25
25
|
makeDeviceKey, makeDeviceEncKey, importDeviceEncKey, signWithDevice, verifyDelegation,
|
|
26
|
-
verifyDeviceSig, makePairingCode, commitCode, pubkeyId
|
|
27
|
-
} from '@dotrino/identity/capabilities'
|
|
26
|
+
verifyDeviceSig, makePairingCode, commitCode, pubkeyId, PEER_SKEW_MS } from '@dotrino/identity/capabilities'
|
|
28
27
|
import { openWrap, wrapForMember, decryptWithCek } from '@dotrino/identity/content'
|
|
29
28
|
import { verifyActa, sealKeyAt } from '@dotrino/identity/acta'
|
|
30
29
|
import { MSG, secretsScope, isValidSecretsNs } from './protocol.js'
|
|
@@ -298,7 +297,7 @@ export async function enrollWithVault ({ qr, label = 'agent', expectedScope = nu
|
|
|
298
297
|
const res = await enrolled
|
|
299
298
|
|
|
300
299
|
if (res.code !== code) throw new Error('the vault echoed a code other than the one shown (possible malicious relay)')
|
|
301
|
-
const v = await verifyDelegation({ cert: res.cert, expectedSub: device.publickey, ...(expectedScope ? { expectedScope } : {}) })
|
|
300
|
+
const v = await verifyDelegation({ cert: res.cert, expectedSub: device.publickey, skewMs: PEER_SKEW_MS, ...(expectedScope ? { expectedScope } : {}) })
|
|
302
301
|
if (!v.ok) throw new Error('invalid cert: ' + v.reason)
|
|
303
302
|
if (res.cert.iss !== qr.iss) throw new Error('cert signed by a master other than the one in the QR')
|
|
304
303
|
|
|
@@ -440,7 +439,7 @@ export async function fetchSecrets ({ dir, ns, proxyUrl, masterPubkey, device, c
|
|
|
440
439
|
client.sendByPubkey(masterPubkey, { type: MSG.RENEW, data, signature, cert })
|
|
441
440
|
const res = await pending
|
|
442
441
|
if (res.type === MSG.RENEWED && res.cert?.sub === device.publickey) {
|
|
443
|
-
const v = await verifyDelegation({ cert: res.cert, expectedSub: device.publickey, expectedScope: secretsScope(ns) })
|
|
442
|
+
const v = await verifyDelegation({ cert: res.cert, expectedSub: device.publickey, skewMs: PEER_SKEW_MS, expectedScope: secretsScope(ns) })
|
|
444
443
|
if (v.ok) { cert = res.cert; if (dir && saved) writeServiceIdentity(dir, { ...saved, cert }) }
|
|
445
444
|
}
|
|
446
445
|
} catch (_) { /* la renovación no bloquea el fetch */ }
|