Module grammers_mtproto::authentication
source · Expand description
Contains the steps required to generate an authorization key.
§Examples
use grammers_mtproto::authentication;
fn send_data_to_server(request: &[u8]) -> Result<Vec<u8>, authentication::Error> {
unimplemented!()
}
fn main() -> Result<(), authentication::Error> {
let (request, data) = authentication::step1()?;
let response = send_data_to_server(&request)?;
let (request, data) = authentication::step2(data, &response)?;
let response = send_data_to_server(&request)?;
let (request, data) = authentication::step3(data, &response)?;
let response = send_data_to_server(&request)?;
let authentication::Finished { auth_key, .. } = authentication::create_key(data, &response)?;
// Now you have a secure `auth_key` to send encrypted messages to server.
Ok(())
}
Structs§
- The final result of doing the authorization handshake, generated by
create_key
. - The data generated by
step3
, needed forcreate_key
.
Enums§
- Represents an error that occured during the generation of an authorization key.
Functions§
- The last step of the process to generate an authorization key.
- The first step of the process to generate an authorization key.
- The second step of the process to generate an authorization key.
- The third step of the process to generate an authorization key.