gamecenter-identity-verifier-js
v1.0.0-rc.2
Published
A small library to verify the identity of apple-gamecenter's local player for consuming it in node.js backend server. A rewrite to typescript of maeltm/node-gamecenter-identity-verifier
Downloads
1
Readme
gamecenter-identity-verifier
This is library to validate a apple's gamecenter identity of localplayer for consuming it in [node.js][node] backend server.
Features
- Zero dependencies
- Exporting both ESM and CommonJS
- Testet
- Caching
Changes
2.0
- rewrite in Typescript
Installation
npm install gamecenter-identity-verifierUsage
import { assertValid, verify } from '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
const identity = {
publicKeyUrl: 'https://valid.apple.com/public/timeout.cer',
timestamp: 1460981421303,
signature: 'PoDwf39DCN464B49jJCU0d9Y0J',
salt: 'saltST==',
playerId: 'G:1111111',
bundleId: 'com.valid.app'
}
assertValid(identity)
await verify(identity)Development
tsc
Wishlist
- Explicitly test and support various runtimes & versions
Inspired by / links
- build commonsJS and ESModules from Typescript https://blog.mastykarz.nl/create-npm-package-commonjs-esm-typescript/
- apple's api document - https://developer.apple.com/library/ios/documentation/GameKit/Reference/GKLocalPlayer_Ref/index.html#//apple_ref/occ/instm/GKLocalPlayer/generateIdentityVerificationSignatureWithCompletionHandler
- stackoverflow - http://stackoverflow.com/questions/17408729/how-to-authenticate-the-gklocalplayer-on-my-third-party-server
TypeScript
The distributed code contain typings.
https://devblogs.microsoft.com/typescript/announcing-typescript-5-8-beta/#the---erasablesyntaxonly-option
