1 {-# OPTIONS -fno-warn-orphans #-}
2 {-# LANGUAGE OverloadedStrings #-}
3 {-# LANGUAGE UndecidableInstances #-} -- for Reifies instances
4 module QuickCheck.Trustee where
6 import Test.Tasty.QuickCheck
7 import qualified Data.Text as Text
12 import QuickCheck.Election ()
14 quickcheck :: Reifies v Version => Proxy v -> TestTree
17 [ testGroup "verifyIndispensableTrusteePublicKey" $
18 [ reify weakFFC $ testIndispensableTrusteePublicKey v
19 , reify beleniosFFC $ testIndispensableTrusteePublicKey v
23 testIndispensableTrusteePublicKey ::
25 CryptoParams crypto c =>
27 Proxy v -> Proxy c -> TestTree
28 testIndispensableTrusteePublicKey (_v::Proxy v) (c::Proxy c) =
29 testGroup (Text.unpack $ cryptoName (reflect c))
30 [ testProperty "Right" $ \seed ->
32 (`evalStateT` mkStdGen seed) $ do
33 trusteeSecKey :: SecretKey crypto c <- randomSecretKey
34 trusteePubKey :: TrusteePublicKey crypto v c
35 <- proveIndispensableTrusteePublicKey trusteeSecKey
36 lift $ verifyIndispensableTrusteePublicKey trusteePubKey
41 , CryptoParams crypto c
42 ) => Arbitrary (TrusteePublicKey crypto v c) where
44 trustee_PublicKey <- arbitrary
45 trustee_SecretKeyProof <- arbitrary
46 return TrusteePublicKey{..}