Skip to content

New API: Retrieving a key by KID from a PyJWKSet? #724

Closed
@woodruffw

Description

@woodruffw

First of all, thanks for creating and maintaining this library!

The current PyJWKSet API is pretty thin: it wraps a list of PyJWK and provides basic deserialization, but nothing else.

I'd like to propose adding PyJWKSet.__getitem__, which would allow a user to index the PyJWKSet by key ID and return the corresponding PyJWK (or KeyError if not present). This saves users from having to write their own search over the PyJWKSet, and doesn't significantly complicate the current API.

With __getitem__, the use pattern would be:

jwks = PyJWKSet(keys)
jwk = jwks["somelonghexkeyid"]

Would this functionality be welcome? If so, I am happy to contribute it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions