Function format

Source
pub fn format<P: AsRef<Path>>(path: P) -> Result<CryptDeviceFormatBuilder>
Expand description

Builder to format a crypt device at the specified path

ยงExamples

use cryptsetup_rs::*;
use uuid::Uuid;

let uuid = Uuid::new_v4();
let device = format("/dev/loop0")?
    .rng_type(crypt_rng_type::CRYPT_RNG_URANDOM)
    .iteration_time(5000)
    .luks1("aes", "xts-plain", "sha256", 256, Some(&uuid))?;

For LUKS2:

use cryptsetup_rs::*;

let device = format("/dev/loop0")?
    .luks2("aes", "xts-plain", 256, None, None, None)
    .label("test")
    .argon2i("sha256", 200, 1, 1024, 1)
    .start();