detee-sgx/examples/mratls_https_server.rs
Noor a47753a8e0 fix compiler error on sealing and examples (#3)
Reviewed-on: SGX/detee-sgx#3
Reviewed-by: Valentyn Faychuk <valy@detee.ltd>
Co-authored-by: Noor <noormohammedb@protonmail.com>
Co-committed-by: Noor <noormohammedb@protonmail.com>
2024-11-08 07:50:55 +00:00

32 lines
942 B
Rust

use actix_web::{get, App, HttpServer};
use detee_sgx::prelude::*;
use std::net::SocketAddr;
#[get("/")]
async fn index() -> String {
format!("Hello world!")
}
#[actix_web::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
env_logger::init_from_env(env_logger::Env::default().default_filter_or("trace"));
// let mrsigner_hex = "83E8A0C3ED045D9747ADE06C3BFC70FCA661A4A65FF79A800223621162A88B76";
// let mut mrsigner = [0u8; 32];
// hex::decode_to_slice(mrsigner_hex, &mut mrsigner)?;
HttpServer::new(|| App::new().service(index))
.bind_ratls(
SocketAddr::from(([127, 0, 0, 1], 8000)),
RaTlsConfig::new().allow_instance_measurement(
// InstanceMeasurement::new().with_mrsigners(vec![mrsigner]),
InstanceMeasurement::new().with_current_mrsigner()?,
),
)
.unwrap()
.run()
.await?;
Ok(())
}