rm HashCode, use DenominationHash directly

This commit is contained in:
swrup 2025-12-21 22:13:35 +01:00
parent dfb0b476c0
commit 99d2ee6194
6 changed files with 77 additions and 39 deletions

View file

@ -117,9 +117,8 @@ end
module Keys_post = struct
let verify_denom_signature ~sm DenomSignature.{ h_denom_pub; master_sig } =
let denom_hash = HashCode.to_denomination_hash h_denom_pub in
let* denom =
match Secmod.find_denom_data sm denom_hash with
match Secmod.find_denom_data sm h_denom_pub with
| None ->
Fmt.error
"404 not found, One of the keys for which a signature was provided \
@ -138,7 +137,7 @@ module Keys_post = struct
fee_withdraw= denom.fee_withdraw;
fee_deposit= denom.fee_deposit;
fee_refresh= denom.fee_refresh;
denom_hash;
denom_hash= h_denom_pub;
}
in
verify_f ~f:Secmod.verify_with_master_key master_sig r
@ -196,7 +195,6 @@ module Keys_post = struct
let* () =
denom_sigs
|> List.map (fun DenomSignature.{ h_denom_pub; master_sig } ->
let h_denom_pub = HashCode.to_denomination_hash h_denom_pub in
(h_denom_pub, master_sig))
|> Secmod.add_denom_master_signatures db_conn sm
in
@ -238,8 +236,7 @@ module Denom_revoke = struct
let db_conn = Vif.Server.device Devices.db_connection server in
let sm = Vif.Server.device Devices.secmod server in
let res =
let* h_denom_pub = HashCode.of_b32 h_denom_pub in
let h_denom_pub = HashCode.to_denomination_hash h_denom_pub in
let* h_denom_pub = DenominationHash.of_b32 h_denom_pub in
let* v = Vif.Request.of_json req |> unwrap_err_msg in
let* () = verify h_denom_pub v in
let* () = do_ ~db_conn ~sm h_denom_pub v in