(* TODO KV store *)

module Secmod_signkey = struct
  type t = {
    sm_key: Signkey.t;
    keys: Signkey.t list;
  }

  let v =
    let finally _key = () in
    Vif.Device.v ~name:"secmod_signkey" ~finally [] @@ fun () ->
    let sm_key = Signkey.generate () in
    let keys = [ Signkey.generate () ] in
    { sm_key; keys }
end

module Secmod_denom = struct
  type t = {
    sm_key: Signkey.t;
    keys: Denomination.t list;
  }

  let v =
    let finally _key = () in
    Vif.Device.v ~name:"secmod_denom" ~finally [] @@ fun () ->
    let sm_key = Signkey.generate () in
    let keys = List.map Denomination.make Config.coins in
    { sm_key; keys }
end

let secmod_signkey = Secmod_signkey.v
let secmod_denom = Secmod_denom.v
