o
    á8\jR  ã                   @  sB   d Z ddlmZ ddlZddlZddd	„Zdd
d„Zddd„ZdS )zµLegacy invoice-form credential compatibility.

This module exists only for the current HTML upload form. Platform API access
uses the RS256 gateway and must not call these helpers.
é    )ÚannotationsNÚrawÚstrÚreturnúdict[str, str]c                 C  sb   i }| pd  d¡D ]%}| ¡ }|rd|vrq	|  dd¡\}}| ¡ }| ¡ }|r.|r.|||< q	|S )NÚ ú,ú:é   )ÚsplitÚstrip)r   ÚusersÚitemÚ	candidateÚusernameÚpassword© r   ú5/var/www/html/flask_server/shared/wp_invoices_auth.pyÚ_parse_users   s   €r   c                   C  s   t t dd¡ƒS )NÚWP_INVOICES_MAIL_USERSr   )r   ÚosÚgetenvr   r   r   r   Úget_allowed_users   s   r   Úuserr   Úboolc                 C  s,   | r|sdS t ƒ  | ¡}|duot ||¡S )zBCompare legacy form credentials without timing-sensitive equality.FN)r   ÚgetÚhmacÚcompare_digest)r   r   Úexpectedr   r   r   Úcheck_credentials   s   r   )r   r   r   r   )r   r   )r   r   r   r   r   r   )Ú__doc__Ú
__future__r   r   r   r   r   r   r   r   r   r   Ú<module>   s    

