+
    3j=8                     r  a  R& t60 t ^ RIt^ RIt^ RI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I	Ht ^ RI	Ht ^ R	I	Ht ^ R
IH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IHt ^ RIHt ^ RI H!t! ^ RI H"t"  ]PF                  t#]PL                  ! ]'4      t(Rt)]]*]]*]*3,          3,          t+]*t,]*t-R R lt. ! R R]4      t/ ! R R]4      t0 ! R R]04      t1 ! R R ]4      t2R!R"R#./t3] ^ k ^t4 ! R$ R%]4      t5R#   ]$ d    ]]],          .]
3,          t%R R lt# Li ; i)'    NPath)Any)Callable)Dict)List)Optional)Type)Union)	HTTPError)KeyringBackend)
properties)PasswordDeleteErrorPasswordSetError)	BaseModel)Field)AnacondaAuthConfig)TokenExpiredError)TokenNotFoundErrorc                0    V ^8  d   QhR\         R\         /# )   methodreturn)_KeyringClassMethod)formats   "3lib/python3.14/site-packages/anaconda_auth/token.py__annotate__r   #   s     = =1 =6I =    c                 @    \         P                  ! \        V 4      4      # N)r   ClassPropertyclassmethod)r   s   &r   classpropertyr$   #   s    ''F(;<<r   zAnaconda Cloudc                0    V ^8  d   QhR\         R\         /# )r   payloadr   str)r   s   "r   r   r   3   s     E Es Es Er   c                j    \         P                  ! V P                  R4      4      P                  R4      # )z"Encode a string to a base64 stringzutf-8)base64	b64encodeencodedecode)r&   s   &r   _as_base64_stringr.   3   s'    GNN734;;GDDr   c                      a  ] tR t^8t o Rt]V 3R lR l4       tV 3R lR ltV 3R lR ltV 3R lR	 lt	V 3R
 lR lt
RtV tR# )NavigatorFallbackg?c                    < V ^8  d   QhRS[ /# r   r   bool)r   __classdict__s   "r   r   NavigatorFallback.__annotate__<   s      t r   c                4     ^ RI pR#   \         d     R# i ; i)r   NTF)anaconda_navigatorModuleNotFoundError)clsr8   s   & r   viableNavigatorFallback.viable;   s    	%" 		s    c                0   < V ^8  d   QhRS[ RS[ RS[ RR/# r   serviceusernamepasswordr   Nr'   )r   r5   s   "r   r   r6   D   /     D DC D3 D# D$ Dr   c                    \        R 4      hz!This keyring cannot set passwordsr   selfr?   r@   rA   s   &&&&r   set_passwordNavigatorFallback.set_passwordD       BCCr   c                    < V ^8  d   QhRS[ /# r2   r'   )r   r5   s   "r   r   r6   G   s     - -# -r   c                j    ^ RI Hp RR/pVP                  RRR4      P                  R4      pW#,          # )r   )CONFzhttps://anaconda.cloudid.anaconda.cloudmaincloud_base_url/)anaconda_navigator.configrL   getstrip)rF   navigator_configknown_mappingrO   s   &   r   _get_auth_domain"NavigatorFallback._get_auth_domainG   s@    F13FG.22$&>

%* 	 ,,r   c                @   < V ^8  d   QhRS[ RS[ RS[S[ R3,          /# r   r?   r@   r   Nr(   r   )r   r5   s   "r   r   r6   Q   s+     & &C &3 &5d;K &r   c                &    ^ RI Hp V P                  4       pT\        8w  d	   Y$8w  d   R# TP                  4       pTe   ^ RIHp ^ RIHp \        TR7      pTP                  '       g    T! TP                  TR7      p	MTP                  p	T! T	4      p
RTP                  RT
R	TP                  /p\         P"                  ! T4      p\%        T4      p\&        P(                  ! \        YM4       T# R#   \         d     R# i ; i  \         d     R# i ; i)
r   )NucleusTokenN)get_api_key)refresh_access_tokendomain)configr@   api_keyr`   )$anaconda_navigator.api.nucleus.tokenr\   rV   ImportErrorKEYRING_NAME	from_fileanaconda_auth.actionsr]   r^   r   validrefresh_tokenr   access_tokenr@   r`   jsondumpsr.   keyringrG   )rF   r?   r@   r\   auth_domaintokenr]   r^   ra   rj   rb   
token_infor&   encodeds   &&&           r   get_passwordNavigatorFallback.get_passwordQ   s    	I//1K l"x'>&&(9B'{;F;;; #7++F$L  %11!,/GENN7&--J
 jj,G'0G  {DNC  		" !   s#   C/ *D /C>=C>DDc                *   < V ^8  d   QhRS[ RS[ RR/# rY   r'   )r   r5   s   "r   r   r6   y   s"      s c d r   c                    V P                  4       p ^ RIHp T\        8w  d	   Y#8w  d   R#  \
        P                  ! T4       R#   \         d     R# i ; i  \         d     R# i ; i)r   )
