forked from RNCryptor/rncryptor-hs
-
Notifications
You must be signed in to change notification settings - Fork 0
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
0 parents
commit ef97392
Showing
10 changed files
with
232 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,4 @@ | ||
dist | ||
.cabal-sandbox | ||
cabal.sandbox.config | ||
shell.nix |
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 @@ | ||
rncryptor |
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,49 @@ | ||
# See https://github.com/hvr/multi-ghc-travis | ||
# The following enables several GHC versions to be tested; often it's enough to test only against the last release in a major GHC version. Feel free to omit lines listings versions you don't need/want testing for. | ||
|
||
notifications: | ||
email: false | ||
|
||
env: | ||
- GHCVER=7.6.2 CABALVER=1.16 | ||
- GHCVER=7.6.3 CABALVER=1.16 | ||
- GHCVER=7.8.2 CABALVER=1.18 | ||
- GHCVER=7.8.3 CABALVER=1.18 | ||
- GHCVER=head CABALVER=1.20 | ||
|
||
matrix: | ||
allow_failures: | ||
- env: GHCVER=head CABALVER=1.20 | ||
|
||
before_install: | ||
- travis_retry sudo add-apt-repository -y ppa:hvr/ghc | ||
- travis_retry sudo apt-get update | ||
- travis_retry sudo apt-get install cabal-install-$CABALVER ghc-$GHCVER | ||
- export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$PATH | ||
- cabal --version | ||
|
||
install: | ||
- cabal update | ||
- cabal install --only-dependencies --enable-tests | ||
|
||
script: | ||
- cabal configure --enable-tests -v2 --enable-library-coverage | ||
- cabal build | ||
- cabal test --show-details=always | ||
- cabal check | ||
- cabal sdist | ||
|
||
# The following scriptlet checks that the resulting source distribution can be built & installed | ||
- export SRC_TGZ=$(cabal-$CABALVER info . | awk '{print $2 ".tar.gz";exit}') ; | ||
cd dist/; | ||
if [ -f "$SRC_TGZ" ]; then | ||
cabal install "$SRC_TGZ"; | ||
else | ||
echo "expected '$SRC_TGZ' not found"; | ||
exit 1; | ||
fi | ||
|
||
after_script: | ||
- cabal install hpc-coveralls | ||
- export PATH=/opt/ghc/$GHCVER/bin:$HOME/.cabal/bin:$PATH | ||
- hpc-coveralls --coverage-mode=StrictlyFullLines mandrill-tests |
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 Alfredo Di Napoli | ||
|
||
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,67 @@ | ||
[](https://travis-ci.org/adinapoli/mandrill) | ||
[](https://coveralls.io/r/adinapoli/mandrill) | ||
|
||
# Haskell Client for the Mandrill JSON API | ||
|
||
This module implement a low-level, 1:1 mapping API to | ||
the [Mandrill](http://mandrillapp.com) transactional email service. | ||
|
||
# Example | ||
|
||
This package was built with pragmatism and reuse in mind. This means | ||
this API comes in two flavours: an IO-based and an handy monad transformer | ||
which can be plugged in your stack of choice. | ||
Example: | ||
|
||
``` haskell | ||
{-# LANGUAGE OverloadedStrings #-} | ||
import Text.Email.Validate | ||
import Network.API.Mandrill | ||
|
||
main :: IO () | ||
main = do | ||
case validate "[email protected]" of | ||
Left err -> print $ "Invalid email!" ++ show err | ||
Right addr -> runMandrill "MYTOKENHERE" $ do | ||
let msg = "<p>My Html</p>" | ||
res <- sendEmail (newTextMessage addr [addr] "Hello" msg) | ||
case res of | ||
MandrillSuccess k -> liftIO (print k) | ||
MandrillFailure f -> liftIO (print f) | ||
``` | ||
|
||
# Supported API versions | ||
|
||
* 1.0 (partially) | ||
- [Users call](https://mandrillapp.com/api/docs/users.JSON.html) - 100% | ||
+ info.json | ||
+ ~~ping.json~~ (as **doesn't return valid json!**) | ||
+ ping2.json | ||
+ senders.json | ||
- [Messages call](https://mandrillapp.com/api/docs/messages.JSON.html) | ||
+ send.json | ||
|
||
# Testing online API | ||
|
||
To test the online API, first build the package with tests enabled: | ||
|
||
``` | ||
cabal install --enable-tests | ||
``` | ||
|
||
Then export an environment variable with your Mandrill **Test** token: | ||
|
||
``` | ||
export MANDRILL_API_KEY="YOURKEYGOESHERE" | ||
``` | ||
|
||
And finally execute the testsuite: | ||
|
||
``` | ||
cabal test | ||
``` | ||
|
||
# Contributions | ||
This library scratches my own itches, but please fork away! | ||
Pull requests are encouraged to implement the part of the API | ||
you need. |
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,2 @@ | ||
import Distribution.Simple | ||
main = defaultMain |
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,53 @@ | ||
name: rncryptor | ||
version: 0.0.1.0 | ||
synopsis: Haskell implementation of the RNCryptor file format | ||
description: Pure Haskell implementation of the RNCrytor spec. | ||
license: MIT | ||
license-file: LICENSE | ||
author: Alfredo Di Napoli | ||
maintainer: [email protected] | ||
category: Network | ||
build-type: Simple | ||
tested-with: GHC == 7.6, GHC == 7.8 | ||
cabal-version: >=1.10 | ||
|
||
source-repository head | ||
type: git | ||
location: https://github.com/adinapoli/rncryptor-hs | ||
|
||
library | ||
exposed-modules: | ||
Crypto.RNCryptor.V3 | ||
other-modules: | ||
build-depends: | ||
base >=4.6 && < 5 | ||
, bytestring >= 0.9.0 | ||
, base64-bytestring >= 1.0.0.1 | ||
, QuickCheck >= 2.6 && < 2.8 | ||
, io-streams >= 1.2.0.0 | ||
hs-source-dirs: | ||
src | ||
default-language: | ||
Haskell2010 | ||
ghc-options: | ||
-funbox-strict-fields | ||
|
||
test-suite rncryptor-tests | ||
type: | ||
exitcode-stdio-1.0 | ||
main-is: | ||
Main.hs | ||
other-modules: | ||
Tests | ||
hs-source-dirs: | ||
test | ||
default-language: | ||
Haskell2010 | ||
build-depends: | ||
rncryptor -any | ||
, base | ||
, bytestring | ||
, QuickCheck | ||
, tasty >= 0.9.0.1 | ||
, tasty-quickcheck | ||
, tasty-hunit |
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,11 @@ | ||
|
||
|
||
module Crypto.RNCryptor.V3 where | ||
|
||
import Data.ByteString (ByteString) | ||
import qualified Data.ByteString as B | ||
|
||
|
||
|
||
decrypt :: ByteString -> ByteString -> ByteString | ||
decrypt _ _ = B.empty |
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,22 @@ | ||
{-# LANGUAGE OverloadedStrings #-} | ||
module Main where | ||
|
||
import System.Environment | ||
import Data.Monoid | ||
import Tests | ||
import Test.Tasty | ||
import Test.Tasty.HUnit | ||
import Test.Tasty.QuickCheck | ||
|
||
---------------------------------------------------------------------- | ||
withQuickCheckDepth :: TestName -> Int -> [TestTree] -> TestTree | ||
withQuickCheckDepth tn depth tests = | ||
localOption (QuickCheckTests depth) (testGroup tn tests) | ||
|
||
---------------------------------------------------------------------- | ||
main :: IO () | ||
main = do | ||
defaultMainWithIngredients defaultIngredients $ | ||
testGroup "RNCryptor tests" $ [ | ||
testGroup "RNCryptor properties" [] | ||
] |
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,3 @@ | ||
module Tests where | ||
|
||
import Test.Tasty.HUnit |