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
//! Bundle integrity verification using cryptographic hashes.
//!
//! ## Integrity Format
//!
//! Integrity hashes are formatted as `<algorithm>:<base64-hash>`.
//!
//! ```text
//! sha256:base64hash...
//! ```
//!
//! ## Example
//!
//! ```no_run
//! # #[cfg(feature = "integrity")]
//! # async {
//! use wvb::integrity::{Integrity, IntegrityAlgorithm, IntegrityCheck};
//!
//! let data = b"<html></html>";
//!
//! // Compute an integrity string over some bytes.
//! let integrity = Integrity::compute(IntegrityAlgorithm::Sha256, data).serialize();
//! println!("Integrity: {integrity}");
//!
//! // Verify bytes against it.
//! IntegrityCheck::Default.check(&integrity, data).await.unwrap();
//! # };
//! ```
//!
//! ## Integrity Policy
//!
//! [`IntegrityPolicy`] controls how a bundle's integrity metadata is treated when the
//! check runs — required ([`IntegrityPolicy::Strict`]), checked when present
//! ([`IntegrityPolicy::Optional`]), or disabled ([`IntegrityPolicy::Off`]). It is applied
//! through [`crate::source::BundleSourceOptions::integrity`] (on load) and
//! [`crate::updater::UpdaterOptions::integrity_policy`] (on download/install).
//!
//! ```no_run
//! # #[cfg(all(feature = "integrity", feature = "source"))]
//! # {
//! use wvb::integrity::IntegrityPolicy;
//! use wvb::source::{BundleSourceIntegrityOptions, BundleSourceOptions};
//!
//! // Require integrity metadata on every bundle this source verifies on load.
//! let options = BundleSourceOptions::default()
//! .integrity(BundleSourceIntegrityOptions::default().policy(IntegrityPolicy::Strict));
//! # let _ = options;
//! # }
//! ```
pub use *;
pub use *;
pub use *;