From fb1d8efa3c593f913baabe1680d535999844ec06 Mon Sep 17 00:00:00 2001 From: swrup Date: Thu, 4 Dec 2025 17:26:19 +0100 Subject: [PATCH] + AmlOfficerSetup --- src/api.ml | 47 ++++++++++++++++++++++++++++++++++++++------ src/bin_signature.ml | 37 ++++++++++++++++++++++++---------- 2 files changed, 68 insertions(+), 16 deletions(-) diff --git a/src/api.ml b/src/api.ml index c48a6ce7..646a74e6 100644 --- a/src/api.ml +++ b/src/api.ml @@ -555,11 +555,7 @@ module DrainProfitsMessage = struct debit_account_section: string; credit_payto_uri: string; wtid: B32.t; - (* - // TALER_MasterDrainProfitPS. - // Must have purpose TALER_SIGNATURE_MASTER_DRAIN_PROFITS. - *) - master_sig: EddsaSignature.t; + master_sig: MasterDrainProfitPS.t; date: Timestamp.t; amount: Amount.t; } @@ -587,8 +583,47 @@ module DrainProfitsMessage = struct |> mem "debit_account_section" Jsont.string ~enc:debit_account_section |> mem "credit_payto_uri" Jsont.string ~enc:credit_payto_uri |> mem "wtid" B32.jsont ~enc:wtid - |> mem "master_sig" EddsaSignature.jsont ~enc:master_sig + |> mem "master_sig" MasterDrainProfitPS.jsont ~enc:master_sig |> mem "date" Timestamp.jsont ~enc:date |> mem "amount" Amount.jsont ~enc:amount |> finish end + +module AmlOfficerSetup = struct + type t = { + officer_pub: EddsaPublicKey.t; + officer_name: string; + is_active: bool; + read_only: bool; + master_sig: MasterAmlOfficerStatusPS.t; + change_date: Timestamp.t; + } + + let jsont = + let make officer_pub officer_name is_active read_only master_sig change_date + = + { + officer_pub; + officer_name; + is_active; + read_only; + master_sig; + change_date; + } + in + let officer_pub v = v.officer_pub in + let officer_name v = v.officer_name in + let is_active v = v.is_active in + let read_only v = v.read_only in + let master_sig v = v.master_sig in + let change_date v = v.change_date in + let open Jsont.Object in + map ~kind:"AmlOfficerSetup" make + |> mem "officer_pub" EddsaPublicKey.jsont ~enc:officer_pub + |> mem "officer_name" Jsont.string ~enc:officer_name + |> mem "is_active" Jsont.bool ~enc:is_active + |> mem "read_only" Jsont.bool ~enc:read_only + |> mem "master_sig" MasterAmlOfficerStatusPS.jsont ~enc:master_sig + |> mem "change_date" Timestamp.jsont ~enc:change_date + |> finish +end diff --git a/src/bin_signature.ml b/src/bin_signature.ml index e1a330fe..e14a0ae7 100644 --- a/src/bin_signature.ml +++ b/src/bin_signature.ml @@ -488,6 +488,33 @@ module MasterDrainProfitPS = struct include MK (R) end +module MasterAmlOfficerStatusPS = struct + module R = struct + (* purpose.purpose = TALER_SIGNATURE_MASTER_AML_KEY *) + type r = { + change_date: TimestampNBO.t; + officer_pub: AmlOfficerPublicKeyP.t; + h_officer_name: Hash_64_cstr.t; + is_active: int32; + } + + let bin = + let open Bin in + Purpose.make_bin Taler_signatures.master_aml_key @@ fun _purpose -> + record (fun _purpose change_date officer_pub h_officer_name is_active -> + { change_date; officer_pub; h_officer_name; is_active }) + |+ Purpose.field _purpose + |+ field TimestampNBO.bin (fun t -> t.change_date) + |+ field AmlOfficerPublicKeyP.bin (fun t -> t.officer_pub) + |+ field Hash_64_cstr.bin (fun t -> t.h_officer_name) + |+ field beint32 (fun t -> t.is_active) + |> sealr + end + + include R + include MK (R) +end + (* ### BIN IMPL END ### *) module WithdrawRequestPS = struct @@ -955,16 +982,6 @@ module CoinPurseRefundConfirmationPS = struct } end -module MasterAmlOfficerStatusPS = struct - (* purpose.purpose = TALER_SIGNATURE_MASTER_AML_KEY *) - type t = { - change_date: TimestampNBO.t; - officer_pub: AmlOfficerPublicKeyP.t; - h_officer_name: Hash_64_cstr.t; - is_active: int; - } -end - module AmlDecisionPS = struct (* purpose.purpose = TALER_SIGNATURE_AML_DECISION *) type t = {