add devices.ml; denom.ml
This commit is contained in:
parent
4611c1e057
commit
85ddb8194f
5 changed files with 22 additions and 29 deletions
|
|
@ -1,70 +0,0 @@
|
|||
open Types
|
||||
|
||||
type rsa_denom = {
|
||||
section_name: string;
|
||||
value: Amount.t;
|
||||
stamp_start: Ptime.t;
|
||||
stamp_expire_withdraw: Ptime.t;
|
||||
stamp_expire_deposit: Ptime.t;
|
||||
stamp_expire_legal: Ptime.t;
|
||||
fee_withdraw: Amount.t;
|
||||
fee_deposit: Amount.t;
|
||||
fee_refresh: Amount.t;
|
||||
fee_refund: Amount.t;
|
||||
pub: RsaPublicKey.t;
|
||||
sign: string -> RsaSignature.t;
|
||||
}
|
||||
|
||||
let hash_pub _pub = "todo public key converted to Crockford Base32"
|
||||
|
||||
let make_rsa_denom
|
||||
({
|
||||
section_name;
|
||||
value;
|
||||
duration_withdraw;
|
||||
duration_spend;
|
||||
duration_legal;
|
||||
fee_withdraw;
|
||||
fee_deposit;
|
||||
fee_refresh;
|
||||
fee_refund;
|
||||
cipher;
|
||||
rsa_keysize;
|
||||
age_restricted= _;
|
||||
} :
|
||||
Config_types.Coin.t) =
|
||||
assert (cipher = `RSA);
|
||||
|
||||
let stamp_start = Ptime_clock.now () in
|
||||
let stamp_expire_withdraw =
|
||||
Util.ptime_add_span_exn stamp_start duration_withdraw
|
||||
in
|
||||
let stamp_expire_deposit =
|
||||
Util.ptime_add_span_exn stamp_start duration_spend
|
||||
in
|
||||
let stamp_expire_legal = Util.ptime_add_span_exn stamp_start duration_legal in
|
||||
|
||||
let open Mirage_crypto_pk.Rsa in
|
||||
let priv = generate ~bits:rsa_keysize () in
|
||||
let pub = pub_of_priv priv in
|
||||
let sign = RsaSignature.sign ~key:priv in
|
||||
{
|
||||
section_name;
|
||||
value;
|
||||
stamp_start;
|
||||
stamp_expire_withdraw;
|
||||
stamp_expire_deposit;
|
||||
stamp_expire_legal;
|
||||
fee_withdraw;
|
||||
fee_deposit;
|
||||
fee_refresh;
|
||||
fee_refund;
|
||||
pub;
|
||||
sign;
|
||||
}
|
||||
|
||||
let denom_device =
|
||||
let finally _key = () in
|
||||
Vif.Device.v ~name:"rsa_denom" ~finally [] @@ fun () ->
|
||||
let rsa_l = List.map make_rsa_denom Config.coins in
|
||||
rsa_l
|
||||
Loading…
Add table
Add a link
Reference in a new issue