From cccebea04bdde1cd6c387614977de53589dc753c Mon Sep 17 00:00:00 2001 From: swrup Date: Tue, 7 Oct 2025 00:47:46 +0200 Subject: [PATCH] --- src/binary_formats.ml | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/binary_formats.ml b/src/binary_formats.ml index 44643581..75a8b47f 100644 --- a/src/binary_formats.ml +++ b/src/binary_formats.ml @@ -51,6 +51,14 @@ module Hash_code = struct record (fun hash -> { hash }) |+ field (bytes 64) (fun t -> t.hash) |> sealr end +module Short_hash_code = struct + type t = { hash: string } + + let bin = + let open Bin in + record (fun hash -> { hash }) |+ field (bytes 32) (fun t -> t.hash) |> sealr +end + module Denomination_hash = struct type t = { hash: Hash_code.t } @@ -91,6 +99,30 @@ module Merchant_wire_hash = struct |> sealr end +module Full_payto_hash = struct + (* Hash over a full payto://-URI, including receiver-name + (and possibly BIC and other optional fields). *) + type t = { hash: Short_hash_code.t } + + let bin = + let open Bin in + record (fun hash -> { hash }) + |+ field Short_hash_code.bin (fun t -> t.hash) + |> sealr +end + +module Normalized_payto_hash = struct + (* Hash over a normalized payto://-URI, including all optional + fields and also with account-part canonicalized (so no BIC). *) + type t = { hash: Short_hash_code.t } + + let bin = + let open Bin in + record (fun hash -> { hash }) + |+ field Short_hash_code.bin (fun t -> t.hash) + |> sealr +end + (* -- Signatures -- *) module Purpose = struct