TOKEN_FILEN)rV   rc   rv   rd   re   osremoveFileNotFoundError)rF   r?   r@   rn   navigator_token_files   &&&  r   delete_password!NavigatorFallback.delete_passwordy   se    ++-	 l"x'>		./  		 % s"   A A AAA%$A% N)__name__
__module____qualname____firstlineno__priorityr$   r;   rG   rV   rr   r{   __static_attributes____classdictcell__r5   s   @r   r0   r0   8   sG     H D D- -& &P r   r0   c                      a  ] tR t^t o Rt]V 3R lR l4       t]V 3R lR l4       t]V 3R lR l4       tV 3R lR	 lt	V 3R
 lR lt
V 3R lR ltV 3R lR ltV 3R lR ltRtV tR# )AnacondaKeyringztoken AnacondaKeyringc                    < V ^8  d   QhRS[ /# r2   r   )r   r5   s   "r   r   AnacondaKeyring.__annotate__   s     1 1T 1r   c                *    \        4       P                  # r!   )r   keyring_path)r:   s   &r   r   AnacondaKeyring.keyring_path   s    !#000r   c                    < V ^8  d   QhRS[ /# r2   float)r   r5   s   "r   r   r      s     	 	 	r   c                    \        4       pVP                  R 8X  d   R# VP                  R8X  d   R# \        RVP                   R24      h)systemg?zanaconda-keyringg      &@ztoken_storage: z is not supported.)r   preferred_token_storage
ValueErrorr:   ra   s   & r   r   AnacondaKeyring.priority   sN    #%))X5++/AA!&"@"@!AAST r   c                    < V ^8  d   QhRS[ /# r2   r3   )r   r5   s   "r   r   r      s      t r   c                    V P                   P                  P                  R R R7       V P                   P                  R4      ;_uu_ 4       pVP	                  4       pRRR4       V#   + '       g   i     X# ; i  \
         d     R# i ; i)Texist_okparentsaNF)r   parentmkdiropenwritableOSError)r:   fr   s   &  r   r;   AnacondaKeyring.viable   ss    	##))4)F!!&&s++q::< ,O ,+O 		s0   A
A; A'	A; 'A8	2A; 8A; ;B
	B
c                    < V ^8  d   QhRS[ /# r2   LocalKeyringData)r   r5   s   "r   r   r      s     	 	' 	r   c                2   V P                   P                  4       '       g   / #  V P                   P                  R 4      ;_uu_ 4       p\        P                  ! V4      pRRR4       V#   + '       g   i     X# ; i  \        P
                   d    / u # i ; i)rN)r   existsr   rk   loadJSONDecodeError)rF   fpdatas   &  r   _readAnacondaKeyring._read   sx      ''))I	""'',,yy} -K -,K## 	I	s/   #A< A(	A< (A9	3A< 9A< <BBc                $   < V ^8  d   QhRS[ RR/# )r   r   r   Nr   )r   r5   s   "r   r   r      s        *  t  r   c                    V P                   P                  P                  R R R7       V P                   P                  R4      ;_uu_ 4       p\        P
                  ! W4       RRR4       R#   + '       g   i     R# ; i)Tr   wN)r   r   r   r   rk   dump)rF   r   r   s   && r   _saveAnacondaKeyring._save   sU      &&d&C##C((BIId )(((s   A,,A=	c                0   < V ^8  d   QhRS[ RS[ RS[ RR/# r>   r'   )r   r5   s   "r   r   r      s)      C 3 # $ r   c                r    V P                  4       pW9  d   / WA&   W4V,          V&   V P                  V4       R # r!   )r   r   )rF   r?   r@   rA   r   s   &&&& r   rG   AnacondaKeyring.set_password   s2    zz|DM"*Wh

4r   c                @   < V ^8  d   QhRS[ RS[ RS[S[ R3,          /# rY   rZ   )r   r5   s   "r   r   r      s+     9 9C 93 95d;K 9r   c                f    V P                  4       pVP                  V/ 4      P                  VR 4      # r!   )r   rR   rF   r?   r@   r   s   &&& r   rr   AnacondaKeyring.get_password   s+    zz|xx$((488r   c                *   < V ^8  d   QhRS[ RS[ RR/# rY   r'   )r   r5   s   "r   r   r      s"     & &s &c &d &r   c                    V P                  4       p VP                  V/ 4      P                  V4       V P                  V4       R #   \         d    \
        hi ; ir!   )r   rR   popr   KeyErrorr   r   s   &&& r   r{   AnacondaKeyring.delete_password   sL    zz|	&HHWb!%%h/JJt 	&%%	&s   2A Ar}   N)r~   r   r   r   namer$   r   r   r;   r   r   rG   rr   r{   r   r   r   s   @r   r   r      sv     "D1 1 	 	  	 	    9 9& &r   r   c                   v   a  ] tR t^t o Rt]V 3R lR l4       tV 3R lR ltV 3R lR ltV 3R lR	 lt	R
t
V tR# )ConfigKeyringztoken ConfigKeyringc                    < V ^8  d   QhRS[ /# r2   r   )r   r5   s   "r   r   ConfigKeyring.__annotate__   s     B B Br   c                f    \        4       pVP                  '       g   VP                  '       d   R # R# )g      Y@g        )r   rb   rm   r   s   & r   r   ConfigKeyring.priority   s%    #%&...uAcAr   c                0   < V ^8  d   QhRS[ RS[ RS[ RR/# r>   r'   )r   r5   s   "r   r   r      rB   r   c                    \        R 4      hrD   r   rE   s   &&&&r   rG   ConfigKeyring.set_password   rI   r   c                *   < V ^8  d   QhRS[ RS[ RR/# rY   r'   )r   r5   s   "r   r   r      s'     G Gs Gc Gd Gr   c                    \        R 4      h)z$This keyring cannot delete passwordsr   )rF   r?   r@   s   &&&r   r{   ConfigKeyring.delete_password   s    EFFr   c                    < V ^8  d   QhRS[ /# r2   r   )r   r5   s   "r   r   r      s      ' r   c                h   \        4       pVP                  '       dx   \        VP                  VP                  R 7      p\        P
                  ! VP                  4       P                  R4      4      P                  R4      p\        VP                  V//# VP                  '       d   VP                  # / # ))r`   rb   ascii)r   rb   	TokenInfor`   r*   r+   model_dump_jsonr,   r-   re   rm   )rF   ra   decodedrq   s   &   r   r   ConfigKeyring._read   s    #%>>>v}}fnnMG&&'')009fWo  !6=='":;;>>>>>!	r   r}   N)r~   r   r   r   r   r$   r   rG   r{   r   r   r   r   s   @r   r   r      s@      DB BD DG G r   r   c                   0   a  ] tR t^t o RtV 3R ltRtV tR# )	RepoTokenNc                F   < V ^8  d   Qh/ S[ ;R&   S[S[R3,          ;R&   # )r   ro   Norg_name)TokenStringr   OrgName)r   r5   s   "r   r   RepoToken.__annotate__   s$      GTM") r   r}   )r~   r   r   r   r   __annotate_func__r   r   r   s   @r   r   r      s     %)H  r   r   zanaconda.comrM   zanaconda.cloudc                   J  a  ] tR t^t o ]! R R7      tRtRt. t]	t
]V 3R lR l4       t]V 3R lR l4       t]RRR	/V 3R
 lR lll4       tV 3R lR ltV 3R lR lt]V 3R lR l4       tV 3R lR ltV 3R lR ltV 3R lR ltV 3R lR ltV 3R lR ltV 3R ltRtV tR# )r   c                 *    \        4       P                  # r!   )r   r`   r}   r   r   <lambda>TokenInfo.<lambda>   s    0B0D0K0Kr   )default_factoryNc                &   < V ^8  d   QhRS[ RS[/# )r   keyring_datar   )r(   dict)r   r5   s   "r   r   TokenInfo.__annotate__  s      3 4 r   c                ^    \         P                  ! V4      p\        P                  ! V4      pV# r!   )r*   	b64decoderk   loads)r:   r   decoded_bytesdecoded_dicts   &&  r   _decodeTokenInfo._decode  s&    ((6zz-0r   c                0   < V ^8  d   QhRS[ RS[ RS[ RR/# )r   r   from_domain	to_domainr   r   r'   )r   r5   s   "r   r   r   	  s-      -0=@	r   c                    V P                  V4      pW4R&   \        VR&   \        R/ VB pVP                  4        \        P
                  ! \        V4       \        P                  RV RV R24       V# )z3Migrate the domain and save token under new domain.r`   versionu1   🔓 Token has been migrated from legacy domain 'z' to 'u   ' 🎉r}   )	r   TOKEN_INFO_VERSIONr   saverm   r{   re   loggerdebug)r:   r   r   r   r   rp   s   &&&&  r   _migrateTokenInfo._migrate  st    
 {{<0!*X"4Y..
k:?}FS\R]]cd	
 r   createFc                :   < V ^8  d   QhRS[ S[,          RS[RR/# )r   r`   r   r   r   )r	   r(   r4   )r   r5   s   "r   r   r     s&     !! !!(3- !!4 !!K !!r   c                  T;'       g    \        4       P                  p\        P                  ! \        V4      pVe2   \
        P                  R4       V P                  V4      p\        R/ VB # \        P                  V. 4      pV F7  p\        P                  ! \        V4      pVf   K$  V P                  WvVR7      u # 	  V'       d"   \
        P                  R4       \        VR7      # \        h)a!  Load the token information from the system keyring.

Args:
    domain: The domain for which to load the token information. If
        not provided, defaults to the configuration domain.
    create: If True, create a new TokenInfo object if not found.

Returns:
    The token information.

u<   🔓 Token has been successfully retrieved from keyring 🎉)r   r   u-   🔓 Token has been successfully created 🎉r_   r}   )r   r`   rm   rr   re   r   r   r   r   
MIGRATIONSrR   r   r   )r:   r`   r   r   r   legacy_domainslegacy_domainexisting_keyring_datas   &&$     r   r   TokenInfo.load  s     66-/66++L&A#LLWX;;|4L,|,, $3+M$+$8$8}$U!$0||)PV $   , LLHIF++  r   c                   < V ^8  d   QhRR/# r   r   Nr}   )r   r5   s   "r   r   r   <  s     R Rd Rr   c                    V P                  RR7      p\        V4      p\        P                  ! \        V P
                  V4       \        P                  R4       R# )z2Write the token information to the system keyring.T)exclude_noneu9   🔒 Token has been safely stored in system keychain 🎉N)r   r.   rm   rG   re   r`   r   r   )rF   r&   rq   s   &  r   r   TokenInfo.save<  sB    &&D&9#G,\4;;@PQr   c                   < V ^8  d   QhRR/# r  r}   )r   r5   s   "r   r   r   C  s     % % %r   c                     \         P                  ! \        V P                  4       \        P
                  '       d+   \	        4       P                  \        V P                  4       R# R#   \         d    \        hi ; i)z5Delete the token information from the system keyring.N)rm   r{   re   r`   r0   r;   r   r   rF   s   &r   deleteTokenInfo.deleteC  sX    	%##L$++> '''!#33L$++N (" 	%$$	%s   :A) (A) )A;c                    < V ^8  d   QhRS[ /# r2   r3   )r   r5   s   "r   r   r   M  s     
