-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
35 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
use proto::{ | ||
connection::{ | ||
auth::marshal::MarshalAuth, | ||
protocols::{Protocol, Sender}, | ||
}, | ||
crypto::{Scheme, Serializable}, | ||
redis, | ||
}; | ||
|
||
use crate::Marshal; | ||
|
||
impl<SignatureScheme: Scheme, ProtocolType: Protocol> Marshal<SignatureScheme, ProtocolType> | ||
where | ||
SignatureScheme::VerificationKey: Serializable, | ||
SignatureScheme::Signature: Serializable, | ||
{ | ||
/// Handles a user's connection, including authentication. | ||
pub async fn handle_connection( | ||
mut connection: (ProtocolType::Sender, ProtocolType::Receiver), | ||
mut redis_client: redis::Client, | ||
) { | ||
// Verify (authenticate) the connection | ||
let _ = MarshalAuth::<SignatureScheme, ProtocolType>::verify_user( | ||
&mut connection, | ||
&mut redis_client, | ||
) | ||
.await; | ||
|
||
// We don't care about this, just drop the connection immediately. | ||
let _ = connection.0.finish().await; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters