@dotrino/vaultd 0.6.0 → 0.6.2

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,12 +1,13 @@
1
1
  {
2
2
  "name": "@dotrino/vaultd",
3
- "version": "0.6.0",
3
+ "version": "0.6.2",
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": {
7
7
  "dotrino-vaultd": "bin/dotrino-vaultd.js",
8
8
  "dotrino-vault-tui": "bin/dotrino-vault-tui.js",
9
- "dotrino-vault": "bin/dotrino-vault.js"
9
+ "dotrino-vault": "bin/dotrino-vault.js",
10
+ "vaultd": "bin/dotrino-vaultd.js"
10
11
  },
11
12
  "scripts": {
12
13
  "start": "node bin/dotrino-vaultd.js",
package/src/ctl.js CHANGED
@@ -26,6 +26,7 @@ import { execFileSync } from 'node:child_process'
26
26
  import { pubkeyId } from '@dotrino/identity/capabilities'
27
27
  import { dataDir, readJson } from './paths.js'
28
28
  import { qrToString } from './qr.js'
29
+ import { VERSION } from './version.js'
29
30
 
30
31
  const dir = dataDir()
31
32
  const stateFile = path.join(dir, 'state.json')
@@ -51,7 +52,7 @@ const writeReq = (name, obj) => fs.writeFileSync(path.join(dir, name), JSON.stri
51
52
 
52
53
  const R = '\x1b[31m', B = '\x1b[1m', Z = '\x1b[0m' // rojo / negrita / reset
53
54
  // La versión se inyecta en build (esbuild --define); en dev cae a 'dev'.
54
- const VERSION = (typeof __VAULT_VERSION__ !== 'undefined') ? __VAULT_VERSION__ : 'dev'
55
+
55
56
  const PROFILE_URL = 'https://vault.dotrino.com/dispositivos#vault='
56
57
 
57
58
  /**
package/src/daemon.js CHANGED
@@ -18,6 +18,7 @@ import fs from 'node:fs'
18
18
  import path from 'node:path'
19
19
  import { startVaultManager } from './manager.js'
20
20
  import { dataDir, writeJson, readJson } from './paths.js'
21
+ import { VERSION } from './version.js'
21
22
 
22
23
  const readJsonSafe = (f) => readJson(f, null)
23
24
  const rm = (f) => { try { fs.rmSync(f, { force: true }) } catch (_) {} }
@@ -37,7 +38,7 @@ export async function runDaemon () {
37
38
 
38
39
  // --- state.json ---
39
40
  const stateFile = path.join(dir, 'state.json')
40
- const daemonVersion = (typeof __VAULT_VERSION__ !== 'undefined') ? __VAULT_VERSION__ : 'dev'
41
+ const daemonVersion = VERSION
41
42
  // Los campos de la raíz (fingerprint/iss) son los del perfil ACTIVO: los leen el
42
43
  // instalador y la web, que son anteriores al multi-perfil. La lista completa va
43
44
  // en `profiles`.
package/src/version.js ADDED
@@ -0,0 +1,26 @@
1
+ /**
2
+ * version.js — de dónde sale «la versión» según cómo se esté corriendo.
3
+ *
4
+ * · binario SEA → la inyecta esbuild al compilar (`__VAULT_VERSION__`).
5
+ * · npm / docker → se lee del `package.json` que viaja con el paquete.
6
+ * · desde el repo → lo mismo, así que deja de decir «dev» sin motivo.
7
+ *
8
+ * Importa: `dotrino-vault status` compara la versión del CLI con la del daemon para
9
+ * avisar de que el servicio quedó viejo tras actualizar. Si las dos dicen «dev», ese
10
+ * aviso no puede funcionar.
11
+ */
12
+ import fs from 'node:fs'
13
+ import path from 'node:path'
14
+ import { fileURLToPath } from 'node:url'
15
+
16
+ function fromPackageJson () {
17
+ try {
18
+ const here = path.dirname(fileURLToPath(import.meta.url))
19
+ return JSON.parse(fs.readFileSync(path.join(here, '..', 'package.json'), 'utf8')).version || 'dev'
20
+ } catch (_) { return 'dev' }
21
+ }
22
+
23
+ // eslint-disable-next-line no-undef
24
+ export const VERSION = (typeof __VAULT_VERSION__ !== 'undefined') ? __VAULT_VERSION__ : fromPackageJson()
25
+
26
+ export default VERSION