diff --git a/src/api.ml b/src/api.ml index f2fbf58e..18903c50 100644 --- a/src/api.ml +++ b/src/api.ml @@ -340,3 +340,33 @@ module SignkeyRevocationSignature = struct |> mem "master_sig" MasterSigningKeyRevocationPS.jsont ~enc |> finish end + +module AuditorSetupMessage = struct + type t = { + auditor_url: string; + auditor_name: string; + auditor_pub: EddsaPublicKey.t; + master_sig: MasterAddAuditorPS.t; + (* TODO time + something about using monotonic system time here! *) + validity_start: Timestamp.t; + } + + let jsont = + let make auditor_url auditor_name auditor_pub master_sig validity_start = + { auditor_url; auditor_name; auditor_pub; master_sig; validity_start } + in + let auditor_url v = v.auditor_url in + let auditor_name v = v.auditor_name in + let auditor_pub v = v.auditor_pub in + let master_sig v = v.master_sig in + let validity_start v = v.validity_start in + let open Jsont.Object in + map ~kind:"AuditorSetupMessage" make + |> mem "auditor_url" Jsont.string ~enc:auditor_url + |> mem "auditor_name" Jsont.string ~enc:auditor_name + |> mem "auditor_pub" EddsaPublicKey.jsont ~enc:auditor_pub + |> mem "master_sig" MasterAddAuditorPS.jsont ~enc:master_sig + |> mem "validity_start" Timestamp.jsont ~enc:validity_start + |> finish +end diff --git a/src/bin_signature.ml b/src/bin_signature.ml index 76b6bc2b..ebd5d006 100644 --- a/src/bin_signature.ml +++ b/src/bin_signature.ml @@ -245,6 +245,31 @@ module MasterSigningKeyRevocationPS = struct include MK (R) end +module MasterAddAuditorPS = struct + module R = struct + (* purpose.purpose = TALER_SIGNATURE_MASTER_ADD_AUDITOR *) + type r = { + start_date: TimeAbsoluteNBO.t; + auditor_pub: AuditorPublicKeyP.t; + h_auditor_url: Hash_64_cstr.t; + } + + let bin = + let open Bin in + Purpose.make_bin Taler_signatures.master_add_auditor @@ fun purpose -> + record (fun _purpose start_date auditor_pub h_auditor_url -> + { start_date; auditor_pub; h_auditor_url }) + |+ Purpose.field purpose + |+ field TimeAbsoluteNBO.bin (fun t -> t.start_date) + |+ field AuditorPublicKeyP.bin (fun t -> t.auditor_pub) + |+ field Hash_64_cstr.bin (fun t -> t.h_auditor_url) + |> sealr + end + + include R + include MK (R) +end + (* ### BIN IMPL END ### *) module WithdrawRequestPS = struct @@ -749,15 +774,6 @@ module CoinPurseRefundConfirmationPS = struct } end -module MasterAddAuditorPS = struct - (* purpose.purpose = TALER_SIGNATURE_MASTER_ADD_AUDITOR *) - type t = { - start_date: TimeAbsoluteNBO.t; - auditor_pub: AuditorPublicKeyP.t; - h_auditor_url: Hash_64_cstr.t; - } -end - module MasterDelAuditorPS = struct (* purpose.purpose = TALER_SIGNATURE_MASTER_DEL_AUDITOR *) type t = {