c2pa-rs

A fork of https://github.com/contentauth/c2pa-rs/
git clone git://archive.git.mtrnord.blog/mtrnords-photography-manager/c2pa-rs.git
Log | Files | Refs | README

commit b51a842dada756e17fd75693303ac66d3720c97f
parent 5b94235e8db04f92537fa7f772307aa17e33150f
Author: MTRNord <mtrnord1@gmail.com>
Date:   Sun, 23 Jun 2024 15:14:44 +0200

Minor fixes

Diffstat:
Msdk/src/manifest_store.rs | 17+++++++++--------
Msdk/src/store.rs | 24++++++++++++------------
2 files changed, 21 insertions(+), 20 deletions(-)

diff --git a/sdk/src/manifest_store.rs b/sdk/src/manifest_store.rs @@ -11,12 +11,12 @@ // specific language governing permissions and limitations under // each license. -#[cfg(feature = "file_io")] -use std::path::Path; use std::{ collections::HashMap, io::{Read, Seek, Write}, }; +#[cfg(feature = "file_io")] +use std::path::Path; use async_generic::async_generic; #[cfg(feature = "json_schema")] @@ -25,12 +25,12 @@ use serde::{Deserialize, Serialize}; use crate::{ claim::ClaimAssetData, + Error, jumbf::labels::manifest_label_from_uri, + Manifest, + Result, status_tracker::{DetailedStatusTracker, StatusTracker}, - store::Store, - utils::base64, - validation_status::{status_for_store, ValidationStatus}, - Error, Manifest, Result, + store::Store, utils::base64, validation_status::{status_for_store, ValidationStatus}, }; #[derive(Debug, Serialize, Deserialize)] @@ -158,7 +158,7 @@ impl ManifestStore { Ok(manifest) => { manifest_store .manifests - .insert(manifest_label.to_owned(), manifest); + .insert(manifest_label.to_string(), manifest); } Err(e) => { statuses.push(ValidationStatus::from_error(&e)); @@ -460,9 +460,10 @@ mod tests { #[cfg(target_arch = "wasm32")] use wasm_bindgen_test::*; - use super::*; use crate::{status_tracker::OneShotStatusTracker, utils::test::create_test_store}; + use super::*; + #[cfg(target_arch = "wasm32")] wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser); diff --git a/sdk/src/store.rs b/sdk/src/store.rs @@ -375,7 +375,7 @@ impl Store { } /// Returns an Assertion referenced by JUMBF URI. The URI should be absolute and include - /// the desired Claim in the path. If you need to specify the Claim for this URI use + /// the desired Claim in the path. If you need to specify the Claim for this URI use /// get_assertion_from_uri_and_claim. /// uri - The JUMBF URI for desired Assertion. pub fn get_assertion_from_uri(&self, uri: &str) -> Option<&Assertion> { @@ -1467,7 +1467,7 @@ impl Store { /// store: Store to validate /// xmp_str: String containing entire XMP block of the asset /// asset_bytes: bytes of the asset to be verified - /// validation_log: If present all found errors are logged and returned, other wise first error causes exit and is returned + /// validation_log: If present all found errors are logged and returned, other wise first error causes exit and is returned pub async fn verify_store_async( store: &Store, asset_data: &mut ClaimAssetData<'_>, @@ -1505,7 +1505,7 @@ impl Store { /// store: Store to validate /// xmp_str: String containing entire XMP block of the asset /// asset_bytes: bytes of the asset to be verified - /// validation_log: If present all found errors are logged and returned, other wise first error causes exit and is returned + /// validation_log: If present all found errors are logged and returned, other wise first error causes exit and is returned pub fn verify_store( store: &Store, asset_data: &mut ClaimAssetData<'_>, @@ -1855,10 +1855,10 @@ impl Store { /// BMFF hash binding. If a BMFF data hash or box hash is detected that is /// an error. The DataHash placeholder assertion will be adjusted to the contain /// the correct values. If the asset_reader value is supplied it will also perform - /// the hash calculations, otherwise the function uses the caller supplied values. + /// the hash calculations, otherwise the function uses the caller supplied values. /// It is an error if `get_data_hashed_manifest_placeholder` was not called first /// as this call inserts the DataHash placeholder assertion to reserve space for the - /// actual hash values not required when using BoxHashes. + /// actual hash values not required when using BoxHashes. pub fn get_data_hashed_embeddable_manifest( &mut self, dh: &DataHash, @@ -1885,10 +1885,10 @@ impl Store { /// BMFF hash binding. If a BMFF data hash or box hash is detected that is /// an error. The DataHash placeholder assertion will be adjusted to the contain /// the correct values. If the asset_reader value is supplied it will also perform - /// the hash calculations, otherwise the function uses the caller supplied values. + /// the hash calculations, otherwise the function uses the caller supplied values. /// It is an error if `get_data_hashed_manifest_placeholder` was not called first /// as this call inserts the DataHash placeholder assertion to reserve space for the - /// actual hash values not required when using BoxHashes. + /// actual hash values not required when using BoxHashes. pub async fn get_data_hashed_embeddable_manifest_async( &mut self, dh: &DataHash, @@ -1917,10 +1917,10 @@ impl Store { /// BMFF hash binding. If a BMFF data hash or box hash is detected that is /// an error. The DataHash placeholder assertion will be adjusted to the contain /// the correct values. If the asset_reader value is supplied it will also perform - /// the hash calculations, otherwise the function uses the caller supplied values. + /// the hash calculations, otherwise the function uses the caller supplied values. /// It is an error if `get_data_hashed_manifest_placeholder` was not called first /// as this call inserts the DataHash placeholder assertion to reserve space for the - /// actual hash values not required when using BoxHashes. + /// actual hash values not required when using BoxHashes. pub async fn get_data_hashed_embeddable_manifest_remote( &mut self, dh: &DataHash, @@ -2014,7 +2014,7 @@ impl Store { /// Returns the supplied manifest composed to be directly compatible with the desired format. /// For example, if format is JPEG function will return the set of APP11 segments that contains - /// the manifest. Similarly for PNG it would be the PNG chunk complete with header and CRC. + /// the manifest. Similarly for PNG it would be the PNG chunk complete with header and CRC. pub fn get_composed_manifest(manifest_bytes: &[u8], format: &str) -> Result<Vec<u8>> { if let Some(h) = get_assetio_handler(format) { if let Some(composed_data_handler) = h.composed_data_ref() { @@ -2728,7 +2728,7 @@ impl Store { /// Verify Store from an existing asset /// asset_path: path to input asset - /// validation_log: If present all found errors are logged and returned, otherwise first error causes exit and is returned + /// validation_log: If present all found errors are logged and returned, otherwise first error causes exit and is returned #[cfg(feature = "file_io")] pub fn verify_from_path( &mut self, @@ -2928,7 +2928,7 @@ impl Store { /// Load Store from claims in an existing asset /// asset_path: path to input asset /// verify: determines whether to verify the contents of the provenance claim. Must be set true to use validation_log - /// validation_log: If present all found errors are logged and returned, otherwise first error causes exit and is returned + /// validation_log: If present all found errors are logged and returned, otherwise first error causes exit and is returned #[cfg(feature = "file_io")] pub fn load_from_asset( asset_path: &Path,