58 $this->protocol = $this->
getInt();
64 $this->gameEdition = $this->
getByte();
70 $chainData = json_decode($this->
get($this->
getLInt()))->{
"chain"};
72 $chainKey = self::MOJANG_PUBKEY;
73 while(!empty($chainData)){
74 foreach($chainData as $index => $chain){
75 list($verified, $webtoken) = $this->
decodeToken($chain, $chainKey);
76 if(isset($webtoken[
"extraData"])){
77 if(isset($webtoken[
"extraData"][
"displayName"])){
78 $this->username = $webtoken[
"extraData"][
"displayName"];
80 if(isset($webtoken[
"extraData"][
"identity"])){
81 $this->clientUUID = $webtoken[
"extraData"][
"identity"];
85 $verified = isset($webtoken[
"nbf"]) && $webtoken[
"nbf"] <= $time && isset($webtoken[
"exp"]) && $webtoken[
"exp"] > $time;
87 if($verified and isset($webtoken[
"identityPublicKey"])){
89 if($webtoken[
"identityPublicKey"] != self::MOJANG_PUBKEY) $chainKey = $webtoken[
"identityPublicKey"];
91 }elseif($chainKey === null){
96 if(!$verified && $chainKey !== null){
99 unset($chainData[$index]);
103 list($verified, $this->clientData) = $this->
decodeToken($this->
get($this->
getLInt()), $chainKey);
105 $this->clientId = $this->clientData[
"ClientRandomId"] ?? null;
106 $this->serverAddress = $this->clientData[
"ServerAddress"] ?? null;
107 $this->skinId = $this->clientData[
"SkinId"] ?? null;
109 if(isset($this->clientData[
"SkinData"])){
110 $this->skin = base64_decode($this->clientData[
"SkinData"]);
113 if(isset($this->clientData[
"DeviceModel"])){
114 $this->deviceModel = $this->clientData[
"DeviceModel"];
117 if(isset($this->clientData[
"DeviceOS"])){
118 $this->deviceOS = $this->clientData[
"DeviceOS"];
122 $this->identityPublicKey = $chainKey;