This commit is contained in:
swrup 2026-02-20 10:35:49 +01:00
parent d370717a59
commit 711bf6c8af
4 changed files with 26 additions and 19 deletions

View file

@ -23,11 +23,7 @@ type t = {
(* -- util -- *)
let time_abs_of_string s =
match int_of_string_opt s with
| None -> None
| Some n ->
let ts = Absolute.of_s (Int64.of_int n) in
Some ts
int_of_string_opt s |> Option.map (fun n -> Absolute.of_s (Int64.of_int n))
let t1_t2_of_fpath fpath =
let fname = Fpath.filename fpath in
@ -122,10 +118,16 @@ let check_periodes _l =
(* TODO *)
Ok ()
let sm_key_fpath =
Result.get_ok
@@
let+ fpath = Fpath.of_string Cfg.sm_priv_key |> unwrap_err_msg in
Fpath.normalize fpath
(* we load sm_key separately
we don't accept non-key files in key_dir *)
let load_key fpath =
match Fpath.filename fpath = Cfg.sm_priv_key with
match Fpath.equal (Fpath.normalize fpath) sm_key_fpath with
| true -> Ok None
| false -> (
match t1_t2_of_fpath fpath with
@ -135,8 +137,6 @@ let load_key fpath =
let pub = EddsaPrivateKey.pub_of_priv priv in
Ok (Some { priv; pub; t1; t2 }))
let sm_key_fpath = Fpath.(v Cfg.key_dir / Cfg.sm_priv_key)
let load () =
let* l = get_key_dir_contents Cfg.key_dir in
let* l = list_map load_key l in