
    qh                         / S Qr SSKJr  SSKJrJrJrJr  SSKJr  SSK	r	\	R                  \	R                  -   rSrSr\" S5      rS	 r\S4S
 jrSS jrg))splitmkNoncecheckTimestamp    )	cryptutil)strptimestrftimegmtimetime)timegmNiPF  z%Y-%m-%dT%H:%M:%SZz0000-00-00T00:00:00Zc                     U S[          n [        [        U[        5      5      nUS:  a  [        S5      eX [         S 4$ ! [         a    Sn N)f = f)a>  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
Nr   ztime out of range)time_str_lenr   r   time_fmtAssertionError
ValueError)nonce_stringtimestamp_str	timestamps      D/var/www/html/env/lib/python3.13/site-packages/openid/store/nonce.pyr   r      sa     !,/M8M8<=	 1},--<=111	  	s   ? AAc                      [        U 5      u  p4Uc
  [        5       nX!-
  nX!-   nXSs=:*  =(       a    U:*  $ s  $ ! [         a     gf = f)a  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.
F)r   r
   r   )r   allowed_skewnowstamp_pastfutures          r   r   r   -   sb    $'& ;&C ! # &&&&&&  s   8 
AAc                     [         R                  " S[        5      nU c  [        5       nO[        U 5      n[	        [
        U5      nX1-   $ )zGenerate a nonce with the current timestamp

@param when: Unix timestamp representing the issue time of the
    nonce. Defaults to the current time.
@type when: int

@returntype: str
@returns: A string that should be usable as a one-way nonce

@see: time
   )r   randomStringNONCE_CHARSr	   r   r   )whensaltttime_strs       r   r   r   R   s?     !!![1D|H4L!$H?    )N)__all__openidr   r
   r   r   r	   calendarr   stringascii_lettersdigitsr    SKEWr   lenr   r   r   r    r%   r   <module>r/      s_     1 1  ""V]]2
 )*2, /3 "'Jr%   