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.

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: I know there the following related questions, but they do not tackle this particular javascript issue.

  1. 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.
  2. 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)

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.

Community
  • 1
  • 1
Rob
  • 5,534
  • 1
  • 22
  • 22

1 Answers1

1

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.

xjodoin
  • 519
  • 5
  • 15