This commit is contained in:
parent
83d053e900
commit
c28f708fc0
1 changed files with 33 additions and 18 deletions
|
|
@ -4,7 +4,8 @@
|
||||||
|
|
||||||
open Include
|
open Include
|
||||||
|
|
||||||
(* TODO test *)
|
let int32_size = 4
|
||||||
|
let int64_size = 8
|
||||||
|
|
||||||
(* -- Time -- *)
|
(* -- Time -- *)
|
||||||
|
|
||||||
|
|
@ -13,6 +14,8 @@ module Time = struct
|
||||||
type t = { timestamp_us: int64 }
|
type t = { timestamp_us: int64 }
|
||||||
type t_nbo = { abs_value_us__: int64 }
|
type t_nbo = { abs_value_us__: int64 }
|
||||||
|
|
||||||
|
let size = int64_size
|
||||||
|
|
||||||
(* not BE here? never used? *)
|
(* not BE here? never used? *)
|
||||||
let bin =
|
let bin =
|
||||||
let open Bin in
|
let open Bin in
|
||||||
|
|
@ -31,6 +34,8 @@ module Time = struct
|
||||||
type t = { timestamp_us: int64 }
|
type t = { timestamp_us: int64 }
|
||||||
type t_nbo = { rel_value_us__: int64 }
|
type t_nbo = { rel_value_us__: int64 }
|
||||||
|
|
||||||
|
let size = int64_size
|
||||||
|
|
||||||
let bin =
|
let bin =
|
||||||
let open Bin in
|
let open Bin in
|
||||||
record (fun timestamp_us -> { timestamp_us })
|
record (fun timestamp_us -> { timestamp_us })
|
||||||
|
|
@ -142,24 +147,18 @@ module Exchange_signature_p = MK_64 ()
|
||||||
module Master_public_key_p = MK_32 ()
|
module Master_public_key_p = MK_32 ()
|
||||||
module Master_private_key_p = MK_32 ()
|
module Master_private_key_p = MK_32 ()
|
||||||
module Master_signature_p = MK_64 ()
|
module Master_signature_p = MK_64 ()
|
||||||
|
module Wire_transfert_identifier_raw_p = MK_BASIC_32 ()
|
||||||
module Wire_transfert_identifier_raw_p = struct
|
|
||||||
(* uint8_t raw[32]; *)
|
|
||||||
type t = { raw: string }
|
|
||||||
|
|
||||||
let bin =
|
|
||||||
let open Bin in
|
|
||||||
record (fun raw -> { raw }) |+ field (bytes 32) (fun t -> t.raw) |> sealr
|
|
||||||
end
|
|
||||||
|
|
||||||
module UUID = struct
|
module UUID = struct
|
||||||
(* uint32_t value[4]; *)
|
(* uint32_t value[4]; *)
|
||||||
type t = { value: string }
|
type t = { value: string }
|
||||||
|
|
||||||
|
let size = 4 * int32_size
|
||||||
|
|
||||||
let bin =
|
let bin =
|
||||||
let open Bin in
|
let open Bin in
|
||||||
record (fun value -> { value })
|
record (fun value -> { value })
|
||||||
|+ field (bytes (4 * 4)) (fun t -> t.value)
|
|+ field (bytes size) (fun t -> t.value)
|
||||||
|> sealr
|
|> sealr
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -167,11 +166,11 @@ module Wad_id = struct
|
||||||
(* uint32_t value[6]; *)
|
(* uint32_t value[6]; *)
|
||||||
type t = { raw: string }
|
type t = { raw: string }
|
||||||
|
|
||||||
|
let size = 6 * int32_size
|
||||||
|
|
||||||
let bin =
|
let bin =
|
||||||
let open Bin in
|
let open Bin in
|
||||||
record (fun raw -> { raw })
|
record (fun raw -> { raw }) |+ field (bytes size) (fun t -> t.raw) |> sealr
|
||||||
|+ field (bytes (4 * 6)) (fun t -> t.raw)
|
|
||||||
|> sealr
|
|
||||||
end
|
end
|
||||||
|
|
||||||
(* TODO not sure what to do of union, probably not needed *)
|
(* TODO not sure what to do of union, probably not needed *)
|
||||||
|
|
@ -227,7 +226,7 @@ module Purpose = struct
|
||||||
purpose: int32;
|
purpose: int32;
|
||||||
}
|
}
|
||||||
|
|
||||||
let size = 4 + 4
|
let size = 2 * int32_size
|
||||||
|
|
||||||
let bin =
|
let bin =
|
||||||
let open Bin in
|
let open Bin in
|
||||||
|
|
@ -261,6 +260,8 @@ module Hash_planchets_p = MK_64 ()
|
||||||
module Age_mask = struct
|
module Age_mask = struct
|
||||||
type t = { mask: int32 }
|
type t = { mask: int32 }
|
||||||
|
|
||||||
|
let size = int32_size
|
||||||
|
|
||||||
let bin =
|
let bin =
|
||||||
let open Bin in
|
let open Bin in
|
||||||
record (fun mask -> { mask }) |+ field beint32 (fun t -> t.mask) |> sealr
|
record (fun mask -> { mask }) |+ field beint32 (fun t -> t.mask) |> sealr
|
||||||
|
|
@ -331,6 +332,8 @@ module Amount = struct
|
||||||
currency: string;
|
currency: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let size = int64_size + int32_size + currency_len
|
||||||
|
|
||||||
(* TODO BE here? *)
|
(* TODO BE here? *)
|
||||||
let bin =
|
let bin =
|
||||||
let open Bin in
|
let open Bin in
|
||||||
|
|
@ -348,6 +351,8 @@ module AmountNBO = struct
|
||||||
currency: string;
|
currency: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let size = int64_size + int32_size + currency_len
|
||||||
|
|
||||||
let bin =
|
let bin =
|
||||||
let open Bin in
|
let open Bin in
|
||||||
record (fun value fraction currency -> { value; fraction; currency })
|
record (fun value fraction currency -> { value; fraction; currency })
|
||||||
|
|
@ -357,6 +362,8 @@ module AmountNBO = struct
|
||||||
|> sealr
|
|> sealr
|
||||||
end
|
end
|
||||||
|
|
||||||
|
module Blinding_master_seed = MK_BASIC_32 ()
|
||||||
|
|
||||||
(* 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. *)
|
||||||
module Withdraw_request_ps = struct
|
module Withdraw_request_ps = struct
|
||||||
|
|
@ -390,7 +397,7 @@ module Withdraw_request_ps = struct
|
||||||
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. *)
|
||||||
(* TODO TALER doc
|
(* TODO TALER doc
|
||||||
`TALER_BlindingMasterSecretP` in doc, but probably TALER_BlindingMasterSeed *)
|
`TALER_BlindingMasterSecretP` in doc, but probably TALER_BlindingMasterSeed *)
|
||||||
blinding_seed: string;
|
blinding_seed: Blinding_master_seed.t;
|
||||||
(* 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.
|
||||||
|
|
@ -404,6 +411,14 @@ module Withdraw_request_ps = struct
|
||||||
mask: Age_mask.t;
|
mask: Age_mask.t;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let size =
|
||||||
|
Purpose.size
|
||||||
|
+ (2 * Amount.size)
|
||||||
|
+ Hash_planchets_p.size
|
||||||
|
+ Blinding_master_seed.size
|
||||||
|
+ int32_size
|
||||||
|
+ Age_mask.size
|
||||||
|
|
||||||
let bin =
|
let bin =
|
||||||
let open Bin in
|
let open Bin in
|
||||||
record
|
record
|
||||||
|
|
@ -421,7 +436,7 @@ 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 cstring (fun t -> t.blinding_seed)
|
|+ field Blinding_master_seed.bin (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
|
||||||
|
|
@ -446,7 +461,7 @@ module Withdraw_confirmation_ps = struct
|
||||||
noreveal_index: int32;
|
noreveal_index: int32;
|
||||||
}
|
}
|
||||||
|
|
||||||
let size = Purpose.size + Hash_planchets_p.size + 4
|
let size = Purpose.size + Hash_planchets_p.size + int32_size
|
||||||
let purpose = Purpose.make size Taler_signatures.exchange_confirm_withdraw
|
let purpose = Purpose.make size Taler_signatures.exchange_confirm_withdraw
|
||||||
|
|
||||||
let bin =
|
let bin =
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue