rename signkey.ml
This commit is contained in:
parent
683d275f73
commit
bc6ea09a59
3 changed files with 6 additions and 6 deletions
|
|
@ -1,30 +0,0 @@
|
|||
open Types
|
||||
|
||||
type t = {
|
||||
stamp_start: Ptime.t;
|
||||
stamp_expire: Ptime.t;
|
||||
stamp_end: Ptime.t;
|
||||
pub: EddsaPublicKey.t;
|
||||
sign: string -> EddsaSignature.t;
|
||||
}
|
||||
|
||||
let make ~name =
|
||||
let finally _key = () in
|
||||
Vif.Device.v ~name ~finally [] @@ fun () ->
|
||||
(* TODO
|
||||
- look if it exists
|
||||
- if not, create it (TOFU initialization scheme)
|
||||
- write it *)
|
||||
(* TODO time
|
||||
correctly set those: *)
|
||||
let stamp_start = Ptime_clock.now () in
|
||||
let stamp_expire =
|
||||
match Ptime.add_span stamp_start Config.Exchange.signkey_legal_duration with
|
||||
| None ->
|
||||
Fmt.failwith "Ptime.add_span: result is not in the range [min;max]"
|
||||
| Some v -> v
|
||||
in
|
||||
let stamp_end = stamp_expire in
|
||||
let priv, pub = Mirage_crypto_ec.Ed25519.generate () in
|
||||
let sign s = EddsaSignature.sign ~key:priv s in
|
||||
{ stamp_start; stamp_expire; stamp_end; pub; sign }
|
||||
Loading…
Add table
Add a link
Reference in a new issue