From d72573c3c6526451cf0497460fdefb1061c94a09 Mon Sep 17 00:00:00 2001 From: swrup Date: Thu, 5 Feb 2026 21:19:57 +0100 Subject: [PATCH] --- src/api.ml | 21 +++++---------------- src/hash.ml | 8 ++------ src/http_keys.ml | 2 +- src/signatures.ml | 15 ++++----------- 4 files changed, 12 insertions(+), 34 deletions(-) diff --git a/src/api.ml b/src/api.ml index 1055f077..80aedc27 100644 --- a/src/api.ml +++ b/src/api.ml @@ -1,35 +1,24 @@ (* TODO - ppx? - normalized JSON-object for signature of ExchangeKeysResponse.exetensions field - why is this one not defined by a struct? - - how to handle protocol versions: - - "@deprecated" fields - - "@since protocol xx" - - use of _monotonic_ time - option: correct use opt_mem or Jsont.option - better types: - payto_uri - - uri + - uri *) + +let protocol_version = "31" - number: - - number is "float", but we probably want int everywhere instead - - numeric values capped at 2^53 -1 inclusive because json *) open Crypto open Signatures -open Jsont.Object module DenominationHash = Hash.DenominationHash 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 decode jsont v = Jsont_bytesrw.decode_string jsont v +open Jsont.Object + module Account_operation = struct type t = | Withdraw diff --git a/src/hash.ml b/src/hash.ml index 84ceda9d..ca32519f 100644 --- a/src/hash.ml +++ b/src/hash.ml @@ -1,9 +1,3 @@ -(* TODO - 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." *) - open Digestif module type S = sig @@ -99,6 +93,8 @@ module Cstring = struct end end +(* TODO + check which hash algorithm to use for each hash type *) module FullPaytoHash : S = H32 module NormalizedPaytoHash : S = H32 module DenominationHash : S = H64 diff --git a/src/http_keys.ml b/src/http_keys.ml index a0662948..0fd92a81 100644 --- a/src/http_keys.ml +++ b/src/http_keys.ml @@ -43,7 +43,7 @@ let denomgroup_of_denomdata { denoms; value; fee_withdraw; fee_deposit; fee_refresh; fee_refund } let mk_keys ~db_conn (module Sm : Secmod.S) ~last_issue_date = - let version = "0" in + let version = Api.protocol_version in let base_url = Config.base_url in let currency = Config.currency in let shopping_url = Config.shopping_url in diff --git a/src/signatures.ml b/src/signatures.ml index 97152fff..6a6b67ce 100644 --- a/src/signatures.ml +++ b/src/signatures.ml @@ -34,8 +34,7 @@ module Aliases = struct (* - Keys - *) - (* TODO keep this? - some of those are actuall ecdhe, or union of eddsa|ecdhe *) + (* some of those are actuall ecdhe, or union of eddsa|ecdhe *) open Crypto module PursePublicKey = EddsaPublicKey module AuditorPublicKeyP = EddsaPublicKey @@ -182,9 +181,8 @@ end module DenominationKeyAnnouncement = struct module R = struct - (* TODO taler_signatures purpose - we use TALER_SIGNATURE_SM_RSA_DENOMINATION_KEY instead here *) - (* purpose.purpose = TALER_SIGNATURE_SM_DENOMINATION_KEY *) + (* TODO CS: use purpose TALER_SIGNATURE_SM_CS_DENOMINATION_KEY *) + (* purpose.purpose = TALER_SIGNATURE_SM_RSA_DENOMINATION_KEY *) type r = { h_denom_pub: DenominationHash.t; h_section_name: Hash.Cstring.H64.t; @@ -639,8 +637,6 @@ end module PartnerConfiguration = struct module R = struct - (* TODO purpose - this purpose is used 2 times!? *) (* purpose.purpose = TALER_SIGNATURE_MASTER_PARNTER_DETAILS *) type r = { partner_pub: MasterPublicKeyP.t; @@ -877,11 +873,8 @@ module WithdrawRequest = struct end module WithdrawConfirmation = struct - (* Purpose is #TALER_SIGNATURE_EXCHANGE_CONFIRM_WITHDRAW. - Signed by a `struct TALER_ExchangePrivateKeyP` using EdDSA. *) + (* Purpose is #TALER_SIGNATURE_EXCHANGE_CONFIRM_WITHDRAW *) type t = { - (* TODO TALER doc - missing TALER_HashBlindedPlanchetsP*) h_planchets: HashPlanchetsP.t; noreveal_index: int32; }