pub mod e2e;
pub mod shamir;
pub mod sign;
#[derive(Debug, PartialEq, Eq, thiserror::Error)]
pub enum CryptoError {
#[error("Key derivation failed")]
KeyDerivationError,
#[error("Key record expired")]
ExpiredKeyRecord,
#[error("Bad public signature key")]
BadPublicSignatureKey,
#[error("Encryption failed")]
BadSignature,
#[error("Missing signature")]
MissingSignature,
#[error("Encryption failed: {0}")]
Encrypt(String),
#[error("Decryption failed: {0}")]
Decrypt(String),
#[error("Invalid metadata: {0}")]
InvalidMeta(String),
#[error("Threshold must be at least 2, but got {0}")]
ThresholdTooLow(u32),
#[error("Share count must be between 1 and 255, but got {0}")]
ShareCountError(u32),
#[error(
"Share count must be at least equal to the threshold, but got {0} shares for threshold {1}"
)]
ThresholdMoreThanShareCound(u32, u32),
#[error(
"Not enough shares to reconstruct the secret. Provided {0} shares, but threshold is {1}"
)]
NotEnoughShares(u32, u32),
#[error("Inconsistent shares provided")]
InconsistentShares,
#[error("Duplicate share index: {0} and {1}")]
DuplicateShareIndex(u8, u8),
}