summaryrefslogtreecommitdiff
path: root/src/Network/ACME.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Network/ACME.hs')
-rw-r--r--src/Network/ACME.hs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/Network/ACME.hs b/src/Network/ACME.hs
index 5ea6ff8..35eebcb 100644
--- a/src/Network/ACME.hs
+++ b/src/Network/ACME.hs
@@ -70,9 +70,9 @@ certify directoryUrl keys reg domainKeys domains = do
70 70
71 cr dom = challengeRequest dom >>= statusReport >>= extractCR >>= performChallenge dom 71 cr dom = challengeRequest dom >>= statusReport >>= extractCR >>= performChallenge dom
72 72
73 runResourceT $ do 73 do
74 challengeResultLinks <- forM (map fst domains) cr 74 challengeResultLinks <- forM (map fst domains) cr
75 lift . runExceptT $ do 75 runExceptT $ do
76 ExceptT $ pollResults challengeResultLinks <&> left ("certificate receipt was not attempted because a challenge failed: " ++) 76 ExceptT $ pollResults challengeResultLinks <&> left ("certificate receipt was not attempted because a challenge failed: " ++)
77 ExceptT $ retrieveCert certReq >>= statusReport <&> checkCertResponse 77 ExceptT $ retrieveCert certReq >>= statusReport <&> checkCertResponse
78 78
@@ -154,12 +154,12 @@ data Directory = Directory {
154} 154}
155newtype Nonce = Nonce String 155newtype Nonce = Nonce String
156data Env = Env { getDir :: Directory, getKeys :: Keys, getSession :: WS.Session } 156data Env = Env { getDir :: Directory, getKeys :: Keys, getSession :: WS.Session }
157type ACME = RWST Env () Nonce IO 157type ACME = RWST Env () Nonce ResIO
158 158
159runACME :: URI -> Keys -> ACME a -> IO a 159runACME :: URI -> Keys -> ACME a -> IO a
160runACME url keys f = WS.withSession $ \sess -> do 160runACME url keys f = WS.withSession $ \sess -> do
161 Just (dir, nonce) <- getDirectory sess (show url) 161 Just (dir, nonce) <- getDirectory sess (show url)
162 fst <$> evalRWST f (Env dir keys sess) nonce 162 runResourceT $ fst <$> evalRWST f (Env dir keys sess) nonce
163 163
164post :: (MonadReader Env m, MonadState Nonce m, MonadIO m) => String -> LC.ByteString -> m (Response LC.ByteString) 164post :: (MonadReader Env m, MonadState Nonce m, MonadIO m) => String -> LC.ByteString -> m (Response LC.ByteString)
165post url payload = do 165post url payload = do