/// Creates a new CryptoConfig in a temporary directory and returns the
/// config together with the temporary directory.
Creates a new CryptoConfig in a temporary directory and returns the
config together with the temporary directory.
Creates a new CryptoConfig in a temporary directory and returns the config together with the temporary directory .
pub fn new_in_temp_dir() -> (Self, TempDir) {
        let temp_dir = tempfile::Builder::new()
            .prefix("ic_crypto_")
            .tempdir()
            .unwrap();
        fs::set_permissions(temp_dir.path(), Permissions::from_mode(0o750)).unwrap_or_else(|_| {
            panic!(
                "Could not set the permissions of the new test directory {}",
                temp_dir.path().display()
            )
        });
        let temp_dir_path = temp_dir.path().to_path_buf();
        CryptoConfig::check_dir_has_required_permissions(&temp_dir_path)
            .expect("Wrong dir permissions");
        let config = CryptoConfig::new(temp_dir_path);
        (config, temp_dir)
    }
pub fn new_in_temp_dir ( ) -> ( Self , TempDir ) { let temp_dir = tempfile :: Builder :: new ( ) . prefix ( " " ) . tempdir ( ) . unwrap ( ) ; fs :: set_permissions ( temp_dir . path ( ) , Permissions :: from_mode ( 0o750 ) ) . unwrap_or_else ( | _ | { panic ! ( " " temp_dir path ( ) display ( ) ) } ) ; let temp_dir_path = temp_dir . path ( ) . to_path_buf ( ) ; CryptoConfig :: check_dir_has_required_permissions ( & temp_dir_path ) . expect ( " " ) ; let config = CryptoConfig :: new ( temp_dir_path ) ; ( config , temp_dir ) }
Creates a new CryptoConfig in a temporary directory and returns the
config together with the temporary directory.
Creates a new CryptoConfig in a temporary directory and returns the config together with the temporary directory .