Instantiate MtcsService
This commit is contained in:
parent
30ce18495a
commit
c38bbb9006
2 changed files with 41 additions and 0 deletions
|
@ -15,6 +15,7 @@
|
|||
|
||||
mod attestor;
|
||||
mod cli;
|
||||
mod mtcs_server;
|
||||
mod proto;
|
||||
mod server;
|
||||
|
||||
|
@ -31,6 +32,8 @@ use tonic::transport::Server;
|
|||
use crate::{
|
||||
attestor::{Attestor, EpidAttestor},
|
||||
cli::Cli,
|
||||
mtcs_server::MtcsService,
|
||||
proto::clearing_server::ClearingServer as MtcsServer,
|
||||
server::CoreService,
|
||||
};
|
||||
|
||||
|
@ -67,6 +70,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||
sk.clone(),
|
||||
EpidAttestor,
|
||||
)))
|
||||
.add_service(MtcsServer::new(MtcsService::new(sk.clone(), EpidAttestor)))
|
||||
.serve(args.rpc_addr)
|
||||
.await?;
|
||||
|
||||
|
|
37
enclaves/quartz/src/mtcs_server.rs
Normal file
37
enclaves/quartz/src/mtcs_server.rs
Normal file
|
@ -0,0 +1,37 @@
|
|||
use std::sync::{Arc, Mutex};
|
||||
|
||||
use k256::ecdsa::SigningKey;
|
||||
use tonic::{Request, Response, Result as TonicResult, Status};
|
||||
|
||||
use crate::{
|
||||
attestor::Attestor,
|
||||
proto::{clearing_server::Clearing, RunClearingRequest, RunClearingResponse},
|
||||
};
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct MtcsService<A> {
|
||||
sk: Arc<Mutex<Option<SigningKey>>>,
|
||||
attestor: A,
|
||||
}
|
||||
|
||||
impl<A> MtcsService<A>
|
||||
where
|
||||
A: Attestor,
|
||||
{
|
||||
pub fn new(sk: Arc<Mutex<Option<SigningKey>>>, attestor: A) -> Self {
|
||||
Self { sk, attestor }
|
||||
}
|
||||
}
|
||||
|
||||
#[tonic::async_trait]
|
||||
impl<A> Clearing for MtcsService<A>
|
||||
where
|
||||
A: Attestor + Send + Sync + 'static,
|
||||
{
|
||||
async fn run(
|
||||
&self,
|
||||
_request: Request<RunClearingRequest>,
|
||||
) -> TonicResult<Response<RunClearingResponse>> {
|
||||
todo!()
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue