mirror of
https://github.com/fluencelabs/js-libp2p-noise
synced 2025-06-17 16:01:23 +00:00
Fix eslint
This commit is contained in:
10
src/utils.ts
10
src/utils.ts
@ -14,7 +14,7 @@ export async function loadPayloadProto () {
|
||||
return payloadProtoBuf.lookupType("pb.NoiseHandshakePayload");
|
||||
}
|
||||
|
||||
export function generateKeypair() : KeyPair {
|
||||
export function generateKeypair(): KeyPair {
|
||||
const privateKey = x25519.privateKeyGenerate();
|
||||
const publicKey = x25519.publicKeyCreate(privateKey);
|
||||
|
||||
@ -29,7 +29,7 @@ export async function createHandshakePayload(
|
||||
libp2pPrivateKey: bytes,
|
||||
signedPayload: bytes,
|
||||
signedEarlyData?: EarlyDataPayload,
|
||||
) : Promise<bytes> {
|
||||
): Promise<bytes> {
|
||||
const NoiseHandshakePayload = await loadPayloadProto();
|
||||
const earlyDataPayload = signedEarlyData ?
|
||||
{
|
||||
@ -56,7 +56,7 @@ type EarlyDataPayload = {
|
||||
libp2pDataSignature: bytes;
|
||||
}
|
||||
|
||||
export function signEarlyDataPayload(libp2pPrivateKey: bytes, earlyData: bytes) : EarlyDataPayload {
|
||||
export function signEarlyDataPayload(libp2pPrivateKey: bytes, earlyData: bytes): EarlyDataPayload {
|
||||
const payload = getEarlyDataPayload(earlyData);
|
||||
const signedPayload = signPayload(libp2pPrivateKey, payload);
|
||||
|
||||
@ -70,11 +70,11 @@ export const getHandshakePayload = (publicKey: bytes ) => Buffer.concat([Buffer.
|
||||
|
||||
export const getEarlyDataPayload = (earlyData: bytes) => Buffer.concat([Buffer.from("noise-libp2p-early-data:"), earlyData]);
|
||||
|
||||
export function encodeMessageBuffer(message: MessageBuffer) : bytes {
|
||||
export function encodeMessageBuffer(message: MessageBuffer): bytes {
|
||||
return Buffer.concat([message.ne, message.ns, message.ciphertext]);
|
||||
}
|
||||
|
||||
export function decodeMessageBuffer(message: bytes) : MessageBuffer {
|
||||
export function decodeMessageBuffer(message: bytes): MessageBuffer {
|
||||
return {
|
||||
ne: message.slice(0, 32),
|
||||
ns: message.slice(32, 64),
|
||||
|
Reference in New Issue
Block a user