SecretStorage

3.5.0 · active · verified Sat Mar 28

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

Install

Imports

Quickstart

This script demonstrates how to initialize a D-Bus connection, access the default collection, create a new secret item, and retrieve its secret using the SecretStorage library.

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())

view raw JSON →