summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Cady <d@jerkface.net>2016-01-20 19:43:11 -0500
committerAndrew Cady <d@jerkface.net>2016-01-20 19:43:11 -0500
commit7fe2488ce345f261c2d99746788e4037069fe9bb (patch)
tree46283ee64777a9e18b3c407e16437b2767247d2e
parent439edb4f1d86df776844495a552fd8656bc4b2f9 (diff)
minor fix: type sig unifies two functions
-rw-r--r--acme.hs8
1 files changed, 5 insertions, 3 deletions
diff --git a/acme.hs b/acme.hs
index e2bfd30..693671b 100644
--- a/acme.hs
+++ b/acme.hs
@@ -11,7 +11,7 @@ module Main where
11import Control.Lens hiding ((.=)) 11import Control.Lens hiding ((.=))
12import Control.Monad 12import Control.Monad
13import Crypto.Number.Serialize (i2osp) 13import Crypto.Number.Serialize (i2osp)
14import Data.Aeson (ToJSON (..), encode, object, (.=)) 14import Data.Aeson (ToJSON (..), encode, object, (.=), Value)
15import Data.Aeson.Lens hiding (key) 15import Data.Aeson.Lens hiding (key)
16import qualified Data.Aeson.Lens as JSON 16import qualified Data.Aeson.Lens as JSON
17import Data.ByteString (ByteString) 17import Data.ByteString (ByteString)
@@ -107,10 +107,12 @@ go (CmdOpts privKeyFile domain challengeDir email termOverride) = do
107 107
108 r <- challengeRequest domain >>= statusReport 108 r <- challengeRequest domain >>= statusReport
109 let 109 let
110
111 httpChallenge :: (Value -> Const (Endo s) Value) -> Response LC.ByteString -> Const (Endo s) (Response LC.ByteString)
110 httpChallenge = responseBody . JSON.key "challenges" . to universe . traverse . (filtered . has $ ix "type" . only "http-01") 112 httpChallenge = responseBody . JSON.key "challenges" . to universe . traverse . (filtered . has $ ix "type" . only "http-01")
111 httpChallenge' = responseBody . JSON.key "challenges" . to universe . traverse . (filtered . has $ ix "type" . only "http-01") 113
112 token = r ^?! httpChallenge . JSON.key "token" . _String . to encodeUtf8 114 token = r ^?! httpChallenge . JSON.key "token" . _String . to encodeUtf8
113 crUri = r ^?! httpChallenge' . JSON.key "uri" . _String . to T.unpack 115 crUri = r ^?! httpChallenge . JSON.key "uri" . _String . to T.unpack
114 thumb = thumbprint (JWK (rsaE pub) "RSA" (rsaN pub)) 116 thumb = thumbprint (JWK (rsaE pub) "RSA" (rsaN pub))
115 thumbtoken = toStrict (LB.fromChunks [token, ".", thumb]) 117 thumbtoken = toStrict (LB.fromChunks [token, ".", thumb])
116 118