mirror of
https://github.com/logos-messaging/js-noise.git
synced 2026-01-07 16:13:08 +00:00
fix linting
This commit is contained in:
parent
05f2b86e15
commit
09df64ccc4
20
src/codec.ts
20
src/codec.ts
@ -1,13 +1,7 @@
|
|||||||
import debug from "debug";
|
|
||||||
import { DecodedMessage } from "@waku/core";
|
import { DecodedMessage } from "@waku/core";
|
||||||
import {
|
import { IEncoder, IDecoder, IDecodedMessage, IProtoMessage, IMessage } from "@waku/interfaces";
|
||||||
IEncoder,
|
|
||||||
IDecoder,
|
|
||||||
IDecodedMessage,
|
|
||||||
IProtoMessage,
|
|
||||||
IMessage,
|
|
||||||
} from "@waku/interfaces";
|
|
||||||
import { WakuMessage } from "@waku/proto";
|
import { WakuMessage } from "@waku/proto";
|
||||||
|
import debug from "debug";
|
||||||
|
|
||||||
import { HandshakeResult, HandshakeStepResult } from "./handshake.js";
|
import { HandshakeResult, HandshakeStepResult } from "./handshake.js";
|
||||||
import { PayloadV2 } from "./payload.js";
|
import { PayloadV2 } from "./payload.js";
|
||||||
@ -22,7 +16,7 @@ const version = 2;
|
|||||||
/**
|
/**
|
||||||
* Used internally in the pairing object to represent a handshake message
|
* Used internally in the pairing object to represent a handshake message
|
||||||
*/
|
*/
|
||||||
export class NoiseHandshakeMessage extends DecodedMessage implements IDecodedMessage {
|
export class NoiseHandshakeMessage extends DecodedMessage implements IDecodedMessage {
|
||||||
get payloadV2(): PayloadV2 {
|
get payloadV2(): PayloadV2 {
|
||||||
if (!this.payload) throw new Error("no payload available");
|
if (!this.payload) throw new Error("no payload available");
|
||||||
return PayloadV2.deserialize(this.payload);
|
return PayloadV2.deserialize(this.payload);
|
||||||
@ -39,7 +33,11 @@ export class NoiseHandshakeEncoder implements IEncoder {
|
|||||||
* @param hsStepResult the result of a step executed while performing the handshake process
|
* @param hsStepResult the result of a step executed while performing the handshake process
|
||||||
* @param ephemeral makes messages ephemeral in the Waku network
|
* @param ephemeral makes messages ephemeral in the Waku network
|
||||||
*/
|
*/
|
||||||
constructor(public contentTopic: string, private hsStepResult: HandshakeStepResult, public ephemeral: boolean = true) {}
|
constructor(
|
||||||
|
public contentTopic: string,
|
||||||
|
private hsStepResult: HandshakeStepResult,
|
||||||
|
public ephemeral: boolean = true
|
||||||
|
) {}
|
||||||
|
|
||||||
async toWire(message: IMessage): Promise<Uint8Array | undefined> {
|
async toWire(message: IMessage): Promise<Uint8Array | undefined> {
|
||||||
return this.encode(message);
|
return this.encode(message);
|
||||||
@ -81,7 +79,7 @@ export class NoiseHandshakeDecoder implements IDecoder<NoiseHandshakeMessage> {
|
|||||||
fromProtoObj(proto: IProtoMessage): Promise<NoiseHandshakeMessage | undefined> {
|
fromProtoObj(proto: IProtoMessage): Promise<NoiseHandshakeMessage | undefined> {
|
||||||
return this.decode(proto);
|
return this.decode(proto);
|
||||||
}
|
}
|
||||||
|
|
||||||
fromWireToProtoObj(bytes: Uint8Array): Promise<IProtoMessage | undefined> {
|
fromWireToProtoObj(bytes: Uint8Array): Promise<IProtoMessage | undefined> {
|
||||||
return this.decodeProto(bytes);
|
return this.decodeProto(bytes);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user