| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
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
- data NoiseSession
- mkNoiseSession :: CacophonyState -> NoiseSession
- encryptMessage :: NoiseSession -> ByteString -> Either String (ByteString, NoiseSession)
- decryptMessage :: NoiseSession -> ByteString -> Either String (ByteString, NoiseSession)
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).