diff options
| author | mat <github@matdoes.dev> | 2022-04-24 22:46:41 -0500 |
|---|---|---|
| committer | mat <github@matdoes.dev> | 2022-04-24 22:46:41 -0500 |
| commit | f4dd3a9293367fa8f3d839a184e8055b22595204 (patch) | |
| tree | 3beafa3c8035c69a33b7d0f12779236bf786cf36 /azalea-client/src | |
| parent | 4c00bd886578c70f6aeb35400d9d03b355df3155 (diff) | |
| download | azalea-drasl-f4dd3a9293367fa8f3d839a184e8055b22595204.tar.xz | |
ENCRYPTION WORKS!!!!!!!!!!!
Diffstat (limited to 'azalea-client/src')
| -rwxr-xr-x | azalea-client/src/connect.rs | 9 |
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); |
