Files
Lucas RayanandClaude Sonnet 5 6328220c60
CI / Format and clippy (push) Successful in 1m57s
CI / Dependency audit (push) Successful in 13s
CI / Check desktop app (Linux) (push) Successful in 3m54s
CI / Tests (Linux) (push) Failing after 7m25s
Release / Create release (push) Successful in 6s
Release / CLI (linux-aarch64) (push) Successful in 1m48s
Release / CLI (linux-x86_64) (push) Successful in 2m39s
Release / Desktop app (linux-aarch64) (push) Successful in 10m9s
Release / Desktop app (linux-x86_64) (push) Successful in 12m20s
Release / Desktop app (windows) (push) Successful in 7m32s
Release / Build latest.json (push) Successful in 5s
chore(i18n): finish translating code comments and scripts to English
Completes the English-only standardization for code, comments, scripts
and CI templates (UI/CLI-facing strings stay bilingual pt-BR/en,
untouched). Covers the remaining crates/, apps/gui/ui/ and
apps/gui/src-tauri/ comments, .gitea/ workflow and template comments,
.githooks/ hooks, and the scripts/ source comments for the files
already renamed in a prior commit (check.sh, generate-logo.py,
install-hooks.sh).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VAyr8d7HuAdUGB6aA5xmDD
2026-10-30 20:43:02 -03:00

40 lines
1.4 KiB
Rust

//! FileVault 2 (Core Storage): `cryptsetup` reference image (password `heslo123`).
use guara_core::crypt::{filevault, Secret, UnlockError};
use guara_core::hashing::MultiHasher;
use guara_core::source::{FileSource, Source};
use std::sync::Arc;
#[test]
fn opens_reference_image_and_matches_known_hash() {
let p = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR"))
.join("../../target/testdata/fvault2-images/small");
if !p.exists() {
eprintln!("SKIP: execute scripts/fetch-testdata.sh");
return;
}
let src: Arc<dyn Source> = Arc::new(FileSource::open(&p).unwrap());
assert!(matches!(
filevault::unlock(src.clone(), &[Secret::Password("errada".into())]),
Err(UnlockError::WrongSecret)
));
let u = filevault::unlock(src, &[Secret::Password("heslo123".into())]).unwrap();
assert_eq!(u.source.size(), 167_772_160);
assert_eq!(
guara_core::crypt::to_hex(u.volume_key.as_ref().unwrap()),
"20734d3389212774d7610c29d732880 9".replace(' ', "")
);
let mut h = MultiHasher::new();
let mut off = 0;
let mut buf = vec![0u8; 1 << 20];
while off < u.source.size() {
let n = u.source.read_at(off, &mut buf).unwrap();
h.update(&buf[..n]);
off += n as u64;
}
assert_eq!(
h.finalize().sha256,
"2c662e36c0f7e2f5583e6a939bbcbdc660805692d0fccaa45ad4052beb3b8e18"
);
}