Expand description
Sans-IO MTProto authorization key generation.
§Flow
let (req, s1) = authentication::step1()?;
// send req, receive resp (ResPQ)
let (req, s2) = authentication::step2(s1, resp, dc_id)?;
// send req, receive resp (ServerDhParams)
let (req, s3) = authentication::step3(s2, resp)?;
// send req, receive resp (SetClientDhParamsAnswer)
let result = authentication::finish(s3, resp)?;
// on FinishResult::Done(d): d.auth_key is ready
// on FinishResult::Retry{..}: call retry_step3() + finish() up to 5 timesStructs§
- DhParams
ForRetry - Pre-processed server DH parameters retained so that step 3 can be
repeated on
dh_gen_retrywithout having to re-decrypt the server response. - Finished
- The final output of a successful auth key handshake.
- Step1
- State after step 1.
- Step2
- State after step 2.
- Step3
- State after step 3.
Enums§
- Error
- Errors that can occur during auth key generation.
- Finish
Result - Result of
finisheither the handshake is done, or the server wants us to retry step 3 with theauth_key_aux_hashasretry_id.
Functions§
- finish
- Finalise the handshake.
- key_
for_ fingerprint - RSA key by server fingerprint. Includes both production and test DC keys.
- retry_
step3 - Re-run the client DH params generation after a
dh_gen_retryresponse. Feed thedh_params,nonce,server_nonce,new_noncefromFinishResult::Retryand theretry_id(=auth_key_aux_hash). - step1
- Generate a
req_pq_multirequest. Returns the request + opaque state. - step2
- Process
ResPQand generatereq_DH_params. - step3
- Process
ServerDhParamsinto a reusableDhParamsForRetry+ send the firstset_client_DH_paramsrequest.