1use thiserror::Error;
2
3#[derive(Debug, Error)]
5pub enum SSKRError {
6 #[error("When combining shares, the provided shares contained a duplicate member index")]
7 DuplicateMemberIndex,
8
9 #[error("Invalid group specification.")]
10 GroupSpecInvalid,
11
12 #[error("When creating a split spec, the group count is invalid")]
13 GroupCountInvalid,
14
15 #[error("SSKR group threshold is invalid")]
16 GroupThresholdInvalid,
17
18 #[error("SSKR member count is invalid")]
19 MemberCountInvalid,
20
21 #[error("SSKR member threshold is invalid")]
22 MemberThresholdInvalid,
23
24 #[error("SSKR shares did not contain enough groups")]
25 NotEnoughGroups,
26
27 #[error("SSKR secret is not of even length")]
28 SecretLengthNotEven,
29
30 #[error("SSKR secret is too long")]
31 SecretTooLong,
32
33 #[error("SSKR secret is too short")]
34 SecretTooShort,
35
36 #[error("SSKR shares did not contain enough serialized bytes")]
37 ShareLengthInvalid,
38
39 #[error("SSKR shares contained invalid reserved bits")]
40 ShareReservedBitsInvalid,
41
42 #[error("SSKR shares were empty")]
43 SharesEmpty,
44
45 #[error("SSKR shares were invalid")]
46 ShareSetInvalid,
47
48 #[error("SSKR Shamir error: {0}")]
49 ShamirError(bc_shamir::Error),
50}
51
52impl From<bc_shamir::Error> for SSKRError {
53 fn from(err: bc_shamir::Error) -> Self {
54 SSKRError::ShamirError(err)
55 }
56}