HenriWahl/Nagstamon — pull request #67 by martin-css (2014-03-25 11:41:57+00:00)
Title: Secure Password Storage Example

As per [issue 66](https://github.com/HenriWahl/Nagstamon/issues/66).

Below is a working example of the changes I made to implement secure password storage. The changes have been tidied up to not be such a nasty hack.

The keyring_available flag is set if the keyring module is available for import on the user's system AND a suitable default implementation for secure storage of credentials exists.

The main load & save server config sections have been modified to use the keyring module for secure password storage if available (ensuring an empty string is written to the config file for the password). If the module is not available then the current obfuscation implementation will be used. If the user does not enable the save password option then nothing will be stored using either method.

Note the or "" one line 326 is necessary for Nagstamon to handle the case where the keyring should be used but no password has yet been saved to the user's credential store. As a matter of personal preference I've disabled storage of empty password values to the keyring.