accessing D-Bus Secret Service API from a snap?

Mark Shuttleworth mark at ubuntu.com
Fri Jun 17 17:55:44 UTC 2016


On 17/06/16 18:42, Bill Janssen wrote:
> My application stores access credentials in the Secret Service.  How do
> I enable access to this?  Presumably this would be a plug or an
> interface (still confused on the distinction between the two of them).
> Or should I just install dbus-python into my Anaconda Python in my snap,
> and use it?
>

An "interface" is the name for a "type of connection". Think of it as a
class or a type.

The plug/slot are the consumer/provider, and they have names on both sides.

Here's a (semi-hypothetical) example. An interface "disk" might be
defined that is a way for a snap to claim a disk.

Now the core snap could say it offers a 'disk interface' called
'directly-attached'. So that's a slot on the core snap called
'directly-attached' of type 'disk'.

But you could also have a snap which is a client for an EMC SAN. That
would have a slot called, say 'san' of type 'disk'.

When you install the EMC snap on the system, there are thus two *slots*
of interface 'disk', one that serves up directly attached disks on the
machine, the other that serves up remote SAN disks.

Now, imagine you have a snap which uses a disk. It would have a *plug*
of the 'disk' interface (type), let's call it 'volume'. When you install
the snap, you can 'connect the volume plug to the core:directly-attached
or emc:san slot'

Does this make sense? This is one of the many capabilities that really
distinguish snappy from the things that have gone before. AppImage for
example is an excellent desktop application container, but it wouldn't
handle this sort of use case.

snapd has heuistics for which of these plugs and slots can be
auto-connected. For example, when you install a desktop app you are
probably automatically connecting a "home" plug/slot/interface which
gives that app access to most of your home directory but NOT access to
things like ~/.ssh/

Was that useful?

Mark





More information about the Snapcraft mailing list