+
    Di<                      a  0 t $ ^ RIHt Rt^ RIt^ RIt^ RIt^ RIt^ RIH	t	H
t
 ^ RIHt ^ R	IHt ^ R
IHt ^ RIHtHt ^RIHtHtHtHtHt ^RIHtHt ^RIHtHtHtH t H!t!H"t" ]PF                  R8  d   ^ RIH$t$ M^ RI%H$t$ ]PF                  R 8  d
   ^ RIH&t&H't' M^ RI%H&t&H't' ]PF                  R!8  d   ^ RIH(t( M^ RI%H(t( ]! R4      t)]&! R4      t*]+]+],],3,          R3,          t-R].R&   ]+]-R3,          t/R].R&    ! R R]4      t0]! RR7       ! R R]4      4       t1]! RR7       ! R R]!]1,          4      4       t2 ! R R] 4      t3R# )"    )annotationsTLSAttributeTLSConnectableTLSListener	TLSStreamN)CallableMapping)	dataclass)wraps)
SSLContext)AnyTypeVar)BrokenResourceErrorEndOfStreamaclose_forcefullyget_cancelled_exc_class	to_thread)TypedAttributeSettyped_attribute)AnyByteStreamAnyByteStreamConnectable
ByteStreamByteStreamConnectableListener	TaskGroup)	TypeAlias)TypeVarTupleUnpack)overrideT_RetvalPosArgsT.r   _PCTRTT_PCTRTTTc                     ] tR t^:t$ Rt]! 4       tR]R&   ]! 4       tR]R&   ]! 4       t	R]R&   ]! 4       t
R]R	&   ]! 4       tR
]R&   ]! 4       tR]R&   ]! 4       tR]R&   ]! 4       tR]R&   ]! 4       tR]R&   ]! 4       tR]R&   RtR# )r   z5Contains Transport Layer Security related attributes.
str | Nonealpn_protocolbyteschannel_binding_tls_uniqueztuple[str, str, int]cipherz*None | dict[str, str | _PCTRTTT | _PCTRTT]peer_certificatezbytes | Nonepeer_certificate_binaryboolserver_sidez!list[tuple[str, str, int]] | Noneshared_ciphersssl.SSLObject
ssl_objectstandard_compatiblestrtls_version N)__name__
__module____qualname____firstlineno____doc__r   r&   __annotations__r(   r)   r*   r+   r-   r.   r0   r1   r3   __static_attributes__r4       o/Users/tonyclaw/.openclaw/workspace/services/omi-webhook/venv/lib/python3.14/site-packages/anyio/streams/tls.pyr   r   :   s    ? !0 1M:1(7(99#2#4F 4 FUEVBV,;,=\=')K) 9H8IN5I / 1J1 !0 11&(K(r<   F)eqc            	          ] tR t^Vt$ RtR]R&   R]R&   R]R&   R]R	&   R]R
&   ]RRRRRRRR/R R ll4       tR R ltR R lt	R R lt
R!R R lltR R ltR R lt]R R l4       tR tR# )"r   a  
A stream wrapper that encrypts all sent data and decrypts received data.

This class has no public initializer; use :meth:`wrap` instead.
All extra attributes from :class:`~TLSAttribute` are supported.

:var AnyByteStream transport_stream: the wrapped stream

r   transport_streamr,   r1   r/   _ssl_objectzssl.MemoryBIO	_read_bio
_write_bior-   Nhostnamessl_contextTc               0    V ^8  d   QhRRRRRRRRR	R
RR/# )   r@   r   r-   zbool | NonerD   r%   rE   ssl.SSLContext | Noner1   r,   returnr   r4   )formats   "r=   __annotate__TLSStream.__annotate__i   sN     D D'D !	D
 D +D "D 
Dr<   c                 "   Vf   V'       * pV'       g   V'       d   \         P                  P                  M\         P                  P                  p\         P                  ! V4      p\        \         R4      '       d)   V;P                  \         P                  ( ,          un        \         P                  ! 4       p\         P                  ! 4       p\        V4      \         P                  J d   VP                  WxW#R7      p	M-\        P                  ! VP                  VVVVR4      G Rj  xL
 p	V ! VVV	VVR7      p
