
    k7i6                        S SK r SSKJr  SSKJr  SSKJr  SSKJr  SSKJ	r	J
r
Jr  Sr S SKrS S	KJrJr  \R"                  " S
S5        S SKJr  Sr\ R,                  " \5      r " S S\R2                  \5      rg! \\\4 a     N4f = f)    N   )backend)KeyringBackend)
properties)SimpleCredential)KeyringLockedPasswordDeleteErrorPasswordSetErrorF)GioGLibSecret1)r   Tc                       \ rS rSrSrSr\S 5       r\R                  S 5       r
\R                  S\4S j5       rS rS	 rS
 rS rSrg)Keyring   zlibsecret KeyringzPython keyring libraryc           
      "   [         R                  R                  S[         R                  R                  U R                  [         R                  R                  [         R                  R                  [         R                  R                  S95      $ )Nzorg.freedesktop.Secret.Genericapplication)r   SchemanewSchemaFlagsNONE_querySchemaAttributeTypeSTRINGselfs    T/home/james-whalen/.local/lib/python3.13/site-packages/keyring/backends/libsecret.pyschemaKeyring.schema!   si    }}  ,##KK**11**11"66==  
 	
    c                 "    [         R                  $ )N)r   COLLECTION_DEFAULTr   s    r   
collectionKeyring.collection-   s    (((r!   returnc                     [         (       d  [        S5      e [        R                  R	                  [        R
                  R                  S 5        g! [        R                   a  n[        S5      UeS nAff = f)Nzlibsecret requiredz*Can't open a session to the secret serviceg333333@)		availableRuntimeErrorr   Serviceget_syncServiceFlagsOPEN_SESSIONr   Error)clserrors     r   priorityKeyring.priority1   se    y344	XNN##F$7$7$D$DdK  zz 	XKLRWW	Xs   8A A6%A11A6c                    U R                  XU R                  S9n [        R                  " U R                  U[        R
                  R                  S5      nU H"  n UR                  5       R!                  5       s  $    g! [        R                   aW  n[        R                  " S5      nUR                  U[        R                  R                  5      (       a  [        S5      Uee SnAff = f! [        R                   aW  n[        R                  " S5      nUR                  U[        R                  R"                  5      (       a  [        S5      Uee SnAff = f)z,Get password of the username for the servicer   Ng-io-error-quarkFailed to unlock the item!secret-error)r   appidr   password_search_syncr   SearchFlagsUNLOCKr   r.   quark_try_stringmatchesr   IOErrorEnumFAILEDr   retrieve_secret_syncget_text	IS_LOCKED)r   serviceusername
attributesitemsr0   quarkitems           r   get_passwordKeyring.get_password>   s   [[

[K
	//Z););)B)BDE D002;;==  zz 	))*<=E}}UCOO$:$:;;#$@AuL		 :: --n===(>(>??'(DE5P	s1   ;B  C. C+AC&&C+.EAEEc                 H   U R                  XU R                  S9nSU SU S3n [        R                  " U R                  X@R
                  XSS5      nU(       d  [        S	5      eg! [        R                   a  n[        R                  " S5      nUR                  U[        R                  R                  5      (       a  [        S5      Ue[        R                  " S5      nUR                  U[        R                  R                  5      (       a  [        S5      Uee SnAff = f)
z,Set password for the username of the servicer   zPassword for 'z' on ''Nr6   z Failed to unlock the collection!r4   zFailed to store password!)r   r7   r   password_store_syncr   r$   r   r.   r;   r<   rA   r   r   r=   r>   r
   )	r   rB   rC   passwordrD   labelstoredr0   rF   s	            r   set_passwordKeyring.set_passwordS   s    [[

[K
 
&	;	//Z%4F "#>??  zz 	)).9E}}UFLL$:$:;;#$FGUR))*<=E}}UCOO$:$:;;#$FGUR	s   -A% %D!9B#DD!c                    U R                  XU R                  S9n [        R                  " U R                  U[        R
                  R                  S5      nU H6  n [        R                  " U R                  UR!                  5       S5      nUs  $    [%        S5      e! [        R                   aW  n[        R                  " S5      nUR                  U[        R                  R                  5      (       a  [        S5      Uee SnAff = f! [        R                   aW  n[        R                  " S5      nUR                  U[        R                  R"                  5      (       a  [        S5      Uee SnAff = f)z/Delete the stored password (only the first one)r   Nr4   r5   r6   zNo such password!)r   r7   r   r8   r   r9   r:   r   r.   r;   r<   r   r=   r>   r   password_clear_syncget_attributesrA   r	   )	r   rB   rC   rD   rE   r0   rF   rG   removeds	            r   delete_passwordKeyring.delete_passwordf   s4   [[

[K
	//Z););)B)BDE D 44KK!4!4!6 N  ""566! zz 	))*<=E}}UCOO$:$:;;#$@AuL		 :: --n===(>(>??'(DE5P	s1   ;B 0DD	2ADD	E7 AE22E7c                    U R                  X5      n [        R                  " U R                  U[        R                  R
                  S5      nU HJ  nUR                  5       R                  S5      n [!        X'R#                  5       R%                  5       5      s  $    g! [        R                   aW  n[        R                  " S5      nUR                  U[        R                  R                  5      (       a  [        S5      Uee SnAff = f! [        R                   aW  n[        R                  " S5      nUR                  U[        R                  R&                  5      (       a  [        S5      Uee SnAff = f)a/  Get the first username and password for a service.
Return a Credential instance

The username can be omitted, but if there is one, it will use get_password
and return a SimpleCredential containing  the username and password
Otherwise, it will return the first username and password combo that it finds.
Nr4   r5   rC   r6   )r   r   r8   r   r9   r:   r   r.   r;   r<   r   r=   r>   r   rT   getr   r?   r@   rA   )r   rB   rC   queryrE   r0   rF   rG   s           r   get_credentialKeyring.get_credential   s0    G.	//UF$6$6$=$=tE D**,00<H'779BBD   zz 	))*<=E}}UCOO$:$:;;#$@AuL		 :: --n===(>(>??'(DE5P	s1   ;B 3&DD
3ADD
E8!AE33E8 N)__name__
__module____qualname____firstlineno____doc__r7   propertyr   r   NonDataPropertyr$   classpropertyfloatr1   rH   rP   rV   r[   __static_attributes__r]   r!   r   r   r      sl    $E	
 	
 )  ) 
 
 
*@&72r!   r   )logging r   r   compatr   credentialsr   errorsr   r	   r
   r(   gigi.repositoryr   r   require_versionr   AttributeErrorImportError
ValueError	getLoggerr^   logSchemeSelectabler   r]   r!   r   <module>rv      s      $  *  			'x%$I !g&&  	Z0 		s   'A: :	BB