+ less failwith

This commit is contained in:
swrup 2025-12-07 06:29:06 +01:00
parent 588b38d66f
commit f8ef92b67e
5 changed files with 37 additions and 48 deletions

View file

@ -62,10 +62,8 @@ module EddsaSignature : sig
end = struct
(* TODO key format
endianess issue? *)
(* EdDSA signatures are transmitted as 64-bytes base32
binary-encoded objects with just the R and S values (base32_ binary-only).
They are signature over a c-struct like `TALER_xxxPS` + with a purpose *)
(* transmitted as 64-bytes base32
binary-encoded objects with just the R and S values *)
type t = string
let to_octets t = t
@ -108,8 +106,7 @@ module RsaPublicKey = struct
let of_b32 s =
let open Syntax in
let* s = B32.decode s in
let v = Util.Bin_rsa.pub_of_octets s in
let+ v = Rsa.pub ~n:v.n ~e:v.e |> unwrap_err_msg in
let+ v = of_octets s in
v
let to_b32 t = B32.encode (to_octets t)
@ -128,7 +125,8 @@ module RsaPrivateKey = struct
let of_b32 s =
let open Syntax in
let* s = B32.decode s in
Ok (of_octets s)
let+ v = of_octets s in
v
let to_b32 t = B32.encode (to_octets t)
let jsont = Jsont.of_of_string ~kind:"RsaPrivateKey" of_b32 ~enc:to_b32