如何我的Node.js服务器上验证GKLocalPlayer [英] How to authenticate the GKLocalPlayer on my Node.js server
问题描述
在<一个href=\"https://developer.apple.com/library/ios/documentation/GameKit/Reference/GKLocalPlayer_Ref/Reference/Reference.html#//apple_ref/occ/instm/GKLocalPlayer/generateIdentityVerificationSignatureWithCompletionHandler%3a\"相对=nofollow称号=GKLocalPlayer类参考:generateIdentityVerificationSignatureWithCompletionHandler>苹果的文档,generateIdentityVerificationSignatureWithCompletionHandler ,你要连接成一个数据缓冲区4个参数,这是以big-endian时间戳参数的一UINT-64格式的,然后生成一个验证SHA-1散列值。
In Apple's Doc, generateIdentityVerificationSignatureWithCompletionHandler, you are to concatenate into a data buffer 4 parameters, one of which being "The timestamp parameter in Big-Endian UInt-64 format", and then generate a SHA-1 hash value for verification.
有没有人做到了这一点成功的Node.js / JavaScript的我遇到的主要问题是使用Javascript / Node.js的似乎没有任何支持64位无符号的大端整数?;它似乎的最大输出的32位无符号。
Has anyone accomplished this successfully in Node.js/Javascript? The main issue I am having is that Javascript/Node.js does not seem to have any support 64-bit unsigned big endian integers; it seems to max out at 32-bit, unsigned.
PS:我知道有以下相关的问题,但他们不解决这个特定的JavaScript的问题。
PS: I know there the following related questions, but they do not tackle this particular javascript issue.
- 如何在我的'第三方认证GKLocalPlayer
?服务器的:该解决方案是红宝石,Python和OBJ-C;所有
其生产的64位原生支持BE十六进制的
时间戳。 - How验证来自第三方的node.js游戏中心用户
服务器:在code依赖于客户端向服务器发送一个上
时间戳已经在十六进制字符串的形式(见json.hexTimestamp
,围绕LN 22)
- How to authenticate the GKLocalPlayer on my 'third party server'?: the solutions are for ruby, python, and obj-c; all having native support for producing the 64-bit BE hex for the timestamp.
- How to authenticate Game Center User from 3rd party node.js
server: the code relies on the client sending the server a
timestamp already in the form of a hex string (see
json.hexTimestamp
, around ln 22)
它甚至能够可靠地创建一个64位无符号大端的十六进制再presentation ... 在JavaScript 的?我正在考虑通过Node.js的执行红宝石/ Python作为一个可能的解决方法。
Is it even possible to reliably create the hex representation of a 64-bit unsigned big endian ... in javascript? I'm considering executing ruby/python via Node.js as a possible workaround.
推荐答案
更简单的方法是使用REF
The easier way is to use ref
var ref = require('ref');
var buf = ref.alloc('uint64');
ref.writeUInt64BE(buf, 0, '1401893400733');
之后,你可以使用缓冲区来更新验证。
after that you could use the buffer to update the verifier.
这篇关于如何我的Node.js服务器上验证GKLocalPlayer的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!