
    k7i                         S r SSKJr  SSKJrJrJr  SSKJr  SSK	J
r
  SSKJr  SSKJrJr  SSKJrJrJrJrJr  \
S	-   r " S
 S	5      rg)aQ  SecretStorage item contains a *secret*, some *attributes* and a
*label* visible to user. Editing all these properties and reading the
secret is possible only when the :doc:`collection <collection>` storing
the item is unlocked. The collection can be unlocked using collection's
:meth:`~secretstorage.collection.Collection.unlock` method.    )default_backend)Cipher
algorithmsmodes)DBusConnection)	SS_PREFIX)Session)LockedExceptionPromptDismissedException)DBusAddressWrapperexec_promptformat_secretopen_sessionunlock_objectsItemc            	       D   \ rS rSrSr S S\S\S\S-  SS4S jjrS	S
S\	4S jr
S\	4S jrS!S jrS S\S-  S\	4S jjrS\\\4   4S jrS\\\4   SS4S jrS\4S jrS\SS4S jrS!S jrS\4S jrS\4S jr S"S\S\SS4S jjrS\4S jrS\4S jrS\4S jrSrg)#r      zRepresents a secret item.N
connection	item_pathsessionreturnc                     X l         [        U[        U5      U l        U R                  R	                  S5        X0l        Xl        g )NLabel)r   r   
ITEM_IFACE_itemget_propertyr   r   )selfr   r   r   s       L/home/james-whalen/.local/lib/python3.13/site-packages/secretstorage/item.py__init__Item.__init__!   s3    "'	:zJ


($    otherr   c                 v    [        UR                  [        5      (       d   eU R                  UR                  :H  $ N)
isinstancer   str)r   r"   s     r   __eq__Item.__eq__)   s,    %//3////~~00r!   c                 J    [        U R                  R                  S5      5      $ )zBReturns :const:`True` if item is locked, otherwise
:const:`False`.Locked)boolr   r   r   s    r   	is_lockedItem.is_locked-   s     DJJ++H566r!   c                 D    U R                  5       (       a  [        S5      eg)zQIf collection is locked, raises
:exc:`~secretstorage.exceptions.LockedException`.zItem is locked!N)r-   r
   r,   s    r   ensure_not_lockedItem.ensure_not_locked2   s"     >>!"344 r!   timeoutc                 B    [        U R                  U R                  /US9$ )a#  Requests unlocking the item. Usually, this means that the
whole collection containing this item will be unlocked.

Returns a boolean representing whether the prompt has been
dismissed; that means :const:`False` on successful unlocking
and :const:`True` if it has been dismissed.

:raises: ``TimeoutError`` if `timeout` (in seconds) passed
   and the prompt was neither accepted nor dismissed.

.. versionadded:: 2.1.2

.. versionchanged:: 3.0
   No longer accepts the ``callback`` argument.

.. versionchanged:: 3.5
   Added ``timeout`` argument.
)r2   )r   r   r   )r   r2   s     r   unlockItem.unlock8   s    & doo/?QQr!   c                 N    U R                   R                  S5      n[        U5      $ )z%Returns item attributes (dictionary).
Attributes)r   r   dict)r   attrss     r   get_attributesItem.get_attributesM   s     

''5E{r!   
attributesc                 >    U R                   R                  SSU5        g)z2Sets item attributes to `attributes` (dictionary).r7   za{ss}N)r   set_property)r   r<   s     r   set_attributesItem.set_attributesR   s    

gzBr!   c                 j    U R                   R                  S5      n[        U[        5      (       d   eU$ )z$Returns item label (unicode string).r   )r   r   r%   r&   r   labels     r   	get_labelItem.get_labelV   s.    

''0%%%%%r!   rC   c                 ^    U R                  5         U R                  R                  SSU5        g)zSets item label to `label`.r   sN)r0   r   r>   rB   s     r   	set_labelItem.set_label\   s$     

