hwormhole-0.1.0.0: magic-wormhole client

Safe HaskellNone
LanguageHaskell2010

Transit

Description

Magic Wormhole is a technology for getting things from one computer to another, safely.

To use it, you must use the MagicWormhole library to first establish an encrypted connection:

  1. Start a Session with the Rendezvous server, to allow peers to find each other (runClient)
  2. Negotiate a shared Nameplate so peers can find each other on the server (allocate, list)
  3. Use the shared Nameplate to open a shared Mailbox
  4. Use a secret password shared between peers to establish an encrypted connection (withEncryptedConnection)

Once you've done this, you can communicate with your peer via send and receive. Once can send and receive either Text messages or Files.

The password is never sent over the wire. Rather, it is used to negotiate a session key using SPAKE2, and that key itself is used to derive many per-message keys, so that each message is encrypted using NaCl SecretBox.

Synopsis

Documentation

data Env Source #

Magic Wormhole transit app environment

Constructors

Env 

Fields

  • appID :: AppID

    Application specific ID

  • side :: Side

    random 5-byte bytestring

  • config :: Options

    configuration like relay and transit url

  • wordList :: [(Text, Text)]

    pass code word list (list of pair of words)

prepareAppEnv :: Text -> FilePath -> Options -> IO Env Source #

Create an Env, given the AppID, wordlist file and Options

app :: App () Source #

A file transfer application that takes an Env and depending on the config options, either sends or receives a file, directory or a text message from the peer.

runApp :: App a -> Env -> IO (Either Error a) Source #

run the App Monad Transformer

data Options Source #

Application Configuration options

Constructors

Options 

Fields

Instances
Eq Options Source # 
Instance details

Defined in Transit.Internal.Conf

Methods

(==) :: Options -> Options -> Bool

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

Show Options Source # 
Instance details

Defined in Transit.Internal.Conf

Methods

showsPrec :: Int -> Options -> ShowS

show :: Options -> String

showList :: [Options] -> ShowS

data Command Source #

Commands

Constructors

Send MessageType

Send a file, directory or a text message

Receive (Maybe Text)

Receive a file, directory or a text message

Instances
Eq Command Source # 
Instance details

Defined in Transit.Internal.Conf

Methods

(==) :: Command -> Command -> Bool

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

Show Command Source # 
Instance details

Defined in Transit.Internal.Conf

Methods

showsPrec :: Int -> Command -> ShowS

show :: Command -> String

showList :: [Command] -> ShowS

data Error Source #

An Error type for the Magic Wormhole Transit Module

Instances
Show Error Source # 
Instance details

Defined in Transit.Internal.Errors

Methods

showsPrec :: Int -> Error -> ShowS

show :: Error -> String

showList :: [Error] -> ShowS

Exception Error Source # 
Instance details

Defined in Transit.Internal.Errors

Methods

toException :: Error -> SomeException

fromException :: SomeException -> Maybe Error

displayException :: Error -> String

data MessageType Source #

Transfer type

Constructors

TMsg Text

Text message transfer

TFile FilePath

File or Directory transfer

Instances
Eq MessageType Source # 
Instance details

Defined in Transit.Internal.FileTransfer

Methods

(==) :: MessageType -> MessageType -> Bool

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

Show MessageType Source # 
Instance details

Defined in Transit.Internal.FileTransfer

Methods

showsPrec :: Int -> MessageType -> ShowS

show :: MessageType -> String

showList :: [MessageType] -> ShowS

parseWebSocketEndpoint :: String -> Maybe WebSocketEndpoint #

parseTransitRelayUri :: String -> Maybe RelayEndpoint Source #

Parse transit url of the form tcp:hostname:port