mv last_change out of sm-rsa
This commit is contained in:
parent
7f5956d96c
commit
d28195366e
4 changed files with 9 additions and 13 deletions
|
|
@ -92,8 +92,6 @@ module Make (Conn : Pg.CONN) (Fs : Fat.FS) : S = struct
|
|||
m "found %d active denomination(s)" (List.length l));
|
||||
l
|
||||
|
||||
let denominations_last_change () = Sm_rsa.last_change ()
|
||||
|
||||
let make_future_sk (pub, (start, expire)) =
|
||||
Logs.debug (fun m -> m "make_future_sk: `%s`" (EddsaPublicKey.to_b32 pub));
|
||||
let open Time in
|
||||
|
|
@ -289,6 +287,10 @@ module Make (Conn : Pg.CONN) (Fs : Fat.FS) : S = struct
|
|||
Denomination.verify_denomination_key_validity ~key:Config.master_public_key
|
||||
dn
|
||||
|
||||
(* MIOU *)
|
||||
let last_change = ref Timestamp.never
|
||||
let denominations_last_change () = !last_change
|
||||
|
||||
let certify_future_signkey Api.SignKeySignature.{ key= pub; master_sig } =
|
||||
match Sm_eddsa.find_key pub with
|
||||
| None -> Error "future signkey not found"
|
||||
|
|
|
|||
|
|
@ -22,7 +22,9 @@ let hello req _server _env =
|
|||
|
||||
(* TODO nice routes typing
|
||||
to enforce json verification
|
||||
to specify handlers responses data and status codes *)
|
||||
to specify handlers responses data and status codes
|
||||
|
||||
use Vif.Uri.conv *)
|
||||
let routes =
|
||||
let open Vifu.Uri in
|
||||
let open Vifu.Route in
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@
|
|||
list_issue_date: save timestamp of key generation
|
||||
key validity period:
|
||||
more checks + do not exceed lookahead
|
||||
look into ocaml-diet maybe
|
||||
refacto common parts with secmod_eddsa *)
|
||||
let src = Logs.Src.create "mte.secmod_eddsa"
|
||||
|
||||
|
|
|
|||
|
|
@ -52,7 +52,6 @@ type t = {
|
|||
sm_key_priv: EddsaPrivateKey.t;
|
||||
sm_pub: EddsaPublicKey.t;
|
||||
ht: (DenominationHash.t, key) Hashtbl.t;
|
||||
mutable last_change: Timestamp.t;
|
||||
}
|
||||
|
||||
let parse_filename =
|
||||
|
|
@ -206,9 +205,7 @@ let load fs =
|
|||
let sm_pub = EddsaPrivateKey.pub_of_priv sm_key_priv in
|
||||
let ht = Hashtbl.create 0xff in
|
||||
let () = List.iter (fun k -> Hashtbl.replace ht k.h_pub k) keys in
|
||||
(* TODO list_issue_date *)
|
||||
let last_change = Timestamp.never in
|
||||
Ok (Some { fs; sm_key_priv; sm_pub; ht; last_change })
|
||||
Ok (Some { fs; sm_key_priv; sm_pub; ht })
|
||||
|
||||
let init fs =
|
||||
let* opt = load fs in
|
||||
|
|
@ -222,8 +219,7 @@ let init fs =
|
|||
m "generated secmod key: `%s`" (EddsaPublicKey.to_b32 sm_pub));
|
||||
let* () = write_eddsa fs sm_key_fpath sm_key_priv in
|
||||
let ht = Hashtbl.create 0xff in
|
||||
let last_change = Timestamp.of_absolute now in
|
||||
Ok { fs; sm_key_priv; sm_pub; ht; last_change }
|
||||
Ok { fs; sm_key_priv; sm_pub; ht }
|
||||
in
|
||||
let all_keys = List.of_seq @@ Hashtbl.to_seq_values t.ht in
|
||||
let new_keys_l =
|
||||
|
|
@ -262,14 +258,11 @@ module Make (Fs : Fat.FS) = struct
|
|||
|> list_iter delete
|
||||
|
||||
let add section_name t1 t2 =
|
||||
let last_change = Timestamp.of_ptime (Mirage_ptime.now ()) in
|
||||
let k = gen_key ~section_name t1 t2 in
|
||||
let+ () = write_key t.fs k in
|
||||
Hashtbl.replace t.ht k.h_pub k;
|
||||
t.last_change <- last_change;
|
||||
()
|
||||
|
||||
let last_change () = t.last_change
|
||||
let sm_pub = t.sm_pub
|
||||
let sign_secmod s = EddsaSignature.sign ~key:t.sm_key_priv s
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue