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

Remove get_randomness (unused)

parent bcfd1f14
......@@ -30,11 +30,6 @@ type template <ocaml predef from="Serializable"> = abstract
(** {1 Web-specific types} *)
type randomness = {
randomness : string;
}
<doc text="Randomness generated by the server sent to the client.">
type user = {
domain : string;
name : string;
......
......@@ -30,7 +30,6 @@ let site_login = service ~path:["login"] ~get_params:(opt (string "service")) ()
let logout = service ~path:["logout"] ~get_params:unit ()
let source_code = service ~path:["belenios.tar.gz"] ~get_params:unit ()
let get_randomness = service ~path:["get-randomness"] ~get_params:unit ()
let tool = preapply (static_dir ()) ["static"; "belenios-tool.html"]
......
......@@ -285,29 +285,6 @@ let () = File.register
~content_type:"application/x-gzip"
(fun () () -> return !source_file)
let do_get_randomness =
let prng = Lazy.from_fun (Lwt_preemptive.detach (fun () ->
pseudo_rng (random_string secure_rng 16)
)) in
let mutex = Lwt_mutex.create () in
fun () ->
Lwt_mutex.with_lock mutex (fun () ->
let%lwt prng = Lazy.force prng in
return (random_string prng 32)
)
let b64_encode_compact x =
Cryptokit.(transform_string (Base64.encode_compact ()) x)
let () = String.register
~service:get_randomness
(fun () () ->
let%lwt r = do_get_randomness () in
b64_encode_compact r |>
(fun x -> string_of_randomness { randomness=x }) |>
(fun x -> return (x, "application/json"))
)
let generate_uuid = Uuidm.v4_gen (Random.State.make_self_init ())
let create_new_election owner cred auth =
......
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