61 lines
1.2 KiB
OCaml
61 lines
1.2 KiB
OCaml
|
|
open Syntax
|
||
|
|
open Crypto
|
||
|
|
|
||
|
|
let read fname = Bos.OS.File.read fname |> unwrap_err_msg
|
||
|
|
let write fname s = Bos.OS.File.write fname s |> unwrap_err_msg
|
||
|
|
|
||
|
|
let read_eddsa fname =
|
||
|
|
let* data = read fname in
|
||
|
|
EddsaPrivateKey.of_octets data
|
||
|
|
|
||
|
|
let write_eddsa fname priv = write fname (EddsaPrivateKey.to_octets priv)
|
||
|
|
|
||
|
|
module Config = struct
|
||
|
|
(* TODO config *)
|
||
|
|
open Config.Exchange_secmod_eddsa
|
||
|
|
|
||
|
|
let dir = Config.secmod_eddsa_dir
|
||
|
|
let lookahead_sign = lookahead_sign
|
||
|
|
let overlap_duration = overlap_duration
|
||
|
|
let duration = duration
|
||
|
|
end
|
||
|
|
|
||
|
|
open Mirage_crypto_ec
|
||
|
|
|
||
|
|
type priv = Ed25519.priv
|
||
|
|
type pub = Ed25519.pub
|
||
|
|
|
||
|
|
type t = {
|
||
|
|
priv: priv;
|
||
|
|
pub: pub;
|
||
|
|
start: Timestamp.t;
|
||
|
|
end_: Timestamp.t;
|
||
|
|
}
|
||
|
|
|
||
|
|
(*
|
||
|
|
create dir if not exists
|
||
|
|
read dir contents
|
||
|
|
init sm_key
|
||
|
|
check filename
|
||
|
|
build sorted list
|
||
|
|
check overlaps
|
||
|
|
just fail if not good
|
||
|
|
add keys until lookahead
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
- sign
|
||
|
|
- verify
|
||
|
|
- expose future_sk list
|
||
|
|
- purge
|
||
|
|
- schedule tasks
|
||
|
|
- !lock
|
||
|
|
|
||
|
|
todo taler doc/config is confusing
|
||
|
|
how is computed stamp_expire stamp_end
|
||
|
|
what to do of 'Exchange.signkey_legal_duration'
|
||
|
|
=> (??)
|
||
|
|
stamp_expire = stamp_start + duration
|
||
|
|
stamp_end = stamp_start + signkey_legal_duration
|
||
|
|
*)
|