Skip to content

Commit 1405af9

Browse files
authored
sha-crypt: export CheckError (#724)
Closes #722
1 parent 00cfbc2 commit 1405af9

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

sha-crypt/src/errors.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,17 @@ impl fmt::Display for CryptError {
4444
}
4545
}
4646

47+
/// Errors which occur when verifying passwords.
4748
#[cfg(feature = "simple")]
4849
#[derive(Debug)]
4950
pub enum CheckError {
51+
/// Format is invalid.
5052
InvalidFormat(String),
53+
54+
/// Cryptographic error.
5155
Crypt(CryptError),
56+
57+
/// Password hash doesn't match (invalid password).
5258
HashMismatch,
5359
}
5460

sha-crypt/src/lib.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,12 @@ pub use crate::{
5454
use alloc::{string::String, vec::Vec};
5555
use sha2::{Digest, Sha256, Sha512};
5656

57+
#[cfg(feature = "simple")]
58+
pub use crate::errors::{CheckError, DecodeError};
59+
5760
#[cfg(feature = "simple")]
5861
use {
59-
crate::{defs::SALT_MAX_LEN, errors::CheckError},
62+
crate::defs::SALT_MAX_LEN,
6063
alloc::string::ToString,
6164
base64ct::{Base64ShaCrypt, Encoding},
6265
rand_core::{OsRng, RngCore, TryRngCore},

0 commit comments

Comments
 (0)