22 public const NETWORK_ID = ProtocolInfo::LOGIN_PACKET;
25 public string $authInfoJson;
26 public string $clientDataJwt;
31 public static function create(
int $protocol,
string $authInfoJson,
string $clientDataJwt) : self{
33 $result->protocol = $protocol;
34 $result->authInfoJson = $authInfoJson;
35 $result->clientDataJwt = $clientDataJwt;
39 public function canBeSentBeforeLogin() : bool{
44 $this->protocol = $in->getInt();
45 $this->decodeConnectionRequest($in->
getString());
48 protected function decodeConnectionRequest(
string $binary) : void{
51 $authInfoJsonLength = $connRequestReader->
getLInt();
52 if($authInfoJsonLength <= 0){
57 $this->authInfoJson = $connRequestReader->get($authInfoJsonLength);
59 $clientDataJwtLength = $connRequestReader->getLInt();
60 if($clientDataJwtLength <= 0){
65 $this->clientDataJwt = $connRequestReader->get($clientDataJwtLength);
69 $out->putInt($this->protocol);
70 $out->putString($this->encodeConnectionRequest());
73 protected function encodeConnectionRequest() : string{
76 $connRequestWriter->putLInt(strlen($this->authInfoJson));
77 $connRequestWriter->put($this->authInfoJson);
79 $connRequestWriter->putLInt(strlen($this->clientDataJwt));
80 $connRequestWriter->put($this->clientDataJwt);
82 return $connRequestWriter->getBuffer();
86 return $handler->handleLogin($this);