init
This commit is contained in:
commit
099cd80670
48 changed files with 4951 additions and 0 deletions
29
src/signkey.ml
Normal file
29
src/signkey.ml
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
open Crypto
|
||||
|
||||
(* TODO master_sig
|
||||
not sur how to handle master_sig initialization *)
|
||||
type t = {
|
||||
pub: EddsaPublicKey.t;
|
||||
priv: EddsaPrivateKey.t;
|
||||
stamp_start: Timestamp.t;
|
||||
stamp_expire: Timestamp.t;
|
||||
stamp_end: Timestamp.t;
|
||||
(* signature of this key by offline master key *)
|
||||
master_sig: EddsaSignature.t option;
|
||||
}
|
||||
|
||||
let generate () =
|
||||
(* TODO
|
||||
- look if it exists
|
||||
- if not, create it (TOFU initialization scheme)
|
||||
- write it *)
|
||||
let stamp_start = Ptime_clock.now () |> Option.some in
|
||||
let stamp_expire =
|
||||
Timestamp.add_span_exn stamp_start
|
||||
(Some Config.Exchange.signkey_legal_duration)
|
||||
in
|
||||
let stamp_end = stamp_expire in
|
||||
|
||||
let priv, pub = Mirage_crypto_ec.Ed25519.generate () in
|
||||
let master_sig = None in
|
||||
{ pub; priv; stamp_start; stamp_expire; stamp_end; master_sig }
|
||||
Loading…
Add table
Add a link
Reference in a new issue