libp2p-hs-0.1.0.0: Haskell implementation of the libp2p networking stack
Safe HaskellNone
LanguageGHC2021

Network.LibP2P.Security.Noise.Session

Description

Post-handshake Noise transport session.

After the XX handshake completes, cacophony's NoiseState transitions to transport mode with two CipherStates (one for each direction). This module wraps that state for encrypted message exchange.

Synopsis

Documentation

data NoiseSession Source #

A post-handshake transport session for encrypted communication.

mkNoiseSession :: CacophonyState -> NoiseSession Source #

Create a NoiseSession from a completed handshake state.

encryptMessage :: NoiseSession -> ByteString -> Either String (ByteString, NoiseSession) Source #

Encrypt a plaintext message for sending. Returns (ciphertext, updatedSession).

decryptMessage :: NoiseSession -> ByteString -> Either String (ByteString, NoiseSession) Source #

Decrypt a received ciphertext message. Returns (plaintext, updatedSession).