+
    ~jA                       ^ RI Ht ^ RIt^ RIt^ RIt^ RIHt ^ RIHtH	t	 ^RI
HtHtHtHt ^RIHt ^RIHtHtHtHtHt ^RIHtHt ^R	IHtHt ]'       d   ^R
I
HtHt ^RIHt ] ! 4       t! ! R R4      t"]"! 4       t#]#PH                  t$]#PJ                  t%]#PL                  t&]#PN                  t']#PP                  t(]#PR                  t)]#PT                  t*R# )    )annotationsN)Sequence)TYPE_CHECKINGAny)	Algorithmget_default_algorithms
has_cryptorequires_cryptography)PyJWK)DecodeErrorInvalidAlgorithmErrorInvalidKeyErrorInvalidSignatureErrorInvalidTokenError)base64url_decodebase64url_encode)InsecureKeyLengthWarningRemovedInPyjwt3Warning)AllowedPrivateKeysAllowedPublicKeys)
SigOptionsc                     ] tR t^!t$ RtR(R R llt]R R l4       tR R ltR	 R
 lt	R R lt
R R lt]RRRR3R R lltR)R R lltR)R R lltR R ltR R ltR*R R lltR0tR]R&   R R/R! R" lltR# R$ ltR% R& ltR'tR# )+PyJWSJWTNc               $    V ^8  d   QhRRRRRR/# )   
algorithmsSequence[str] | NoneoptionsSigOptions | NonereturnNone )formats   "`/Users/mitch_tango/dev/rabbit-r1-livekit/agent/.venv/lib/python3.14/site-packages/jwt/api_jws.py__annotate__PyJWS.__annotate__$   s(     7 7(7 #7 
	7    c                	h   \        4       V n        Ve   \        V4      M\        V P                  4      V n        \	        V P                  P                  4       4       F"  pW0P                  9  g   K  V P                  V K$  	  V P                  4       V n        Ve   / V P                  CVCV n        R # R # )N)r   _algorithmsset_valid_algslistkeys_get_default_optionsr   )selfr   r   keys   &&& r%   __init__PyJWS.__init__$   s    
 23)5C
O3t?O?O;P 	
 ((--/0C***$$S) 1 $(#<#<#>6dll6g6DL r(   c                   V ^8  d   QhRR/# )r   r!   r   r#   )r$   s   "r%   r&   r'   8   s     O O* Or(   c                 	    R RRR/# )verify_signatureTenforce_minimum_key_lengthFr#   r#   r(   r%   r/   PyJWS._get_default_options7   s    "D*FNNr(   c               $    V ^8  d   QhRRRRRR/# )r   alg_idstralg_objr   r!   r"   r#   )r$   s   "r%   r&   r'   ;   s!     % % %y %T %r(   c                    WP                   9   d   \        R4      h\        V\        4      '       g   \	        R4      hW P                   V&   V P
                  P                  V4       R# )z
Registers a new Algorithm for use when creating and verifying tokens.

:param str alg_id: the ID of the Algorithm
:param alg_obj: the Algorithm object
:type alg_obj: Algorithm
z Algorithm already has a handler.z!Object is not of type `Algorithm`N)r*   
ValueError
isinstancer   	TypeErrorr,   add)r0   r:   r<   s   &&&r%   register_algorithmPyJWS.register_algorithm;   sW     %%%?@@'9--?@@#* V$r(   c                    V ^8  d   QhRRRR/# )r   r:   r;   r!   r"   r#   )r$   s   "r%   r&   r'   L   s     ( (3 (4 (r(   c                    WP                   9  d   \        R4      hV P                   V V P                  P                  V4       R# )z
Unregisters an Algorithm for use when creating and verifying tokens
:param str alg_id: the ID of the Algorithm
:raises KeyError: if algorithm is not registered.
zJThe specified algorithm could not be removed because it is not registered.N)r*   KeyErrorr,   remove)r0   r:   s   &&r%   unregister_algorithmPyJWS.unregister_algorithmL   sF     )))1 
 V$'r(   c                   V ^8  d   QhRR/# )r   r!   z	list[str]r#   )r$   s   "r%   r&   r'   [   s     & &	 &r(   c                ,    \        V P                  4      # )zP
Returns a list of supported values for the `alg` parameter.

:rtype: list[str]
)r-   r,   )r0   s   &r%   get_algorithmsPyJWS.get_algorithms[   s     D$$%%r(   c                    V ^8  d   QhRRRR/# )r   alg_namer;   r!   r   r#   )r$   s   "r%   r&   r'   c   s     H Hc Hi Hr(   c                     V P                   V,          #   \         d9   p\        '       g   T\        9   d   \	        RT R24      Th\	        R4      ThRp?ii ; i)z
For a given string name, return the matching Algorithm object.

Example usage:
>>> jws_obj = PyJWS()
>>> jws_obj.get_algorithm_by_name("RS256")

:param alg_name: The name of the algorithm to retrieve
:type alg_name: str
:rtype: Algorithm
zAlgorithm 'z9' could not be found. Do you have cryptography installed?Algorithm not supportedN)r*   rF   r	   r
   NotImplementedError)r0   rO   es   && r%   get_algorithm_by_namePyJWS.get_algorithm_by_namec   se    	H##H-- 	H:(.C"C)!(+de &&?@aG	Hs    A3AAFTc               8    V ^8  d   QhRRRRRRRRR	R