< 
< 
<r   c                   V P                   f   R# \        P                  ! V P                   R.RR/R7      p\        P                  P                  VR,          4      P                  \        P                  P                  R7      pV\        P                  P                  \        P                  P                  R7      8  # )	NTRS256verify_signatureF)
algorithmsoptionsexp)tzinfo)tz)
rb   jwtr-   dtdatetimefromtimestampreplacetimezoneutcnow)rF   r   expirys   &  r   expiredTokenInfo.expiredL  s    <<**LLgY9KU8S
 **75>:BB;;?? C 
 2;;??;;;r   c                    < V ^8  d   QhRS[ /# r2   r'   )r   r5   s   "r   r   r   Y  s      # r   c                L   V P                   fC    \        P                  V P                  4      pTP
                  T n        TP                   T n         V P                   f   Q hV P                  '       d   \        R4      hV P                   #   \         d    Rp\	        T4      hi ; i)z>Get the access token, ensuring login and refresh if necessary.z2No token found, please login with `anaconda login`zNYour login token as expired. Please login again using
  anaconda login --force)rb   r   r   r`   r   r@   r  r   )rF   new_token_infomessages   &  r   get_access_tokenTokenInfo.get_access_tokenY  s    <<2!*!< +33DM)11DL||'''<<<#+ 
 ||! & 2N(112s   B
 
B#c                *   < V ^8  d   QhRS[ RS[RR/# )r   r   ro   r   Nr   r   )r   r5   s   "r   r   r   p  s'     K Kw K{ Kt Kr   c                    V P                  VR7       V P                   Uu. uF  q3P                  V8w  g   K  VNK  	  upV P                  R&   V P                  P	                  \        WR7      4       R# u upi   \         d     L9i ; i)zSet the repo token for a specific organization.

Args:
    org_name: The organization name for which to search for a token.
    token: The token value.

)r   NNN)r   ro   N)get_repo_tokenrepo_tokensr   r   appendr   )rF   r   ro   ts   &&& r   set_repo_tokenTokenInfo.set_repo_tokenp  s    
	2  ++#+azzX/E+#DQ 		8 IJ	# " 		s   A; A6A6;B	B	c                &   < V ^8  d   QhRS[ RS[/# )r   r   r   r%  )r   r5   s   "r   r   r     s     R Rw R; Rr   c                    V P                    F"  pVP                  V8X  g   K  VP                  u # 	  \        RV 24      h)a6  Return the installed repo token for a specific organization.

Args:
    org_name: The organization name for which to search for a token.

Returns:
    The repo access token associated with the requested organization.

Raises:
    TokenNotFoundError: if no token is found in the keyring for that organization.

z"Could not find repo token for org )r)  r   ro   r   )rF   r   ro   s   && r   r(  TokenInfo.get_repo_token  s?     %%E~~){{" & !#EhZ!PQQr   c                $   < V ^8  d   QhRS[ RR/# )r   r   r   N)r   )r   r5   s   "r   r   r     s     V V' Vd Vr   c                    V P                    Uu. uF  q"P                  V8w  g   K  VNK  	  upV P                   R&   R# u upi )z|Delete the repo token for a specific organization.

Args:
    org_name: The organization name for which to delete a token.

r'  N)r)  r   )rF   r   r+  s   && r   delete_repo_tokenTokenInfo.delete_repo_token  s9     +/*:*:U*:QjjH>Tqq*:UUs   >>c                   < V ^8  d   QhRR/# r  r}   )r   r5   s   "r   r   r     s     ! !t !r   c                $    . V P                   R&   R# )zDelete all repo tokensr'  N)r)  r  s   &r   delete_all_repo_tokenTokenInfo.delete_all_repo_token  s     !r   c                   < V ^8  d   Qh/ S[ ;R&   S[S[ R3,          ;R&   S[S[ R3,          ;R&   S[S[,          ;R&   S[S[,          ;R&   # )r   r`   Nrb   r@   r)  r   )r(   r   r   r   r	   int)r   r5   s   "r   r   r      s\     L 39$  CI%  i%	 
 c]/ r   )rb   r@   r!   )r~   r   r   r   r   r`   rb   r@   r)  r   r   r#   r   r   r   r   r  propertyr  r"  r,  r(  r3  r7  r   r   r   r   s   @r   r   r      s     (KLF $G!%H#%K/G 
   !!% !! !! !!FR R% % 
< 
< .K K.R R$V V! !W  r   r   c                x    V ^8  d   Qh/ ^ \         9   d&   \        \        \        \        ,          3,          ;R&   # )r   r   )__conditional_annotations__r   r(   r   )r   s   "r   r   r      s+    h Dd3i  i r   )7r=  r*   r  r  rk   loggingrw   pathlibr   typingr   r   r   r   r	   r
   r   urllib.errorr   r  rm   keyring.backendr   r   keyring.errorsr   r   pydanticr   r   anaconda_auth.configr   anaconda_auth.exceptionsr   r   r$   AttributeErrorr   	getLoggerr~   r   re   r(   r   r   r   r.   r0   r   r   r   r   r   r   r   )r=  s   @r   <module>rI     s;       	         " 
  * & . +   3 6 7=,,M 
		8	$   T#s(^+, 
E
Q QhB&n B&JO 8*	 * (*:;$
   n!	 n!w  ="D$8#93#>?==s   D  D65D6