add amount & blinding_seed mess
This commit is contained in:
parent
947388b354
commit
6ef34b8fe7
1 changed files with 123 additions and 9 deletions
|
|
@ -308,14 +308,96 @@ module Age_mask = struct
|
||||||
record (fun mask -> { mask }) |+ field beint32 (fun t -> t.mask) |> sealr
|
record (fun mask -> { mask }) |+ field beint32 (fun t -> t.mask) |> sealr
|
||||||
end
|
end
|
||||||
|
|
||||||
(* TODO not in doc
|
(* TODO TALER doc
|
||||||
dummy impl
|
should be in doc
|
||||||
struct TALER_BlindingMasterSecretP blinding_seed; *)
|
found in src/include/taler/taler_amount_lib.h
|
||||||
module Blinding_master_secret_p = MAKE_H (Hash_code)
|
|
||||||
|
|
||||||
(* TODO not in doc
|
why is the non-NBO version only used in TALER_WithdrawRequestPS?
|
||||||
struct TALER_Amount amount; *)
|
GNUNET_PACKED?
|
||||||
module Amount = MAKE_H (Hash_code)
|
|
||||||
|
can be set to "invalid" if currency = all 0 *)
|
||||||
|
(*
|
||||||
|
/**
|
||||||
|
* @brief Number of characters (plus 1 for 0-termination) we use to
|
||||||
|
* represent currency names (i.e. EUR, USD, etc.). We use 8+4 for
|
||||||
|
* alignment in the `struct TALER_Amount`. The amount is typically an
|
||||||
|
* ISO 4217 currency code when an alphanumeric 3-digit code is used.
|
||||||
|
* For regional currencies, the first character should be a "*" followed
|
||||||
|
* by a region-specific name (i.e. "*BRETAGNEFR").
|
||||||
|
*/
|
||||||
|
#define TALER_CURRENCY_LEN 12
|
||||||
|
|
||||||
|
struct TALER_AmountNBO
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Value in the main currency, in NBO.
|
||||||
|
*/
|
||||||
|
uint64_t value GNUNET_PACKED;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fraction (integer multiples of #TALER_AMOUNT_FRAC_BASE), in NBO.
|
||||||
|
*/
|
||||||
|
uint32_t fraction GNUNET_PACKED;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Type of the currency being represented.
|
||||||
|
*/
|
||||||
|
char currency[TALER_CURRENCY_LEN];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct TALER_Amount
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Value (numerator of fraction)
|
||||||
|
*/
|
||||||
|
uint64_t value;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fraction (integer multiples of #TALER_AMOUNT_FRAC_BASE).
|
||||||
|
*/
|
||||||
|
uint32_t fraction;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Currency string, left adjusted and padded with zeros. All zeros
|
||||||
|
* for "invalid" values.
|
||||||
|
*/
|
||||||
|
char currency[TALER_CURRENCY_LEN];
|
||||||
|
};
|
||||||
|
*)
|
||||||
|
let currency_len = 12
|
||||||
|
|
||||||
|
module Amount = struct
|
||||||
|
type t = {
|
||||||
|
value: int64;
|
||||||
|
fraction: int32;
|
||||||
|
currency: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
(* TODO BE here? *)
|
||||||
|
let bin =
|
||||||
|
let open Bin in
|
||||||
|
record (fun value fraction currency -> { value; fraction; currency })
|
||||||
|
|+ field beint64 (fun t -> t.value)
|
||||||
|
|+ field beint32 (fun t -> t.fraction)
|
||||||
|
|+ field (bytes currency_len) (fun t -> t.currency)
|
||||||
|
|> sealr
|
||||||
|
end
|
||||||
|
|
||||||
|
module AmountNBO = struct
|
||||||
|
type t = {
|
||||||
|
value: int64;
|
||||||
|
fraction: int32;
|
||||||
|
currency: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
let bin =
|
||||||
|
let open Bin in
|
||||||
|
record (fun value fraction currency -> { value; fraction; currency })
|
||||||
|
|+ field beint64 (fun t -> t.value)
|
||||||
|
|+ field beint32 (fun t -> t.fraction)
|
||||||
|
|+ field (bytes currency_len) (fun t -> t.currency)
|
||||||
|
|> sealr
|
||||||
|
end
|
||||||
|
|
||||||
(* Format used for to generate the signature on a request to withdraw
|
(* Format used for to generate the signature on a request to withdraw
|
||||||
coins from a reserve. *)
|
coins from a reserve. *)
|
||||||
|
|
@ -348,7 +430,9 @@ module Withdraw_request_ps = struct
|
||||||
h_planchets: Hash_planchets_p.t;
|
h_planchets: Hash_planchets_p.t;
|
||||||
(* The master seed that was used in the call to /blinding-prepare blinding,
|
(* The master seed that was used in the call to /blinding-prepare blinding,
|
||||||
or all zeros, if no denomination of cipher type Clause-Schnorr is used. *)
|
or all zeros, if no denomination of cipher type Clause-Schnorr is used. *)
|
||||||
blinding_seed: Blinding_master_secret_p.t;
|
(* TODO TALER doc
|
||||||
|
`TALER_BlindingMasterSecretP` in doc, but probably TALER_BlindingMasterSeed *)
|
||||||
|
blinding_seed: string;
|
||||||
(* If age restriction proof is required, the maximum age _group_
|
(* If age restriction proof is required, the maximum age _group_
|
||||||
to commit to, 0 otherwise. Note that in this case, all
|
to commit to, 0 otherwise. Note that in this case, all
|
||||||
denominations for all coins MUST support age restriction.
|
denominations for all coins MUST support age restriction.
|
||||||
|
|
@ -379,8 +463,38 @@ module Withdraw_request_ps = struct
|
||||||
|+ field Amount.bin (fun t -> t.amount)
|
|+ field Amount.bin (fun t -> t.amount)
|
||||||
|+ field Amount.bin (fun t -> t.fee)
|
|+ field Amount.bin (fun t -> t.fee)
|
||||||
|+ field Hash_planchets_p.bin (fun t -> t.h_planchets)
|
|+ field Hash_planchets_p.bin (fun t -> t.h_planchets)
|
||||||
|+ field Blinding_master_secret_p.bin (fun t -> t.blinding_seed)
|
|+ field cstring (fun t -> t.blinding_seed)
|
||||||
|+ field beint32 (fun t -> t.max_age_group)
|
|+ field beint32 (fun t -> t.max_age_group)
|
||||||
|+ field Age_mask.bin (fun t -> t.mask)
|
|+ field Age_mask.bin (fun t -> t.mask)
|
||||||
|> sealr
|
|> sealr
|
||||||
end
|
end
|
||||||
|
|
||||||
|
module Withdraw_confirmation_ps = struct
|
||||||
|
type t = {
|
||||||
|
(* Purpose is #TALER_SIGNATURE_EXCHANGE_CONFIRM_WITHDRAW.
|
||||||
|
Signed by a `struct TALER_ExchangePrivateKeyP` using EdDSA. *)
|
||||||
|
purpose: Ecc_signature_purpose.t;
|
||||||
|
(* Commitment made in the /withdraw request.
|
||||||
|
Also needed for the /reveal-withdraw endpoint (in case
|
||||||
|
of required proof of age restriction) and for /recoup *)
|
||||||
|
(* TODO TALER doc
|
||||||
|
missing TALER_HashBlindedPlanchetsP*)
|
||||||
|
h_planchets: Hash_planchets_p.t;
|
||||||
|
(* If proof of age restriction is not required for to this
|
||||||
|
withdrawal, (i.e. max_age was not set during the request)
|
||||||
|
MUST be 0xFFFFFFFF.
|
||||||
|
Otherwise (i.e. proof of age restriction required):
|
||||||
|
index that the client will not have to reveal, in NBO,
|
||||||
|
MUST be smaller than #TALER_CNC_KAPPA. *)
|
||||||
|
noreveal_index: int32;
|
||||||
|
}
|
||||||
|
|
||||||
|
let bin =
|
||||||
|
let open Bin in
|
||||||
|
record (fun purpose h_planchets noreveal_index ->
|
||||||
|
{ purpose; h_planchets; noreveal_index })
|
||||||
|
|+ field Ecc_signature_purpose.bin (fun t -> t.purpose)
|
||||||
|
|+ field Hash_planchets_p.bin (fun t -> t.h_planchets)
|
||||||
|
|+ field beint32 (fun t -> t.noreveal_index)
|
||||||
|
|> sealr
|
||||||
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue