@dotrino/vaultd 0.175.0 → 0.175.2
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/browser.js +30 -10
- package/lib/src/core/libVersion.js +1 -1
- package/lib/src/passwordLogins.js +6 -2
- package/package.json +2 -2
- package/src/vaultControl.js +2 -2
package/lib/src/browser.js
CHANGED
|
@@ -25,9 +25,33 @@ import { memberScopes } from '@dotrino/identity/acta'
|
|
|
25
25
|
import { deviceIdOf } from './enroll.js'
|
|
26
26
|
|
|
27
27
|
const DEFAULT_PROXY = 'wss://proxy.dotrino.com'
|
|
28
|
-
/**
|
|
28
|
+
/**
|
|
29
|
+
* Cada cuánto se MIRA si el papel de la consola local sigue al día. Solo se vuelve a firmar
|
|
30
|
+
* cuando el acta cambió (ver `selfCert`).
|
|
31
|
+
*/
|
|
29
32
|
const SELF_CERT_EVERY_MS = 60_000
|
|
30
33
|
|
|
34
|
+
/**
|
|
35
|
+
* EL PAPEL DE LA CONSOLA LOCAL, firmado solo cuando hace falta. Un certificado muere con el
|
|
36
|
+
* acta (`seq`), así que mientras ni el `seq` ni los permisos de `master` cambien, el de antes
|
|
37
|
+
* sigue valiendo y no se vuelve a firmar: la bóveda no firma sola sin que nadie haga nada.
|
|
38
|
+
* Devuelve una función que da el papel vigente, o `null` si el acta no le deja nada.
|
|
39
|
+
*/
|
|
40
|
+
export function selfCertIssuer ({ identity, master }) {
|
|
41
|
+
let issued = null // { key, cert }
|
|
42
|
+
return async () => {
|
|
43
|
+
const acta = (await identity.profileActa().catch(() => null))?.acta || null
|
|
44
|
+
if (!acta) { issued = null; return null }
|
|
45
|
+
const scope = memberScopes(acta, master)
|
|
46
|
+
if (!scope.length) { issued = null; return null }
|
|
47
|
+
const key = acta.seq + '|' + [...scope].sort().join(',')
|
|
48
|
+
if (issued?.key === key) return issued.cert
|
|
49
|
+
const cert = (await identity.signDelegation(master, scope, { label: 'self' })).cert
|
|
50
|
+
issued = { key, cert }
|
|
51
|
+
return cert
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
31
55
|
/**
|
|
32
56
|
* @param {object} opts
|
|
33
57
|
* @param {object} opts.core el núcleo de identidad ya abierto (`createIdentityCore`)
|
|
@@ -99,8 +123,10 @@ export async function startBrowserVault ({ core, proxyUrl = DEFAULT_PROXY, makeC
|
|
|
99
123
|
})
|
|
100
124
|
|
|
101
125
|
// EL PAPEL CON EL QUE LA CONSOLA DE ESTE NAVEGADOR ADMINISTRA ESTA BÓVEDA: la llave del
|
|
102
|
-
// perfil firmándose a sí misma con lo que el acta le deja hoy. Se
|
|
103
|
-
//
|
|
126
|
+
// perfil firmándose a sí misma con lo que el acta le deja hoy. Se mira cada minuto porque
|
|
127
|
+
// el acta cambia (un permiso que te quitas, un sellado nuevo), pero se FIRMA solo cuando
|
|
128
|
+
// cambió: la bóveda no firma sola sin que nadie haga nada (dueño, 2026-10-25). Antes se
|
|
129
|
+
// rehacía cada minuto, y cada vez retiraba el anterior en el registro de papeles.
|
|
104
130
|
const master = identity.me.publickey
|
|
105
131
|
// LA BÓVEDA ES DE UNA CUENTA. Si en esta pestaña se abre otra (crear perfil, entrar con
|
|
106
132
|
// contraseña), la identidad cambia por debajo y la bóveda firmaría como la nueva con el
|
|
@@ -111,13 +137,7 @@ export async function startBrowserVault ({ core, proxyUrl = DEFAULT_PROXY, makeC
|
|
|
111
137
|
throw Object.assign(new Error('the account open in this tab changed: this vault was started for another one; reload the tab'), { code: 'profile-changed' })
|
|
112
138
|
}
|
|
113
139
|
}
|
|
114
|
-
const selfCert =
|
|
115
|
-
const acta = (await identity.profileActa().catch(() => null))?.acta || null
|
|
116
|
-
if (!acta) return null
|
|
117
|
-
const scope = memberScopes(acta, master)
|
|
118
|
-
if (!scope.length) return null
|
|
119
|
-
return (await identity.signDelegation(master, scope, { label: 'self' })).cert
|
|
120
|
-
}
|
|
140
|
+
const selfCert = selfCertIssuer({ identity, master })
|
|
121
141
|
/**
|
|
122
142
|
* EL DUEÑO EN SU MÁQUINA ADMINISTRA. En el binario eso es la TUI, que no necesita ningún
|
|
123
143
|
* permiso del acta; aquí la consola habla el protocolo de la consola remota, que exige
|
|
@@ -507,8 +507,8 @@ export async function createPasswordLogin ({ user, password, label, caps, begin,
|
|
|
507
507
|
const fin = opaque.registrationFinish({ state: start.state, response: begun.response, password })
|
|
508
508
|
const device = await makeDeviceKey({ label })
|
|
509
509
|
const enc = await makeDeviceEncKey()
|
|
510
|
-
const blob = await sealDeviceKeys(fin.exportKey, { sign: device.privateJwk, enc: enc.
|
|
511
|
-
return finish({ user, upload: fin.upload, pub: device.publickey, encPub: enc.
|
|
510
|
+
const blob = await sealDeviceKeys(fin.exportKey, { sign: device.privateJwk, enc: enc.encPrivateJwk })
|
|
511
|
+
return finish({ user, upload: fin.upload, pub: device.publickey, encPub: enc.encPublickey, label, blob, caps })
|
|
512
512
|
}
|
|
513
513
|
|
|
514
514
|
export async function registerLogin ({
|
|
@@ -540,6 +540,10 @@ export async function registerLogin ({
|
|
|
540
540
|
if (typeof identity?.admitMember !== 'function') {
|
|
541
541
|
throw Object.assign(new Error('this vault cannot add devices to the account record: no login was created'), { code: 'admit-unavailable' })
|
|
542
542
|
}
|
|
543
|
+
// SIN LLAVE DE CIFRADO NO ENTRA. Un aparato así está en el acta pero nada se le puede
|
|
544
|
+
// sellar: no recibe contraseñas ni cajones, y lo único que hace es pedir. Pasó el
|
|
545
|
+
// 2026-10-26 (el alta leía `enc.publickey`, que no existe) y nadie lo vio hasta usarlo.
|
|
546
|
+
if (!encPub) throw Object.assign(new Error('a password login needs its encryption public key'), { code: 'no-encpub' })
|
|
543
547
|
const deviceId = await deviceIdOf(pub)
|
|
544
548
|
await logins.registerFinish({ user, upload, pub, encPub, deviceId, label, blob })
|
|
545
549
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dotrino/vaultd",
|
|
3
|
-
"version": "0.175.
|
|
3
|
+
"version": "0.175.2",
|
|
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": {
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"@dotrino/compat": "0.4.0",
|
|
25
25
|
"@dotrino/identity": "0.126.4",
|
|
26
26
|
"@dotrino/opaque": "0.1.0",
|
|
27
|
-
"@dotrino/passmanager": "0.18.
|
|
27
|
+
"@dotrino/passmanager": "0.18.6",
|
|
28
28
|
"@dotrino/proxy-client": "^0.45.0",
|
|
29
29
|
"@dotrino/roadmap": "0.4.63",
|
|
30
30
|
"@dotrino/store": "0.12.3",
|
package/src/vaultControl.js
CHANGED
|
@@ -306,11 +306,11 @@ export async function addLogin ({ user, password, label = 'equipo prestado', cap
|
|
|
306
306
|
const fin = opaque.registrationFinish({ state: start.state, response: begun.response, password })
|
|
307
307
|
const device = await makeDeviceKey({ label })
|
|
308
308
|
const enc = await makeDeviceEncKey()
|
|
309
|
-
const blob = await sealDeviceKeys(fin.exportKey, { sign: device.privateJwk, enc: enc.
|
|
309
|
+
const blob = await sealDeviceKeys(fin.exportKey, { sign: device.privateJwk, enc: enc.encPrivateJwk })
|
|
310
310
|
// Los PERMISOS del acta, tal cual: cualquiera, y todos por el mismo camino. Traducirlos a
|
|
311
311
|
// los scopes del certificado es cosa del pilar (`registerLogin`), no de esta pantalla.
|
|
312
312
|
return loginsOp('register-finish', {
|
|
313
|
-
user, upload: fin.upload, pub: device.publickey, encPub: enc.
|
|
313
|
+
user, upload: fin.upload, pub: device.publickey, encPub: enc.encPublickey, label, blob, caps
|
|
314
314
|
})
|
|
315
315
|
}
|
|
316
316
|
|