Commit 147c0088 authored by Stephane Glondu's avatar Stephane Glondu

Make setup_election a serializable type

parent 2045caf4
......@@ -22,7 +22,6 @@
open Lwt
open Platform
open Common
open Serializable_t
open Web_serializable_builtin_t
open Web_serializable_j
......@@ -178,28 +177,6 @@ let uuid =
and to_string x = Uuidm.to_string x
in Eliom_parameter.user_type ~of_string ~to_string
type setup_voter = {
sv_id : string;
mutable sv_password : (string * string) option;
}
type setup_trustee = {
st_id : string;
st_token : string;
mutable st_public_key : string;
}
type setup_election = {
mutable se_owner : user;
mutable se_group : string;
mutable se_voters : setup_voter list;
mutable se_questions : template;
mutable se_public_keys : setup_trustee list;
mutable se_metadata : metadata;
mutable se_public_creds : string;
mutable se_public_creds_received : bool;
}
let b58_digits = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"
let token_length = 14
let prng = lazy (pseudo_rng (random_string secure_rng 16))
......
......@@ -19,7 +19,6 @@
(* <http://www.gnu.org/licenses/>. *)
(**************************************************************************)
open Serializable_t
open Web_serializable_t
val spool_dir : string ref
......@@ -95,28 +94,6 @@ val uuid :
[ `One of Uuidm.t ] Eliom_parameter.param_name)
Eliom_parameter.params_type
type setup_voter = {
sv_id : string;
mutable sv_password : (string * string) option;
}
type setup_trustee = {
st_id : string;
st_token : string;
mutable st_public_key : string;
}
type setup_election = {
mutable se_owner : user;
mutable se_group : string;
mutable se_voters : setup_voter list;
mutable se_questions : template;
mutable se_public_keys : setup_trustee list;
mutable se_metadata : metadata;
mutable se_public_creds : string;
mutable se_public_creds_received : bool;
}
val generate_token : unit -> string Lwt.t
val string_of_user : user -> string
......
......@@ -26,6 +26,7 @@
type uuid <ocaml predef from="Serializable_builtin"> = abstract
type string_set <ocaml predef from="Serializable_builtin"> = abstract
type datetime <ocaml predef from="Web_serializable_builtin"> = abstract
type template <ocaml predef from="Serializable"> = abstract
(** {1 Web-specific types} *)
......@@ -65,3 +66,27 @@ type election_uuid = {
type election_dates = {
finalization : datetime;
} <ocaml field_prefix="e_">
(** {1 Types related to elections being prepared} *)
type setup_voter = {
id : string;
?password <ocaml mutable> : (string * string) option;
} <ocaml field_prefix="sv_">
type setup_trustee = {
id : string;
token : string;
public_key <ocaml mutable> : string;
} <ocaml field_prefix="st_">
type setup_election = {
owner : user;
group : string;
voters <ocaml mutable> : setup_voter list;
questions <ocaml mutable> : template;
public_keys <ocaml mutable> : setup_trustee list;
metadata <ocaml mutable> : metadata;
public_creds : string;
public_creds_received <ocaml mutable> : bool;
} <ocaml field_prefix="se_">
......@@ -20,6 +20,7 @@
(**************************************************************************)
open Serializable_t
open Web_serializable_t
open Signatures
val home : unit -> [> `Html ] Eliom_content.Html5.F.elt Lwt.t
......@@ -37,15 +38,15 @@ val generic_page : title:string ->
string -> unit -> [> `Html ] Eliom_content.Html5.F.elt Lwt.t
val election_setup_pre : unit -> [> `Html ] Eliom_content.Html5.F.elt Lwt.t
val election_setup : Uuidm.t -> Web_common.setup_election -> unit -> [> `Html ] Eliom_content.Html5.F.elt Lwt.t
val election_setup_voters : Uuidm.t -> Web_common.setup_election -> unit -> [> `Html ] Eliom_content.Html5.F.elt Lwt.t
val election_setup_questions : Uuidm.t -> Web_common.setup_election -> unit -> [> `Html ] Eliom_content.Html5.F.elt Lwt.t
val election_setup_credential_authority : Uuidm.t -> Web_common.setup_election -> unit -> [> `Html ] Eliom_content.Html5.F.elt Lwt.t
val election_setup_credentials : string -> string -> Web_common.setup_election -> unit -> [> `Html ] Eliom_content.Html5.F.elt Lwt.t
val election_setup_trustees : Uuidm.t -> Web_common.setup_election -> unit -> [> `Html ] Eliom_content.Html5.F.elt Lwt.t
val election_setup_trustee : string -> Web_common.setup_election -> unit -> [> `Html ] Eliom_content.Html5.F.elt Lwt.t
val election_setup_import : Uuidm.t -> Web_common.setup_election -> (module ELECTION_DATA) list * (module ELECTION_DATA) list * (module ELECTION_DATA) list -> unit -> [> `Html ] Eliom_content.Html5.F.elt Lwt.t
val election_setup_confirm : Uuidm.t -> Web_common.setup_election -> unit -> [> `Html ] Eliom_content.Html5.F.elt Lwt.t
val election_setup : Uuidm.t -> setup_election -> unit -> [> `Html ] Eliom_content.Html5.F.elt Lwt.t
val election_setup_voters : Uuidm.t -> setup_election -> unit -> [> `Html ] Eliom_content.Html5.F.elt Lwt.t
val election_setup_questions : Uuidm.t -> setup_election -> unit -> [> `Html ] Eliom_content.Html5.F.elt Lwt.t
val election_setup_credential_authority : Uuidm.t -> setup_election -> unit -> [> `Html ] Eliom_content.Html5.F.elt Lwt.t
val election_setup_credentials : string -> string -> setup_election -> unit -> [> `Html ] Eliom_content.Html5.F.elt Lwt.t
val election_setup_trustees : Uuidm.t -> setup_election -> unit -> [> `Html ] Eliom_content.Html5.F.elt Lwt.t
val election_setup_trustee : string -> setup_election -> unit -> [> `Html ] Eliom_content.Html5.F.elt Lwt.t
val election_setup_import : Uuidm.t -> setup_election -> (module ELECTION_DATA) list * (module ELECTION_DATA) list * (module ELECTION_DATA) list -> unit -> [> `Html ] Eliom_content.Html5.F.elt Lwt.t
val election_setup_confirm : Uuidm.t -> setup_election -> unit -> [> `Html ] Eliom_content.Html5.F.elt Lwt.t
val election_home : (module ELECTION_DATA) -> Web_persist.election_state -> unit -> [> `Html ] Eliom_content.Html5.F.elt Lwt.t
val election_admin : (module ELECTION_DATA) -> Web_serializable_j.metadata -> Web_persist.election_state -> unit -> [> `Html ] Eliom_content.Html5.F.elt Lwt.t
......
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