← Back
Editing: nonce.cpython-311.pyc
� |=�^ � � � g d �Z ddlmZ ddlmZmZmZmZ ddlmZ ddl Z e j e j z ZdZ dZ ed� � Zd � Ze dfd �Zdd�ZdS ) )�split�mkNonce�checkTimestamp� )� cryptutil)�strptime�strftime�gmtime�time)�timegmNiPF z%Y-%m-%dT%H:%M:%SZz0000-00-00T00:00:00Zc �� � | dt � } t t |t � � � � }n# t $ r d}Y nw xY w|dk rt d� � �|| t d� fS )aZ Extract a timestamp from the given nonce string @param nonce_string: the nonce from which to extract the timestamp @type nonce_string: str @returns: A pair of a Unix timestamp and the salt characters @returntype: (int, str) @raises ValueError: if the nonce does not start with a correctly formatted time string N���r ztime out of range)�time_str_lenr r �time_fmt�AssertionError� ValueError)�nonce_string� timestamp_str� timestamps �4/usr/lib/python3/dist-packages/openid/store/nonce.pyr r s� � � !��,��/�M���8�M�8�<�<�=�=� � ��� � � �� � � ������1�}�}��,�-�-�-��l�<�=�=�1�1�1s �"4 �A�Ac � � t | � � \ }}|�t � � }||z }||z }||cxk o|k nc S # t $ r Y dS w xY w)a8 Is the timestamp that is part of the specified nonce string within the allowed clock-skew of the current time? @param nonce_string: The nonce that is being checked @type nonce_string: str @param allowed_skew: How many seconds should be allowed for completing the request, allowing for clock skew. @type allowed_skew: int @param now: The current time, as a Unix timestamp @type now: int @returntype: bool @returns: Whether the timestamp is correctly formatted and within the allowed skew of the current time. NF)r r r )r �allowed_skew�now�stamp�_�past�futures r r r - s� � �$'���&�&���q� �;��&�&�C� �\�!�� �|�#�� �u�&�&�&�&��&�&�&�&�&�� � � � ��u�u����s �>