Skip to content

Commit

Permalink
feat: add headers checks
Browse files Browse the repository at this point in the history
  • Loading branch information
frdomovic committed Jun 7, 2024
1 parent 1f67803 commit a3df7c1
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions crates/server/src/admin/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::error::Error;
use std::fmt::{self, Display, Formatter};
use std::sync::Arc;

use axum::http::StatusCode;
use axum::http::{HeaderMap, StatusCode};
use axum::response::IntoResponse;
use axum::routing::{delete, get, post};
use axum::{Extension, Json, Router};
Expand All @@ -26,7 +26,7 @@ use super::handlers::context::{
};
use super::handlers::fetch_did::fetch_did_handler;
use super::storage::root_key::add_root_key;
use crate::verifysignature;
use crate::{middleware, verifysignature};

#[derive(Debug, Serialize, Deserialize)]
pub struct AdminConfig {
Expand Down Expand Up @@ -186,17 +186,18 @@ fn handle_root_key_result(result: eyre::Result<bool>) -> axum::http::Response<ax
}

async fn create_root_key_handler(
headers: HeaderMap,
session: Session,
Extension(state): Extension<Arc<AdminState>>,
Json(req): Json<PubKeyRequest>,
) -> impl IntoResponse {
let recipient = "me";

// let did_result = crate::admin::storage::did::get_did(&state.store);
let did_result = crate::admin::storage::did::get_did(&state.store);

// if let Some(mut did) = did_result {
// let result = crate::middleware::auth::auth(&headers, &state.store);
// }
if let Ok(Some(mut did)) = did_result {
let result = crate::middleware::auth::auth(&headers, &state.store);
}

match session
.get::<NodeChallenge>(CHALLENGE_KEY)
Expand Down

0 comments on commit a3df7c1

Please sign in to comment.