Encoding and decoding authentication token of Safari Push Notifications.
npm install spn-auth-token
var spnAuthToken = require('spn-auth-token');
spnAuthToken.crypt({id: 'my-id'}, 'salt')
.then(function (token) {
console.log(token); // eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJmb28iOiJiYXIifQ.e9wZgUdux3Bp-QVGjhEBpuS65hU4zcr1uzCMJyPwsg0
});
spnAuthToken.decrypt('eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJmb28iOiJiYXIifQ.e9wZgUdux3Bp-QVGjhEBpuS65hU4zcr1uzCMJyPwsg0', 'salt')
.then(function (payload) {
console.log(payload); // {id: 'my-id'}
});
Generate an authentication token from a payload.
Decode an authentication token.
MIT