diff --git a/python/py_vapid/__init__.py b/python/py_vapid/__init__.py index 9d61e9d..76edc62 100644 --- a/python/py_vapid/__init__.py +++ b/python/py_vapid/__init__.py @@ -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: @@ -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): diff --git a/python/py_vapid/main.py b/python/py_vapid/main.py index 54aa3e8..58ca491 100644 --- a/python/py_vapid/main.py +++ b/python/py_vapid/main.py @@ -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)") @@ -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: diff --git a/python/setup.py b/python/setup.py index f567a3d..1600cbc 100644 --- a/python/setup.py +++ b/python/setup.py @@ -3,7 +3,7 @@ from setuptools import setup, find_packages -__version__ = "1.8.2" +__version__ = "1.9.0" def read_from(file): diff --git a/rust/vapid/Cargo.toml b/rust/vapid/Cargo.toml index 4ae33c7..6dabaff 100644 --- a/rust/vapid/Cargo.toml +++ b/rust/vapid/Cargo.toml @@ -1,8 +1,8 @@ [package] name = "vapid" -version = "0.4.0" +version = "0.5.0" authors = ["jrconlin "] -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"