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
//! The crate's error type.
use pontifex::{ChannelError, attestation};
/// Failures while configuring or calling the host.
#[derive(Debug, thiserror::Error)]
pub enum Error {
/// A configuration field was not usable.
#[error("invalid {attribute}: {reason}")]
InvalidConfig {
/// Which field.
attribute: String,
/// Why it was rejected.
reason: String,
},
/// The configuration JSON could not be parsed.
#[error("failed to parse config: {0}")]
MalformedConfig(String),
/// An attestation document did not verify.
#[error(transparent)]
Attestation(#[from] attestation::Error),
/// The assignment document or public key was not valid base64.
#[error("assignment document or public key was not valid base64")]
MalformedAssignment,
/// The assignment is stale: re-assign, re-seal, and retry once.
#[error("the request was not sealed to the enclave's current key; re-assign and retry once")]
ReassignRequired,
/// Channel attestation, key binding, sealing or opening failed.
#[error("sealed channel failure: {0:?}")]
Channel(#[source] ChannelError),
/// The request violated a WIP-201 bound or its AAT did not verify.
#[error("match request was malformed")]
MalformedRequest,
/// The attested release does not define the request's pipeline or `match_strictness`, or the
/// request's `pipeline_inputs` do not fit the pipeline.
#[error("the enclave's release does not support the request's pipeline or strictness")]
ReleaseUnavailable,
/// The request's pipeline lists more response slots than the configured maximum, so its
/// response timing could reveal too much (WIP-201 ยง4.6 step 3).
#[error("the pipeline lists more response slots than the configured maximum")]
TooManyResponseSlots,
/// The assignment's attestation does not carry the `release_hash` of its release manifest.
#[error("the attestation does not attest the assignment's release manifest")]
ReleaseNotAttested,
/// The sealed plaintext was not a match result.
#[error("sealed response was not a match result")]
MalformedResult,
/// The attested signing public key was not a valid `BabyJubJub` point.
#[error("attested signing public key was invalid")]
InvalidSigningKey,
/// The statement did not verify under the attested signing key.
#[error("match statement did not verify under the attested signing key")]
StatementInvalid,
/// The WebSocket handshake or an I/O operation on it failed.
#[error("WebSocket transport failed: {0}")]
WebSocket(#[source] tokio_tungstenite::tungstenite::Error),
/// An operation did not finish within its configured deadline.
#[error("the host did not respond within the configured deadline")]
Timeout,
/// The host closed the WebSocket before the exchange completed.
#[error("the host closed the connection before the exchange completed")]
ConnectionClosed,
/// A frame was not the message the protocol expects at that point.
#[error("the host sent an unexpected or malformed message")]
MalformedMessage,
/// The host returned an error envelope over the WebSocket.
#[error("host returned error ({code})")]
ApiFrame {
/// Machine-readable code from the envelope.
code: String,
/// Whether the host says the request may be retried.
allow_retry: bool,
},
}