hwormhole-0.2.0.1: magic-wormhole client

Safe HaskellNone
LanguageHaskell2010

Transit.Internal.App

Description

 
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

Instances
MonadReader Env App Source # 
Instance details

Defined in Transit.Internal.App

Methods

ask :: App Env

local :: (Env -> Env) -> App a -> App a

reader :: (Env -> a) -> App a

newtype App a Source #

App Monad Transformer that reads the configuration from Env, runs a computation over the IO Monad and returns either the value a or Error

Constructors

App 

Fields

Instances
Monad App Source # 
Instance details

Defined in Transit.Internal.App

Methods

(>>=) :: App a -> (a -> App b) -> App b

(>>) :: App a -> App b -> App b

return :: a -> App a

fail :: String -> App a

Functor App Source # 
Instance details

Defined in Transit.Internal.App

Methods

fmap :: (a -> b) -> App a -> App b

(<$) :: a -> App b -> App a

Applicative App Source # 
Instance details

Defined in Transit.Internal.App

Methods

pure :: a -> App a

(<*>) :: App (a -> b) -> App a -> App b

liftA2 :: (a -> b -> c) -> App a -> App b -> App c

(*>) :: App a -> App b -> App b

(<*) :: App a -> App b -> App a

MonadIO App Source # 
Instance details

Defined in Transit.Internal.App

Methods

liftIO :: IO a -> App a

MonadError Error App Source # 
Instance details

Defined in Transit.Internal.App

Methods

throwError :: Error -> App a

catchError :: App a -> (Error -> App a) -> App a

MonadReader Env App Source # 
Instance details

Defined in Transit.Internal.App

Methods

ask :: App Env

local :: (Env -> Env) -> App a -> App a

reader :: (Env -> a) -> App a

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

Create an Env, given the AppID 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

send :: Session -> Text -> MessageType -> App () Source #

Given the magic-wormhole session, appid, pass code, a function to print a helpful message on the command the receiver needs to type (simplest would be just a putStrLn) and the path on the disk of the sender of the file that needs to be sent, sendFile sends it via the wormhole securely. The receiver, on successfully receiving the file, would compute a sha256 sum of the encrypted file and sends it across to the sender, along with an acknowledgement, which the sender can verify.

receive :: Session -> Text -> App () Source #

receive a text message or file from the wormhole peer.