This class implements an encrypted connection.

The key negotiation is done by derived classes, because depending on the side of the conversation (client: initiator of the connection / server: acceptor of the connection) the key exchange procedure changes.

Hierarchy (view full)

Constructors

  • Creates an encryption layer above the passed websocket.

    Instantiating this class is not enough. The shared key pairs have to be set up by a derived class through some kind of key negotiation procedure before the encryption actually works.

    Parameters

    • sharedKey: Uint8Array

      the key used for encryption

    • evenLocalNonceCounter: boolean

      If true the local instance uses even nonces, otherwise odd.

    Returns default

Properties

name: string

Methods

  • Converts the nonce counter from number to Uint8Array.

    The highest supported nonce counter value is Number.MAX_SAFE_INTEGER - 2

    Public for tests.

    Parameters

    • nonceNumber: number

    Returns Uint8Array