-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Lars Kuhtz
committed
May 15, 2014
0 parents
commit 8d4d4e0
Showing
18 changed files
with
2,548 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
syntax: glob | ||
.*.swp | ||
dist/ | ||
*.jsmod | ||
tmp/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
Copyright (c) 2014 AlephCloud Systems, Inc. | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining | ||
a copy of this software and associated documentation files (the | ||
"Software"), to deal in the Software without restriction, including | ||
without limitation the rights to use, copy, modify, merge, publish, | ||
distribute, sublicense, and/or sell copies of the Software, and to | ||
permit persons to whom the Software is furnished to do so, subject to | ||
the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be | ||
included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<style type="text/css"> | ||
body { font-family:verdana; font-size: 10pt} | ||
</style> | ||
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script> | ||
<script type="text/javascript" src="./src/Client.js"></script> | ||
<script type="text/javascript"> | ||
$(document).ready(function() { | ||
var logg = function(str) { console.log(str); return; } | ||
var api = new API(); | ||
var isEncrypted = false; | ||
$("#cryptBut").click(function(e) { | ||
var but = this; | ||
if (! isEncrypted) { | ||
var pwd = $("#password").val(); | ||
var msg = $("#mailbody").val(); | ||
api.encrypt_with_password({ "password" : btoa(pwd), "plain_text" : btoa(msg)}, logg, logg, function (r) { | ||
$("#mailbody").val(r.cipher_text); | ||
isEncrypted = true; | ||
$("#mailbody").prop("disabled", true); | ||
$(but).text("Decrypt"); | ||
}); | ||
} else { | ||
var pwd = $("#password").val(); | ||
var msg = $("#mailbody").val(); | ||
api.decrypt_with_password({"password" : btoa(pwd), "cipher_text" : msg}, logg, logg, function (r) { | ||
$("#mailbody").val(atob(r.plain_text)); | ||
isEncrypted = false; | ||
$("#mailbody").prop("disabled",false); | ||
$(but).text("Encrypt"); | ||
}); | ||
} | ||
}); | ||
|
||
$("#sendBut").click(function(e){ | ||
var but = this; | ||
var email = $("#mailaddress").val(); | ||
var subject = $("#subject").val(); | ||
var msg = $("#mailbody").val(); | ||
window.open('mailto:' + email + '?subject=' + subject + '&body=' + msg); | ||
}); | ||
}); | ||
</script> | ||
</head> | ||
<body> | ||
<h1>CryptMail</h1> | ||
<div> | ||
<div>Address:</div> | ||
<textarea id="mailaddress" rows="1" cols="100" required placeholder="address" autocomplete="on" spellcheck="false"></textarea> | ||
<div>Subject:</div> | ||
<textarea id="subject" rows="1" cols="100" required placeholder="subject" autocomplete="on" spellcheck="true"></textarea> | ||
<div>Message:</div> | ||
<textarea id="mailbody" rows="5" cols="100" placeholder="message" spellcheck="true"></textarea> | ||
<div>Password:</div> | ||
<textarea id="password" rows="1" cols="50" placeholder="encryption password" spellcheck="false"></textarea> | ||
<div> | ||
<button id="cryptBut">Encrypt</button> | ||
<button id="sendBut">send</button> | ||
</div> | ||
</div> | ||
</body> | ||
</html> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
-- ------------------------------------------------------ -- | ||
-- Copyright © 2014 AlephCloud Systems, Inc. | ||
-- ------------------------------------------------------ -- | ||
|
||
Name: bayhac2014-cryptmail | ||
Version: 0.0.1 | ||
Description: | ||
An application for sending encrypted email from a browser. | ||
This is an example application for a talk at BayHac 2014 | ||
on web frontend development with Haste. | ||
|
||
Homepage: http://github.com/alephcloud/bayhac2014-cryptmail | ||
License: MIT | ||
License-file: LICENSE | ||
Author: Lars Kuhtz <lars@alephcloud.com> | ||
Maintainer: Lars Kuhtz <lars@alephcloud.com> | ||
Copyright: Copyright (c) 2014 AlephCloud Systems, Inc. | ||
Category: Haste, Cryptography, Web | ||
Build-type: Simple | ||
Cabal-version: >= 1.18 | ||
|
||
source-repository head | ||
type: git | ||
location: http://github.com/alephcloud/bayhac2014-cryptmail | ||
|
||
Flag haste | ||
description: build with haste-compiler | ||
default: False | ||
|
||
Library | ||
default-language: Haskell2010 | ||
hs-source-dirs: src | ||
|
||
other-modules: | ||
BayHac2014.Cryptmail.Json.Encode | ||
BayHac2014.Cryptmail.Json.Decode | ||
BayHac2014.Cryptmail.Json.Instances | ||
|
||
exposed-modules: | ||
-- BayHac2014.Cryptmail.Utils | ||
BayHac2014.Cryptmail.Text | ||
BayHac2014.Cryptmail.ByteString | ||
BayHac2014.Cryptmail.PasswordEncryption | ||
BayHac2014.Cryptmail.ServiceApi | ||
BayHac2014.Cryptmail.Json | ||
|
||
build-depends: | ||
base == 4.*, | ||
base-unicode-symbols >= 0.2.2.4, | ||
transformers >= 0.3.0.0, | ||
unordered-containers >= 0.2.3.3, | ||
errors >= 1.4.6, | ||
containers >= 0.5.0.0 | ||
|
||
if flag(haste) | ||
build-depends: | ||
haste-lib >= 0.1 | ||
else | ||
build-depends: | ||
QuickCheck >= 2.7.3, | ||
base64-bytestring >= 1.0.0.1, | ||
bytestring >= 0.10.4.0, | ||
cipher-aes >= 0.2.7, | ||
crypto-random >= 0.0.7, | ||
cryptohash >= 0.11.4, | ||
text >= 1.1.0.1, | ||
quickcheck-instances >= 0.3.8, | ||
pbkdf >= 1.1.1.1, | ||
scotty >= 0.7.2, | ||
cabal-test-quickcheck >= 0.1.1, | ||
attoparsec >= 0.10.4.0, | ||
aeson >= 0.7.0.3, | ||
vector >= 0.10.9.1 | ||
|
||
ghc-options: -Wall | ||
|
||
Executable cryptmail-client | ||
default-language: Haskell2010 | ||
Main-Is: src/Client.hs | ||
hs-source-dirs: . | ||
|
||
if !flag(haste) | ||
buildable: False | ||
|
||
if flag(haste) | ||
build-depends: | ||
base == 4.*, | ||
bayhac2014-cryptmail, | ||
base-unicode-symbols >= 0.2.2.4, | ||
haste-lib >= 0.1, | ||
transformers >= 0.3.0.0, | ||
errors >= 1.4.6 | ||
|
||
ghc-options: -Wall --start=asap --with-js=lib/sjcl.js,lib/bayhac2014-cryptmail.js | ||
|
||
Executable cryptmail-server | ||
default-language: Haskell2010 | ||
Main-Is: src/Server.hs | ||
hs-source-dirs: . | ||
|
||
if flag(haste) | ||
buildable: False | ||
|
||
if ! flag(haste) | ||
build-depends: | ||
base == 4.*, | ||
scotty >= 0.7.2, | ||
bayhac2014-cryptmail, | ||
base-unicode-symbols >= 0.2.2.4, | ||
transformers >= 0.3.0.0, | ||
text >= 1.1.0.1 | ||
|
||
ghc-options: -Wall | ||
|
||
Test-Suite cryptmail-tests | ||
default-language: Haskell2010 | ||
type: detailed-0.9 | ||
test-module: Test | ||
hs-source-dirs: test | ||
|
||
if flag(haste) | ||
buildable: False | ||
|
||
build-depends: | ||
base == 4.*, | ||
bayhac2014-cryptmail, | ||
cabal-test-quickcheck >= 0.1.1, | ||
Cabal >= 1.20.0.0 | ||
|
Oops, something went wrong.