+
    yj                     p    R t ^ RIt^ RIt^ RIHt ^ RIHt ^ RIHt ^RIHt ^RI	H
t
 R	t ! R R]
4      tR# )
a  
A provided CSRF implementation which puts CSRF data in a session.

This can be used fairly comfortably with many `request.session` type
objects, including the Werkzeug/Flask session store, Django sessions, and
potentially other similar objects which use a dict-like API for storing
session keys.

The basic concept is a randomly generated value is stored in the user's
session, and an hmac-sha1 of it (along with an optional expiration time,
for extra security) is used as the value of the csrf_token. If this token
validates with the hmac of the random value + expiration time, and the
expiration time is not passed, the CSRF validation will pass.
N)datetime)	timedelta)sha1)ValidationError)CSRFSessionCSRFc                   h   a a ] tR t^t oRtV 3R ltR tR tR t]	R 4       t
]	R 4       tRtVtV ;t# )	r   z%Y%m%d%H%M%Sc                D   < VP                   V n        \        SV `  V4      # )N)meta	form_metasuper
setup_form)selfform	__class__s   &&H/var/www/html/2rare/lib/python3.14/site-packages/wtforms/csrf/session.pyr   SessionCSRF.setup_form   s    w!$''    c                |   V P                   pVP                  f   \        R4      hVP                  f   \	        R4      hV P
                  pRV9  d1   \        \        P                  ! ^@4      4      P                  4       VR&   V P                  '       dU   V P                  4       V P                  ,           P                  V P                  4      pRP                  VR,          V4      pMRpVR,          p\        P                   ! VP                  VP#                  R4      \        R7      pV RVP                  4        2# )	Nz<must set `csrf_secret` on class Meta for SessionCSRF to workz2Must provide a session-like object as csrf contextcsrfz{}{} utf8	digestmod##)r   csrf_secret	Exceptioncsrf_context	TypeErrorsessionr   osurandom	hexdigest
time_limitnowstrftimeTIME_FORMATformathmacnewencode)r   csrf_token_fieldr
   r   expires
csrf_build	hmac_csrfs   &&     r   generate_csrf_tokenSessionCSRF.generate_csrf_token#   s   ~~#N  $PQQ,, "2::b>2<<>GFO???xxzDOO3==d>N>NOGwv@JG JHHj//74
	 "Y002344r   c                   V P                   pVP                  '       d   R VP                  9  d   \        VP                  R4      4      hVP                  P	                  R ^4      w  rEV P
                  R,          V,           P                  R4      p\        P                  ! VP                  V\        R7      pVP                  4       V8w  d   \        VP                  R4      4      hV P                  '       dL   V P                  4       P                  V P                  4      pW8  d   \        VP                  R4      4      hR# R# )r   zCSRF token missing.r   r   r   zCSRF failed.zCSRF token expired.N)r   datar   gettextsplitr   r*   r(   r)   r   r   r"   r#   r$   r%   r&   )	r   r   fieldr
   r,   r.   	check_valhmac_comparenow_formatteds	   &&&      r   validate_csrf_tokenSessionCSRF.validate_csrf_token=   s    ~~zzzT3!%--0E"FGG"ZZ--dA6\\&)G3;;FC	xx 0 0)tL!!#y0!%--"?@@??? HHJ//0@0@AM&%emm4I&JKK ' r   c                ,    \         P                  ! 4       # )z@
Get the current time. Used for test mocking/overriding mainly.
)r   r$   r   s   &r   r$   SessionCSRF.nowO   s     ||~r   c                D    \        V P                  R \        ^R7      4      # )csrf_time_limit)minutes)getattrr   r   r<   s   &r   r#   SessionCSRF.time_limitU   s    t~~'8)B:OPPr   c                l    \        V P                  P                  R V P                  P                  4      # )r   )rA   r   r   r<   s   &r   r   SessionCSRF.sessionY   s*    NN''DNN4O4O
 	
r   )r   )__name__
__module____qualname____firstlineno__r&   r   r/   r9   r$   propertyr#   r   __static_attributes____classdictcell____classcell__)r   __classdict__s   @@r   r   r      sN      K(54L$ Q Q 
 
 
r   )r   )__doc__r(   r    r   r   hashlibr   
validatorsr   corer   __all__r    r   r   <module>rT      s4     	    ( 
A
$ A
r   