better fix
This commit is contained in:
parent
4c511efae9
commit
00a642658a
3 changed files with 33 additions and 11 deletions
23
src/api.ml
23
src/api.ml
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue