zk_citadel/error.rs
1// This Source Code Form is subject to the terms of the Mozilla Public
2// License, v. 2.0. If a copy of the MPL was not distributed with this
3// file, You can obtain one at http://mozilla.org/MPL/2.0/.
4//
5// Copyright (c) DUSK NETWORK. All rights reserved.
6
7use core::fmt;
8
9/// All possible errors for Citadel
10#[allow(clippy::enum_variant_names)]
11#[derive(Debug, Clone)]
12pub enum Error {
13 /// The public input vector has the wrong length
14 InvalidPublicInputs,
15 /// A public commitment point is malformed or not allowed
16 InvalidCommitment,
17 /// The session ID in the cookie does not match the session
18 WrongSessionId,
19 /// The deployment metadata in the cookie does not match this verifier
20 WrongDeployment,
21 /// The cookie object version does not match the selected policy
22 WrongCookieVersion,
23 /// The cookie mode does not match the selected policy
24 WrongCookieMode,
25 /// The policy ID in the cookie does not match the selected policy
26 WrongPolicyId,
27 /// The cookie SP key does not match the selected policy
28 WrongServiceProvider,
29 /// The cookie LP key does not match the selected policy
30 WrongLicenseProvider,
31 /// The disclosed challenge does not match the selected policy
32 WrongChallenge,
33 /// The disclosed attribute data does not match the selected policy
34 WrongAttributeData,
35 /// The session root does not satisfy the selected policy
36 WrongRoot,
37 /// A required digest-style attribute opening is missing
38 MissingAttributeOpening,
39 /// A supplied attribute opening does not match `attr_data`
40 WrongAttributeOpening,
41 /// The commitment to the public key of the License Provider is incorrect
42 WrongLicenseProviderComm,
43 /// The commitment to the attribute data is incorrect
44 WrongAttributeDataComm,
45 /// The commitment to the challenge is incorrect
46 WrongChallengeComm,
47 /// The result of the session hash is incorrect
48 WrongSessionHash,
49 /// A public key in the cookie or selected policy is malformed
50 InvalidPublicKey,
51}
52
53impl fmt::Display for Error {
54 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
55 write!(f, "Citadel Error: {:?}", &self)
56 }
57}