V
P                  V	P                  4      G Rj  xL
  V
#  L6 L5i)a\  
Wrap an existing stream with Transport Layer Security.

This performs a TLS handshake with the peer.

:param transport_stream: a bytes-transporting stream to wrap
:param server_side: ``True`` if this is the server side of the connection,
    ``False`` if this is the client side (if omitted, will be set to ``False``
    if ``hostname`` has been provided, ``False`` otherwise). Used only to create
    a default context when an explicit context has not been provided.
:param hostname: host name of the peer (if host name checking is desired)
:param ssl_context: the SSLContext object to use (if not provided, a secure
    default will be created)
:param standard_compatible: if ``False``, skip the closing handshake when
    closing the connection, and don't raise an exception if the peer does the
    same
:raises ~ssl.SSLError: if the TLS handshake fails

NOP_IGNORE_UNEXPECTED_EOF)r-   server_hostname)r@   r1   rA   rB   rC   )sslPurposeCLIENT_AUTHSERVER_AUTHcreate_default_contexthasattroptionsrN   	MemoryBIOtyper   wrap_bior   run_sync_call_sslobject_methoddo_handshake)clsr@   r-   rD   rE   r1   purposebio_inbio_outr0   wrappers   &&$$$$     r=   wrapTLSStream.wraph   s,    : &,K+6''CKK<S<S  44W=K s677##(D(D'DD#--/ .$--[ . J  )11$$  J - 3"
 ,,Z-D-DEEE#  	Fs.   E$E$DE$)E */E$E"E$"E$c               $    V ^8  d   QhRRRRRR/# )rG   funcz&Callable[[Unpack[PosArgsT]], T_Retval]argszUnpack[PosArgsT]rI   r    r4   )rJ   s   "r=   rK   rL      s$     , ,:,CS,	,r<   c                	  "     V! V!  pV P                   P                  '       d<   V P                  P                  V P                   P	                  4       4      G Rj  xL
  V#  L  \
        P                   Ed     T P                   P                  '       d=   T P                  P                  T P                   P	                  4       4      G Rj  xL 
  T P                  P                  4       G Rj  xL 
 pT P                  P                  T4        EK    \         d!    T P                  P                  4          EK>  \         dA   pT P                  P                  4        T P                   P                  4        \        ThRp?ii ; i\
        P                   dB    T P                  P                  T P                   P	                  4       4      G Rj  xL 
   EK  \
        P                   dA   pT P                  P                  4        T P                   P                  4        \        ThRp?i\
        P                    d   pT P                  P                  4        T P                   P                  4        \#        T\
        P$                  4      '       g$   TP&                  '       d2   RTP&                  9   d!   T P(                  '       d   \        Th\        Rhh Rp?ii ; i5i)TNUNEXPECTED_EOF_WHILE_READING)rC   pendingr@   sendreadrP   SSLWantReadErrorreceiverB   writer   	write_eofOSErrorr   SSLWantWriteErrorSSLSyscallErrorSSLError
isinstanceSSLEOFErrorstrerrorr1   )selfre   rf   resultdataexcs   &&*   r=   r[    TLSStream._call_sslobject_method   s     (tH ??***//44T__5I5I5KLLL MI '' //..."33889M9M9OPPP!%!6!6!>!>!@@@D NN((.. # /NN,,.. 7NN,,.OO--/-367 (( I++001E1E1GHHH&& 3((*))+)s2<< ((*))+c3??33LLL%Cs||%S///1s:)t3s   K)A& AK)A$K)&K&=D6DC"D2C53D8K&K)%F<K&=K)F
F;FFK&!7K&GK&K)"K&5K&6;H11K&K&	A%K!/"K!K!!K&&K)c                   V ^8  d   QhRR/# )rG   rI   ztuple[AnyByteStream, bytes]r4   )rJ   s   "r=   rK   rL      s     
< 
<9 
<r<   c                  "   V P                  V P                  P                  4      G Rj  xL
  V P                  P	                  4        V P
                  P	                  4        V P                  V P                  P                  4       3#  L^5i)zl
Does the TLS closing handshake.

:return: a tuple of (wrapped byte stream, bytes left in the read buffer)

N)r[   rA   unwraprB   ro   rC   r@   rk   rw   s   &r=   r~   TLSStream.unwrap   sk      ))$*:*:*A*ABBB  "!!#$$dnn&9&9&;;; 	Cs   )BB
ABc                   V ^8  d   QhRR/# rG   rI   Noner4   )rJ   s   "r=   rK   rL      s     - -d -r<   c                	  "   V P                   '       d    V P                  4       G R j  xL
  V P                  P                  4       G R j  xL
  R #  L(  \         d!    \        T P                  4      G R j  xL 
  h i ; i L65iN)r1   r~   BaseExceptionr   r@   acloser   s   &r=   r   TLSStream.aclose   so     ###kkm##
 ##**,,, $  '(=(=>>> 	-sC   BA AA BBBA #A?7A:8A??Bc                    V ^8  d   QhRRRR/# )rG   	max_bytesintrI   r'   r4   )rJ   s   "r=   rK   rL      s      s u r<   c                	   "   V P                  V P                  P                  V4      G R j  xL
 pV'       g   \        hV#  L5ir   )r[   rA   rk   r   )rw   r   ry   s   && r=   rm   TLSStream.receive   s:     001A1A1F1F	RR	 Ss   *AAA	Ac                    V ^8  d   QhRRRR/# )rG   itemr'   rI   r   r4   )rJ   s   "r=   rK   rL      s     H Hu H Hr<   c                	n   "   V P                  V P                  P                  V4      G R j  xL
  R #  L5ir   )r[   rA   rn   )rw   r   s   &&r=   rj   TLSStream.send   s'     ))$*:*:*@*@$GGGs   *535c                   V ^8  d   QhRR/# r   r4   )rJ   s   "r=   rK   rL      s     
 
 
r<   c                	B  "   V P                  \        P                  4      p\        P                  ! R V4      pV'       dT   \        VP                  ^4      4      \        VP                  ^4      ;'       g    ^ 4      rCW43R8  d   \        RV 24      h\        R4      h5i)zTLSv(\d+)(?:\.(\d+))?z;send_eof() requires at least TLSv1.3; current session uses z7send_eof() has not yet been implemented for TLS streams)      )extrar   r3   rematchr   groupNotImplementedError)rw   r3   r   majorminors   &    r=   send_eofTLSStream.send_eof   s     jj!9!9:1;?u{{1~.EKKN4G4Ga0H5~&)$$/=2 
 "E
 	
s   A4B7(Bc                   V ^8  d   QhRR/# rG   rI   zMapping[Any, Callable[[], Any]]r4   )rJ   s   "r=   rK   rL     s     
 
"A 
r<   c                	H  a  / S P                   P                  C\        P                  S P                  P
                  \        P                  S P                  P                  \        P                  S P                  P                  \        P                  V 3R  l\        P                  V 3R l\        P                  V 3R l\        P                  V 3R l\        P                  V 3R l\        P                  V 3R l\        P                  S P                  P                   /
C# )c                 :   < S P                   P                  R 4      # )FrA   getpeercertr   s   r=   <lambda>,TLSStream.extra_attributes.<locals>.<lambda>  s    43C3C3O3OPU3Vr<   c                 :   < S P                   P                  R 4      # )Tr   r   s   r=   r   r     s    $:J:J:V:V;r<   c                 0   < S P                   P                  # r   )rA   r-   r   s   r=   r   r     s    d.>.>.J.Jr<   c                 t   < S P                   P                  '       d   S P                   P                  4       # R # r   )rA   r-   r.   r   s   r=   r   r     s6    +++ 261A1A1P1P1R 22r<   c                    < S P                   # r   r1   r   s   r=   r   r         d6N6Nr<   c                    < S P                   # r   )rA   r   s   r=   r   r     s    T-=-=r<   )r@   extra_attributesr   r&   rA   selected_alpn_protocolr(   get_channel_bindingr)   r*   r+   r-   r.   r1   r0   r3   versionr   s   fr=   r   TLSStream.extra_attributes  s    
##44
&&(8(8(O(O33  44!1!1!8!8))+V00 3 $$&J'' * ,,.N##%=$$d&6&6&>&>#
 	
r<   r4   )i   )r5   r6   r7   r8   r9   r:   classmethodrb   r[   r~   r   rm   rj   r   propertyr   r;   r4   r<   r=   r   r   V   s     $#D $(	D
  $D .2D %)D DL,\
<-H
 
 
r<   c                      ] tR tRt$ RtR]R&   R]R&   RtR]R	&   ^tR
]R&   ]R R l4       t	RR R llt
R R lt]R R l4       tRtR# )r   i#  aj  
A convenience listener that wraps another listener and auto-negotiates a TLS session
on every accepted connection.

