crypto: mark errors as `non_exhaustive`
To improve crate version churn, mark the error types as `non_exhaustive`. This removes the need to change the version number of the crate when adding a new variant. Note that these errors are never matched on, so no other code is changed in dependent crates.
This commit is contained in:
parent
30908dcf48
commit
5b260964cb
|
|
@ -28,6 +28,7 @@ pub type SharedSecret = [u8; 32];
|
||||||
/// Error returned if signing fails, eg. due to an HSM or KMS.
|
/// Error returned if signing fails, eg. due to an HSM or KMS.
|
||||||
#[derive(Debug, Clone, Error)]
|
#[derive(Debug, Clone, Error)]
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
|
#[non_exhaustive]
|
||||||
pub struct SignerError {
|
pub struct SignerError {
|
||||||
#[from]
|
#[from]
|
||||||
source: Arc<dyn std::error::Error + Send + Sync>,
|
source: Arc<dyn std::error::Error + Send + Sync>,
|
||||||
|
|
@ -93,6 +94,7 @@ impl fmt::Debug for Signature {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Error, Debug)]
|
#[derive(Error, Debug)]
|
||||||
|
#[non_exhaustive]
|
||||||
pub enum SignatureError {
|
pub enum SignatureError {
|
||||||
#[error("invalid multibase string: {0}")]
|
#[error("invalid multibase string: {0}")]
|
||||||
Multibase(#[from] multibase::Error),
|
Multibase(#[from] multibase::Error),
|
||||||
|
|
@ -273,6 +275,7 @@ impl Deref for SecretKey {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Error, Debug)]
|
#[derive(Error, Debug)]
|
||||||
|
#[non_exhaustive]
|
||||||
pub enum PublicKeyError {
|
pub enum PublicKeyError {
|
||||||
#[error("invalid length {0}")]
|
#[error("invalid length {0}")]
|
||||||
InvalidLength(usize),
|
InvalidLength(usize),
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ use crate::PublicKey;
|
||||||
pub use keystore::{Keystore, Passphrase};
|
pub use keystore::{Keystore, Passphrase};
|
||||||
|
|
||||||
#[derive(Debug, Error)]
|
#[derive(Debug, Error)]
|
||||||
|
#[non_exhaustive]
|
||||||
pub enum ExtendedSignatureError {
|
pub enum ExtendedSignatureError {
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
Ssh(#[from] ssh_key::Error),
|
Ssh(#[from] ssh_key::Error),
|
||||||
|
|
@ -128,6 +129,7 @@ pub mod fmt {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Error)]
|
#[derive(Debug, Error)]
|
||||||
|
#[non_exhaustive]
|
||||||
pub enum SignatureError {
|
pub enum SignatureError {
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
Invalid(#[from] crypto::Error),
|
Invalid(#[from] crypto::Error),
|
||||||
|
|
@ -164,6 +166,7 @@ impl Encodable for crypto::Signature {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Error)]
|
#[derive(Debug, Error)]
|
||||||
|
#[non_exhaustive]
|
||||||
pub enum PublicKeyError {
|
pub enum PublicKeyError {
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
Invalid(#[from] crypto::Error),
|
Invalid(#[from] crypto::Error),
|
||||||
|
|
@ -199,6 +202,7 @@ impl Encodable for PublicKey {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Error)]
|
#[derive(Debug, Error)]
|
||||||
|
#[non_exhaustive]
|
||||||
pub enum SecretKeyError {
|
pub enum SecretKeyError {
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
Encoding(#[from] encoding::Error),
|
Encoding(#[from] encoding::Error),
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ use super::ExtendedSignature;
|
||||||
pub type Passphrase = Zeroizing<String>;
|
pub type Passphrase = Zeroizing<String>;
|
||||||
|
|
||||||
#[derive(Debug, Error)]
|
#[derive(Debug, Error)]
|
||||||
|
#[non_exhaustive]
|
||||||
pub enum Error {
|
pub enum Error {
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
Io(#[from] io::Error),
|
Io(#[from] io::Error),
|
||||||
|
|
@ -227,6 +228,7 @@ impl Keystore {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Error)]
|
#[derive(Debug, Error)]
|
||||||
|
#[non_exhaustive]
|
||||||
pub enum MemorySignerError {
|
pub enum MemorySignerError {
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
Keystore(#[from] Error),
|
Keystore(#[from] Error),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue