SecretStorage
SecretStorage is a Python library that provides secure storage for passwords and other secrets using the FreeDesktop.org Secret Service API. The current version is 3.5.0, released on November 23, 2025. It requires Python 3.10 or higher and has a stable release cadence with regular updates addressing security and functionality improvements.
Warnings
- breaking Python 3.10 or higher is required starting from version 3.4.0
- deprecated The int_to_bytes() function was removed in version 3.5.0
Install
-
pip install SecretStorage
Imports
- Collection
from secretstorage.collection import Collection
- Item
from secretstorage.item import Item
- SecretStorageException
from secretstorage.exceptions import SecretStorageException
Quickstart
import secretstorage
# Initialize D-Bus connection
connection = secretstorage.dbus_init()
# Access the default collection
collection = secretstorage.get_default_collection(connection)
# Create a new item
attributes = {'application': 'myapp'}
item = collection.create_item('My Secret Item', attributes, b'mysecretpassword')
# Retrieve the secret
secret = item.get_secret()
print(secret.decode())