@dotrino/vaultd 0.89.0 → 0.91.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dotrino/vaultd",
3
- "version": "0.89.0",
3
+ "version": "0.91.0",
4
4
  "type": "module",
5
5
  "description": "Certificador personal de Dotrino: daemon headless que custodia la clave maestra y delega capacidades a tus dispositivos por el proxy. Tu CA propia.",
6
6
  "bin": {
package/src/daemon.js CHANGED
@@ -225,7 +225,7 @@ export async function runDaemon () {
225
225
  }, expiresInMs + 1000).unref?.()
226
226
  console.log('[vault] pairing started (valid for %d min)', expiresInMs / 60000)
227
227
  } catch (e) {
228
- console.error('[vault] no se pudo iniciar emparejamiento:', e.message)
228
+ console.error('[vault] could not start pairing:', e.message)
229
229
  }
230
230
  }
231
231
 
@@ -413,7 +413,7 @@ export async function runDaemon () {
413
413
  } catch (e) { console.error('[vault] could not grant admin: %s', e.message) }
414
414
  }
415
415
  pendingAdmin = false
416
- console.log('[vault] aprobado %s', r.deviceId)
416
+ console.log('[vault] approved %s', r.deviceId)
417
417
  answer({ ok: true, deviceId: r.deviceId || null })
