linux

package
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 17, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conn

type Conn = dbus.Conn

Conn is a session bus connection.

func SessionBus

func SessionBus() (*Conn, error)

SessionBus dials the session bus.

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 Provider

type Provider struct {
	// contains filtered or unexported fields
}

func New

func New() *Provider

func NewOnConn

func NewOnConn(conn *Conn) *Provider

func (*Provider) Delete

func (p *Provider) Delete(service, user string) error

func (*Provider) DeleteAll

func (p *Provider) DeleteAll(service string) error

func (*Provider) Ensure

func (p *Provider) Ensure(log func(...any)) error

func (*Provider) Get

func (p *Provider) Get(service, user string) (string, error)

func (*Provider) Set

func (p *Provider) Set(service, user, password string) error

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL