@dotrino/vaultd 0.150.0 → 0.150.1
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 +1 -1
- package/src/transport.js +10 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dotrino/vaultd",
|
|
3
|
-
"version": "0.150.
|
|
3
|
+
"version": "0.150.1",
|
|
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/transport.js
CHANGED
|
@@ -36,7 +36,7 @@ export async function masterPubkeyOf (identity) {
|
|
|
36
36
|
* @param {string} [opts.url] URL del proxy (default wss://proxy.dotrino.com).
|
|
37
37
|
* @returns {Promise<{ client, token:string, identify():Promise<void> }>}
|
|
38
38
|
*/
|
|
39
|
-
export async function createTransport ({ identity, dir, url = DEFAULT_PROXY, commKey = null, log = () => {}, makeClient = null, announce = null }) {
|
|
39
|
+
export async function createTransport ({ identity, dir, url = DEFAULT_PROXY, commKey = null, log = () => {}, makeClient = null, announce = null, recheckMs = 60_000, reannounceMs = 10 * 60_000 }) {
|
|
40
40
|
installNodeGlobals(dir)
|
|
41
41
|
// Import dinámico DESPUÉS de instalar los globals que el paquete usa.
|
|
42
42
|
// `WebSocketProxyClient` (la clase) y NO el helper `getWebSocketProxyClient`:
|
|
@@ -174,8 +174,10 @@ export async function createTransport ({ identity, dir, url = DEFAULT_PROXY, com
|
|
|
174
174
|
* existe». Si el anuncio falla, la bóveda sigue sirviendo a todo lo demás y se dice en voz
|
|
175
175
|
* alta: lo que se pierde es que la encuentren por su dirección, no que deje de funcionar.
|
|
176
176
|
*/
|
|
177
|
+
let announcedAt = 0
|
|
177
178
|
const announceAccount = async () => {
|
|
178
179
|
if (!announce || !identificado) return
|
|
180
|
+
announcedAt = Date.now()
|
|
179
181
|
try { await client.publish(announce) } catch (e) {
|
|
180
182
|
log(`[vault] could not announce this account on the proxy (${e.message}) — a borrowed machine will not find this vault by its address`)
|
|
181
183
|
}
|
|
@@ -219,8 +221,9 @@ export async function createTransport ({ identity, dir, url = DEFAULT_PROXY, com
|
|
|
219
221
|
* `connect()` es seguro de repetir: si ya está conectado devuelve el token y no abre
|
|
220
222
|
* nada.
|
|
221
223
|
*/
|
|
222
|
-
const RECHECK_MS =
|
|
224
|
+
const RECHECK_MS = recheckMs
|
|
223
225
|
const PATIENCE_MS = 5 * 60_000
|
|
226
|
+
const REANNOUNCE_MS = reannounceMs // la mitad de lo que el proxio guarda una entrada
|
|
224
227
|
let downSince = 0
|
|
225
228
|
let saidDown = false
|
|
226
229
|
client.on('disconnect', ({ code, reason } = {}) => {
|
|
@@ -236,6 +239,11 @@ export async function createTransport ({ identity, dir, url = DEFAULT_PROXY, com
|
|
|
236
239
|
if (identificado && client.token) {
|
|
237
240
|
if (downSince) log(`[vault] back on the proxy after ${Math.round((Date.now() - downSince) / 1000)}s`)
|
|
238
241
|
downSince = 0; saidDown = false
|
|
242
|
+
// EL ANUNCIO CADUCA: el proxio borra una entrada de canal a los 20 minutos de publicada.
|
|
243
|
+
// Sin renovarlo, entrar con usuario y contraseña solo funcionaba los primeros 20 minutos
|
|
244
|
+
// tras identificarse, y desde fuera se veía como «no hay ninguna bóveda en esa dirección»
|
|
245
|
+
// con la bóveda encendida (2026-10-12, la demo de los revisores).
|
|
246
|
+
if (announce && Date.now() - announcedAt >= REANNOUNCE_MS) await announceAccount()
|
|
239
247
|
return
|
|
240
248
|
}
|
|
241
249
|
if (!downSince) downSince = Date.now()
|