e4r!   c                     U R                  5         U R                  R                  SS5      u  nUS:w  a+  [        U R                  U5      u  p#U(       a  [        S5      egg)zDeletes the item.Delete /zPrompt dismissed.N)r0   r   callr   r   r   )r   prompt	dismissed_results       r   deleteItem.deletea   sW     **//(B/S=!,T__f!EI./BCC  r!   c                    U R                  5         U R                  (       d  [        U R                  5      U l        U R                  R                  SSU R                  R                  5      u  nU R                  R                  (       d  [        US   5      $ U R                  R                  c   e[        R                  " U R                  R                  5      n[        US   5      n[        U[        R                  " U5      [        5       5      R!                  5       nUS   nUR#                  [        U5      5      UR%                  5       -   n['        U[        5      (       d   eUSUS   *  $ )z!Returns item secret (bytestring).	GetSecreto   N   )r0   r   r   r   r   rN   object_path	encryptedbytesaes_keyr   AESr   r   CBCr   	decryptorupdatefinalizer%   )r   secretaesaes_ivr`   encrypted_secretpadded_secrets          r   
get_secretItem.get_secretj   s    ||'8DL**//+sDLL4L4LM||%%##||##///nnT\\112vay!3		& 1?3DEOOQ	!!9!((/?)@AIDVDVDXX-////0}R0011r!   c                     U R                  5         U R                  (       d  [        U R                  5      U l        U R                  R                  SSU R                  R                  5      u  n[        US   5      $ )z-Returns content type of item secret (string).rU   rV      )r0   r   r   r   r   rN   rZ   r&   )r   rc   s     r   get_secret_content_typeItem.get_secret_content_type{   sU     ||'8DL**//+sDLL4L4LM6!9~r!   rc   content_typec                     U R                  5         U R                  (       d  [        U R                  5      U l        [	        U R                  X5      nU R
                  R                  SSU5        g)zSets item secret to `secret`. If `content_type` is given,
also sets the content type of the secret (``text/plain`` by
default).	SetSecretz(oayays)N)r0   r   r   r   r   r   rN   )r   rc   rn   _secrets       r   
set_secretItem.set_secret   sK    
 	 ||'8DLfC

Z9r!   c                 j    U R                   R                  S5      n[        U[        5      (       d   eU$ )zhReturns UNIX timestamp (integer) representing the time
when the item was created.

.. versionadded:: 1.1Createdr   r   r%   int)r   createds     r   get_createdItem.get_created   s0    
 **)))4'3''''r!   c                 j    U R                   R                  S5      n[        U[        5      (       d   eU$ )zWReturns UNIX timestamp (integer) representing the time
when the item was last modified.Modifiedrv   )r   modifieds     r   get_modifiedItem.get_modified   s0     ::**:6(C((((r!   c                 H    SU R                  5       < SU R                  < S3$ )Nz<Item z path=>)rD   r   r,   s    r   __repr__Item.__repr__   s$    (+6$..1C1EEr!   )r   r   r   r   r$   )r   N)z
text/plain)__name__
__module____qualname____firstlineno____doc__r   r&   r	   r   r+   r'   r-   r0   floatr4   r8   r:   r?   rD   rH   rR   r\   rh   rl   rr   rw   ry   r~   r   __static_attributes__ r!   r   r   r      s(   # <@%> %%*1D.%DH%1, 1 174 7
5Redl Rd R*S#X 
Cc3h CD C3 5s 5t 5
D2E 2"  (4	: 	:!$	:8<	:S c F# Fr!   N)r   cryptography.hazmat.backendsr   &cryptography.hazmat.primitives.ciphersr   r   r   jeepney.io.blockingr   secretstorage.definesr   secretstorage.dhcryptor	   secretstorage.exceptionsr
   r   secretstorage.utilr   r   r   r   r   r   r   r   r!   r   <module>r      sE   ? 9 L L . + * N  
AF AFr!   