@dotrino/identity 0.121.4 → 0.121.5
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/vault/vendor/proxy-client/VERSION.txt +1 -1
- package/vault/vendor/proxy-client/binpack.js +10 -12
- package/vault/vendor/proxy-client/client.js +3 -3
- package/vault/vendor/proxy-client/parts.js +5 -4
- package/vault/vendor/roadmap/VERSION.txt +1 -1
- package/vault/vendor/roadmap/manifests.js +7 -0
- package/vault/vendor/vault/VERSION.txt +1 -1
- package/vault/vendor/vault/core/libVersion.js +1 -1
- package/vault/vendor/vault/core/subacta.js +3 -3
- package/vault/vendor/vault/core/vault.js +27 -27
- package/vault/vendor/vault/enroll.js +1 -1
- package/vault/vendor/vault/index.js +2 -2
- package/vault/vendor/vault/passwordLogins.js +1 -1
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Copia vendorizada de @dotrino/proxy-client@0.38.
|
|
1
|
+
Copia vendorizada de @dotrino/proxy-client@0.38.3 (dotrino-proxy-client/src/{binpack,canonical,client,encpub,errors,index,parts,sealing,signature,stats-log,stats,webrtc}.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
|
sealing.js resuelve @dotrino/identity/content de forma PEREZOSA (= ../../content.js
|
|
4
4
|
por el import map): solo se carga si de verdad se sella algo.
|
|
@@ -23,6 +23,8 @@
|
|
|
23
23
|
* El proxio lee la cabecera para enrutar y no mira el cuerpo, que va sellado.
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
|
+
import { errorWithCode } from './errors.js'
|
|
27
|
+
|
|
26
28
|
export const BIN_TAG = '__dotrino_bin'
|
|
27
29
|
const PACK_MAGIC = 0xB1
|
|
28
30
|
const FRAME_VERSION = 0x01
|
|
@@ -30,10 +32,6 @@ const FRAME_VERSION = 0x01
|
|
|
30
32
|
const enc = new TextEncoder()
|
|
31
33
|
const dec = new TextDecoder()
|
|
32
34
|
|
|
33
|
-
function withCode (message, code) {
|
|
34
|
-
return Object.assign(new Error(message), { code })
|
|
35
|
-
}
|
|
36
|
-
|
|
37
35
|
/** Bytes, sin importar de qué vista vengan (`Buffer`, `ArrayBuffer`, `Uint8Array`). */
|
|
38
36
|
export function asBytes (v) {
|
|
39
37
|
if (v instanceof Uint8Array) return v
|
|
@@ -84,12 +82,12 @@ export const isPacked = (b) => b instanceof Uint8Array && b.length >= 5 && b[0]
|
|
|
84
82
|
*/
|
|
85
83
|
export function unpack (bytes) {
|
|
86
84
|
const b = asBytes(bytes)
|
|
87
|
-
if (!isPacked(b)) throw
|
|
85
|
+
if (!isPacked(b)) throw errorWithCode('not a packed message', 'bad-pack')
|
|
88
86
|
const len = new DataView(b.buffer, b.byteOffset, b.byteLength).getUint32(1)
|
|
89
|
-
if (5 + len > b.length) throw
|
|
87
|
+
if (5 + len > b.length) throw errorWithCode('packed message is shorter than its header says', 'bad-pack')
|
|
90
88
|
const area = b.subarray(5 + len)
|
|
91
89
|
let obj
|
|
92
|
-
try { obj = JSON.parse(dec.decode(b.subarray(5, 5 + len))) } catch (_) { throw
|
|
90
|
+
try { obj = JSON.parse(dec.decode(b.subarray(5, 5 + len))) } catch (_) { throw errorWithCode('packed message header is not JSON', 'bad-pack') }
|
|
93
91
|
const revive = (v) => {
|
|
94
92
|
if (Array.isArray(v)) return v.map(revive)
|
|
95
93
|
if (!v || typeof v !== 'object') return v
|
|
@@ -97,7 +95,7 @@ export function unpack (bytes) {
|
|
|
97
95
|
if (ref !== undefined) {
|
|
98
96
|
if (!Array.isArray(ref) || ref.length !== 2 || !Number.isInteger(ref[0]) || !Number.isInteger(ref[1]) ||
|
|
99
97
|
ref[0] < 0 || ref[1] < 0 || ref[0] + ref[1] > area.length) {
|
|
100
|
-
throw
|
|
98
|
+
throw errorWithCode('packed message points outside itself', 'bad-pack')
|
|
101
99
|
}
|
|
102
100
|
return area.subarray(ref[0], ref[0] + ref[1])
|
|
103
101
|
}
|
|
@@ -130,11 +128,11 @@ export function encodeFrame (header, body) {
|
|
|
130
128
|
/** El inverso: `{ header, body }`. Lanza con `code: 'bad-frame'` si no es una trama válida. */
|
|
131
129
|
export function decodeFrame (data) {
|
|
132
130
|
const b = asBytes(data)
|
|
133
|
-
if (!b || b.length < 5 || b[0] !== FRAME_VERSION) throw
|
|
131
|
+
if (!b || b.length < 5 || b[0] !== FRAME_VERSION) throw errorWithCode('not a binary frame of a known version', 'bad-frame')
|
|
134
132
|
const len = new DataView(b.buffer, b.byteOffset, b.byteLength).getUint32(1)
|
|
135
|
-
if (5 + len > b.length) throw
|
|
133
|
+
if (5 + len > b.length) throw errorWithCode('binary frame is shorter than its header says', 'bad-frame')
|
|
136
134
|
let header
|
|
137
|
-
try { header = JSON.parse(dec.decode(b.subarray(5, 5 + len))) } catch (_) { throw
|
|
138
|
-
if (!header || typeof header !== 'object' || Array.isArray(header)) throw
|
|
135
|
+
try { header = JSON.parse(dec.decode(b.subarray(5, 5 + len))) } catch (_) { throw errorWithCode('binary frame header is not JSON', 'bad-frame') }
|
|
136
|
+
if (!header || typeof header !== 'object' || Array.isArray(header)) throw errorWithCode('binary frame header is not an object', 'bad-frame')
|
|
139
137
|
return { header, body: b.subarray(5 + len) }
|
|
140
138
|
}
|
|
@@ -50,7 +50,7 @@ const APP_RE = /^[a-z0-9][a-z0-9-]{0,31}$/
|
|
|
50
50
|
function checkApp (app) {
|
|
51
51
|
if (app == null) return null
|
|
52
52
|
if (typeof app !== 'string' || !APP_RE.test(app)) {
|
|
53
|
-
throw
|
|
53
|
+
throw errorWithCode(`app: "${app}" is not a valid app name (a-z, 0-9, -; up to 32)`, 'bad-app')
|
|
54
54
|
}
|
|
55
55
|
return app
|
|
56
56
|
}
|
|
@@ -309,7 +309,7 @@ export class WebSocketProxyClient {
|
|
|
309
309
|
if (options.app != null) {
|
|
310
310
|
const app = checkApp(options.app)
|
|
311
311
|
if (this.app && this.app !== app) {
|
|
312
|
-
throw
|
|
312
|
+
throw errorWithCode(`app: this client is already "${this.app}", not "${app}"`, 'app-conflict')
|
|
313
313
|
}
|
|
314
314
|
this.app = app
|
|
315
315
|
}
|
|
@@ -1155,7 +1155,7 @@ export class WebSocketProxyClient {
|
|
|
1155
1155
|
// `code`: la bóveda usa esto para saber si su llave de comunicación firma todavía, y
|
|
1156
1156
|
// tragarse un fallo de red como si fuera lo primero la mandaría al camino equivocado.
|
|
1157
1157
|
if (typeof signature !== 'string') {
|
|
1158
|
-
throw
|
|
1158
|
+
throw errorWithCode('identifyAs: sign() returned no signature', 'no-signature')
|
|
1159
1159
|
}
|
|
1160
1160
|
return this.identify({ data, signature, cert, acta, sign })
|
|
1161
1161
|
}
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
import { pack, unpack, concatBytes } from './binpack.js'
|
|
26
|
+
import { errorWithCode } from './errors.js'
|
|
26
27
|
|
|
27
28
|
export const PART_TAG = '__dotrino_part'
|
|
28
29
|
|
|
@@ -107,7 +108,7 @@ export class Reassembler {
|
|
|
107
108
|
if (!p || typeof p.id !== 'string' || p.id.length > 64 ||
|
|
108
109
|
!Number.isInteger(p.n) || !Number.isInteger(p.i) || p.n < 2 || p.n > MAX_PARTS ||
|
|
109
110
|
p.i < 0 || p.i >= p.n || (typeof d !== 'string' && !(d instanceof Uint8Array))) {
|
|
110
|
-
throw
|
|
111
|
+
throw errorWithCode('malformed message part', 'bad-part')
|
|
111
112
|
}
|
|
112
113
|
const key = `${sender}|${p.id}`
|
|
113
114
|
let a = this._open.get(key)
|
|
@@ -117,12 +118,12 @@ export class Reassembler {
|
|
|
117
118
|
}
|
|
118
119
|
if (a.n !== p.n || a.bin !== (d instanceof Uint8Array)) {
|
|
119
120
|
this._drop(key)
|
|
120
|
-
throw
|
|
121
|
+
throw errorWithCode('message parts disagree on their count or kind', 'bad-part')
|
|
121
122
|
}
|
|
122
123
|
if (a.got[p.i] === undefined) {
|
|
123
124
|
if (this._chars + d.length > RECV_MAX_CHARS) {
|
|
124
125
|
this._drop(key)
|
|
125
|
-
throw
|
|
126
|
+
throw errorWithCode('too much of a message in parts is pending', 'parts-too-big')
|
|
126
127
|
}
|
|
127
128
|
// Una copia: `d` es una vista sobre la trama entera, y guardarla retendría la trama.
|
|
128
129
|
a.got[p.i] = a.bin ? d.slice() : d
|
|
@@ -134,7 +135,7 @@ export class Reassembler {
|
|
|
134
135
|
if (a.count === a.n) {
|
|
135
136
|
this._drop(key)
|
|
136
137
|
try { return a.bin ? unpack(concatBytes(a.got)) : JSON.parse(a.got.join('')) }
|
|
137
|
-
catch (_) { throw
|
|
138
|
+
catch (_) { throw errorWithCode('a message in parts did not join into a message', 'bad-part') }
|
|
138
139
|
}
|
|
139
140
|
a.timer = setTimeout(() => {
|
|
140
141
|
const missing = a.n - a.count
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
Copia vendorizada de @dotrino/roadmap@0.4.
|
|
1
|
+
Copia vendorizada de @dotrino/roadmap@0.4.36 (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.
|
|
@@ -371,6 +371,13 @@ export const MANIFESTS = Object.freeze({
|
|
|
371
371
|
"remote-agent": ">=0.19.0",
|
|
372
372
|
"vault": ">=0.92.0"
|
|
373
373
|
}
|
|
374
|
+
},
|
|
375
|
+
"ai": {
|
|
376
|
+
"repo": "imdotrino/dotrino-ai",
|
|
377
|
+
"npm": "@dotrino/ai",
|
|
378
|
+
"current": "0.1.0",
|
|
379
|
+
"protocol": 1,
|
|
380
|
+
"requires": {}
|
|
374
381
|
}
|
|
375
382
|
},
|
|
376
383
|
"broken": [
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Copia vendorizada de @dotrino/vault@0.
|
|
1
|
+
Copia vendorizada de @dotrino/vault@0.93.0 (dotrino-vault/lib/src/{admin,b64,browser,core/approvals,core/backup,core/blocked,core/browserDisk,core/commKey,core/disk,core/libVersion,core/machines,core/notices,core/notifiable,core/passwords,core/sealKey,core/sealer,core/sealers,core/secretsStore,core/sha256,core/store,core/subacta,core/threadStore,core/transport,core/vault,enroll,index,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
|
|
@@ -75,12 +75,12 @@ export function openSubacta (disk) {
|
|
|
75
75
|
* aparatos se cuentan lo mismo.
|
|
76
76
|
*/
|
|
77
77
|
async add (e) {
|
|
78
|
-
if (!(await isAcceptable(e))) return { ok: false, reason: '
|
|
78
|
+
if (!(await isAcceptable(e))) return { ok: false, reason: 'not-acceptable' }
|
|
79
79
|
const id = idOf(e)
|
|
80
|
-
if (data.entries.some((x) => idOf(x) === id)) return { ok: false, reason: '
|
|
80
|
+
if (data.entries.some((x) => idOf(x) === id)) return { ok: false, reason: 'already-present' }
|
|
81
81
|
data.entries = [...data.entries, e]
|
|
82
82
|
guardar()
|
|
83
|
-
return { ok: true, reason: '
|
|
83
|
+
return { ok: true, reason: 'new' }
|
|
84
84
|
},
|
|
85
85
|
|
|
86
86
|
/**
|
|
@@ -872,13 +872,13 @@ export async function startVault ({ platform, proxyUrl, log = console.log, onEnr
|
|
|
872
872
|
// acta falta justo cuando algo se rompió (un archivo a medias, un `catch` que devolvió
|
|
873
873
|
// null), que es cuando menos hay que fiarse. Toda cuenta tiene acta desde hace versiones.
|
|
874
874
|
if (!record) {
|
|
875
|
-
audit('rejected', { what, reason: '
|
|
875
|
+
audit('rejected', { what, reason: 'no-record' })
|
|
876
876
|
reply(from, { type: MSG.ERROR, error: 'unauthorized: this vault has no record to decide with' })
|
|
877
877
|
return false
|
|
878
878
|
}
|
|
879
879
|
if (Acta.memberCanScope(record, chk.device, scope)) return true
|
|
880
|
-
audit('rejected', { what, reason: '
|
|
881
|
-
reply(from, { type: MSG.ERROR, error: 'unauthorized:
|
|
880
|
+
audit('rejected', { what, reason: 'record' })
|
|
881
|
+
reply(from, { type: MSG.ERROR, error: 'unauthorized: record — this member no longer has that permission' })
|
|
882
882
|
return false
|
|
883
883
|
}
|
|
884
884
|
|
|
@@ -976,14 +976,14 @@ export async function startVault ({ platform, proxyUrl, log = console.log, onEnr
|
|
|
976
976
|
const t = Date.now()
|
|
977
977
|
for (const [n, v] of aperturas) if (v.exp <= t) aperturas.delete(n)
|
|
978
978
|
const eph = await makeEphemeralKey()
|
|
979
|
-
aperturas.set('
|
|
979
|
+
aperturas.set('pending', { privateKey: eph.privateKey, exp: t + EPHEMERAL_TTL_MS })
|
|
980
980
|
audit('unlock.begin', { by })
|
|
981
981
|
return { ...params, ek: eph.ek }
|
|
982
982
|
},
|
|
983
983
|
|
|
984
984
|
async open ({ nonce, enc, by }) {
|
|
985
|
-
const guardada = aperturas.get('
|
|
986
|
-
aperturas.delete('
|
|
985
|
+
const guardada = aperturas.get('pending')
|
|
986
|
+
aperturas.delete('pending')
|
|
987
987
|
if (!guardada || guardada.exp <= Date.now()) {
|
|
988
988
|
return { ok: false, error: 'unlock: ask for a key first, and use it within a minute' }
|
|
989
989
|
}
|
|
@@ -992,7 +992,7 @@ export async function startVault ({ platform, proxyUrl, log = console.log, onEnr
|
|
|
992
992
|
// EL NONCE VA DENTRO DEL SOBRE. Si fuera solo por fuera, un sobre capturado se
|
|
993
993
|
// reenvía con un nonce nuevo y el candado del nonce no sirve de nada.
|
|
994
994
|
if (!payload || payload.nonce !== nonce || typeof payload.key !== 'string') {
|
|
995
|
-
audit('rejected', { what: 'unlock', by, reason: '
|
|
995
|
+
audit('rejected', { what: 'unlock', by, reason: 'envelope' })
|
|
996
996
|
return { ok: false, error: 'unlock: the envelope does not check out' }
|
|
997
997
|
}
|
|
998
998
|
const derivada = b64ToBytes(payload.key)
|
|
@@ -1314,10 +1314,10 @@ export async function startVault ({ platform, proxyUrl, log = console.log, onEnr
|
|
|
1314
1314
|
const { issued, revoked } = await identity.listDelegations()
|
|
1315
1315
|
if (!puedeVerTodo) {
|
|
1316
1316
|
if (!record) {
|
|
1317
|
-
audit('rejected', { what: 'devices', reason: '
|
|
1317
|
+
audit('rejected', { what: 'devices', reason: 'no-record' })
|
|
1318
1318
|
return reply(from, { type: MSG.ERROR, error: 'unauthorized: this vault has no record to decide with' })
|
|
1319
1319
|
}
|
|
1320
|
-
audit('devices', { device: await deviceIdOf(chk.device).catch(() => null),
|
|
1320
|
+
audit('devices', { device: await deviceIdOf(chk.device).catch(() => null), only: 'revocations' })
|
|
1321
1321
|
return reply(from, { type: MSG.DEVICES_RESULT, devices: [], revoked, blocked: blocked.pubs(), acta: record, sealerChain: await sealerChainOf() })
|
|
1322
1322
|
}
|
|
1323
1323
|
// El acta viaja con la lista: así cada dispositivo se entera de los cambios de
|
|
@@ -1401,7 +1401,7 @@ export async function startVault ({ platform, proxyUrl, log = console.log, onEnr
|
|
|
1401
1401
|
// Sin acta no se renueva: caer al scope del papel viejo es reconceder a ciegas lo que
|
|
1402
1402
|
// el acta ya no dice. Un repliegue así no protege de nada, tapa.
|
|
1403
1403
|
if (!record) {
|
|
1404
|
-
audit('rejected', { what: 'renew', device: await deviceIdOf(p.cert.sub), reason: '
|
|
1404
|
+
audit('rejected', { what: 'renew', device: await deviceIdOf(p.cert.sub), reason: 'no-record' })
|
|
1405
1405
|
return reply(from, { type: MSG.ERROR, error: 'unauthorized: this vault has no record to decide with' })
|
|
1406
1406
|
}
|
|
1407
1407
|
const scope = Acta.memberScopes(record, p.cert.sub)
|
|
@@ -1460,7 +1460,7 @@ export async function startVault ({ platform, proxyUrl, log = console.log, onEnr
|
|
|
1460
1460
|
// que se cerró en `handleSign`, en otro mostrador.
|
|
1461
1461
|
const record = (await identity.profileActa?.().catch(() => null))?.acta
|
|
1462
1462
|
if (!record || !Acta.memberCanReadSecrets(record, chk.device, ns)) {
|
|
1463
|
-
audit('rejected', { what: 'enckey', ns, reason: record ? 'cn' : '
|
|
1463
|
+
audit('rejected', { what: 'enckey', ns, reason: record ? 'cn' : 'no-record' })
|
|
1464
1464
|
return reply(from, { type: MSG.ERROR, error: `unauthorized: cn — the record does not recognise this member as the "${ns}" service` })
|
|
1465
1465
|
}
|
|
1466
1466
|
try {
|
|
@@ -1545,7 +1545,7 @@ export async function startVault ({ platform, proxyUrl, log = console.log, onEnr
|
|
|
1545
1545
|
if (!chk.ok) return denyChain(from, chk, p, 'digest')
|
|
1546
1546
|
const record = (await identity.profileActa?.().catch(() => null))?.acta
|
|
1547
1547
|
if (!record || !Acta.memberCanReadSecrets(record, chk.device, ns)) {
|
|
1548
|
-
audit('rejected', { what: 'digest', ns, reason: record ? 'cn' : '
|
|
1548
|
+
audit('rejected', { what: 'digest', ns, reason: record ? 'cn' : 'no-record' })
|
|
1549
1549
|
return reply(from, { type: MSG.ERROR, error: `unauthorized: cn — the record does not recognise this member as the "${ns}" service` })
|
|
1550
1550
|
}
|
|
1551
1551
|
const body = { op: 'secrets.digest', ns, digest: drawerDigest(ns, chk.device), ts: Date.now() }
|
|
@@ -1578,8 +1578,8 @@ export async function startVault ({ platform, proxyUrl, log = console.log, onEnr
|
|
|
1578
1578
|
if (!chk.ok) return denyChain(from, chk, p, 'update-ask')
|
|
1579
1579
|
const record = (await identity.profileActa?.().catch(() => null))?.acta
|
|
1580
1580
|
if (!record || !(record.members || []).some((m) => m.pub === chk.device)) {
|
|
1581
|
-
audit('rejected', { what: 'update-ask', reason: record ? '
|
|
1582
|
-
return reply(from, { type: MSG.ERROR, error: 'unauthorized:
|
|
1581
|
+
audit('rejected', { what: 'update-ask', reason: record ? 'record' : 'no-record' })
|
|
1582
|
+
return reply(from, { type: MSG.ERROR, error: 'unauthorized: record — this device is not in the record' })
|
|
1583
1583
|
}
|
|
1584
1584
|
const product = cut(p.data?.product, 128)
|
|
1585
1585
|
const version = cut(p.data?.version, 64)
|
|
@@ -1656,8 +1656,8 @@ export async function startVault ({ platform, proxyUrl, log = console.log, onEnr
|
|
|
1656
1656
|
const record = (await identity.profileActa?.().catch(() => null))?.acta
|
|
1657
1657
|
const member = (record?.members || []).find((m) => m.pub === chk.device)
|
|
1658
1658
|
if (!member) {
|
|
1659
|
-
audit('rejected', { what: op, reason: record ? '
|
|
1660
|
-
return reply(from, { type: MSG.ERROR, error: 'unauthorized:
|
|
1659
|
+
audit('rejected', { what: op, reason: record ? 'record' : 'no-record' })
|
|
1660
|
+
return reply(from, { type: MSG.ERROR, error: 'unauthorized: record — this device is not in the record' })
|
|
1661
1661
|
}
|
|
1662
1662
|
const product = cut(p.data?.product, 128)
|
|
1663
1663
|
const version = cut(p.data?.version, 64)
|
|
@@ -1685,7 +1685,7 @@ export async function startVault ({ platform, proxyUrl, log = console.log, onEnr
|
|
|
1685
1685
|
if (!chk.ok) return denyChain(from, chk, p, op)
|
|
1686
1686
|
const record = (await identity.profileActa?.().catch(() => null))?.acta
|
|
1687
1687
|
if (!record || !Acta.memberCanReadSecrets(record, chk.device, ns)) {
|
|
1688
|
-
audit('rejected', { what: op, ns, reason: record ? 'cn' : '
|
|
1688
|
+
audit('rejected', { what: op, ns, reason: record ? 'cn' : 'no-record' })
|
|
1689
1689
|
return reply(from, { type: MSG.ERROR, error: `unauthorized: cn — the record does not recognise this member as the "${ns}" service` })
|
|
1690
1690
|
}
|
|
1691
1691
|
const deviceId = await deviceIdOf(chk.device).catch(() => null)
|
|
@@ -1756,7 +1756,7 @@ export async function startVault ({ platform, proxyUrl, log = console.log, onEnr
|
|
|
1756
1756
|
// llave del proxy no ve nada que no sea del proxy, y está escrito donde se puede comprobar.
|
|
1757
1757
|
const record = (await identity.profileActa?.().catch(() => null))?.acta
|
|
1758
1758
|
if (!record || !Acta.memberCanReadSecrets(record, chk.device, ns)) {
|
|
1759
|
-
audit('rejected', { what: 'secrets', ns, reason: record ? 'cn' : '
|
|
1759
|
+
audit('rejected', { what: 'secrets', ns, reason: record ? 'cn' : 'no-record' })
|
|
1760
1760
|
return reply(from, { type: MSG.ERROR, error: `unauthorized: cn — the record does not recognise this member as the "${ns}" service` })
|
|
1761
1761
|
}
|
|
1762
1762
|
// APROBACIÓN: si este APARATO está marcado (`dotrino-vault approval <ID> on`), liberarle
|
|
@@ -1908,8 +1908,8 @@ export async function startVault ({ platform, proxyUrl, log = console.log, onEnr
|
|
|
1908
1908
|
if (!chk.ok) return denyChain(from, chk, p, 'approval')
|
|
1909
1909
|
const record = (await identity.profileActa?.().catch(() => null))?.acta
|
|
1910
1910
|
if (!record || !Acta.memberCan(record, chk.device, 'approve')) {
|
|
1911
|
-
audit('rejected', { what: 'approval', reason: record ? '
|
|
1912
|
-
return reply(from, { type: MSG.ERROR, error: 'unauthorized:
|
|
1911
|
+
audit('rejected', { what: 'approval', reason: record ? 'record' : 'no-record' })
|
|
1912
|
+
return reply(from, { type: MSG.ERROR, error: 'unauthorized: record — this member does not approve' })
|
|
1913
1913
|
}
|
|
1914
1914
|
const by = await deviceIdOf(chk.device).catch(() => null)
|
|
1915
1915
|
const answer = async (body) => {
|
|
@@ -2157,8 +2157,8 @@ export async function startVault ({ platform, proxyUrl, log = console.log, onEnr
|
|
|
2157
2157
|
if (!chk.ok) return denyChain(from, chk, p, 'incident')
|
|
2158
2158
|
const record = await refreshActa()
|
|
2159
2159
|
if (!record || !Acta.memberCan(record, chk.device, 'sign')) {
|
|
2160
|
-
audit('rejected', { what: 'incident', reason: record ? '
|
|
2161
|
-
return reply(from, { type: MSG.ERROR, error: 'unauthorized:
|
|
2160
|
+
audit('rejected', { what: 'incident', reason: record ? 'record' : 'no-record' })
|
|
2161
|
+
return reply(from, { type: MSG.ERROR, error: 'unauthorized: record — this member cannot report incidents' })
|
|
2162
2162
|
}
|
|
2163
2163
|
const d = p.data || {}
|
|
2164
2164
|
const kind = typeof d.kind === 'string' ? d.kind.slice(0, 32) : ''
|
|
@@ -2913,7 +2913,7 @@ export async function startVault ({ platform, proxyUrl, log = console.log, onEnr
|
|
|
2913
2913
|
return chk
|
|
2914
2914
|
}
|
|
2915
2915
|
const record = (await identity.profileActa?.().catch(() => null))?.acta
|
|
2916
|
-
if (!record || !Acta.memberCan(record, chk.device, 'admin')) return { ok: false, reason: record ? '
|
|
2916
|
+
if (!record || !Acta.memberCan(record, chk.device, 'admin')) return { ok: false, reason: record ? 'record' : 'no-record' }
|
|
2917
2917
|
return chk
|
|
2918
2918
|
}
|
|
2919
2919
|
})
|
|
@@ -2949,12 +2949,12 @@ export async function startVault ({ platform, proxyUrl, log = console.log, onEnr
|
|
|
2949
2949
|
// la fecha de la última renuncia por miembro y rechace las que no sean posteriores.
|
|
2950
2950
|
const actual = (await identity.profileActa?.().catch(() => null))?.acta || null
|
|
2951
2951
|
if (!actual) {
|
|
2952
|
-
audit('rejected', { what: 'renounce', reason: '
|
|
2952
|
+
audit('rejected', { what: 'renounce', reason: 'no-record' })
|
|
2953
2953
|
return reply(from, { type: MSG.ERROR, error: 'renounce: this vault has no record to apply it to' })
|
|
2954
2954
|
}
|
|
2955
2955
|
const tiene = new Set(Acta.effectiveCaps(actual, record.member) || [])
|
|
2956
2956
|
if (!(record.caps || []).some((c) => tiene.has(c))) {
|
|
2957
|
-
audit('rejected', { what: 'renounce', reason: '
|
|
2957
|
+
audit('rejected', { what: 'renounce', reason: 'nothing-to-remove' })
|
|
2958
2958
|
return reply(from, { type: MSG.ERROR, error: 'renounce: that member no longer holds any of those capabilities' })
|
|
2959
2959
|
}
|
|
2960
2960
|
try {
|
|
@@ -2963,8 +2963,8 @@ export async function startVault ({ platform, proxyUrl, log = console.log, onEnr
|
|
|
2963
2963
|
// de la maestra, y con el perfil cerrado la renuncia se perdía con un error — en el
|
|
2964
2964
|
// único momento en que de verdad hace falta.
|
|
2965
2965
|
const guardada = await subacta.add(record)
|
|
2966
|
-
if (!guardada.ok && guardada.reason === '
|
|
2967
|
-
audit('rejected', { what: 'renounce', reason: '
|
|
2966
|
+
if (!guardada.ok && guardada.reason === 'not-acceptable') {
|
|
2967
|
+
audit('rejected', { what: 'renounce', reason: 'not-acceptable' })
|
|
2968
2968
|
return reply(from, { type: MSG.ERROR, error: 'renounce: the entry is not one this vault accepts' })
|
|
2969
2969
|
}
|
|
2970
2970
|
const device = await deviceIdOf(record.member).catch(() => null)
|
|
@@ -272,7 +272,7 @@ export function createEnrollDesk ({
|
|
|
272
272
|
return { ignored: true }
|
|
273
273
|
}
|
|
274
274
|
if (!pend || Date.now() > pend.exp) {
|
|
275
|
-
audit('rejected', { what: 'hello', reason: '
|
|
275
|
+
audit('rejected', { what: 'hello', reason: 'no-session' })
|
|
276
276
|
return fail(from, 'no pairing session open for that code', String(p?.sn || ''))
|
|
277
277
|
}
|
|
278
278
|
// La respuesta va FIRMADA por la maestra y el `sn` va dentro de lo firmado. Eso ata
|
|
@@ -261,7 +261,7 @@ export async function startDeviceVault (identity, { proxyUrl, client: injectedCl
|
|
|
261
261
|
if (expectedScope) {
|
|
262
262
|
const record = (await identity.profileActa?.().catch(() => null))?.acta || null
|
|
263
263
|
if (record && !memberCanScope(record, chk.device, expectedScope)) {
|
|
264
|
-
send(from, { type: MSG.ERROR, error: 'unauthorized:
|
|
264
|
+
send(from, { type: MSG.ERROR, error: 'unauthorized: record — this member no longer has that permission' })
|
|
265
265
|
return null
|
|
266
266
|
}
|
|
267
267
|
}
|
|
@@ -356,7 +356,7 @@ export async function startDeviceVault (identity, { proxyUrl, client: injectedCl
|
|
|
356
356
|
if (p.type === MSG.HELLO) handle('hello', desk.handleHello(_from, p), _from)
|
|
357
357
|
else if (p.type === MSG.ENROLL) handle('enroll', desk.handleEnroll(_from, p), _from)
|
|
358
358
|
// Camino A: el aparato devuelve su acta sellada admitiendo a esta bóveda.
|
|
359
|
-
else if (p.type === MSG.ACTA_SEALED) handle('
|
|
359
|
+
else if (p.type === MSG.ACTA_SEALED) handle('record-sealed', desk.handleActaSealed(_from, p), _from)
|
|
360
360
|
else if (p.type === MSG.RENEW) handle('renew', handleRenew(_from, p), _from)
|
|
361
361
|
else if (p.type === MSG.DEVICES) handle('devices', handleDevices(_from, p), _from)
|
|
362
362
|
// Lo que faltaba para que un aparato enrolado aquí pueda hacer lo mismo que contra
|
|
@@ -67,7 +67,7 @@ export const loginAddress = (user, fingerprint) => `${user}@${accountCode(finger
|
|
|
67
67
|
*/
|
|
68
68
|
export async function accountFingerprint (identity) {
|
|
69
69
|
const pid = (await identity?.profileActa?.().catch(() => null))?.acta?.profileId
|
|
70
|
-
if (!pid) throw err('no-
|
|
70
|
+
if (!pid) throw err('no-record', 'this vault has no account record yet: there is no address to build')
|
|
71
71
|
return (await pubkeyId(pid)).slice(0, 16)
|
|
72
72
|
}
|
|
73
73
|
|