magic-wormhole-0.3.2: 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) 
Instances
Eq PakeError Source # 
Instance details

Defined in MagicWormhole.Internal.Pake

Methods

(==) :: PakeError -> PakeError -> Bool

(/=) :: PakeError -> PakeError -> Bool

Show PakeError Source # 
Instance details

Defined in MagicWormhole.Internal.Pake

Methods

showsPrec :: Int -> PakeError -> ShowS

show :: PakeError -> String

showList :: [PakeError] -> ShowS

Exception PakeError Source # 
Instance details

Defined in MagicWormhole.Internal.Pake

Methods

toException :: PakeError -> SomeException

fromException :: SomeException -> Maybe PakeError

displayException :: PakeError -> String

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.