dune: add mte library; + wip key jsont
This commit is contained in:
parent
d5eaf6d92f
commit
a04e179c08
5 changed files with 47 additions and 34 deletions
27
src/types.ml
27
src/types.ml
|
|
@ -112,20 +112,39 @@ module Amount = struct
|
|||
end
|
||||
|
||||
module Eddsa = struct
|
||||
(* TODO test *)
|
||||
(* EdDSA and ECDHE public keys always point on Curve25519
|
||||
and represented using the standard 256 bits Ed25519 compact format,
|
||||
converted to Crockford Base32. *)
|
||||
type pub = string
|
||||
type priv = string
|
||||
type pub = Mirage_crypto_ec.Ed25519.pub
|
||||
|
||||
let pub_of_string s =
|
||||
let open Mirage_crypto_ec in
|
||||
match Base_32.decode s with
|
||||
| Error _ as err -> err
|
||||
| Ok octets -> (
|
||||
match Ed25519.pub_of_octets octets with
|
||||
| Error e -> Fmt.error "%a" pp_error e
|
||||
| Ok pub -> Ok pub)
|
||||
|
||||
let pub_to_string pub =
|
||||
pub |> Mirage_crypto_ec.Ed25519.pub_to_octets |> Base_32.encode
|
||||
|
||||
(*type priv = string*)
|
||||
(* EdDSA signatures are transmitted as 64-bytes base32
|
||||
binary-encoded objects with just the R and S values (base32_ binary-only). *)
|
||||
type signature = string
|
||||
(*type signature = string*)
|
||||
end
|
||||
|
||||
module Rsa = struct
|
||||
(* RSA public key converted to Crockford Base32. *)
|
||||
type pub = string
|
||||
type pub = Mirage_crypto_pk.Rsa.pub
|
||||
|
||||
(* TODO
|
||||
how to read/write pub rsa key
|
||||
what format is used? *)
|
||||
let pub_of_string _s = assert false
|
||||
let pub_to_string _pub = assert false
|
||||
end
|
||||
|
||||
module Hash_code = struct
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue