add time.ml, similar to libgnunetutil's
This commit is contained in:
parent
5eba5f2265
commit
cec0e6afa9
17 changed files with 336 additions and 321 deletions
|
|
@ -162,11 +162,12 @@ module Make (Conn : Pg.CONN) = struct
|
|||
| _, _, _ -> error_invalid_state
|
||||
|
||||
let make_new_signkey () =
|
||||
let stamp_start = Ptime_clock.now () |> Option.some in
|
||||
let stamp_expire =
|
||||
Timestamp.add_span_exn stamp_start
|
||||
(Some Config.Exchange.signkey_legal_duration)
|
||||
let start = Time.Absolute.of_ptime (Ptime_clock.now ()) in
|
||||
let expire =
|
||||
Time.Absolute.add start Config.Exchange.signkey_legal_duration
|
||||
in
|
||||
let stamp_start = Time.Timestamp.of_absolute start in
|
||||
let stamp_expire = Time.Timestamp.of_absolute expire in
|
||||
let stamp_end = stamp_expire in
|
||||
let priv, pub = Mirage_crypto_ec.Ed25519.generate () in
|
||||
let master_sig = None in
|
||||
|
|
@ -194,16 +195,19 @@ module Make (Conn : Pg.CONN) = struct
|
|||
age_restricted= _;
|
||||
} =
|
||||
assert (cipher = `RSA);
|
||||
let stamp_start = Ptime_clock.now () |> Option.some in
|
||||
let open Time in
|
||||
let start = Absolute.of_ptime (Ptime_clock.now ()) in
|
||||
let stamp_start = Timestamp.of_absolute start in
|
||||
let stamp_expire_withdraw =
|
||||
Timestamp.add_span_exn stamp_start (Some duration_withdraw)
|
||||
Timestamp.of_absolute @@ Absolute.add start duration_withdraw
|
||||
in
|
||||
let stamp_expire_deposit =
|
||||
Timestamp.add_span_exn stamp_start (Some duration_spend)
|
||||
Timestamp.of_absolute @@ Absolute.add start duration_spend
|
||||
in
|
||||
let stamp_expire_legal =
|
||||
Timestamp.add_span_exn stamp_start (Some duration_legal)
|
||||
Timestamp.of_absolute @@ Absolute.add start duration_legal
|
||||
in
|
||||
|
||||
let priv, pub = RsaPrivateKey.generate ~bits:rsa_keysize () in
|
||||
let h_pub = Bin_type.DenominationHash.hash (RsaPublicKey.to_octets pub) in
|
||||
let master_sig = None in
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue