[SailfishDevel] Secure storage for login data

Caliste Damien dcaliste at free.fr
Thu Jun 13 18:40:24 UTC 2019


Hello,

Chris Adams was quicker than me to provide an example. Thanks Chris for
this comprehensive and commented code.

I may add some more words and comment another example:
https://github.com/sailfishos/sailfish-secrets/plugins/gnupgplugin/pinentry/qassuanserver.cpp

This is the implementation of a pinentry for GnuPG and it can store the
provided passphrase to avoid typing it each time.

To enter Sailfish Secrets, it is important to know that you're relying
on plugins to actually store the data. There is a default encrypted
sqlite storage, see:
 Sailfish::Secrets::SecretManager::DefaultEncryptedStoragePluginName

Everything is asynchronous. To dialog with the daemon, you need to
instanciate a SecretManager and provide requests to it, to store or to
read a secret data.

The secret data will be stored in a collection that is defined by a
name. You need to ensure that the collection exists, see
ensureCacheCollection() in qassuanserver.cpp

You can store a secret with a Sailfish::Secrets::StoreSecretRequest and
read it with a Sailfish::Secrets::StoredSecretRequest, see
requestPassphrase() in qassuanserver.cpp. This routine is asking for a
passphrase, but before doing it it is reading the secret cache to see
if the passphrase has been stored already or not.

Last but not least, compile sailfish secret in SDK, it will generate a
HTML documentation that is quite extensive.

As Chris said, this is open source, and you're encourage to open bugs
in Github or give feedback about API, doc...

Don't hesitate to ask if you need more specific help.

Regards,

Damien.


More information about the Devel mailing list