web-push-libs / pywebpush

Python Webpush Data encryption library
Mozilla Public License 2.0
303 stars 52 forks source link

Fix #130 by copying claims dict #143

Closed GladOSkar closed 2 years ago

GladOSkar commented 2 years ago

I my humble opinion modifying the vapid_claims dict is very unintuitive because it can lead to errors such as the one I described in #130. I therefore recommend copying the dict as implemented in this PR to avoid such errors.

It's also worth considering to revert the fix from #113 within this PR since it attempted to solve a similar problem that is also covered by this change, although that would change the behavior for exps in the past a bit. The corresponding test would need to be changed.

If the modifying of the passed dict is intentional, I'd recommend making that very clear in the documentation.

Please let me know about any desired changes, I'm unfamiliar with e.g. python tests.