@dotrino/vaultd 0.194.0 → 0.194.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/lib/src/atrest.js CHANGED
@@ -65,6 +65,10 @@ import { resolveKey, mintKey, readConfig, writeConfig, probe, clearCache, config
65
65
  const MAGIC = 'DOTRINO-ATREST-v1'
66
66
  const SALT_FILE = 'atrest.salt'
67
67
 
68
+ // El material no cambia mientras corre el proceso: se lee una vez. En Windows leerlo es lanzar
69
+ // `reg.exe`, y un agente que abre su enlace en cada consulta lanzaba uno cada vez.
70
+ let machineCache = null
71
+
68
72
  /**
69
73
  * Material de ESTA máquina, por sistema. Si no se encuentra nada, se cae al hostname
70
74
  * (peor —un hostname se adivina y se repite— pero deja el esquema funcionando).
@@ -74,13 +78,14 @@ const SALT_FILE = 'atrest.salt'
74
78
  * · macOS `IOPlatformUUID` del hardware
75
79
  */
76
80
  function machineMaterial () {
81
+ if (machineCache) return machineCache
77
82
  const parts = []
78
83
  if (process.platform === 'win32') {
79
84
  try {
80
85
  const out = execFileSync(
81
86
  path.join(process.env.SystemRoot || 'C:\\Windows', 'System32', 'reg.exe'),
82
87
  ['query', 'HKLM\\SOFTWARE\\Microsoft\\Cryptography', '/v', 'MachineGuid'],
83
- { encoding: 'utf8', timeout: 4000, stdio: ['ignore', 'pipe', 'ignore'] }
88
+ { encoding: 'utf8', timeout: 4000, stdio: ['ignore', 'pipe', 'ignore'], windowsHide: true }
84
89
  )
85
90
  const m = /MachineGuid\s+REG_SZ\s+(\S+)/i.exec(out)
86
91
  if (m) parts.push(m[1])
@@ -97,8 +102,9 @@ function machineMaterial () {
97
102
  try { parts.push(fs.readFileSync(f, 'utf8').trim()) } catch (_) {}
98
103
  }
99
104
  }
100
- if (!parts.length) parts.push(os.hostname())
101
- return parts.join('|')
105
+ // Solo se guarda lo leído del sistema: el hostname de repuesto se vuelve a intentar.
106
+ if (parts.length) return (machineCache = parts.join('|'))
107
+ return os.hostname()
102
108
  }
103
109
 
104
110
  /** Salt local, creado la primera vez y guardado junto a los datos (0600). */
@@ -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.121.3'
package/lib/src/kek.js CHANGED
@@ -96,7 +96,8 @@ export function runStep (step, input, what) {
96
96
  encoding: 'utf8',
97
97
  timeout: Number(step.timeoutMs) || 15000,
98
98
  maxBuffer: 1024 * 1024,
99
- stdio: ['pipe', 'pipe', 'pipe']
99
+ stdio: ['pipe', 'pipe', 'pipe'],
100
+ windowsHide: true
100
101
  })
101
102
  } catch (e) {
102
103
  // `stderr` es lo único que dice POR QUÉ (credenciales caducadas, sin permiso, sin red).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dotrino/vaultd",
3
- "version": "0.194.0",
3
+ "version": "0.194.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": {