mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-06 05:01:14 -07:00
Bump pyjwt from 2.4.0 to 2.6.0 (#1897)
* Bump pyjwt from 2.4.0 to 2.6.0 Bumps [pyjwt](https://github.com/jpadilla/pyjwt) from 2.4.0 to 2.6.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.4.0...2.6.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.6.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
79cf61c53e
commit
60da559332
11 changed files with 326 additions and 103 deletions
|
@ -439,6 +439,41 @@ if has_crypto:
|
|||
except InvalidSignature:
|
||||
return False
|
||||
|
||||
@staticmethod
|
||||
def to_jwk(key_obj):
|
||||
|
||||
if isinstance(key_obj, EllipticCurvePrivateKey):
|
||||
public_numbers = key_obj.public_key().public_numbers()
|
||||
elif isinstance(key_obj, EllipticCurvePublicKey):
|
||||
public_numbers = key_obj.public_numbers()
|
||||
else:
|
||||
raise InvalidKeyError("Not a public or private key")
|
||||
|
||||
if isinstance(key_obj.curve, ec.SECP256R1):
|
||||
crv = "P-256"
|
||||
elif isinstance(key_obj.curve, ec.SECP384R1):
|
||||
crv = "P-384"
|
||||
elif isinstance(key_obj.curve, ec.SECP521R1):
|
||||
crv = "P-521"
|
||||
elif isinstance(key_obj.curve, ec.SECP256K1):
|
||||
crv = "secp256k1"
|
||||
else:
|
||||
raise InvalidKeyError(f"Invalid curve: {key_obj.curve}")
|
||||
|
||||
obj = {
|
||||
"kty": "EC",
|
||||
"crv": crv,
|
||||
"x": to_base64url_uint(public_numbers.x).decode(),
|
||||
"y": to_base64url_uint(public_numbers.y).decode(),
|
||||
}
|
||||
|
||||
if isinstance(key_obj, EllipticCurvePrivateKey):
|
||||
obj["d"] = to_base64url_uint(
|
||||
key_obj.private_numbers().private_value
|
||||
).decode()
|
||||
|
||||
return json.dumps(obj)
|
||||
|
||||
@staticmethod
|
||||
def from_jwk(jwk):
|
||||
try:
|
||||
|
@ -574,7 +609,7 @@ if has_crypto:
|
|||
Sign a message ``msg`` using the EdDSA private key ``key``
|
||||
:param str|bytes msg: Message to sign
|
||||
:param Ed25519PrivateKey}Ed448PrivateKey key: A :class:`.Ed25519PrivateKey`
|
||||
or :class:`.Ed448PrivateKey` iinstance
|
||||
or :class:`.Ed448PrivateKey` isinstance
|
||||
:return bytes signature: The signature, as bytes
|
||||
"""
|
||||
msg = bytes(msg, "utf-8") if type(msg) is not bytes else msg
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue