Skip to content

Commit

Permalink
Merge pull request web-push-libs#258 from web-push-libs/gauntface-pat…
Browse files Browse the repository at this point in the history
…ch-1

VAPID Expiration within 12 Hours
  • Loading branch information
marco-c authored Nov 28, 2016
2 parents 8dcf1b9 + 0e2d97f commit 99fe255
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/vapid-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ function getVapidHeaders(audience, subject, publicKey, privateKey, expiration) {
publicKey = urlBase64.decode(publicKey);
privateKey = urlBase64.decode(privateKey);

const DEFAULT_EXPIRATION = Math.floor(Date.now() / 1000) + 43200;

if (expiration) {
// TODO: Check if expiration is valid and use it in place of the hard coded
Expand All @@ -136,7 +137,7 @@ function getVapidHeaders(audience, subject, publicKey, privateKey, expiration) {

const jwtPayload = {
aud: audience,
exp: Math.floor(Date.now() / 1000) + 86400,
exp: DEFAULT_EXPIRATION,
sub: subject
};

Expand Down

0 comments on commit 99fe255

Please sign in to comment.