JJ: Description from the destination commit:

rename

JJ: Description from source commit:
~
This commit is contained in:
swrup 2026-02-18 17:26:53 +01:00
parent 1e30753ba9
commit 676b2070d1
7 changed files with 82 additions and 85 deletions

View file

@ -159,37 +159,35 @@ end = struct
binary-encoded objects with just the R and S values *)
type t = string
(* mirage_crypto: "The result is the concatenation of r and s, as specified in RFC 8032." *)
(* mirage_crypto:
"The result is the concatenation of r and s, as specified in RFC 8032." *)
let sign ~key s = Mirage_crypto_ec.Ed25519.sign ~key s
let verify ~key s ~msg =
let b = Mirage_crypto_ec.Ed25519.verify ~key s ~msg in
match b with
| false -> Error "signature verification failure: invalid signature"
| false -> Error "EddsaSignature verification: invalid signature"
| true -> Ok ()
let to_octets t = t
let check_size t =
match String.length t = 64 with
| false -> Error "EddsaSignature of_octets: data is not 64 bytes."
| true -> Ok ()
let of_octets v =
match String.length v = 64 with
| false ->
Fmt.error "EddsaSignature.of_octets failure: data is not 64 bytes."
| true -> Ok v
let+ () = check_size v in
v
let bin =
let of_octets_exn t = of_octets t |> Result.get_ok in
Bin.map (Bin.bytes 64) of_octets_exn to_octets
let check_size t =
match String.length t = 64 with
| false -> Error "EddsaSignature: invalid string length"
| true -> Ok ()
let jsont =
let of_b32 s =
let* t = B32.decode s in
let+ () = check_size t in
t
of_octets t
in
let to_b32 = B32.encode in
Jsont.of_of_string ~kind:"EddsaSignature" of_b32 ~enc:to_b32