@dotrino/identity 0.122.0 → 0.124.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 +1 -1
- package/src/index.js +2 -2
- package/vault/acta.js +18 -2
- package/vault/core.js +4 -4
- package/vault/facade.js +1 -1
- package/vault/remote.js +11 -3
- package/vault/vault.js +23 -6
- package/vault/vendor/proxy-client/VERSION.txt +1 -1
- package/vault/vendor/proxy-client/client.js +10 -3
- package/vault/vendor/roadmap/VERSION.txt +1 -1
- package/vault/vendor/roadmap/manifests.js +26 -25
- package/vault/vendor/vault/VERSION.txt +1 -1
- package/vault/vendor/vault/browser.js +42 -11
- package/vault/vendor/vault/core/libVersion.js +1 -1
- package/vault/vendor/vault/enroll.js +7 -1
- package/vault/vendor/vault/revocation.js +5 -1
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -431,10 +431,10 @@ export class Identity {
|
|
|
431
431
|
* está emparejada con esa misma bóveda. Si no, falla antes de tocar la red.
|
|
432
432
|
* @returns {Promise<{ ok:boolean, deviceId:string, master:string, exp:number, scope:string[] }>}
|
|
433
433
|
*/
|
|
434
|
-
async enrollDevice (qr, { label = '', join = 'current' } = {}) {
|
|
434
|
+
async enrollDevice (qr, { label = '', join = 'current', account = null } = {}) {
|
|
435
435
|
// DÓNDE CORRE se mira AQUÍ, en la página, y no dentro del iframe: el iframe no ve si la
|
|
436
436
|
// página es una extensión o la app nativa (`vault/machine.js`).
|
|
437
|
-
return this._call('vaultPair', { qr, label, join, machine: browserMachine() }, 200000)
|
|
437
|
+
return this._call('vaultPair', { qr, label, join, account, machine: browserMachine() }, 200000)
|
|
438
438
|
}
|
|
439
439
|
|
|
440
440
|
/** Estado de emparejamiento: { paired, deviceId?, master?, scope?, exp?, pairedAt? }. */
|
package/vault/acta.js
CHANGED
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
* Módulo PURO: sin kv, sin red, sin disco. Cripto de `./capabilities.js`.
|
|
36
36
|
*/
|
|
37
37
|
import { canonicalStringify } from './core.js'
|
|
38
|
-
import { signWithDevice, verifyDeviceSig, verifyDelegation, keyLabel } from './capabilities.js'
|
|
38
|
+
import { signWithDevice, verifyDeviceSig, verifyDelegation, keyLabel, pubkeyId } from './capabilities.js'
|
|
39
39
|
import { cleanMachine } from './machine.js'
|
|
40
40
|
export { cleanMachine }
|
|
41
41
|
|
|
@@ -639,6 +639,22 @@ export async function verifySignedBy (args = {}) {
|
|
|
639
639
|
return { ok: true, profileId: c.profileId, seq: c.seq, signer: publickey }
|
|
640
640
|
}
|
|
641
641
|
|
|
642
|
+
/**
|
|
643
|
+
* ¿ESTA INVITACIÓN ES DE LA CUENTA QUE ESPERO? Para un aparato que solo puede entrar en una
|
|
644
|
+
* cuenta (la réplica o la bóveda alojadas, que van atadas a la cuenta que las pagó). El reto del
|
|
645
|
+
* alta trae la cadena de selladoras de la bóveda que invita: se verifica, se comprueba que quien
|
|
646
|
+
* contestó sella esa cuenta y se compara el id del perfil con el esperado (`pubkeyId`, 64 hex).
|
|
647
|
+
* Devuelve `null` si es la cuenta, o el porqué si no.
|
|
648
|
+
*/
|
|
649
|
+
export async function accountMismatch (chain, iss, account) {
|
|
650
|
+
if (!Array.isArray(chain) || !chain.length) return 'the vault did not say which account it belongs to (it may need an update)'
|
|
651
|
+
const c = await verifySealerChain(chain)
|
|
652
|
+
if (!c.ok) return 'the vault account could not be verified: ' + c.reason
|
|
653
|
+
if (!canSeal(chain[chain.length - 1], iss)) return 'the vault that answered does not seal that account'
|
|
654
|
+
const got = await pubkeyId(c.profileId)
|
|
655
|
+
return got === account ? null : `the invitation is from account ${got}, not from ${account}`
|
|
656
|
+
}
|
|
657
|
+
|
|
642
658
|
export async function verifySealerChain (chain, { expectedProfileId = null } = {}) {
|
|
643
659
|
if (!Array.isArray(chain) || !chain.length) return { ok: false, reason: 'empty-chain' }
|
|
644
660
|
const [raiz] = chain
|
|
@@ -1307,7 +1323,7 @@ export async function canAdopt ({ candidate, current }) {
|
|
|
1307
1323
|
}
|
|
1308
1324
|
|
|
1309
1325
|
export default {
|
|
1310
|
-
ACTA_V, CAPS, CAP_SCOPE, genesisActa, actaBody, actaHash, memberId, checkShape, verifySealerChain, verifySignedBy,
|
|
1326
|
+
ACTA_V, CAPS, CAP_SCOPE, genesisActa, actaBody, actaHash, memberId, checkShape, verifySealerChain, accountMismatch, verifySignedBy,
|
|
1311
1327
|
sealActa, verifyActa, checkVaultReply, applyChanges, makeRenounce, verifyRenounce,
|
|
1312
1328
|
makeContinuity, verifyContinuity,
|
|
1313
1329
|
cardBody, makeProfileCard, verifyProfileCard, canAdoptCard, sealersOf, canSeal,
|
package/vault/core.js
CHANGED
|
@@ -1329,7 +1329,7 @@ export async function createIdentityCore ({ kv: hostKv, peers, makeSync = null,
|
|
|
1329
1329
|
* cert contra la bóveda y entra a su cuenta. Aparte para que la decisión de CUÁL cuenta y
|
|
1330
1330
|
* el deshacerla si esto falla vivan juntos arriba, y aquí solo quede el trámite.
|
|
1331
1331
|
*/
|
|
1332
|
-
async function pairWithVault ({ qr, label = '', machine = undefined }) {
|
|
1332
|
+
async function pairWithVault ({ qr, label = '', machine = undefined, account = null }) {
|
|
1333
1333
|
// Usa la PROPIA llave de identidad de este navegador como dispositivo: el cert delega
|
|
1334
1334
|
// TU identidad (P) desde la maestra M → una sola identidad (signData/identify/cert = P).
|
|
1335
1335
|
// La privada es la CryptoKey del perfil (no extractable): se pasa como `privateKey`
|
|
@@ -1343,7 +1343,7 @@ export async function createIdentityCore ({ kv: hostKv, peers, makeSync = null,
|
|
|
1343
1343
|
const continuity = (mine && mine.members.length === 1 && !isPendingJoin())
|
|
1344
1344
|
? await Acta.makeContinuity({ member: publickeyJwkStr, from: mine.profileId, privateKey: masterKey() })
|
|
1345
1345
|
: null
|
|
1346
|
-
const res = await remoteEnroll({ qr, device, continuity, encPub: encPublickeyJwkStr, label: label || me?.nickname || '', machine: machine === undefined && pageMachine ? pageMachine : machine, onChallenge: (c) => emitVault({ phase: 'challenge', deviceId: c.deviceId, code: c.code }) })
|
|
1346
|
+
const res = await remoteEnroll({ qr, device, continuity, encPub: encPublickeyJwkStr, label: label || me?.nickname || '', machine: machine === undefined && pageMachine ? pageMachine : machine, account, onChallenge: (c) => emitVault({ phase: 'challenge', deviceId: c.deviceId, code: c.code }) })
|
|
1347
1347
|
kv.setItem(VAULT_DEVICE_STORAGE, JSON.stringify({ useIdentityKey: true, publickey: publickeyJwkStr }))
|
|
1348
1348
|
kv.setItem(VAULT_CERT_STORAGE, JSON.stringify({ cert: res.cert, master: res.master, proxy: res.proxy, deviceId: res.deviceId, pairedAt: Date.now() }))
|
|
1349
1349
|
// Conectarse a una bóveda es ENTRAR A SU CUENTA: el acta viene con el cert.
|
|
@@ -2936,7 +2936,7 @@ export async function createIdentityCore ({ kv: hostKv, peers, makeSync = null,
|
|
|
2936
2936
|
* master: si esta cuenta ya la manda otra bóveda, no hay nada que
|
|
2937
2937
|
* regalar y falla en voz alta.
|
|
2938
2938
|
*/
|
|
2939
|
-
async vaultPair ({ qr, label = '', join = 'current', machine = undefined }) {
|
|
2939
|
+
async vaultPair ({ qr, label = '', join = 'current', machine = undefined, account = null }) {
|
|
2940
2940
|
if (join === 'adopt') return handlers.vaultAdopt({ qr, label, machine })
|
|
2941
2941
|
// La cuenta abierta AQUÍ y la que se cree para este intento. `born` es la que hay que
|
|
2942
2942
|
// tirar si el emparejamiento no llega a término: nació para él y no tiene nada dentro.
|
|
@@ -2967,7 +2967,7 @@ export async function createIdentityCore ({ kv: hostKv, peers, makeSync = null,
|
|
|
2967
2967
|
}
|
|
2968
2968
|
}
|
|
2969
2969
|
try {
|
|
2970
|
-
return await pairWithVault({ qr, label, machine })
|
|
2970
|
+
return await pairWithVault({ qr, label, machine, account })
|
|
2971
2971
|
} catch (e) {
|
|
2972
2972
|
// El intento falló (código vencido, la bóveda dijo que no, se agotó la espera): la
|
|
2973
2973
|
// cuenta que nació para él se va con él. Si no, cada reintento dejaba una cuenta
|
package/vault/facade.js
CHANGED
|
@@ -136,7 +136,7 @@ export class IdentityFacade {
|
|
|
136
136
|
/** Rota la clave de contenido (corta el acceso al contenido FUTURO de quien ya no está). */
|
|
137
137
|
rotateContentKey () { return this._h('rotateContentKey') }
|
|
138
138
|
// Emparejar ESTE dispositivo con el vault del usuario (Fase 1)
|
|
139
|
-
enrollDevice (qr, { label = '', join = 'current' } = {}) { return this._h('vaultPair', { qr, label, join }) }
|
|
139
|
+
enrollDevice (qr, { label = '', join = 'current', account = null } = {}) { return this._h('vaultPair', { qr, label, join, account }) }
|
|
140
140
|
vaultStatus () { return this._h('vaultStatus') }
|
|
141
141
|
unpairDevice () { return this._h('vaultUnpair') }
|
|
142
142
|
vaultSign (payload) { return this._h('vaultSign', { payload }) }
|
package/vault/remote.js
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* `@dotrino/proxy-client` (importado perezosamente; solo se carga al emparejar).
|
|
15
15
|
*/
|
|
16
16
|
import { makeDeviceKey, signWithDevice, verifyDeviceSig, makePairingCode, commitCode, keyLabel } from './capabilities.js'
|
|
17
|
-
import { checkVaultReply } from './acta.js'
|
|
17
|
+
import { checkVaultReply, accountMismatch } from './acta.js'
|
|
18
18
|
import { cleanMachine, browserMachine } from './machine.js'
|
|
19
19
|
|
|
20
20
|
const MSG = {
|
|
@@ -143,9 +143,11 @@ async function askVault (client, qr) {
|
|
|
143
143
|
* @param {(c:{deviceId:string, code:string})=>void} [opts.onChallenge] Para mostrar el código a tipear en el PC.
|
|
144
144
|
* @param {string} [opts.label]
|
|
145
145
|
* @param {number} [opts.approveTimeoutMs] Espera de la aprobación humana (def 3 min).
|
|
146
|
+
* @param {string} [opts.account] si viene (`pubkeyId` del perfil, 64 hex), SOLO entra en esa cuenta:
|
|
147
|
+
* se comprueba al llegar el reto, antes de enseñar el código (`wrong-account`).
|
|
146
148
|
* @returns {Promise<{device, cert, master:string, proxy:string, deviceId:string, account:string}>}
|
|
147
149
|
*/
|
|
148
|
-
export async function enrollDevice ({ qr, device, onChallenge, label = '', continuity = null, encPub = null, approveTimeoutMs = 180000, intent = 'join', profileId = null, onAdopt = null, machine = undefined } = {}) {
|
|
150
|
+
export async function enrollDevice ({ qr, device, onChallenge, label = '', continuity = null, encPub = null, approveTimeoutMs = 180000, intent = 'join', profileId = null, onAdopt = null, machine = undefined, account = null } = {}) {
|
|
149
151
|
if (!qr?.sn || !(qr.iss || qr.conn)) throw new Error('invalid qr: missing vault or nonce')
|
|
150
152
|
const { WebSocketProxyClient } = await import('@dotrino/proxy-client')
|
|
151
153
|
const client = new WebSocketProxyClient({ url: qr.proxy || 'wss://proxy.dotrino.com', enableWebRTC: false, autoReconnect: false })
|
|
@@ -196,7 +198,13 @@ export async function enrollDevice ({ qr, device, onChallenge, label = '', conti
|
|
|
196
198
|
const off = client.on('message', async (_from, p) => {
|
|
197
199
|
if (!p || typeof p !== 'object') return
|
|
198
200
|
if ((p.type === MSG.ENROLL_CHALLENGE || p.type === MSG.ERROR) && !await fromMyVault(p, qr)) return
|
|
199
|
-
if (p.type === MSG.ENROLL_CHALLENGE) {
|
|
201
|
+
if (p.type === MSG.ENROLL_CHALLENGE) {
|
|
202
|
+
if (account) {
|
|
203
|
+
const why = await accountMismatch(p.signed?.chain, qr.iss, account)
|
|
204
|
+
if (why) { cleanup(); reject(Object.assign(new Error(why), { code: 'wrong-account' })); return }
|
|
205
|
+
}
|
|
206
|
+
try { onChallenge?.({ deviceId, code }) } catch (_) {}
|
|
207
|
+
}
|
|
200
208
|
// El vault ECHA el código que tipeaste; aceptamos SOLO si coincide con el que generamos.
|
|
201
209
|
// (Un código distinto = un vault que no lo conoce → lo ignoramos y seguimos esperando.)
|
|
202
210
|
else if (p.type === MSG.ENROLLED) { if (p.code === code) { cleanup(); resolve(p) } }
|
package/vault/vault.js
CHANGED
|
@@ -192,7 +192,15 @@ import { useBackend as usePeerBackend } from './peerStore.js'
|
|
|
192
192
|
// aprobaciones, consola remota, inicios de sesión. Solo UN iframe por origin es el activo
|
|
193
193
|
// (navigator.locks): la pestaña VISIBLE sostiene el lock; al pasar a background lo
|
|
194
194
|
// libera y otra pestaña visible lo toma. Así varias apps abiertas no compiten.
|
|
195
|
+
// EL INTERRUPTOR ES DE UN PERFIL: guarda el `pid` cuya bóveda corre este navegador. Era un
|
|
196
|
+
// «1» global y la pestaña arrancaba la bóveda de la cuenta que tuviera abierta, aunque fuera
|
|
197
|
+
// una entrada con contraseña que no sella nada (2026-10-19). El «1» viejo se lee como apagado:
|
|
198
|
+
// se vuelve a encender una vez desde la consola.
|
|
195
199
|
const SELF_FLAG = 'dotrino.self-vault.enabled' // persistido en localStorage (kv)
|
|
200
|
+
const selfEnabled = async () => {
|
|
201
|
+
const { id } = await handlers.currentProfile()
|
|
202
|
+
return !!id && kv.getItem(SELF_FLAG) === id
|
|
203
|
+
}
|
|
196
204
|
const SELF_LOCK = 'dotrino-self-vault'
|
|
197
205
|
/**
|
|
198
206
|
* Proxio del mostrador, SOLO en localhost (`?proxy=ws://…` en la URL de este iframe).
|
|
@@ -211,6 +219,7 @@ import { useBackend as usePeerBackend } from './peerStore.js'
|
|
|
211
219
|
} catch (_) { return null }
|
|
212
220
|
})()
|
|
213
221
|
let daemon = null // la bóveda (`startBrowserVault`) cuando ESTE iframe es el activo
|
|
222
|
+
let daemonError = null // por qué no arrancó (`{ code, message }`), para enseñarlo
|
|
214
223
|
let _lockResolver = null // resolver del callback del lock (libera al resolverlo)
|
|
215
224
|
|
|
216
225
|
// La dirección `nombre@AB12-CD34-EF56` sale del acta de la cuenta.
|
|
@@ -238,15 +247,21 @@ import { useBackend as usePeerBackend } from './peerStore.js'
|
|
|
238
247
|
// disco en IndexedDB. Import dinámico: el iframe lo cargan las ~30 apps y solo esta
|
|
239
248
|
// pestaña es bóveda; además aísla un fallo del vendor del arranque de la identidad.
|
|
240
249
|
const { startBrowserVault } = await import('@dotrino/vault/browser')
|
|
250
|
+
daemonError = null
|
|
241
251
|
daemon = await startBrowserVault({
|
|
242
252
|
core,
|
|
243
253
|
...(selfProxyUrl ? { proxyUrl: selfProxyUrl } : {}),
|
|
244
254
|
legacyLogins,
|
|
245
255
|
onPendingChange: () => broadcast('selfVault', { pending: daemon ? daemon.listPending() : [] }),
|
|
256
|
+
onStopped: (e) => { daemon = null; daemonError = { code: e?.code || null, message: e?.message || String(e) }; broadcast('selfVault', { running: false, error: daemonError.message }) },
|
|
246
257
|
log: (...a) => console.log(...a)
|
|
247
258
|
})
|
|
248
259
|
broadcast('selfVault', { running: true })
|
|
249
|
-
} catch (e) {
|
|
260
|
+
} catch (e) {
|
|
261
|
+
daemon = null
|
|
262
|
+
daemonError = { code: e?.code || null, message: e?.message || String(e) }
|
|
263
|
+
broadcast('selfVault', { error: daemonError.message })
|
|
264
|
+
}
|
|
250
265
|
}
|
|
251
266
|
function stopSelfDaemon () {
|
|
252
267
|
if (!daemon) return
|
|
@@ -256,9 +271,9 @@ import { useBackend as usePeerBackend } from './peerStore.js'
|
|
|
256
271
|
}
|
|
257
272
|
|
|
258
273
|
// Adquiere el lock solo si el modo self está activado Y la pestaña es visible.
|
|
259
|
-
function holdSelfLock () {
|
|
274
|
+
async function holdSelfLock () {
|
|
260
275
|
if (!navigator.locks) return
|
|
261
|
-
if (
|
|
276
|
+
if (!(await selfEnabled()) || document.visibilityState !== 'visible') return
|
|
262
277
|
navigator.locks.request(SELF_LOCK, { mode: 'exclusive', ifAvailable: true }, async (lock) => {
|
|
263
278
|
if (!lock) return // otra pestaña visible lo tiene
|
|
264
279
|
await startSelfDaemon()
|
|
@@ -309,7 +324,7 @@ import { useBackend as usePeerBackend } from './peerStore.js'
|
|
|
309
324
|
// hacer RPC al daemon del PC: somos nuestra propia maestra. Así ia/terminal listan
|
|
310
325
|
// agentes siempre, sin depender de qué pestaña sostenga el lock del daemon.
|
|
311
326
|
listVaultDevices: async () => {
|
|
312
|
-
if (
|
|
327
|
+
if (!(await selfEnabled())) return handlers.listVaultDevices({})
|
|
313
328
|
// Con la bóveda encendida en ESTA pestaña, la lista sale de ella (por el camino
|
|
314
329
|
// local): trae lo mismo que la del binario. Sin ella encendida, se lee lo guardado.
|
|
315
330
|
if (daemon) return handlers.listVaultDevices({})
|
|
@@ -327,9 +342,11 @@ import { useBackend as usePeerBackend } from './peerStore.js'
|
|
|
327
342
|
})))
|
|
328
343
|
return { devices, revoked: (revoked || []).map((r) => r.nonce || r) }
|
|
329
344
|
},
|
|
330
|
-
selfVaultStatus: async () => ({ enabled:
|
|
345
|
+
selfVaultStatus: async () => ({ enabled: await selfEnabled(), running: !!daemon, error: daemon ? null : daemonError }),
|
|
331
346
|
setSelfVault: async ({ enabled }) => {
|
|
332
|
-
|
|
347
|
+
const { id } = await handlers.currentProfile()
|
|
348
|
+
if (enabled && !id) throw Object.assign(new Error('no profile: the vault belongs to an account'), { code: 'no-profile' })
|
|
349
|
+
if (enabled) kv.setItem(SELF_FLAG, id); else kv.removeItem(SELF_FLAG)
|
|
333
350
|
if (enabled) holdSelfLock(); else releaseSelfLock()
|
|
334
351
|
return { ok: true, enabled: !!enabled }
|
|
335
352
|
},
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Copia vendorizada de @dotrino/proxy-client@0.
|
|
1
|
+
Copia vendorizada de @dotrino/proxy-client@0.39.0 (dotrino-proxy-client/src/{binpack,canonical,client,encpub,errors,index,parts,sealing,signature,stats-log,stats,webrtc}.js).
|
|
2
2
|
NO se edita a mano: la escribe `node vendor.mjs` y la vigila test/vendor-up-to-date.test.mjs.
|
|
3
3
|
sealing.js resuelve @dotrino/identity/content de forma PEREZOSA (= ../../content.js
|
|
4
4
|
por el import map): solo se carga si de verdad se sella algo.
|
|
@@ -1384,11 +1384,18 @@ export class WebSocketProxyClient {
|
|
|
1384
1384
|
* `channel` (opcional): el canal donde la buscan quienes no saben su llave —quien entra con
|
|
1385
1385
|
* usuario y contraseña—. Listarlo vacío también la despierta (`list()` devuelve `waking`).
|
|
1386
1386
|
*
|
|
1387
|
-
*
|
|
1387
|
+
* `self` (websocket-proxy ≥ 1.8.0): el timbre es de ESTA llave y no de la cuenta. Lo usa una
|
|
1388
|
+
* réplica que vive en una función: se identifica con su llave, y es a ella a la que le
|
|
1389
|
+
* escribe un servicio cuando la bóveda no contesta. Un proxio que no anuncia `wake-self` lo
|
|
1390
|
+
* guardaría para la cuenta y le quitaría el timbre a la bóveda, así que ahí no se manda.
|
|
1391
|
+
*
|
|
1392
|
+
* @param {{ publicKey:string, sign:Function, url:string, acta:object, channel?:string, self?:boolean }} opts
|
|
1388
1393
|
*/
|
|
1389
|
-
async registerWake ({ publicKey, sign, url, acta, channel } = {}) {
|
|
1394
|
+
async registerWake ({ publicKey, sign, url, acta, channel, self = false } = {}) {
|
|
1390
1395
|
if (!publicKey || typeof sign !== 'function' || !url || !acta) throw errorWithCode('registerWake requires { publicKey, sign, url, acta }', 'bad-args')
|
|
1391
|
-
|
|
1396
|
+
if (self && channel) throw errorWithCode('registerWake: a self wake has no channel', 'bad-args')
|
|
1397
|
+
if (self && !(Array.isArray(this.caps) && this.caps.includes('wake-self'))) throw errorWithCode('registerWake: this proxy does not support a wake for the device key (needs websocket-proxy >= 1.8.0)', 'no-wake-self-support')
|
|
1398
|
+
const data = { op: 'push-subscribe', publickey: publicKey, subscription: JSON.stringify({ kind: 'wake', url, ...(channel ? { channel } : {}), ...(self ? { self: true } : {}) }), ts: Date.now() }
|
|
1392
1399
|
const signature = await normalizeSignature(sign, data)
|
|
1393
1400
|
const r = await this._request({ type: 'push-subscribe', data, signature, acta }, 'push-subscribed')
|
|
1394
1401
|
return { kind: 'wake', url, profile: r?.publickey || null }
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
Copia vendorizada de @dotrino/roadmap@0.4.
|
|
1
|
+
Copia vendorizada de @dotrino/roadmap@0.4.49 (dotrino-roadmap/src/{index,manifests}.js).
|
|
2
2
|
NO se edita a mano: la escribe `node vendor.mjs` y la vigila test/vendor-up-to-date.test.mjs.
|
|
3
3
|
El registro de versiones rotas que viaja con cada versión. Importa @dotrino/compat/ranges.
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
export const MANIFESTS = Object.freeze({
|
|
9
9
|
"dotrino": {
|
|
10
10
|
"manifest": "dotrino",
|
|
11
|
-
"seq":
|
|
11
|
+
"seq": 37,
|
|
12
12
|
"issued": "2026-10-18",
|
|
13
13
|
"note": "Registro comun de compatibilidad del ecosistema. Se edita a mano en este repo y se consulta con @dotrino/roadmap. Rangos: ver @dotrino/compat/ranges (x.y.z, >= > <= <, «a - b», «*», o una lista que es un O).",
|
|
14
14
|
"products": {
|
|
@@ -31,7 +31,7 @@ export const MANIFESTS = Object.freeze({
|
|
|
31
31
|
"identity": {
|
|
32
32
|
"repo": "imdotrino/dotrino-identity",
|
|
33
33
|
"npm": "@dotrino/identity",
|
|
34
|
-
"current": "0.
|
|
34
|
+
"current": "0.123.0",
|
|
35
35
|
"protocol": 1,
|
|
36
36
|
"requires": {
|
|
37
37
|
"proxy-client": ">=0.13.1"
|
|
@@ -109,7 +109,7 @@ export const MANIFESTS = Object.freeze({
|
|
|
109
109
|
},
|
|
110
110
|
"proxy": {
|
|
111
111
|
"repo": "imdotrino/dotrino-proxy",
|
|
112
|
-
"current": "1.
|
|
112
|
+
"current": "1.8.0",
|
|
113
113
|
"protocol": 2,
|
|
114
114
|
"requires": {
|
|
115
115
|
"vault": ">=0.87.0",
|
|
@@ -121,7 +121,7 @@ export const MANIFESTS = Object.freeze({
|
|
|
121
121
|
"proxy-client": {
|
|
122
122
|
"repo": "imdotrino/dotrino-proxy-client",
|
|
123
123
|
"npm": "@dotrino/proxy-client",
|
|
124
|
-
"current": "0.
|
|
124
|
+
"current": "0.39.0",
|
|
125
125
|
"protocol": 2,
|
|
126
126
|
"requires": {
|
|
127
127
|
"identity": ">=0.53.0",
|
|
@@ -131,7 +131,7 @@ export const MANIFESTS = Object.freeze({
|
|
|
131
131
|
"remote-agent": {
|
|
132
132
|
"repo": "imdotrino/dotrino-remote-agent",
|
|
133
133
|
"npm": "@dotrino/remote-agent",
|
|
134
|
-
"current": "0.
|
|
134
|
+
"current": "0.23.1",
|
|
135
135
|
"protocol": 1,
|
|
136
136
|
"requires": {
|
|
137
137
|
"identity": ">=0.121.7",
|
|
@@ -155,7 +155,7 @@ export const MANIFESTS = Object.freeze({
|
|
|
155
155
|
},
|
|
156
156
|
"terminal-ios": {
|
|
157
157
|
"repo": "imdotrino/dotrino-terminal",
|
|
158
|
-
"current": "0.13.
|
|
158
|
+
"current": "0.13.7",
|
|
159
159
|
"protocol": 1,
|
|
160
160
|
"requires": {
|
|
161
161
|
"terminal-agent": ">=0.37.0"
|
|
@@ -163,7 +163,7 @@ export const MANIFESTS = Object.freeze({
|
|
|
163
163
|
},
|
|
164
164
|
"terminal-android": {
|
|
165
165
|
"repo": "imdotrino/dotrino-terminal",
|
|
166
|
-
"current": "0.13.
|
|
166
|
+
"current": "0.13.7",
|
|
167
167
|
"protocol": 1,
|
|
168
168
|
"requires": {
|
|
169
169
|
"terminal-agent": ">=0.37.0"
|
|
@@ -171,7 +171,7 @@ export const MANIFESTS = Object.freeze({
|
|
|
171
171
|
},
|
|
172
172
|
"terminal-desktop": {
|
|
173
173
|
"repo": "imdotrino/dotrino-terminal",
|
|
174
|
-
"current": "0.2.
|
|
174
|
+
"current": "0.2.80",
|
|
175
175
|
"protocol": 1,
|
|
176
176
|
"requires": {
|
|
177
177
|
"terminal-agent": ">=0.37.0"
|
|
@@ -253,11 +253,11 @@ export const MANIFESTS = Object.freeze({
|
|
|
253
253
|
"vault": {
|
|
254
254
|
"repo": "imdotrino/dotrino-vault",
|
|
255
255
|
"npm": "@dotrino/vault",
|
|
256
|
-
"current": "0.
|
|
256
|
+
"current": "0.95.1",
|
|
257
257
|
"protocol": 1,
|
|
258
258
|
"requires": {
|
|
259
259
|
"vaultd": ">=0.105.0",
|
|
260
|
-
"proxy-client": ">=0.
|
|
260
|
+
"proxy-client": ">=0.39.0",
|
|
261
261
|
"identity": ">=0.118.0",
|
|
262
262
|
"opaque": ">=0.1.0",
|
|
263
263
|
"compat": ">=0.4.0",
|
|
@@ -269,11 +269,11 @@ export const MANIFESTS = Object.freeze({
|
|
|
269
269
|
"vaultd": {
|
|
270
270
|
"repo": "imdotrino/dotrino-vault",
|
|
271
271
|
"npm": "@dotrino/vaultd",
|
|
272
|
-
"current": "0.
|
|
272
|
+
"current": "0.167.1",
|
|
273
273
|
"protocol": 1,
|
|
274
274
|
"requires": {
|
|
275
275
|
"identity": ">=0.118.0",
|
|
276
|
-
"proxy-client": ">=0.
|
|
276
|
+
"proxy-client": ">=0.39.0",
|
|
277
277
|
"store": ">=0.11.0",
|
|
278
278
|
"passmanager": ">=0.18.4",
|
|
279
279
|
"compat": ">=0.4.0",
|
|
@@ -332,22 +332,22 @@ export const MANIFESTS = Object.freeze({
|
|
|
332
332
|
},
|
|
333
333
|
"app": {
|
|
334
334
|
"repo": "imdotrino/dotrino-app",
|
|
335
|
-
"current": "0.4.
|
|
335
|
+
"current": "0.4.25",
|
|
336
336
|
"protocol": 1,
|
|
337
337
|
"requires": {
|
|
338
|
-
"proxy": "1.
|
|
339
|
-
"vaultd": ">=0.
|
|
340
|
-
"identity": ">=0.
|
|
338
|
+
"proxy": "1.6.0+",
|
|
339
|
+
"vaultd": ">=0.159.0",
|
|
340
|
+
"identity": ">=0.117.2"
|
|
341
341
|
}
|
|
342
342
|
},
|
|
343
343
|
"app-ios": {
|
|
344
344
|
"repo": "imdotrino/dotrino-app",
|
|
345
|
-
"current": "0.4.
|
|
345
|
+
"current": "0.4.15",
|
|
346
346
|
"protocol": 1,
|
|
347
347
|
"requires": {
|
|
348
|
-
"proxy": "1.
|
|
349
|
-
"vaultd": ">=0.
|
|
350
|
-
"identity": ">=0.
|
|
348
|
+
"proxy": "1.6.0+",
|
|
349
|
+
"vaultd": ">=0.159.0",
|
|
350
|
+
"identity": ">=0.117.2"
|
|
351
351
|
}
|
|
352
352
|
},
|
|
353
353
|
"social-bot": {
|
|
@@ -364,13 +364,14 @@ export const MANIFESTS = Object.freeze({
|
|
|
364
364
|
"accounts": {
|
|
365
365
|
"repo": "imdotrino/dotrino-accounts",
|
|
366
366
|
"npm": null,
|
|
367
|
-
"current": "0.
|
|
367
|
+
"current": "0.5.0",
|
|
368
368
|
"protocol": 1,
|
|
369
369
|
"requires": {
|
|
370
370
|
"identity": ">=0.116.0",
|
|
371
|
-
"remote-agent": ">=0.
|
|
372
|
-
"vault": ">=0.
|
|
373
|
-
"pay": ">=0.
|
|
371
|
+
"remote-agent": ">=0.23.1",
|
|
372
|
+
"vault": ">=0.95.0",
|
|
373
|
+
"pay": ">=0.2.0",
|
|
374
|
+
"vaultd": ">=0.167.0"
|
|
374
375
|
}
|
|
375
376
|
},
|
|
376
377
|
"ai": {
|
|
@@ -383,7 +384,7 @@ export const MANIFESTS = Object.freeze({
|
|
|
383
384
|
"pay": {
|
|
384
385
|
"repo": "imdotrino/dotrino-pay",
|
|
385
386
|
"npm": "@dotrino/pay",
|
|
386
|
-
"current": "0.
|
|
387
|
+
"current": "0.2.0",
|
|
387
388
|
"protocol": 1,
|
|
388
389
|
"requires": {}
|
|
389
390
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Copia vendorizada de @dotrino/vault@0.
|
|
1
|
+
Copia vendorizada de @dotrino/vault@0.95.1 (dotrino-vault/lib/src/{admin,b64,browser,core/approvals,core/backup,core/blocked,core/browserDisk,core/commKey,core/disk,core/libVersion,core/machines,core/notices,core/notifiable,core/passwords,core/sealKey,core/sealer,core/sealers,core/secretsStore,core/sha256,core/store,core/subacta,core/threadStore,core/transport,core/vault,enroll,index,loginClient,passwordLogins,procContext,protocol,revocation,sealed}.js).
|
|
2
2
|
NO se edita a mano: la escribe `node vendor.mjs` y la vigila test/vendor-up-to-date.test.mjs.
|
|
3
3
|
browser.js es la bóveda de esta pestaña: el MISMO núcleo que el binario (core/), con
|
|
4
4
|
el disco en IndexedDB. Importa @dotrino/{compat,roadmap,passmanager,store/core} y
|
|
@@ -38,6 +38,7 @@ const SELF_CERT_EVERY_MS = 60_000
|
|
|
38
38
|
* antes de correr el núcleo (`{ state, drop }` o `null`). Se traen UNA vez.
|
|
39
39
|
* @param {Function} [opts.onPendingChange] un aparato espera aprobación, o dejó de esperar
|
|
40
40
|
* @param {Function} [opts.onAdopted]
|
|
41
|
+
* @param {Function} [opts.onStopped] `(error)`: la bóveda se paró sola (la cuenta de la pestaña cambió)
|
|
41
42
|
* @param {Function} [opts.log]
|
|
42
43
|
* @param {object} [opts.opaque] el servidor de OPAQUE, si el del paquete no se puede cargar aquí
|
|
43
44
|
* (la extensión: su CSP no deja WASM en la página de la bóveda).
|
|
@@ -46,12 +47,18 @@ const SELF_CERT_EVERY_MS = 60_000
|
|
|
46
47
|
* @param {Function} [opts.openDisk] `(name) => disk`. Solo para las pruebas (Node no tiene
|
|
47
48
|
* IndexedDB); por defecto, `openBrowserDisk`.
|
|
48
49
|
*/
|
|
49
|
-
export async function startBrowserVault ({ core, proxyUrl = DEFAULT_PROXY, makeClient = null, legacyLogins = null, onPendingChange = () => {}, onAdopted = () => {}, log = console.log, openDisk = openBrowserDisk, opaque = null, servePasswords = true } = {}) {
|
|
50
|
+
export async function startBrowserVault ({ core, proxyUrl = DEFAULT_PROXY, makeClient = null, legacyLogins = null, onPendingChange = () => {}, onAdopted = () => {}, onStopped = () => {}, log = console.log, openDisk = openBrowserDisk, opaque = null, servePasswords = true } = {}) {
|
|
50
51
|
if (!core?.handlers) throw Object.assign(new Error('startBrowserVault: the identity core is required'), { code: 'no-identity' })
|
|
51
52
|
const identity = new IdentityFacade(core)
|
|
52
53
|
if (!identity.me?.publickey) throw Object.assign(new Error('no identity: create or unlock your profile before using this browser as a vault'), { code: 'no-identity' })
|
|
53
54
|
const { id: pid } = await identity.currentProfile()
|
|
54
55
|
if (!pid) throw Object.assign(new Error('no profile: the vault belongs to an account'), { code: 'no-profile' })
|
|
56
|
+
// UNA BÓVEDA QUE NO PUEDE SELLAR SU ACTA NO ES UNA BÓVEDA. Arrancaba igual —un aparato
|
|
57
|
+
// entrado con usuario y contraseña es miembro, no selladora— y el fallo salía después, al
|
|
58
|
+
// aprobar a alguien («not the master, nor a co-sealer»), con el código ya en pantalla.
|
|
59
|
+
const info = await identity.profileActa()
|
|
60
|
+
if (!info?.acta) throw Object.assign(new Error('this account has no record yet: open the profile first'), { code: 'no-record' })
|
|
61
|
+
if (!info.isMaster) throw Object.assign(new Error('this browser cannot be the vault of the account open here: its key does not seal the account record'), { code: 'not-sealer' })
|
|
55
62
|
|
|
56
63
|
const disk = await openDisk(`dotrino-vault.${pid}`)
|
|
57
64
|
|
|
@@ -95,6 +102,15 @@ export async function startBrowserVault ({ core, proxyUrl = DEFAULT_PROXY, makeC
|
|
|
95
102
|
// perfil firmándose a sí misma con lo que el acta le deja hoy. Se rehace cada minuto
|
|
96
103
|
// porque el acta cambia (un permiso que te quitas, un sellado nuevo).
|
|
97
104
|
const master = identity.me.publickey
|
|
105
|
+
// LA BÓVEDA ES DE UNA CUENTA. Si en esta pestaña se abre otra (crear perfil, entrar con
|
|
106
|
+
// contraseña), la identidad cambia por debajo y la bóveda firmaría como la nueva con el
|
|
107
|
+
// disco de la vieja: se para antes de firmar nada.
|
|
108
|
+
const sameAccount = async () => {
|
|
109
|
+
const { id } = await identity.currentProfile()
|
|
110
|
+
if (id !== pid || identity.me?.publickey !== master) {
|
|
111
|
+
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
|
+
}
|
|
113
|
+
}
|
|
98
114
|
const selfCert = async () => {
|
|
99
115
|
const acta = (await identity.profileActa().catch(() => null))?.acta || null
|
|
100
116
|
if (!acta) return null
|
|
@@ -119,15 +135,36 @@ export async function startBrowserVault ({ core, proxyUrl = DEFAULT_PROXY, makeC
|
|
|
119
135
|
log('[vault] this browser administers the account: admin added to its own key')
|
|
120
136
|
}
|
|
121
137
|
const open = (onReply) => vault.localChannel(onReply)
|
|
138
|
+
let stopped = false
|
|
139
|
+
let refresh = null
|
|
140
|
+
const shutdown = async () => {
|
|
141
|
+
if (stopped) return
|
|
142
|
+
stopped = true
|
|
143
|
+
clearInterval(refresh)
|
|
144
|
+
try { core.setSelfVault?.(null) } catch (_) {}
|
|
145
|
+
vault.close()
|
|
146
|
+
try { await disk.flush() } catch (e) { log('[vault] some changes could not be saved: ' + (e?.message || e)) }
|
|
147
|
+
disk.close()
|
|
148
|
+
}
|
|
122
149
|
const present = async () => {
|
|
150
|
+
if (stopped) return
|
|
123
151
|
try {
|
|
152
|
+
await sameAccount()
|
|
124
153
|
await ensureAdmin()
|
|
125
154
|
const cert = await selfCert()
|
|
126
155
|
core.setSelfVault?.(cert ? { cert, proxy: proxyUrl, open } : null)
|
|
127
|
-
} catch (e) {
|
|
156
|
+
} catch (e) {
|
|
157
|
+
if (e?.code === 'profile-changed') {
|
|
158
|
+
log('[vault] ' + e.message)
|
|
159
|
+
await shutdown()
|
|
160
|
+
try { onStopped(e) } catch (_) {}
|
|
161
|
+
return
|
|
162
|
+
}
|
|
163
|
+
log('[vault] the console in this browser cannot administer this vault yet: ' + (e?.message || e))
|
|
164
|
+
}
|
|
128
165
|
}
|
|
129
166
|
await present()
|
|
130
|
-
|
|
167
|
+
if (!stopped) refresh = setInterval(present, SELF_CERT_EVERY_MS)
|
|
131
168
|
|
|
132
169
|
return {
|
|
133
170
|
...vault,
|
|
@@ -135,7 +172,7 @@ export async function startBrowserVault ({ core, proxyUrl = DEFAULT_PROXY, makeC
|
|
|
135
172
|
proxy: proxyUrl,
|
|
136
173
|
disk,
|
|
137
174
|
/** Aprueba TIPEANDO el código que muestra el aparato (el núcleo comprueba el compromiso). */
|
|
138
|
-
approve: async (_deviceId, code) => { try { return await vault.approveDevice(code) } finally { notify() } },
|
|
175
|
+
approve: async (_deviceId, code) => { try { await sameAccount(); return await vault.approveDevice(code) } finally { notify() } },
|
|
139
176
|
reject: (deviceId) => { try { return vault.rejectDevice(deviceId) } finally { notify() } },
|
|
140
177
|
/**
|
|
141
178
|
* Las máquinas con papel de firma de esta cuenta (excluye los navegadores enrolados con
|
|
@@ -154,13 +191,7 @@ export async function startBrowserVault ({ core, proxyUrl = DEFAULT_PROXY, makeC
|
|
|
154
191
|
},
|
|
155
192
|
revokeDevice: (sub) => vault.revokeDevice({ sub }),
|
|
156
193
|
revoke: (nonce) => vault.revokeDevice(nonce),
|
|
157
|
-
|
|
158
|
-
clearInterval(refresh)
|
|
159
|
-
try { core.setSelfVault?.(null) } catch (_) {}
|
|
160
|
-
vault.close()
|
|
161
|
-
try { await disk.flush() } catch (e) { log('[vault] some changes could not be saved: ' + (e?.message || e)) }
|
|
162
|
-
disk.close()
|
|
163
|
-
}
|
|
194
|
+
close: shutdown
|
|
164
195
|
}
|
|
165
196
|
}
|
|
166
197
|
|
|
@@ -370,7 +370,13 @@ export function createEnrollDesk ({
|
|
|
370
370
|
// llegue el acta sellada, que es la que este dispositivo dijo que iba a entregar.
|
|
371
371
|
if (intent === 'adopt' && typeof d.profileId === 'string') pend.profileId = d.profileId
|
|
372
372
|
|
|
373
|
-
|
|
373
|
+
// DE QUÉ CUENTA ES ESTA BÓVEDA, demostrable: la cadena de selladoras (su raíz la firma la
|
|
374
|
+
// llave del perfil). Va DENTRO del reto firmado para que el aparato pueda negarse a entrar
|
|
375
|
+
// en otra cuenta ANTES de enseñar su código —la réplica que se pagó para una cuenta, por
|
|
376
|
+
// ejemplo— en vez de descubrirlo cuando ya lo aprobaron. Quien no la mira, no la necesita.
|
|
377
|
+
let chain = null
|
|
378
|
+
try { chain = (await identity.sealerChain?.()) || null } catch (e) { log('[vault] could not build the sealer chain for the challenge:', e.message) }
|
|
379
|
+
await tell(from, { type: MSG_ENROLL_CHALLENGE, deviceId, chain }, pend.sn)
|
|
374
380
|
fire(onChallenge, { deviceId, scope: pend.scope, label: pend.label || '', machine: pend.machine || null, mode: pend.mode || 'join' })
|
|
375
381
|
fire(onPendingChange)
|
|
376
382
|
return { deviceId }
|
|
@@ -24,7 +24,11 @@
|
|
|
24
24
|
* `bad-action-signature`, `cert-device-mismatch`, `untrusted-issuer`…) son ruido o gente
|
|
25
25
|
* ajena: ahí no hay a quién avisar de nada.
|
|
26
26
|
*/
|
|
27
|
-
|
|
27
|
+
// `legacy-cert-retired` (un papel del modelo viejo, sin `seq`) también: se rechaza ANTES de
|
|
28
|
+
// mirar la firma del certificado, pero DESPUÉS de la del aparato, así que el aviso solo
|
|
29
|
+
// puede ir a la llave de quien pregunta. Sin él, un navegador quitado del acta que guardaba
|
|
30
|
+
// un papel viejo se quedaba con la cuenta abierta para siempre (93D9-1B36, 2026-10-19).
|
|
31
|
+
export const STALE_PAPER = Object.freeze(['revoked', 'expired', 'scope', 'legacy-cert-retired'])
|
|
28
32
|
const STALE = new Set(STALE_PAPER)
|
|
29
33
|
|
|
30
34
|
/** ¿El motivo del rechazo es «tu papel ya no sirve»? */
|