Skip to content

Instantly share code, notes, and snippets.

View saminadhikari's full-sized avatar

samin saminadhikari

View GitHub Profile
const jwt = require('jsonwebtoken');
const http2 = require('http2');
const fs = require('fs');
/*
Read p8 file. Assumes p8 file to be in same directory
*/
const key = fs.readFileSync(__dirname + "/{your p8 filename}.p8", 'utf8')
//"iat" should not be older than 1 hr from current time or will get rejected
const http2 = require('http2');
const fs = require('fs');
/*
Use 'https://api.push.apple.com' for production build
*/
host = 'https://api.sandbox.push.apple.com'
path = '/3/device/{you device token}'