This commit is contained in:
parent
c0765bac8e
commit
72a4321b4e
2 changed files with 7 additions and 6 deletions
|
|
@ -23,4 +23,6 @@ let decode s =
|
|||
| c -> c)
|
||||
s
|
||||
in
|
||||
Base32.decode ~alphabet ~off:0 ~len:(String.length s) s
|
||||
match Base32.decode ~alphabet ~off:0 ~len:(String.length s) s with
|
||||
| Error (`Msg e) -> Error e
|
||||
| Ok v -> Ok v
|
||||
|
|
|
|||
|
|
@ -25,7 +25,10 @@ module EddsaPublicKey = struct
|
|||
let of_b32 s =
|
||||
let open Syntax in
|
||||
let* octets = B32.decode s in
|
||||
let* pub = of_octets octets in
|
||||
let* pub =
|
||||
of_octets octets
|
||||
|> Result.map_error (fun e -> Fmt.str "%a" Mirage_crypto_ec.pp_error e)
|
||||
in
|
||||
Ok pub
|
||||
|
||||
let to_b32 t = B32.encode (to_octets t)
|
||||
|
|
@ -61,8 +64,6 @@ module EddsaSignature : sig
|
|||
|
||||
val sign : key:EddsaPrivateKey.t -> string -> t
|
||||
val verify : key:EddsaPublicKey.t -> t -> msg:string -> bool
|
||||
val of_b32 : string -> (t, string) result
|
||||
val to_b32 : t -> string
|
||||
val to_octets : t -> string
|
||||
val of_octets : string -> t
|
||||
val jsont : t Jsont.t
|
||||
|
|
@ -145,8 +146,6 @@ module RsaSignature : sig
|
|||
|
||||
val to_octets : t -> string
|
||||
val sign : key:Mirage_crypto_pk.Rsa.priv -> string -> t
|
||||
val of_b32 : string -> (t, string) result
|
||||
val to_b32 : t -> string
|
||||
val jsont : t Jsont.t
|
||||
end = struct
|
||||
type t = string
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue