1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
use thiserror::Error;
use crate::{frost::Identifier, Ciphersuite};
#[non_exhaustive]
#[derive(Error, Debug, Copy, Clone, Eq, PartialEq)]
pub enum Error<C: Ciphersuite> {
#[error("min_signers must be at least 2 and not larger than max_signers")]
InvalidMinSigners,
#[error("max_signers must be at least 2")]
InvalidMaxSigners,
#[error("coefficients must have min_signers-1 elements")]
InvalidCoefficients,
#[error("Malformed identifier is unserializable.")]
MalformedIdentifier,
#[error("Malformed signing key encoding.")]
MalformedSigningKey,
#[error("Malformed verifying key encoding.")]
MalformedVerifyingKey,
#[error("Malformed signature encoding.")]
MalformedSignature,
#[error("Invalid signature.")]
InvalidSignature,
#[error("Duplicated shares provided.")]
DuplicatedShares,
#[error("Commitment equals the identity.")]
IdentityCommitment,
#[error("Invalid signature share.")]
InvalidSignatureShare {
signer: Identifier<C>,
},
#[error("Invalid secret share.")]
InvalidSecretShare,
#[error("Round 1 package not found for Round 2 participant.")]
PackageNotFound,
#[error("Incorrect number of packages.")]
IncorrectNumberOfPackages,
#[error("The incorrect package was specified.")]
IncorrectPackage,
#[error("The ciphersuite does not support DKG.")]
DKGNotSupported,
#[error("The proof of knowledge is not valid.")]
InvalidProofOfKnowledge,
#[error("Error in scalar Field.")]
FieldError(#[from] FieldError),
#[error("Error in elliptic curve Group.")]
GroupError(#[from] GroupError),
}
#[non_exhaustive]
#[derive(Error, Debug, Copy, Clone, Eq, PartialEq)]
pub enum FieldError {
#[error("Malformed scalar encoding.")]
MalformedScalar,
#[error("Invalid for this scalar to be zero.")]
InvalidZeroScalar,
}
#[non_exhaustive]
#[derive(Error, Debug, Copy, Clone, Eq, PartialEq)]
pub enum GroupError {
#[error("Malformed group element encoding.")]
MalformedElement,
#[error("Invalid for this element to be the identity.")]
InvalidIdentityElement,
#[error("Invalid for this element to not have large prime order.")]
InvalidNonPrimeOrderElement,
}