JJ: Description from the destination commit:
add hash.ml JJ: Description from source commit: .
This commit is contained in:
parent
55ccc6f18a
commit
6353c885f7
11 changed files with 187 additions and 188 deletions
|
|
@ -24,13 +24,12 @@
|
||||||
open Crypto
|
open Crypto
|
||||||
open Bin_sig
|
open Bin_sig
|
||||||
open Jsont.Object
|
open Jsont.Object
|
||||||
|
module DenominationHash = Hash.DenominationHash
|
||||||
|
|
||||||
let encode_exn jsont v = Jsont_bytesrw.encode_string jsont v |> Result.get_ok
|
let encode_exn jsont v = Jsont_bytesrw.encode_string jsont v |> Result.get_ok
|
||||||
let encode jsont v = Jsont_bytesrw.encode_string jsont v
|
let encode jsont v = Jsont_bytesrw.encode_string jsont v
|
||||||
let decode jsont v = Jsont_bytesrw.decode_string jsont v
|
let decode jsont v = Jsont_bytesrw.decode_string jsont v
|
||||||
|
|
||||||
module DenominationHash = Bin_type.DenominationHash
|
|
||||||
|
|
||||||
module Account_operation = struct
|
module Account_operation = struct
|
||||||
type t =
|
type t =
|
||||||
| Withdraw
|
| Withdraw
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
(* Packed Signature *)
|
(* Packed Signature *)
|
||||||
|
|
||||||
open Bin_type
|
open Bin_type
|
||||||
|
open Hash
|
||||||
|
|
||||||
module Aliases = struct
|
module Aliases = struct
|
||||||
module Timestamp = struct
|
module Timestamp = struct
|
||||||
|
|
@ -139,7 +140,7 @@ module DenominationKeyAnnouncement = struct
|
||||||
(* purpose.purpose = TALER_SIGNATURE_SM_DENOMINATION_KEY *)
|
(* purpose.purpose = TALER_SIGNATURE_SM_DENOMINATION_KEY *)
|
||||||
type r = {
|
type r = {
|
||||||
h_denom_pub: DenominationHash.t;
|
h_denom_pub: DenominationHash.t;
|
||||||
h_section_name: Hash_64_cstr.t;
|
h_section_name: Hash.Cstring.H64.t;
|
||||||
anchor_time: TimestampNBO.t;
|
anchor_time: TimestampNBO.t;
|
||||||
duration_withdraw: TimeRelativeNBO.t;
|
duration_withdraw: TimeRelativeNBO.t;
|
||||||
}
|
}
|
||||||
|
|
@ -154,7 +155,7 @@ module DenominationKeyAnnouncement = struct
|
||||||
{ h_denom_pub; h_section_name; anchor_time; duration_withdraw })
|
{ h_denom_pub; h_section_name; anchor_time; duration_withdraw })
|
||||||
|+ Purpose.field purpose
|
|+ Purpose.field purpose
|
||||||
|+ field DenominationHash.bin (fun t -> t.h_denom_pub)
|
|+ field DenominationHash.bin (fun t -> t.h_denom_pub)
|
||||||
|+ field Hash_64_cstr.bin (fun t -> t.h_section_name)
|
|+ field Hash.Cstring.H64.bin (fun t -> t.h_section_name)
|
||||||
|+ field TimestampNBO.bin (fun t -> t.anchor_time)
|
|+ field TimestampNBO.bin (fun t -> t.anchor_time)
|
||||||
|+ field TimeRelativeNBO.bin (fun t -> t.duration_withdraw)
|
|+ field TimeRelativeNBO.bin (fun t -> t.duration_withdraw)
|
||||||
|> sealr
|
|> sealr
|
||||||
|
|
@ -325,7 +326,7 @@ module MasterAddAuditor = struct
|
||||||
type r = {
|
type r = {
|
||||||
start_date: TimestampNBO.t;
|
start_date: TimestampNBO.t;
|
||||||
auditor_pub: AuditorPublicKeyP.t;
|
auditor_pub: AuditorPublicKeyP.t;
|
||||||
h_auditor_url: Hash_64_cstr.t;
|
h_auditor_url: Hash.Cstring.H64.t;
|
||||||
}
|
}
|
||||||
|
|
||||||
let bin =
|
let bin =
|
||||||
|
|
@ -336,7 +337,7 @@ module MasterAddAuditor = struct
|
||||||
|+ Purpose.field purpose
|
|+ Purpose.field purpose
|
||||||
|+ field TimestampNBO.bin (fun t -> t.start_date)
|
|+ field TimestampNBO.bin (fun t -> t.start_date)
|
||||||
|+ field AuditorPublicKeyP.bin (fun t -> t.auditor_pub)
|
|+ field AuditorPublicKeyP.bin (fun t -> t.auditor_pub)
|
||||||
|+ field Hash_64_cstr.bin (fun t -> t.h_auditor_url)
|
|+ field Hash.Cstring.H64.bin (fun t -> t.h_auditor_url)
|
||||||
|> sealr
|
|> sealr
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -434,9 +435,9 @@ module MasterWireDetails = struct
|
||||||
(* purpose.purpose = TALER_SIGNATURE_MASTER_WIRE_DETAILS *)
|
(* purpose.purpose = TALER_SIGNATURE_MASTER_WIRE_DETAILS *)
|
||||||
type r = {
|
type r = {
|
||||||
h_wire_details: FullPaytoHash.t;
|
h_wire_details: FullPaytoHash.t;
|
||||||
h_conversion_url: Hash_64_cstr.t;
|
h_conversion_url: Hash.Cstring.H64.t;
|
||||||
h_credit_restrictions: Hash_64_cstr.t;
|
h_credit_restrictions: Hash.Cstring.H64.t;
|
||||||
h_debit_restrictions: Hash_64_cstr.t;
|
h_debit_restrictions: Hash.Cstring.H64.t;
|
||||||
}
|
}
|
||||||
|
|
||||||
let bin =
|
let bin =
|
||||||
|
|
@ -458,9 +459,9 @@ module MasterWireDetails = struct
|
||||||
})
|
})
|
||||||
|+ Purpose.field purpose
|
|+ Purpose.field purpose
|
||||||
|+ field FullPaytoHash.bin (fun t -> t.h_wire_details)
|
|+ field FullPaytoHash.bin (fun t -> t.h_wire_details)
|
||||||
|+ field Hash_64_cstr.bin (fun t -> t.h_conversion_url)
|
|+ field Hash.Cstring.H64.bin (fun t -> t.h_conversion_url)
|
||||||
|+ field Hash_64_cstr.bin (fun t -> t.h_credit_restrictions)
|
|+ field Hash.Cstring.H64.bin (fun t -> t.h_credit_restrictions)
|
||||||
|+ field Hash_64_cstr.bin (fun t -> t.h_debit_restrictions)
|
|+ field Hash.Cstring.H64.bin (fun t -> t.h_debit_restrictions)
|
||||||
|> sealr
|
|> sealr
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -474,9 +475,9 @@ module MasterAddWire = struct
|
||||||
type r = {
|
type r = {
|
||||||
start_date: TimestampNBO.t;
|
start_date: TimestampNBO.t;
|
||||||
h_wire: FullPaytoHash.t;
|
h_wire: FullPaytoHash.t;
|
||||||
h_conversion_url: Hash_64_cstr.t;
|
h_conversion_url: Hash.Cstring.H64.t;
|
||||||
h_credit_restrictions: Hash_64_cstr.t;
|
h_credit_restrictions: Hash.Cstring.H64.t;
|
||||||
h_debit_restrictions: Hash_64_cstr.t;
|
h_debit_restrictions: Hash.Cstring.H64.t;
|
||||||
}
|
}
|
||||||
|
|
||||||
let bin =
|
let bin =
|
||||||
|
|
@ -501,9 +502,9 @@ module MasterAddWire = struct
|
||||||
|+ Purpose.field _purpose
|
|+ Purpose.field _purpose
|
||||||
|+ field TimestampNBO.bin (fun t -> t.start_date)
|
|+ field TimestampNBO.bin (fun t -> t.start_date)
|
||||||
|+ field FullPaytoHash.bin (fun t -> t.h_wire)
|
|+ field FullPaytoHash.bin (fun t -> t.h_wire)
|
||||||
|+ field Hash_64_cstr.bin (fun t -> t.h_conversion_url)
|
|+ field Hash.Cstring.H64.bin (fun t -> t.h_conversion_url)
|
||||||
|+ field Hash_64_cstr.bin (fun t -> t.h_credit_restrictions)
|
|+ field Hash.Cstring.H64.bin (fun t -> t.h_credit_restrictions)
|
||||||
|+ field Hash_64_cstr.bin (fun t -> t.h_debit_restrictions)
|
|+ field Hash.Cstring.H64.bin (fun t -> t.h_debit_restrictions)
|
||||||
|> sealr
|
|> sealr
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -540,7 +541,7 @@ module MasterDrainProfit = struct
|
||||||
wtid: WireTransferIdentifierRawP.t;
|
wtid: WireTransferIdentifierRawP.t;
|
||||||
date: TimestampNBO.t;
|
date: TimestampNBO.t;
|
||||||
amount: AmountNBO.t;
|
amount: AmountNBO.t;
|
||||||
h_section: Hash_64_cstr.t;
|
h_section: Hash.Cstring.H64.t;
|
||||||
h_payto: FullPaytoHash.t;
|
h_payto: FullPaytoHash.t;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -553,7 +554,7 @@ module MasterDrainProfit = struct
|
||||||
|+ field WireTransferIdentifierRawP.bin (fun t -> t.wtid)
|
|+ field WireTransferIdentifierRawP.bin (fun t -> t.wtid)
|
||||||
|+ field TimestampNBO.bin (fun t -> t.date)
|
|+ field TimestampNBO.bin (fun t -> t.date)
|
||||||
|+ field AmountNBO.bin (fun t -> t.amount)
|
|+ field AmountNBO.bin (fun t -> t.amount)
|
||||||
|+ field Hash_64_cstr.bin (fun t -> t.h_section)
|
|+ field Hash.Cstring.H64.bin (fun t -> t.h_section)
|
||||||
|+ field FullPaytoHash.bin (fun t -> t.h_payto)
|
|+ field FullPaytoHash.bin (fun t -> t.h_payto)
|
||||||
|> sealr
|
|> sealr
|
||||||
end
|
end
|
||||||
|
|
@ -568,7 +569,7 @@ module MasterAmlOfficerStatus = struct
|
||||||
type r = {
|
type r = {
|
||||||
change_date: TimestampNBO.t;
|
change_date: TimestampNBO.t;
|
||||||
officer_pub: AmlOfficerPublicKeyP.t;
|
officer_pub: AmlOfficerPublicKeyP.t;
|
||||||
h_officer_name: Hash_64_cstr.t;
|
h_officer_name: Hash.Cstring.H64.t;
|
||||||
is_active: int32;
|
is_active: int32;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -580,7 +581,7 @@ module MasterAmlOfficerStatus = struct
|
||||||
|+ Purpose.field _purpose
|
|+ Purpose.field _purpose
|
||||||
|+ field TimestampNBO.bin (fun t -> t.change_date)
|
|+ field TimestampNBO.bin (fun t -> t.change_date)
|
||||||
|+ field AmlOfficerPublicKeyP.bin (fun t -> t.officer_pub)
|
|+ field AmlOfficerPublicKeyP.bin (fun t -> t.officer_pub)
|
||||||
|+ field Hash_64_cstr.bin (fun t -> t.h_officer_name)
|
|+ field Hash.Cstring.H64.bin (fun t -> t.h_officer_name)
|
||||||
|+ field beint32 (fun t -> t.is_active)
|
|+ field beint32 (fun t -> t.is_active)
|
||||||
|> sealr
|
|> sealr
|
||||||
end
|
end
|
||||||
|
|
@ -600,7 +601,7 @@ module PartnerConfiguration = struct
|
||||||
end_date: TimestampNBO.t;
|
end_date: TimestampNBO.t;
|
||||||
wad_frequency: TimeRelativeNBO.t;
|
wad_frequency: TimeRelativeNBO.t;
|
||||||
wad_fee: AmountNBO.t;
|
wad_fee: AmountNBO.t;
|
||||||
h_url: Hash_64_cstr.t;
|
h_url: Hash.Cstring.H64.t;
|
||||||
}
|
}
|
||||||
|
|
||||||
let bin =
|
let bin =
|
||||||
|
|
@ -623,7 +624,7 @@ module PartnerConfiguration = struct
|
||||||
|+ field TimestampNBO.bin (fun t -> t.end_date)
|
|+ field TimestampNBO.bin (fun t -> t.end_date)
|
||||||
|+ field TimeRelativeNBO.bin (fun t -> t.wad_frequency)
|
|+ field TimeRelativeNBO.bin (fun t -> t.wad_frequency)
|
||||||
|+ field AmountNBO.bin (fun t -> t.wad_fee)
|
|+ field AmountNBO.bin (fun t -> t.wad_fee)
|
||||||
|+ field Hash_64_cstr.bin (fun t -> t.h_url)
|
|+ field Hash.Cstring.H64.bin (fun t -> t.h_url)
|
||||||
|> sealr
|
|> sealr
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -635,7 +636,7 @@ module WadPartnerSignature = struct
|
||||||
module R = struct
|
module R = struct
|
||||||
(* purpose.purpose = TALER_SIGNATURE_MASTER_PARTNER_DETAILS *)
|
(* purpose.purpose = TALER_SIGNATURE_MASTER_PARTNER_DETAILS *)
|
||||||
type r = {
|
type r = {
|
||||||
h_partner_base_url: Hash_64_cstr.t;
|
h_partner_base_url: Hash.Cstring.H64.t;
|
||||||
master_public_key: MasterPublicKeyP.t;
|
master_public_key: MasterPublicKeyP.t;
|
||||||
start_date: TimestampNBO.t;
|
start_date: TimestampNBO.t;
|
||||||
end_date: TimestampNBO.t;
|
end_date: TimestampNBO.t;
|
||||||
|
|
@ -666,7 +667,7 @@ module WadPartnerSignature = struct
|
||||||
wad_frequency;
|
wad_frequency;
|
||||||
})
|
})
|
||||||
|+ Purpose.field _purpose
|
|+ Purpose.field _purpose
|
||||||
|+ field Hash_64_cstr.bin (fun t -> t.h_partner_base_url)
|
|+ field Hash.Cstring.H64.bin (fun t -> t.h_partner_base_url)
|
||||||
|+ field MasterPublicKeyP.bin (fun t -> t.master_public_key)
|
|+ field MasterPublicKeyP.bin (fun t -> t.master_public_key)
|
||||||
|+ field TimestampNBO.bin (fun t -> t.start_date)
|
|+ field TimestampNBO.bin (fun t -> t.start_date)
|
||||||
|+ field TimestampNBO.bin (fun t -> t.end_date)
|
|+ field TimestampNBO.bin (fun t -> t.end_date)
|
||||||
|
|
@ -683,7 +684,7 @@ module MasterWireFee = struct
|
||||||
module R = struct
|
module R = struct
|
||||||
(* purpose.purpose = TALER_SIGNATURE_MASTER_WIRE_FEES *)
|
(* purpose.purpose = TALER_SIGNATURE_MASTER_WIRE_FEES *)
|
||||||
type r = {
|
type r = {
|
||||||
h_wire_method: Hash_64_cstr.t;
|
h_wire_method: Hash.Cstring.H64.t;
|
||||||
start_date: TimestampNBO.t;
|
start_date: TimestampNBO.t;
|
||||||
end_date: TimestampNBO.t;
|
end_date: TimestampNBO.t;
|
||||||
wire_fee: AmountNBO.t;
|
wire_fee: AmountNBO.t;
|
||||||
|
|
@ -697,7 +698,7 @@ module MasterWireFee = struct
|
||||||
(fun _purpose h_wire_method start_date end_date wire_fee closing_fee ->
|
(fun _purpose h_wire_method start_date end_date wire_fee closing_fee ->
|
||||||
{ h_wire_method; start_date; end_date; wire_fee; closing_fee })
|
{ h_wire_method; start_date; end_date; wire_fee; closing_fee })
|
||||||
|+ Purpose.field _purpose
|
|+ Purpose.field _purpose
|
||||||
|+ field Hash_64_cstr.bin (fun t -> t.h_wire_method)
|
|+ field Hash.Cstring.H64.bin (fun t -> t.h_wire_method)
|
||||||
|+ field TimestampNBO.bin (fun t -> t.start_date)
|
|+ field TimestampNBO.bin (fun t -> t.start_date)
|
||||||
|+ field TimestampNBO.bin (fun t -> t.end_date)
|
|+ field TimestampNBO.bin (fun t -> t.end_date)
|
||||||
|+ field AmountNBO.bin (fun t -> t.wire_fee)
|
|+ field AmountNBO.bin (fun t -> t.wire_fee)
|
||||||
|
|
@ -713,7 +714,7 @@ module ExchangeKeyValidity = struct
|
||||||
module R = struct
|
module R = struct
|
||||||
(* purpose.purpose = TALER_SIGNATURE_AUDITOR_EXCHANGE_KEYS *)
|
(* purpose.purpose = TALER_SIGNATURE_AUDITOR_EXCHANGE_KEYS *)
|
||||||
type r = {
|
type r = {
|
||||||
auditor_url_hash: Hash_64_cstr.t;
|
auditor_url_hash: Hash.Cstring.H64.t;
|
||||||
master: MasterPublicKeyP.t;
|
master: MasterPublicKeyP.t;
|
||||||
start: TimestampNBO.t;
|
start: TimestampNBO.t;
|
||||||
expire_withdraw: TimestampNBO.t;
|
expire_withdraw: TimestampNBO.t;
|
||||||
|
|
@ -758,7 +759,7 @@ module ExchangeKeyValidity = struct
|
||||||
denom_hash;
|
denom_hash;
|
||||||
})
|
})
|
||||||
|+ Purpose.field _purpose
|
|+ Purpose.field _purpose
|
||||||
|+ field Hash_64_cstr.bin (fun t -> t.auditor_url_hash)
|
|+ field Hash.Cstring.H64.bin (fun t -> t.auditor_url_hash)
|
||||||
|+ field MasterPublicKeyP.bin (fun t -> t.master)
|
|+ field MasterPublicKeyP.bin (fun t -> t.master)
|
||||||
|+ field TimestampNBO.bin (fun t -> t.start)
|
|+ field TimestampNBO.bin (fun t -> t.start)
|
||||||
|+ field TimestampNBO.bin (fun t -> t.expire_withdraw)
|
|+ field TimestampNBO.bin (fun t -> t.expire_withdraw)
|
||||||
|
|
@ -781,7 +782,8 @@ module ExchangeKeySet = struct
|
||||||
(* purpose.purpose = TALER_SIGNATURE_EXCHANGE_KEY_SET *)
|
(* purpose.purpose = TALER_SIGNATURE_EXCHANGE_KEY_SET *)
|
||||||
type r = {
|
type r = {
|
||||||
list_issue_date: TimestampNBO.t;
|
list_issue_date: TimestampNBO.t;
|
||||||
hc: Hash_64.t;
|
(* hash over a concatenation of master_sigs *)
|
||||||
|
hc: H64.t;
|
||||||
}
|
}
|
||||||
|
|
||||||
let bin =
|
let bin =
|
||||||
|
|
@ -790,7 +792,7 @@ module ExchangeKeySet = struct
|
||||||
record (fun _purpose list_issue_date hc -> { list_issue_date; hc })
|
record (fun _purpose list_issue_date hc -> { list_issue_date; hc })
|
||||||
|+ Purpose.field _purpose
|
|+ Purpose.field _purpose
|
||||||
|+ field TimestampNBO.bin (fun t -> t.list_issue_date)
|
|+ field TimestampNBO.bin (fun t -> t.list_issue_date)
|
||||||
|+ field Hash_64.bin (fun t -> t.hc)
|
|+ field H64.bin (fun t -> t.hc)
|
||||||
|> sealr
|
|> sealr
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -871,7 +873,7 @@ module DepositRequest = struct
|
||||||
amount_with_fee: AmountNBO.t;
|
amount_with_fee: AmountNBO.t;
|
||||||
deposit_fee: AmountNBO.t;
|
deposit_fee: AmountNBO.t;
|
||||||
merchant: MerchantPublicKeyP.t;
|
merchant: MerchantPublicKeyP.t;
|
||||||
wallet_data_hash: Hash_64_cstr.t;
|
wallet_data_hash: Hash.Cstring.H64.t;
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -934,7 +936,7 @@ module WireDepositData = struct
|
||||||
wire_fee: AmountNBO.t;
|
wire_fee: AmountNBO.t;
|
||||||
merchant_pub: MerchantPublicKeyP.t;
|
merchant_pub: MerchantPublicKeyP.t;
|
||||||
h_wire: MerchantWireHash.t;
|
h_wire: MerchantWireHash.t;
|
||||||
h_details: Hash_64_cstr.t;
|
h_details: Hash.Cstring.H64.t;
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -995,7 +997,7 @@ end
|
||||||
module MerchantRefundConfirmation = struct
|
module MerchantRefundConfirmation = struct
|
||||||
(* purpose.purpose = TALER_SIGNATURE_MERCHANT_REFUND_OK *)
|
(* purpose.purpose = TALER_SIGNATURE_MERCHANT_REFUND_OK *)
|
||||||
(* Hash of the order ID (a string), hashed without the 0-termination. *)
|
(* Hash of the order ID (a string), hashed without the 0-termination. *)
|
||||||
type t = { h_order_id: Hash_64_cstr.t }
|
type t = { h_order_id: Hash.Cstring.H64.t }
|
||||||
end
|
end
|
||||||
|
|
||||||
module RecoupRequest = struct
|
module RecoupRequest = struct
|
||||||
|
|
@ -1120,7 +1122,7 @@ module PurseDepositSignature = struct
|
||||||
h_denom_pub: DenominationHash.t;
|
h_denom_pub: DenominationHash.t;
|
||||||
h_age_commitment: AgeCommitmentHash.t;
|
h_age_commitment: AgeCommitmentHash.t;
|
||||||
purse_pub: PursePublicKey.t;
|
purse_pub: PursePublicKey.t;
|
||||||
h_exchange_base_url: Hash_64_cstr.t;
|
h_exchange_base_url: Hash.Cstring.H64.t;
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -1187,7 +1189,7 @@ module WadDataSignature = struct
|
||||||
type t = {
|
type t = {
|
||||||
wad_execution_time: TimestampNBO.t;
|
wad_execution_time: TimestampNBO.t;
|
||||||
total_amount: AmountNBO.t;
|
total_amount: AmountNBO.t;
|
||||||
h_items: Hash_64_cstr.t;
|
h_items: Hash.Cstring.H64.t;
|
||||||
wad_id: WadId.t;
|
wad_id: WadId.t;
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
@ -1220,11 +1222,11 @@ end
|
||||||
module AmlDecision = struct
|
module AmlDecision = struct
|
||||||
(* purpose.purpose = TALER_SIGNATURE_AML_DECISION *)
|
(* purpose.purpose = TALER_SIGNATURE_AML_DECISION *)
|
||||||
type t = {
|
type t = {
|
||||||
h_justification: Hash_64_cstr.t;
|
h_justification: Hash.Cstring.H64.t;
|
||||||
decision_time: TimestampNBO.t;
|
decision_time: TimestampNBO.t;
|
||||||
new_threshold: AmountNBO.t;
|
new_threshold: AmountNBO.t;
|
||||||
h_payto: NormalizedPaytoHash.t;
|
h_payto: NormalizedPaytoHash.t;
|
||||||
h_kyc_requirements: Hash_64_cstr.t;
|
h_kyc_requirements: Hash.Cstring.H64.t;
|
||||||
new_state: int;
|
new_state: int;
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
@ -1251,7 +1253,7 @@ module ReserveAttestRequest = struct
|
||||||
(* purpose.purpose = TALER_SIGNATURE_WALLET_ATTEST_REQUEST *)
|
(* purpose.purpose = TALER_SIGNATURE_WALLET_ATTEST_REQUEST *)
|
||||||
type t = {
|
type t = {
|
||||||
request_timestamp: TimestampNBO.t;
|
request_timestamp: TimestampNBO.t;
|
||||||
h_details: Hash_64_cstr.t;
|
h_details: Hash.Cstring.H64.t;
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -1261,6 +1263,6 @@ module ExchangeAttest = struct
|
||||||
attest_timestamp: TimestampNBO.t;
|
attest_timestamp: TimestampNBO.t;
|
||||||
expiration_time: TimestampNBO.t;
|
expiration_time: TimestampNBO.t;
|
||||||
reserve_pub: ReservePublicKeyP.t;
|
reserve_pub: ReservePublicKeyP.t;
|
||||||
h_attributes: Hash_64_cstr.t;
|
h_attributes: Hash.Cstring.H64.t;
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
|
||||||
118
src/bin_type.ml
118
src/bin_type.ml
|
|
@ -30,16 +30,6 @@
|
||||||
- better way to have module aliases?
|
- better way to have module aliases?
|
||||||
*)
|
*)
|
||||||
|
|
||||||
(* TODO hash and C(ancer)-terminated strings
|
|
||||||
|
|
||||||
- "A JSON object is canonicalized by converting it to an ASCII byte array
|
|
||||||
with the algorithm specified in RFC 8785. The resulting bytes are
|
|
||||||
terminated with a single 0-byte and then hashed with SHA512."
|
|
||||||
- from the code it looks like its the same for all stringy-strings
|
|
||||||
! not strings that are raw-bytes-data-like
|
|
||||||
? only for "HashCode" and "ShortHashCode"
|
|
||||||
*)
|
|
||||||
|
|
||||||
module Taler_signatures = Include.Taler_signatures
|
module Taler_signatures = Include.Taler_signatures
|
||||||
|
|
||||||
let int32_size = 4
|
let int32_size = 4
|
||||||
|
|
@ -59,114 +49,6 @@ end
|
||||||
|
|
||||||
(* -- Cryptographic primitives -- *)
|
(* -- Cryptographic primitives -- *)
|
||||||
|
|
||||||
(* Hashes *)
|
|
||||||
|
|
||||||
module Hash_32 = struct
|
|
||||||
type t = Digestif.SHA256.t
|
|
||||||
|
|
||||||
let hash s = Digestif.SHA256.(digest_string s)
|
|
||||||
|
|
||||||
let of_octets s =
|
|
||||||
match String.length s = 32 with
|
|
||||||
| false -> Fmt.failwith "Hash.of_octets failure: data is not 32 bytes"
|
|
||||||
| true -> Digestif.SHA256.of_raw_string s
|
|
||||||
|
|
||||||
let to_octets = Digestif.SHA256.to_raw_string
|
|
||||||
let of_b32 s = Result.map of_octets (B32.decode s)
|
|
||||||
|
|
||||||
let bin =
|
|
||||||
let open Bin in
|
|
||||||
map (bytes 32) of_octets to_octets
|
|
||||||
|
|
||||||
(* hashes are not b32 encoded in the database *)
|
|
||||||
let caqti : t Caqti_type.t =
|
|
||||||
let open Caqti_type in
|
|
||||||
custom
|
|
||||||
~encode:(fun v -> Ok (to_octets v))
|
|
||||||
~decode:(fun v -> Ok (of_octets v))
|
|
||||||
octets
|
|
||||||
|
|
||||||
let jsont =
|
|
||||||
let enc v = B32.encode (to_octets v) in
|
|
||||||
Jsont.of_of_string ~kind:"Hash 32" of_b32 ~enc
|
|
||||||
end
|
|
||||||
|
|
||||||
module Hash_64 = struct
|
|
||||||
type t = Digestif.SHA512.t
|
|
||||||
|
|
||||||
let hash s = Digestif.SHA512.(digest_string s)
|
|
||||||
|
|
||||||
let of_octets s =
|
|
||||||
match String.length s = 64 with
|
|
||||||
| false -> Fmt.failwith "Hash.of_octets failure: data is not 64 bytes"
|
|
||||||
| true -> Digestif.SHA512.of_raw_string s
|
|
||||||
|
|
||||||
let to_octets v =
|
|
||||||
let s = Digestif.SHA512.to_raw_string v in
|
|
||||||
match String.length s = 64 with
|
|
||||||
| false -> Fmt.failwith "Hash.to_octets failure: data is not 64 bytes"
|
|
||||||
| true -> s
|
|
||||||
|
|
||||||
let of_b32 s = Result.map of_octets (B32.decode s)
|
|
||||||
|
|
||||||
let bin =
|
|
||||||
let open Bin in
|
|
||||||
map (bytes 64) of_octets to_octets
|
|
||||||
|
|
||||||
(* hashes are not b32 encoded in the database *)
|
|
||||||
let caqti : t Caqti_type.t =
|
|
||||||
let open Caqti_type in
|
|
||||||
custom
|
|
||||||
~encode:(fun v -> Ok (to_octets v))
|
|
||||||
~decode:(fun v -> Ok (of_octets v))
|
|
||||||
octets
|
|
||||||
|
|
||||||
let jsont =
|
|
||||||
let enc v = B32.encode (to_octets v) in
|
|
||||||
Jsont.of_of_string ~kind:"Hash 64" of_b32 ~enc
|
|
||||||
end
|
|
||||||
|
|
||||||
(* Hash over string + '\0' *)
|
|
||||||
module Hash_32_cstr = struct
|
|
||||||
include Hash_32
|
|
||||||
|
|
||||||
let hash s =
|
|
||||||
let s = s ^ "\x00" in
|
|
||||||
Digestif.SHA256.(digest_string s)
|
|
||||||
end
|
|
||||||
|
|
||||||
module Hash_64_cstr = struct
|
|
||||||
include Hash_64
|
|
||||||
|
|
||||||
let hash s =
|
|
||||||
let s = s ^ "\x00" in
|
|
||||||
Digestif.SHA512.(digest_string s)
|
|
||||||
end
|
|
||||||
|
|
||||||
module type Hash_S = sig
|
|
||||||
type t
|
|
||||||
|
|
||||||
val bin : t Bin.t
|
|
||||||
val caqti : t Caqti_type.t
|
|
||||||
val jsont : t Jsont.t
|
|
||||||
val hash : string -> t
|
|
||||||
val of_octets : string -> t
|
|
||||||
val to_octets : t -> string
|
|
||||||
val of_b32 : B32.t -> (t, string) result
|
|
||||||
end
|
|
||||||
|
|
||||||
module FullPaytoHash : Hash_S = Hash_32
|
|
||||||
module NormalizedPaytoHash : Hash_S = Hash_32
|
|
||||||
module DenominationHash : Hash_S = Hash_64
|
|
||||||
module PrivateContractHash : Hash_S = Hash_64
|
|
||||||
module ExtensionsPolicyHash : Hash_S = Hash_64
|
|
||||||
module MerchantWireHash : Hash_S = Hash_64
|
|
||||||
module AgeCommitmentHash : Hash_S = Hash_64
|
|
||||||
module BlindedCoinHash : Hash_S = Hash_64
|
|
||||||
module CoinPubHash : Hash_S = Hash_64
|
|
||||||
module OutputCommitmentHash : Hash_S = Hash_64
|
|
||||||
module HashPlanchetsP : Hash_S = Hash_64
|
|
||||||
|
|
||||||
(* --- Various --- *)
|
(* --- Various --- *)
|
||||||
|
|
||||||
module TransferSecretP = Bytes_64
|
module TransferSecretP = Bytes_64
|
||||||
|
|
|
||||||
|
|
@ -207,4 +207,4 @@ type eddsa_sig = EddsaSignature.t
|
||||||
type rsa_priv = RsaPrivateKey.t
|
type rsa_priv = RsaPrivateKey.t
|
||||||
type rsa_pub = RsaPublicKey.t
|
type rsa_pub = RsaPublicKey.t
|
||||||
type rsa_sig = RsaSignature.t
|
type rsa_sig = RsaSignature.t
|
||||||
type denomination_hash = Bin_type.DenominationHash.t
|
type denomination_hash = Hash.DenominationHash.t
|
||||||
|
|
|
||||||
117
src/hash.ml
Normal file
117
src/hash.ml
Normal file
|
|
@ -0,0 +1,117 @@
|
||||||
|
(* TODO hash:
|
||||||
|
json:
|
||||||
|
"A JSON object is canonicalized by converting it to an ASCII byte array
|
||||||
|
with the algorithm specified in RFC 8785. The resulting bytes are
|
||||||
|
terminated with a single 0-byte and then hashed with SHA512." *)
|
||||||
|
(* C-terminated strings
|
||||||
|
some strings need to be hashed with a '\0' termination char *)
|
||||||
|
|
||||||
|
open Digestif
|
||||||
|
|
||||||
|
module type S = sig
|
||||||
|
type t
|
||||||
|
|
||||||
|
val bin : t Bin.t
|
||||||
|
val caqti : t Caqti_type.t
|
||||||
|
val jsont : t Jsont.t
|
||||||
|
val hash : string -> t
|
||||||
|
val of_octets : string -> t
|
||||||
|
val to_octets : t -> string
|
||||||
|
val of_b32 : B32.t -> (t, string) result
|
||||||
|
end
|
||||||
|
|
||||||
|
module H32 = struct
|
||||||
|
type t = SHA256.t
|
||||||
|
|
||||||
|
let hash s = SHA256.(digest_string s)
|
||||||
|
|
||||||
|
let of_octets s =
|
||||||
|
match String.length s = 32 with
|
||||||
|
| false -> Fmt.failwith "Hash.of_octets failure: data is not 32 bytes"
|
||||||
|
| true -> SHA256.of_raw_string s
|
||||||
|
|
||||||
|
let to_octets = SHA256.to_raw_string
|
||||||
|
let of_b32 s = Result.map of_octets (B32.decode s)
|
||||||
|
|
||||||
|
let bin =
|
||||||
|
let open Bin in
|
||||||
|
map (bytes 32) of_octets to_octets
|
||||||
|
|
||||||
|
(* hashes are not b32 encoded in the database *)
|
||||||
|
let caqti : t Caqti_type.t =
|
||||||
|
let open Caqti_type in
|
||||||
|
custom
|
||||||
|
~encode:(fun v -> Ok (to_octets v))
|
||||||
|
~decode:(fun v -> Ok (of_octets v))
|
||||||
|
octets
|
||||||
|
|
||||||
|
let jsont =
|
||||||
|
let enc v = B32.encode (to_octets v) in
|
||||||
|
Jsont.of_of_string ~kind:"Hash 32" of_b32 ~enc
|
||||||
|
end
|
||||||
|
|
||||||
|
module H64 = struct
|
||||||
|
type t = SHA512.t
|
||||||
|
|
||||||
|
let hash s = SHA512.(digest_string s)
|
||||||
|
|
||||||
|
let of_octets s =
|
||||||
|
match String.length s = 64 with
|
||||||
|
| false -> Fmt.failwith "Hash.of_octets failure: data is not 64 bytes"
|
||||||
|
| true -> SHA512.of_raw_string s
|
||||||
|
|
||||||
|
let to_octets v =
|
||||||
|
let s = SHA512.to_raw_string v in
|
||||||
|
match String.length s = 64 with
|
||||||
|
| false -> Fmt.failwith "Hash.to_octets failure: data is not 64 bytes"
|
||||||
|
| true -> s
|
||||||
|
|
||||||
|
let of_b32 s = Result.map of_octets (B32.decode s)
|
||||||
|
|
||||||
|
let bin =
|
||||||
|
let open Bin in
|
||||||
|
map (bytes 64) of_octets to_octets
|
||||||
|
|
||||||
|
(* hashes are not b32 encoded in the database *)
|
||||||
|
let caqti : t Caqti_type.t =
|
||||||
|
let open Caqti_type in
|
||||||
|
custom
|
||||||
|
~encode:(fun v -> Ok (to_octets v))
|
||||||
|
~decode:(fun v -> Ok (of_octets v))
|
||||||
|
octets
|
||||||
|
|
||||||
|
let jsont =
|
||||||
|
let enc v = B32.encode (to_octets v) in
|
||||||
|
Jsont.of_of_string ~kind:"Hash 64" of_b32 ~enc
|
||||||
|
end
|
||||||
|
|
||||||
|
(* Hash over string + '\0' *)
|
||||||
|
module Cstring = struct
|
||||||
|
module H32 = struct
|
||||||
|
include H32
|
||||||
|
|
||||||
|
let hash s =
|
||||||
|
let s = s ^ "\x00" in
|
||||||
|
hash s
|
||||||
|
end
|
||||||
|
|
||||||
|
module H64 = struct
|
||||||
|
include H64
|
||||||
|
|
||||||
|
let hash s =
|
||||||
|
let s = s ^ "\x00" in
|
||||||
|
hash s
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
module FullPaytoHash : S = H32
|
||||||
|
module NormalizedPaytoHash : S = H32
|
||||||
|
module DenominationHash : S = H64
|
||||||
|
module PrivateContractHash : S = H64
|
||||||
|
module ExtensionsPolicyHash : S = H64
|
||||||
|
module MerchantWireHash : S = H64
|
||||||
|
module AgeCommitmentHash : S = H64
|
||||||
|
module BlindedCoinHash : S = H64
|
||||||
|
module CoinPubHash : S = H64
|
||||||
|
module OutputCommitmentHash : S = H64
|
||||||
|
module HashPlanchetsP : S = H64
|
||||||
|
|
@ -182,7 +182,7 @@ let mk_keys ~db_conn (module Sm : Secmod.S) ~last_issue_date =
|
||||||
|> List.filter_map (fun v -> v.Denom_data.master_sig)
|
|> List.filter_map (fun v -> v.Denom_data.master_sig)
|
||||||
|> List.map Bin_sig.DenominationKeyValidity.to_octets
|
|> List.map Bin_sig.DenominationKeyValidity.to_octets
|
||||||
|> String.concat ""
|
|> String.concat ""
|
||||||
|> Bin_type.Hash_64.hash
|
|> Hash.H64.hash
|
||||||
in
|
in
|
||||||
let open Bin_sig.ExchangeKeySet in
|
let open Bin_sig.ExchangeKeySet in
|
||||||
sign_f ~f:(Sm.sign_with_signkey ~pub:exchange_pub) R.{ list_issue_date; hc }
|
sign_f ~f:(Sm.sign_with_signkey ~pub:exchange_pub) R.{ list_issue_date; hc }
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
open Syntax
|
open Syntax
|
||||||
open Api
|
open Api
|
||||||
|
open Hash
|
||||||
|
|
||||||
module Keys_get = struct
|
module Keys_get = struct
|
||||||
let mk_future_denom (module Sm : Secmod.S) ~section_name
|
let mk_future_denom (module Sm : Secmod.S) ~section_name
|
||||||
|
|
@ -26,7 +27,7 @@ module Keys_get = struct
|
||||||
let denom_secmod_sig =
|
let denom_secmod_sig =
|
||||||
let open Bin_sig.DenominationKeyAnnouncement in
|
let open Bin_sig.DenominationKeyAnnouncement in
|
||||||
let h_denom_pub = h_pub in
|
let h_denom_pub = h_pub in
|
||||||
let h_section_name = Bin_type.Hash_64_cstr.hash section_name in
|
let h_section_name = Hash.Cstring.H64.hash section_name in
|
||||||
let anchor_time = stamp_start in
|
let anchor_time = stamp_start in
|
||||||
let duration_withdraw =
|
let duration_withdraw =
|
||||||
Timestamp.diff stamp_start stamp_expire_withdraw
|
Timestamp.diff stamp_start stamp_expire_withdraw
|
||||||
|
|
@ -293,7 +294,7 @@ module Auditors = struct
|
||||||
{
|
{
|
||||||
start_date= validity_start;
|
start_date= validity_start;
|
||||||
auditor_pub;
|
auditor_pub;
|
||||||
h_auditor_url= Bin_type.Hash_64_cstr.hash auditor_url;
|
h_auditor_url= Hash.Cstring.H64.hash auditor_url;
|
||||||
}
|
}
|
||||||
|
|
||||||
(* TODO timestamps last_change +/- checks *)
|
(* TODO timestamps last_change +/- checks *)
|
||||||
|
|
@ -389,7 +390,7 @@ module Wire_fee = struct
|
||||||
let open Bin_sig.MasterWireFee in
|
let open Bin_sig.MasterWireFee in
|
||||||
verify_f ~f:Sm.verify_with_master_key master_sig_wire
|
verify_f ~f:Sm.verify_with_master_key master_sig_wire
|
||||||
{
|
{
|
||||||
h_wire_method= Bin_type.Hash_64_cstr.hash wire_method;
|
h_wire_method= Hash.Cstring.H64.hash wire_method;
|
||||||
start_date= fee_start;
|
start_date= fee_start;
|
||||||
end_date= fee_end;
|
end_date= fee_end;
|
||||||
wire_fee;
|
wire_fee;
|
||||||
|
|
@ -527,15 +528,14 @@ module Wire = struct
|
||||||
let conversion_url = "" in
|
let conversion_url = "" in
|
||||||
let credit_restrictions = "" in
|
let credit_restrictions = "" in
|
||||||
let debit_restrictions = "" in
|
let debit_restrictions = "" in
|
||||||
let open Bin_type in
|
|
||||||
let* () =
|
let* () =
|
||||||
let open Bin_sig.MasterWireDetails in
|
let open Bin_sig.MasterWireDetails in
|
||||||
verify_f ~f:Sm.verify_with_master_key master_sig_wire
|
verify_f ~f:Sm.verify_with_master_key master_sig_wire
|
||||||
{
|
{
|
||||||
h_wire_details= FullPaytoHash.hash payto_uri;
|
h_wire_details= FullPaytoHash.hash payto_uri;
|
||||||
h_conversion_url= Hash_64_cstr.hash conversion_url;
|
h_conversion_url= Hash.Cstring.H64.hash conversion_url;
|
||||||
h_credit_restrictions= Hash_64_cstr.hash credit_restrictions;
|
h_credit_restrictions= Hash.Cstring.H64.hash credit_restrictions;
|
||||||
h_debit_restrictions= Hash_64_cstr.hash debit_restrictions;
|
h_debit_restrictions= Hash.Cstring.H64.hash debit_restrictions;
|
||||||
}
|
}
|
||||||
in
|
in
|
||||||
let* () =
|
let* () =
|
||||||
|
|
@ -544,9 +544,9 @@ module Wire = struct
|
||||||
{
|
{
|
||||||
start_date= validity_start;
|
start_date= validity_start;
|
||||||
h_wire= FullPaytoHash.hash payto_uri;
|
h_wire= FullPaytoHash.hash payto_uri;
|
||||||
h_conversion_url= Hash_64_cstr.hash conversion_url;
|
h_conversion_url= Hash.Cstring.H64.hash conversion_url;
|
||||||
h_credit_restrictions= Hash_64_cstr.hash credit_restrictions;
|
h_credit_restrictions= Hash.Cstring.H64.hash credit_restrictions;
|
||||||
h_debit_restrictions= Hash_64_cstr.hash debit_restrictions;
|
h_debit_restrictions= Hash.Cstring.H64.hash debit_restrictions;
|
||||||
}
|
}
|
||||||
in
|
in
|
||||||
Ok ()
|
Ok ()
|
||||||
|
|
@ -596,7 +596,7 @@ module Wire_disable = struct
|
||||||
WireTeardownMessage.{ payto_uri; master_sig_del; validity_end } =
|
WireTeardownMessage.{ payto_uri; master_sig_del; validity_end } =
|
||||||
let open Bin_sig.MasterDelWire in
|
let open Bin_sig.MasterDelWire in
|
||||||
verify_f ~f:Sm.verify_with_master_key master_sig_del
|
verify_f ~f:Sm.verify_with_master_key master_sig_del
|
||||||
{ end_date= validity_end; h_wire= Bin_type.FullPaytoHash.hash payto_uri }
|
{ end_date= validity_end; h_wire= FullPaytoHash.hash payto_uri }
|
||||||
|
|
||||||
let do_ ~db_conn
|
let do_ ~db_conn
|
||||||
WireTeardownMessage.{ payto_uri; master_sig_del= _; validity_end } =
|
WireTeardownMessage.{ payto_uri; master_sig_del= _; validity_end } =
|
||||||
|
|
@ -638,13 +638,12 @@ module Drain = struct
|
||||||
amount;
|
amount;
|
||||||
} =
|
} =
|
||||||
let open Bin_sig.MasterDrainProfit in
|
let open Bin_sig.MasterDrainProfit in
|
||||||
let open Bin_type in
|
|
||||||
verify_f ~f:Sm.verify_with_master_key master_sig
|
verify_f ~f:Sm.verify_with_master_key master_sig
|
||||||
{
|
{
|
||||||
wtid;
|
wtid;
|
||||||
date;
|
date;
|
||||||
amount;
|
amount;
|
||||||
h_section= Hash_64_cstr.hash debit_account_section;
|
h_section= Hash.Cstring.H64.hash debit_account_section;
|
||||||
h_payto= FullPaytoHash.hash credit_payto_uri;
|
h_payto= FullPaytoHash.hash credit_payto_uri;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -684,7 +683,7 @@ module AmlOfficer = struct
|
||||||
{
|
{
|
||||||
change_date;
|
change_date;
|
||||||
officer_pub;
|
officer_pub;
|
||||||
h_officer_name= Bin_type.Hash_64_cstr.hash officer_name;
|
h_officer_name= Hash.Cstring.H64.hash officer_name;
|
||||||
is_active;
|
is_active;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -727,7 +726,7 @@ module Partners = struct
|
||||||
end_date;
|
end_date;
|
||||||
wad_frequency;
|
wad_frequency;
|
||||||
wad_fee;
|
wad_fee;
|
||||||
h_url= Bin_type.Hash_64_cstr.hash partner_base_url;
|
h_url= Hash.Cstring.H64.hash partner_base_url;
|
||||||
}
|
}
|
||||||
|
|
||||||
let do_ ~db_conn v =
|
let do_ ~db_conn v =
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,7 @@
|
||||||
(* this module defines caqti encoding/decodings *)
|
(* this module defines caqti encoding/decodings *)
|
||||||
open Crypto
|
|
||||||
open Bin_type
|
|
||||||
open Api
|
|
||||||
open Caqti_type
|
open Caqti_type
|
||||||
|
open Crypto
|
||||||
|
open Api
|
||||||
|
|
||||||
(* TODO
|
(* TODO
|
||||||
check that we use Caqti_type.octets for binary data *)
|
check that we use Caqti_type.octets for binary data *)
|
||||||
|
|
@ -32,6 +31,7 @@ let b32 = B32.caqti
|
||||||
|
|
||||||
include struct
|
include struct
|
||||||
(* alias for hash *)
|
(* alias for hash *)
|
||||||
|
open Hash
|
||||||
|
|
||||||
let fullpayto_hash = FullPaytoHash.caqti
|
let fullpayto_hash = FullPaytoHash.caqti
|
||||||
let nomalizaedpayto_hash = NormalizedPaytoHash.caqti
|
let nomalizaedpayto_hash = NormalizedPaytoHash.caqti
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,7 @@ module Make (Conn : Pg.CONN) = struct
|
||||||
|
|
||||||
let db_lookup_denom_data conn ~section_name priv =
|
let db_lookup_denom_data conn ~section_name priv =
|
||||||
let pub = RsaPrivateKey.pub_of_priv priv in
|
let pub = RsaPrivateKey.pub_of_priv priv in
|
||||||
let h_pub = Bin_type.DenominationHash.hash (RsaPublicKey.to_octets pub) in
|
let h_pub = Hash.DenominationHash.hash (RsaPublicKey.to_octets pub) in
|
||||||
let* opt = Pg.find_denom conn h_pub |> unwrap_err_caqti in
|
let* opt = Pg.find_denom conn h_pub |> unwrap_err_caqti in
|
||||||
match opt with
|
match opt with
|
||||||
| None ->
|
| None ->
|
||||||
|
|
@ -209,7 +209,7 @@ module Make (Conn : Pg.CONN) = struct
|
||||||
in
|
in
|
||||||
|
|
||||||
let priv, pub = RsaPrivateKey.generate ~bits:rsa_keysize () in
|
let priv, pub = RsaPrivateKey.generate ~bits:rsa_keysize () in
|
||||||
let h_pub = Bin_type.DenominationHash.hash (RsaPublicKey.to_octets pub) in
|
let h_pub = Hash.DenominationHash.hash (RsaPublicKey.to_octets pub) in
|
||||||
let master_sig = None in
|
let master_sig = None in
|
||||||
let revoked_sig = None in
|
let revoked_sig = None in
|
||||||
let dn_data =
|
let dn_data =
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
open Syntax
|
open Syntax
|
||||||
|
open Hash
|
||||||
|
|
||||||
let read_file fname = Bos.OS.File.read (Fpath.v fname) |> unwrap_err_msg
|
let read_file fname = Bos.OS.File.read (Fpath.v fname) |> unwrap_err_msg
|
||||||
|
|
||||||
|
|
@ -60,7 +61,7 @@ let sign ~master_key ~input ~output =
|
||||||
|
|
||||||
let revoke_denom ~output ~master_key ~h_denom =
|
let revoke_denom ~output ~master_key ~h_denom =
|
||||||
let* key = read_master_key_file master_key in
|
let* key = read_master_key_file master_key in
|
||||||
let* h_denom_pub = Bin_type.DenominationHash.of_b32 h_denom in
|
let* h_denom_pub = DenominationHash.of_b32 h_denom in
|
||||||
let denom_revoke =
|
let denom_revoke =
|
||||||
let master_sig =
|
let master_sig =
|
||||||
let open Bin_sig.MasterDenominationKeyRevocation in
|
let open Bin_sig.MasterDenominationKeyRevocation in
|
||||||
|
|
@ -145,7 +146,7 @@ let enable_auditor ~output ~master_key ~auditor_url ~auditor_name ~auditor_pub
|
||||||
{
|
{
|
||||||
start_date= validity_start;
|
start_date= validity_start;
|
||||||
auditor_pub;
|
auditor_pub;
|
||||||
h_auditor_url= Bin_type.Hash_64_cstr.hash auditor_url;
|
h_auditor_url= Hash.Cstring.H64.hash auditor_url;
|
||||||
}
|
}
|
||||||
in
|
in
|
||||||
let v =
|
let v =
|
||||||
|
|
@ -176,7 +177,7 @@ let wire_fee ~output ~master_key ~wire_method ~fee_start ~fee_end ~closing_fee
|
||||||
let open Bin_sig.MasterWireFee in
|
let open Bin_sig.MasterWireFee in
|
||||||
sign_f ~f:(EddsaSignature.sign ~key)
|
sign_f ~f:(EddsaSignature.sign ~key)
|
||||||
{
|
{
|
||||||
h_wire_method= Bin_type.Hash_64_cstr.hash wire_method;
|
h_wire_method= Hash.Cstring.H64.hash wire_method;
|
||||||
start_date= fee_start;
|
start_date= fee_start;
|
||||||
end_date= fee_end;
|
end_date= fee_end;
|
||||||
closing_fee;
|
closing_fee;
|
||||||
|
|
@ -209,8 +210,8 @@ let drain ~output ~master_key ~debit_account_section ~credit_payto_uri ~wtid
|
||||||
wtid;
|
wtid;
|
||||||
date;
|
date;
|
||||||
amount;
|
amount;
|
||||||
h_section= Bin_type.Hash_64_cstr.hash debit_account_section;
|
h_section= Hash.Cstring.H64.hash debit_account_section;
|
||||||
h_payto= Bin_type.FullPaytoHash.hash credit_payto_uri;
|
h_payto= FullPaytoHash.hash credit_payto_uri;
|
||||||
}
|
}
|
||||||
in
|
in
|
||||||
let v =
|
let v =
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
open Crypto
|
open Crypto
|
||||||
open Bin_type
|
|
||||||
open Api
|
open Api
|
||||||
|
|
||||||
let verify_future_keys_response =
|
let verify_future_keys_response =
|
||||||
|
|
@ -22,7 +21,7 @@ let verify_future_keys_response =
|
||||||
let h_denom_pub =
|
let h_denom_pub =
|
||||||
DenominationHash.hash (DenominationKey.to_octets denom_pub)
|
DenominationHash.hash (DenominationKey.to_octets denom_pub)
|
||||||
in
|
in
|
||||||
let h_section_name = Hash_64_cstr.hash section_name in
|
let h_section_name = Hash.Cstring.H64.hash section_name in
|
||||||
let anchor_time = stamp_start in
|
let anchor_time = stamp_start in
|
||||||
let duration_withdraw = Timestamp.diff stamp_start stamp_expire_withdraw in
|
let duration_withdraw = Timestamp.diff stamp_start stamp_expire_withdraw in
|
||||||
let open Bin_sig.DenominationKeyAnnouncement in
|
let open Bin_sig.DenominationKeyAnnouncement in
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue