summaryrefslogtreecommitdiffhomepage
path: root/Crypto.hs
diff options
context:
space:
mode:
authorJoey Hess <joeyh@joeyh.name>2018-12-08 13:26:14 -0400
committerJoey Hess <joeyh@joeyh.name>2018-12-08 13:28:42 -0400
commit9d7e697474720b2c6e78fbf11066a8499fc55807 (patch)
treef2f1b6b0c29017f2fcc6cb206ffea5939d3b19c7 /Crypto.hs
parentad33cd0f276eb898db5287dd36bf06fd6258f911 (diff)
downloaddebug-me-9d7e697474720b2c6e78fbf11066a8499fc55807.tar.gz
Update to lts-12.10, support ghc 8.4, and aeson 1.3.
Don't fully understand the need for the MonoLocalBinds language extension, which was not needed before but now ghc complains if it's not included, but I've tested it and it does work. All the rest of the changes are straightforward AMP changes and dep updates. Removed fgl from stack.yaml because it seems that indirect dep no longer needs to be specified for stack to build. Added custom-setup stanza since stack now warns without one. This commit was sponsored by Trenton Cronholm on Patreon.
Diffstat (limited to 'Crypto.hs')
-rw-r--r--Crypto.hs8
1 files changed, 6 insertions, 2 deletions
diff --git a/Crypto.hs b/Crypto.hs
index 2fe27e0..af3ad17 100644
--- a/Crypto.hs
+++ b/Crypto.hs
@@ -16,6 +16,7 @@ import Crypto.Error
import Crypto.Random.Entropy
import Data.ByteArray (convert)
import qualified Data.ByteString as B
+import qualified Data.Semigroup as Sem
dummySignature :: Signature
dummySignature = OtherSignature (Val mempty)
@@ -78,10 +79,13 @@ mkSigVerifier (PublicKey (Val pk)) =
CryptoPassed pk' -> SigVerifier 1 (Ed25519.verify pk')
CryptoFailed _ -> mempty
+instance Sem.Semigroup SigVerifier where
+ SigVerifier na a <> SigVerifier nb b =
+ SigVerifier (na+nb) $ \d s -> b d s || a d s
+
instance Monoid SigVerifier where
mempty = SigVerifier 0 $ \_b _s -> False
- mappend (SigVerifier na a) (SigVerifier nb b) =
- SigVerifier (na+nb) $ \d s -> b d s || a d s
+ mappend = (Sem.<>)
data MySessionKey = MySessionKey Ed25519.SecretKey Ed25519.PublicKey