Roshani's KDE & GSoC Blog

Week 4 Update: KeepSecret Import/Export Feature Completed

This week, the import/export feature for KeepSecret was completed and merged in !33.

The implementation went through several changes before reaching its final form. My initial approach was to use a KWalletManager-compatible XML format so that data could be exchanged directly between the two applications. To match KWalletManager's structure exactly, I referenced kwalleteditor.cpp from the KWalletManager repository and implemented support for elements.

The final format now preserves all item information:

-Secrets are Base64-encoded and decoded from raw bytes, avoiding UTF-8 conversions.

-ContentType is preserved per the Secret Service specification.

-Attributes are exported exactly as stored.

-Files use the .keepsecret extension instead of .xml.

My first version queried libsecret directly during export. After review, I changed it to use the data already stored in m_items when a wallet is opened, making the code simpler, cleaner, and consistent with the rest of the model.

There was also a small but important UI change. Initially, the Import and Export actions were placed in the application's global drawer. During review, Marco Martin noted that these operations belong to a specific wallet rather than the application as a whole. Following that feedback, the actions were moved to the wallet page itself and integrated into the ActionCollection system, alongside actions such as Lock and Delete Wallet.

The next step is a follow-up merge request that adds support for importing the legacy KWalletManager XML format. This will make migration from KWallet to KeepSecret much smoother for existing users. The merge request!34 is open and under review.