Skip to content

Commit

Permalink
add minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgeantonio21 committed Dec 9, 2024
1 parent 3e89e4b commit afc1142
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
7 changes: 2 additions & 5 deletions atoma-proxy/src/server/handlers/chat_completions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -449,11 +449,8 @@ async fn handle_streaming_response(

let stream = response.bytes_stream();

let shared_secret = if let Some(node_x25519_public_key) = node_x25519_public_key {
Some(state.compute_shared_secret(&node_x25519_public_key))
} else {
None
};
let shared_secret = node_x25519_public_key
.map(|node_x25519_public_key| state.compute_shared_secret(&node_x25519_public_key));

// Create the SSE stream
let stream = Sse::new(Streamer::new(
Expand Down
2 changes: 1 addition & 1 deletion atoma-proxy/src/server/middleware.rs
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ pub async fn confidential_compute_middleware(
let salt = rand::random::<[u8; SALT_SIZE]>();
let shared_secret = state.compute_shared_secret(&x25519_public_key);

let (encrypted_plaintext, nonce) = encrypt_plaintext(&body_bytes, &shared_secret, &salt)
let (encrypted_plaintext, nonce) = encrypt_plaintext(&body_bytes, &shared_secret, &salt, None)
.map_err(|_| {
error!("Failed to encrypt plaintext");
StatusCode::BAD_REQUEST
Expand Down
1 change: 1 addition & 0 deletions atoma-proxy/src/server/streamer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ pub enum StreamStatus {

impl Streamer {
/// Creates a new Streamer instance
#[allow(clippy::too_many_arguments)]
pub fn new(
stream: impl Stream<Item = Result<Bytes, reqwest::Error>> + Send + 'static,
state_manager_sender: Sender<AtomaAtomaStateManagerEvent>,
Expand Down

0 comments on commit afc1142

Please sign in to comment.