@dotrino/vaultd 0.168.0 → 0.169.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/lib/src/core/libVersion.js +1 -1
- package/lib/src/core/transport.js +21 -1
- package/lib/src/core/vault.js +20 -6
- package/package.json +2 -2
|
@@ -85,6 +85,21 @@ export async function createTransport ({ identity, url = DEFAULT_PROXY, commKey
|
|
|
85
85
|
|
|
86
86
|
await client.connect()
|
|
87
87
|
|
|
88
|
+
// LO ENCOLADO LLEGA AL IDENTIFICARSE, y quien monta la bóveda todavía no escucha: pone su
|
|
89
|
+
// oyente cuando ya tiene todo listo, bastante después. Sin esto, lo que el proxio guardaba
|
|
90
|
+
// para una bóveda dormida —el acta nueva que sacó la otra bóveda, un pedido— se entregaba
|
|
91
|
+
// a nadie y se perdía. Se guarda aquí hasta que llegue el oyente (`listen`).
|
|
92
|
+
let early = []
|
|
93
|
+
const offEarly = client.on('message', (from, payload) => { early?.push([from, payload]) })
|
|
94
|
+
const listen = (fn) => {
|
|
95
|
+
const off = client.on('message', fn)
|
|
96
|
+
const pending = early || []
|
|
97
|
+
early = null
|
|
98
|
+
try { offEarly?.() } catch (_) {}
|
|
99
|
+
for (const [from, payload] of pending) { try { fn(from, payload) } catch (_) {} }
|
|
100
|
+
return off
|
|
101
|
+
}
|
|
102
|
+
|
|
88
103
|
const identify = async () => {
|
|
89
104
|
identified = false
|
|
90
105
|
if (!client.token) return
|
|
@@ -195,6 +210,11 @@ export async function createTransport ({ identity, url = DEFAULT_PROXY, commKey
|
|
|
195
210
|
if (!comm || !seenActa) { log('[vault] cannot register the wake URL: no communication key in the record yet'); return }
|
|
196
211
|
try {
|
|
197
212
|
await client.registerWake({ publicKey: comm, sign: (d) => commKey.sign(d), url: wakeUrl, acta: seenActa, channel: announce || undefined })
|
|
213
|
+
// Y POR SU PROPIA LLAVE. Lo dirigido a la cuenta solo la despierta si no hay nadie más
|
|
214
|
+
// de la cuenta conectado; con otra bóveda encendida, nunca. La consola que elige ESTA
|
|
215
|
+
// bóveda le escribe a su llave de comunicación (`vault` en el acta), y es por ella
|
|
216
|
+
// por donde tiene que despertarse.
|
|
217
|
+
await client.registerWake({ publicKey: comm, sign: (d) => commKey.sign(d), url: wakeUrl, acta: seenActa, self: true })
|
|
198
218
|
log('[vault] wake URL registered on the proxy')
|
|
199
219
|
} catch (e) {
|
|
200
220
|
log(`[vault] could not register the wake URL (${e.code || ''} ${e.message}) — the proxy will not wake this vault`)
|
|
@@ -286,5 +306,5 @@ export async function createTransport ({ identity, url = DEFAULT_PROXY, commKey
|
|
|
286
306
|
}, RECHECK_MS)
|
|
287
307
|
watchdog.unref?.()
|
|
288
308
|
|
|
289
|
-
return { client, token: client.token, identify: identifyWithRetry, isIdentified: () => identified }
|
|
309
|
+
return { client, token: client.token, identify: identifyWithRetry, isIdentified: () => identified, listen }
|
|
290
310
|
}
|
package/lib/src/core/vault.js
CHANGED
|
@@ -478,9 +478,17 @@ export async function startVault ({ platform, proxyUrl, log = console.log, onEnr
|
|
|
478
478
|
const acta = info?.acta
|
|
479
479
|
if (!acta || isLocked() || identity.masterLocked) return false
|
|
480
480
|
const pub = await commKey.ensure()
|
|
481
|
-
|
|
481
|
+
const mine = (acta.members || []).find((m) => m?.pub === pub)
|
|
482
482
|
if (!info?.isMaster) return false
|
|
483
|
-
|
|
483
|
+
// DE QUÉ BÓVEDA ES (`vault`: esta maestra). Con dos bóvedas en la cuenta es lo único que
|
|
484
|
+
// deja a la consola escribirle a una sola. A la llave que entró antes del campo se le pone.
|
|
485
|
+
if (mine) {
|
|
486
|
+
if (mine.vault || !master) return false
|
|
487
|
+
await identity.setMemberVault({ pub, vault: master })
|
|
488
|
+
log('[vault] the record now says which vault this communication key speaks for')
|
|
489
|
+
return true
|
|
490
|
+
}
|
|
491
|
+
await identity.admitMember({ pub, label: 'esta bóveda', cn: COMM_CN, caps: [...COMM_CAPS], ...(master ? { vault: master } : {}) })
|
|
484
492
|
log('[vault] this vault is now a member of its own record: it talks with its own key, not the master one')
|
|
485
493
|
return true
|
|
486
494
|
} catch (e) {
|
|
@@ -488,12 +496,14 @@ export async function startVault ({ platform, proxyUrl, log = console.log, onEnr
|
|
|
488
496
|
return false
|
|
489
497
|
}
|
|
490
498
|
}
|
|
491
|
-
|
|
499
|
+
// Lo que se selló aquí se anuncia cuando ya hay transporte (más abajo): sin el aviso, la otra
|
|
500
|
+
// bóveda de la cuenta no se entera y las dos acaban con actas distintas del mismo número.
|
|
501
|
+
const commSealedAtStart = await ensureCommKeyInActa()
|
|
492
502
|
|
|
493
503
|
// `announce`: el canal de ESTA cuenta, para que una máquina prestada —que no tiene
|
|
494
504
|
// ninguna llave y solo sabe la dirección `nombre@AB12-CD34-EF56`— pueda encontrar a quien
|
|
495
505
|
// la atiende. Lo construye la pieza compartida, porque quien lo busca es la extensión.
|
|
496
|
-
const { client, identify: reidentify, isIdentified } = await createTransport({
|
|
506
|
+
const { client, identify: reidentify, isIdentified, listen } = await createTransport({
|
|
497
507
|
identity, url: proxyUrl, commKey, log, announce: vaultChannel(fp), makeClient: platform.makeClient || null, wakeUrl: platform.wakeUrl || null
|
|
498
508
|
})
|
|
499
509
|
|
|
@@ -501,6 +511,7 @@ export async function startVault ({ platform, proxyUrl, log = console.log, onEnr
|
|
|
501
511
|
// que le dicen a un tercero si esta cuenta sigue sellada por quien él cree. Ver
|
|
502
512
|
// `sealers.js` — es una comodidad para quien lee, nunca una dependencia de la bóveda.
|
|
503
513
|
startSealersPublisher({ identity, client, log })
|
|
514
|
+
if (commSealedAtStart) await notifyMembers('commkey')
|
|
504
515
|
|
|
505
516
|
async function revocationSet () {
|
|
506
517
|
const { revoked } = await identity.listDelegations()
|
|
@@ -2218,7 +2229,8 @@ export async function startVault ({ platform, proxyUrl, log = console.log, onEnr
|
|
|
2218
2229
|
reply(from, { type: MSG.INCIDENT_RESULT, id: pend.id, approvers, blocked: false })
|
|
2219
2230
|
}
|
|
2220
2231
|
|
|
2221
|
-
client.on
|
|
2232
|
+
// `listen` y no `client.on`: entrega también lo que llegó encolado antes de este punto.
|
|
2233
|
+
listen((from, payload) => {
|
|
2222
2234
|
// Quien monta la bóveda puede querer saber que hay trabajo (la Lambda se apaga cuando
|
|
2223
2235
|
// deja de haberlo). Es un aviso, no decide nada.
|
|
2224
2236
|
try { platform.onActivity?.() } catch (_) {}
|
|
@@ -4293,7 +4305,9 @@ export async function startVault ({ platform, proxyUrl, log = console.log, onEnr
|
|
|
4293
4305
|
// la bóveda seguía muda en el proxio con su llave ya admitida en el acta. Al dueño le
|
|
4294
4306
|
// pasó el 2026-09-05: hizo lo que el log pedía y la consola siguió sin contestar.
|
|
4295
4307
|
if (r?.locked === false) {
|
|
4296
|
-
try {
|
|
4308
|
+
try {
|
|
4309
|
+
if (await ensureCommKeyInActa()) { await reidentify?.(); await notifyMembers('commkey') }
|
|
4310
|
+
} catch (_) {}
|
|
4297
4311
|
}
|
|
4298
4312
|
// Y ABSORBER LO PENDIENTE. La subacta ya lo estaba honrando con el perfil cerrado —de
|
|
4299
4313
|
// eso vive—, pero mientras siga ahí solo lo sabe esta máquina: al sellarlo, entra en
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dotrino/vaultd",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.169.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Certificador personal de Dotrino: daemon headless que custodia la clave maestra y delega capacidades a tus dispositivos por el proxy. Tu CA propia.",
|
|
6
6
|
"bin": {
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@dotrino/compat": "0.4.0",
|
|
25
|
-
"@dotrino/identity": "0.
|
|
25
|
+
"@dotrino/identity": "0.125.0",
|
|
26
26
|
"@dotrino/opaque": "0.1.0",
|
|
27
27
|
"@dotrino/passmanager": "0.18.4",
|
|
28
28
|
"@dotrino/proxy-client": "0.39.0",
|