sos-integrity 0.17.1

Integrity checks for the Save Our Secrets SDK.
Documentation
use sos_core::commit::CommitHash;
use thiserror::Error;
use uuid::Uuid;

/// Errors generated by the integrity library.
#[derive(Debug, Error)]
pub enum Error {
    /// Error generated when event log row data does
    /// not match the commit hash.
    #[error("row '{id}' checksums do not match, expected {commit} but got {value}")]
    VaultHashMismatch {
        /// Expected commit hash.
        commit: CommitHash,
        /// Commit hash of the value.
        value: CommitHash,
        /// Record identifier.
        id: Uuid,
    },

    /// Error generated when event log row data does
    /// not match the commit hash.
    #[error("row checksums do not match, expected {commit} but got {value}")]
    HashMismatch {
        /// Expected commit hash.
        commit: CommitHash,
        /// Commit hash of the value.
        value: CommitHash,
    },

    /// Error generated converting to fixed length slice.
    #[error(transparent)]
    TryFromSlice(#[from] std::array::TryFromSliceError),

    /// Error generated by the core library.
    #[error(transparent)]
    Core(#[from] sos_core::Error),

    /// Error generated by the backend library.
    #[error(transparent)]
    Backend(#[from] sos_backend::Error),

    /// Error generated by the vault library.
    #[error(transparent)]
    Vault(#[from] sos_vault::Error),

    /// Error generated by the filesystem library.
    #[error(transparent)]
    FileSystem(#[from] sos_filesystem::Error),

    /// Error generated by the database library.
    #[error(transparent)]
    Database(#[from] sos_database::Error),

    /// Error generated by the sqlite library.
    #[error(transparent)]
    AsyncSqlite(#[from] sos_database::async_sqlite::Error),

    /// Error generated by the sqlite library.
    #[error(transparent)]
    Sqlite(#[from] sos_database::async_sqlite::rusqlite::Error),

    /// Error generated by the IO module.
    #[error(transparent)]
    Io(#[from] std::io::Error),

    /// Error generated parsing UUIDs.
    #[error(transparent)]
    Uuid(#[from] uuid::Error),

    /// Error generated when attempting to join a task.
    #[error(transparent)]
    Join(#[from] tokio::task::JoinError),
}