protocol: add verification of trustees' public key
authorJulien Moutinho <julm+hjugement@autogeree.net>
Mon, 5 Aug 2019 18:08:31 +0000 (18:08 +0000)
committerJulien Moutinho <julm+hjugement@autogeree.net>
Mon, 5 Aug 2019 18:08:40 +0000 (18:08 +0000)
hjugement-cli/hjugement-cli.cabal
hjugement-cli/src/Hjugement/CLI/Administrator.hs

index 8b329f219f0b2ba1d8bb21568d198cc1e865b6b6..6ad5f2acd1564ad19c2d652ced48ee9108ddd236 100644 (file)
@@ -73,8 +73,8 @@ Executable hjugement
     -fno-warn-tabs
     -- -fhide-source-paths
   build-depends:
-      hjugement >= 2.0
-    , hjugement-protocol >= 0.0.1
+      hjugement >= 2.0.2
+    , hjugement-protocol >= 0.0.6
     , aeson >= 1.3
     , base >= 4.6 && < 5
     , base64-bytestring >= 1.0
@@ -97,7 +97,7 @@ Executable hjugement
     , pipes-text >= 0.0.2.5
     , random >= 1.1
     , reflection >= 2.1
-    , symantic-cli >= 2.4
+    , symantic-cli >= 2.4.1
     , symantic-document >= 1.5
     , terminal-size >= 0.3
     , text >= 1.2
index 94a11a893ff2c4e4ff94224e7d4212472d87f73c..1def17052cf42f2028403122027f601b9f625647 100644 (file)
@@ -157,6 +157,10 @@ run_administrator_election
                let trusteeKeysPath = global_dir FP.</> "public_keys.jsons"
                trusteeKeys :: [VP.TrusteePublicKey c] <- runPipeWithError $
                        Pip.toListM' $ readJSON trusteeKeysPath
+               forM_ trusteeKeys $ \trusteeKey ->
+                       case runExcept $ VP.verifyIndispensableTrusteePublicKey trusteeKey of
+                        Left err -> outputError $ Doc.from (show err)
+                        Right () -> return ()
                let grades = List.nub administratorElection_grades
                unless (List.length grades > 1) $
                        outputError $ "at least two distinct grades are needed"