How to use secrets manager?

I’ve recently returned to Sailfish OS and am trying to get back to development. Currently I’m trying to start using secrets manager but I can’t seem to get it working at all.

From what I found I need to add sailfishsecrets to PKGCONFIG but when I do that, I get this error:

Project ERROR: sailfishsecrets development package not found

Any help to get it working? Thanks.

Well, the error message states that you don’t have the sailfishsecrets development package installed in your target.

What’s missing is BuildRequires: pkgconfig(sailfishsecrets) in your .spec file. Or, if you prefer yaml, - sailfishsecrets in the PkgConfigBR section of the .yaml file.

1 Like

Thanks, that worked! Now I get this error when deploying to emulator:

Unable to connect to secrets daemon: QDBusError("org.freedesktop.DBus.Error.FileNotFound", "Failed to connect to socket /run/user/100000/sailfishsecretsd/p2pSocket: No such file or directory") 1 "org.freedesktop.DBus.Error.FileNotFound"

Any idea how to run the daemon on the emulator?

The same way you run it on a device :wink:

You should have Requires: sailfishsecretsdaemon on your spec file. That way, when you deploy your app on the emulator, it will pull the daemon in with it. If I remember correctly, there’s still the issue that the daemon doesn’t start immediately after installing it, so you might need to restart the emulator after installation.

Thanks again! Is there any place where I can find documentation for this? I can’t find anything regarding this topic.

I’m afraid there isn’t. Someone should write that documentation. We do have Secrets and Crypto | Sailfish OS Documentation though, so it’s just one PR away. Another possibility would be adding it to the API documentation, which is currently only published as part of the SDK.

It seems to not want to work with me… Now I get this error:

No such encrypted storage plugin exists: org.sailfishos.secrets.plugin.encryptedstorage.sqlcipher

Is it just because of the emulator? I used Sailfish::Secrets::SecretManager::DefaultEncryptedStoragePluginName not the name directly.

Try adding Requires: sailfishsecretsdaemon-secretsplugins-default in the spec.

We really shoud write the documentation for this stuff :frowning:

Sadly the same error :confused:

@vige Do you have any other ideas what could help?

Not really. It would help if you could share the source code of your project so I could try it myself.