@dotrino/identity 0.136.1 → 0.136.3
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 +3 -2
- package/src/index.d.ts +60 -2
- package/src/index.js +364 -81
- package/src/node.js +29 -5
- package/types/acta.d.ts +397 -175
- package/types/assertion.d.ts +25 -18
- package/types/avatar.d.ts +14 -3
- package/types/capabilities.d.ts +110 -61
- package/types/content.d.ts +88 -45
- package/types/core.d.ts +578 -383
- package/types/keyid.d.ts +10 -3
- package/types/machine.d.ts +5 -1
- package/types/peerStore.d.ts +80 -0
- package/types/peerSync.d.ts +20 -6
- package/types/remote.d.ts +170 -42
- package/types/session.d.ts +74 -81
- package/types/sessionFlow.d.ts +108 -33
- package/types/vaultSeal.d.ts +21 -9
- package/vault/acta.js +245 -29
- package/vault/assertion.js +13 -4
- package/vault/avatar.js +12 -1
- package/vault/capabilities.js +56 -6
- package/vault/channel.js +18 -2
- package/vault/content.js +60 -6
- package/vault/core.js +419 -88
- package/vault/externalKeys.js +34 -2
- package/vault/facade.js +182 -24
- package/vault/globals.d.ts +60 -0
- package/vault/keyid.js +10 -1
- package/vault/machine.js +7 -1
- package/vault/nativeStore.js +21 -4
- package/vault/originPolicy.js +13 -2
- package/vault/peerStore.js +57 -10
- package/vault/peerSync.js +23 -4
- package/vault/remote.js +132 -32
- package/vault/session.js +24 -7
- package/vault/sessionFlow.js +43 -9
- package/vault/sync.js +59 -15
- package/vault/vault.js +78 -49
- package/vault/vaultSeal.js +18 -7
- package/vault/vendor/opaque/VERSION.txt +1 -1
- package/vault/vendor/opaque/src/index.js +90 -13
- package/vault/vendor/proxy-client/VERSION.txt +1 -1
- package/vault/vendor/proxy-client/binpack.js +38 -7
- package/vault/vendor/proxy-client/ble/manager.js +148 -36
- package/vault/vendor/proxy-client/ble/wire.js +74 -9
- package/vault/vendor/proxy-client/canonical.js +6 -2
- package/vault/vendor/proxy-client/client.js +439 -130
- package/vault/vendor/proxy-client/encpub.js +9 -1
- package/vault/vendor/proxy-client/index.js +4 -0
- package/vault/vendor/proxy-client/parts.js +22 -2
- package/vault/vendor/proxy-client/sealing.js +60 -9
- package/vault/vendor/proxy-client/signature.js +38 -1
- package/vault/vendor/proxy-client/stats-log.js +29 -9
- package/vault/vendor/proxy-client/stats.js +36 -8
- package/vault/vendor/proxy-client/webrtc.js +95 -16
- package/vault/vendor/roadmap/VERSION.txt +1 -1
- package/vault/vendor/roadmap/index.js +85 -9
- package/vault/vendor/roadmap/manifests.js +25 -24
- package/vault/vendor/vault/VERSION.txt +1 -1
- package/vault/vendor/vault/admin.js +4 -1
- package/vault/vendor/vault/core/libVersion.js +1 -1
- package/vault/vendor/vault/core/secretsStore.js +4 -1
- package/vault/vendor/vault/core/vault.js +14 -3
- package/vault/vendor/vault/passwordLogins.js +4 -2
|
@@ -47,19 +47,47 @@ const RTC_TAG = '__cc_rtc__'
|
|
|
47
47
|
* Si no hay ninguno, WebRTC queda apagado y se sigue por el proxio. Eso no es un fallo:
|
|
48
48
|
* es el escalón 4, que siempre funciona.
|
|
49
49
|
*/
|
|
50
|
+
/** @type {typeof RTCPeerConnection | null} */
|
|
50
51
|
let _PC = null
|
|
51
52
|
let _PCLookedUp = false
|
|
52
53
|
|
|
54
|
+
/**
|
|
55
|
+
* El estado de un canal con una punta (por token). `pc` es un `RTCPeerConnection` del
|
|
56
|
+
* navegador o uno de Node con el mismo contrato (`@dotrino/webrtc`/werift).
|
|
57
|
+
* @typedef {{
|
|
58
|
+
* remote: string,
|
|
59
|
+
* pc: RTCPeerConnection | null,
|
|
60
|
+
* dc: RTCDataChannel | null,
|
|
61
|
+
* makingOffer: boolean,
|
|
62
|
+
* ignoreOffer: boolean,
|
|
63
|
+
* negotiating: boolean,
|
|
64
|
+
* failed: boolean,
|
|
65
|
+
* polite: boolean,
|
|
66
|
+
* pendingCandidates: RTCIceCandidateInit[],
|
|
67
|
+
* openWaiters: Array<{ resolve: () => void, reject: (e: Error) => void }>,
|
|
68
|
+
* route?: 'direct' | 'turn',
|
|
69
|
+
* wasOpened?: boolean,
|
|
70
|
+
* closing?: boolean,
|
|
71
|
+
* busy?: number,
|
|
72
|
+
* }} PeerState
|
|
73
|
+
*/
|
|
74
|
+
|
|
75
|
+
/** La señal que viaja por el proxio. @typedef {{ kind: 'start' } | { kind: 'sdp', sdp: RTCSessionDescriptionInit | null } | { kind: 'ice', candidate: RTCIceCandidateInit }} RtcSignal */
|
|
76
|
+
|
|
53
77
|
/**
|
|
54
78
|
* Si este canal sirve AHORA para mandar: abierto Y con la conexión de debajo `connected`. Un
|
|
55
79
|
* canal abierto sobre una conexión `disconnected` acepta `send()` y lo pierde.
|
|
80
|
+
* @param {PeerState | null | undefined} peer
|
|
81
|
+
* @returns {peer is PeerState & { dc: RTCDataChannel, pc: RTCPeerConnection }}
|
|
56
82
|
*/
|
|
57
83
|
export function usable (peer) {
|
|
58
84
|
return !!(peer && peer.dc && peer.dc.readyState === 'open' && peer.pc && peer.pc.connectionState === 'connected')
|
|
59
85
|
}
|
|
60
86
|
|
|
87
|
+
/** @param {typeof RTCPeerConnection | null} impl */
|
|
61
88
|
export function setPeerConnection (impl) { _PC = impl; _PCLookedUp = true }
|
|
62
89
|
|
|
90
|
+
/** @returns {typeof RTCPeerConnection | null} */
|
|
63
91
|
export function resolvePeerConnection () {
|
|
64
92
|
if (_PCLookedUp) return _PC
|
|
65
93
|
_PCLookedUp = true
|
|
@@ -70,6 +98,7 @@ export function resolvePeerConnection () {
|
|
|
70
98
|
/**
|
|
71
99
|
* Busca una implementación para Node. Es ASÍNCRONO —importar un paquete lo es— así que se
|
|
72
100
|
* llama una vez al arrancar, no en medio de una negociación.
|
|
101
|
+
* @returns {Promise<typeof RTCPeerConnection | null>}
|
|
73
102
|
*/
|
|
74
103
|
export async function loadNodePeerConnection () {
|
|
75
104
|
if (_PCLookedUp && _PC) return _PC
|
|
@@ -116,13 +145,16 @@ export async function pinTurnToIPv4 (iceServers, opts = {}) {
|
|
|
116
145
|
// las apps de navegador, donde `node:dns` no existe (y donde no se llega hasta aquí).
|
|
117
146
|
const mod = 'node:dns'
|
|
118
147
|
const dns = await import(mod)
|
|
119
|
-
lookup = async (host) => (await dns.promises.lookup(host, { family: 4 })).address
|
|
148
|
+
lookup = async (/** @type {string} */ host) => (await dns.promises.lookup(host, { family: 4 })).address
|
|
120
149
|
}
|
|
150
|
+
/** @type {Map<string, Promise<string | null>>} */
|
|
121
151
|
const cache = new Map()
|
|
152
|
+
/** @param {string} url @returns {Promise<string>} */
|
|
122
153
|
const pin = async (url) => {
|
|
123
154
|
const m = /^(turn:)([^:?[\]]+)((?::\d+)?(?:\?.*)?)$/i.exec(String(url).trim())
|
|
124
155
|
if (!m || /^[\d.]+$/.test(m[2])) return url
|
|
125
|
-
|
|
156
|
+
const look = /** @type {(host: string) => Promise<string>} */ (lookup)
|
|
157
|
+
if (!cache.has(m[2])) cache.set(m[2], look(m[2]).catch(() => null))
|
|
126
158
|
const ip = await cache.get(m[2])
|
|
127
159
|
return ip ? m[1] + ip + m[3] : url
|
|
128
160
|
}
|
|
@@ -143,9 +175,10 @@ export class WebRTCManager {
|
|
|
143
175
|
* @param {(event: string, ...args: any[]) => void} opts.emit
|
|
144
176
|
* @param {(dir: 'in'|'out', token: string, bytes: number, route: 'direct'|'turn'|'webrtc') => void} [opts.count]
|
|
145
177
|
* cuenta el tráfico que va por el canal (ver stats.js)
|
|
146
|
-
* @param {{iceServers?:
|
|
178
|
+
* @param {{iceServers?: RTCIceServer[]} | null} [opts.config]
|
|
147
179
|
*/
|
|
148
180
|
constructor (opts) {
|
|
181
|
+
/** @type {((from: string) => boolean) | null} */
|
|
149
182
|
this.acceptFrom = null // ver `handleIncoming`: lo pone quien monta el cliente
|
|
150
183
|
this.getSelfToken = opts.getSelfToken
|
|
151
184
|
this.signalSend = opts.signalSend
|
|
@@ -153,7 +186,8 @@ export class WebRTCManager {
|
|
|
153
186
|
this.emit = opts.emit
|
|
154
187
|
this.count = typeof opts.count === 'function' ? opts.count : null
|
|
155
188
|
this.iceServers = (opts.config && opts.config.iceServers) || DEFAULT_ICE_SERVERS
|
|
156
|
-
|
|
189
|
+
/** @type {Map<string, PeerState>} remoteToken -> PeerState */
|
|
190
|
+
this.peers = new Map()
|
|
157
191
|
this.closed = false // `closeAll()`: no se abre nada más hasta `reopen()`
|
|
158
192
|
}
|
|
159
193
|
|
|
@@ -173,6 +207,10 @@ export class WebRTCManager {
|
|
|
173
207
|
*
|
|
174
208
|
* `acceptFrom` lo decide quien monta el cliente: la bóveda solo acepta a MIEMBROS DE SU
|
|
175
209
|
* ACTA. Sin política se mantiene lo de antes, para no romper a quien ya dependía de ello.
|
|
210
|
+
*
|
|
211
|
+
* @param {string} from
|
|
212
|
+
* @param {any} parsed
|
|
213
|
+
* @returns {boolean}
|
|
176
214
|
*/
|
|
177
215
|
handleIncoming (from, parsed) {
|
|
178
216
|
if (!parsed || typeof parsed !== 'object' || parsed.t !== RTC_TAG) return false
|
|
@@ -190,13 +228,18 @@ export class WebRTCManager {
|
|
|
190
228
|
* Try to send the given JSON payload over a DataChannel.
|
|
191
229
|
* Returns true if it was sent P2P; false if the caller should fall back
|
|
192
230
|
* to the proxy. Also opportunistically starts the connection negotiation.
|
|
231
|
+
*
|
|
232
|
+
* @param {string} to
|
|
233
|
+
* @param {string | Uint8Array} payloadString
|
|
234
|
+
* @returns {boolean}
|
|
193
235
|
*/
|
|
194
236
|
trySend (to, payloadString) {
|
|
195
237
|
if (this.closed) return false
|
|
196
238
|
const peer = this._ensurePeer(to)
|
|
197
239
|
if (usable(peer)) {
|
|
198
240
|
try {
|
|
199
|
-
|
|
241
|
+
// `send` tiene una sobrecarga por tipo y no acepta la unión; el canal lleva las dos.
|
|
242
|
+
peer.dc.send(/** @type {string} */ (payloadString))
|
|
200
243
|
this.count?.('out', to, utf8Length(payloadString), peer.route || 'webrtc')
|
|
201
244
|
return true
|
|
202
245
|
} catch (_) {
|
|
@@ -212,17 +255,23 @@ export class WebRTCManager {
|
|
|
212
255
|
* mensaje grande: soltarlas todas de golpe desborda el búfer del canal, el navegador lo
|
|
213
256
|
* cierra y el resto se pierde. Devuelve false si el canal no está (o se cerró), y quien
|
|
214
257
|
* llama sigue por el proxio.
|
|
258
|
+
*
|
|
259
|
+
* @param {string} to
|
|
260
|
+
* @param {string | Uint8Array} payloadString
|
|
261
|
+
* @param {number} [highWater]
|
|
262
|
+
* @returns {Promise<boolean>}
|
|
215
263
|
*/
|
|
216
264
|
async sendDirect (to, payloadString, highWater = 1024 * 1024) {
|
|
217
265
|
const peer = this.peers.get(to)
|
|
218
|
-
const dc = peer && peer.dc
|
|
219
266
|
if (!usable(peer)) return false
|
|
267
|
+
const dc = peer.dc
|
|
220
268
|
while (dc.bufferedAmount > highWater) {
|
|
221
269
|
await new Promise((r) => setTimeout(r, 15))
|
|
222
270
|
if (!usable(peer)) return false
|
|
223
271
|
}
|
|
224
272
|
try {
|
|
225
|
-
|
|
273
|
+
// `send` tiene una sobrecarga por tipo y no acepta la unión; el canal lleva las dos.
|
|
274
|
+
dc.send(/** @type {string} */ (payloadString))
|
|
226
275
|
this.count?.('out', to, utf8Length(payloadString), peer.route || 'webrtc')
|
|
227
276
|
return true
|
|
228
277
|
} catch (_) {
|
|
@@ -230,13 +279,17 @@ export class WebRTCManager {
|
|
|
230
279
|
}
|
|
231
280
|
}
|
|
232
281
|
|
|
233
|
-
/**
|
|
282
|
+
/**
|
|
283
|
+
* Optional: explicitly preconnect to a peer.
|
|
284
|
+
* @param {string} to
|
|
285
|
+
* @returns {Promise<void>}
|
|
286
|
+
*/
|
|
234
287
|
connect (to) {
|
|
235
288
|
if (this.closed) return Promise.reject(new Error('WebRTC closed'))
|
|
236
289
|
const peer = this._ensurePeer(to)
|
|
237
290
|
if (usable(peer)) return Promise.resolve()
|
|
238
291
|
if (!peer.negotiating) this._startNegotiation(peer).catch(() => {})
|
|
239
|
-
return new Promise((resolve, reject) => {
|
|
292
|
+
return new Promise(/** @param {() => void} resolve @param {(e: Error) => void} reject */ (resolve, reject) => {
|
|
240
293
|
peer.openWaiters.push({ resolve, reject })
|
|
241
294
|
})
|
|
242
295
|
}
|
|
@@ -248,6 +301,8 @@ export class WebRTCManager {
|
|
|
248
301
|
* abrirse después no los cierra nadie. El proceso no sale nunca: así se colgaron las
|
|
249
302
|
* pruebas de la bóveda en CI (0.186.0 y 0.186.1). Por eso, con una descripción en vuelo,
|
|
250
303
|
* la conexión se cierra al terminar esta, que ya ha reunido todo.
|
|
304
|
+
*
|
|
305
|
+
* @param {string} to
|
|
251
306
|
*/
|
|
252
307
|
closePeer (to) {
|
|
253
308
|
const peer = this.peers.get(to)
|
|
@@ -263,15 +318,22 @@ export class WebRTCManager {
|
|
|
263
318
|
for (const t of Array.from(this.peers.keys())) this.closePeer(t)
|
|
264
319
|
}
|
|
265
320
|
|
|
321
|
+
/** @param {PeerState} peer */
|
|
266
322
|
_closePC (peer) {
|
|
267
323
|
try { if (peer.pc) peer.pc.close() } catch (_) {}
|
|
268
324
|
}
|
|
269
325
|
|
|
270
|
-
/**
|
|
326
|
+
/**
|
|
327
|
+
* Una descripción (local o remota) en vuelo: mientras dure, cerrar espera a que acabe.
|
|
328
|
+
* @template T
|
|
329
|
+
* @param {PeerState} peer
|
|
330
|
+
* @param {() => Promise<T>} fn
|
|
331
|
+
* @returns {Promise<T>}
|
|
332
|
+
*/
|
|
271
333
|
async _describe (peer, fn) {
|
|
272
334
|
peer.busy = (peer.busy || 0) + 1
|
|
273
335
|
try { return await fn() } finally {
|
|
274
|
-
peer.busy
|
|
336
|
+
peer.busy = (peer.busy || 1) - 1
|
|
275
337
|
if (peer.closing && !peer.busy) this._closePC(peer)
|
|
276
338
|
}
|
|
277
339
|
}
|
|
@@ -280,12 +342,18 @@ export class WebRTCManager {
|
|
|
280
342
|
* Reemplaza la lista de ICE servers para las PRÓXIMAS conexiones (los peers
|
|
281
343
|
* ya negociados conservan la suya). Lo usa `client.enableTurn()` para
|
|
282
344
|
* inyectar las credenciales TURN temporales del proxy.
|
|
345
|
+
*
|
|
346
|
+
* @param {RTCIceServer[]} list
|
|
283
347
|
*/
|
|
284
348
|
setIceServers (list) {
|
|
285
349
|
if (Array.isArray(list) && list.length) this.iceServers = list
|
|
286
350
|
}
|
|
287
351
|
|
|
288
|
-
/**
|
|
352
|
+
/**
|
|
353
|
+
* Pregunta a ICE por dónde va el canal y lo apunta en `peer.route`.
|
|
354
|
+
* @param {PeerState} peer
|
|
355
|
+
* @returns {Promise<'direct' | 'turn' | null>}
|
|
356
|
+
*/
|
|
289
357
|
async probeRoute (peer) {
|
|
290
358
|
const r = await routeOf(peer.pc)
|
|
291
359
|
if (r) peer.route = r
|
|
@@ -295,8 +363,11 @@ export class WebRTCManager {
|
|
|
295
363
|
/**
|
|
296
364
|
* El estado de cada canal, para las estadísticas: `connecting` mientras se negocia,
|
|
297
365
|
* `direct`/`turn`/`webrtc` con el canal abierto, `failed` si no salió.
|
|
366
|
+
*
|
|
367
|
+
* @returns {Promise<Map<string, 'connecting' | 'failed' | 'direct' | 'turn' | 'webrtc' | null>>}
|
|
298
368
|
*/
|
|
299
369
|
async describe () {
|
|
370
|
+
/** @type {Map<string, 'connecting' | 'failed' | 'direct' | 'turn' | 'webrtc' | null>} */
|
|
300
371
|
const out = new Map()
|
|
301
372
|
for (const peer of this.peers.values()) {
|
|
302
373
|
const open = usable(peer)
|
|
@@ -306,12 +377,14 @@ export class WebRTCManager {
|
|
|
306
377
|
return out
|
|
307
378
|
}
|
|
308
379
|
|
|
380
|
+
/** @param {string} to @returns {boolean} */
|
|
309
381
|
isOpen (to) {
|
|
310
382
|
return usable(this.peers.get(to))
|
|
311
383
|
}
|
|
312
384
|
|
|
313
385
|
// ---------- internals ----------
|
|
314
386
|
|
|
387
|
+
/** @param {string} remoteToken @returns {PeerState} */
|
|
315
388
|
_ensurePeer (remoteToken) {
|
|
316
389
|
let peer = this.peers.get(remoteToken)
|
|
317
390
|
if (peer) return peer
|
|
@@ -331,12 +404,14 @@ export class WebRTCManager {
|
|
|
331
404
|
return peer
|
|
332
405
|
}
|
|
333
406
|
|
|
407
|
+
/** @param {string} remoteToken @returns {boolean} */
|
|
334
408
|
_isPolite (remoteToken) {
|
|
335
409
|
const self = this.getSelfToken()
|
|
336
410
|
if (!self) return false
|
|
337
411
|
return self < remoteToken
|
|
338
412
|
}
|
|
339
413
|
|
|
414
|
+
/** @param {PeerState} peer @returns {RTCPeerConnection} */
|
|
340
415
|
_createPC (peer) {
|
|
341
416
|
const PC = resolvePeerConnection()
|
|
342
417
|
if (!PC) throw new Error('no WebRTC here: install `werift` for Node, or run this in a browser')
|
|
@@ -383,16 +458,17 @@ export class WebRTCManager {
|
|
|
383
458
|
return pc
|
|
384
459
|
}
|
|
385
460
|
|
|
461
|
+
/** @param {PeerState} peer */
|
|
386
462
|
async _startNegotiation (peer) {
|
|
387
463
|
if (peer.negotiating) return
|
|
388
464
|
peer.negotiating = true
|
|
389
465
|
try {
|
|
390
|
-
|
|
466
|
+
const pc = peer.pc || this._createPC(peer)
|
|
391
467
|
// Caller side creates the data channel; the other end gets it via
|
|
392
468
|
// `ondatachannel`. The token comparison decides who initiates.
|
|
393
469
|
const self = this.getSelfToken()
|
|
394
470
|
if (self && self > peer.remote && !peer.dc) {
|
|
395
|
-
const dc =
|
|
471
|
+
const dc = pc.createDataChannel('cc', { ordered: true })
|
|
396
472
|
this._attachDC(peer, dc)
|
|
397
473
|
} else if (self && self < peer.remote && !peer.dc) {
|
|
398
474
|
// EL QUE NO CREA EL CANAL TIENE QUE PEDIRLO. Sin un canal nuevo no hay nada que
|
|
@@ -409,6 +485,7 @@ export class WebRTCManager {
|
|
|
409
485
|
}
|
|
410
486
|
}
|
|
411
487
|
|
|
488
|
+
/** @param {PeerState} peer @param {RTCDataChannel} dc */
|
|
412
489
|
_attachDC (peer, dc) {
|
|
413
490
|
peer.dc = dc
|
|
414
491
|
// Los bytes como ArrayBuffer: un Blob se lee de forma asíncrona y desordenaría las partes.
|
|
@@ -442,6 +519,7 @@ export class WebRTCManager {
|
|
|
442
519
|
}
|
|
443
520
|
}
|
|
444
521
|
|
|
522
|
+
/** @param {PeerState} peer */
|
|
445
523
|
_failPeer (peer) {
|
|
446
524
|
peer.failed = true
|
|
447
525
|
peer.negotiating = false
|
|
@@ -451,13 +529,14 @@ export class WebRTCManager {
|
|
|
451
529
|
for (const w of waiters) w.reject(err)
|
|
452
530
|
}
|
|
453
531
|
|
|
532
|
+
/** @param {PeerState} peer @param {RtcSignal} body */
|
|
454
533
|
_signal (peer, body) {
|
|
455
534
|
this.signalSend(peer.remote, { t: RTC_TAG, ...body })
|
|
456
535
|
}
|
|
457
536
|
|
|
537
|
+
/** @param {PeerState} peer @param {any} msg */
|
|
458
538
|
async _handleSignal (peer, msg) {
|
|
459
|
-
|
|
460
|
-
const pc = peer.pc
|
|
539
|
+
const pc = peer.pc || this._createPC(peer)
|
|
461
540
|
|
|
462
541
|
if (msg.kind === 'start') {
|
|
463
542
|
// El otro quiere ir directo y el canal lo creamos nosotros (ver `_startNegotiation`).
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
Copia vendorizada de @dotrino/roadmap@0.4.
|
|
1
|
+
Copia vendorizada de @dotrino/roadmap@0.4.88 (dotrino-roadmap/src/{index,manifests}.js).
|
|
2
2
|
NO se edita a mano: la escribe `node vendor.mjs` y la vigila test/vendor-up-to-date.test.mjs.
|
|
3
3
|
El registro de versiones rotas que viaja con cada versión. Importa @dotrino/compat/ranges.
|
|
@@ -22,6 +22,37 @@
|
|
|
22
22
|
import { satisfies } from '@dotrino/compat/ranges'
|
|
23
23
|
import { MANIFESTS } from './manifests.js'
|
|
24
24
|
|
|
25
|
+
/**
|
|
26
|
+
* @typedef {object} Product la ficha de un producto en el registro
|
|
27
|
+
* @property {string} repo `imdotrino/<repo>`
|
|
28
|
+
* @property {string|null} [npm] el nombre en npm (`null` si no se publica ahí)
|
|
29
|
+
* @property {string} current la versión que el registro da por vigente
|
|
30
|
+
* @property {number} protocol el entero del cable (`@dotrino/compat`)
|
|
31
|
+
* @property {Record<string, string|string[]>} requires rango que exige de cada pieza
|
|
32
|
+
* @property {string} [deprecated] por qué se retiró, si se retiró
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* @typedef {object} BrokenEntry una versión (o rango) marcada rota
|
|
37
|
+
* @property {string} product
|
|
38
|
+
* @property {string|string[]} versions
|
|
39
|
+
* @property {string} [why]
|
|
40
|
+
* @property {string} [fix]
|
|
41
|
+
*/
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* @typedef {object} Manifest
|
|
45
|
+
* @property {string} manifest
|
|
46
|
+
* @property {number} seq
|
|
47
|
+
* @property {string} issued
|
|
48
|
+
* @property {string} [note]
|
|
49
|
+
* @property {Record<string, Product>} products
|
|
50
|
+
* @property {BrokenEntry[]} broken
|
|
51
|
+
*/
|
|
52
|
+
|
|
53
|
+
/** @type {Readonly<Record<string, Manifest>>} */
|
|
54
|
+
const REGISTRY = MANIFESTS
|
|
55
|
+
|
|
25
56
|
/**
|
|
26
57
|
* NADA DE DISCO, y esto costó un binario que no arrancaba.
|
|
27
58
|
*
|
|
@@ -34,31 +65,56 @@ import { MANIFESTS } from './manifests.js'
|
|
|
34
65
|
* (`src/manifests.js`, generado desde `manifests/*.json`).
|
|
35
66
|
*/
|
|
36
67
|
|
|
37
|
-
/**
|
|
68
|
+
/**
|
|
69
|
+
* Los manifiestos que trae esta versión. Hay uno («dotrino») y caben varios.
|
|
70
|
+
* @returns {string[]}
|
|
71
|
+
*/
|
|
38
72
|
export function manifestNames () {
|
|
39
|
-
return Object.keys(
|
|
73
|
+
return Object.keys(REGISTRY).sort()
|
|
40
74
|
}
|
|
41
75
|
|
|
42
76
|
/**
|
|
43
77
|
* Un manifiesto por nombre. LANZA si no está: quien pregunta por un registro que no existe
|
|
44
78
|
* tiene un error, y devolverle un objeto vacío lo convertiría en «todo compatible».
|
|
79
|
+
* @param {string} [name]
|
|
80
|
+
* @returns {Manifest}
|
|
45
81
|
*/
|
|
46
82
|
export function loadManifest (name = 'dotrino') {
|
|
47
|
-
const m = Object.hasOwn(
|
|
83
|
+
const m = Object.hasOwn(REGISTRY, String(name)) ? REGISTRY[String(name)] : null
|
|
48
84
|
if (!m) throw new Error(`roadmap: there is no manifest called "${name}"`)
|
|
49
85
|
return m
|
|
50
86
|
}
|
|
51
87
|
|
|
52
|
-
/**
|
|
88
|
+
/**
|
|
89
|
+
* Los productos que el registro conoce.
|
|
90
|
+
* @param {Manifest|null|undefined} m
|
|
91
|
+
* @returns {string[]}
|
|
92
|
+
*/
|
|
53
93
|
export const products = (m) => Object.keys(m?.products || {}).sort()
|
|
54
94
|
|
|
55
|
-
/**
|
|
95
|
+
/**
|
|
96
|
+
* La ficha de un producto, o `null` si el registro no lo conoce.
|
|
97
|
+
* @param {Manifest|null|undefined} m
|
|
98
|
+
* @param {string} product
|
|
99
|
+
* @returns {Product|null}
|
|
100
|
+
*/
|
|
56
101
|
export const productOf = (m, product) => m?.products?.[product] || null
|
|
57
102
|
|
|
58
|
-
/**
|
|
103
|
+
/**
|
|
104
|
+
* La versión que el registro da por vigente. `null` si no lo conoce.
|
|
105
|
+
* @param {Manifest|null|undefined} m
|
|
106
|
+
* @param {string} product
|
|
107
|
+
* @returns {string|null}
|
|
108
|
+
*/
|
|
59
109
|
export const currentOf = (m, product) => productOf(m, product)?.current || null
|
|
60
110
|
|
|
61
|
-
/**
|
|
111
|
+
/**
|
|
112
|
+
* El rango que `product` necesita de `peer`, o `null` si no exige nada.
|
|
113
|
+
* @param {Manifest|null|undefined} m
|
|
114
|
+
* @param {string} product
|
|
115
|
+
* @param {string} peer
|
|
116
|
+
* @returns {string|string[]|null}
|
|
117
|
+
*/
|
|
62
118
|
export function requirementFor (m, product, peer) {
|
|
63
119
|
const p = productOf(m, product)
|
|
64
120
|
if (!p) return null
|
|
@@ -75,6 +131,9 @@ export function requirementFor (m, product, peer) {
|
|
|
75
131
|
*
|
|
76
132
|
* Si el registro no conoce al producto que pregunta, es `false`: preguntar por quien no
|
|
77
133
|
* está en el registro no puede salir que sí.
|
|
134
|
+
* @param {Manifest|null|undefined} m
|
|
135
|
+
* @param {{ product: string, peer: string, version: string }} q
|
|
136
|
+
* @returns {{ ok: boolean, reason: string }}
|
|
78
137
|
*/
|
|
79
138
|
export function meets (m, { product, peer, version }) {
|
|
80
139
|
if (!productOf(m, product)) {
|
|
@@ -86,10 +145,27 @@ export function meets (m, { product, peer, version }) {
|
|
|
86
145
|
return { ok: false, reason: `${product} needs ${peer} ${range} and this one is ${version}` }
|
|
87
146
|
}
|
|
88
147
|
|
|
89
|
-
/**
|
|
148
|
+
/**
|
|
149
|
+
* La lista de rotas del registro, lista para pasarla a `check` de `@dotrino/compat`.
|
|
150
|
+
* @param {Manifest|null|undefined} m
|
|
151
|
+
* @returns {BrokenEntry[]}
|
|
152
|
+
*/
|
|
90
153
|
export const brokenOf = (m) => Array.isArray(m?.broken) ? m.broken : []
|
|
91
154
|
|
|
92
|
-
/**
|
|
155
|
+
/**
|
|
156
|
+
* @typedef {object} Summary
|
|
157
|
+
* @property {string|null} manifest
|
|
158
|
+
* @property {number|null} seq
|
|
159
|
+
* @property {string|null} issued
|
|
160
|
+
* @property {{ product: string, current: string|null, protocol: number|null, requires: Record<string, string|string[]> }[]} products
|
|
161
|
+
* @property {BrokenEntry[]} broken
|
|
162
|
+
*/
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Lo que el administrador enseña: qué versión debería ir cada pieza, según el registro.
|
|
166
|
+
* @param {Manifest|null|undefined} m
|
|
167
|
+
* @returns {Summary}
|
|
168
|
+
*/
|
|
93
169
|
export function summary (m) {
|
|
94
170
|
return {
|
|
95
171
|
manifest: m?.manifest || null,
|
|
@@ -31,10 +31,10 @@ export const MANIFESTS = Object.freeze({
|
|
|
31
31
|
"identity": {
|
|
32
32
|
"repo": "imdotrino/dotrino-identity",
|
|
33
33
|
"npm": "@dotrino/identity",
|
|
34
|
-
"current": "0.
|
|
34
|
+
"current": "0.136.2",
|
|
35
35
|
"protocol": 1,
|
|
36
36
|
"requires": {
|
|
37
|
-
"proxy-client": ">=0.
|
|
37
|
+
"proxy-client": ">=0.20.0"
|
|
38
38
|
}
|
|
39
39
|
},
|
|
40
40
|
"lobby": {
|
|
@@ -95,7 +95,7 @@ export const MANIFESTS = Object.freeze({
|
|
|
95
95
|
"opaque": {
|
|
96
96
|
"repo": "imdotrino/dotrino-opaque",
|
|
97
97
|
"npm": "@dotrino/opaque",
|
|
98
|
-
"current": "0.1.
|
|
98
|
+
"current": "0.1.1",
|
|
99
99
|
"protocol": 1,
|
|
100
100
|
"requires": {}
|
|
101
101
|
},
|
|
@@ -111,19 +111,20 @@ export const MANIFESTS = Object.freeze({
|
|
|
111
111
|
},
|
|
112
112
|
"proxy": {
|
|
113
113
|
"repo": "imdotrino/dotrino-proxy",
|
|
114
|
-
"current": "1.11.
|
|
114
|
+
"current": "1.11.2",
|
|
115
115
|
"protocol": 2,
|
|
116
116
|
"requires": {
|
|
117
117
|
"vault": ">=0.87.0",
|
|
118
118
|
"identity": ">=0.117.2",
|
|
119
119
|
"proxy-client": ">=0.36.1",
|
|
120
|
-
"content": "0.5.3+"
|
|
120
|
+
"content": "0.5.3+",
|
|
121
|
+
"update": ">=0.9.0"
|
|
121
122
|
}
|
|
122
123
|
},
|
|
123
124
|
"proxy-client": {
|
|
124
125
|
"repo": "imdotrino/dotrino-proxy-client",
|
|
125
126
|
"npm": "@dotrino/proxy-client",
|
|
126
|
-
"current": "0.
|
|
127
|
+
"current": "0.47.2",
|
|
127
128
|
"protocol": 2,
|
|
128
129
|
"requires": {
|
|
129
130
|
"identity": ">=0.53.0",
|
|
@@ -133,10 +134,10 @@ export const MANIFESTS = Object.freeze({
|
|
|
133
134
|
"remote-agent": {
|
|
134
135
|
"repo": "imdotrino/dotrino-remote-agent",
|
|
135
136
|
"npm": "@dotrino/remote-agent",
|
|
136
|
-
"current": "0.
|
|
137
|
+
"current": "0.33.1",
|
|
137
138
|
"protocol": 1,
|
|
138
139
|
"requires": {
|
|
139
|
-
"identity": ">=0.
|
|
140
|
+
"identity": ">=0.136.0",
|
|
140
141
|
"vault": ">=0.115.0",
|
|
141
142
|
"proxy-client": ">=0.46.0",
|
|
142
143
|
"vaultd": ">=0.154.0",
|
|
@@ -160,7 +161,7 @@ export const MANIFESTS = Object.freeze({
|
|
|
160
161
|
"terminal-agent": {
|
|
161
162
|
"repo": "imdotrino/dotrino-terminal",
|
|
162
163
|
"npm": "@dotrino/terminal-agent",
|
|
163
|
-
"current": "0.54.
|
|
164
|
+
"current": "0.54.1",
|
|
164
165
|
"protocol": 2,
|
|
165
166
|
"requires": {
|
|
166
167
|
"remote-agent": ">=0.32.1",
|
|
@@ -211,7 +212,7 @@ export const MANIFESTS = Object.freeze({
|
|
|
211
212
|
"content": {
|
|
212
213
|
"repo": "imdotrino/dotrino-content",
|
|
213
214
|
"npm": "@dotrino/content",
|
|
214
|
-
"current": "0.7.
|
|
215
|
+
"current": "0.7.3",
|
|
215
216
|
"protocol": 1,
|
|
216
217
|
"requires": {
|
|
217
218
|
"remote-agent": ">=0.30.0",
|
|
@@ -236,7 +237,7 @@ export const MANIFESTS = Object.freeze({
|
|
|
236
237
|
"roadmap": {
|
|
237
238
|
"repo": "imdotrino/dotrino-roadmap",
|
|
238
239
|
"npm": "@dotrino/roadmap",
|
|
239
|
-
"current": "0.4.
|
|
240
|
+
"current": "0.4.88",
|
|
240
241
|
"protocol": 1,
|
|
241
242
|
"requires": {
|
|
242
243
|
"compat": "0.4.0+"
|
|
@@ -255,7 +256,7 @@ export const MANIFESTS = Object.freeze({
|
|
|
255
256
|
"theme": {
|
|
256
257
|
"repo": "imdotrino/dotrino-theme",
|
|
257
258
|
"npm": "@dotrino/theme",
|
|
258
|
-
"current": "0.1.
|
|
259
|
+
"current": "0.1.1",
|
|
259
260
|
"protocol": 1,
|
|
260
261
|
"requires": {}
|
|
261
262
|
},
|
|
@@ -272,12 +273,12 @@ export const MANIFESTS = Object.freeze({
|
|
|
272
273
|
"vault": {
|
|
273
274
|
"repo": "imdotrino/dotrino-vault",
|
|
274
275
|
"npm": "@dotrino/vault",
|
|
275
|
-
"current": "0.
|
|
276
|
+
"current": "0.120.0",
|
|
276
277
|
"protocol": 1,
|
|
277
278
|
"requires": {
|
|
278
279
|
"vaultd": ">=0.105.0",
|
|
279
|
-
"proxy-client": ">=0.
|
|
280
|
-
"identity": ">=0.
|
|
280
|
+
"proxy-client": ">=0.47.0",
|
|
281
|
+
"identity": ">=0.136.0",
|
|
281
282
|
"opaque": ">=0.1.0",
|
|
282
283
|
"compat": ">=0.5.0",
|
|
283
284
|
"roadmap": ">=0.4.26",
|
|
@@ -288,11 +289,11 @@ export const MANIFESTS = Object.freeze({
|
|
|
288
289
|
"vaultd": {
|
|
289
290
|
"repo": "imdotrino/dotrino-vault",
|
|
290
291
|
"npm": "@dotrino/vaultd",
|
|
291
|
-
"current": "0.
|
|
292
|
+
"current": "0.192.0",
|
|
292
293
|
"protocol": 1,
|
|
293
294
|
"requires": {
|
|
294
|
-
"identity": ">=0.
|
|
295
|
-
"proxy-client": ">=0.
|
|
295
|
+
"identity": ">=0.136.0",
|
|
296
|
+
"proxy-client": ">=0.47.0",
|
|
296
297
|
"store": ">=0.13.0",
|
|
297
298
|
"passmanager": ">=0.18.6",
|
|
298
299
|
"compat": ">=0.5.0",
|
|
@@ -341,12 +342,12 @@ export const MANIFESTS = Object.freeze({
|
|
|
341
342
|
},
|
|
342
343
|
"passmanager-extension": {
|
|
343
344
|
"repo": "imdotrino/dotrino-passmanager",
|
|
344
|
-
"current": "0.58.
|
|
345
|
+
"current": "0.58.5",
|
|
345
346
|
"protocol": 1,
|
|
346
347
|
"requires": {
|
|
347
|
-
"identity": ">=0.
|
|
348
|
-
"proxy-client": ">=0.
|
|
349
|
-
"vault": ">=0.
|
|
348
|
+
"identity": ">=0.136.0",
|
|
349
|
+
"proxy-client": ">=0.47.0",
|
|
350
|
+
"vault": ">=0.120.0",
|
|
350
351
|
"proxy": "1.1.0+",
|
|
351
352
|
"vaultd": ">=0.160.2"
|
|
352
353
|
}
|
|
@@ -413,7 +414,7 @@ export const MANIFESTS = Object.freeze({
|
|
|
413
414
|
"expenses-agent": {
|
|
414
415
|
"repo": "imdotrino/dotrino-expenses-agent",
|
|
415
416
|
"npm": "@dotrino/expenses-agent",
|
|
416
|
-
"current": "0.2.
|
|
417
|
+
"current": "0.2.1",
|
|
417
418
|
"protocol": 1,
|
|
418
419
|
"requires": {
|
|
419
420
|
"remote-agent": ">=0.30.0",
|
|
@@ -432,7 +433,7 @@ export const MANIFESTS = Object.freeze({
|
|
|
432
433
|
"update": {
|
|
433
434
|
"repo": "imdotrino/dotrino-update",
|
|
434
435
|
"npm": "@dotrino/update",
|
|
435
|
-
"current": "0.9.
|
|
436
|
+
"current": "0.9.4",
|
|
436
437
|
"protocol": 1,
|
|
437
438
|
"requires": {}
|
|
438
439
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Copia vendorizada de @dotrino/vault@0.120.
|
|
1
|
+
Copia vendorizada de @dotrino/vault@0.120.1 (dotrino-vault/lib/src/{admin,b64,browser,core/approvals,core/backup,core/blocked,core/browserDisk,core/commKey,core/disk,core/exNotices,core/gate,core/libVersion,core/logAnchor,core/machines,core/memberGroups,core/notices,core/notifiable,core/passwords,core/sealKey,core/sealer,core/sealers,core/secretsStore,core/sha256,core/siblingBackup,core/store,core/subacta,core/threadStore,core/transport,core/vault,enroll,index,invite,loginClient,passwordLogins,procContext,protocol,revocation,sealed}.js).
|
|
2
2
|
NO se edita a mano: la escribe `node vendor.mjs` y la vigila test/vendor-up-to-date.test.mjs.
|
|
3
3
|
browser.js es la bóveda de esta pestaña: el MISMO núcleo que el binario (core/), con
|
|
4
4
|
el disco en IndexedDB. Importa @dotrino/{compat,roadmap,passmanager,store/core} y
|
|
@@ -241,7 +241,10 @@ export function createAdminDesk ({
|
|
|
241
241
|
// VER UNA PRIVADA (`varsDesk.reveal`). Antes que las demás de variables porque aquí no
|
|
242
242
|
// viaja ningún destino en claro: va dentro del sobre, y la política es de la bóveda.
|
|
243
243
|
if (data.op === 'var.reveal.begin' || data.op === 'var.reveal') {
|
|
244
|
-
|
|
244
|
+
// Se comprueba el método que se va a llamar. Antes se miraba siempre `reveal`, y una
|
|
245
|
+
// bóveda sin `revealBegin` reventaba con un TypeError en vez de decirlo.
|
|
246
|
+
const method = data.op === 'var.reveal.begin' ? 'revealBegin' : 'reveal'
|
|
247
|
+
if (!vars || typeof vars[method] !== 'function') return { ok: false, error: 'admin: this vault cannot show a private variable (update it)' }
|
|
245
248
|
try {
|
|
246
249
|
const result = data.op === 'var.reveal.begin'
|
|
247
250
|
? await vars.revealBegin({ caller: chk.device, by })
|
|
@@ -1448,7 +1448,10 @@ export function openSecretsStore (disk, { sealer = null, recipients = null, sign
|
|
|
1448
1448
|
dev: {},
|
|
1449
1449
|
recovery: { pub: pair.pub, priv: await sealer.sealMaster(pair.priv, keyOr(adminKey)) },
|
|
1450
1450
|
// El histórico empieza aquí: de lo de antes no se guardó ninguna versión previa.
|
|
1451
|
-
history: []
|
|
1451
|
+
history: [],
|
|
1452
|
+
// Las lápidas se conservan. Faltaba el campo, y el primer `delete` tras convertir
|
|
1453
|
+
// reventaba en `_drop` (`data.deleted[owner]` sobre `undefined`) hasta reiniciar.
|
|
1454
|
+
deleted: data.deleted
|
|
1452
1455
|
}
|
|
1453
1456
|
const antes = {}
|
|
1454
1457
|
const noKey = {}
|