Documentation
¶
Overview ¶
Package client is a Secret Service client for lys components that keep a secret of their own in the user's keyring, such as the portal's per-app master secrets. It works against any provider on the bus (lys-secrets or gnome-keyring), over a plain session: the secret never leaves the user's own bus.
Index ¶
- Constants
- Variables
- type Client
- func (c *Client) ChangeLock(ctx context.Context, coll dbus.ObjectPath) error
- func (c *Client) Close()
- func (c *Client) Collections(ctx context.Context) ([]Collection, error)
- func (c *Client) Delete(ctx context.Context, attrs map[string]string) error
- func (c *Client) DeleteItem(ctx context.Context, item dbus.ObjectPath) error
- func (c *Client) Describe(ctx context.Context, items []dbus.ObjectPath) ([]Item, error)
- func (c *Client) Find(ctx context.Context, attrs map[string]string) (value []byte, found bool, err error)
- func (c *Client) Lock(ctx context.Context, objects []dbus.ObjectPath) error
- func (c *Client) Lookup(ctx context.Context, attrs map[string]string) (value []byte, found bool, err error)
- func (c *Client) Search(ctx context.Context, coll dbus.ObjectPath) ([]dbus.ObjectPath, error)
- func (c *Client) Secret(ctx context.Context, item dbus.ObjectPath) ([]byte, error)
- func (c *Client) SetLabel(ctx context.Context, item dbus.ObjectPath, label string) error
- func (c *Client) SetSecret(ctx context.Context, item dbus.ObjectPath, value []byte, contentType string) error
- func (c *Client) Store(ctx context.Context, label string, attrs map[string]string, value []byte) error
- func (c *Client) StoreLogin(ctx context.Context, label string, attrs map[string]string, value []byte) error
- func (c *Client) Unlock(ctx context.Context, objects []dbus.ObjectPath) error
- func (c *Client) WatchItems(ctx context.Context, coll dbus.ObjectPath, changed func(), failed func(error)) (*dbusx.Watch, error)
- type Collection
- type Item
- type Keychain
Constants ¶
const LoginCollection = dbus.ObjectPath("/org/freedesktop/secrets/collection/login")
LoginCollection is the collection the login password opens, under lys-secrets and gnome-keyring alike.
Variables ¶
var ErrDismissed = errors.New("secrets: the prompt was dismissed")
ErrDismissed is the user (or the client) dismissing a prompt.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is one plain session with the Secret Service.
func OpenEncrypted ¶
OpenEncrypted starts a DH session, so secrets cross the bus encrypted under a key only this client and the provider hold.
func (*Client) ChangeLock ¶
ChangeLock asks the provider for a new password for coll through its prompt (lys-secrets' extension of the service).
func (*Client) Collections ¶
func (c *Client) Collections(ctx context.Context) ([]Collection, error)
Collections is every collection the provider serves.
func (*Client) DeleteItem ¶
DeleteItem deletes the item, through a prompt when the provider asks.
func (*Client) Describe ¶
Describe is the items' labels, attributes, times and lock state, their GetAll calls sent together and collected after.
func (*Client) Find ¶
func (c *Client) Find(ctx context.Context, attrs map[string]string) (value []byte, found bool, err error)
Find finds the first unlocked item holding attrs and returns its secret, asking nothing; found is false when no unlocked item matches.
func (*Client) Lookup ¶
func (c *Client) Lookup(ctx context.Context, attrs map[string]string) (value []byte, found bool, err error)
Lookup finds the first item holding attrs and returns its secret, unlocking its collection through a prompt when it is locked. found is false when no item matches.
func (*Client) Search ¶
func (c *Client) Search(ctx context.Context, coll dbus.ObjectPath) ([]dbus.ObjectPath, error)
Search is every item of coll, locked or not.
func (*Client) Secret ¶
Secret is the item's secret, its collection unlocked through the provider's prompt when needed. The caller owns the returned bytes and should clear them when done.
func (*Client) SetSecret ¶
func (c *Client) SetSecret(ctx context.Context, item dbus.ObjectPath, value []byte, contentType string) error
SetSecret replaces the item's secret.
func (*Client) Store ¶
func (c *Client) Store(ctx context.Context, label string, attrs map[string]string, value []byte) error
Store saves value under attrs in the default collection, replacing an item with the same attributes; a missing default collection is created through the provider's prompt.
func (*Client) StoreLogin ¶
func (c *Client) StoreLogin(ctx context.Context, label string, attrs map[string]string, value []byte) error
StoreLogin saves value under attrs in the login collection, replacing an item with the same attributes, unlocking it through a prompt when it is locked.
func (*Client) Unlock ¶
Unlock unlocks objects (collections or items) through the provider's prompt when it needs one.
func (*Client) WatchItems ¶
func (c *Client) WatchItems(ctx context.Context, coll dbus.ObjectPath, changed func(), failed func(error)) (*dbusx.Watch, error)
WatchItems runs changed, on the watch's goroutine, on every item created, changed or deleted in coll that the provider owning the Secret Service's name announces, until ctx ends or the watch is stopped. failed is told, on the same goroutine, of such an announcement that did not decode.
type Collection ¶
type Collection struct {
Path dbus.ObjectPath
Label string
Locked bool
}
Collection is one collection and whether it is locked.
type Item ¶
type Item struct {
Path dbus.ObjectPath
Label string
Attributes map[string]string
Created, Modified uint64
Locked bool
}
Item is one item as the provider describes it, its secret aside.