This commit is contained in:
parent
9213604385
commit
d450ecd2ad
3 changed files with 28 additions and 12 deletions
|
|
@ -2,9 +2,9 @@ open Syntax
|
|||
(*open Crypto*)
|
||||
|
||||
let keys content =
|
||||
let open Api.ExchangeKeysResponse in
|
||||
let open Api in
|
||||
let open ExchangeKeysResponse in
|
||||
let* v = Api.decode jsont content in
|
||||
(* validate version compatibility *)
|
||||
let* () =
|
||||
if
|
||||
Libtool_version.is_compatible
|
||||
|
|
@ -13,13 +13,29 @@ let keys content =
|
|||
else Fmt.error "version incompatible"
|
||||
in
|
||||
|
||||
(* TODO *)
|
||||
(* validate currency specification *)
|
||||
(* validate all amounts *)
|
||||
(* validate all timestamp/duration *)
|
||||
(* validate master_public_key *)
|
||||
(* validate accounts *)
|
||||
(* validate wire-fees *)
|
||||
(* TODO need hash over json..
|
||||
validate ExchangeWireAccount *)
|
||||
let* () =
|
||||
let open AggregateTransferFee in
|
||||
v.wire_fees
|
||||
|> String_map.bindings
|
||||
|> List.concat_map (fun (wire_method, l) ->
|
||||
List.map (fun item -> (wire_method, item)) l)
|
||||
|> list_iter
|
||||
(fun
|
||||
(wire_method, { wire_fee; closing_fee; start_date; end_date; sig_ })
|
||||
->
|
||||
let open Signatures.MasterWireFee in
|
||||
verify v.master_public_key sig_
|
||||
{
|
||||
h_wire_method= Hash.Cstring.H64.hash wire_method;
|
||||
start_date;
|
||||
end_date;
|
||||
wire_fee;
|
||||
closing_fee;
|
||||
})
|
||||
in
|
||||
|
||||
(* validate signkeys *)
|
||||
(* validate exchange_pub *)
|
||||
(* validate denominations *)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue