Skip to content

Commit c865554

Browse files
authored
Merge pull request #6 from flashbots/peg/error-handling
Add error handling
2 parents 746b1e4 + a91288a commit c865554

File tree

5 files changed

+257
-151
lines changed

5 files changed

+257
-151
lines changed

Cargo.lock

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ thiserror = "2.0.17"
1313
clap = { version = "4.5.51", features = ["derive"] }
1414
webpki-roots = "1.0.4"
1515
rustls-pemfile = "2.2.0"
16+
anyhow = "1.0.100"
1617

1718
[dev-dependencies]
1819
rcgen = "0.14.5"

src/attestation.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,19 @@ use x509_parser::prelude::*;
55

66
/// Represents a CVM technology with quote generation and verification
77
pub trait AttestationPlatform: Clone + Send + 'static {
8+
/// Whether this is CVM attestation. This should always return true except for the [NoAttestation] case.
9+
///
10+
/// When false, allows TLS client to be configured without client authentication
811
fn is_cvm(&self) -> bool;
912

13+
/// Generate an attestation
1014
fn create_attestation(
1115
&self,
1216
cert_chain: &[CertificateDer<'_>],
1317
exporter: [u8; 32],
1418
) -> Result<Vec<u8>, AttestationError>;
1519

20+
/// Verify the given attestation payload
1621
fn verify_attestation(
1722
&self,
1823
input: Vec<u8>,
@@ -71,7 +76,7 @@ impl AttestationPlatform for NoAttestation {
7176
false
7277
}
7378

74-
/// Mocks creating an attestation
79+
/// Create an empty attestation
7580
fn create_attestation(
7681
&self,
7782
_cert_chain: &[CertificateDer<'_>],
@@ -80,7 +85,7 @@ impl AttestationPlatform for NoAttestation {
8085
Ok(Vec::new())
8186
}
8287

83-
/// Mocks verifying an attestation
88+
/// Ensure that an empty attestation is given
8489
fn verify_attestation(
8590
&self,
8691
input: Vec<u8>,

0 commit comments

Comments
 (0)