Skip to content

Commit 24d746b

Browse files
committed
Merge branch 'master' of github.com:web-push-libs/pywebpush into feat/97
2 parents 110be71 + 14331e4 commit 24d746b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pywebpush/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from copy import deepcopy
77
import json
88
import os
9+
import time
910

1011
try:
1112
from urllib.parse import urlparse
@@ -380,6 +381,9 @@ def webpush(subscription_info,
380381
url = urlparse(subscription_info.get('endpoint'))
381382
aud = "{}://{}".format(url.scheme, url.netloc)
382383
vapid_claims['aud'] = aud
384+
if not vapid_claims.get('exp'):
385+
# encryption lives for 12 hours
386+
vapid_claims['exp'] = int(time.time()) + (12 * 60 * 60)
383387
if not vapid_private_key:
384388
raise WebPushException("VAPID dict missing 'private_key'")
385389
if isinstance(vapid_private_key, Vapid):

0 commit comments

Comments
 (0)