Skip to content

mypy. Key can be cryptography.hazmat.backends.openssl.rsa._RSAPublicKey not only string #848

@ievgennaida

Description

@ievgennaida

Summary.
jwt.decode can accept cryptography.hazmat.backends.openssl.rsa._RSAPublicKey or private key or string.

Expected Result

Allow to pass not only string.

Actual Result

Warning from mypy while only string is expected but actually public key is expected.

Reproduction Steps

jwk_set = PyJWKSet.from_json(data)
jwt.decode("", key= jwk_set.keys[0].key);

System Information

$ python -m jwt.help
{
  "cryptography": {
    "version": "39.0.0"
  },
  "implementation": {
    "name": "CPython",
    "version": "3.8.10"
  },
  "platform": {
    "release": "10",
    "system": "Windows"
  },
  "pyjwt": {
    "version": "2.6.0"
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    staleIssues without activity for more than 60 days

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions