Documentation
¶
Index ¶
- type Conn
- type ObjectPath
- type Provider
- type Secret
- type SecretService
- func (svc *SecretService) Close(session *busObject) error
- func (svc *SecretService) CloseConn()
- func (svc *SecretService) CreateItem(collection *busObject, label string, attributes map[string]string, ...) error
- func (svc *SecretService) Delete(itemPath ObjectPath) error
- func (svc *SecretService) GetLoginCollection() *busObject
- func (svc *SecretService) GetSecret(itemPath, session ObjectPath) (*Secret, error)
- func (svc *SecretService) OpenSession() (*busObject, error)
- func (svc *SecretService) SearchItems(collection *busObject, search map[string]string) ([]ObjectPath, error)
- func (svc *SecretService) Unlock(path ObjectPath) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ObjectPath ¶
type ObjectPath = dbus.ObjectPath
ObjectPath is the D-Bus object path type, aliased so this package's callers need not import tinywasm/dbus directly.
type Secret ¶
type Secret struct {
Session ObjectPath
Parameters []byte
Value []byte
ContentType string
}
Secret is the org.freedesktop.Secret.Item secret structure. Its D-Bus signature is (oayays) and the field order is part of the wire format — do not reorder.
func NewSecret ¶
func NewSecret(session ObjectPath, secret string) Secret
NewSecret initializes a Secret for a plain (unencrypted) session.
type SecretService ¶
type SecretService struct {
*Conn
// contains filtered or unexported fields
}
SecretService is a client of the org.freedesktop.secrets D-Bus API.
func NewSecretService ¶
func NewSecretService() (*SecretService, error)
NewSecretService opens its own connection to the session bus.
func NewSecretServiceOnConn ¶
func NewSecretServiceOnConn(conn *Conn) *SecretService
NewSecretServiceOnConn reuses an existing connection. Tests inject a connection to a fake bus through it.
func (*SecretService) Close ¶
func (svc *SecretService) Close(session *busObject) error
Close closes a session opened with OpenSession. Sessions accumulate in the daemon for the life of the process if this is skipped.
func (*SecretService) CloseConn ¶
func (svc *SecretService) CloseConn()
CloseConn closes the underlying bus connection.
func (*SecretService) CreateItem ¶
func (svc *SecretService) CreateItem(collection *busObject, label string, attributes map[string]string, secret Secret) error
CreateItem stores a secret in a collection under the given attributes.
func (*SecretService) Delete ¶
func (svc *SecretService) Delete(itemPath ObjectPath) error
Delete removes an item from its collection.
func (*SecretService) GetLoginCollection ¶
func (svc *SecretService) GetLoginCollection() *busObject
GetLoginCollection returns the collection secrets are stored in.
It prefers the literal /collection/login path and falls back to the default alias. Both forms are needed: distributions differ, and each one alone fails on some of them.
func (*SecretService) GetSecret ¶
func (svc *SecretService) GetSecret(itemPath, session ObjectPath) (*Secret, error)
GetSecret reads an item's secret within an open session.
func (*SecretService) OpenSession ¶
func (svc *SecretService) OpenSession() (*busObject, error)
OpenSession opens a plain (unencrypted) secret service session.
func (*SecretService) SearchItems ¶
func (svc *SecretService) SearchItems(collection *busObject, search map[string]string) ([]ObjectPath, error)
SearchItems returns the item paths in collection matching every attribute in search.
func (*SecretService) Unlock ¶
func (svc *SecretService) Unlock(path ObjectPath) error
Unlock unlocks a collection or an individual item, driving the prompt the daemon returns when the keyring is locked.