Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions python/py_vapid/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ def verify_token(self, validation_token, verification_token):
def _base_sign(self, claims):
cclaims = copy.deepcopy(claims)
if not cclaims.get('exp'):
cclaims['exp'] = str(int(time.time()) + 86400)
cclaims['exp'] = int(time.time()) + 86400
if not self.conf.get('no-strict', False):
valid = _check_sub(cclaims.get('sub', ''))
else:
Expand All @@ -277,7 +277,6 @@ def _base_sign(self, claims):
"Missing 'aud' from claims. "
"'aud' is the scheme, host and optional port for this "
"transaction e.g. https://example.com:8080")

return cclaims

def sign(self, claims, crypto_key=None):
Expand Down
8 changes: 5 additions & 3 deletions python/py_vapid/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,17 @@ def main():
parser.add_argument('--applicationServerKey',
help="show applicationServerKey value",
default=False, action="store_true")
parser.add_argument('--private-key', '-k', help='private key pem file',
default="private_key.pem")
args = parser.parse_args()

# Added to solve 2.7 => 3.* incompatibility
Vapid = Vapid02
if args.version1:
Vapid = Vapid01
if args.gen or not os.path.exists('private_key.pem'):
if args.gen or not os.path.exists(args.private_key):
if not args.gen:
print("No private_key.pem file found.")
print("No private key file found.")
answer = None
while answer not in ['y', 'n']:
answer = prompt("Do you want me to create one for you? (Y/n)")
Expand All @@ -60,7 +62,7 @@ def main():
vapid.save_key('private_key.pem')
print("Generating public_key.pem")
vapid.save_public_key('public_key.pem')
vapid = Vapid.from_file('private_key.pem')
vapid = Vapid.from_file(args.private_key)
claim_file = args.sign
result = dict()
if args.applicationServerKey:
Expand Down
2 changes: 1 addition & 1 deletion python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from setuptools import setup, find_packages

__version__ = "1.8.2"
__version__ = "1.9.0"


def read_from(file):
Expand Down
4 changes: 2 additions & 2 deletions rust/vapid/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[package]
name = "vapid"
version = "0.4.0"
version = "0.5.0"
authors = ["jrconlin <jconlin+git@mozilla.com>"]
edition = "2018"
edition = "2021"
description = "An implementation of the RFC 8292 Voluntary Application Server Identification (VAPID) Auth header generator"
repository = "https://github.com/web-push-libs/vapid"
license = "MPL 2.0"
Expand Down