@dotrino/vault 0.36.0 → 0.37.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 +1 -1
- 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.37.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
|
@@ -359,7 +359,7 @@ export function createEnrollDesk ({
|
|
|
359
359
|
pend.state = 'DONE'
|
|
360
360
|
pending.delete(pend.token)
|
|
361
361
|
fire(onPendingChange)
|
|
362
|
-
log(
|
|
362
|
+
log(`[vault] device approved: ${pend.deviceId}`)
|
|
363
363
|
return { ok: true, deviceId: pend.deviceId, cert }
|
|
364
364
|
}
|
|
365
365
|
|
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 */ }
|