use thiserror::Error;
#[derive(Error, Debug)]
pub enum EntryBuilderError {
#[error(transparent)]
EncodeEntryError(#[from] EncodeEntryError),
}
#[derive(Error, Debug)]
pub enum EncodeEntryError {
#[error(transparent)]
ValidateEntryError(#[from] ValidateEntryError),
#[error(transparent)]
BambooEncodeError(#[from] bamboo_rs_core_ed25519_yasmf::entry::encode::Error),
}
#[derive(Error, Debug)]
pub enum DecodeEntryError {
#[error(transparent)]
ValidateEntryError(#[from] ValidateEntryError),
#[error(transparent)]
BambooDecodeError(#[from] bamboo_rs_core_ed25519_yasmf::entry::decode::Error),
}
#[derive(Error, Debug)]
#[allow(missing_copy_implementations)]
pub enum ValidateEntryError {
#[error("backlink and skiplink not valid for this sequence number")]
InvalidLinks,
#[error("operation needs to match payload hash of encoded entry")]
PayloadHashMismatch,
#[error("operation needs to match payload size of encoded entry")]
PayloadSizeMismatch,
#[error("backlink and skiplink are identical")]
BacklinkAndSkiplinkIdentical,
#[error("entry is in log id {0} but backlink entry in log id {1}")]
WrongBacklinkLogId(u64, u64),
#[error("entry is in log id {0} but skiplink entry in log id {1}")]
WrongSkiplinkLogId(u64, u64),
#[error("claimed author does not match backlink entry")]
WrongBacklinkAuthor,
#[error("claimed hash does not match backlink entry")]
WrongBacklinkHash,
#[error("claimed author does not match skiplink entry")]
WrongSkiplinkAuthor,
#[error("claimed hash does not match skiplink entry")]
WrongSkiplinkHash,
#[error("signature invalid")]
KeyPairError(#[from] crate::identity::error::KeyPairError),
}
#[derive(Error, Debug)]
#[allow(missing_copy_implementations)]
pub enum SeqNumError {
#[error("sequence number can not be zero or negative")]
NotZeroOrNegative,
#[error("string contains invalid u64 value")]
InvalidU64String,
}
#[derive(Error, Debug)]
#[allow(missing_copy_implementations)]
pub enum LogIdError {
#[error("string contains invalid u64 value")]
InvalidU64String,
}