This package contains code for an example Web application for a class at BayHac2014. The application allows to create encrypted emails from within a browser.
This is not production level code.
The package includes a library component that can be compiled with native GHC as well as with the Haste compiler. The library exposes two interfaces:
- a Haskell API for encryption and decryption with a password and
- a JSON service API that wraps the Haskell API in JSON data types.
The package further contains an application that serves the JSON API over HTTP using scotty.
Finally, there is a cabal test suite for unit testing the library with a native compilation.
Setup of Haste with a Sandbox
The following instructions installs the haste-compiler in a cabal sandbox. Note, however, that the resulting haste-compiler itself is not using a sandbox for compilations.
cabal sandbox init echo 'constraints: scientific<0.3' >> cabal.config cabal install haste-compiler -j export PATH=./.cabal-sandbox/bin:$PATH
echo 'solver: topdown' >> ~/.cabal/config haste-boot sed -i '/solver: topdown/d' ~/.cabal/config
haste-boot failes with an error message that inlcude the text
installed instances can be used you may try to temporarily add the
following to your
~/.cabal/config while running
The native version of the library and the server application can be installed via
The test suite can be run via
cabal configure --enable-tests cabal build cabal test
mv cabal.sandbox.config cabal.sandbox.config.disabled haste-inst install -fhaste haste-inst configure -fhaste haste-inst build
src/Client.js. It can be tested
by opening the file
Main.html in a browser from the root directory of the
This package includes a copy of a version of SJCL
in the file
./lib/sjcl.js. SJCL is hosted at https://github.com/bitwiseshiftleft/sjcl and
distributed under a BSD license as described at http://bitwiseshiftleft.github.io/sjcl.
./src/BayHac2014/Cryptmail/Json.hs and the files in the directory
./src/BayHac2014/Cryptmail/Json of this package in part contain code that was
copied, derived, or inspired by the Aeson
package. The Aeson package is
distributed under a BSD3 License and copyright of (c) 2011-2014 Bryan
O'Sullivan (c) 2011 MailRank, Inc.. A copy of the LICENSE of the Aeson package
can be found