If the TLS handshake times out or raises an exception,
:meth:`handle_handshake_error` is called to do whatever post-mortem processing is
deemed necessary.

Supports only the :attr:`~TLSAttribute.standard_compatible` extra attribute.

:param Listener listener: the listener to wrap
:param ssl_context: the SSL context object
:param standard_compatible: a flag passed through to :meth:`TLSStream.wrap`
:param handshake_timeout: time limit for the TLS handshake
    (passed to :func:`~anyio.fail_after`)
zListener[Any]listenerzssl.SSLContextrE   Tr,   r1   floathandshake_timeoutc               $    V ^8  d   QhRRRRRR/# )rG   rz   r   streamr   rI   r   r4   )rJ   s   "r=   rK   TLSListener.__annotate__<  s"      -  SW r<   c                $  "   \        V4      G Rj  xL
  \        V \        4       4      '       g,   \        P                  ! \
        4      P                  RV R7       \        V \        4      '       d   \        V \        4       4      '       d   h R#  L|5i)au  
Handle an exception raised during the TLS handshake.

This method does 3 things:

#. Forcefully closes the original stream
#. Logs the exception (unless it was a cancellation exception) using the
   ``anyio.streams.tls`` logger
#. Reraises the exception if it was a base exception or a cancellation exception

:param exc: the exception
:param stream: the original stream

NzError during TLS handshake)exc_info)r   rt   r   logging	getLoggerr5   	exception	Exception)rz   r   s   &&r=   handle_handshake_error"TLSListener.handle_handshake_error;  sz        ''' #6899
 h'11,s 2 
 #y))Z=T=V-W-W .X 	(s   BBA=BNc               $    V ^8  d   QhRRRRRR/# )rG   handlerzCallable[[TLSStream], Any]
task_groupzTaskGroup | NonerI   r   r4   )rJ   s   "r=   rK   r   [  s(     ? ?+? %? 
	?r<   c                	   a a"   \        S4      R  VV 3R ll4       pS P                  P                  W24      G Rj  xL
  R#  L5i)c                    V ^8  d   QhRRRR/# )rG   r   r   rI   r   r4   )rJ   s   "r=   rK   'TLSListener.serve.<locals>.__annotate__a  s     	. 	.- 	.D 	.r<   c                  <"   ^RI Hp  V! SP                  4      ;_uu_ 4        \        P	                  V SP
                  SP                  R7      G Rj  xL
 pRRR4       S! X4      G Rj  xL
  R#  L  + '       g   i     L$; i L  \         d&   pSP                  Y04      G Rj  xL 
   Rp?R# Rp?ii ; i5i)rG   )
