ok secmod + logs

This commit is contained in:
swrup 2026-02-21 19:25:31 +01:00
parent cb33942711
commit 37ed47326a
5 changed files with 79 additions and 51 deletions

View file

@ -17,12 +17,11 @@ module Make (Conn : Pg.CONN) = struct
let secmod_eddsa_pub = Sm_eddsa.sm_pub
let secmod_rsa_pub = Sm_rsa.sm_pub
(* TODO error
should be a "key not found", either:
(* TODO
error "key not found", either:
- we tried to sign with a key that is not ours
- key was revoked
- bad keyring state
*)
- bad keyring state *)
let sign pub s =
match Sm_eddsa.sign pub s with
| Error e -> Fmt.failwith "sign failure: %s." e
@ -37,6 +36,8 @@ module Make (Conn : Pg.CONN) = struct
let find_signkey pub = Pg.find_signkey conn pub |> unwrap_err_caqti
let find_denomination h_pub = Pg.find_denom conn h_pub |> unwrap_err_caqti
(* TODO
check if database is coherent with secmod *)
let signkeys () : Signkey.t list result =
let now = Timestamp.of_ptime @@ Ptime_clock.now () in
Pg.get_active_signkeys conn ~now |> unwrap_err_caqti