Safe Haskell | None |
---|---|
Language | Haskell2010 |
Magic Wormhole is a technology for getting things from one computer to another, safely.
In order to use the library in an application, you need to create an "application ID"
which is a unique application specific ascii string, a random 5-byte bytestring called
"side" and a few application configuration options defined in Options
type in the
Conf
module which sets up the transit server url, relay server url and the mode (send
or receive).
Once the environment and the configurations are set, the app
can be run via runApp
.
Synopsis
- data Env = Env {}
- prepareAppEnv :: Text -> Options -> IO Env
- app :: App ()
- runApp :: App a -> Env -> IO (Either Error a)
- send :: Session -> Text -> MessageType -> App ()
- receive :: Session -> Text -> App ()
- data Options = Options {
- cmd :: Command
- relayEndpoint :: WebSocketEndpoint
- transitUrl :: RelayEndpoint
- data Command
- = Send MessageType
- | Receive (Maybe Text)
- data Error
- data MessageType
- parseWebSocketEndpoint :: String -> Maybe WebSocketEndpoint
- parseTransitRelayUri :: String -> Maybe RelayEndpoint
Documentation
Magic Wormhole transit app environment
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.
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.
Application Configuration options
Options | |
|
Commands
Send MessageType | Send a file, directory or a text message |
Receive (Maybe Text) | Receive a file, directory or a text message |
An Error type for the Magic Wormhole Transit Module
Instances
Show Error Source # | |
Exception Error Source # | |
Defined in Transit.Internal.Errors toException :: Error -> SomeException fromException :: SomeException -> Maybe Error displayException :: Error -> String | |
MonadError Error App | |
Defined in Transit.Internal.App throwError :: Error -> App a catchError :: App a -> (Error -> App a) -> App a |
data MessageType Source #
Transfer type
Instances
Eq MessageType Source # | |
Defined in Transit.Internal.FileTransfer (==) :: MessageType -> MessageType -> Bool (/=) :: MessageType -> MessageType -> Bool | |
Show MessageType Source # | |
Defined in Transit.Internal.FileTransfer 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