Skip to content

Commit 99fe255

Browse files
authored
Merge pull request #258 from web-push-libs/gauntface-patch-1
VAPID Expiration within 12 Hours
2 parents 8dcf1b9 + 0e2d97f commit 99fe255

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/vapid-helper.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ function getVapidHeaders(audience, subject, publicKey, privateKey, expiration) {
123123
publicKey = urlBase64.decode(publicKey);
124124
privateKey = urlBase64.decode(privateKey);
125125

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

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

137138
const jwtPayload = {
138139
aud: audience,
139-
exp: Math.floor(Date.now() / 1000) + 86400,
140+
exp: DEFAULT_EXPIRATION,
140141
sub: subject
141142
};
142143

0 commit comments

Comments
 (0)