magic-wormhole-0.3.4: Interact with Magic Wormhole

Safe HaskellNone
LanguageHaskell2010

MagicWormhole.Internal.Pake

Contents

Description

Once a peer is found, and both sides have mailboxes open, the peers need to generate a shared SessionKey based on their shared password.

pakeExchange has the logic for doing this.

Synopsis

Documentation

pakeExchange Source #

Arguments

:: Connection

A connection to a peer

-> Password

The shared password. Construct with makePassword.

-> IO SessionKey

A key that can be used for the remainder of the session

Exchange SPAKE2 keys with a Magic Wormhole peer.

Throws an Error if we cannot parse the incoming message.

newtype PakeError Source #

An error that occured during pakeExchange.

Constructors

Error (MessageError Text) 

Exported for testing

spakeBytesToMessageBody :: ByteString -> Body Source #

Encode the bytes generated by the SPAKE2 algorithm into a Magic Wormhole message body.

messageBodyToSpakeBytes :: Body -> Either Text ByteString Source #

Decode a Magic Wormhole message body into bytes that can be used as input into the SPAKE2 algorithm.