@dotrino/identity 0.140.1 → 0.140.3

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dotrino/identity",
3
- "version": "0.140.1",
3
+ "version": "0.140.3",
4
4
  "description": "Identidad y rating de usuarios compartidos entre apps de Dotrino (vault iframe + postMessage)",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -100,5 +100,10 @@
100
100
  },
101
101
  "peerDependencies": {
102
102
  "@dotrino/proxy-client": ">=0.20.0"
103
+ },
104
+ "dotrino": {
105
+ "site": "id",
106
+ "dist": "vault",
107
+ "build": "bash scripts/build-vault-site.sh"
103
108
  }
104
109
  }
package/vault/index.html CHANGED
@@ -163,6 +163,7 @@
163
163
  "@dotrino/roadmap": "./vendor/roadmap/index.js",
164
164
  "@dotrino/passmanager": "./vendor/passmanager/index.js",
165
165
  "@dotrino/passmanager/sealed": "./vendor/passmanager/sealed/index.js",
166
+ "@dotrino/passmanager/match": "./vendor/passmanager/match.js",
166
167
  "@dotrino/store/core": "./vendor/store/core.js",
167
168
  "@dotrino/identity/facade": "./facade.js",
168
169
  "@dotrino/identity/machine": "./machine.js",
@@ -103,14 +103,21 @@ export async function sendToVault (client, { dest, to = null, acta = null, paylo
103
103
  // esconderle nada, y ahí la bóveda no tiene llave de cifrado que anunciar.
104
104
  if (client?.local) { client.sendByPubkey(dest, payload, opts); return { sealed: 0, why: 'local' } }
105
105
  const keys = to ? [to] : vaultKeysOf(await latestActa(client, acta))
106
- const encPubs = []
106
+ /** @type {{ key: string, peerEncPub: string }[]} */
107
+ const sealed = []
107
108
  let lastError = null
108
109
  for (const k of keys) {
109
- try { encPubs.push(await client.encPubOf(k)) } catch (e) { lastError = e }
110
+ try { sealed.push({ key: k, peerEncPub: await client.encPubOf(k) }) } catch (e) { lastError = e }
110
111
  }
111
- if (encPubs.length) {
112
- for (const peerEncPub of encPubs) await client.sendSealed([dest], payload, { peerEncPub, ...opts })
113
- return { sealed: encPubs.length }
112
+ // CADA SOBRE A LA LLAVE DE SU BÓVEDA, no todos a `dest`. `dest` es la maestra de la bóveda que
113
+ // firmó el papel, y una bóveda se ata en el proxio con su llave de comunicación y con el
114
+ // `profileId` (la maestra de la PRIMERA): la maestra de una hermana no la escucha nadie. Un
115
+ // aparato con el papel renovado por una hermana (la Nube, otra máquina) mandaba todo a una
116
+ // dirección muerta y la cuenta no contestaba con las bóvedas encendidas (la tableta de
117
+ // Seyacat, 2026-12-05). Regla del dueño: contesta la bóveda que esté encendida.
118
+ if (sealed.length) {
119
+ for (const { key, peerEncPub } of sealed) await client.sendSealed([key], payload, { peerEncPub, ...opts })
120
+ return { sealed: sealed.length }
114
121
  }
115
122
  const why = keys.length ? (/** @type {{ code?: string } | null} */ (lastError)?.code || 'no-encpub') : 'no-vault-key'
116
123
  if (!plainAllowed(now)) {
@@ -1,3 +1,3 @@
1
- Copia vendorizada de @dotrino/passmanager@0.18.6 (dotrino-passmanager/lib/src/{crypto,fields,generate,import,index,match,model,pubkey,sealed/convert,sealed/device,sealed/entry,sealed/index,sealed/keys,sealed/recovery,sealed/store,session-cache,totp,transport/protocol,transport/proxy,transport/sealed,vault/approval,vault/errors,vault/guard,vault/interface,vault/local,vault/remote,vault/responder,vault/sealed-local,vault/sealed-responder,vault/sealed,webauthn}.js).
1
+ Copia vendorizada de @dotrino/passmanager@0.19.2 (dotrino-passmanager/lib/src/{crypto,fields,generate,import,index,match,model,pubkey,sealed/convert,sealed/device,sealed/entry,sealed/index,sealed/keys,sealed/recovery,sealed/store,session-cache,totp,transport/protocol,transport/proxy,transport/sealed,vault/approval,vault/errors,vault/guard,vault/interface,vault/local,vault/remote,vault/responder,vault/sealed-local,vault/sealed-responder,vault/sealed,webauthn}.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 sobre de las contraseñas, el mismo que usan el binario y la extensión. Importa @dotrino/identity/content.
@@ -16,6 +16,8 @@
16
16
  // un valor muy corto (un PIN de cuatro cifras) probando resúmenes. Por eso los resúmenes no
17
17
  // salen del aparato que los calcula.
18
18
 
19
+ import { hostOf, registrableDomain } from '../match.js'
20
+
19
21
  const subtle = () => {
20
22
  const c = globalThis.crypto
21
23
  if (!c?.subtle) throw new Error('webcrypto unavailable')
@@ -117,4 +119,40 @@ export function valueDigest (kcmp, id, field, value) {
117
119
  return hmac(kcmp, `${id} ${field} ${value}`)
118
120
  }
119
121
 
120
- export default { makePasswordKey, profileKeys, siteIndex, fieldIndex, passkeyIndex, valueDigest }
122
+ /**
123
+ * LAS HUELLAS DE UNA URL O UN DOMINIO. El sitio guardado puede ser el dominio y la URL un
124
+ * subdominio suyo (`empresa.com` vale en `login.empresa.com`), así que salen las de CADA
125
+ * variante: el host, sus padres hasta el dominio registrable, y las de comodín. Una sola
126
+ * función para el gestor que autocompleta y la consola que busca: dos listas de variantes
127
+ * acabarían encontrando cosas distintas.
128
+ */
129
+ export async function siteHashes (kidx, url) {
130
+ const host = hostOf(url)
131
+ if (!host) return []
132
+ const out = []
133
+ for (const v of hostVariants(host)) {
134
+ out.push(await siteIndex(kidx, v))
135
+ out.push(await siteIndex(kidx, '*.' + v))
136
+ }
137
+ return out
138
+ }
139
+
140
+ /** Las huellas de passkey (`wa.rp`) que puede tener ese host: él y sus padres. */
141
+ export async function passkeyRpHashes (kidx, url) {
142
+ const host = hostOf(url)
143
+ if (!host) return []
144
+ return Promise.all(hostVariants(host).map((v) => passkeyIndex(kidx, 'rp', v)))
145
+ }
146
+
147
+ function hostVariants (host) {
148
+ const base = registrableDomain(host)
149
+ const out = [host]
150
+ let actual = host
151
+ while (actual.includes('.') && actual !== base) {
152
+ actual = actual.slice(actual.indexOf('.') + 1)
153
+ out.push(actual)
154
+ }
155
+ return out
156
+ }
157
+
158
+ export default { makePasswordKey, profileKeys, siteIndex, siteHashes, passkeyRpHashes, fieldIndex, passkeyIndex, valueDigest }
@@ -504,6 +504,66 @@ export class SealedStore {
504
504
  return [...faltan].map(([pub, generations]) => ({ pub, generations }))
505
505
  }
506
506
 
507
+ /**
508
+ * ¿HAY ALGO PARA ESTE SITIO, Y LO PUEDE ABRIR QUIEN DEBE? Diagnóstico de la consola: no
509
+ * abre nada y **no escribe nada** (ni siquiera reenvuelve: eso es `rewrapAll`, aparte).
510
+ *
511
+ * Busca por las huellas que calculó quien pregunta —de sitio (`idx`) y de passkey (`rp`)—,
512
+ * igual que `find`, pero sin filtrar por destinatario: lo que interesa aquí es justamente
513
+ * a quién le falta la envoltura. De cada entrada dice:
514
+ *
515
+ * · `holders` los aparatos que pueden abrir TODO lo suyo (todas sus generaciones);
516
+ * · `missing` los que el acta dice que deberían y no pueden (falta de sincronizar);
517
+ * · `recovery` si la frase del perfil la abre (sin ella no se puede volver a repartir);
518
+ * · `recoveryWrap` la envoltura de la frase para su VISTA, para quien quiera abrir el
519
+ * título y el usuario. Nunca la de un campo: de aquí no sale ningún valor.
520
+ *
521
+ * Sin huellas no contesta nada, salvo que se pida `all: true` a propósito: es lo que usa la
522
+ * BÚSQUEDA PARCIAL de la consola (`npm` encuentra `www.npmjs.com`), que no se puede hacer
523
+ * con huellas y abre las vistas con la frase para comparar el texto. Igual que con
524
+ * huellas, de aquí sale la vista sellada y nunca un valor.
525
+ */
526
+ async inspect ({ idx = [], rp = [], all = false } = {}) {
527
+ const busca = new Set(idx)
528
+ const buscaRp = new Set(rp)
529
+ if (!all && !busca.size && !buscaRp.size) return []
530
+ const s = await this.#state()
531
+ const deben = {}
532
+ for (const kind of ['main', 'passkeys']) {
533
+ deben[kind] = (await this.recipients(kind)).filter((m) => m?.encPub).map((m) => m.pub)
534
+ }
535
+ const out = []
536
+ for (const e of s.entries) {
537
+ const porSitio = (e.idx || []).some((h) => busca.has(h))
538
+ const porPasskey = !!e.wa?.rp && buscaRp.has(e.wa.rp)
539
+ if (!all && !porSitio && !porPasskey) continue
540
+ const gens = [...new Set([e.view.gen, ...Object.values(e.fields).map((f) => f.gen)])]
541
+ .map((g) => this.#gen(s, g) || { gen: g, kind: null, wraps: {} })
542
+ const quien = (g) => Object.keys(g.wraps || {}).filter((k) => k !== RECOVERY)
543
+ const holders = gens.reduce((acc, g) => acc.filter((p) => quien(g).includes(p)), quien(gens[0]))
544
+ const missing = new Set()
545
+ for (const g of gens) {
546
+ for (const p of deben[g.kind || 'main'] || []) if (!g.wraps?.[p]) missing.add(p)
547
+ }
548
+ out.push({
549
+ id: e.id,
550
+ createdAt: e.createdAt || null,
551
+ updatedAt: e.updatedAt || null,
552
+ by: e.by || e.author?.pub || null,
553
+ match: porSitio ? 'site' : porPasskey ? 'passkey' : null,
554
+ passkey: !!e.wa,
555
+ // Una generación que ya no está en el llavero es una entrada rota: se dice.
556
+ broken: gens.some((g) => g.kind === null),
557
+ holders,
558
+ missing: [...missing],
559
+ recovery: gens.every((g) => !!g.wraps?.[RECOVERY]),
560
+ view: e.view,
561
+ recoveryWrap: this.#wrapFor(s, e.view.gen, RECOVERY)
562
+ })
563
+ }
564
+ return out
565
+ }
566
+
507
567
  /** Cuántas entradas y cuántas generaciones. Diagnóstico: no abre nada. */
508
568
  async stats () {
509
569
  const s = await this.#state()
@@ -17,8 +17,8 @@
17
17
 
18
18
  import { SEALED_OPS } from '../transport/protocol.js'
19
19
  import { VaultError, CODES } from './errors.js'
20
- import { hostOf, registrableDomain, findForUrl } from '../match.js'
21
- import { profileKeys, siteIndex, fieldIndex, passkeyIndex, valueDigest } from '../sealed/keys.js'
20
+ import { findForUrl } from '../match.js'
21
+ import { profileKeys, siteIndex, siteHashes, fieldIndex, passkeyIndex, valueDigest } from '../sealed/keys.js'
22
22
  import { buildSealedEntry, buildSealedPatch, buildProfileKey, openSealedEntry, makeOpener } from '../sealed/device.js'
23
23
  import { openView, PASSKEY_FIELD } from '../sealed/entry.js'
24
24
  import { fieldKey, normalizeFields } from '../fields.js'
@@ -127,23 +127,10 @@ export class SealedVault {
127
127
  */
128
128
  async #hashesFor (url) {
129
129
  const { kidx } = await this.keys()
130
- const host = hostOf(url)
131
- if (!host) return []
132
- const base = registrableDomain(host)
133
- const variantes = new Set([host])
134
- let actual = host
135
- while (actual.includes('.') && actual !== base) {
136
- actual = actual.slice(actual.indexOf('.') + 1)
137
- variantes.add(actual)
138
- }
139
- const out = []
140
- for (const v of variantes) {
141
- out.push(await siteIndex(kidx, v))
142
- out.push(await siteIndex(kidx, '*.' + v))
143
- }
144
- return out
130
+ return siteHashes(kidx, url)
145
131
  }
146
132
 
133
+
147
134
  /**
148
135
  * QUÉ HAY PARA ESTE SITIO. Las huellas son un filtro previo; el emparejamiento de verdad
149
136
  * —el que decide si `empresa.com` vale aquí— se rehace con `match.js` sobre las vistas ya
@@ -181,7 +168,9 @@ export class SealedVault {
181
168
  await this.#request('pm2.put', sobre)
182
169
  // La vista se devuelve ARMADA AQUÍ: quien guardó ya la tiene en claro, y pedírsela a la
183
170
  // bóveda sería un viaje para que nos devuelva lo que acabamos de sellar.
184
- return this.#viewOf(plain)
171
+ // Con el id del SOBRE: una entrada nueva llega sin id y se lo pone `newEntry` al
172
+ // sellarla. Con el de `plain`, guardar algo nuevo devolvía una vista sin id.
173
+ return this.#viewOf({ ...plain, id: sobre.entry.id })
185
174
  }
186
175
 
187
176
  /**
@@ -1,4 +1,4 @@
1
- Copia vendorizada de @dotrino/proxy-client@0.49.1 (dotrino-proxy-client/src/{binpack,ble/manager,ble/wire,canonical,client,encpub,errors,index,parts,sealing,signature,stats-log,stats,webrtc}.js).
1
+ Copia vendorizada de @dotrino/proxy-client@0.51.0 (dotrino-proxy-client/src/{binpack,ble/manager,ble/wire,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.
@@ -259,8 +259,19 @@ export class WebSocketProxyClient {
259
259
  this._outChains = new Map()
260
260
  // Mensajes grandes que llegan en partes (parts.js). Uno que se queda a medias se DICE:
261
261
  // con él se pierde el mensaje entero, y eso no puede pasar callado.
262
+ // Y mientras llega, se AVISA (`incoming`): un archivo grande tarda, y sin aviso el chat no
263
+ // enseña nada hasta la última parte (dueño, 2026-12-05: «si está sincronizando algo, no
264
+ // debería aparecer en el chat algo como (...)?»).
265
+ /** @type {Map<string, { from: string, meta: MessageMeta }>} */
266
+ this._incoming = new Map()
262
267
  this._parts = new Reassembler({
263
- onExpire: (info) => this._emit('error', { type: 'parts_incomplete', code: 'parts-incomplete', ...info })
268
+ onExpire: (info) => {
269
+ const key = `${info.sender}|${info.id}`
270
+ const seen = this._incoming.get(key)
271
+ this._incoming.delete(key)
272
+ if (seen) this._emit('incoming', seen.from, { id: info.id, got: info.parts - info.missing, of: info.parts, failed: true }, seen.meta)
273
+ this._emit('error', { type: 'parts_incomplete', code: 'parts-incomplete', id: info.id, parts: info.parts, missing: info.missing })
274
+ }
264
275
  })
265
276
  // Las CEK de los mensajes con bytes ya abiertas, por su sobre: todas las partes de un
266
277
  // mensaje traen la misma, y abrirla es una vuelta a la bóveda. Pocas: un mensaje vivo.
@@ -869,11 +880,23 @@ export class WebSocketProxyClient {
869
880
  async sendSealed (toPubkeys, payload, { peerEncPub, pilar = false, ...opts } = {}) {
870
881
  const list = Array.isArray(toPubkeys) ? toPubkeys : [toPubkeys]
871
882
  // Por pubkey el mensaje puede quedarse ESPERANDO en el proxio, y ahí se deja como mucho
872
- // 8 MB de archivo (parts.js). Lo que pasa de eso no se manda: se dice, y la app decide.
883
+ // 8 MB de archivo (parts.js). Lo que pasa de eso NO PUEDE ESPERAR: va por el token de cada
884
+ // destinatario conectado (en vivo, 25 MB por el proxio, sin tope por canal directo), que
885
+ // se averigua saludándolo (`locate`). Si alguno no está conectado no sale a ninguno —se
886
+ // resuelven todos antes de mandar nada— y se dice con `too-big-for-queue` (dueño,
887
+ // 2026-12-05: la terminal no podía mandarle al teléfono más de 8 MB estando los dos en línea).
873
888
  const m = this._measure(payload)
874
889
  const queueMax = m.bin ? QUEUE_MAX_BYTES : QUEUE_MAX_CHARS
875
890
  if (m.len > queueMax) {
876
- throw errorWithCode(`sendSealed: ${m.len} ${m.bin ? 'bytes' : 'chars'} is more than can wait in the proxy (${queueMax}); send it by token while both ends are connected`, 'too-big-for-queue')
891
+ const tokens = await Promise.all(list.map((pk) => this.locate(pk, { app: opts.app })))
892
+ const missing = list.filter((_, i) => !tokens[i])
893
+ if (missing.length) {
894
+ throw errorWithCode(`sendSealed: ${m.len} ${m.bin ? 'bytes' : 'chars'} is more than can wait in the proxy (${queueMax}), and ${missing.length === list.length ? 'the peer is' : `${missing.length} of the peers are`} not connected to take it live`, 'too-big-for-queue')
895
+ }
896
+ for (let i = 0; i < list.length; i++) {
897
+ await this.sendSealedTo(/** @type {string} */ (tokens[i]), payload, { peerPubkey: list[i], peerEncPub, pilar })
898
+ }
899
+ return
877
900
  }
878
901
  // Por pubkey todo va por el proxio: si no admite bytes, se dice antes de mandar nada. Y
879
902
  // si alguno de los destinatarios dijo que no los entiende, tampoco.
@@ -1187,6 +1210,31 @@ export class WebSocketProxyClient {
1187
1210
  }
1188
1211
  }
1189
1212
 
1213
+ /**
1214
+ * DÓNDE ESTÁ AHORA esta identidad: el token de una conexión suya que esté en línea, o `null`.
1215
+ * La saluda POR PUBKEY y sin cola (`ephemeral`: si no está conectada, no hay nada que
1216
+ * guardarle), y quien la recibe contesta su saludo desde su token (`_onHello`), aunque ya nos
1217
+ * hubiera saludado antes (`ask`; lo entienden proxy-client ≥ 0.50.0 y dotrino-native ≥ 0.52.3:
1218
+ * uno anterior que ya saludó no contesta, y entonces esto da `null`). Con `app`,
1219
+ * solo la conexión de esa app. Es lo que deja mandar por token —en vivo, sin el tope de la
1220
+ * cola— a quien solo se conoce por su llave.
1221
+ * @param {string} pubkey
1222
+ * @param {{ app?: string, timeoutMs?: number }} [opts]
1223
+ * @returns {Promise<string | null>}
1224
+ */
1225
+ async locate (pubkey, { app, timeoutMs = 6000 } = {}) {
1226
+ if (!this.myPublickey) {
1227
+ throw errorWithCode('locate: identify first — a greeting with no identity says nothing', 'not-identified')
1228
+ }
1229
+ return new Promise(/** @param {(t: string | null) => void} resolve */ (resolve) => {
1230
+ /** @param {string | null} t */
1231
+ const done = (t) => { off(); clearTimeout(timer); resolve(t) }
1232
+ const off = this.on('peer_identity', (/** @type {string} */ t, /** @type {string} */ pk) => { if (samePubkey(pk, pubkey)) done(t) })
1233
+ const timer = setTimeout(() => done(null), timeoutMs)
1234
+ this._sendByPubkeyRaw([pubkey], { t: HELLO_TAG, publickey: this.myPublickey, speaks: SPEAKS, ask: true }, { ephemeral: true, app })
1235
+ })
1236
+ }
1237
+
1190
1238
  /**
1191
1239
  * De quién es este token, si alguien lo ha dicho. `null` es «todavía no lo sé».
1192
1240
  * @param {string} token
@@ -1274,8 +1322,10 @@ export class WebSocketProxyClient {
1274
1322
  const speaks = new Set(Array.isArray(msg.speaks) ? msg.speaks.filter((/** @type {unknown} */ x) => typeof x === 'string').slice(0, 32) : [])
1275
1323
  this._tokenSpeaks.set(from, speaks)
1276
1324
  this._pubkeySpeaks.set(msg.publickey, speaks)
1277
- // Contestar UNA vez: el saludo queda simétrico sin rebotar para siempre.
1278
- if (!this._helloSent.has(from) && this.myPublickey) this.helloTo(from)
1325
+ // Contestar UNA vez: el saludo queda simétrico sin rebotar para siempre. Salvo que lo pida
1326
+ // (`ask`, de `locate`): quien busca dónde estoy necesita la respuesta aunque ya lo hubiera
1327
+ // saludado. La respuesta va sin `ask`, así que tampoco rebota.
1328
+ if ((!this._helloSent.has(from) || msg.ask === true) && this.myPublickey) this.helloTo(from)
1279
1329
  this._emit('peer_identity', from, msg.publickey)
1280
1330
  }
1281
1331
 
@@ -1645,10 +1695,26 @@ export class WebSocketProxyClient {
1645
1695
  _handOpened (from, opened, fullMeta) {
1646
1696
  if (isPart(opened)) {
1647
1697
  // Se agrupa por quien selló: solo esa llave pudo armar cada parte.
1698
+ const sender = fullMeta.senderEncPub || fullMeta.fromPubkey || from || ''
1699
+ const id = opened.__dotrino_part?.id
1700
+ const key = `${sender}|${id}`
1648
1701
  let whole
1649
- try { whole = this._parts.add(fullMeta.senderEncPub || fullMeta.fromPubkey || from || '', opened) }
1650
- catch (e) { this._emit('error', { type: 'bad_part', from, code: codeOf(e) || 'bad-part', error: e }); return }
1651
- if (whole !== null) this._emit('message', from, whole, { ...fullMeta, parts: opened.__dotrino_part.n })
1702
+ try { whole = this._parts.add(sender, opened) }
1703
+ catch (e) {
1704
+ if (this._incoming.delete(key)) this._emit('incoming', from, { id, got: 0, of: opened.__dotrino_part.n, failed: true }, fullMeta)
1705
+ this._emit('error', { type: 'bad_part', from, code: codeOf(e) || 'bad-part', error: e })
1706
+ return
1707
+ }
1708
+ const n = opened.__dotrino_part.n
1709
+ if (whole !== null) {
1710
+ this._incoming.delete(key)
1711
+ this._emit('incoming', from, { id, got: n, of: n, done: true }, fullMeta)
1712
+ this._emit('message', from, whole, { ...fullMeta, parts: n })
1713
+ return
1714
+ }
1715
+ this._incoming.set(key, { from, meta: fullMeta })
1716
+ const p = this._parts.progress(sender, id)
1717
+ if (p) this._emit('incoming', from, { id, got: p.got, of: p.of }, fullMeta)
1652
1718
  return
1653
1719
  }
1654
1720
  this._emit('message', from, opened, fullMeta)
@@ -108,7 +108,7 @@ export const isPart = (o) => !!(o && typeof o === 'object' && o[PART_TAG])
108
108
  */
109
109
 
110
110
  export class Reassembler {
111
- /** @param {{ onExpire?: (info: { id: string, parts: number, missing: number }) => void }} [opts] */
111
+ /** @param {{ onExpire?: (info: { id: string, parts: number, missing: number, sender: string }) => void }} [opts] */
112
112
  constructor ({ onExpire = () => {} } = {}) {
113
113
  /** @type {Map<string, PendingParts>} */
114
114
  this._open = new Map()
@@ -159,12 +159,23 @@ export class Reassembler {
159
159
  a.timer = setTimeout(() => {
160
160
  const missing = a.n - a.count
161
161
  this._drop(key)
162
- this._onExpire({ id: p.id, parts: a.n, missing })
162
+ this._onExpire({ id: p.id, parts: a.n, missing, sender })
163
163
  }, RECV_IDLE_MS)
164
164
  a.timer.unref?.()
165
165
  return null
166
166
  }
167
167
 
168
+ /**
169
+ * Cuántas partes van de un mensaje a medio rearmar (para enseñar «recibiendo…»); `null` si no
170
+ * hay ninguno abierto con ese id.
171
+ * @param {string} sender @param {string} id
172
+ * @returns {{ got: number, of: number } | null}
173
+ */
174
+ progress (sender, id) {
175
+ const a = this._open.get(`${sender}|${id}`)
176
+ return a ? { got: a.count, of: a.n } : null
177
+ }
178
+
168
179
  /** @param {string} key */
169
180
  _drop (key) {
170
181
  const a = this._open.get(key)
@@ -1,3 +1,3 @@
1
- Copia vendorizada de @dotrino/roadmap@0.4.89 (dotrino-roadmap/src/{index,manifests}.js).
1
+ Copia vendorizada de @dotrino/roadmap@0.4.97 (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.
@@ -22,7 +22,7 @@ export const MANIFESTS = Object.freeze({
22
22
  "env": {
23
23
  "repo": "imdotrino/dotrino-vault",
24
24
  "npm": "@dotrino/env",
25
- "current": "0.121.2",
25
+ "current": "0.123.4",
26
26
  "protocol": 1,
27
27
  "requires": {
28
28
  "vault": ">=0.118.0"
@@ -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.138.0",
34
+ "current": "0.140.2",
35
35
  "protocol": 1,
36
36
  "requires": {
37
37
  "proxy-client": ">=0.20.0"
@@ -49,14 +49,14 @@ export const MANIFESTS = Object.freeze({
49
49
  },
50
50
  "messenger": {
51
51
  "repo": "imdotrino/dotrino-messenger",
52
- "current": "0.8.5",
52
+ "current": "0.10.3",
53
53
  "protocol": 2,
54
54
  "requires": {
55
55
  "identity": ">=0.117.0",
56
56
  "proxy-client": ">=0.45.1",
57
57
  "store": ">=0.12.3",
58
58
  "proxy": "1.6.1+",
59
- "profile": ">=0.21.1"
59
+ "profile": ">=0.22.2"
60
60
  }
61
61
  },
62
62
  "messenger-android": {
@@ -83,6 +83,17 @@ export const MANIFESTS = Object.freeze({
83
83
  "proxy": "1.1.0+"
84
84
  }
85
85
  },
86
+ "temp": {
87
+ "repo": "imdotrino/dotrino-temp",
88
+ "current": "0.3.0",
89
+ "protocol": 1,
90
+ "requires": {
91
+ "proxy-client": ">=0.49.1",
92
+ "proxy": "1.6.1+",
93
+ "identity": ">=0.139.0",
94
+ "store": ">=0.12.3"
95
+ }
96
+ },
86
97
  "notes": {
87
98
  "repo": "imdotrino/dotrino-notes",
88
99
  "current": "0.3.0",
@@ -93,6 +104,16 @@ export const MANIFESTS = Object.freeze({
93
104
  "topbar": ">=0.17.3"
94
105
  }
95
106
  },
107
+ "songbook": {
108
+ "repo": "imdotrino/dotrino-songbook",
109
+ "current": "0.1.13",
110
+ "protocol": 1,
111
+ "requires": {
112
+ "identity": ">=0.140.1",
113
+ "store": ">=0.14.3",
114
+ "topbar": ">=0.19.2"
115
+ }
116
+ },
96
117
  "notes-android": {
97
118
  "repo": "imdotrino/dotrino-notes",
98
119
  "current": "0.3.0",
@@ -128,7 +149,7 @@ export const MANIFESTS = Object.freeze({
128
149
  "profile": {
129
150
  "repo": "imdotrino/dotrino-profile",
130
151
  "npm": "@dotrino/profile",
131
- "current": "0.21.2",
152
+ "current": "0.22.2",
132
153
  "protocol": 1,
133
154
  "requires": {
134
155
  "identity": ">=0.33.0",
@@ -150,7 +171,7 @@ export const MANIFESTS = Object.freeze({
150
171
  "proxy-client": {
151
172
  "repo": "imdotrino/dotrino-proxy-client",
152
173
  "npm": "@dotrino/proxy-client",
153
- "current": "0.49.1",
174
+ "current": "0.51.0",
154
175
  "protocol": 2,
155
176
  "requires": {
156
177
  "identity": ">=0.53.0",
@@ -160,10 +181,10 @@ export const MANIFESTS = Object.freeze({
160
181
  "remote-agent": {
161
182
  "repo": "imdotrino/dotrino-remote-agent",
162
183
  "npm": "@dotrino/remote-agent",
163
- "current": "0.37.0",
184
+ "current": "0.43.0",
164
185
  "protocol": 1,
165
186
  "requires": {
166
- "identity": ">=0.136.0",
187
+ "identity": ">=0.140.1",
167
188
  "vault": ">=0.115.0",
168
189
  "proxy-client": ">=0.46.0",
169
190
  "vaultd": ">=0.154.0",
@@ -173,7 +194,7 @@ export const MANIFESTS = Object.freeze({
173
194
  "tunnel": {
174
195
  "repo": "imdotrino/dotrino-tunnel",
175
196
  "npm": "@dotrino/tunnel",
176
- "current": "0.5.3",
197
+ "current": "0.5.5",
177
198
  "protocol": 2,
178
199
  "requires": {
179
200
  "identity": ">=0.127.0",
@@ -187,11 +208,11 @@ export const MANIFESTS = Object.freeze({
187
208
  "terminal-agent": {
188
209
  "repo": "imdotrino/dotrino-terminal",
189
210
  "npm": "@dotrino/terminal-agent",
190
- "current": "0.55.0",
211
+ "current": "0.58.4",
191
212
  "protocol": 2,
192
213
  "requires": {
193
- "remote-agent": ">=0.37.0",
194
- "identity": ">=0.136.0",
214
+ "remote-agent": ">=0.41.1",
215
+ "identity": ">=0.140.1",
195
216
  "vault": ">=0.115.0",
196
217
  "proxy-client": ">=0.49.0",
197
218
  "update": ">=0.9.4",
@@ -201,16 +222,24 @@ export const MANIFESTS = Object.freeze({
201
222
  "remote-desktop-agent": {
202
223
  "repo": "imdotrino/dotrino-remote-desktop",
203
224
  "npm": "@dotrino/remote-desktop-agent",
204
- "current": "0.5.0",
225
+ "current": "0.10.3",
205
226
  "protocol": 1,
206
227
  "requires": {
207
- "remote-agent": ">=0.37.0",
228
+ "remote-agent": ">=0.40.0",
208
229
  "proxy-client": ">=0.49.0",
209
- "identity": ">=0.136.0",
230
+ "identity": ">=0.139.0",
210
231
  "vault": ">=0.115.0",
211
232
  "update": ">=0.9.4"
212
233
  }
213
234
  },
235
+ "remote-desktop-desktop": {
236
+ "repo": "imdotrino/dotrino-remote-desktop",
237
+ "current": "0.1.0",
238
+ "protocol": 1,
239
+ "requires": {
240
+ "remote-desktop-agent": ">=0.7.0"
241
+ }
242
+ },
214
243
  "terminal-ios": {
215
244
  "repo": "imdotrino/dotrino-terminal",
216
245
  "current": "0.13.8",
@@ -221,7 +250,7 @@ export const MANIFESTS = Object.freeze({
221
250
  },
222
251
  "terminal-android": {
223
252
  "repo": "imdotrino/dotrino-terminal",
224
- "current": "0.13.8",
253
+ "current": "0.15.1",
225
254
  "protocol": 1,
226
255
  "requires": {
227
256
  "terminal-agent": ">=0.37.0"
@@ -229,7 +258,7 @@ export const MANIFESTS = Object.freeze({
229
258
  },
230
259
  "terminal-desktop": {
231
260
  "repo": "imdotrino/dotrino-terminal",
232
- "current": "0.2.92",
261
+ "current": "0.2.95",
233
262
  "protocol": 1,
234
263
  "requires": {
235
264
  "terminal-agent": ">=0.37.0"
@@ -251,7 +280,7 @@ export const MANIFESTS = Object.freeze({
251
280
  "content": {
252
281
  "repo": "imdotrino/dotrino-content",
253
282
  "npm": "@dotrino/content",
254
- "current": "0.7.3",
283
+ "current": "0.7.5",
255
284
  "protocol": 1,
256
285
  "requires": {
257
286
  "remote-agent": ">=0.30.0",
@@ -264,7 +293,7 @@ export const MANIFESTS = Object.freeze({
264
293
  "sealers": {
265
294
  "repo": "imdotrino/dotrino-sealers",
266
295
  "npm": "@dotrino/sealers",
267
- "current": "0.11.1",
296
+ "current": "0.11.2",
268
297
  "protocol": 1,
269
298
  "requires": {
270
299
  "remote-agent": ">=0.30.0",
@@ -276,7 +305,7 @@ export const MANIFESTS = Object.freeze({
276
305
  "roadmap": {
277
306
  "repo": "imdotrino/dotrino-roadmap",
278
307
  "npm": "@dotrino/roadmap",
279
- "current": "0.4.88",
308
+ "current": "0.4.96",
280
309
  "protocol": 1,
281
310
  "requires": {
282
311
  "compat": "0.4.0+"
@@ -285,7 +314,7 @@ export const MANIFESTS = Object.freeze({
285
314
  "store": {
286
315
  "repo": "imdotrino/dotrino-store",
287
316
  "npm": "@dotrino/store",
288
- "current": "0.14.3",
317
+ "current": "0.15.0",
289
318
  "protocol": 1,
290
319
  "requires": {
291
320
  "identity": ">=0.91.0",
@@ -302,7 +331,7 @@ export const MANIFESTS = Object.freeze({
302
331
  "topbar": {
303
332
  "repo": "imdotrino/dotrino-topbar",
304
333
  "npm": "@dotrino/topbar",
305
- "current": "0.17.3",
334
+ "current": "0.19.2",
306
335
  "protocol": 1,
307
336
  "requires": {
308
337
  "identity": ">=0.96.1",
@@ -312,7 +341,7 @@ export const MANIFESTS = Object.freeze({
312
341
  "vault": {
313
342
  "repo": "imdotrino/dotrino-vault",
314
343
  "npm": "@dotrino/vault",
315
- "current": "0.121.2",
344
+ "current": "0.123.4",
316
345
  "protocol": 1,
317
346
  "requires": {
318
347
  "vaultd": ">=0.105.0",
@@ -321,25 +350,25 @@ export const MANIFESTS = Object.freeze({
321
350
  "opaque": ">=0.1.0",
322
351
  "compat": ">=0.5.0",
323
352
  "roadmap": ">=0.4.26",
324
- "passmanager": ">=0.18.6",
353
+ "passmanager": ">=0.19.1",
325
354
  "store": ">=0.13.0"
326
355
  }
327
356
  },
328
357
  "vaultd": {
329
358
  "repo": "imdotrino/dotrino-vault",
330
359
  "npm": "@dotrino/vaultd",
331
- "current": "0.193.3",
360
+ "current": "0.199.6",
332
361
  "protocol": 1,
333
362
  "requires": {
334
- "identity": ">=0.136.0",
363
+ "identity": ">=0.139.0",
335
364
  "proxy-client": ">=0.47.0",
336
365
  "store": ">=0.13.0",
337
- "passmanager": ">=0.18.6",
366
+ "passmanager": ">=0.19.1",
338
367
  "compat": ">=0.5.0",
339
368
  "opaque": ">=0.1.0",
340
369
  "roadmap": ">=0.4.58",
341
370
  "remote-agent": ">=0.24.0",
342
- "update": ">=0.9.0"
371
+ "update": ">=0.14.0"
343
372
  }
344
373
  },
345
374
  "verifier": {
@@ -354,7 +383,7 @@ export const MANIFESTS = Object.freeze({
354
383
  "passmanager": {
355
384
  "repo": "imdotrino/dotrino-passmanager",
356
385
  "npm": "@dotrino/passmanager",
357
- "current": "0.18.6",
386
+ "current": "0.19.2",
358
387
  "protocol": 1,
359
388
  "requires": {
360
389
  "identity": ">=0.117.2",
@@ -381,7 +410,7 @@ export const MANIFESTS = Object.freeze({
381
410
  },
382
411
  "passmanager-extension": {
383
412
  "repo": "imdotrino/dotrino-passmanager",
384
- "current": "0.62.0",
413
+ "current": "0.64.2",
385
414
  "protocol": 1,
386
415
  "requires": {
387
416
  "identity": ">=0.138.0",
@@ -453,7 +482,7 @@ export const MANIFESTS = Object.freeze({
453
482
  "expenses-agent": {
454
483
  "repo": "imdotrino/dotrino-expenses-agent",
455
484
  "npm": "@dotrino/expenses-agent",
456
- "current": "0.2.1",
485
+ "current": "0.2.2",
457
486
  "protocol": 1,
458
487
  "requires": {
459
488
  "remote-agent": ">=0.30.0",
@@ -472,7 +501,34 @@ export const MANIFESTS = Object.freeze({
472
501
  "update": {
473
502
  "repo": "imdotrino/dotrino-update",
474
503
  "npm": "@dotrino/update",
475
- "current": "0.9.4",
504
+ "current": "0.17.0",
505
+ "protocol": 1,
506
+ "requires": {}
507
+ },
508
+ "context": {
509
+ "repo": "imdotrino/dotrino-context",
510
+ "npm": "@dotrino/context",
511
+ "current": "0.1.6",
512
+ "protocol": 1,
513
+ "requires": {
514
+ "update": ">=0.12.1"
515
+ }
516
+ },
517
+ "cards": {
518
+ "repo": "imdotrino/dotrino-cards",
519
+ "current": "0.1.0",
520
+ "protocol": 1,
521
+ "requires": {
522
+ "identity": ">=0.140.1",
523
+ "store": ">=0.14.3",
524
+ "topbar": ">=0.17.3",
525
+ "cards-engine": ">=0.1.0"
526
+ }
527
+ },
528
+ "cards-engine": {
529
+ "repo": "imdotrino/dotrino-cards",
530
+ "npm": "@dotrino/cards",
531
+ "current": "0.1.1",
476
532
  "protocol": 1,
477
533
  "requires": {}
478
534
  }
@@ -1240,6 +1296,108 @@ export const MANIFESTS = Object.freeze({
1240
1296
  "versions": "0.182.2",
1241
1297
  "why": "al adoptar un acta sellada por otra bóveda no guardaba la anterior en el historial: con dos bóvedas, un aparato atrasado no podía ponerse al día y se quedaba en su acta para siempre (2026-10-27, arreglado en identity 0.131.0/0.132.0, vaultd 0.183.1/0.184.0)",
1242
1298
  "fix": "actualiza la bóveda a 0.184.0 (dotrino-vault update)"
1299
+ },
1300
+ {
1301
+ "product": "remote-agent",
1302
+ "versions": "0.39.2",
1303
+ "why": "un saludo fallido (unauthorized o sin respuesta) dejaba abierto su WebSocket con reconexión automática; el agente de terminal reintenta cada pocos segundos y el 2026-11-17 acumuló 380 conexiones al proxio, agotó las de nginx y nadie más pudo conectarse",
1304
+ "fix": "sube a @dotrino/remote-agent 0.40.1"
1305
+ },
1306
+ {
1307
+ "product": "remote-agent",
1308
+ "versions": "0.40.0",
1309
+ "why": "un saludo fallido (unauthorized o sin respuesta) dejaba abierto su WebSocket con reconexión automática; el agente de terminal reintenta cada pocos segundos y el 2026-11-17 acumuló 380 conexiones al proxio, agotó las de nginx y nadie más pudo conectarse",
1310
+ "fix": "sube a @dotrino/remote-agent 0.40.1"
1311
+ },
1312
+ {
1313
+ "product": "terminal-agent",
1314
+ "versions": "0.54.1",
1315
+ "why": "usa un @dotrino/remote-agent que deja abierto el WebSocket de cada saludo fallido: acumula conexiones al proxio hasta agotarlas (2026-11-17)",
1316
+ "fix": "sube a @dotrino/terminal-agent 0.56.1"
1317
+ },
1318
+ {
1319
+ "product": "terminal-agent",
1320
+ "versions": "0.55.0",
1321
+ "why": "usa un @dotrino/remote-agent que deja abierto el WebSocket de cada saludo fallido: acumula conexiones al proxio hasta agotarlas (2026-11-17)",
1322
+ "fix": "sube a @dotrino/terminal-agent 0.56.1"
1323
+ },
1324
+ {
1325
+ "product": "terminal-agent",
1326
+ "versions": "0.56.0",
1327
+ "why": "usa un @dotrino/remote-agent que deja abierto el WebSocket de cada saludo fallido: acumula conexiones al proxio hasta agotarlas (2026-11-17)",
1328
+ "fix": "sube a @dotrino/terminal-agent 0.56.1"
1329
+ },
1330
+ {
1331
+ "product": "update",
1332
+ "versions": "0.12.0",
1333
+ "why": "verifyNpmPackage buscaba la firma de sigstore con el nombre del tarball del registro y no con el de npm pack: con el espejo como único canal no la encontraba y no instalaba",
1334
+ "fix": "sube a @dotrino/update 0.12.1"
1335
+ },
1336
+ {
1337
+ "product": "content",
1338
+ "versions": "0.7.4",
1339
+ "why": "salió a npm sin su release de GitHub (el espejo falló antes de crearla): sin npm-integrity.json las piezas no pueden verificarla y no se actualizan a ella",
1340
+ "fix": "sube a @dotrino/content 0.7.5"
1341
+ },
1342
+ {
1343
+ "product": "terminal-agent",
1344
+ "versions": "0.56.2",
1345
+ "why": "salió a npm sin su release de GitHub (el espejo falló antes de crearla): sin npm-integrity.json las piezas no pueden verificarla y no se actualizan a ella",
1346
+ "fix": "sube a @dotrino/terminal-agent 0.56.3"
1347
+ },
1348
+ {
1349
+ "product": "tunnel",
1350
+ "versions": "0.5.4",
1351
+ "why": "salió a npm sin su release de GitHub (el espejo falló antes de crearla): sin npm-integrity.json las piezas no pueden verificarla y no se actualizan a ella",
1352
+ "fix": "sube a @dotrino/tunnel 0.5.5"
1353
+ },
1354
+ {
1355
+ "product": "remote-agent",
1356
+ "versions": "0.41.0",
1357
+ "why": "cuenta la maestra de la bóveda como uno de tus aparatos: le escribe un sobre que nadie abre y el proxio lo reparte, por duplicado, a los aparatos con papel",
1358
+ "fix": "sube a @dotrino/remote-agent 0.41.1"
1359
+ },
1360
+ {
1361
+ "product": "terminal-agent",
1362
+ "versions": "0.58.0",
1363
+ "why": "cuenta la maestra de la bóveda como uno de tus aparatos: le escribe un sobre que nadie abre y el proxio lo reparte, por duplicado, a los aparatos con papel (lo trae remote-agent 0.41.0)",
1364
+ "fix": "sube a @dotrino/terminal-agent 0.58.1"
1365
+ },
1366
+ {
1367
+ "product": "profile",
1368
+ "versions": "0.22.0",
1369
+ "why": "ownDevices cuenta la maestra de la bóveda como un aparato (sale un hilo sin nombre en el messenger)",
1370
+ "fix": "sube a @dotrino/profile 0.22.2"
1371
+ },
1372
+ {
1373
+ "product": "profile",
1374
+ "versions": "0.22.1",
1375
+ "why": "ownDevices cuenta la maestra de la bóveda como un aparato (sale un hilo sin nombre en el messenger)",
1376
+ "fix": "sube a @dotrino/profile 0.22.2"
1377
+ },
1378
+ {
1379
+ "product": "identity",
1380
+ "versions": "0.140.0",
1381
+ "why": "en un service worker (la extensión de contraseñas) encKeyId usaba import() dinámico: cada sobre salía sin destinatarios y la bóveda lo descartaba en silencio",
1382
+ "fix": "sube a @dotrino/identity 0.140.1"
1383
+ },
1384
+ {
1385
+ "product": "passmanager-extension",
1386
+ "versions": "0.64.0",
1387
+ "why": "lleva el núcleo de identity 0.140.0: ningún pedido de contraseñas llega a la bóveda (se queda en «esperando a tu bóveda»)",
1388
+ "fix": "sube a la extensión 0.64.1"
1389
+ },
1390
+ {
1391
+ "product": "vaultd",
1392
+ "versions": "0.199.0",
1393
+ "why": "con la ventana vieja del .deb (sin --tray) la lanzaba y relanzaba cada 30 s: la interfaz se abría sola",
1394
+ "fix": "sube a vaultd 0.199.3 (se actualiza sola)"
1395
+ },
1396
+ {
1397
+ "product": "vaultd",
1398
+ "versions": "0.199.1",
1399
+ "why": "el aviso del acta a una bóveda hermana atrasada pasaba de 1 MB: el proxio cerraba la conexión (1009) cada 5 min y nadie llegaba a la bóveda",
1400
+ "fix": "sube a vaultd 0.199.3 (se actualiza sola)"
1243
1401
  }
1244
1402
  ]
1245
1403
  }
@@ -1,3 +1,3 @@
1
- Copia vendorizada de @dotrino/store/core@0.14.3 (dotrino-store/store/{core}.js).
1
+ Copia vendorizada de @dotrino/store/core@0.15.0 (dotrino-store/store/{core}.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
  Las reglas del almacén (lápidas, páginas): las mismas en el store y en la bóveda.
@@ -1,4 +1,4 @@
1
- Copia vendorizada de @dotrino/vault@0.121.2 (dotrino-vault/lib/src/{admin,b64,browser,core/approvals,core/backup,core/blocked,core/browserDisk,core/commKey,core/disk,core/exNotices,core/gate,core/libVersion,core/logAnchor,core/machines,core/memberGroups,core/notices,core/notifiable,core/passwords,core/sealKey,core/sealer,core/sealers,core/secretsStore,core/sha256,core/siblingBackup,core/store,core/subacta,core/threadStore,core/transport,core/vault,enroll,index,invite,loginClient,passwordLogins,procContext,protocol,revocation,sealed}.js).
1
+ Copia vendorizada de @dotrino/vault@0.123.6 (dotrino-vault/lib/src/{admin,b64,browser,core/approvals,core/backup,core/blocked,core/browserDisk,core/commKey,core/disk,core/exNotices,core/gate,core/libVersion,core/logAnchor,core/machines,core/memberGroups,core/notices,core/notifiable,core/passwords,core/sealKey,core/sealer,core/sealers,core/secretsStore,core/sha256,core/siblingBackup,core/store,core/subacta,core/threadStore,core/transport,core/vault,enroll,index,invite,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
@@ -5,4 +5,4 @@
5
5
  * si no coincide con la del paquete: una versión anunciada que no es la que corre es peor
6
6
  * que no anunciar ninguna.
7
7
  */
8
- export const LIB_VERSION = '0.121.2'
8
+ export const LIB_VERSION = '0.123.6'
@@ -75,7 +75,7 @@ export function openNotices ({ disk, now = Date.now }) {
75
75
  * administrador). `product`: qué (`@dotrino/vaultd` es la propia bóveda);
76
76
  * `deviceId`/`label`: el aparato, si fue uno.
77
77
  */
78
- add (ev, { version, from = null, product = '@dotrino/vaultd', deviceId = null, label = null, devices = null, logSeq = null, head = null, tsa = null, ns = null, kind = null, outcome = null, by = null, byLabel = null, request = null }) {
78
+ add (ev, { version, from = null, product = '@dotrino/vaultd', deviceId = null, label = null, devices = null, logSeq = null, head = null, tsa = null, vault = null, ns = null, kind = null, outcome = null, by = null, byLabel = null, request = null }) {
79
79
  if (!NOTICE_EVS.includes(ev)) throw fail('bad-notice', `unknown notice: ${ev}`)
80
80
  if (ev === 'delivered') {
81
81
  if (!DELIVERED_KINDS.includes(kind)) throw fail('bad-notice', `${ev}: kind must be one of ${DELIVERED_KINDS.join(', ')}`)
@@ -88,11 +88,16 @@ export function openNotices ({ disk, now = Date.now }) {
88
88
  }
89
89
  // EL ANCLA DE LA BITÁCORA (`logAnchor.js`): la cabeza sellada por el signer, para que el
90
90
  // aprobador la guarde. Solo se queda la última: la anterior ya no dice nada que esta no diga.
91
+ //
92
+ // `vault` es QUÉ bóveda la ancla (el id de su maestra). Cada bóveda de una cuenta lleva su
93
+ // propia bitácora, con su propio contador: sin decir de cuál es, el aprobador comparaba el
94
+ // ancla de una hermana con la de otra y avisaba de un corte que no existía (2026-12-06).
91
95
  if (ev === 'log-anchor') {
92
96
  if (typeof logSeq !== 'number' || typeof head !== 'string' || !tsa || typeof tsa.signature !== 'string') {
93
97
  throw fail('bad-notice', `${ev}: logSeq, head and the signer receipt are required`)
94
98
  }
95
- const n = { id: newId(), ev, logSeq, head, tsa, ts: now() }
99
+ if (typeof vault !== 'string' || !vault) throw fail('bad-notice', `${ev}: the vault that anchors its log is required`)
100
+ const n = { id: newId(), ev, vault, logSeq, head, tsa, ts: now() }
96
101
  items = [...items.filter(alive).filter((x) => x.ev !== 'log-anchor'), n]
97
102
  save()
98
103
  return n
@@ -202,3 +202,56 @@ export async function importPasswordEntries ({ sealed, openRecovery, recipients,
202
202
  }
203
203
  return { written }
204
204
  }
205
+
206
+ /**
207
+ * ¿QUÉ HAY GUARDADO PARA ESTO, Y QUIÉN LO ABRE? (`dotrino-vault passwords find`).
208
+ *
209
+ * **Solo lee**: ni reenvuelve ni escribe. La llave del perfil se abre con la copia de
210
+ * recuperación (`openRecovery`, bóveda abierta). De cada entrada se abre su VISTA —título,
211
+ * usuario, sitios—, nunca un valor.
212
+ *
213
+ * La búsqueda es PARCIAL: `npm` encuentra `www.npmjs.com`, y también por título o usuario.
214
+ * Con huellas sola no se puede (una huella solo casa con el texto exacto), así que se abren
215
+ * las vistas y se compara el texto. Y se suman las huellas del sitio, para que una URL
216
+ * (`login.empresa.com/x`) siga encontrando lo guardado para su dominio (`empresa.com`).
217
+ *
218
+ * Devuelve las públicas tal cual (`by`, `holders`, `missing`): ponerles nombre es de quien
219
+ * tiene el acta.
220
+ */
221
+ export async function findPasswordEntries ({ sealed, openRecovery, query }) {
222
+ const { hostOf } = await import('@dotrino/passmanager/match')
223
+ const q = String(query || '').trim()
224
+ if (!q) throw Object.assign(new Error('nothing to search: give part of a site, a title or a user'), { code: 'EMPTY_QUERY' })
225
+ // Una URL se compara por su host: nadie guarda `https://` ni la ruta.
226
+ const host = hostOf(q)
227
+ const needle = (q.includes('://') && host ? host : q).toLowerCase()
228
+ const stats = await sealed.stats()
229
+ if (!stats.sealed) return { sealed: false, entries: stats.entries, found: [] }
230
+ const { RECOVERY, profileKeys, siteHashes, passkeyRpHashes, openSealedView } = await import('@dotrino/passmanager/sealed')
231
+ const { decryptWithCek } = await import('@dotrino/identity/content')
232
+ let prof
233
+ try { prof = await sealed.profile({ pub: RECOVERY }) } catch (e) {
234
+ if (e?.code !== 'not-yours') throw e
235
+ throw Object.assign(new Error('the password profile key has no recovery wrap: open the vault so it gets one'), { code: 'NO_RECOVERY' })
236
+ }
237
+ const openSealed = async ({ wrap, envelope }) => decryptWithCek({ cek: await openRecovery(wrap), envelope })
238
+ const keys = await profileKeys(await openSealed({ wrap: prof.wrap, envelope: prof.envelope }))
239
+ const hits = await sealed.inspect({
240
+ all: true,
241
+ idx: host ? await siteHashes(keys.kidx, q) : [],
242
+ rp: host ? await passkeyRpHashes(keys.kidx, q) : []
243
+ })
244
+ const found = []
245
+ for (const h of hits) {
246
+ let view = null
247
+ if (h.recoveryWrap) {
248
+ const v = await openSealedView({ view: h.view, wrap: h.recoveryWrap, id: h.id, openSealed })
249
+ view = { title: v.title || '', user: v.hint || '', sites: v.sites || [], rpId: v.webauthn?.rpId || null, hasSecret: !!v.hasSecret, hasTotp: !!v.hasTotp }
250
+ }
251
+ const text = view ? [view.title, view.user, view.rpId || '', ...view.sites].join('\n').toLowerCase() : ''
252
+ if (!h.match && !text.includes(needle)) continue
253
+ const { view: _sealedView, recoveryWrap: _w, ...meta } = h
254
+ found.push({ ...meta, match: h.match || 'text', view })
255
+ }
256
+ return { sealed: true, entries: stats.entries, found }
257
+ }
@@ -74,6 +74,8 @@ const MAX_REPLY_BYTES = 768 * 1024
74
74
  // Cuántas actas viajan con el aviso a las hermanas: cada una es el acta entera (unos KB), y el
75
75
  // frame del proxio corta en 1 MB.
76
76
  const SIBLING_ACTAS = 5
77
+ /** Lo más que ocupa el aviso del acta a las hermanas: la trama del proxio es de 1 MB, con margen. */
78
+ const ANNOUNCE_MAX_BYTES = 900 * 1024
77
79
 
78
80
  /**
79
81
  * LA BÓVEDA, la misma en las tres versiones (binario, pestaña y extensión).
@@ -175,7 +177,7 @@ export async function startVault ({ platform, proxyUrl, log = console.log, onEnr
175
177
  const body = { ...part, by: mine, to, ts: Date.now() }
176
178
  const signature = await commKey.sign(body)
177
179
  if (!signature) throw new Error('the communication key could not sign')
178
- await client.sendSealed([to], { type: MSG.SIBLING_BACKUP, body, signature }, { quiet: true, app: 'vault' })
180
+ await client.sendSealed([to], { type: MSG.SIBLING_BACKUP, body, signature }, { quiet: true, app: 'vault', pilar: true })
179
181
  },
180
182
  log
181
183
  })
@@ -2497,7 +2499,7 @@ export async function startVault ({ platform, proxyUrl, log = console.log, onEnr
2497
2499
  }
2498
2500
  const logSeq = auditSeq; const head = auditPrev
2499
2501
  const tsa = await sealHead(head, { fetchFn: platform.fetch || globalThis.fetch })
2500
- const notice = notices.add('log-anchor', { logSeq, head, tsa })
2502
+ const notice = notices.add('log-anchor', { vault: await deviceIdOf(master), logSeq, head, tsa })
2501
2503
  // CALLADO: no es nada que hacer, y timbrar cada pocas horas haría sonar el teléfono con un
2502
2504
  // pedido vacío. La app lo lee de la lista de avisos la próxima vez que pregunte.
2503
2505
  const sent = await sendNotice(notice, who, 'the log anchor', { quiet: true })
@@ -2752,12 +2754,18 @@ export async function startVault ({ platform, proxyUrl, log = console.log, onEnr
2752
2754
  // ----- LA BÓVEDA DE CONTRASEÑAS -----
2753
2755
  //
2754
2756
  // Se monta al final y envuelto: es una pieza opcional y un fallo suyo no puede tumbar
2755
- // la CA. Solo se levanta cuando el acta autoriza a alguien — sin eso no hay a quién
2756
- // responder, y crear la llave por si acaso sería crear un secreto que nadie pidió.
2757
+ // la CA.
2757
2758
  //
2758
- // Y se levanta EN CUANTO pasa, no en el siguiente arranque: conceder el permiso ya es
2759
- // un acto explícito del dueño, y pedirle además que reinicie la bóveda es de las cosas
2760
- // que se olvidan y luego parecen un fallo del gestor.
2759
+ // SE LEVANTA SIEMPRE, aunque ningún aparato tenga todavía `passwords` (dueño,
2760
+ // 2026-12-04). Antes solo se levantaba cuando el acta autorizaba a alguien, y entonces un
2761
+ // gestor enlazado sin el permiso preguntaba y NADIE contestaba: la extensión se quedaba
2762
+ // en «Sincronizando…» y «Guardar» se colgaba, sin decir por qué (perfil Crifa). En pie, el
2763
+ // mostrador le contesta `denied` («this device cannot ask for passwords») y el gestor dice
2764
+ // qué permiso falta. Estar en pie no crea nada: la bóveda no tiene llave de contraseñas
2765
+ // (`passwords.js`) y el archivo solo se escribe cuando guarda alguien con permiso.
2766
+ //
2767
+ // Lo que SÍ cambia al levantarlo: pone su `sealing` en el cliente, que es uno para toda la
2768
+ // bóveda. Por eso lo que la bóveda manda a otras bóvedas va con `pilar: true`.
2761
2769
  let passwords = null
2762
2770
  /**
2763
2771
  * EL SELLADO del gestor: la misma cripto de los sobres del ecosistema
@@ -2814,7 +2822,7 @@ export async function startVault ({ platform, proxyUrl, log = console.log, onEnr
2814
2822
  // EL ALMACÉN LO ATIENDE QUIEN MONTA LA BÓVEDA (la extensión: su worker es el único que
2815
2823
  // escribe sus contraseñas, y dos escritores se pisarían). La política sigue siendo esta.
2816
2824
  if (platform.servePasswords === false) return
2817
- if (passwords || !passwordDevices().length) return
2825
+ if (passwords) return tellPasswordDevices()
2818
2826
  const { createPasswordDesk } = await import('./passwords.js')
2819
2827
  client.updateConfig({ sealing: passwordSealing })
2820
2828
  passwords = createPasswordDesk({
@@ -2846,7 +2854,17 @@ export async function startVault ({ platform, proxyUrl, log = console.log, onEnr
2846
2854
  audit,
2847
2855
  log,
2848
2856
  }).start()
2849
- log(`[vault] passwords: serving ${passwordDevices().length} device(s)`)
2857
+ tellPasswordDevices()
2858
+ }
2859
+ // A cuántos atiende, dicho cuando CAMBIA (dar o quitar el permiso), no en cada pasada.
2860
+ let toldPasswordDevices = -1
2861
+ function tellPasswordDevices () {
2862
+ const n = passwordDevices().length
2863
+ if (n === toldPasswordDevices) return
2864
+ toldPasswordDevices = n
2865
+ // Ni código de enlace ni pegar nada: un gestor entra como cualquier otro aparato.
2866
+ if (n) log(`[vault] passwords: serving ${n} device(s)`)
2867
+ else log('[vault] passwords: no device may ask yet (they get `denied`) · give one the permission with `dotrino-vault caps <ID> +passwords`')
2850
2868
  }
2851
2869
  try {
2852
2870
  // El acta ANTES de mirarla: es ella la que dice si hay a quién responder, y sin
@@ -2856,9 +2874,7 @@ export async function startVault ({ platform, proxyUrl, log = console.log, onEnr
2856
2874
  refreshActa().then(startPasswordDesk).catch(() => {})
2857
2875
  }, 5000)
2858
2876
  actaSweeper.unref?.()
2859
- if (passwordDevices().length) await startPasswordDesk()
2860
- // Ni código de enlace ni pegar nada: un gestor entra como cualquier otro aparato.
2861
- else log('[vault] passwords: no device may ask yet · pair one with `dotrino-vault pair --scope passwords`')
2877
+ await startPasswordDesk()
2862
2878
  } catch (e) {
2863
2879
  log(`[vault] passwords: could not start (${e.message}); everything else keeps going`)
2864
2880
  }
@@ -3011,6 +3027,32 @@ export async function startVault ({ platform, proxyUrl, log = console.log, onEnr
3011
3027
  * por las reglas de siempre (`handleAdminEvent` → `adoptActa`, en fila desde identity
3012
3028
  * 0.129.2), así que una vieja se rechaza sola.
3013
3029
  */
3030
+ /**
3031
+ * QUE QUEPA EN UNA TRAMA DEL PROXIO. Va en claro por `sendByPubkey`, que no parte el mensaje,
3032
+ * para que una hermana dormida (la Lambda) lo reciba de la cola sin tener que anunciar antes su
3033
+ * llave de cifrado. El proxio corta la conexión entera con 1009 si una trama pasa de 1 MB, y eso
3034
+ * pasaba cada 5 min: el PC de Seyacat se quedaba 24 s fuera de la red y lo que le pedían sus
3035
+ * aparatos no recibía respuesta (2026-12-05). Se quita primero la cadena de selladoras y luego
3036
+ * las actas más viejas; lo que se quita se dice. Si ni el acta sola cabe, no se manda y se dice.
3037
+ */
3038
+ function fitAnnounce (msg) {
3039
+ const size = (o) => byteLength(JSON.stringify(o))
3040
+ let out = msg
3041
+ if (size(out) > ANNOUNCE_MAX_BYTES && out.sealerChain) {
3042
+ out = { ...out, sealerChain: null }
3043
+ log('[vault] record announce too big for one proxy frame: sent without the sealer chain')
3044
+ }
3045
+ while (size(out) > ANNOUNCE_MAX_BYTES && Array.isArray(out.actas) && out.actas.length) {
3046
+ out = { ...out, actas: out.actas.length > 1 ? out.actas.slice(1) : null }
3047
+ log(`[vault] record announce too big for one proxy frame: sent with ${out.actas?.length || 0} past record(s)`)
3048
+ }
3049
+ if (size(out) > ANNOUNCE_MAX_BYTES) {
3050
+ log(`[vault] record #${msg.acta?.seq ?? '?'} does not fit in one proxy frame (${size(out)} bytes): not announced to the sibling vaults`)
3051
+ return null
3052
+ }
3053
+ return out
3054
+ }
3055
+
3014
3056
  async function announceToSiblings (reason) {
3015
3057
  try {
3016
3058
  const acta = (await identity.profileActa?.().catch(() => null))?.acta || null
@@ -3021,11 +3063,14 @@ export async function startVault ({ platform, proxyUrl, log = console.log, onEnr
3021
3063
  // que hay detrás —el PC se quedó sin la #75 y la #76 que selló la Nube— y sin ellas no
3022
3064
  // puede poner al día a sus aparatos. Se autentican solas: cada una nombra a la anterior
3023
3065
  // por su hash, y quien las recibe solo acepta las que encajan.
3024
- const actas = (await identity.recentActas?.(SIBLING_ACTAS).catch(() => null))?.actas || null
3066
+ // `{ count }`: con el número a secas la identidad tomaba su valor por defecto (10).
3067
+ const actas = (await identity.recentActas?.({ count: SIBLING_ACTAS }).catch(() => null))?.actas || null
3025
3068
  // Y la cadena de selladoras: con ella llega aunque le falten las de en medio.
3026
3069
  const sealerChain = (await identity.sealerChain?.().catch(() => null)) || null
3070
+ const msg = fitAnnounce({ type: MSG.ADMIN_EVENT, body: { ev: 'record', reason, ts: Date.now() }, acta, actas, sealerChain })
3071
+ if (!msg) return
3027
3072
  for (const m of siblings) {
3028
- try { client.sendByPubkey(m.pub, { type: MSG.ADMIN_EVENT, body: { ev: 'record', reason, ts: Date.now() }, acta, actas, sealerChain }, { quiet: true, app: 'vault' }) }
3073
+ try { client.sendByPubkey(m.pub, msg, { quiet: true, app: 'vault' }) }
3029
3074
  catch (e) { log(`[vault] could not send the record to a sibling vault: ${e.message}`) }
3030
3075
  }
3031
3076
  if (siblings.length) log(`[vault] sent record #${acta.seq} to ${siblings.length} sibling vault(s) on ${reason}`)
@@ -3068,7 +3113,11 @@ export async function startVault ({ platform, proxyUrl, log = console.log, onEnr
3068
3113
  // SELLADO POR EL PILAR a la llave de cifrado del transporte de la hermana, que ella
3069
3114
  // anunció firmada con su llave de comunicación y el pilar verifica. Si todavía no la
3070
3115
  // ha anunciado (no ha despertado desde que el proxio arrancó), se dice y se espera.
3071
- try { await client.sendSealed([m.pub], { type: MSG.SIBLING_DRAWERS, body, signature }, { quiet: true, app: 'vault' }); n++ }
3116
+ // `pilar`: el sobre del PILAR, que abre cualquier bóveda con su llave de
3117
+ // transporte. Sin él, con el mostrador de contraseñas en pie (que pone su
3118
+ // `sealing` en el cliente compartido), salía con el sobre del gestor y la otra
3119
+ // bóveda no lo abría: los cajones no llegaban (2026-12-04).
3120
+ try { await client.sendSealed([m.pub], { type: MSG.SIBLING_DRAWERS, body, signature }, { quiet: true, app: 'vault', pilar: true }); n++ }
3072
3121
  catch (e) { log(`[vault] could not send the drawers to a sibling vault (${e.code || 'error'}): ${e.message}`) }
3073
3122
  }
3074
3123
  if (n) log(`[vault] sent the drawers to ${n} sibling vault(s) on ${reason}`)
@@ -4378,6 +4427,15 @@ export async function startVault ({ platform, proxyUrl, log = console.log, onEnr
4378
4427
  // cajón: retirarlas en silencio esconde que alguien las tuvo de más.
4379
4428
  if (r?.dropped) log(`[vault] ${reason}: ${r.dropped} stale wrap(s) dropped (they belonged to members the record no longer names)`)
4380
4429
  if (r?.failed?.length) log(`[vault] ${reason}: ${r.failed.length} drawer(s) could NOT be resealed: ${r.failed.map((f) => f.owner).join(', ')}`)
4430
+ // Y LAS CONTRASEÑAS, en el mismo momento (dueño, 2026-12-05, Crifa: «está abierta la
4431
+ // bóveda, ¿por qué debería cerrarla y abrirla?»). Dar `passwords` a un aparato con la
4432
+ // bóveda abierta no le envolvía la llave de contraseñas hasta el siguiente desbloqueo, y
4433
+ // la extensión decía «this device has no key for the profile password key». El acta se
4434
+ // relee antes: los destinatarios salen de ella, y la copia en caché va hasta 5 s atrás.
4435
+ // Solo si hay a quién envolverle: sin ningún aparato con el permiso no hay nada que
4436
+ // repartir, y estrenar aquí la llave la dejaría envuelta solo a la recuperación.
4437
+ await refreshActa()
4438
+ if (passwordDevices().length) await sealPasswords(k)
4381
4439
  return r
4382
4440
  }
4383
4441
 
@@ -4752,6 +4810,32 @@ export async function startVault ({ platform, proxyUrl, log = console.log, onEnr
4752
4810
  const { exportPasswordEntries } = await import('./passwords.js')
4753
4811
  return exportPasswordEntries({ sealed: await sealedPasswords(), openRecovery: passwordsRecovery(adminKey) })
4754
4812
  }
4813
+ /**
4814
+ * ¿HAY UNA CONTRASEÑA O PASSKEY PARA ESTE SITIO, Y LA TIENEN TODOS LOS APARATOS? Lo que
4815
+ * pide la consola para comprobar que algo se guardó y se repartió (2026-11-23).
4816
+ *
4817
+ * **Solo lee.** No reenvuelve, no convierte, no escribe: si falta una envoltura se DICE, y
4818
+ * se arregla aparte (abrir la bóveda o `rewrapAll`). Bóveda abierta, como el respaldo: la
4819
+ * huella del sitio sale de la llave del perfil, y esa solo la abre la frase.
4820
+ *
4821
+ * De cada entrada sale la vista (título, usuario, sitios), nunca un valor.
4822
+ */
4823
+ async function findPasswords (query, { adminKey } = {}) {
4824
+ needOpen()
4825
+ const { findPasswordEntries } = await import('./passwords.js')
4826
+ const r = await findPasswordEntries({ sealed: await sealedPasswords(), openRecovery: passwordsRecovery(adminKey), query })
4827
+ const who = async (pub) => {
4828
+ const m = (actaCache?.members || []).find((x) => x.pub === pub)
4829
+ return { id: await pubkeyId(pub), label: m?.label || m?.cn || null }
4830
+ }
4831
+ for (const f of r.found) {
4832
+ f.by = f.by ? await who(f.by) : null
4833
+ f.holders = await Promise.all(f.holders.map(who))
4834
+ f.missing = await Promise.all(f.missing.map(who))
4835
+ }
4836
+ return r
4837
+ }
4838
+
4755
4839
  /** Cómo se llama un cajón para quien lo lee: el del aparato, con su ID y su nombre. */
4756
4840
  const drawerLabel = (owner) => {
4757
4841
  if (!owner.startsWith('dev:')) return null
@@ -5246,6 +5330,7 @@ export async function startVault ({ platform, proxyUrl, log = console.log, onEnr
5246
5330
  setSecret, deleteSecret, renameSecret, renameDeviceSecret, listSecrets, setSecretVisibility, openSecrets,
5247
5331
  // El respaldo: exportar, ver el plan e importar. Las tres con la bóveda abierta.
5248
5332
  backupDrawers, exportBackup, planBackupImport, importBackup,
5333
+ findPasswords,
5249
5334
  // Sella un `secrets.json` v3 entero. Es el punto de no retorno del despliegue y
5250
5335
  // por eso es una operación con nombre propio, no algo que ocurra de refilón al
5251
5336
  // desbloquear: deja `secrets.json.v3.bak` para poder volver.