@@ -11,7 +11,7 @@ export default function VerifyCertificateModal({ show, onClose, certificateHash
1111 const [ showLoadingWarning , setShowLoadingWarning ] = useState ( false ) ;
1212 const [ client , setClient ] = useState ( undefined ) ;
1313 const [ certificate , setCertificate ] = useState ( undefined ) ;
14- const enableCertificateChainVerificationCache = true ;
14+ const [ isCacheEnabled , setIsCacheEnabled ] = useState ( false ) ;
1515
1616 useEffect ( ( ) => {
1717 if ( show ) {
@@ -31,14 +31,19 @@ export default function VerifyCertificateModal({ show, onClose, certificateHash
3131
3232 async function init ( aggregator , certificateHash ) {
3333 const genesisVerificationKey = await fetchGenesisVerificationKey ( aggregator ) ;
34- const client = new MithrilClient ( aggregator , genesisVerificationKey , {
35- unstable : true ,
36- enable_certificate_chain_verification_cache : enableCertificateChainVerificationCache ,
37- } ) ;
34+ const isCacheEnabled = process . env . UNSTABLE === true ;
35+ const client_options = process . env . UNSTABLE
36+ ? {
37+ unstable : true ,
38+ enable_certificate_chain_verification_cache : isCacheEnabled ,
39+ }
40+ : { } ;
41+ const client = new MithrilClient ( aggregator , genesisVerificationKey , client_options ) ;
3842 const certificate = await client . get_mithril_certificate ( certificateHash ) ;
3943
4044 setClient ( client ) ;
4145 setCertificate ( certificate ) ;
46+ setIsCacheEnabled ( isCacheEnabled ) ;
4247 }
4348
4449 function handleModalClose ( ) {
@@ -73,7 +78,7 @@ export default function VerifyCertificateModal({ show, onClose, certificateHash
7378 < CertificateVerifier
7479 client = { client }
7580 certificate = { certificate }
76- certificateChainVerificationCacheEnabled = { enableCertificateChainVerificationCache }
81+ isCacheEnabled = { isCacheEnabled }
7782 onStepChange = { ( step ) =>
7883 setLoading ( step === certificateValidationSteps . validationInProgress )
7984 }
0 commit comments