Skip to content

Commit

Permalink
attestation-service: rename builtin rvps
Browse files Browse the repository at this point in the history
Since we changed the name of "core" to Rvps, we need to change the code
in the attestation service where we use the builtin rvps.

Also, change the rvps struct in the AS to BuiltinRvps. This isn't
strictly necessary (since it's in a module called Builtin) but it avoids
a naming collision.

Signed-off-by: Tobin Feldman-Fitzthum <tobin@ibm.com>
  • Loading branch information
fitzthum authored and Xynnn007 committed Feb 5, 2025
1 parent 9e55867 commit ef687f9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
18 changes: 9 additions & 9 deletions attestation-service/src/rvps/builtin.rs
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
use super::{Result, RvpsApi};
use async_trait::async_trait;
use core::result::Result::Ok;
use reference_value_provider_service::{Config, Core};
use reference_value_provider_service::{Config, Rvps};
use std::collections::HashMap;

pub struct Rvps {
core: Core,
pub struct BuiltinRvps {
rvps: Rvps,
}

impl Rvps {
impl BuiltinRvps {
pub fn new(config: Config) -> Result<Self> {
let core = Core::new(config)?;
Ok(Self { core })
let rvps = Rvps::new(config)?;
Ok(Self { rvps })
}
}

#[async_trait]
impl RvpsApi for Rvps {
impl RvpsApi for BuiltinRvps {
async fn verify_and_extract(&mut self, message: &str) -> Result<()> {
self.core.verify_and_extract(message).await?;
self.rvps.verify_and_extract(message).await?;
Ok(())
}

async fn get_digests(&self) -> Result<HashMap<String, Vec<String>>> {
let hashes = self.core.get_digests().await?;
let hashes = self.rvps.get_digests().await?;

Ok(hashes)
}
Expand Down
3 changes: 2 additions & 1 deletion attestation-service/src/rvps/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ pub async fn initialize_rvps_client(config: &RvpsConfig) -> Result<Box<dyn RvpsA
match config {
RvpsConfig::BuiltIn(config) => {
info!("launch a built-in RVPS.");
Ok(Box::new(builtin::Rvps::new(config.clone())?) as Box<dyn RvpsApi + Send + Sync>)
Ok(Box::new(builtin::BuiltinRvps::new(config.clone())?)
as Box<dyn RvpsApi + Send + Sync>)
}
#[cfg(feature = "rvps-grpc")]
RvpsConfig::GrpcRemote(config) => {
Expand Down

0 comments on commit ef687f9

Please sign in to comment.