This commit is contained in:
morrigan 2020-02-08 11:20:19 +01:00
parent 082b0c560a
commit ceb31929a2
2 changed files with 2 additions and 3 deletions

View File

@ -7,8 +7,7 @@ import PeerId from "peer-id";
class Keycache { class Keycache {
private storage = new Map<bytes, bytes32>(); private storage = new Map<bytes, bytes32>();
public store(peerId?: PeerId, key: bytes32): void { public store(peerId: PeerId, key: bytes32): void {
if(!peerId) return;
this.storage.set(peerId.id, key); this.storage.set(peerId.id, key);
} }

View File

@ -181,7 +181,7 @@ export class Noise implements INoiseConnection {
await handshake.exchange(); await handshake.exchange();
await handshake.finish(); await handshake.finish();
if (this.useNoisePipes) { if (this.useNoisePipes && remotePeer) {
KeyCache.store(remotePeer, handshake.getRemoteStaticKey()); KeyCache.store(remotePeer, handshake.getRemoteStaticKey());
} }
} catch (e) { } catch (e) {