Std.Crypto.Noise
Std.Crypto.Noise — the Noise_IK_25519_ChaChaPoly_SHA256 and
Types
type Handshake
type Transport
type Suite = Sha256 | Blake2s
Values
decrypt : String -> Transport -> Result Error ( Transport, String )
`decrypt ciphertext transport` — the plaintext, and the next state.
encrypt : String -> Transport -> Result Error ( Transport, String )
`encrypt plaintext transport` — the ciphertext to send, and the next
handshakeHash : Transport -> String
The 32-byte handshake hash — the same on both sides, and unique to the
initiator : Kx.SecretKey -> Kx.PublicKey -> String -> Task Error Handshake
`initiator myStaticKey responderPublicKey prologue` — start a handshake
initiatorWith : Suite -> Kx.SecretKey -> Kx.PublicKey -> String -> Task Error Handshake
`initiatorWith suite myStaticKey responderPublicKey prologue` —
isComplete : Handshake -> Bool
Have both handshake messages been processed?
peer : Handshake -> Maybe Kx.PublicKey
The peer's static public key, once known: from the start for the
protocolName : Suite -> String
The Noise protocol name of a suite, for logs and for checking a peer's
readMessage : String -> Handshake -> Result Error ( Handshake, String )
`readMessage message handshake` — process the peer's handshake message:
rekeyReceive : Transport -> Result Error Transport
Replace the receiving key; pairs with the peer's `rekeySend`.
rekeySend : Transport -> Result Error Transport
Replace the sending key with a new one derived from it (Noise §11.3).
responder : Kx.SecretKey -> String -> Task Error Handshake
`responder myStaticKey prologue` — start a handshake as the side that
responderWith : Suite -> Kx.SecretKey -> String -> Task Error Handshake
`responderWith suite myStaticKey prologue` — [`responder`] with a chosen
transport : Handshake -> Result Error Transport
Turn a complete handshake into a `Transport`. `Err` before both messages
transportPeer : Transport -> Kx.PublicKey
The peer's static public key on an established session.
writeMessage : String -> Handshake -> Result Error ( Handshake, String )
`writeMessage payload handshake` — the next handshake message to send