add to_octets
This commit is contained in:
parent
78b08dcb4e
commit
812b81a966
3 changed files with 37 additions and 36 deletions
|
|
@ -75,35 +75,23 @@ let mk_future_denom denom_secmod_sign_f
|
|||
|
||||
let mk_future_sign_key signkey_secmod_sign_f
|
||||
({ pub; sign= _; stamp_start; stamp_expire; stamp_end } : Secmod_keys.t) =
|
||||
let exchange_pub =
|
||||
(* TODO
|
||||
- I don't think its in crockford base 32 here
|
||||
maybe SHA-512?
|
||||
or maybe SHA-512 in crockford base 32
|
||||
-> no, its not a hash here
|
||||
need to change ugly binary_formats functor
|
||||
to not mixup hashed values with others
|
||||
- have a make function for wrapped HashCode structs
|
||||
make it take the relevant type *)
|
||||
let v = EddsaPublicKey.to_b32 pub in
|
||||
Binary_formats.ExchangePublicKeyP.{ v= { v } }
|
||||
in
|
||||
let signkey_secmod_sig =
|
||||
let open Binary_formats in
|
||||
let ps =
|
||||
let anchor_time =
|
||||
TimeAbsoluteNBO.{ v= Util.ptime_to_int64_us stamp_start }
|
||||
in
|
||||
let duration =
|
||||
let v =
|
||||
Ptime.diff stamp_start stamp_expire
|
||||
|> Util.ptime_of_span_exn
|
||||
|> Util.ptime_to_int64_us
|
||||
in
|
||||
TimeRelativeNBO.{ v }
|
||||
in
|
||||
SigningKeyAnnouncementPS.{ exchange_pub; anchor_time; duration }
|
||||
let exchange_pub =
|
||||
ExchangePublicKeyP.{ v= { v= EddsaPublicKey.to_octets pub } }
|
||||
in
|
||||
let anchor_time =
|
||||
TimeAbsoluteNBO.{ v= Util.ptime_to_int64_us stamp_start }
|
||||
in
|
||||
let duration =
|
||||
let v =
|
||||
Ptime.diff stamp_start stamp_expire
|
||||
|> Util.ptime_of_span_exn
|
||||
|> Util.ptime_to_int64_us
|
||||
in
|
||||
TimeRelativeNBO.{ v }
|
||||
in
|
||||
let ps = SigningKeyAnnouncementPS.{ exchange_pub; anchor_time; duration } in
|
||||
ps |> Bin.to_string SigningKeyAnnouncementPS.bin |> signkey_secmod_sign_f
|
||||
in
|
||||
FutureSignKey.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue