o
    Dfs                     @   s   d dl mZ G dd dZdS )    )
json_dumpsc                   @   s4   e Zd ZdZdd ZdddZdddZd	d
 ZdS )KeySetz)This class represents a JSON Web Key Set.c                 C   s
   || _ d S )Nkeys)selfr    r   U/home/ubuntu/webapp/venv/lib/python3.10/site-packages/authlib/jose/rfc7517/key_set.py__init__   s   
zKeySet.__init__Fc                    s   d fdd| j D iS )z5Represent this key as a dict of the JSON Web Key Set.r   c                    s   g | ]}|j  fi qS r   )as_dict).0k
is_privateparamsr   r   
<listcomp>   s    z"KeySet.as_dict.<locals>.<listcomp>r   )r   r   r   r   r   r   r
   
   s   zKeySet.as_dictc                 K   s   | j |fi |}t|S )z(Represent this key set as a JSON string.)r
   r   )r   r   r   objr   r   r   as_json   s   zKeySet.as_jsonc                 C   s&   | j D ]}|j|kr|  S qtd)zFind the key matches the given kid value.

        :param kid: A string of kid
        :return: Key instance
        :raise: ValueError
        zInvalid JSON Web Key Set)r   kid
ValueError)r   r   r   r   r   r   find_by_kid   s
   

zKeySet.find_by_kidN)F)__name__
__module____qualname____doc__r	   r
   r   r   r   r   r   r   r      s    

r   N)authlib.common.encodingr   r   r   r   r   r   <module>   s    