Une MAJ de sécurité est nécessaire sur notre version actuelle. Elle sera effectuée lundi 02/08 entre 12h30 et 13h. L'interruption de service devrait durer quelques minutes (probablement moins de 5 minutes).

Commit bd1dc0f1 authored by Stephane Glondu's avatar Stephane Glondu
Browse files

Simplify structure of Web_election

parent 4b3be873
......@@ -33,23 +33,11 @@ open Web_services
let ( / ) = Filename.concat
module type REGISTRABLE = sig
module W : sig
include ELECTION_DATA
include WEB_PARAMS
module E : ELECTION with type elt = G.t
end
module Register (X : EMPTY) : WEB_ELECTION
end
module Make (D : ELECTION_DATA) (P : WEB_PARAMS) : REGISTRABLE = struct
module W = struct
include D
include P
module M = MakeLwtRandom(struct let rng = make_rng () end)
module E = Election.MakeElection(G)(M)
end
module Register (X : EMPTY) : WEB_ELECTION = struct
let uuid = Uuidm.to_string D.election.e_params.e_uuid
......@@ -69,7 +57,10 @@ module Make (D : ELECTION_DATA) (P : WEB_PARAMS) : REGISTRABLE = struct
module Auth = Web_auth.Make (N)
let () = Auth.configure N.auth_config
include W
include D
include P
module M = MakeLwtRandom(struct let rng = make_rng () end)
module E = Election.MakeElection(G)(M)
module B : WEB_BALLOT_BOX = struct
......
......@@ -26,11 +26,6 @@ open Web_serializable_t
open Web_signatures
module type REGISTRABLE = sig
module W : sig
include ELECTION_DATA
include WEB_PARAMS
module E : ELECTION with type elt = G.t
end
module Register (X : EMPTY) : WEB_ELECTION
end
......
......@@ -138,7 +138,7 @@ let import_election f =
let web_params = (module X : WEB_PARAMS) in
let r, do_register = register_election params web_params in
let module R = (val r : Web_election.REGISTRABLE) in
let module G = R.W.G in
let module G = P.G in
let module KG = Election.MakeSimpleDistKeyGen (G) (LwtRandom) in
let public_keys = Lwt_io.lines_of_file f.f_public_keys in
lwt pks = Lwt_stream.(
......@@ -148,7 +148,7 @@ let import_election f =
) in
if not (Array.forall KG.check pks) then
failwith "Public keys are invalid.";
if not G.(R.W.election.e_params.e_public_key =~ KG.combine pks) then
if not G.(P.params.e_public_key =~ KG.combine pks) then
failwith "Public keys mismatch with election public key.";
let public_creds = Lwt_io.lines_of_file f.f_public_creds in
lwt () = Lwt_stream.(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment