NicklasWallgren / PokemonGoAPI-PHP

Pokemon Go API PHP library
BSD 2-Clause "Simplified" License
130 stars 51 forks source link

Added basic request signing. #92

Closed Droeftoeter closed 7 years ago

Droeftoeter commented 8 years ago

Hey, I added basic request signing. I wasn't able to test this on PHP 5.6 but I think the random_bytes polyfill works.

This extension is required for request signing: https://github.com/MatthewKingDev/php-xxhash Also depends on https://github.com/NicklasWallgren/pogoprotos-php/pull/5

I suggest switching to https://github.com/protobuf-php/protobuf-plugin for protobuf generation in a later version.

NicklasWallgren commented 8 years ago

Nice addition!, I will have a look at it later today :)

KyleBoyer commented 8 years ago

Nice addition!, I will have a look at it later today :)

How's the merge process going?

jaspervdm commented 8 years ago

Before this is merged, the function generateRequestHash() in src/Handlers/Signature.php should be replaced with:

    protected function generateRequestHash($serializedTicket, $serializedRequest)
    {
        $seed = (unpack("J", pack("H*", xxhash64($serializedTicket, 0x1B845238))))[1];
        return (unpack("J", pack("H*", xxhash64($request, $seed))))[1];
    }

(See also https://github.com/Droeftoeter/pokapi/pull/4)

Droeftoeter commented 8 years ago

Ill update it tonight.

KyleBoyer commented 8 years ago

Progress?

NicklasWallgren commented 7 years ago

Anyone up for the challenge?

Droeftoeter commented 7 years ago

It seems the signatures we generated are not correct. And the only way to properly sign them is by using a hashing server.