Rename the parsing errors using the module name
This commit is contained in:
parent
16d4e19617
commit
59c36b0ebe
3 changed files with 6 additions and 6 deletions
|
@ -10,14 +10,14 @@ pub enum Error {
|
|||
IkmNotFound(u32),
|
||||
#[error("parsing error: invalid base64-urlsafe-nopadding data: {0}")]
|
||||
ParsingBase64Error(base64ct::Error),
|
||||
#[error("parsing error: invalid data length: {0} bytes")]
|
||||
ParsingInvalidLength(usize),
|
||||
#[error("parsing error: {0}: unknown scheme")]
|
||||
ParsingUnknownScheme(u32),
|
||||
#[error("parsing error: encoded data: invalid IKM id: {0:?}")]
|
||||
ParsingEncodedDataInvalidIkmId(Vec<u8>),
|
||||
#[error("parsing error: encoded data: invalid number of parts: got {1} instead of {0}")]
|
||||
ParsingEncodedDataInvalidPartLen(usize, usize),
|
||||
#[error("parsing error: ikm: invalid data length: {0} bytes")]
|
||||
ParsingIkmInvalidLength(usize),
|
||||
#[error("parsing error: scheme: {0}: unknown scheme")]
|
||||
ParsingSchemeUnknownScheme(u32),
|
||||
#[error("unable to generate random values: {0}")]
|
||||
RandomSourceError(getrandom::Error),
|
||||
#[error("system time error: {0}")]
|
||||
|
|
|
@ -109,7 +109,7 @@ impl InputKeyMaterialList {
|
|||
pub fn import(s: &str) -> Result<Self> {
|
||||
let data = Base64UrlUnpadded::decode_vec(s)?;
|
||||
if data.len() % IKM_STRUCT_SIZE != 4 {
|
||||
return Err(Error::ParsingInvalidLength(data.len()));
|
||||
return Err(Error::ParsingIkmInvalidLength(data.len()));
|
||||
}
|
||||
let mut ikm_lst = Vec::with_capacity(data.len() / IKM_STRUCT_SIZE);
|
||||
for ikm_slice in data[4..].chunks_exact(IKM_STRUCT_SIZE) {
|
||||
|
|
|
@ -29,7 +29,7 @@ impl TryFrom<u32> for Scheme {
|
|||
fn try_from(value: u32) -> Result<Self, Self::Error> {
|
||||
match value {
|
||||
1 => Ok(Scheme::XChaCha20Poly1305WithBlake3),
|
||||
_ => Err(Error::ParsingUnknownScheme(value)),
|
||||
_ => Err(Error::ParsingSchemeUnknownScheme(value)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue