Skip to content

Commit

Permalink
Add common error type
Browse files Browse the repository at this point in the history
  • Loading branch information
Kijewski committed Sep 14, 2023
1 parent f8c044a commit fd6adb6
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "zipsign"
description = "Sign and verify `.zip` and `.tar.gz` files with an ed25519 signing key"
version = "0.1.0-a.0"
version = "0.1.0-a.1"
edition = "2021"
authors = ["René Kijewski <[email protected]>"]
repository = "https://github.com/Kijewski/zipsign"
Expand All @@ -22,7 +22,7 @@ thiserror = "1"
zip = { version = "0.6", default-features = false }

[workspace.dependencies.zipsign-api]
version = "0.1.0-a.0"
version = "0.1.0-a.1"
path = "api"
default-features = false
features = ["verify-tar", "verify-zip", "sign-tar", "sign-zip"]
Expand Down
2 changes: 1 addition & 1 deletion api/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "zipsign-api"
description = "Sign and verify `.zip` and `.tar.gz` files with an ed25519 signing key"
version = "0.1.0-a.0"
version = "0.1.0-a.1"
edition = "2021"
authors = ["René Kijewski <[email protected]>"]
repository = "https://github.com/Kijewski/zipsign"
Expand Down
38 changes: 38 additions & 0 deletions api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,41 @@ where
let _: u64 = copy(input, &mut prehashed_message)?;
Ok(prehashed_message)
}

/// A collection of all error this library can return
#[non_exhaustive]
#[derive(Debug, thiserror::Error)]
#[error(transparent)]
pub enum ZipsignError {
/// An error returned by [`gather_signature_data()`][sign::gather_signature_data]
#[cfg_attr(docsrs, doc(cfg(feature = "sign")))]
GatherSignatureData(#[from] sign::GatherSignatureDataError),
/// An error returned by [`read_signing_keys()`][sign::read_signing_keys]
#[cfg_attr(docsrs, doc(cfg(feature = "sign")))]
ReadSigningKeys(#[from] sign::ReadSigningKeysError),
/// An error returned by [`copy_and_sign_tar()`][sign::copy_and_sign_tar]
#[cfg_attr(docsrs, doc(cfg(feature = "sign-tar")))]
SignTar(#[from] sign::SignTarError),
/// An error returned by [`copy_and_sign_zip()`][sign::copy_and_sign_zip]
#[cfg_attr(docsrs, doc(cfg(feature = "sign-zip")))]
SignZip(#[from] sign::SignZipError),

/// No matching key/signature pair found
#[cfg_attr(docsrs, doc(cfg(feature = "verify")))]
NoMatch(#[from] verify::NoMatch),
/// An error returned by [`collect_keys()`][verify::collect_keys]
#[cfg_attr(docsrs, doc(cfg(feature = "verify")))]
CollectKeys(#[from] verify::CollectKeysError),
/// An error returned by [`read_signatures()`][verify::read_signatures]
#[cfg_attr(docsrs, doc(cfg(feature = "verify")))]
ReadSignatures(#[from] verify::ReadSignaturesError),
/// An error returned by [`verify_tar()`][verify::verify_tar]
#[cfg_attr(docsrs, doc(cfg(feature = "verify-tar")))]
VerifyTar(#[from] verify::VerifyTarError),
/// An error retuned by [`verify_zip()`][verify::verify_zip]
#[cfg_attr(docsrs, doc(cfg(feature = "verify-zip")))]
VerifyZip(#[from] verify::VerifyZipError),

/// An I/O occurred
Io(#[from] std::io::Error),
}

0 comments on commit fd6adb6

Please sign in to comment.