%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python3/dist-packages/secretstorage/__pycache__/
Upload File :
Create Path :
Current File : //usr/lib/python3/dist-packages/secretstorage/__pycache__/item.cpython-312.pyc

�

��b����dZddlmZmZddlmZddlmZddlm	Z	ddl
mZmZddl
mZmZmZmZmZddlmZmZmZdd	lmZed
zZGd�d
�Zy)
aQSecretStorage 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.�)�Dict�Optional)�DBusConnection)�	SS_PREFIX)�Session)�LockedException�PromptDismissedException)�DBusAddressWrapper�exec_prompt�open_session�
format_secret�unlock_objects)�Cipher�
algorithms�modes)�default_backend�Itemc	��eZdZdZ	ddededeeddfd�Zdd	de	fd
�Z
de	fd�Zdd�Zde	fd
�Z
deeeffd�Zdeeefddfd�Zdefd�Zdeddfd�Zdd�Zdefd�Zdefd�Z	ddededdfd�Zdefd�Zdefd�Zy)rzRepresents a secret item.N�
connection�	item_path�session�returnc��||_t|t|�|_|jj	d�||_||_y)N�Label)rr
�
ITEM_IFACE�_item�get_propertyrr)�selfrrrs    �4/usr/lib/python3/dist-packages/secretstorage/item.py�__init__z
Item.__init__s9��"���'�	�:�z�J��
��
�
����(����$����otherrc�l�t|jt�sJ�|j|jk(S�N)�
isinstancer�str)rr"s  r�__eq__zItem.__eq__$s)���%�/�/�3�/�/�/��~�~����0�0r!c�J�t|jjd��S)zJReturns :const:`True` if item is locked, otherwise
        :const:`False`.�Locked)�boolrr�rs r�	is_lockedzItem.is_locked(s���D�J�J�+�+�H�5�6�6r!c�:�|j�rtd��y)zYIf collection is locked, raises
        :exc:`~secretstorage.exceptions.LockedException`.zItem is locked!N)r,rr+s r�ensure_not_lockedzItem.ensure_not_locked-s���>�>��!�"3�4�4�r!c�D�t|j|jg�S)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.

        .. versionadded:: 2.1.2

        .. versionchanged:: 3.0
           No longer accepts the ``callback`` argument.
        )rrrr+s r�unlockzItem.unlock3s���d�o�o����/?�@�@r!c�N�|jjd�}t|�S)z%Returns item attributes (dictionary).�
Attributes)rr�dict)r�attrss  r�get_attributeszItem.get_attributesBs ���
�
�'�'��5���E�{�r!�
attributesc�>�|jjdd|�y)z2Sets item attributes to `attributes` (dictionary).r2za{ss}N)r�set_property)rr6s  r�set_attributeszItem.set_attributesGs���
�
����g�z�Br!c�`�|jjd�}t|t�sJ�|S)z$Returns item label (unicode string).r)rrr%r&�r�labels  r�	get_labelzItem.get_labelKs+���
�
�'�'��0���%��%�%�%��r!r<c�^�|j�|jjdd|�y)zSets item label to `label`.r�sN)r.rr8r;s  r�	set_labelzItem.set_labelQs$����� ��
�
�����e�4r!c��|j�|jjdd�\}|dk7r't|j|�\}}|rtd��yy)zDeletes the item.�Delete��/zPrompt dismissed.N)r.r�callrrr	)r�prompt�	dismissed�_results    r�deletezItem.deleteVsY����� ��*�*�/�/�(�B�/����S�=�!,�T�_�_�f�!E��I�w��.�/B�C�C��r!c��|j�|jst|j�|_|jjdd|jj�\}|jjst|d�S|jj�J�tj|jj�}t|d�}t|tj|�t��j!�}|d}|j#t|��|j%�z}t'|t�sJ�|d|dS)z!Returns item secret (bytestring).�	GetSecret�o�N����)r.rrrrrE�object_path�	encrypted�bytes�aes_keyr�AESrr�CBCr�	decryptor�update�finalizer%)r�secret�aes�aes_ivrV�encrypted_secret�
padded_secrets       r�
get_secretzItem.get_secret_s����� ��|�|�'����8�D�L��*�*�/�/�+�s�D�L�L�4L�4L�M����|�|�%�%�����#�#��|�|�#�#�/�/�/��n�n�T�\�\�1�1�2���v�a�y�!���3��	�	�&� 1�?�3D�E�O�O�Q�	�!�!�9��!�(�(��/?�)@�A�I�DV�DV�DX�X�
��-��/�/�/��0�}�R�0�0�1�1r!c���|j�|jst|j�|_|jjdd|jj�\}t|d�S)z-Returns content type of item secret (string).rKrL�)r.rrrrrErPr&)rrYs  r�get_secret_content_typezItem.get_secret_content_typepsU����� ��|�|�'����8�D�L��*�*�/�/�+�s�D�L�L�4L�4L�M����6�!�9�~�r!rY�content_typec���|j�|jst|j�|_t	|j||�}|j
j
dd|�y)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)r.rrrr
rrE)rrYrb�_secrets    r�
set_secretzItem.set_secretxsM��
	
��� ��|�|�'����8�D�L�����f�l�C���
�
����Z��9r!c�`�|jjd�}t|t�sJ�|S)zxReturns UNIX timestamp (integer) representing the time
        when the item was created.

        .. versionadded:: 1.1�Created�rrr%�int)r�createds  r�get_createdzItem.get_created�s-��
�*�*�)�)�)�4���'�3�'�'�'��r!c�`�|jjd�}t|t�sJ�|S)z_Returns UNIX timestamp (integer) representing the time
        when the item was last modified.�Modifiedri)r�modifieds  r�get_modifiedzItem.get_modified�s-���:�:�*�*�:�6���(�C�(�(�(��r!r$)rN)z
text/plain)�__name__�
__module__�__qualname__�__doc__rr&rrr r*r'r,r.r0rr5r9r=r@rIrRr^rarfrjrlrp�r!rrrs��#�?C�%�>�%��%�*2�7�*;�%�GK�%�1�,�1��1�7�4�7�
5�
A��
A���S�#�X���
C��c�3�h��C�D�C��3��5�s�5�t�5�
D�2�E�2�"���(4�	:��	:�!$�	:�8<�	:��S���c�r!N)rt�typingrr�jeepney.io.blockingr�secretstorage.definesr�secretstorage.dhcryptor�secretstorage.exceptionsrr	�secretstorage.utilr
rrr
r�&cryptography.hazmat.primitives.ciphersrrr�cryptography.hazmat.backendsrrrrur!r�<module>r~sD��?�"�.�+�*�N�:�:�L�L�8�
��
�
�x�xr!

Zerion Mini Shell 1.0