aboutsummaryrefslogtreecommitdiff
path: root/azalea-client/src
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2022-04-24 22:46:41 -0500
committermat <github@matdoes.dev>2022-04-24 22:46:41 -0500
commitf4dd3a9293367fa8f3d839a184e8055b22595204 (patch)
tree3beafa3c8035c69a33b7d0f12779236bf786cf36 /azalea-client/src
parent4c00bd886578c70f6aeb35400d9d03b355df3155 (diff)
downloadazalea-drasl-f4dd3a9293367fa8f3d839a184e8055b22595204.tar.xz
ENCRYPTION WORKS!!!!!!!!!!!
Diffstat (limited to 'azalea-client/src')
-rwxr-xr-xazalea-client/src/connect.rs9
1 files changed, 7 insertions, 2 deletions
diff --git a/azalea-client/src/connect.rs b/azalea-client/src/connect.rs
index b402200a..44eff33f 100755
--- a/azalea-client/src/connect.rs
+++ b/azalea-client/src/connect.rs
@@ -43,14 +43,19 @@ pub async fn join_server(address: &ServerAddress) -> Result<(), String> {
LoginPacket::ClientboundHelloPacket(p) => {
println!("Got encryption request {:?} {:?}", p.nonce, p.public_key);
let e = azalea_auth::encryption::encrypt(&p.public_key, &p.nonce).unwrap();
+
+ // TODO: authenticate with the server here (authenticateServer)
+ println!("Sending encryption response {:?}", e);
+
conn.write(
ServerboundKeyPacket {
- nonce: e.encrypted_nonce,
- shared_secret: e.encrypted_public_key,
+ nonce: e.encrypted_nonce.into(),
+ shared_secret: e.encrypted_public_key.into(),
}
.get(),
)
.await;
+ conn.set_encryption_key(e.secret_key);
}
LoginPacket::ClientboundLoginCompressionPacket(p) => {
println!("Got compression request {:?}", p.compression_threshold);