*Change logic to abort if the signature fails
This commit is contained in:
parent
d65d33aa18
commit
58252606a6
|
@ -319,10 +319,12 @@ export default class DHTCache extends EventEmitter {
|
||||||
|
|
||||||
let bufId = b4a.from(toId as Uint8Array) as Buffer;
|
let bufId = b4a.from(toId as Uint8Array) as Buffer;
|
||||||
|
|
||||||
if (signature && crypto.verify(bufData, signature, id)) {
|
if (!(signature && crypto.verify(bufData, signature, id))) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this._addEntityConnection(id, bufId as Buffer);
|
this._addEntityConnection(id, bufId as Buffer);
|
||||||
this._setEntity(bufId as Buffer, { heartbeat: Date.now() });
|
this._setEntity(bufId as Buffer, { heartbeat: Date.now() });
|
||||||
}
|
|
||||||
|
|
||||||
this.log.debug(
|
this.log.debug(
|
||||||
`Bootstrap response received from ${bufId.toString("hex")}`
|
`Bootstrap response received from ${bufId.toString("hex")}`
|
||||||
|
|
Loading…
Reference in New Issue