web_serializable.atd 4.17 KB
Newer Older
1 2 3
(**************************************************************************)
(*                                BELENIOS                                *)
(*                                                                        *)
Stephane Glondu's avatar
Stephane Glondu committed
4
(*  Copyright © 2012-2018 Inria                                           *)
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
(*                                                                        *)
(*  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/>.                                       *)
(**************************************************************************)

<doc text="Web-specific serializable datatypes">

(** {1 Predefined types} *)

26
type number <ocaml predef from="Serializable_builtin"> = abstract
27
type uuid <ocaml predef from="Serializable_builtin"> = abstract
Stephane Glondu's avatar
Stephane Glondu committed
28
type string_set <ocaml predef from="Serializable_builtin"> = abstract
29
type datetime <ocaml predef from="Web_serializable_builtin"> = abstract
30
type template <ocaml predef from="Serializable"> = abstract
31 32 33
type cert <ocaml predef from="Serializable"> = abstract
type polynomial <ocaml predef from="Serializable"> = abstract
type vinput <ocaml predef from="Serializable"> = abstract
34 35 36 37 38 39 40 41

(** {1 Web-specific types} *)

type user = {
  domain : string;
  name : string;
} <ocaml field_prefix="user_">

42 43 44 45 46 47
type auth_config = {
  auth_system : string;
  auth_instance : string;
  auth_config : (string * string) list;
}

48 49
type metadata = {
  ?owner: user option;
50
  ?auth_config: auth_config list option;
51
  ?cred_authority : string option;
52
  ?trustees : string list option;
53
  ?languages : string list option;
54
  ?contact : string option;
55
} <ocaml field_prefix="e_">
56

57 58 59
type election_dates = {
  finalization : datetime;
} <ocaml field_prefix="e_">
60 61 62 63 64 65 66 67 68 69 70 71

(** {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;
72
  ?private_key : number option;
73 74
} <ocaml field_prefix="st_">

75 76 77 78 79 80 81 82 83 84
type setup_threshold_trustee = {
  id : string;
  token : string;
  ?step <ocaml mutable> : int option;
  ?cert <ocaml mutable> : cert option;
  ?polynomial <ocaml mutable> : polynomial option;
  ?vinput <ocaml mutable> : vinput option;
  ?voutput <ocaml mutable> : string option;
} <ocaml field_prefix="stt_">

85 86 87 88 89 90 91 92 93
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;
94 95 96 97
  ?threshold <ocaml mutable> : int option;
  ?threshold_trustees <ocaml mutable> : setup_threshold_trustee list option;
  ?threshold_parameters <ocaml mutable> : string option;
  ?threshold_error <ocaml mutable> : string option;
98
} <ocaml field_prefix="se_">
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117

(** {1 OpenID Connect-related types} *)

type oidc_configuration = {
  authorization_endpoint : string;
  token_endpoint : string;
  userinfo_endpoint : string;
}

type oidc_tokens = {
  access_token : string;
  token_type : string;
  id_token : string;
} <ocaml field_prefix="oidc_">

type oidc_userinfo = {
  sub : string;
  ?email : string option;
} <ocaml field_prefix="oidc_">