Skip to content

Commit

Permalink
Add as_XX to Report
Browse files Browse the repository at this point in the history
  • Loading branch information
kvinwang committed Nov 23, 2024
1 parent 4405d1d commit 11b83e8
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/quote.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,28 @@ impl Report {
pub fn is_sgx(&self) -> bool {
matches!(self, Report::SgxEnclave(_))
}

pub fn as_td10(&self) -> Option<&TDReport10> {
match self {
Report::TD10(report) => Some(report),
Report::TD15(report) => Some(&report.base),
_ => None,
}
}

pub fn as_td15(&self) -> Option<&TDReport15> {
match self {
Report::TD15(report) => Some(report),
_ => None,
}
}

pub fn as_sgx(&self) -> Option<&EnclaveReport> {
match self {
Report::SgxEnclave(report) => Some(report),
_ => None,
}
}
}

#[derive(Debug, Serialize, Deserialize)]
Expand Down

0 comments on commit 11b83e8

Please sign in to comment.