1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
//! FerroCrypt Archive (FCA) v1 — native archive payload format.
//!
//! Full wire-format spec: `ferrocrypt-lib/FORMAT.md` §9.
pub
pub
pub
pub
pub
pub
pub
pub
pub use ArchiveLimits;
pub use unarchive;
pub use ;
pub use PERMISSION_BITS_MASK;
/// Policy for the `.incomplete` working tree when decrypt fails.
///
/// During decryption the archive is staged under
/// `{output_dir}/{root_name}.incomplete` and atomically renamed to
/// `{output_dir}/{root_name}` only after every authentication and
/// validation check has passed. This policy controls what happens to
/// the staged tree when a decrypt error occurs *before* that rename:
/// payload AEAD failure on a later chunk, archive structural reject
/// (manifest tree-shape failure, path-grammar reject, duplicate
/// detection), trailing-bytes reject, or a final-name collision
/// discovered at promotion time.
///
/// [`Self::DeleteOnError`] is the default. It matches the typical user
/// expectation that "decrypt failed → no plaintext on disk" and avoids
/// leaving authenticated-but-incomplete plaintext that an unaware
/// caller could pick up.
///
/// [`Self::RetainOnError`] is the opt-in for backup-recovery and
/// forensic flows where partial plaintext is more useful than no
/// plaintext.
///
/// Note: this policy only governs cleanup of the `.incomplete` working
/// tree on a normal `Err` return. Process termination (crash, SIGKILL,
/// power loss) AND panic-unwind bypass cleanup entirely, so a
/// `.incomplete` left by a killed or panicking process is available
/// for recovery regardless of the policy. The library does not wrap
/// extraction in `catch_unwind`; if a panic propagates out of
/// `unarchive`, treat the working tree as if the process had been
/// killed: it may contain authenticated-but-incomplete plaintext that
/// the caller must inspect or remove explicitly.