better fix

This commit is contained in:
swrup 2025-11-30 23:57:09 +01:00
parent 4c511efae9
commit 00a642658a
3 changed files with 33 additions and 11 deletions

View file

@ -90,7 +90,26 @@ module RsaDenominationKey = struct
|> Jsont.Object.finish
end
(* Clause Schnorr cipher is not supported *)
(* ! Clause Schnorr cipher is not supported *)
module CSDenominationKey = struct
type t = {
age_mask: int;
cs_pub: B32.t;
}
(* TODO B32.jsont *)
let b32_jsont = Jsont.of_of_string ~kind:"B32" B32.decode ~enc:B32.encode
let jsont =
let make age_mask cs_pub = { age_mask; cs_pub } in
let age_mask v = v.age_mask in
let cs_pub v = v.cs_pub in
Jsont.Object.map ~kind:"CSDenominationKey" make
|> Jsont.Object.mem "age_mask" Jsont.int ~enc:age_mask
|> Jsont.Object.mem "cs_pub" b32_jsont ~enc:cs_pub
|> Jsont.Object.finish
end
module DenominationKey = struct
type t = Rsa of RsaDenominationKey.t
(*| CS of CSDenominationKey.t*)
@ -105,7 +124,7 @@ module DenominationKey = struct
let jsont =
let open Jsont.Object in
let rsa = Case.map "RSA" RsaDenominationKey.jsont ~dec:of_rsa in
let cs = Case.map "CS" RsaDenominationKey.jsont ~dec:of_cs in
let cs = Case.map "CS" CSDenominationKey.jsont ~dec:of_cs in
let enc_case = function Rsa v -> Case.value rsa v in
let cases = Case.[ make rsa; make cs ] in
map ~kind:"DenominationKey" Fun.id