Generates a signature that allows a third party server to authenticate the local player.
- iOS 7.0+
- macOS 10.10+
- tvOS 9.0+
- watchOS 3.0+
A block to be called when the request completes.
The block receives the following parameters:
The URL for the public encryption key.
The verification signature data generated.
NSStringused to compute the hash and keep it randomized.
The date and time that the signature was created.
If an error occurred, this parameter holds an error object that explains the error. Otherwise, the value of this parameter is
When this method is called, it creates a new background task to handle the request. The method then returns control to your game. Later, when the task is complete, Game Kit calls your completion handler. The completion handler is always called on the main thread.
Invoke this method to verify the identity of the local player. Use the following steps to generate a signature on your server:
[GKLocalin your app.
Player generate Identity Verification Signature With Completion Handler]
timestampparameters to the third party server used for authentication.
publicon the third party server to download the public key.
Verify with the appropriate signing authority that the public key is signed by Apple.
Retrieve the player’s
Concatenate into a data buffer the following information, in the order listed:
playerparameter in UTF-8 format
bundleparameter in UTF-8 format
timestampparameter in Big-Endian UInt-64 format
Generate a SHA-256 hash value for the buffer.
Using the public key downloaded in step 3, verify that the hash value generated in step 7 matches the
signatureparameter provided by the API.
If the generated and retrieved signatures match, the local player has been authenticated.