~ keep jsont in Types for trivial types
not sure about this
This commit is contained in:
parent
9929a4a324
commit
c68f7db1a6
3 changed files with 15 additions and 31 deletions
|
|
@ -486,6 +486,8 @@ module SigningKeyAnnouncementPS = struct
|
||||||
|> sealr
|
|> sealr
|
||||||
end
|
end
|
||||||
|
|
||||||
|
(* --- BIN IMPL END --- *)
|
||||||
|
|
||||||
module SingleWithdrawRequestPS = struct
|
module SingleWithdrawRequestPS = struct
|
||||||
(* purpose.purpose = TALER_SIGNATURE_WALLET_RESERVE_WITHDRAW *)
|
(* purpose.purpose = TALER_SIGNATURE_WALLET_RESERVE_WITHDRAW *)
|
||||||
type t = {
|
type t = {
|
||||||
|
|
|
||||||
30
src/json.ml
30
src/json.ml
|
|
@ -73,36 +73,6 @@ module RelativeTime = struct
|
||||||
|> Jsont.Object.finish
|
|> Jsont.Object.finish
|
||||||
end
|
end
|
||||||
|
|
||||||
module Amount = struct
|
|
||||||
open Amount
|
|
||||||
|
|
||||||
let jsont = Jsont.of_of_string ~kind:"Amount" of_string ~enc:to_string
|
|
||||||
end
|
|
||||||
|
|
||||||
module EddsaPublicKey = struct
|
|
||||||
open EddsaPublicKey
|
|
||||||
|
|
||||||
let jsont = Jsont.of_of_string ~kind:"EddsaPublicKey" of_b32 ~enc:to_b32
|
|
||||||
end
|
|
||||||
|
|
||||||
module EddsaSignature = struct
|
|
||||||
open EddsaSignature
|
|
||||||
|
|
||||||
let jsont = Jsont.of_of_string ~kind:"EddsaSignature" of_b32 ~enc:to_b32
|
|
||||||
end
|
|
||||||
|
|
||||||
module RsaPublicKey = struct
|
|
||||||
open RsaPublicKey
|
|
||||||
|
|
||||||
let jsont = Jsont.of_of_string ~kind:"RsaPublicKey" of_b32 ~enc:to_b32
|
|
||||||
end
|
|
||||||
|
|
||||||
module RsaSignature = struct
|
|
||||||
open RsaSignature
|
|
||||||
|
|
||||||
let jsont = Jsont.of_of_string ~kind:"RsaSignature" of_b32 ~enc:to_b32
|
|
||||||
end
|
|
||||||
|
|
||||||
module RsaDenominationKey = struct
|
module RsaDenominationKey = struct
|
||||||
open RsaDenominationKey
|
open RsaDenominationKey
|
||||||
|
|
||||||
|
|
|
||||||
14
src/types.ml
14
src/types.ml
|
|
@ -63,7 +63,11 @@ module RelativeTime = struct
|
||||||
| Forever
|
| Forever
|
||||||
end
|
end
|
||||||
|
|
||||||
module Amount = Amount
|
module Amount = struct
|
||||||
|
include Amount
|
||||||
|
|
||||||
|
let jsont = Jsont.of_of_string ~kind:"Amount" of_string ~enc:to_string
|
||||||
|
end
|
||||||
|
|
||||||
(* TODO key format
|
(* TODO key format
|
||||||
- check what is the exact format in GNUNET
|
- check what is the exact format in GNUNET
|
||||||
|
|
@ -83,6 +87,7 @@ module EddsaPublicKey = struct
|
||||||
| Ok pub -> Ok pub
|
| Ok pub -> Ok pub
|
||||||
|
|
||||||
let to_b32 pub = pub |> Mirage_crypto_ec.Ed25519.pub_to_octets |> B32.encode
|
let to_b32 pub = pub |> Mirage_crypto_ec.Ed25519.pub_to_octets |> B32.encode
|
||||||
|
let jsont = Jsont.of_of_string ~kind:"EddsaPublicKey" of_b32 ~enc:to_b32
|
||||||
end
|
end
|
||||||
|
|
||||||
module EddsaSignature : sig
|
module EddsaSignature : sig
|
||||||
|
|
@ -91,6 +96,7 @@ module EddsaSignature : sig
|
||||||
val sign : key:Mirage_crypto_ec.Ed25519.priv -> string -> t
|
val sign : key:Mirage_crypto_ec.Ed25519.priv -> string -> t
|
||||||
val of_b32 : string -> (t, string) result
|
val of_b32 : string -> (t, string) result
|
||||||
val to_b32 : t -> string
|
val to_b32 : t -> string
|
||||||
|
val jsont : t Jsont.t
|
||||||
end = struct
|
end = struct
|
||||||
(* EdDSA signatures are transmitted as 64-bytes base32
|
(* EdDSA signatures are transmitted as 64-bytes base32
|
||||||
binary-encoded objects with just the R and S values (base32_ binary-only).
|
binary-encoded objects with just the R and S values (base32_ binary-only).
|
||||||
|
|
@ -111,6 +117,8 @@ end = struct
|
||||||
let s = B32.encode t in
|
let s = B32.encode t in
|
||||||
assert (String.length s = 64);
|
assert (String.length s = 64);
|
||||||
s
|
s
|
||||||
|
|
||||||
|
let jsont = Jsont.of_of_string ~kind:"EddsaSignature" of_b32 ~enc:to_b32
|
||||||
end
|
end
|
||||||
|
|
||||||
module RsaPublicKey = struct
|
module RsaPublicKey = struct
|
||||||
|
|
@ -130,6 +138,8 @@ module RsaPublicKey = struct
|
||||||
let s = Bin.to_string bin v in
|
let s = Bin.to_string bin v in
|
||||||
let s = B32.encode s in
|
let s = B32.encode s in
|
||||||
s
|
s
|
||||||
|
|
||||||
|
let jsont = Jsont.of_of_string ~kind:"RsaPublicKey" of_b32 ~enc:to_b32
|
||||||
end
|
end
|
||||||
|
|
||||||
module RsaSignature : sig
|
module RsaSignature : sig
|
||||||
|
|
@ -138,6 +148,7 @@ module RsaSignature : sig
|
||||||
val sign : key:Mirage_crypto_pk.Rsa.priv -> string -> t
|
val sign : key:Mirage_crypto_pk.Rsa.priv -> string -> t
|
||||||
val of_b32 : string -> (t, string) result
|
val of_b32 : string -> (t, string) result
|
||||||
val to_b32 : t -> string
|
val to_b32 : t -> string
|
||||||
|
val jsont : t Jsont.t
|
||||||
end = struct
|
end = struct
|
||||||
type t = string
|
type t = string
|
||||||
|
|
||||||
|
|
@ -148,6 +159,7 @@ end = struct
|
||||||
|
|
||||||
let of_b32 s = B32.decode s
|
let of_b32 s = B32.decode s
|
||||||
let to_b32 t = B32.encode t
|
let to_b32 t = B32.encode t
|
||||||
|
let jsont = Jsont.of_of_string ~kind:"RsaSignature" of_b32 ~enc:to_b32
|
||||||
end
|
end
|
||||||
|
|
||||||
module HashCode = struct
|
module HashCode = struct
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue