diff options
-rw-r--r-- | HTTP.hs | 11 | ||||
-rw-r--r-- | HTTP/Client.hs | 1 | ||||
-rw-r--r-- | HTTP/ProofOfWork.hs | 22 | ||||
-rw-r--r-- | HTTP/Server.hs | 1 | ||||
-rw-r--r-- | Storage/Network.hs | 2 | ||||
-rw-r--r-- | keysafe.cabal | 1 |
6 files changed, 27 insertions, 11 deletions
@@ -14,6 +14,7 @@ module HTTP where import Types import Types.Storage +import HTTP.ProofOfWork import Serialization () import Servant.API import Data.Text @@ -40,16 +41,6 @@ type V1 = "v1" newtype Motd = Motd Text deriving (Generic) -data ProofOfWorkRequirement t - = Result t - | ProofOfWorkRequirement - { leadingZeros :: Int - , argon2Iterations :: Int - } - deriving (Generic) - -newtype ProofOfWork = ProofOfWork Text - type POWParam = QueryParam "proofofwork" ProofOfWork type ObjectIdent = Capture "ident" StorableObjectIdent diff --git a/HTTP/Client.hs b/HTTP/Client.hs index 0a79ba0..0c28005 100644 --- a/HTTP/Client.hs +++ b/HTTP/Client.hs @@ -6,6 +6,7 @@ module HTTP.Client where import HTTP +import HTTP.ProofOfWork import Types import Types.Storage import Servant.API diff --git a/HTTP/ProofOfWork.hs b/HTTP/ProofOfWork.hs new file mode 100644 index 0000000..45cc96d --- /dev/null +++ b/HTTP/ProofOfWork.hs @@ -0,0 +1,22 @@ +{- Copyright 2016 Joey Hess <id@joeyh.name> + - + - Licensed under the GNU AGPL version 3 or higher. + -} + +{-# LANGUAGE DeriveGeneric #-} + +module HTTP.ProofOfWork where + +import Types +import qualified Data.Text as T +import GHC.Generics + +data ProofOfWorkRequirement t + = Result t + | ProofOfWorkRequirement + { leadingZeros :: Int + , argon2Iterations :: Int + } + deriving (Generic) + +newtype ProofOfWork = ProofOfWork T.Text diff --git a/HTTP/Server.hs b/HTTP/Server.hs index 5d5c87f..ab27aaa 100644 --- a/HTTP/Server.hs +++ b/HTTP/Server.hs @@ -8,6 +8,7 @@ module HTTP.Server (runServer) where import HTTP +import HTTP.ProofOfWork import Types import Types.Storage import Tunables diff --git a/Storage/Network.hs b/Storage/Network.hs index ef6d86e..24f1c7d 100644 --- a/Storage/Network.hs +++ b/Storage/Network.hs @@ -16,8 +16,8 @@ import Types import Types.Storage import Data.List import Data.Char -import HTTP import HTTP.Client +import HTTP.ProofOfWork import Servant.Client import Network.Wai.Handler.Warp (Port) import Network.HTTP.Client hiding (port, host) diff --git a/keysafe.cabal b/keysafe.cabal index 9c0b1a6..9b75141 100644 --- a/keysafe.cabal +++ b/keysafe.cabal @@ -74,6 +74,7 @@ Executable keysafe Gpg HTTP HTTP.Client + HTTP.ProofOfWork HTTP.Server SecretKey Serialization |