apple-gamecenter-identity-verifier
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

Overview

This is library to validate a apple's gamecenter identity of localplayer for consuming it in node.js backend server.

Installation

npm install apple-gamecenter-identity-verifier --save

Usage

var verifier = require('apple-gamecenter-identity-verifier');


// identity from client.
// Reference:  https://developer.apple.com/library/ios/documentation/GameKit/Reference/GKLocalPlayer_Ref/index.html#//apple_ref/occ/instm/GKLocalPlayer/generateIdentityVerificationSignatureWithCompletionHandler

var identity = {
  publicKeyUrl: 'https://valid.apple.com/public/timeout.cer',
  timestamp: 1460981421303,
  signature: 'PoDwf39DCN464B49jJCU0d9Y0J',
  salt: 'saltST==',
  playerId: 'G:1111111',
  bundleId: 'com.valid.app'
};

verifier.verify(identity, function (err, token) {
  if (!err) {
    // use token in here.
    console.log(token);
  }
});
import { verify } from 'apple-gamecenter-identity-verifier';


// identity from client.
// Reference:  https://developer.apple.com/library/ios/documentation/GameKit/Reference/GKLocalPlayer_Ref/index.html#//apple_ref/occ/instm/GKLocalPlayer/generateIdentityVerificationSignatureWithCompletionHandler

var identity = {
  publicKeyUrl: 'https://valid.apple.com/public/timeout.cer',
  timestamp: 1460981421303,
  signature: 'PoDwf39DCN464B49jJCU0d9Y0J',
  salt: 'saltST==',
  playerId: 'G:1111111',
  bundleId: 'com.valid.app'
};

verify(identity, function (err, token) {
  if (!err) {
    // use token in here.
    console.log(token);
  }
});

Tests

npm test

Contributing

Take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code.

Inspired by

Release History

  • 1.0.0 Initial release

Package Sidebar

Install

npm i apple-gamecenter-identity-verifier

Weekly Downloads

19

Version

1.0.3

License

MIT

Unpacked Size

8.71 kB

Total Files

9

Last publish

Collaborators

  • aminoiz