RRRRRR/# )r   payloadbytesr1   z(AllowedPrivateKeys | PyJWK | str | bytes	algorithmz
str | Noneheaderszdict[str, Any] | Nonejson_encoderztype[json.JSONEncoder] | Noneis_payload_detachedboolsort_headersr!   r;   r#   )r$   s   "r%   r&   r'   x   sd     a. a.a. 6a. 	a.
 'a. 4a. "a. a. 
a.r(   c                	   . pV\         J d'   \        V\        4      '       d   VP                  p	M/R p	M,Vf'   \        V\        4      '       d   VP                  p	MRp	MTp	V'       d<   VP	                  R4      p
V
'       d
   VR,          p	VP	                  R4      pVRJ d   RpRV P
                  RV	/pV'       d%   V P                  VRR7       VP                  V4       VR,          '       g   VR V'       dJ   RVR&   VP	                  R. 4      p\        V\        4      '       g   \        R	4      hRV9  d
   . VORNVR&   M
RV9   d   VR \        P                  ! VRWWR
7      P                  4       pVP                  \        V4      4       V'       d   TpM\        V4      pVP                  V4       RP                  V4      pV P!                  V	4      p\        V\        4      '       d   VP"                  pVP%                  V4      pVP'                  V4      pV'       dK   V P(                  P	                  RR4      '       d   \+        V4      h\,        P.                  ! V\0        ^R7       VP3                  VV4      pVP                  \        V4      4       V'       d   RV^&   RP                  V4      pVP5                  R4      # )HS256nonealgb64FTtyp)encodingcritz%Invalid 'crit' header: must be a list)
separatorscls	sort_keys   .r7   
stacklevelr(   utf-8),:)_ALGORITHM_UNSETr?   r   algorithm_nameget
header_typ_validate_headersupdater-   r   jsondumpsencodeappendr   joinrT   r1   prepare_keycheck_key_lengthr   r   warningswarnr   signdecode)r0   rW   r1   rY   rZ   r[   r\   r^   segments
algorithm_headers_algheaders_b64headerexisting_critjson_headermsg_payloadsigning_inputr<   key_length_msg	signatureencoded_strings   &&&&&&&&             r%   rx   PyJWS.encodex   si    !# ((#u%% //
$
#u%% //
#
"J !++e,K$U^
!++e,Ke#&*# #(%!L""7T":MM'"e}}u!F5M
 #JJvr2MmT22'(OPPM)!8=!8%!8vf_ujjz|

&( 	 	(56!K*73K$ 		(+,,Z8c5!!''C!!#& 11#6|| <eDD%n55n.FSTULL4	(34 HQK8,$$W--r(   c               4    V ^8  d   QhRRRRRRRRR	R
RRRR/# )r   jwtstr | bytesr1   'AllowedPublicKeys | PyJWK | str | bytesr   r   r   r    detached_payloadbytes | Nonekwargsdict[str, Any]r!   r#   )r$   s   "r%   r&   r'      sY     @
 @
@
 5@
 )	@

 #@
 '@
 !@
 
@
r(   c           	     	   V'       d8   \         P                  ! R \        VP                  4       4       2\        ^R7       Vf   V P
                  pM/ V P
                  CVCpVR,          pV'       d*   V'       g"   \        V\        4      '       g   \        R4      hV P                  V4      w  rrV P                  V4       VP                  RR4      RJ d   VP                  R4      ;'       g    . p\        V\        4      '       d   RV9  d   \        R4      hVf   \        R	4      hTp	R
P                  V
P                  R
^4      ^ ,          V	.4      p
V'       d   V P!                  V
VVVVVR7       RV	RVRV/# )zypassing additional kwargs to decode_complete() is deprecated and will be removed in pyjwt version 3. Unsupported kwargs: rk   r6   z\It is required that you pass in a value for the "algorithms" argument when calling decode().rc   TFrf   zAThe 'b64' header parameter requires 'b64' to be listed in 'crit'.zIt is required that you pass in a value for the "detached_payload" argument to decode a message having the b64 header set to false.rj   )r   rW   r   r   )r}   r~   tupler.   r   r   r?   r   r   _loadrt   rr   r-   r   rz   rsplit_verify_signature)r0   r   r1   r   r   r   r   merged_optionsr6   rW   r   r   r   rf   s   &&&&&&,       r%   decode_completePyJWS.decode_complete   s    MM'',V[[]';&<> ' ?!\\N888N)*<=Jz#u7M7Mn  59JJsO1v&::eT"e+ ::f%++DdD))U$->'W   '! Z  'G II}';';D!'DQ'G&QRM""& #  wf
 	
r(   c               4    V ^8  d   QhRRRRRRRRR	R
RRRR/# )r   r   r   r1   r   r   r   r   r    r   r   r   r   r!   r   r#   )r$   s   "r%   r&   r'     sP     " "" 5" )	"
 #" '" !" 
"r(   c                	    V'       d8   \         P                  ! R \        VP                  4       4       2\        ^R7       V P                  WW4VR7      pVR,          # )zppassing additional kwargs to decode() is deprecated and will be removed in pyjwt version 3. Unsupported kwargs: rk   )r   rW   )r}   r~   r   r.   r   r   )r0   r   r1   r   r   r   r   decodeds   &&&&&&, r%   r   PyJWS.decode  sb     MM'',V[[]';&<> ' &&j<L ' 
 y!!r(   c                    V ^8  d   QhRRRR/# )r   r   r   r!   r   r#   )r$   s   "r%   r&   r'   3  s     	 	 	 	r(   c                X    V P                  V4      ^,          pV P                  V4       V# )zReturns back the JWT header parameters as a `dict`

Note: The signature is not verified so the header parameters
should not be fully trusted until signature verification is complete
)r   rt   )r0   r   rZ   s   && r%   get_unverified_headerPyJWS.get_unverified_header3  s)     **S/!$w'r(   c                    V ^8  d   QhRRRR/# )r   r   r   r!   z*tuple[bytes, bytes, dict[str, Any], bytes]r#   )r$   s   "r%   r&   r'   >  s     0; 0; 0;)S 0;r(   c                	   \        V\        4      '       d   VP                  R 4      p\        V\        4      '       g   \	        R\         24      h VP                  R^4      w  r#VP                  R^4      w  rE \        T4      p \        P                  ! T4      p\        T\        4      '       g   \	        R4      hTP                  RR	4      R
J d   T'       d   \	        R4      hRp
M \        T4      p
 \        T4      pYY3#   \         d   p\	        R4      ThRp?ii ; i  \        \        P                  3 d   p\	        R4      ThRp?ii ; i  \         d   p	\	        RT	 24      T	hRp	?	ii ; i  \        \        P                  3 d   p\	        R4      ThRp?ii ; i  \        \        P                  3 d   p\	        R4      ThRp?ii ; i)rm   z$Invalid token type. Token must be a rj   zNot enough segmentsNzInvalid header paddingzInvalid header string: z,Invalid header string: must be a json objectrc   TFz2Payload segment must be empty when 'b64' is false.r(   zInvalid payload paddingzInvalid crypto padding)r?   r;   rx   rX   r   r   splitr>   r   r@   binasciiErrorrv   loadsdictrr   )r0   r   r   crypto_segmentheader_segmentpayload_segmenterrheader_datar   rS   rW   r   s   &&          r%   r   PyJWS._load>  s   c3**W%C#u%% DUGLMM	>,/JJtQ,?)M.;.A.A$.J+N	A*>:K	D%)ZZ%<F &$''LMM::eT"e+ !"VWWGF*?;	A(8I ::M  	>34#=	>
 8>>* 	A67S@	A
  	D 7s;<!C	D( x~~. F!";<#EF
 8>>* 	A67S@	Asx   (D :D$ E *E5 6F$ D!DD!$E?EEE2E--E25F!FF!$G?GGc               4    V ^8  d   QhRRRRRRRRRR	R
RRR/# )r   r   rX   r   r   r   r1   r   r   r   r   r    r!   r"   r#   )r$   s   "r%   r&   r'   p  sY     1I 1I1I 1I 	1I
 51I )1I #1I 
1Ir(   c                	0   Ve   TMV P                   pVf$   \        V\        4      '       d   VP                  .p VR,          pT'       d   Te   Y9  d   \        R4      h\        T\        4      '       dG   YP                  8w  d   \        RT: RTP                  : 24      hTP                  p	TP                  p
M# T P                  T4      p	T	P                  T4      p
T	P                  T
4      pT'       dA   TP                  RR4      '       d   \        T4      h\        P                  ! T\         ^R	7       T	P#                  YT4      '       g   \%        R
4      hR #   \         d    \        R4      R hi ; i  \         d   p\        R4      ThR p?ii ; i)Nrb   zAlgorithm not specifiedz&The specified alg value is not allowedzToken algorithm z$ does not match the key's algorithm rQ   r7   Frk   zSignature verification failed)r   r?   r   rq   rF   r   r   r1   rT   rR   r{   r|   rr   r   r}   r~   r   verifyr   )r0   r   r   r   r1   r   r   effective_optionsrb   r<   prepared_keyrS   r   s   &&&&&&&      r%   r   PyJWS._verify_signaturep  s    (/':G*S%"8"8,,-J	M-C z-#2G'(PQQc5!! (((+&sg .!!$!3!3 68  mmG77LN44S9 #..s3L 11,? $$%A5II%n55n.FSTU~~m9EE'(GHH FC  	M'(ABL	M, ' N+,EFAMNs#   	E >E9 E69FFFrc   zset[str]_supported_critre   c               $    V ^8  d   QhRRRRRR/# )r   rZ   r   re   r]   r!   r"   r#   )r$   s   "r%   r&   r'     s$     ) )%)48)	)r(   c               	    R V9   d   V P                  VR ,          4       V'       g   RV9   d   V P                  V4       R# R# R# )kidrf   N)_validate_kid_validate_crit)r0   rZ   re   s   &&$r%   rt   PyJWS._validate_headers  s=     Gwu~.Fg-( .xr(   c                    V ^8  d   QhRRRR/# )r   r   r   r!   r"   r#   )r$   s   "r%   r&   r'     s     P P P Pr(   c                	H    \        V\        4      '       g   \        R 4      hR# )z(Key ID header parameter must be a stringN)r?   r;   r   )r0   r   s   &&r%   r   PyJWS._validate_kid  s     #s###$NOO $r(   c                    V ^8  d   QhRRRR/# )r   rZ   r   r!   r"   r#   )r$   s   "r%   r&   r'     s      n  r(   c                	4   VR ,          p\        V\        4      '       d   \        V4      ^ 8X  d   \        R4      hV FW  p\        V\        4      '       g   \        R4      hW0P
                  9  d   \        RV 24      hW19  g   KJ  \        RV R24      h	  R# )rf   z/Invalid 'crit' header: must be a non-empty listz-Invalid 'crit' header: values must be stringsz Unsupported critical extension: zCritical extension 'z' is missing from headersN)r?   r-   lenr   r;   r   )r0   rZ   rf   exts   &&  r%   r   PyJWS._validate_crit  s    v$%%Ta#$UVVCc3'''(WXX...'*J3%(PQQ!'*3%/HI  r(   )r*   r,   r   )NN) NNN)r   NN)__name__
__module____qualname____firstlineno__rs   r2   staticmethodr/   rB   rH   rL   rT   rp   rx   r   r   r   r   r   r   __annotations__rt   r   r   __static_attributes__r#   r(   r%   r   r   !   s    J7& O O%"(&H2 !1)-6:$)!a.F@
D",	0;d1Ih "'OX');@)P r(   r   )+
__future__r   r   rv   r}   collections.abcr   typingr   r   r   r   r   r	   r
   api_jwkr   
exceptionsr   r   r   r   r   utilsr   r   r   r   r   r   typesr   objectrp   r   _jws_global_objrx   r   r   rB   rH   rT   r   r#   r(   r%   <module>r      s    "    $ %    6 FA!8 ] ]@ '			!11			$77 &;; '== '== r(   