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.
|
||||
#[derive(Debug, Clone, Error)]
|
||||
#[error(transparent)]
|
||||
#[non_exhaustive]
|
||||
pub struct SignerError {
|
||||
#[from]
|
||||
source: Arc<dyn std::error::Error + Send + Sync>,
|
||||
|
|
@ -93,6 +94,7 @@ impl fmt::Debug for Signature {
|
|||
}
|
||||
|
||||
#[derive(Error, Debug)]
|
||||
#[non_exhaustive]
|
||||
pub enum SignatureError {
|
||||
#[error("invalid multibase string: {0}")]
|
||||
Multibase(#[from] multibase::Error),
|
||||
|
|
@ -273,6 +275,7 @@ impl Deref for SecretKey {
|
|||
}
|
||||
|
||||
#[derive(Error, Debug)]
|
||||
#[non_exhaustive]
|
||||
pub enum PublicKeyError {
|
||||
#[error("invalid length {0}")]
|
||||
InvalidLength(usize),
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ use crate::PublicKey;
|
|||
pub use keystore::{Keystore, Passphrase};
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
#[non_exhaustive]
|
||||
pub enum ExtendedSignatureError {
|
||||
#[error(transparent)]
|
||||
Ssh(#[from] ssh_key::Error),
|
||||
|
|
@ -128,6 +129,7 @@ pub mod fmt {
|
|||
}
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
#[non_exhaustive]
|
||||
pub enum SignatureError {
|
||||
#[error(transparent)]
|
||||
Invalid(#[from] crypto::Error),
|
||||
|
|
@ -164,6 +166,7 @@ impl Encodable for crypto::Signature {
|
|||
}
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
#[non_exhaustive]
|
||||
pub enum PublicKeyError {
|
||||
#[error(transparent)]
|
||||
Invalid(#[from] crypto::Error),
|
||||
|
|
@ -199,6 +202,7 @@ impl Encodable for PublicKey {
|
|||
}
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
#[non_exhaustive]
|
||||
pub enum SecretKeyError {
|
||||
#[error(transparent)]
|
||||
Encoding(#[from] encoding::Error),
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ use super::ExtendedSignature;
|
|||
pub type Passphrase = Zeroizing<String>;
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
#[non_exhaustive]
|
||||
pub enum Error {
|
||||
#[error(transparent)]
|
||||
Io(#[from] io::Error),
|
||||
|
|
@ -227,6 +228,7 @@ impl Keystore {
|
|||
}
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
#[non_exhaustive]
|
||||
pub enum MemorySignerError {
|
||||
#[error(transparent)]
|
||||
Keystore(#[from] Error),
|
||||
|
|
|
|||
Loading…
Reference in New Issue