@dotrino/identity 0.121.6 → 0.121.8

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.121.6",
3
+ "version": "0.121.8",
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",
package/vault/acta.js CHANGED
@@ -467,7 +467,7 @@ export function genesisActa ({ pub, encPub = null, sealPub = null, label = '', c
467
467
 
468
468
  /** Comprobaciones de FORMA (sin cripto): que el acta sea un acta. */
469
469
  export function checkShape (acta) {
470
- if (!acta || typeof acta !== 'object') return 'no-acta'
470
+ if (!acta || typeof acta !== 'object') return 'no-record'
471
471
  if (!ACTA_LEIBLES.includes(acta.v)) return 'version'
472
472
  if (!isPub(acta.profileId) || !isPub(acta.sealedBy)) return 'shape'
473
473
  if (acta.chainUrl != null && !isChainUrl(acta.chainUrl)) return 'chainurl'
@@ -252,7 +252,7 @@ export async function verifyDelegation ({ cert, expectedScope, expectedSub, acta
252
252
  // Sin esos datos no se puede juzgar, y se dice en vez de contestar «vale» a solas:
253
253
  // devolver `ok` sin haber comprobado nada es exactamente cómo un papel viejo seguía
254
254
  // entrando.
255
- if (typeof actaSeq !== 'number' || !Array.isArray(sealers)) return { ok: false, reason: 'no-acta' }
255
+ if (typeof actaSeq !== 'number' || !Array.isArray(sealers)) return { ok: false, reason: 'no-record' }
256
256
  // SOLO SE RECHAZA EL PAPEL DEL FUTURO. Si el cert nombra un acta MÁS NUEVA que la que
257
257
  // tengo, no puedo juzgarlo: mi política está atrasada y decir que sí sería fiarme de algo
258
258
  // que no he visto. Al revés no: un papel viejo es normal —el aparato estuvo apagado— y lo
package/vault/core.js CHANGED
@@ -1140,7 +1140,7 @@ export async function createIdentityCore ({ kv: hostKv, peers, makeSync = null,
1140
1140
  // es suya: que la llave que se va a instalar SEA de esta cuenta. Sin ello, el navegador
1141
1141
  // se quedaría con una identidad que ningún acta reconoce — y sin forma de notarlo.
1142
1142
  const v = await Acta.verifyActa({ acta: entrada?.acta })
1143
- if (!v.ok) throw Object.assign(new Error('the account record does not verify: ' + v.reason), { code: 'bad-acta' })
1143
+ if (!v.ok) throw Object.assign(new Error('the account record does not verify: ' + v.reason), { code: 'bad-record' })
1144
1144
  if (!(entrada.acta.members || []).some((m) => m?.pub === entrada.publickey)) {
1145
1145
  throw Object.assign(new Error('that key is not a member of the account record'), { code: 'not-a-member' })
1146
1146
  }
@@ -1416,7 +1416,7 @@ export async function createIdentityCore ({ kv: hostKv, peers, makeSync = null,
1416
1416
  // Ya no hay ventana de caducidad: el papel no vence. Lo único que obliga a pedir uno
1417
1417
  // nuevo es que el ACTA diga algo distinto de lo que lleva escrito.
1418
1418
  /** Rechazos de la bóveda que se arreglan con un papel nuevo (el mismo juego que la app nativa). */
1419
- const PAPER_REASONS = new Set(['scope', 'stale-record', 'untrusted-issuer', 'expired', 'legacy-cert-retired', 'no-acta'])
1419
+ const PAPER_REASONS = new Set(['scope', 'stale-record', 'untrusted-issuer', 'expired', 'legacy-cert-retired', 'no-record'])
1420
1420
  const RENEW_RETRY_MS = 60 * 60 * 1000 // si falla (vault apagado), no insistir >1 vez/hora
1421
1421
  let renewLastTry = 0
1422
1422
  /**
@@ -1,3 +1,3 @@
1
- Copia vendorizada de @dotrino/roadmap@0.4.38 (dotrino-roadmap/src/{index,manifests}.js).
1
+ Copia vendorizada de @dotrino/roadmap@0.4.40 (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": 33,
11
+ "seq": 35,
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.121.5",
34
+ "current": "0.121.6",
35
35
  "protocol": 1,
36
36
  "requires": {
37
37
  "proxy-client": ">=0.13.1"
@@ -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.38.3",
124
+ "current": "0.38.4",
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.22.3",
134
+ "current": "0.22.4",
135
135
  "protocol": 1,
136
136
  "requires": {
137
137
  "identity": ">=0.121.4",
@@ -143,13 +143,13 @@ export const MANIFESTS = Object.freeze({
143
143
  "terminal-agent": {
144
144
  "repo": "imdotrino/dotrino-terminal",
145
145
  "npm": "@dotrino/terminal-agent",
146
- "current": "0.48.0",
146
+ "current": "0.49.0",
147
147
  "protocol": 2,
148
148
  "requires": {
149
- "remote-agent": ">=0.20.1",
150
- "identity": ">=0.117.2",
151
- "vault": ">=0.87.0",
152
- "proxy-client": ">=0.36.1",
149
+ "remote-agent": ">=0.22.4",
150
+ "identity": ">=0.121.6",
151
+ "vault": ">=0.93.0",
152
+ "proxy-client": ">=0.38.4",
153
153
  "vaultd": ">=0.142.0"
154
154
  }
155
155
  },
@@ -193,7 +193,7 @@ export const MANIFESTS = Object.freeze({
193
193
  "content": {
194
194
  "repo": "imdotrino/dotrino-content",
195
195
  "npm": "@dotrino/content",
196
- "current": "0.6.8",
196
+ "current": "0.6.9",
197
197
  "protocol": 1,
198
198
  "requires": {
199
199
  "remote-agent": ">=0.22.2",
@@ -1,4 +1,4 @@
1
- Copia vendorizada de @dotrino/vault@0.93.0 (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).
1
+ Copia vendorizada de @dotrino/vault@0.93.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
@@ -157,7 +157,7 @@ export function createAdminDesk ({
157
157
  now = () => Date.now()
158
158
  }) {
159
159
  const ops = new Set(ADMIN_OPS)
160
- const mientrasCerrada = new Set(ADMIN_OPS_WHILE_LOCKED)
160
+ const whileLocked = new Set(ADMIN_OPS_WHILE_LOCKED)
161
161
 
162
162
  // NONCE de un solo uso. `sign`/`get` son idempotentes y les basta la ventana de ±5
163
163
  // min; `revoke` y `var.set` CAMBIAN ESTADO, así que reproducir uno dentro de esa
@@ -196,7 +196,7 @@ export function createAdminDesk ({
196
196
  //
197
197
  // El código va aparte del texto porque el texto se traduce y el código no: quien
198
198
  // llama distingue «está cerrada, ábrela» de «no tienes permiso» sin leer la frase.
199
- if (isLocked() && !mientrasCerrada.has(data.op)) {
199
+ if (isLocked() && !whileLocked.has(data.op)) {
200
200
  audit('rejected', { what: 'admin', op: data.op, by, reason: 'locked' })
201
201
  return {
202
202
  ok: false,
@@ -69,7 +69,7 @@ export async function startBrowserVault ({ core, proxyUrl = DEFAULT_PROXY, makeC
69
69
  }
70
70
  }
71
71
 
72
- const avisar = () => { try { onPendingChange() } catch (_) {} }
72
+ const notify = () => { try { onPendingChange() } catch (_) {} }
73
73
  const vault = await startVault({
74
74
  platform: {
75
75
  disk,
@@ -87,7 +87,7 @@ export async function startBrowserVault ({ core, proxyUrl = DEFAULT_PROXY, makeC
87
87
  // El navegador no tiene la contraseña del perfil con la que el binario cierra la copia
88
88
  // de recuperación: se cierra con la llave de este almacén, y el núcleo lo dice.
89
89
  hasPassword: () => false,
90
- onEnrollChallenge: avisar,
90
+ onEnrollChallenge: notify,
91
91
  onAdopted: (info) => { try { onAdopted(info) } catch (_) {} }
92
92
  })
93
93
 
@@ -109,7 +109,7 @@ export async function startBrowserVault ({ core, proxyUrl = DEFAULT_PROXY, makeC
109
109
  * acta: es verdad que este navegador administra la cuenta. `aprueba` NO, a propósito: con
110
110
  * él los servicios pasarían a esperar el visto bueno de una pestaña que puede no estar.
111
111
  */
112
- const asegurarAdmin = async () => {
112
+ const ensureAdmin = async () => {
113
113
  if (core.masterLocked) return
114
114
  const acta = (await identity.profileActa().catch(() => null))?.acta || null
115
115
  const yo = (acta?.members || []).find((m) => m.pub === master)
@@ -119,15 +119,15 @@ export async function startBrowserVault ({ core, proxyUrl = DEFAULT_PROXY, makeC
119
119
  log('[vault] this browser administers the account: admin added to its own key')
120
120
  }
121
121
  const open = (onReply) => vault.localChannel(onReply)
122
- const presentar = async () => {
122
+ const present = async () => {
123
123
  try {
124
- await asegurarAdmin()
124
+ await ensureAdmin()
125
125
  const cert = await selfCert()
126
126
  core.setSelfVault?.(cert ? { cert, proxy: proxyUrl, open } : null)
127
127
  } catch (e) { log('[vault] the console in this browser cannot administer this vault yet: ' + (e?.message || e)) }
128
128
  }
129
- await presentar()
130
- const refresco = setInterval(presentar, SELF_CERT_EVERY_MS)
129
+ await present()
130
+ const refresh = setInterval(present, SELF_CERT_EVERY_MS)
131
131
 
132
132
  return {
133
133
  ...vault,
@@ -135,8 +135,8 @@ export async function startBrowserVault ({ core, proxyUrl = DEFAULT_PROXY, makeC
135
135
  proxy: proxyUrl,
136
136
  disk,
137
137
  /** 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 { avisar() } },
139
- reject: (deviceId) => { try { return vault.rejectDevice(deviceId) } finally { avisar() } },
138
+ approve: async (_deviceId, code) => { try { return await vault.approveDevice(code) } finally { notify() } },
139
+ reject: (deviceId) => { try { return vault.rejectDevice(deviceId) } finally { notify() } },
140
140
  /**
141
141
  * Las máquinas con papel de firma de esta cuenta (excluye los navegadores enrolados con
142
142
  * etiqueta `cli`, que no atienden pedidos). Se queda el papel del acta más nueva.
@@ -155,7 +155,7 @@ export async function startBrowserVault ({ core, proxyUrl = DEFAULT_PROXY, makeC
155
155
  revokeDevice: (sub) => vault.revokeDevice({ sub }),
156
156
  revoke: (nonce) => vault.revokeDevice(nonce),
157
157
  async close () {
158
- clearInterval(refresco)
158
+ clearInterval(refresh)
159
159
  try { core.setSelfVault?.(null) } catch (_) {}
160
160
  vault.close()
161
161
  try { await disk.flush() } catch (e) { log('[vault] some changes could not be saved: ' + (e?.message || e)) }
@@ -84,7 +84,7 @@ export function createApprovals ({ now = Date.now, pendingTtlMs = PENDING_TTL_MS
84
84
  * apruebe— y tiene que volver por el mismo sitio: desde que la bóveda atiende también
85
85
  * por un socket local, mandarla siempre por el proxio la dejaba en el vacío.
86
86
  */
87
- request ({ ns, device, deviceId, label = '', ek, ctx = null, from = null, ttlMs = null, kind = 'read' }) {
87
+ request ({ ns, device, deviceId, label = '', ek, ctx = null, from = null, ttlMs = null, kind = 'read', re = null }) {
88
88
  // Pedir las claves otra vez reemplaza al pedido anterior: es la misma pregunta. Una
89
89
  // ESCRITURA no: cada una lleva su propio valor, y reemplazarla tiraría la anterior
90
90
  // sin que nadie dijera que no.
@@ -92,7 +92,8 @@ export function createApprovals ({ now = Date.now, pendingTtlMs = PENDING_TTL_MS
92
92
  const ts = now()
93
93
  // `ttlMs` lo pone quien pide: una actualización aguanta un día y un comando cinco
94
94
  // minutos, y la mesa no tiene por qué saber cuál es cuál (ver `PENDING_TTL_MS`).
95
- const p = { id: rnd(), ns, kind, device, deviceId, label, ek, ctx, ts, exp: ts + (ttlMs || pendingTtlMs), from }
95
+ // `re`: la huella de la petición, para firmarle al que pidió el «denegado» (ver `signError`).
96
+ const p = { id: rnd(), ns, kind, device, deviceId, label, ek, ctx, ts, exp: ts + (ttlMs || pendingTtlMs), from, re }
96
97
  pending.set(p.id, p)
97
98
  return publicOf(p)
98
99
  },
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * LA VERSIÓN DE `@dotrino/vault`, escrita aquí porque el navegador no puede leer el
3
3
  * `package.json`. Con esta se anuncia la bóveda de la pestaña y de la extensión
4
- * (`@dotrino/compat`). Una prueba (`test/version-del-navegador.test.mjs`) para el release
4
+ * (`@dotrino/compat`). Una prueba (`test/browser-version.test.mjs`) para el release
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.93.0'
8
+ export const LIB_VERSION = '0.93.1'
@@ -163,8 +163,8 @@ export function makeSealer () {
163
163
  * síntoma sería un servicio arrancando sin configuración y sin decir por qué.
164
164
  */
165
165
  async wrapFor (cek, members) {
166
- const { generation, sinLlave } = await makeGeneration({ members, cek })
167
- return { wraps: generation.wraps, sinLlave }
166
+ const { generation, sinLlave: noKey } = await makeGeneration({ members, cek })
167
+ return { wraps: generation.wraps, sinLlave: noKey }
168
168
  }
169
169
  }
170
170
  }
@@ -59,7 +59,7 @@ export function startSealersPublisher ({ identity, client, log = console.log, re
59
59
  if (!registryId) return () => {}
60
60
 
61
61
  /** Una respuesta a `sealers.whois`, o null si no contesta a tiempo. */
62
- function preguntarQuienEs (token, timeoutMs = 8000) {
62
+ function askWhoItIs (token, timeoutMs = 8000) {
63
63
  return new Promise((resolve) => {
64
64
  const fin = (v) => { try { off() } catch (_) {} ; clearTimeout(t); resolve(v) }
65
65
  const off = client.on('message', (_f, p) => { if (p?.op === WHOIS + '.result') fin(p) })
@@ -82,11 +82,11 @@ export function startSealersPublisher ({ identity, client, log = console.log, re
82
82
  * filtraría nada —el eslabón es público— pero se los tragaría EN SILENCIO, que es peor
83
83
  * que un error.
84
84
  */
85
- async function testigo () {
85
+ async function witness () {
86
86
  let tokens
87
87
  try { tokens = await client.list(canal) } catch (_) { return null }
88
88
  for (const token of tokens || []) {
89
- const r = await preguntarQuienEs(token)
89
+ const r = await askWhoItIs(token)
90
90
  const cert = r?.cert
91
91
  if (!cert?.sub || cert.iss !== registryId) continue
92
92
  // AQUÍ SOMOS EXTRAÑOS: no tenemos el acta del registro, así que no podemos preguntarle
@@ -107,11 +107,11 @@ export function startSealersPublisher ({ identity, client, log = console.log, re
107
107
  return null
108
108
  }
109
109
 
110
- let ultima = null
110
+ let latest = null
111
111
 
112
- let avisadoDeOtroTestigo = false
112
+ let warnedOtherWitness = false
113
113
 
114
- async function publicar (motivo) {
114
+ async function publish (reason) {
115
115
  let actas
116
116
  try { actas = await identity.sealerChain?.() } catch (_) { return }
117
117
  if (!Array.isArray(actas)) return
@@ -122,8 +122,8 @@ export function startSealersPublisher ({ identity, client, log = console.log, re
122
122
  // exactamente lo que ese campo existe para impedir. Se dice una vez y se calla.
123
123
  const genesis = actas[0]
124
124
  if (genesis?.chainUrl && registryId === DOTRINO_REGISTRY_ID) {
125
- if (!avisadoDeOtroTestigo) {
126
- avisadoDeOtroTestigo = true
125
+ if (!warnedOtherWitness) {
126
+ warnedOtherWitness = true
127
127
  log(`[sealers] this account names its own registry (${genesis.chainUrl}): not depositing into Dotrino's`)
128
128
  }
129
129
  return
@@ -136,14 +136,14 @@ export function startSealersPublisher ({ identity, client, log = console.log, re
136
136
  // aparece en el registro hasta que selle un acta nueva.
137
137
  if (chain.length < 2) return
138
138
 
139
- const cabeza = chain[chain.length - 1]?.seq
140
- if (cabeza === ultima) return
139
+ const head = chain[chain.length - 1]?.seq
140
+ if (head === latest) return
141
141
  try {
142
- const a = await testigo()
142
+ const a = await witness()
143
143
  if (!a) { log('[sealers] no witness announced in ' + canal + ': the chain stays for the next time'); return }
144
144
  await client.sendByPubkey(a, { op: OP, chain })
145
- ultima = cabeza
146
- log(`[sealers] chain up to #${cabeza} deposited (${motivo})`)
145
+ latest = head
146
+ log(`[sealers] chain up to #${head} deposited (${reason})`)
147
147
  } catch (e) {
148
148
  // Que no se pueda depositar no rompe nada de lo que la bóveda hace: el registro es
149
149
  // una comodidad para terceros, no una dependencia. Se reintenta en la próxima acta.
@@ -151,8 +151,8 @@ export function startSealersPublisher ({ identity, client, log = console.log, re
151
151
  }
152
152
  }
153
153
 
154
- publicar('startup').catch(() => {})
155
- const off = identity.onVault?.((e) => { if (e?.phase === 'acta') publicar(`record #${e.seq}`).catch(() => {}) })
154
+ publish('startup').catch(() => {})
155
+ const off = identity.onVault?.((e) => { if (e?.phase === 'acta') publish(`record #${e.seq}`).catch(() => {}) })
156
156
  return () => { try { off?.() } catch (_) {} }
157
157
  }
158
158