pub struct SchemaHasher;Expand description
Schema hasher for adding integrity verification to schemas
Implementations§
Source§impl SchemaHasher
impl SchemaHasher
Sourcepub fn calculate_hash(schema_json: &Value) -> Result<String, SchemaError>
pub fn calculate_hash(schema_json: &Value) -> Result<String, SchemaError>
Calculate hash for a schema JSON, excluding hash, payment_config, and permission_policy fields
Sourcepub fn add_hash_to_schema(
schema_json: &mut Value,
) -> Result<String, SchemaError>
pub fn add_hash_to_schema( schema_json: &mut Value, ) -> Result<String, SchemaError>
Add or update hash field in a schema JSON
Sourcepub fn verify_schema_hash(schema_json: &Value) -> Result<bool, SchemaError>
pub fn verify_schema_hash(schema_json: &Value) -> Result<bool, SchemaError>
Verify that a schema’s hash matches its content
Sourcepub fn hash_schema_file(file_path: &Path) -> Result<String, SchemaError>
pub fn hash_schema_file(file_path: &Path) -> Result<String, SchemaError>
Process a schema file: read, add/update hash, and write back
Sourcepub fn hash_schemas_directory<P: AsRef<Path>>(
directory_path: P,
) -> Result<Vec<(String, String)>, SchemaError>
pub fn hash_schemas_directory<P: AsRef<Path>>( directory_path: P, ) -> Result<Vec<(String, String)>, SchemaError>
Process all schema files in the specified directory
Sourcepub fn hash_available_schemas_directory() -> Result<Vec<(String, String)>, SchemaError>
pub fn hash_available_schemas_directory() -> Result<Vec<(String, String)>, SchemaError>
Process all schema files in the available_schemas directory (convenience method)
Sourcepub fn verify_schemas_directory<P: AsRef<Path>>(
directory_path: P,
) -> Result<Vec<(String, bool)>, SchemaError>
pub fn verify_schemas_directory<P: AsRef<Path>>( directory_path: P, ) -> Result<Vec<(String, bool)>, SchemaError>
Verify all schemas in the specified directory
Sourcepub fn verify_available_schemas_directory() -> Result<Vec<(String, bool)>, SchemaError>
pub fn verify_available_schemas_directory() -> Result<Vec<(String, bool)>, SchemaError>
Verify all schemas in the available_schemas directory (convenience method)
Auto Trait Implementations§
impl Freeze for SchemaHasher
impl RefUnwindSafe for SchemaHasher
impl Send for SchemaHasher
impl Sync for SchemaHasher
impl Unpin for SchemaHasher
impl UnwindSafe for SchemaHasher
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.