Skip to content

Commit

Permalink
fixed small oversight
Browse files Browse the repository at this point in the history
  • Loading branch information
sokorototo committed May 14, 2024
1 parent 4fe012b commit 10feec4
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 13 deletions.
2 changes: 1 addition & 1 deletion vach/src/global/reg_entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ impl RegistryEntry {
#[inline(always)]
pub(crate) fn empty() -> RegistryEntry {
RegistryEntry {
id: Arc::from("<EMPTY ID>"),
id: Arc::from("<NULL ID>"),
flags: Flags::empty(),
content_version: 0,
location: 0,
Expand Down
15 changes: 3 additions & 12 deletions vach/src/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ fn fetch_with_signature() -> InternalResult {
config.load_public_key(keypair)?;

let mut archive = Archive::with_config(target, &config)?;
dbg!(archive.entries());
let resource = archive.fetch_mut("test_data/song.txt")?;
let song = str::from_utf8(&resource.data).unwrap();

Expand All @@ -178,17 +177,9 @@ fn fetch_with_signature() -> InternalResult {
assert!(!not_signed_resource.authenticated);

// Check authenticity of retrieved data
let song = song.trim();
println!("{}", song);

// Windows bullshit
#[cfg(target_os = "windows")]
{
assert_eq!(song.len(), 2041);
}
#[cfg(not(any(target_os = "windows", target_os = "ios")))]
{
assert_eq!(song.len(), 1977);
}
assert_eq!(song.len(), 1977);

assert!(resource.authenticated);
assert!(resource.flags.contains(Flags::SIGNED_FLAG));
Expand All @@ -198,7 +189,7 @@ fn fetch_with_signature() -> InternalResult {

#[test]
#[cfg(feature = "crypto")]
fn edcryptor_test() -> InternalResult {
fn decryptor_test() -> InternalResult {
use crate::crypto_utils::gen_keypair;

let vk = gen_keypair().verifying_key();
Expand Down
4 changes: 4 additions & 0 deletions vach/src/writer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,10 @@ impl<'a> Builder<'a> {
.map(|l| Builder::process_leaf(l, encryptor.as_ref()))
.try_for_each(write)?;

// write out Registry
target.seek(SeekFrom::Start(Header::BASE_SIZE as _))?;
target.write_all(&registry)?;

// // Define all arc-mutexes
// let leaf_offset_arc = Arc::new(AtomicU64::new(leaf_offset));
// let total_arc = Arc::new(AtomicUsize::new(Header::BASE_SIZE));
Expand Down
Binary file modified vach/test_data/encrypted/target.vach
Binary file not shown.
Binary file modified vach/test_data/signed/target.vach
Binary file not shown.
Binary file modified vach/test_data/simple/target.vach
Binary file not shown.

0 comments on commit 10feec4

Please sign in to comment.