418
418
  } catch (e) {
419
419
  console.error('[vault] approval failed:', e.message)
@@ -440,7 +440,7 @@ export async function runDaemon () {
440
440
  rm(path.join(dir, 'caps-request.json'))
441
441
  try {
442
442
  await targetOf(capsReq)?.setCaps(capsReq.pub, capsReq.caps)
443
- console.log('[vault] permissions updated: %s', capsReq.caps.join(', ') || '(ninguno)')
443
+ console.log('[vault] permissions updated: %s', capsReq.caps.join(', ') || '(none)')
444
444
  } catch (e) { console.error('[vault] could not change permissions:', e.message) }
445
445
  }
446
446
  // Quitar un dispositivo: se pide por `sub` (la llave del aparato). `nonce` sigue
package/src/manager.js CHANGED
@@ -80,7 +80,7 @@ export async function startVaultManager ({ root = dataDir(), proxyUrl, log = con
80
80
  }
81
81
 
82
82
  const migrated = await profiles.migrate(mintKey)
83
- if (migrated?.migrated) log('[vault] identidad mono-perfil migrada al perfil %s', migrated.id)
83
+ if (migrated?.migrated) log('[vault] single-profile identity migrated to profile %s', migrated.id)
84
84
 
85
85
  const running = new Map() // id -> instancia de startVault
86
86
 
@@ -121,7 +121,7 @@ export async function startVaultManager ({ root = dataDir(), proxyUrl, log = con
121
121
  id = await profiles.ensureNamedByKey(p.id, mintKey)
122
122
  if (id !== p.id) log('[vault] profile %s renamed to %s (the folder is named after its key)', p.id, id)
123
123
  } catch (e) { log('[vault] could not name the folder of %s after its key: %s', p.id, e.message) }
124
- try { await open(id) } catch (e) { log('[vault] no se pudo abrir el perfil %s: %s', id, e.message) }
124
+ try { await open(id) } catch (e) { log('[vault] could not open profile %s: %s', id, e.message) }
125
125
  }
126
126
 
127
127
  const get = (id) => {
@@ -179,7 +179,7 @@ export async function startVaultManager ({ root = dataDir(), proxyUrl, log = con
179
179
  async add (name, { adopt = false, kek = null } = {}) {
180
180
  const p = await profiles.add(name, { adopt, kek, mintKey })
181
181
  await open(p.id)
182
- log('[vault] perfil creado%s: %s (%s)', adopt ? ' (a la espera de adoptar una cuenta)' : '', p.name || '(sin nombre)', p.id)
182
+ log('[vault] profile created%s: %s (%s)', adopt ? ' (waiting to adopt an account)' : '', p.name || '(no name)', p.id)
183
183
  return profiles.get(p.id)
184
184
  },
185
185
 
@@ -209,7 +209,7 @@ export async function startVaultManager ({ root = dataDir(), proxyUrl, log = con
209
209
  const res = profiles.remove(id) // valida: no es el único, no está bloqueado
210
210
  try { running.get(id)?.close() } catch (_) {}
211
211
  running.delete(id)
212
- log('[vault] perfil borrado: %s (%s)', res.name || '(sin nombre)', id)
212
+ log('[vault] profile deleted: %s (%s)', res.name || '(no name)', id)
213
213
  return res
214
214
  },
215
215
 
package/src/passwords.js CHANGED
@@ -79,7 +79,7 @@ export function createPasswordDesk (opts = {}) {
79
79
  // el criterio del vault es apuntar la operación, no el payload.
80
80
  audit('passwords', { op: r.op, outcome: r.outcome, device: (r.from || '').slice(0, 24) })
81
81
  if (r.outcome !== 'served') {
82
- log('[vault] passwords: %s %s', r.op, r.outcome)
82
+ log(`[vault] passwords: ${r.op} ${r.outcome}`)
83
83
  }
84
84
  },
85
85
  })
package/src/transport.js CHANGED
@@ -73,7 +73,7 @@ export async function createTransport ({ identity, dir, url = DEFAULT_PROXY, com
73
73
  // quedaba en el log era el del repliegue. Así que cuando la consola decía «no
74
74
  // contesta», no había forma de saber desde aquí si la bóveda estaba atada al proxio
75
75
  // o no. Una línea por reconexión es barata; no tenerla cuesta una hora de sondeos.
76
- log('[vault] identified on the proxy with the communication key · record #%s', record?.seq ?? '?')
76
+ log(`[vault] identified on the proxy with the communication key · record #${record?.seq ?? '?'}`)
77
77
  return
78
78
  }
79
79
  }
package/src/vault.js CHANGED
@@ -333,6 +333,24 @@ export async function startVault ({ dir = dataDir(), proxyUrl, log = console.log
333
333
  // rotación no necesita abrir nada.
334
334
  const activityFile = path.join(dir, 'activity.log')
335
335
  const activityAtRest = atRestFor(dir)
336
+ // MIGRACIÓN de las bitácoras escritas antes de 0.89, que están en claro. Se convierten
337
+ // de una vez al arrancar: es un archivo acotado (rota al MB) y así «nada en claro» es
338
+ // cierto también para lo que ya estaba escrito, no solo para lo que se escriba desde
339
+ // ahora. Se agota sola — cuando no queda ninguna línea en claro, no vuelve a tocar nada.
340
+ try {
341
+ const crudo = fs.readFileSync(activityFile, 'utf8')
342
+ const lineas = crudo.split('\n')
343
+ if (lineas.some((l) => l && !l.startsWith('DOTRINO-ATREST-v1.'))) {
344
+ const convertidas = lineas.map((l) => (l && !l.startsWith('DOTRINO-ATREST-v1.') ? activityAtRest.encrypt(l) : l))
345
+ // Escribir aparte y renombrar: a medio convertir, la bitácora sería ilegible entera.
346
+ fs.writeFileSync(activityFile + '.tmp', convertidas.join('\n'), { mode: 0o600 })
347
+ fs.renameSync(activityFile + '.tmp', activityFile)
348
+ // Sin `%d`: el `log` de la bóveda no formatea, así que el placeholder salía literal.
349
+ log(`[vault] activity log: ${convertidas.filter(Boolean).length} line(s) sealed at rest`)
350
+ }
351
+ // Y el modo, que hasta 0.89 se creaba 0664: legible por cualquier usuario.
352
+ if ((fs.statSync(activityFile).mode & 0o077) !== 0) fs.chmodSync(activityFile, 0o600)
353
+ } catch (_) { /* no hay bitácora todavía */ }
336
354
  const audit = (op, info = {}) => {
337
355
  try {
338
356
  const line = activityAtRest.encrypt(JSON.stringify({ ts: Date.now(), op, ...info }))
@@ -1170,7 +1188,7 @@ export async function startVault ({ dir = dataDir(), proxyUrl, log = console.log
1170
1188
  audit,
1171
1189
  log,
1172
1190
  }).start()
1173
- log('[vault] passwords: serving %d device(s)', passwordDevices().length)
1191
+ log(`[vault] passwords: serving ${passwordDevices().length} device(s)`)
1174
1192
  }
1175
1193
  try {
1176
1194
  // El acta ANTES de mirarla: es ella la que dice si hay a quién responder, y sin
@@ -1184,7 +1202,7 @@ export async function startVault ({ dir = dataDir(), proxyUrl, log = console.log
1184
1202
  // Ni código de enlace ni pegar nada: un gestor entra como cualquier otro aparato.
1185
1203
  else log('[vault] passwords: no device may ask yet · pair one with `dotrino-vault pair --scope contrasenas`')
1186
1204
  } catch (e) {
1187
- log('[vault] passwords: no se pudo levantar (%s); el resto sigue igual', e.message)
1205
+ log(`[vault] passwords: could not start (${e.message}); everything else keeps going`)
1188
1206
  }
1189
1207
 
1190
1208
  log(`[vault] listo · id ${fp} · ${store.getTree().children.length} nodos`)