@dotrino/vaultd 0.131.2 → 0.131.4

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.131.2",
3
+ "version": "0.131.4",
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/ctl.js CHANGED
@@ -1723,7 +1723,8 @@ async function cmdLogins (rest) {
1723
1723
  * `dotrino-vault update` — TRAER LA VERSIÓN NUEVA, cuando lo escribe una persona.
1724
1724
  *
1725
1725
  * Con la INSTALACIÓN DE USUARIO (`~/.local/share/dotrino/bin`) el daemon ya se actualiza
1726
- * solo: pide permiso al teléfono si hay aprobadores y, si no los hay, no hace falta
1726
+ * solo: pide permiso a un aparato con `aprueba` (el teléfono, un navegador…) si lo hay y,
1727
+ * si no hay ninguno, no hace falta
1727
1728
  * (dueño, 2026-09-24). Esto es lo mismo a mano, sin esperar al aviso del día. Con el
1728
1729
  * `.deb` del sistema el binario es de root y aquí solo se verifica y se dice el `sudo`.
1729
1730
  *
package/src/update.js CHANGED
@@ -75,11 +75,28 @@ export function isUserInstall (execPath = process.execPath, home = os.homedir())
75
75
  export async function installUserRelease (release, { binDir = userBinDir(), log = () => {}, fetchVerifiedImpl = fetchVerified } = {}) {
76
76
  const pick = pickAsset(release.assets, [{ kind: 'tar', re: /-linux-x64\.tar\.gz$/ }])
77
77
  if (!pick.ok) return pick
78
- const got = await fetchVerifiedImpl(pick.asset, { repo: REPO, product: 'dotrino-vault', version: VERSION })
78
+ // SE TRABAJA EN DISCO, al lado de los binarios, y no en /tmp: en un VPS /tmp es un tmpfs
79
+ // (memoria) de unos cientos de MB, y el tarball (41 MB) más el binario (125 MB) no cabían
80
+ // — tar falló con «Disk quota exceeded» en la bóveda de Dotrino (2026-09-24). Además es la
81
+ // única carpeta que la unidad deja escribir. La carpeta se borra al acabar, salga como salga.
82
+ const work = path.join(path.dirname(binDir), 'update')
83
+ fs.rmSync(work, { recursive: true, force: true })
84
+ fs.mkdirSync(work, { recursive: true, mode: 0o700 })
85
+ try {
86
+ return await instalarDesde(work, pick, release, { binDir, log, fetchVerifiedImpl })
87
+ } finally {
88
+ try { fs.rmSync(work, { recursive: true, force: true }) } catch (_) {}
89
+ }
90
+ }
91
+
92
+ async function instalarDesde (work, pick, release, { binDir, log, fetchVerifiedImpl }) {
93
+ const got = await fetchVerifiedImpl(pick.asset, { repo: REPO, product: 'dotrino-vault', version: VERSION, dir: work })
79
94
  if (!got.ok) return got
80
95
  log(`[vault] update: ${pick.asset.name} verified against its attestation`)
81
- const work = path.dirname(got.file)
82
- execFileSync('tar', ['xzf', got.file, '-C', work])
96
+ try { execFileSync('tar', ['xzf', got.file, '-C', work], { stdio: ['ignore', 'ignore', 'pipe'] }) } catch (e) {
97
+ // El motivo de tar es lo que sirve («Disk quota exceeded», …): se dice, no solo «falló».
98
+ return { ok: false, code: 'UNPACK_FAILED', reason: `could not unpack the release: ${String(e.stderr || e.message).trim().split('\n').slice(-2).join(' · ')}` }
99
+ }
83
100
  const src = fs.readdirSync(work).map((d) => path.join(work, d)).find((d) => fs.existsSync(path.join(d, 'dotrino-vaultd')))
84
101
  if (!src) return { ok: false, code: 'BAD_TARBALL', reason: 'the tarball has no dotrino-vaultd inside' }
85
102
  fs.mkdirSync(binDir, { recursive: true })
@@ -90,6 +107,5 @@ export async function installUserRelease (release, { binDir = userBinDir(), log
90
107
  fs.chmodSync(tmp, 0o755)
91
108
  fs.renameSync(tmp, path.join(binDir, name))
92
109
  }
93
- try { fs.rmSync(work, { recursive: true, force: true }) } catch (_) {}
94
110
  return { ok: true, version: release.version }
95
111
  }
package/src/vault.js CHANGED
@@ -1137,7 +1137,8 @@ export async function startVault ({ dir = dataDir(), proxyUrl, log = console.log
1137
1137
  async function denyChain (from, chk, p, what) {
1138
1138
  await notifyIfRevoked(p.data?.publickey, p.cert?.nonce || null, p.cert?.iss || null, chk.reason)
1139
1139
  if (what) audit('rejected', { what, reason: chk.reason })
1140
- return reply(from, { type: MSG.ERROR, error: 'unauthorized: ' + chk.reason })
1140
+ // `code` + `reason` como campos: quien llama decide por ellos, no por la frase.
1141
+ return reply(from, { type: MSG.ERROR, code: 'unauthorized', reason: chk.reason, error: 'unauthorized: ' + chk.reason })
1141
1142
  }
1142
1143
 
1143
1144
  /**