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