use Jsont.Error for unsupported CS denom
better fix
This commit is contained in:
parent
4568b1bd4c
commit
166e24b7fd
145 changed files with 9932 additions and 37 deletions
71
.jjconflict-side-1/src/denomination.ml
Normal file
71
.jjconflict-side-1/src/denomination.ml
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
open Crypto
|
||||
|
||||
type t = {
|
||||
pub: RsaPublicKey.t;
|
||||
priv: RsaPrivateKey.t;
|
||||
section_name: string;
|
||||
value: Amount.t;
|
||||
stamp_start: Timestamp.t;
|
||||
stamp_expire_withdraw: Timestamp.t;
|
||||
stamp_expire_deposit: Timestamp.t;
|
||||
stamp_expire_legal: Timestamp.t;
|
||||
fee_withdraw: Amount.t;
|
||||
fee_deposit: Amount.t;
|
||||
fee_refresh: Amount.t;
|
||||
fee_refund: Amount.t;
|
||||
age_mask: int;
|
||||
h_pub: Bin_type.DenominationHash.t;
|
||||
master_sig: EddsaSignature.t option;
|
||||
}
|
||||
|
||||
let make
|
||||
({
|
||||
section_name;
|
||||
value;
|
||||
duration_withdraw;
|
||||
duration_spend;
|
||||
duration_legal;
|
||||
fee_withdraw;
|
||||
fee_deposit;
|
||||
fee_refresh;
|
||||
fee_refund;
|
||||
cipher;
|
||||
rsa_keysize;
|
||||
age_restricted= _;
|
||||
} :
|
||||
Config.Coin.t) =
|
||||
assert (cipher = `RSA);
|
||||
|
||||
let stamp_start = Ptime_clock.now () |> Option.some in
|
||||
let stamp_expire_withdraw =
|
||||
Timestamp.add_span_exn stamp_start (Some duration_withdraw)
|
||||
in
|
||||
let stamp_expire_deposit =
|
||||
Timestamp.add_span_exn stamp_start (Some duration_spend)
|
||||
in
|
||||
let stamp_expire_legal =
|
||||
Timestamp.add_span_exn stamp_start (Some 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 h_pub = Bin_type.DenominationHash.hash (RsaPublicKey.to_octets pub) in
|
||||
let master_sig = None in
|
||||
{
|
||||
pub;
|
||||
priv;
|
||||
section_name;
|
||||
value;
|
||||
stamp_start;
|
||||
stamp_expire_withdraw;
|
||||
stamp_expire_deposit;
|
||||
stamp_expire_legal;
|
||||
fee_withdraw;
|
||||
fee_deposit;
|
||||
fee_refresh;
|
||||
fee_refund;
|
||||
age_mask= 0;
|
||||
h_pub;
|
||||
master_sig;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue