mirror of
https://github.com/fluencelabs/js-libp2p-noise
synced 2025-04-25 08:22:35 +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);
|
||||
}
|
||||
|
||||
public getRemoteEphemeralKeys(): KeyPair {
|
||||
public getLocalEphemeralKeys(): KeyPair {
|
||||
if (!this.session.hs.e) {
|
||||
throw new Error("Ephemeral keys do not exist.");
|
||||
}
|
||||
|
@ -136,8 +136,8 @@ export class Noise implements INoiseConnection {
|
||||
} catch (e) {
|
||||
// IK failed, go to XX fallback
|
||||
let ephemeralKeys;
|
||||
if (!params.isInitiator) {
|
||||
ephemeralKeys = ikHandshake.getRemoteEphemeralKeys();
|
||||
if (params.isInitiator) {
|
||||
ephemeralKeys = ikHandshake.getLocalEphemeralKeys();
|
||||
}
|
||||
return await this.performXXFallbackHandshake(params, payload, e.initialMsg, ephemeralKeys);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user