fail_after)rE   r1   N)	 r   r   r   rb   rE   r1   r   r   )r   r   wrapped_streamrz   r   rw   s   &   r=   handler_wrapper*TLSListener.serve.<locals>.handler_wrapper`  s     %
. 6 677+4>>$($4$4,0,D,D ,: , &N 8 n---& 87 . ! ?11#>>>?su   B>B 0A6A4A6B "B>-B	.B>4A66B	B 	B>B;B6*B-+B60B>6B;;B>N)r   r   serve)rw   r   r   r   s   ff& r=   r   TLSListener.serve[  s=     
 
w	. 	. 
	. mm!!/>>>s   7AAAc                   V ^8  d   QhRR/# r   r4   )rJ   s   "r=   rK   r   r  s     % %d %r<   c                	V   "   V P                   P                  4       G R j  xL
  R #  L5ir   )r   r   r   s   &r=   r   TLSListener.acloser  s     mm""$$$s   )')c                   V ^8  d   QhRR/# r   r4   )rJ   s   "r=   rK   r   v  s     
 
"A 
r<   c                	0   a  \         P                  V 3R  l/# )c                    < S P                   # r   r   r   s   r=   r   .TLSListener.extra_attributes.<locals>.<lambda>x  r   r<   )r   r1   r   s   fr=   r   TLSListener.extra_attributesu  s     ,,.N
 	
r<   r4   r   )r5   r6   r7   r8   r9   r:   r1   r   staticmethodr   r   r   r   r   r;   r4   r<   r=   r   r   #  s[    "  $$!u! >?.% 
 
r<   c                  L    ] tR tRtRtRRRRRR/R R	 llt]R
 R l4       tRtR# )r   i|  a  
Wraps another connectable and does TLS negotiation after a successful connection.

:param connectable: the connectable to wrap
:param hostname: host name of the server (if host name checking is desired)
:param ssl_context: the SSLContext object to use (if not provided, a secure default
    will be created)
:param standard_compatible: if ``False``, skip the closing handshake when closing
    the connection, and don't raise an exception if the server does the same
rD   NrE   r1   Tc          
     ,    V ^8  d   QhRRRRRRRRR	R
/# )rG   connectabler   rD   r%   rE   rH   r1   r,   rI   r   r4   )rJ   s   "r=   rK   TLSConnectable.__annotate__  s<     7 7-7 	7
 +7 "7 
7r<   c               	N   Wn         T;'       g/    \        P                  ! \        P                  P                  4      V n        \        V P
                  \        P                  4      '       g,   \        R \        V P
                  4      P                   24      hW n        W@n        R# )z7ssl_context must be an instance of ssl.SSLContext, not N)r   rP   rT   rQ   rS   rE   rt   r   	TypeErrorrX   r5   rD   r1   )rw   r   rD   rE   r1   s   &&$$$r=   __init__TLSConnectable.__init__  s     ''2 (
 (
c6P6PKK##7
 $**CNN;;I(()2235  !#6 r<   c                   V ^8  d   QhRR/# )rG   rI   r   r4   )rJ   s   "r=   rK   r     s      y r<   c                	  "   V P                   P                  4       G R j  xL
 p \        P                  VV P                  V P
                  V P                  R7      G R j  xL
 #  LD L  \         d    \        T4      G R j  xL 
  h i ; i5i)N)rD   rE   r1   )	r   connectr   rb   rD   rE   r1   r   r   )rw   r   s   & r=   r   TLSConnectable.connect  s     ''//11		" ,,$($<$<	 (    2  	#F+++	sD   BA%B:A)  A'!A) $B'A) )B
BB

B)r   rD   rE   r1   )	r5   r6   r7   r8   r9   r   r   r   r;   r4   r<   r=   r   r   |  s>    	7  $	7
 .27 %)7(  r<   )r   r   r   r   )r   
   )r      )r      )4__conditional_annotations__
__future__r   __all__r   r   rP   syscollections.abcr   r	   dataclassesr
   	functoolsr   r   typingr   r   r   r   r   r   r   r   _core._typedattrr   r   abcr   r   r   r   r   r   version_infor   typing_extensionsr   r   r   r    r!   tupler2   r"   r:   r#   r   r   r   r   )r   s   @r=   <module>r      s5   " "  	 
 
 - !     B  w +w++6w*:
#5c?C/0 0GSL)) ))$ )8 eI

 I
 I
X eU
(9% U
 U
p,* ,r<   