nurtex-protocol 1.2.2

Library that allows a Minecraft client to communicate with a server.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use crate::packets::login::{ClientsideEncryptionRequest, ServersideEncryptionResponse};

/// Функция обработки запроса шифрования
pub fn handle_encryption_request(request: &ClientsideEncryptionRequest) -> Option<(ServersideEncryptionResponse, [u8; 16])> {
  if let Some(encryption) = nurtex_encrypt::try_encrypt(&request.public_key, &request.verify_token) {
    let response = ServersideEncryptionResponse {
      shared_secret: encryption.encrypted_public_key,
      verify_token: encryption.encrypted_challenge,
    };

    Some((response, encryption.secret_key))
  } else {
    None
  }
}