pub fn new(
        config: &CryptoConfig,
        logger: Option<ReplicaLogger>,
        metrics: Arc<CryptoMetrics>,
    ) -> Self {
        let logger = logger.unwrap_or_else(no_op_logger);
        let secret_key_store =
            ProtoSecretKeyStore::open(&config.crypto_root, Some(new_logger!(&logger)));
        let node_public_keys = match read_node_public_keys(&config.crypto_root) {
            Ok(node_pks) => node_pks,
            Err(_) => Default::default(),
        };
        let public_key_data = PublicKeyData::new(node_public_keys);

        Csp {
            csprng: CspRwLock::new_for_rng(OsRng::default(), Arc::clone(&metrics)),
            public_key_data,
            secret_key_store: CspRwLock::new_for_sks(secret_key_store, metrics),
            logger,
        }
    }
/// Creates a production-grade crypto service provider.
Creates a production-grade crypto service provider.
Creates a production - grade crypto service provider .
pub fn new(
        config: &CryptoConfig,
        logger: Option<ReplicaLogger>,
        metrics: Arc<CryptoMetrics>,
    ) -> Self {
        let logger = logger.unwrap_or_else(no_op_logger);
        let secret_key_store =
            ProtoSecretKeyStore::open(&config.crypto_root, Some(new_logger!(&logger)));
        let node_public_keys = match read_node_public_keys(&config.crypto_root) {
            Ok(node_pks) => node_pks,
            Err(_) => Default::default(),
        };
        let public_key_data = PublicKeyData::new(node_public_keys);
        Csp {
            csprng: CspRwLock::new_for_rng(OsRng::default(), Arc::clone(&metrics)),
            public_key_data,
            secret_key_store: CspRwLock::new_for_sks(secret_key_store, metrics),
            logger,
        }
    }
pub fn new ( config : & CryptoConfig , logger : Option < ReplicaLogger > , metrics : Arc < CryptoMetrics > , ) -> Self { let logger = logger . unwrap_or_else ( no_op_logger ) ; let secret_key_store = ProtoSecretKeyStore :: open ( & config . crypto_root , Some ( new_logger ! ( logger ) ) ) ; let node_public_keys = match read_node_public_keys ( & config . crypto_root ) { Ok ( node_pks ) => node_pks , Err ( _ ) => Default :: default ( ) , } ; let public_key_data = PublicKeyData :: new ( node_public_keys ) ; Csp { csprng : CspRwLock :: new_for_rng ( OsRng :: default ( ) , Arc :: clone ( & metrics ) ) , public_key_data , secret_key_store : CspRwLock :: new_for_sks ( secret_key_store , metrics ) , logger , } }
Creates a production-grade crypto service provider.
Creates a production - grade crypto service provider .
config
&CryptoConfig
logger
Option<ReplicaLogger>
metrics
Arc<CryptoMetrics>
config
&CryptoConfig
logger
Option<ReplicaLogger>
metrics
Arc<CryptoMetrics>