Skip to content

Commit

Permalink
Cleanup AttestationDoc::new
Browse files Browse the repository at this point in the history
  • Loading branch information
emostov authored and petreeftime committed Mar 8, 2023
1 parent 504d675 commit a0aaf04
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 19 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ lto = true
nix = "0.20"
libc = "0.2"
log = "0.4"
minicbor = { version = "0.18.0", features = ["derive", "alloc"] }
minicbor = { version = "0.18", features = ["derive", "alloc"] }
23 changes: 5 additions & 18 deletions src/api/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,29 +257,16 @@ impl AttestationDoc {
nonce: Option<Vec<u8>>,
public_key: Option<Vec<u8>>,
) -> Self {
let mut pcrs_serialized = BTreeMap::new();

for (i, pcr) in pcrs.into_iter() {
// let pcr = ByteBuf::from(pcr);
pcrs_serialized.insert(i, pcr);
}

// let cabundle_serialized = cabundle.into_iter().map(ByteBuf::from).collect();
let cabundle_serialized = cabundle;

AttestationDoc {
module_id,
digest,
timestamp,
pcrs: pcrs_serialized,
cabundle: cabundle_serialized,
// certificate: ByteBuf::from(certificate),
certificate: certificate,
// user_data: user_data.map(ByteBuf::from),
user_data: user_data,
// nonce: nonce.map(ByteBuf::from),
nonce: nonce,
// public_key: public_key.map(ByteBuf::from),
pcrs,
cabundle,
certificate,
user_data,
nonce,
public_key: public_key,
}
}
Expand Down

0 comments on commit a0aaf04

Please sign in to comment.