pamoja for TypeScript - v0.1.17
    Preparing search index...

    A confidential, tamper-evident, replay-protected channel with one peer.

    Index
    • Establishes a session with a peer.

      Parameters

      • local: session.AgreementKey

        This device's key-agreement secret.

      • peerPublicKey: Buffer

        The peer's 32-byte public key, already authenticated by pinning or by a signature.

      • salt: Buffer

        A fresh per-session salt both sides share, exchanged in the clear. Reusing one with the same pair of keys reuses the session key, so it must change each session.

      • role: Role

        Whether this device opens the session or answers.

      Returns session.Session

    • Opens a message from the peer.

      Parameters

      • sealed: session.SealedMessage

        The ciphertext with the counter and tag that arrived with it.

      • Optionalaad: Buffer<ArrayBufferLike>

        The same associated data the sender authenticated.

      Returns Buffer

      The plaintext.

      When the counter repeats or is older than the replay window still tracks, and when the tag does not authenticate. Nothing readable is ever returned from a message that failed either check.

    • Seals a message for the peer.

      Parameters

      • plaintext: Buffer

        The message to protect.

      • Optionalaad: Buffer<ArrayBufferLike>

        Data authenticated but not encrypted, so it stays readable on the wire yet cannot be altered: a device identifier or a routing header belongs here.

      Returns session.SealedMessage

      The ciphertext, with the counter and tag to send beside it.