@dotrino/identity 0.45.0 → 0.46.0
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/remote.js +9 -2
package/package.json
CHANGED
package/vault/remote.js
CHANGED
|
@@ -45,10 +45,17 @@ export { MSG as VAULT_MSG }
|
|
|
45
45
|
* un `vault.error` con la palabra «revocado» no borra nada (cierra el wipe-DoS, ver
|
|
46
46
|
* `dotrino-vault/docs/pairing-protocol.md §2.3`).
|
|
47
47
|
*/
|
|
48
|
-
export async function isAuthenticRevoke ({ body, signature, master, devicePubkey }) {
|
|
48
|
+
export async function isAuthenticRevoke ({ body, signature, master, devicePubkey, currentNonce = null }) {
|
|
49
49
|
if (!body || body.op !== 'revoke' || typeof signature !== 'string') return false
|
|
50
50
|
if (body.sub !== devicePubkey) return false
|
|
51
51
|
if (typeof body.exp === 'number' && Date.now() > body.exp) return false
|
|
52
|
+
// Y tiene que hablar del certificado que este aparato usa AHORA. Un certificado se
|
|
53
|
+
// retira también cuando NO pasa nada malo: renovar retira el anterior, y cambiar
|
|
54
|
+
// permisos obliga a renovar. Sin esta comprobación, el aviso de «tu papel viejo ya no
|
|
55
|
+
// vale» borraba el enlace con la bóveda entero: dabas «administra» a un aparato y el
|
|
56
|
+
// aparato desaparecía solo, como si lo hubieran echado. El proxy encola 24 h, así que
|
|
57
|
+
// el aviso puede llegar mucho después de haber renovado.
|
|
58
|
+
if (currentNonce && typeof body.nonce === 'string' && body.nonce !== currentNonce) return false
|
|
52
59
|
return verifyDeviceSig({ publickey: master, data: body, signature })
|
|
53
60
|
}
|
|
54
61
|
|
|
@@ -236,7 +243,7 @@ async function vaultRpc ({ master, proxy, device, cert, acta = null, sendType, o
|
|
|
236
243
|
const off = client.on('message', (_f, p) => {
|
|
237
244
|
if (!p || typeof p !== 'object') return
|
|
238
245
|
if (p.type === MSG.REVOKED) {
|
|
239
|
-
isAuthenticRevoke({ body: p.body, signature: p.signature, master, devicePubkey: device.publickey })
|
|
246
|
+
isAuthenticRevoke({ body: p.body, signature: p.signature, master, devicePubkey: device.publickey, currentNonce: cert?.nonce || null })
|
|
240
247
|
.then((ok) => { if (ok) { try { onRevoked?.() } catch (_) {} } })
|
|
241
248
|
.catch(() => {})
|
|
242
249
|
return
|