@@ -22,8 +22,13 @@ use crate::snapshot_client::SnapshotClient;
2222use crate :: snapshot_downloader:: { HttpSnapshotDownloader , SnapshotDownloader } ;
2323use crate :: MithrilResult ;
2424
25+ #[ cfg( target_family = "wasm" ) ]
26+ const fn certificate_chain_verification_cache_duration_in_seconds_default ( ) -> u32 {
27+ 604800
28+ }
29+
2530/// Options that can be used to configure the client.
26- #[ derive( Debug , Default , Serialize , Deserialize ) ]
31+ #[ derive( Debug , Clone , Default , Serialize , Deserialize ) ]
2732pub struct ClientOptions {
2833 /// HTTP headers to include in the client requests.
2934 pub http_headers : Option < HashMap < String , String > > ,
@@ -42,6 +47,19 @@ pub struct ClientOptions {
4247 #[ cfg( target_family = "wasm" ) ]
4348 #[ cfg_attr( target_family = "wasm" , serde( default ) ) ]
4449 pub enable_certificate_chain_verification_cache : bool ,
50+
51+ /// Duration in seconds of certificate chain verification cache in the WASM client.
52+ ///
53+ /// Default to one week (604800 seconds).
54+ ///
55+ /// `enable_certificate_chain_verification_cache` and `unstable` must both be set to `true`
56+ /// for this option to have any effect.
57+ #[ cfg( target_family = "wasm" ) ]
58+ #[ cfg_attr(
59+ target_family = "wasm" ,
60+ serde( default = "certificate_chain_verification_cache_duration_in_seconds_default" )
61+ ) ]
62+ pub certificate_chain_verification_cache_duration_in_seconds : u32 ,
4563}
4664
4765impl ClientOptions {
@@ -53,6 +71,9 @@ impl ClientOptions {
5371 unstable : false ,
5472 #[ cfg( target_family = "wasm" ) ]
5573 enable_certificate_chain_verification_cache : false ,
74+ #[ cfg( target_family = "wasm" ) ]
75+ certificate_chain_verification_cache_duration_in_seconds :
76+ certificate_chain_verification_cache_duration_in_seconds_default ( ) ,
5677 }
5778 }
5879
0 commit comments