The secretstorage.item
module¶
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 collection storing
the item is unlocked. The collection can be unlocked using collection’s
unlock()
method.
- class secretstorage.item.Item(connection: DBusConnection, item_path: str, session: Session | None = None)[source]¶
Represents a secret item.
- ensure_not_locked() None [source]¶
If collection is locked, raises
LockedException
.
- get_created() int [source]¶
Returns UNIX timestamp (integer) representing the time when the item was created.
New in version 1.1.
- get_modified() int [source]¶
Returns UNIX timestamp (integer) representing the time when the item was last modified.
- set_attributes(attributes: dict[str, str]) None [source]¶
Sets item attributes to attributes (dictionary).
- set_secret(secret: bytes, content_type: str = 'text/plain') None [source]¶
Sets item secret to secret. If content_type is given, also sets the content type of the secret (
text/plain
by default).
- unlock() bool [source]¶
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
False
on successful unlocking andTrue
if it has been dismissed.New in version 2.1.2.
Changed in version 3.0: No longer accepts the
callback
argument.