Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Framer

Wire protocol msg framer

Hierarchy

  • Framer

Index

Constructors

constructor

Properties

Private network

network: Network

Static ENCRYPTED_MSG_HEADER_LENGTH

ENCRYPTED_MSG_HEADER_LENGTH: 4 = 4

Static ENCRYPTED_MSG_PAYLOAD_HEADER_LENGTH

ENCRYPTED_MSG_PAYLOAD_HEADER_LENGTH: 8 = 8

Static ENCRYPTION_IV_LENGTH

ENCRYPTION_IV_LENGTH: 16 = 16

Static ENCRYPTION_KEY_LENGTH

ENCRYPTION_KEY_LENGTH: 32 = 32

Static MSG_HEADER_LENGTH

MSG_HEADER_LENGTH: 16 = 16

Methods

decrypt

  • decrypt(ciphertext: Buffer, key: Buffer): Buffer
  • Parameters

    • ciphertext: Buffer
    • key: Buffer

    Returns Buffer

encrypt

  • encrypt(plaintext: Buffer, key: Buffer): Promise<Buffer>
  • Parameters

    • plaintext: Buffer
    • key: Buffer

    Returns Promise<Buffer>

frame

  • frame(packet: Packet, encryptionKey?: Buffer): Promise<Buffer>
  • Frame a packet with a header to be used as a wire msg

    Parameters

    • packet: Packet
    • Optional encryptionKey: Buffer

    Returns Promise<Buffer>

parseHeader

  • Parse the header of a wire msg or an encrypted wire msg payload

    Parameters

    • msg: Buffer
    • encrypted: boolean

    Returns WireMsgHeader

parseLength

  • parseLength(data: Buffer, encrypted: boolean): number
  • Parse the length of a wire msg or an encrypted wire msg

    Parameters

    • data: Buffer
    • encrypted: boolean

    Returns number

unframe

  • unframe(msg: Buffer, encryptionKey?: Buffer): WireMsg
  • Unframe a wire msg or an encrypted wire msg

    Parameters

    • msg: Buffer
    • Optional encryptionKey: Buffer

    Returns WireMsg

Generated using TypeDoc