o
    _O                     @   sN   d Z ddlZddlmZ ddlmZ ddlmZ dd ZG dd	 d	ejZdS )
z3Interface to handle end to end flow of U2F signing.    N)baseauthenticator)customauthenticator)localauthenticatorc                 C   s   t | t| g}t|S N)r   ZCustomAuthenticatorr   ZLocalAuthenticatorCompositeAuthenticator)originauthenticators r	   ?lib/python3.10/site-packages/pyu2f/convenience/authenticator.pyCreateCompositeAuthenticator   s   r   c                   @   s0   e Zd ZdZdd ZejjfddZdd Z	dS )	r   zComposes multiple authenticators into a single authenticator.

  Priority is based on the order of the list initialized with the instance.
  c                 C   s
   || _ d S r   )r   )selfr   r	   r	   r
   __init__$   s   
zCompositeAuthenticator.__init__c                 C   s2   | j D ]}| r||||}|  S qtd)See base class.zNo valid authenticators found)r   IsAvailableAuthenticate
ValueError)r   Zapp_idZchallenge_dataZprint_callbackZauthenticatorresultr	   r	   r
   r   '   s   
z#CompositeAuthenticator.Authenticatec                 C   s   dS )r   Tr	   )r   r	   r	   r
   r   3   s   z"CompositeAuthenticator.IsAvailableN)
__name__
__module____qualname____doc__r   sysstderrwriter   r   r	   r	   r	   r
   r      s    
r   )	r   r   Zpyu2f.conveniencer   r   r   r   ZBaseAuthenticatorr   r	   r	   r	   r
   <module>   s   