From 4490485fc208f4e5d5ee3f601594d616b81be196 Mon Sep 17 00:00:00 2001 From: swrup Date: Tue, 7 Oct 2025 15:08:35 +0200 Subject: [PATCH] more module renaming --- src/binary_formats.ml | 4 ++-- src/json.ml | 28 ++++++++++++++-------------- src/mte.ml | 4 ++-- src/types.ml | 18 +++++++++--------- test/test.ml | 6 +++--- 5 files changed, 30 insertions(+), 30 deletions(-) diff --git a/src/binary_formats.ml b/src/binary_formats.ml index bb840af8..f51dc198 100644 --- a/src/binary_formats.ml +++ b/src/binary_formats.ml @@ -364,7 +364,7 @@ module BlindingMasterSeed = MK_BASIC_32 () (* Format used for to generate the signature on a request to withdraw coins from a reserve. *) -module WithdrawRequestPs = struct +module WithdrawRequestPS = struct (* Purpose is #TALER_SIGNATURE_WALLET_RESERVE_WITHDRAW *) type t = { (* Amount to withdraw, excluding fees, i.e. @@ -432,7 +432,7 @@ module WithdrawRequestPs = struct |> sealr end -module WithdrawConfirmationPs = struct +module WithdrawConfirmationPS = struct (* Purpose is #TALER_SIGNATURE_EXCHANGE_CONFIRM_WITHDRAW. Signed by a `struct TALER_ExchangePrivateKeyP` using EdDSA. *) type t = { diff --git a/src/json.ml b/src/json.ml index c4a34de6..f800b83a 100644 --- a/src/json.ml +++ b/src/json.ml @@ -4,8 +4,8 @@ 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 -module Error_detail = struct - open Error_detail +module ErrorDetail = struct + open ErrorDetail let jsont = let make code hint = { code; hint } in @@ -45,8 +45,8 @@ module Timestamp = struct |> Jsont.Object.finish end -module Relative_time = struct - open Relative_time +module RelativeTime = struct + open RelativeTime let number_or_forever_jsont = let forever = @@ -87,8 +87,8 @@ module Eddsa = struct let signature_jsont = Jsont.string end -module Rsa_denomination_key = struct - open Rsa_denomination_key +module RsaDenominationKey = struct + open RsaDenominationKey let jsont = let make age_mask rsa_pub = { age_mask; rsa_pub } in @@ -100,8 +100,8 @@ module Rsa_denomination_key = struct |> Jsont.Object.finish end -module CS_denomination_key = struct - open CS_denomination_key +module CSDenominationKey = struct + open CSDenominationKey let jsont = let make age_mask cs_pub = { age_mask; cs_pub } in @@ -113,16 +113,16 @@ module CS_denomination_key = struct |> Jsont.Object.finish end -module Denomination_key = struct - open Denomination_key +module DenominationKey = struct + open DenominationKey let rsa v = Rsa v let cs v = CS v let jsont = let open Jsont.Object in - let rsa = Case.map "RSA" Rsa_denomination_key.jsont ~dec:rsa in - let cs = Case.map "CS" CS_denomination_key.jsont ~dec:cs in + let rsa = Case.map "RSA" RsaDenominationKey.jsont ~dec:rsa in + let cs = Case.map "CS" CSDenominationKey.jsont ~dec:cs in let enc_case = function | Rsa v -> Case.value rsa v | CS v -> Case.value cs v @@ -133,8 +133,8 @@ module Denomination_key = struct |> finish end -module Future_sign_key = struct - open Future_sign_key +module FutureSignKey = struct + open FutureSignKey let jsont = (* TODO ppx? *) diff --git a/src/mte.ml b/src/mte.ml index 1b77f44b..8c013b47 100644 --- a/src/mte.ml +++ b/src/mte.ml @@ -14,10 +14,10 @@ along with this program. If not, see . *) let error_detail ?hint _status = - let open Types.Error_detail in + let open Types.ErrorDetail in let open Json in let code = -1 in - let s = encode_exn Error_detail.jsont { code; hint } in + let s = encode_exn ErrorDetail.jsont { code; hint } in s module Respond_with = struct diff --git a/src/types.ml b/src/types.ml index f4546537..d1f43f96 100644 --- a/src/types.ml +++ b/src/types.ml @@ -1,5 +1,5 @@ (* https://docs.taler.net/core/api-common.html#tsref-type-ErrorDetail *) -module Error_detail = struct +module ErrorDetail = struct (* TODO GANA error codes https://git.gnunet.org/gana.git/tree/gnu-taler-error-codes/registry.rec *) type t = { @@ -21,7 +21,7 @@ module Timestamp = struct | Never end -module Relative_time = struct +module RelativeTime = struct (* Duration in microseconds or "forever" to represent an infinite duration. Numeric values are capped at 2^53 - 1 inclusive. *) @@ -147,19 +147,19 @@ module Rsa = struct let pub_to_string _pub = assert false end -module Hash_code = struct +module HashCode = struct (* 32-byte value representing a point on Curve25519. *) type cs25519Point = string end -module Rsa_denomination_key = struct +module RsaDenominationKey = struct type t = { age_mask: int; rsa_pub: string; (* Rsa.pub *) } end -module CS_denomination_key = struct +module CSDenominationKey = struct (* Clause Schnorr *) type t = { age_mask: int; @@ -167,13 +167,13 @@ module CS_denomination_key = struct } end -module Denomination_key = struct +module DenominationKey = struct type t = - | Rsa of Rsa_denomination_key.t - | CS of CS_denomination_key.t + | Rsa of RsaDenominationKey.t + | CS of CSDenominationKey.t end -module Future_sign_key = struct +module FutureSignKey = struct type t = { (* The actual exchange's EdDSA signing public key *) key: Eddsa.pub; diff --git a/test/test.ml b/test/test.ml index 0d8d4ed2..d84a6004 100644 --- a/test/test.ml +++ b/test/test.ml @@ -18,9 +18,9 @@ let () = check_bad Timestamp.jsont {|{"t_s": "123456780"}|}; check_bad Timestamp.jsont {|{"t_s": "agagou"}|}; - check Denomination_key.jsont + check DenominationKey.jsont {|{"cipher": "RSA", "age_mask": 18, "rsa_pub": "agagouh"}|}; - check Denomination_key.jsont + check DenominationKey.jsont {|{"cipher": "CS", "age_mask": 18, "cs_pub": "ouhagag"}|}; () @@ -73,7 +73,7 @@ let () = () let () = - let open Binary_formats.WithdrawConfirmationPs in + let open Binary_formats.WithdrawConfirmationPS in let str64 = String.make 64 '0' in let dummy_t = { h_planchets= { v= { v= str64 } }; noreveal_index= 0_l } in let size' = Bin.size_of_value bin dummy_t |> Option.get in