use Jsont.Error for unsupported CS denom + wip type binary signature

This commit is contained in:
swrup 2025-11-30 22:44:36 +01:00
parent 4568b1bd4c
commit eb56150120
6 changed files with 66 additions and 45 deletions

View file

@ -15,11 +15,13 @@ let () =
in
()
let get_ok = function Error e -> failwith e | Ok v -> v
let () =
let open Api in
let check jsont s =
let encode v = encode jsont v |> Result.get_ok in
let decode v = decode jsont v |> Result.get_ok in
let encode v = encode jsont v |> get_ok in
let decode v = decode jsont v |> get_ok in
let ts = decode s in
let s' = encode ts in
let ts' = decode s' in
@ -35,13 +37,14 @@ let () =
check_bad Timestamp.jsont {|{"t_s": "123456780"}|};
check_bad Timestamp.jsont {|{"t_s": "agagou"}|};
(* TODO use a valid rsa_pub value *)
(*
check DenominationKey.jsont
{|{"cipher": "RSA", "age_mask": 18, "rsa_pub": "agagouh"}|};
check DenominationKey.jsont
(* CS not implemented *)
check_bad DenominationKey.jsont
{|{"cipher": "CS", "age_mask": 18, "cs_pub": "ouhagag"}|};
*)
(* TODO test with a valid rsa_pub value *)
(* TODO handle "rsa pub_of_octets failure" correctly *)
(* check_bad DenominationKey.jsont
{|{"cipher": "RSA", "age_mask": 18, "rsa_pub": "agagouh"}|}; *)
()
let () =