+
    i                        ^ RI Ht ^ RIt^ RIt^ RIt^ RIHtHt ^ RIH	t	H
t
Ht ^RIHt ^RIHt ^RIHtHt ^RIHtHt R	R
.t]]]3,          tR R lt ! R R	]4      tRR R lltR# )    )annotationsN)	AwaitableIterable)AnyCallablecast)Headers)InvalidHeader)build_www_authenticate_basicparse_authorization_basic)HTTPResponseWebSocketServerProtocol BasicAuthWebSocketServerProtocolbasic_auth_protocol_factoryc                    V ^8  d   QhRRRR/# )   valuer   returnbool )formats   "]/home/wkmabra/.openclaw/workspace/venv/lib/python3.14/site-packages/websockets/legacy/auth.py__annotate__r      s     G G# G$ G    c                     V w  r\        V\        4      ;'       d    \        V\        4      #   \        \        3 d     R # i ; iF)
isinstancestr	TypeError
ValueError)r   usernamepasswords   &  r   is_credentialsr#      sG    G" (C(FFZ#-FF z" s   . AAc                  ~   a  ] tR t^t$ RtRtR]R&    RtR]R&    RRRR/R	 V 3R
 llltR R lt	R V 3R llt
RtV ;t# )r   z;
WebSocket server protocol that enforces HTTP Basic Auth.

 r   realmN
str | Noner!   check_credentialsc          
     ,    V ^8  d   QhRRRRRRRRRR	/# )
r   argsr   r&   r'   r(   ,Callable[[str, str], Awaitable[bool]] | Nonekwargsr   Noner   )r   s   "r   r   -BasicAuthWebSocketServerProtocol.__annotate__.   s=     
* 
*
* 
* H	
*
 
* 

*r   c               	H   < Ve   Wn         W n        \        SV `  ! V/ VB  R # N)r&   _check_credentialssuper__init__)selfr&   r(   r*   r,   	__class__s   &$$*,r   r3   )BasicAuthWebSocketServerProtocol.__init__.   s(     J"3$)&)r   c               $    V ^8  d   QhRRRRRR/# r   r!   r   r"   r   r   r   )r   s   "r   r   r.   :   s!       s t r   c                `   "   V P                   e   V P                  W4      G Rj  xL
 # R#  L5i)ar  
Check whether credentials are authorized.

This coroutine may be overridden in a subclass, for example to
authenticate against a database or an external service.

Args:
    username: HTTP Basic Auth username.
    password: HTTP Basic Auth password.

Returns:
    :obj:`True` if the handshake should continue;
    :obj:`False` if it should fail with an HTTP 401 error.

NF)r1   )r4   r!   r"   s   &&&r   r(   2BasicAuthWebSocketServerProtocol.check_credentials:   s0       "".00DDD Es   #.,.c               $    V ^8  d   QhRRRRRR/# )r   pathr   request_headersr	   r   zHTTPResponse | Noner   )r   s   "r   r   r.   O   s-     $D $D$D !$D 
	$Dr   c                2  <"    VR,          p \        T4      w  rET P                  YE4      G Rj  xL
 '       g4   \        P                  P                  R\	        T P
                  4      3.R3# Y@n	        \        ST `-  Y4      G Rj  xL
 #   \          d7    \        P                  P                  R\	        T P
                  4      3.R3u # i ; i  \         d7    \        P                  P                  R\	        T P
                  4      3.R3u # i ; i L L5i)zC
Check HTTP Basic Auth and return an HTTP 401 response if needed.

AuthorizationzWWW-Authenticates   Missing credentials
s   Unsupported credentials
Ns   Invalid credentials
)KeyErrorhttp
HTTPStatusUNAUTHORIZEDr   r&   r   r
   r(   r!   r2   process_request)r4   r<   r=   authorizationr!   r"   r5   s   &&&   r   rD   0BasicAuthWebSocketServerProtocol.process_requestO   s    	+O<M	!:=!IH ++H???,,$&B4::&NOP(  !W,TCCC3  	,,$&B4::&NOP( 	  	,,$&B4::&NOP, 	 @ Dsf   D	B C DD	DADDD>C	DCD>DDDDD)r1   r&   r!   )__name__
