mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-06 05:01:14 -07:00
Bump pyjwt from 2.9.0 to 2.10.0 (#2441)
* Bump pyjwt from 2.9.0 to 2.10.0 Bumps [pyjwt](https://github.com/jpadilla/pyjwt) from 2.9.0 to 2.10.0. - [Release notes](https://github.com/jpadilla/pyjwt/releases) - [Changelog](https://github.com/jpadilla/pyjwt/blob/master/CHANGELOG.rst) - [Commits](https://github.com/jpadilla/pyjwt/compare/2.9.0...2.10.0) --- updated-dependencies: - dependency-name: pyjwt dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * Update pyjwt==2.10.0 --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com> [skip ci]
This commit is contained in:
parent
feca713b76
commit
dd9a35df51
9 changed files with 152 additions and 59 deletions
|
@ -1,7 +1,7 @@
|
|||
import base64
|
||||
import binascii
|
||||
import re
|
||||
from typing import Union
|
||||
from typing import Optional, Union
|
||||
|
||||
try:
|
||||
from cryptography.hazmat.primitives.asymmetric.ec import EllipticCurve
|
||||
|
@ -37,11 +37,11 @@ def base64url_encode(input: bytes) -> bytes:
|
|||
return base64.urlsafe_b64encode(input).replace(b"=", b"")
|
||||
|
||||
|
||||
def to_base64url_uint(val: int) -> bytes:
|
||||
def to_base64url_uint(val: int, *, bit_length: Optional[int] = None) -> bytes:
|
||||
if val < 0:
|
||||
raise ValueError("Must be a positive integer")
|
||||
|
||||
int_bytes = bytes_from_int(val)
|
||||
int_bytes = bytes_from_int(val, bit_length=bit_length)
|
||||
|
||||
if len(int_bytes) == 0:
|
||||
int_bytes = b"\x00"
|
||||
|
@ -63,13 +63,10 @@ def bytes_to_number(string: bytes) -> int:
|
|||
return int(binascii.b2a_hex(string), 16)
|
||||
|
||||
|
||||
def bytes_from_int(val: int) -> bytes:
|
||||
remaining = val
|
||||
byte_length = 0
|
||||
|
||||
while remaining != 0:
|
||||
remaining >>= 8
|
||||
byte_length += 1
|
||||
def bytes_from_int(val: int, *, bit_length: Optional[int] = None) -> bytes:
|
||||
if bit_length is None:
|
||||
bit_length = val.bit_length()
|
||||
byte_length = (bit_length + 7) // 8
|
||||
|
||||
return val.to_bytes(byte_length, "big", signed=False)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue