This commit is contained in:
parent
f8150e5cf6
commit
d87ad57452
1 changed files with 9 additions and 9 deletions
|
|
@ -39,7 +39,7 @@ let add_signkey_master_signatures conn t l =
|
|||
list_iter
|
||||
(fun (pub, master_sig) ->
|
||||
match Hashtbl.find_opt t.sk_ht pub with
|
||||
| None -> Error "secmod_signkey failure: public key not found."
|
||||
| None -> Error "secmod failure: public key not found."
|
||||
| Some signkey ->
|
||||
let signkey = { signkey with master_sig= Some master_sig } in
|
||||
let* () =
|
||||
|
|
@ -54,7 +54,7 @@ let add_denom_master_signatures conn t l =
|
|||
list_iter
|
||||
(fun (h_denom_pub, master_sig) ->
|
||||
match Hashtbl.find_opt t.dn_ht h_denom_pub with
|
||||
| None -> Error "secmod_denom failure: denomination hash not found."
|
||||
| None -> Error "secmod failure: denomination hash not found."
|
||||
| Some denom ->
|
||||
let denom = { denom with master_sig= Some master_sig } in
|
||||
let* () =
|
||||
|
|
@ -67,7 +67,7 @@ let add_denom_master_signatures conn t l =
|
|||
let revoke_signkey t exchange_pub master_sig =
|
||||
Miou.Mutex.protect t.lock @@ fun () ->
|
||||
match Hashtbl.find_opt t.sk_ht exchange_pub with
|
||||
| None -> Error "secmod_denom failure: denomination hash not found."
|
||||
| None -> Error "secmod failure: denomination hash not found."
|
||||
| Some signkey ->
|
||||
Hashtbl.remove t.sk_ht exchange_pub;
|
||||
Hashtbl.replace t.sk_revoked_ht exchange_pub (signkey, master_sig);
|
||||
|
|
@ -76,13 +76,13 @@ let revoke_signkey t exchange_pub master_sig =
|
|||
let revoke_denomination t h_denom_pub master_sig =
|
||||
Miou.Mutex.protect t.lock @@ fun () ->
|
||||
match Hashtbl.find_opt t.dn_ht h_denom_pub with
|
||||
| None -> Error "secmod_denom failure: denomination hash not found."
|
||||
| None -> Error "secmod failure: denomination hash not found."
|
||||
| Some denom ->
|
||||
Hashtbl.remove t.dn_ht h_denom_pub;
|
||||
Hashtbl.replace t.dn_revoked_ht h_denom_pub (denom, master_sig);
|
||||
Ok ()
|
||||
|
||||
let dir = Fpath.(v "data" / "secmod_signkey")
|
||||
let dir = Fpath.(v "data" / "secmod ")
|
||||
|
||||
let db_lookup_signkey_data conn fname priv =
|
||||
let pub = Crypto.EddsaPrivateKey.pub_of_priv priv in
|
||||
|
|
@ -175,7 +175,7 @@ let _store t =
|
|||
|
||||
let load conn =
|
||||
let error_invalid_state =
|
||||
Fmt.error_msg "secmod_signkey load error: invalid store state."
|
||||
Fmt.error_msg "secmod load error: invalid store state."
|
||||
in
|
||||
let* sm_key_priv = Data_file.read_eddsa Fpath.(dir / "sm_key") in
|
||||
let* signkeys =
|
||||
|
|
@ -259,11 +259,11 @@ let init conn =
|
|||
match load conn with
|
||||
| Ok None ->
|
||||
let t = make_new () in
|
||||
Logs.info (fun m -> m "secmod_signkey initialized with fresh keys");
|
||||
Logs.info (fun m -> m "secmod initialized with fresh keys");
|
||||
t
|
||||
| Ok (Some v) ->
|
||||
Logs.info (fun m -> m "secmod_signkey initialized from storage");
|
||||
Logs.info (fun m -> m "secmod initialized from storage");
|
||||
v
|
||||
| Error _ ->
|
||||
(* TODO error: pretty print *)
|
||||
Fmt.failwith "secmod_signkey init failure."
|
||||
Fmt.failwith "secmod init failure."
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue