add test/validate_response.ml
This commit is contained in:
parent
b984190d6d
commit
cbf54c16df
6 changed files with 277 additions and 12 deletions
|
|
@ -915,6 +915,10 @@ module SignKey = struct
|
|||
Signkey.{ pub; stamp_start; stamp_expire; stamp_end; master_sig } =
|
||||
{ key= pub; stamp_start; stamp_expire; stamp_end; master_sig }
|
||||
|
||||
let to_signkey { key= pub; stamp_start; stamp_expire; stamp_end; master_sig }
|
||||
=
|
||||
Signkey.{ pub; stamp_start; stamp_expire; stamp_end; master_sig }
|
||||
|
||||
let jsont =
|
||||
let make key stamp_start stamp_expire stamp_end master_sig =
|
||||
{ key; stamp_start; stamp_expire; stamp_end; master_sig }
|
||||
|
|
@ -1261,7 +1265,7 @@ module ExchangeKeysResponse = struct
|
|||
stefan_lin: Float.t;
|
||||
asset_type: string;
|
||||
accounts: ExchangeWireAccount.t list;
|
||||
wire_fees: AggregateTransferFee.t list Stdlib.Map.Make(Stdlib.String).t;
|
||||
wire_fees: AggregateTransferFee.t list String_map.t;
|
||||
wads: ExchangePartnerListEntry.t list;
|
||||
kyc_enabled: bool;
|
||||
disable_direct_deposit: bool;
|
||||
|
|
@ -1278,7 +1282,7 @@ module ExchangeKeysResponse = struct
|
|||
list_issue_date: Timestamp.t;
|
||||
auditors: AuditorKeys.t list;
|
||||
signkeys: SignKey.t list;
|
||||
extensions: ExtensionManifest.t Stdlib.Map.Make(Stdlib.String).t option;
|
||||
extensions: ExtensionManifest.t String_map.t option;
|
||||
(* Signature by the exchange master key of the SHA-256 hash of the
|
||||
normalized JSON-object of field extensions, if it was set.
|
||||
The signature has purpose TALER_SIGNATURE_MASTER_EXTENSIONS. *)
|
||||
|
|
|
|||
|
|
@ -110,3 +110,60 @@ let make_denom_group_sorted denominations =
|
|||
|> List.sort cmp_group
|
||||
in
|
||||
l
|
||||
|
||||
let denoms_of_denomgroups l =
|
||||
let open Api in
|
||||
l
|
||||
|> List.concat_map
|
||||
(fun
|
||||
(DenomGroup.Rsa
|
||||
RsaDenomGroup.
|
||||
{
|
||||
denoms;
|
||||
value;
|
||||
fee_withdraw;
|
||||
fee_deposit;
|
||||
fee_refresh;
|
||||
fee_refund;
|
||||
})
|
||||
->
|
||||
let open RsaDenom in
|
||||
denoms
|
||||
|> List.map
|
||||
(fun
|
||||
{
|
||||
rsa_pub;
|
||||
master_sig;
|
||||
stamp_start;
|
||||
stamp_expire_withdraw;
|
||||
stamp_expire_deposit;
|
||||
stamp_expire_legal;
|
||||
lost= _;
|
||||
}
|
||||
->
|
||||
let h_pub =
|
||||
DenominationHash.hash (Crypto.RsaPublicKey.to_octets rsa_pub)
|
||||
in
|
||||
{
|
||||
pub= rsa_pub;
|
||||
value;
|
||||
stamp_start;
|
||||
stamp_expire_withdraw;
|
||||
stamp_expire_deposit;
|
||||
stamp_expire_legal;
|
||||
fee_withdraw;
|
||||
fee_deposit;
|
||||
fee_refresh;
|
||||
fee_refund;
|
||||
age_mask= 0;
|
||||
h_pub;
|
||||
master_sig;
|
||||
}))
|
||||
|
||||
let hash_over_master_sigs denominations =
|
||||
denominations
|
||||
|> List.map (fun (Api.DenomGroup.Rsa g) -> g.Api.RsaDenomGroup.denoms)
|
||||
|> List.concat_map (List.map (fun dn -> dn.Api.RsaDenom.master_sig))
|
||||
|> List.map Signatures.DenominationKeyValidity.to_octets
|
||||
|> String.concat ""
|
||||
|> Hash.H64.hash
|
||||
|
|
|
|||
|
|
@ -104,16 +104,13 @@ let mk_keys ~db_conn (module Keys : Keys.S) ~last_issue_date =
|
|||
|
||||
(* ! depends on denominations order *)
|
||||
let exchange_sig =
|
||||
let hc =
|
||||
denominations
|
||||
|> List.map (fun (DenomGroup.Rsa g) -> g.RsaDenomGroup.denoms)
|
||||
|> List.concat_map (List.map (fun dn -> dn.RsaDenom.master_sig))
|
||||
|> List.map Signatures.DenominationKeyValidity.to_octets
|
||||
|> String.concat ""
|
||||
|> Hash.H64.hash
|
||||
in
|
||||
let open Signatures.ExchangeKeySet in
|
||||
signf (Keys.sign exchange_pub) R.{ list_issue_date; hc }
|
||||
signf (Keys.sign exchange_pub)
|
||||
R.
|
||||
{
|
||||
list_issue_date;
|
||||
hc= Denomination.hash_over_master_sigs denominations;
|
||||
}
|
||||
in
|
||||
|
||||
let recoup = (* /recoup *) [] in
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue