mirror of
https://github.com/fluencelabs/js-libp2p-noise
synced 2025-04-25 14:12:30 +00:00
Fix linting errors
This commit is contained in:
parent
c48ca75b26
commit
99d3c769c9
@ -106,7 +106,7 @@ export abstract class AbstractHandshake {
|
|||||||
|
|
||||||
protected dh(privateKey: bytes32, publicKey: bytes32): bytes32 {
|
protected dh(privateKey: bytes32, publicKey: bytes32): bytes32 {
|
||||||
try {
|
try {
|
||||||
return Buffer.from(box.before(publicKey, privateKey))
|
return Buffer.from(box.before(publicKey, privateKey));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger(e.message);
|
logger(e.message);
|
||||||
return Buffer.alloc(32);
|
return Buffer.alloc(32);
|
||||||
@ -120,7 +120,7 @@ export abstract class AbstractHandshake {
|
|||||||
protected getHash(a: bytes, b: bytes): bytes32 {
|
protected getHash(a: bytes, b: bytes): bytes32 {
|
||||||
return Buffer.from(
|
return Buffer.from(
|
||||||
hash.sha256().update(Buffer.from([...a, ...b])).digest('hex')
|
hash.sha256().update(Buffer.from([...a, ...b])).digest('hex')
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected mixKey(ss: SymmetricState, ikm: bytes32): void {
|
protected mixKey(ss: SymmetricState, ikm: bytes32): void {
|
||||||
|
@ -11,9 +11,9 @@ import {pb} from "./proto/payload";
|
|||||||
const NoiseHandshakePayloadProto = pb.NoiseHandshakePayload;
|
const NoiseHandshakePayloadProto = pb.NoiseHandshakePayload;
|
||||||
|
|
||||||
export function generateKeypair(): KeyPair {
|
export function generateKeypair(): KeyPair {
|
||||||
const keyPair = box.keyPair()
|
const keyPair = box.keyPair();
|
||||||
const publicKey = Buffer.from(keyPair['publicKey'])
|
const publicKey = Buffer.from(keyPair['publicKey']);
|
||||||
const privateKey = Buffer.from(keyPair['secretKey'])
|
const privateKey = Buffer.from(keyPair['secretKey']);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
publicKey,
|
publicKey,
|
||||||
@ -101,7 +101,7 @@ export async function verifySignedPayload(
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function getHkdf(ck: bytes32, ikm: bytes): Hkdf {
|
export function getHkdf(ck: bytes32, ikm: bytes): Hkdf {
|
||||||
const okm = hkdf(ikm, 96, {salt: ck, hash: 'SHA-256'})
|
const okm = hkdf(ikm, 96, {salt: ck, hash: 'SHA-256'});
|
||||||
|
|
||||||
const k1 = okm.slice(0, 32);
|
const k1 = okm.slice(0, 32);
|
||||||
const k2 = okm.slice(32, 64);
|
const k2 = okm.slice(32, 64);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user