__module____qualname____firstlineno____doc__r&   __annotations__r!   r3   r(   rD   __static_attributes____classcell__)r5   s   @r   r   r      sX    
 E3O  Hj-
* !
* KO	
* 
**$D $Dr   c          
     ,    V ^8  d   QhRRRRRRRRR	R
/# )r   r&   r'   credentialsz*Credentials | Iterable[Credentials] | Noner(   r+   create_protocolz6Callable[..., BasicAuthWebSocketServerProtocol] | Noner   z/Callable[..., BasicAuthWebSocketServerProtocol]r   )r   s   "r   r   r   v   sC     H HH;H DH L	H
 5Hr   c                H  a VRJ VRJ 8X  d   \        R4      hVe   \        V4      '       d   \        \        V4      .pM\	        V\
        4      '       dn   \        \        \
        \        ,          V4      4      p\        ;QJ d    R V 4       F  '       d   K   RM	  RM! R V 4       4      '       g   \        RV 24      hM\        RV 24      h\        V4      oR V3R llpVf   \        p\        \        R	\        3,          V4      p\        P                  ! VV VR
7      # )a  
Protocol factory that enforces HTTP Basic Auth.

:func:`basic_auth_protocol_factory` is designed to integrate with
:func:`~websockets.legacy.server.serve` like this::

    serve(
        ...,
        create_protocol=basic_auth_protocol_factory(
            realm="my dev server",
            credentials=("hello", "iloveyou"),
        )
    )

Args:
    realm: Scope of protection. It should contain only ASCII characters
        because the encoding of non-ASCII characters is undefined.
        Refer to section 2.2 of :rfc:`7235` for details.
    credentials: Hard coded authorized credentials. It can be a
        ``(username, password)`` pair or a list of such pairs.
    check_credentials: Coroutine that verifies credentials.
        It receives ``username`` and ``password`` arguments
        and returns a :class:`bool`. One of ``credentials`` or
        ``check_credentials`` must be provided but not both.
    create_protocol: Factory that creates the protocol. By default, this
        is :class:`BasicAuthWebSocketServerProtocol`. It can be replaced
        by a subclass.
Raises:
    TypeError: If the ``credentials`` or ``check_credentials`` argument is
        wrong.

Nz/provide either credentials or check_credentialsc              3  8   "   T F  p\        V4      x  K  	  R # 5ir0   )r#   ).0items   & r   	<genexpr>.basic_auth_protocol_factory.<locals>.<genexpr>   s     I8H~d++8Hs   FTzinvalid credentials argument: c               $    V ^8  d   QhRRRRRR/# r8   r   )r   s   "r   r   1basic_auth_protocol_factory.<locals>.__annotate__   s&     	D 	Dc 	DS 	DT 	Dr   c                p   <"    SV ,          p\        P                  ! Y!4      #   \          d     R # i ; i5ir   )r@   hmaccompare_digest)r!   r"   expected_passwordcredentials_dicts   && r   r(   6basic_auth_protocol_factory.<locals>.check_credentials   s=     $4X$>! &&'8CC  s   6	$ 63636.)r&   r(   )r   r#   r   Credentialsr   r   listalldictr   r   	functoolspartial)r&   rP   r(   rQ   credentials_listr^   s   &&&& @r   r   r   v   s   L 	t!2d!:;IJJ+&& $[+ >?X..#D+)>$LM3I8HI333I8HIII"@ NOO J <[MJKK 01	D 	D : 667O + r   )NNNN)
__future__r   rd   r[   rA   collections.abcr   r   typingr   r   r   datastructuresr	   
exceptionsr
   headersr   r   serverr   r   __all__tupler   r`   r#   r   r   r   r   r   <module>rp      sd    "    / & & $ & M 9 ./L
MCHoGVD'> VDrH Hr   