web_persist.mli 3.77 KB
Newer Older
Stephane Glondu's avatar
Stephane Glondu committed
1 2 3
(**************************************************************************)
(*                                BELENIOS                                *)
(*                                                                        *)
Stephane Glondu's avatar
Stephane Glondu committed
4
(*  Copyright © 2012-2018 Inria                                           *)
Stephane Glondu's avatar
Stephane Glondu committed
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
(*                                                                        *)
(*  This program is free software: you can redistribute it and/or modify  *)
(*  it under the terms of the GNU Affero General Public License as        *)
(*  published by the Free Software Foundation, either version 3 of the    *)
(*  License, or (at your option) any later version, with the additional   *)
(*  exemption that compiling, linking, and/or using OpenSSL is allowed.   *)
(*                                                                        *)
(*  This program is distributed in the hope that it will be useful, but   *)
(*  WITHOUT ANY WARRANTY; without even the implied warranty of            *)
(*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *)
(*  Affero General Public License for more details.                       *)
(*                                                                        *)
(*  You should have received a copy of the GNU Affero General Public      *)
(*  License along with this program.  If not, see                         *)
(*  <http://www.gnu.org/licenses/>.                                       *)
(**************************************************************************)

22
open Serializable_t
23
open Common
24
open Web_serializable_t
25

26 27 28
val get_draft_election : uuid -> draft_election option Lwt.t
val set_draft_election : uuid -> draft_election -> unit Lwt.t

29 30
val get_election_state : uuid -> election_state Lwt.t
val set_election_state : uuid -> election_state -> unit Lwt.t
31

32 33
type election_date =
  [ `Creation
34
  | `Validation
35 36
  | `Tally
  | `Archive
37
  | `LastMail
38 39 40
  ]
val get_election_date : election_date -> uuid -> datetime option Lwt.t
val set_election_date : election_date -> uuid -> datetime -> unit Lwt.t
41

42 43
val get_partial_decryptions : uuid -> partial_decryptions Lwt.t
val set_partial_decryptions : uuid -> partial_decryptions -> unit Lwt.t
Stephane Glondu's avatar
Stephane Glondu committed
44

45 46 47
val get_decryption_tokens : uuid -> decryption_tokens option Lwt.t
val set_decryption_tokens : uuid -> decryption_tokens -> unit Lwt.t

48
val get_auth_config : uuid -> (string * (string * string list)) list Lwt.t
49

50 51 52
val get_raw_election : uuid -> string option Lwt.t
val get_election_metadata : uuid -> metadata Lwt.t
val get_election_result : uuid -> Yojson.Safe.json result option Lwt.t
Stephane Glondu's avatar
Stephane Glondu committed
53

54 55 56 57 58 59 60
type election_kind =
  [ `Draft
  | `Validated
  | `Tallied
  | `Archived
  ]
val get_elections_by_owner : user -> (election_kind * uuid * datetime * string) list Lwt.t
61

62 63 64
val get_voters : uuid -> string list option Lwt.t
val get_passwords : uuid -> (string * string) SMap.t option Lwt.t
val get_public_keys : uuid -> string list option Lwt.t
65
val get_private_key : uuid -> number option Lwt.t
66 67
val get_private_keys : uuid -> string list option Lwt.t
val get_threshold : uuid -> string option Lwt.t
68

69 70
val get_ballot_hashes : uuid -> string list Lwt.t
val get_ballot_by_hash : uuid -> string -> string option Lwt.t
71

72 73
val add_ballot : uuid -> string -> string Lwt.t
val replace_ballot : uuid -> string -> string -> string Lwt.t
74 75
val compute_encrypted_tally : uuid -> (int * string * string) Lwt.t

76 77 78
val find_extended_record : uuid -> string -> (datetime * string) option Lwt.t
val add_extended_record : uuid -> string -> datetime * string -> unit Lwt.t

79
val has_voted : uuid -> user -> bool Lwt.t
80 81 82 83 84

val init_credential_mapping : uuid -> string list -> unit Lwt.t
val find_credential_mapping : uuid -> string -> string option Lwt.t
val add_credential_mapping : uuid -> string -> string option -> unit Lwt.t
val replace_credential : uuid -> string -> string -> unit Lwt.t