mirror of
https://github.com/rustic-rs/rustic.git
synced 2025-10-26 11:18:51 +00:00
cargo fmt
This commit is contained in:
parent
09d58a5782
commit
28401ff025
@ -24,7 +24,7 @@ pub(super) fn execute(be: &impl ReadBackend, opts: Opts) -> Result<()> {
|
||||
}
|
||||
})?;
|
||||
|
||||
let index= BoomIndex::from_iter(AllIndexFiles::new(be.clone()).into_iter());
|
||||
let index = BoomIndex::from_iter(AllIndexFiles::new(be.clone()).into_iter());
|
||||
let snap = SnapshotFile::from_backend(be, id)?;
|
||||
|
||||
for path_node in TreeIterator::from_id(be.clone(), index, snap.tree) {
|
||||
|
||||
@ -45,7 +45,7 @@ pub fn execute() -> Result<()> {
|
||||
let args = Opts::parse();
|
||||
|
||||
let be = LocalBackend::new(&args.repository);
|
||||
let passwd = fs::read_to_string(&args.password_file)?.replace("\n","");
|
||||
let passwd = fs::read_to_string(&args.password_file)?.replace("\n", "");
|
||||
let key = repo::find_key_in_backend(&be, &passwd, None)?;
|
||||
let dbe = DecryptBackend::new(&be, key);
|
||||
|
||||
|
||||
@ -28,8 +28,7 @@ impl KeyFile {
|
||||
let salt = base64::decode(&self.salt)?;
|
||||
|
||||
let mut key = [0; 64];
|
||||
scrypt::scrypt(passwd.as_ref(), &salt, ¶ms, &mut key)
|
||||
.expect("output length invalid?");
|
||||
scrypt::scrypt(passwd.as_ref(), &salt, ¶ms, &mut key).expect("output length invalid?");
|
||||
|
||||
Ok(Key::from_slice(&key))
|
||||
}
|
||||
@ -93,7 +92,11 @@ impl MasterKey {
|
||||
|
||||
/// Find a KeyFile in the backend that fits to the given password and return the contained key
|
||||
/// If a key hint is given, only this key is tested (recommended for a large number of keys)
|
||||
pub fn find_key_in_backend<B: ReadBackend>(be: &B, passwd: &impl AsRef<[u8]>, hint: Option<Id>) -> Result<Key> {
|
||||
pub fn find_key_in_backend<B: ReadBackend>(
|
||||
be: &B,
|
||||
passwd: &impl AsRef<[u8]>,
|
||||
hint: Option<Id>,
|
||||
) -> Result<Key> {
|
||||
match hint {
|
||||
Some(id) => KeyFile::from_backend(be, id)?.key_from_password(passwd),
|
||||
None => be
|
||||
|
||||
Loading…
Reference in New Issue
Block a user