diff --git a/src/error.rs b/src/error.rs index 61b1ba7..f225373 100644 --- a/src/error.rs +++ b/src/error.rs @@ -32,8 +32,10 @@ pub enum Error { ParsingEncodedDataInvalidPartLen(usize, usize), #[error("parsing error: encoded data: invalid timestamp: {0:?}")] ParsingEncodedDataInvalidTimestamp(Vec), - #[error("parsing error: encoded data: invalid version")] - ParsingEncodedDataInvalidVersion, + #[error("parsing error: encoded data: invalid IKML version")] + ParsingEncodedDataInvalidIkmlVersion, + #[error("parsing error: encoded data: invalid encrypted data version")] + ParsingEncodedDataInvalidEncVersion, #[error("parsing error: scheme: {0}: unknown scheme")] ParsingSchemeUnknownScheme(crate::scheme::SchemeSerializeType), #[error("unable to generate random values: {0}")] diff --git a/src/storage.rs b/src/storage.rs index 0115ecb..4e6bcac 100644 --- a/src/storage.rs +++ b/src/storage.rs @@ -59,7 +59,7 @@ pub(crate) fn encode_cipher( pub(crate) fn decode_ikm_list(data: &str) -> Result { let data = data .strip_prefix(crate::STORAGE_IKML_VERSION) - .ok_or(Error::ParsingEncodedDataInvalidVersion)?; + .ok_or(Error::ParsingEncodedDataInvalidIkmlVersion)?; let v: Vec<&str> = data.split(STORAGE_SEPARATOR).collect(); if v.is_empty() { return Err(Error::ParsingEncodedDataInvalidIkmListLen(v.len())); @@ -85,7 +85,7 @@ pub(crate) fn decode_ikm_list(data: &str) -> Result { pub(crate) fn decode_cipher(data: &str) -> Result<(IkmId, EncryptedData, Option)> { let data = data .strip_prefix(crate::STORAGE_ENC_VERSION) - .ok_or(Error::ParsingEncodedDataInvalidVersion)?; + .ok_or(Error::ParsingEncodedDataInvalidEncVersion)?; let mut v: Vec<&str> = data.split(STORAGE_SEPARATOR).collect(); let time_period = if v.len() == NB_PARTS + 1 { match v.pop() {