mirror of
https://github.com/fluencelabs/js-libp2p-noise
synced 2025-04-25 14:32:18 +00:00
Fix fetching ephemeral keys from IK
This commit is contained in:
parent
ceb31929a2
commit
36e3462a82
@ -101,7 +101,7 @@ export class IKHandshake implements IHandshake {
|
|||||||
return this.ik.encryptWithAd(cs, Buffer.alloc(0), plaintext);
|
return this.ik.encryptWithAd(cs, Buffer.alloc(0), plaintext);
|
||||||
}
|
}
|
||||||
|
|
||||||
public getRemoteEphemeralKeys(): KeyPair {
|
public getLocalEphemeralKeys(): KeyPair {
|
||||||
if (!this.session.hs.e) {
|
if (!this.session.hs.e) {
|
||||||
throw new Error("Ephemeral keys do not exist.");
|
throw new Error("Ephemeral keys do not exist.");
|
||||||
}
|
}
|
||||||
|
@ -136,8 +136,8 @@ export class Noise implements INoiseConnection {
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
// IK failed, go to XX fallback
|
// IK failed, go to XX fallback
|
||||||
let ephemeralKeys;
|
let ephemeralKeys;
|
||||||
if (!params.isInitiator) {
|
if (params.isInitiator) {
|
||||||
ephemeralKeys = ikHandshake.getRemoteEphemeralKeys();
|
ephemeralKeys = ikHandshake.getLocalEphemeralKeys();
|
||||||
}
|
}
|
||||||
return await this.performXXFallbackHandshake(params, payload, e.initialMsg, ephemeralKeys);
|
return await this.performXXFallbackHandshake(params, payload, e.initialMsg, ephemeralKeys);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user