diff options
| author | mat <github@matdoes.dev> | 2022-04-24 19:28:29 -0500 |
|---|---|---|
| committer | mat <github@matdoes.dev> | 2022-04-24 19:28:29 -0500 |
| commit | 4c00bd886578c70f6aeb35400d9d03b355df3155 (patch) | |
| tree | f4903dd0b8f9690a6c52a180babd56d12c3926c0 /azalea-client/src | |
| parent | 3e507f0db4020eaf406ba69aae3d4dc1301d29ac (diff) | |
| download | azalea-drasl-4c00bd886578c70f6aeb35400d9d03b355df3155.tar.xz | |
Add ServerboundKeyPacket
Diffstat (limited to 'azalea-client/src')
| -rwxr-xr-x | azalea-client/src/connect.rs | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/azalea-client/src/connect.rs b/azalea-client/src/connect.rs index 884648b4..b402200a 100755 --- a/azalea-client/src/connect.rs +++ b/azalea-client/src/connect.rs @@ -4,7 +4,10 @@ use azalea_protocol::{ packets::{ game::GamePacket, handshake::client_intention_packet::ClientIntentionPacket, - login::{serverbound_hello_packet::ServerboundHelloPacket, LoginPacket}, + login::{ + serverbound_hello_packet::ServerboundHelloPacket, + serverbound_key_packet::ServerboundKeyPacket, LoginPacket, + }, ConnectionProtocol, PROTOCOL_VERSION, }, resolver, ServerAddress, @@ -39,7 +42,15 @@ pub async fn join_server(address: &ServerAddress) -> Result<(), String> { Ok(packet) => match packet { LoginPacket::ClientboundHelloPacket(p) => { println!("Got encryption request {:?} {:?}", p.nonce, p.public_key); - panic!(""); + let e = azalea_auth::encryption::encrypt(&p.public_key, &p.nonce).unwrap(); + conn.write( + ServerboundKeyPacket { + nonce: e.encrypted_nonce, + shared_secret: e.encrypted_public_key, + } + .get(), + ) + .await; } LoginPacket::ClientboundLoginCompressionPacket(p) => { println!("Got compression request {:?}", p.compression_threshold); @@ -58,6 +69,7 @@ pub async fn join_server(address: &ServerAddress) -> Result<(), String> { LoginPacket::ClientboundCustomQueryPacket(p) => { println!("Got custom query {:?}", p); } + LoginPacket::ServerboundKeyPacket(_) => todo!(), }, Err(e) => { panic!("Error: {:?}", e); |
