
    XhL                         U d Z ddlmZmZmZ ddlmZ ddlmZ d Z	d Z
d Zd	 Z eej                        Zeed
<   g dZy)z miscellaneous zmq_utils wrapping    )InterruptedSystemCall	_check_rc_check_version   )ffi)libc                     t        dd       t        | t              r| j                  d      } t	        t        j                  |             S )zxCheck for zmq capability by name (e.g. 'ipc', 'curve')

    .. versionadded:: libzmq-4.1
    .. versionadded:: 14.1
    )   r   zzmq.hasutf8)r   
isinstancestrencodeboolCzmq_has)
capabilitys    J/var/www/html/myenv/lib/python3.12/site-packages/zmq/backend/cffi/utils.pyhasr      s<     69%*c"&&v.
		*%&&    c                      t        j                  d      } t        j                  d      }t        j                  | |      }t	        |       t        j
                  |       dd t        j
                  |      dd fS )u  generate a Z85 key pair for use with zmq.CURVE security

    Requires libzmq (≥ 4.0) to have been built with CURVE support.

    Returns
    -------
    (public, secret) : two bytestrings
        The public and private key pair as 40 byte z85-encoded bytestrings.
    char[64]N(   )r   newr   zmq_curve_keypairr   buffer)publicprivatercs      r   curve_keypairr      sd     WWZ Fggj!G	
		VW	-BbM::fcr"CJJw$7$<<<r   c                     t        | t              r| j                  d      } t        dd       t	        j
                  d      }t        j                  ||       }t        |       t	        j                  |      dd S )un  Compute the public key corresponding to a private key for use
    with zmq.CURVE security

    Requires libzmq (≥ 4.2) to have been built with CURVE support.

    Parameters
    ----------
    private
        The private key as a 40 byte z85-encoded bytestring
    Returns
    -------
    bytestring
        The public key as a 40 byte z85-encoded bytestring.
    r   )r
      curve_publicr   Nr   )
r   r   r   r   r   r   r   zmq_curve_publicr   r   )r   r   r   s      r   r"   r"   )   sc     '3..(6>*WWZ F	
		FG	,BbM::fcr""r   c                 J    	  | | }	 t        |       	 |S # t        $ r Y  w xY w)z/make a call, retrying if interrupted with EINTR)r   r   )fargskwargsr   s       r   _retry_sys_callr(   A   s8    
X	bM I	 % 		s    	""PYZMQ_DRAFT_API)r   r   r"   r)   N)__doc__	zmq.errorr   r   r   _cffir   r   r   r   r   r"   r(   r   r)   __annotations____all__ r   r   <module>r0      sG    &
 G F  	'="#0
 Q../ /
Er   