Skip to content

Commit 393c374

Browse files
authored
Improve jwt.decode key doc (#198)
* Update jwt.py * Update jwt.py
1 parent 50d4390 commit 393c374

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

jose/jwt.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,15 @@ def decode(token, key, algorithms=None, options=None, audience=None, issuer=None
6868
6969
Args:
7070
token (str): A signed JWS to be verified.
71-
key (str or dict): A key to attempt to verify the payload with. Can be
72-
individual JWK or JWK set.
71+
key (str or iterable): A key to attempt to verify the payload with.
72+
This can be simple string with an individual key (e.g. "a1234"),
73+
a tuple or list of keys (e.g. ("a1234...", "b3579"),
74+
a JSON string, (e.g. '["a1234", "b3579"]'),
75+
a dict with the 'keys' key that gives a tuple or list of keys (e.g {'keys': [...]} ) or
76+
a dict or JSON string for a JWK set as defined by RFC 7517 (e.g.
77+
{'keys': [{'kty': 'oct', 'k': 'YTEyMzQ'}, {'kty': 'oct', 'k':'YjM1Nzk'}]} or
78+
'{"keys": [{"kty":"oct","k":"YTEyMzQ"},{"kty":"oct","k":"YjM1Nzk"}]}'
79+
) in which case the keys must be base64 url safe encoded (with optional padding).
7380
algorithms (str or list): Valid algorithms that should be used to verify the JWS.
7481
audience (str): The intended audience of the token. If the "aud" claim is
7582
included in the claim set, then the audience must be included and must equal

0 commit comments

Comments
 (0)