dbus

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: May 14, 2026 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Overview

Package dbus implements the FreeDesktop Secret Service API. Spec: https://specifications.freedesktop.org/secret-service-spec/latest/

Package dbus implements the FreeDesktop Secret Service API. Spec: https://specifications.freedesktop.org/secret-service-spec/latest/

Package dbus implements the FreeDesktop Secret Service API. Spec: https://specifications.freedesktop.org/secret-service-spec/latest/

Package dbus provides D-Bus to Knox bridge implementation.

Package dbus implements the FreeDesktop Secret Service API. Spec: https://specifications.freedesktop.org/secret-service-spec/latest/

Package dbus implements the FreeDesktop Secret Service API. Spec: https://specifications.freedesktop.org/secret-service-spec/latest/

Index

Constants

View Source
const (
	// MetadataKey is the key used to store metadata in Knox key data.
	MetadataKey = "dbus_metadata"

	// Default attributes for common use cases.
	AttributeService = "service"
	AttributeUser    = "user"
	AttributeURL     = "url"
	AttributeApp     = "application"
)

Metadata constants.

View Source
const (
	// DBus service name.
	ServiceName = "org.freedesktop.secrets"

	// Object paths.
	ServicePath      = "/org/freedesktop/secrets"
	SessionPrefix    = "/org/freedesktop/secrets/session/"
	CollectionPrefix = "/org/freedesktop/secrets/collection/"
	AliasPrefix      = "/org/freedesktop/secrets/aliases/"

	// Interface names.
	ServiceInterface    = "org.freedesktop.Secret.Service"
	CollectionInterface = "org.freedesktop.Secret.Collection"
	ItemInterface       = "org.freedesktop.Secret.Item"
	SessionInterface    = "org.freedesktop.Secret.Session"
	PromptInterface     = "org.freedesktop.Secret.Prompt"

	// Special aliases.
	DefaultCollection = "default"
	SessionCollection = "session"
)

Variables

This section is empty.

Functions

func CombineMetadataWithSecret

func CombineMetadataWithSecret(metadata *ItemMetadata, secret []byte) ([]byte, error)

CombineMetadataWithSecret combines metadata and secret into a single byte array.

func CreateDefaultAttributes

func CreateDefaultAttributes(label string) map[string]string

CreateDefaultAttributes creates default attributes from common patterns.

Types

type AuthManager

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

AuthManager manages authentication and locking for the D-Bus bridge.

func NewAuthManager

func NewAuthManager() *AuthManager

NewAuthManager creates a new authentication manager.

func (*AuthManager) Authenticate

func (am *AuthManager) Authenticate(password string) (bool, error)

Authenticate attempts to authenticate with the provided password.

func (*AuthManager) ChangePassword

func (am *AuthManager) ChangePassword(oldPassword, newPassword string) (bool, error)

ChangePassword changes the master password.

func (*AuthManager) GetStatus

func (am *AuthManager) GetStatus() (bool, bool, int)

GetStatus returns the current authentication status.

func (*AuthManager) IsLocked

func (am *AuthManager) IsLocked() bool

IsLocked returns whether the service is currently locked.

func (*AuthManager) Lock

func (am *AuthManager) Lock()

Lock immediately locks the service.

func (*AuthManager) SetAutoLockTimeout

func (am *AuthManager) SetAutoLockTimeout(timeout time.Duration)

SetAutoLockTimeout sets the auto-lock timeout duration.

func (*AuthManager) SetEnabled

func (am *AuthManager) SetEnabled(enabled bool)

SetEnabled enables or disables authentication.

func (*AuthManager) Unlock

func (am *AuthManager) Unlock(password string) (bool, error)

Unlock unlocks the service with the provided password.

func (*AuthManager) UpdateActivity

func (am *AuthManager) UpdateActivity()

UpdateActivity updates the last activity timestamp.

type AuthPromptHandler

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

AuthPromptHandler handles authentication prompts.

func NewAuthPromptHandler

func NewAuthPromptHandler(authManager *AuthManager) *AuthPromptHandler

NewAuthPromptHandler creates a new authentication prompt handler.

func (*AuthPromptHandler) GetAuthenticationPromptMessage

func (h *AuthPromptHandler) GetAuthenticationPromptMessage(operation string) string

GetAuthenticationPromptMessage returns the message for an authentication prompt.

func (*AuthPromptHandler) HandleChangePasswordPrompt

func (h *AuthPromptHandler) HandleChangePasswordPrompt(_ string) (bool, string, string, error)

HandleChangePasswordPrompt handles a change password prompt.

func (*AuthPromptHandler) HandleUnlockPrompt

func (h *AuthPromptHandler) HandleUnlockPrompt(_ string) (bool, error)

HandleUnlockPrompt handles an unlock prompt.

func (*AuthPromptHandler) IsAuthenticationRequired

func (h *AuthPromptHandler) IsAuthenticationRequired(operation string) bool

IsAuthenticationRequired checks if authentication is required for an operation.

type Bridge

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

Bridge represents the D-Bus to Knox bridge.

func NewBridge

func NewBridge(cfg *config.DBusConfig, knoxClient client.APIClient) (*Bridge, error)

NewBridge creates a new D-Bus to Knox bridge.

func (*Bridge) ChangeLock

func (b *Bridge) ChangeLock(objects []dbus.ObjectPath) ([]dbus.ObjectPath, dbus.ObjectPath, *dbus.Error)

ChangeLock changes the lock state of objects.

func (*Bridge) Close

func (b *Bridge) Close() *dbus.Error

Close closes the service and releases all resources.

func (*Bridge) CreateCollection

func (b *Bridge) CreateCollection(properties map[string]dbus.Variant, alias string) (dbus.ObjectPath, dbus.ObjectPath, *dbus.Error)

CreateCollection creates a new collection.

func (*Bridge) DeleteCollection

func (b *Bridge) DeleteCollection(collectionPath dbus.ObjectPath) *dbus.Error

DeleteCollection deletes a collection.

func (*Bridge) GetProperty

func (b *Bridge) GetProperty(interfaceName, propertyName string) (dbus.Variant, *dbus.Error)

GetProperty gets a service property.

func (*Bridge) GetSecrets

func (b *Bridge) GetSecrets(items []dbus.ObjectPath, sessionPath dbus.ObjectPath) (map[dbus.ObjectPath]Secret, *dbus.Error)

GetSecrets retrieves secrets for multiple items.

func (*Bridge) GetServiceInfo

func (b *Bridge) GetServiceInfo() (string, []string, *dbus.Error)

GetServiceInfo returns service information and capabilities.

func (*Bridge) GetServiceProperties

func (b *Bridge) GetServiceProperties() map[string]dbus.Variant

GetServiceProperties returns additional service properties including lock status.

func (*Bridge) GetSession

func (b *Bridge) GetSession(sessionPath dbus.ObjectPath) (EncryptionAlgorithm, []byte, *dbus.Error)

GetSession returns session information.

func (*Bridge) Lock

func (b *Bridge) Lock(objects []dbus.ObjectPath) ([]dbus.ObjectPath, dbus.ObjectPath, *dbus.Error)

Lock locks objects.

func (*Bridge) OpenSession

func (b *Bridge) OpenSession(algorithm string, input dbus.Variant) (dbus.Variant, dbus.ObjectPath, *dbus.Error)

OpenSession opens a new session.

func (*Bridge) ReadAlias

func (b *Bridge) ReadAlias(name string) (dbus.ObjectPath, *dbus.Error)

ReadAlias resolves an alias to a collection.

func (*Bridge) SearchCollections

func (b *Bridge) SearchCollections(attributes map[string]string) ([]dbus.ObjectPath, *dbus.Error)

SearchCollections searches for collections matching the given attributes.

func (*Bridge) SearchItems

func (b *Bridge) SearchItems(attributes map[string]string) ([]dbus.ObjectPath, []dbus.ObjectPath, *dbus.Error)

SearchItems searches all collections for items matching the given attributes.

func (*Bridge) SetAlias

func (b *Bridge) SetAlias(name string, collectionPath dbus.ObjectPath) *dbus.Error

SetAlias sets an alias for a collection.

func (*Bridge) SetProperty

func (b *Bridge) SetProperty(interfaceName, propertyName string, value dbus.Variant) *dbus.Error

SetProperty sets a service property.

func (*Bridge) Start

func (b *Bridge) Start() error

Start starts the D-Bus bridge.

func (*Bridge) Stop

func (b *Bridge) Stop() error

Stop stops the D-Bus bridge.

func (*Bridge) Unlock

func (b *Bridge) Unlock(objects []dbus.ObjectPath) ([]dbus.ObjectPath, dbus.ObjectPath, *dbus.Error)

Unlock unlocks objects.

type Collection

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

Collection represents a collection of secret items.

func NewCollection

func NewCollection(bridge *Bridge, name, label string, customPrefix ...string) *Collection

NewCollection creates a new collection.

func (*Collection) CreateItem

func (c *Collection) CreateItem(properties map[string]dbus.Variant, secret Secret, replace bool) (dbus.ObjectPath, dbus.ObjectPath, *dbus.Error)

CreateItem creates a new item in the collection.

func (*Collection) Delete

func (c *Collection) Delete() (dbus.ObjectPath, *dbus.Error)

Delete deletes the collection.

func (*Collection) DeleteAllItems

func (c *Collection) DeleteAllItems() error

DeleteAllItems deletes all items in the collection.

func (*Collection) Export

func (c *Collection) Export(conn *dbus.Conn) error

Export exports the collection to D-Bus.

func (*Collection) GetSecrets

func (c *Collection) GetSecrets(items []dbus.ObjectPath, sessionPath dbus.ObjectPath) (map[dbus.ObjectPath]Secret, *dbus.Error)

GetSecrets retrieves secrets for multiple items in this collection.

func (*Collection) Introspect

func (c *Collection) Introspect() *introspect.Node

Introspect returns XML introspection data.

func (*Collection) IsLocked

func (c *Collection) IsLocked() bool

IsLocked returns whether the collection is locked.

func (*Collection) Lock

func (c *Collection) Lock()

Lock locks the collection and all its items.

func (*Collection) Path

func (c *Collection) Path() dbus.ObjectPath

Path returns the D-Bus object path for this collection.

func (*Collection) SearchItems

func (c *Collection) SearchItems(attributes map[string]string) ([]dbus.ObjectPath, error)

SearchItems searches for items matching the given attributes.

func (*Collection) SetProperties

func (c *Collection) SetProperties(properties map[string]dbus.Variant) *dbus.Error

SetProperties sets properties on the collection.

func (*Collection) Unexport

func (c *Collection) Unexport(conn *dbus.Conn)

Unexport removes the collection from D-Bus.

func (*Collection) Unlock

func (c *Collection) Unlock()

Unlock unlocks the collection and all its items.

type DHKeyExchange

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

DHKeyExchange performs Diffie-Hellman key exchange.

func NewDHKeyExchange

func NewDHKeyExchange() (*DHKeyExchange, error)

NewDHKeyExchange creates a new DH key exchange.

func (*DHKeyExchange) ComputeSharedKey

func (dh *DHKeyExchange) ComputeSharedKey(peerPublicKeyBytes []byte) error

ComputeSharedKey computes the shared secret from the peer's public key. Implements comprehensive validation to prevent small subgroup attacks.

func (*DHKeyExchange) GetPublicKey

func (dh *DHKeyExchange) GetPublicKey() []byte

GetPublicKey returns the public key as bytes (big-endian).

func (*DHKeyExchange) GetSharedKey

func (dh *DHKeyExchange) GetSharedKey() []byte

GetSharedKey returns the derived shared key (16 bytes for AES-128).

type DefaultPromptHandler

type DefaultPromptHandler struct{}

DefaultPromptHandler is the default implementation that auto-approves prompts. This maintains backward compatibility while allowing for future enhancement.

func (*DefaultPromptHandler) ShowPrompt

func (d *DefaultPromptHandler) ShowPrompt(windowID, message string) (bool, error)

ShowPrompt implements the PromptHandler interface with auto-approval.

type EncryptionAlgorithm

type EncryptionAlgorithm string

EncryptionAlgorithm represents supported encryption algorithms.

const (
	AlgorithmPlain EncryptionAlgorithm = "plain"
	AlgorithmDHAES EncryptionAlgorithm = "dh-ietf1024-sha256-aes128-cbc-pkcs7"
)

type Item

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

Item represents a secret item in a collection.

func NewItem

func NewItem(collection *Collection, itemID, label string, attributes map[string]string) *Item

NewItem creates a new item.

func (*Item) Delete

func (i *Item) Delete() (dbus.ObjectPath, *dbus.Error)

Delete deletes the item.

func (*Item) Export

func (i *Item) Export(conn *dbus.Conn, _ *prop.Properties) error

Export exports the item to D-Bus.

func (*Item) GetAttributes

func (i *Item) GetAttributes() map[string]string

GetAttributes returns the item's attributes.

func (*Item) GetLabel

func (i *Item) GetLabel() string

GetLabel returns the item's label.

func (*Item) GetSecret

func (i *Item) GetSecret(sessionPath dbus.ObjectPath) (Secret, *dbus.Error)

GetSecret retrieves the secret value.

func (*Item) Introspect

func (i *Item) Introspect() *introspect.Node

Introspect returns XML introspection data.

func (*Item) IsLocked

func (i *Item) IsLocked() bool

IsLocked returns whether the item is locked.

func (*Item) Lock

func (i *Item) Lock()

Lock locks the item.

func (*Item) MatchesAttributes

func (i *Item) MatchesAttributes(attributes map[string]string) bool

MatchesAttributes checks if the item matches the given attributes.

func (*Item) Path

func (i *Item) Path() dbus.ObjectPath

Path returns the D-Bus object path for this item.

func (*Item) SetProperties

func (i *Item) SetProperties(properties map[string]dbus.Variant) *dbus.Error

SetProperties sets properties on the item.

func (*Item) SetSecret

func (i *Item) SetSecret(secret Secret) *dbus.Error

SetSecret sets the secret value.

func (*Item) Unexport

func (i *Item) Unexport(conn *dbus.Conn)

Unexport removes the item from D-Bus.

func (*Item) Unlock

func (i *Item) Unlock()

Unlock unlocks the item.

type ItemMetadata

type ItemMetadata struct {
	Label      string            `json:"label"`      // Human-readable label for the item
	Attributes map[string]string `json:"attributes"` // Searchable attributes
	Created    int64             `json:"created"`    // Creation timestamp (Unix seconds)
	Modified   int64             `json:"modified"`   // Last modification timestamp (Unix seconds)
	Type       string            `json:"type"`       // Item type (e.g., "password", "certificate")
	AppID      string            `json:"app_id"`     // Application that created the item
}

ItemMetadata represents metadata for D-Bus secret items.

func ExtractMetadataFromKeyData

func ExtractMetadataFromKeyData(keyData []byte) (*ItemMetadata, []byte, error)

ExtractMetadataFromKeyData extracts metadata from key data. Knox stores the actual secret data along with metadata in a structured format.

func NewItemMetadata

func NewItemMetadata(label string) *ItemMetadata

NewItemMetadata creates new metadata with default values.

func (*ItemMetadata) GetAttribute

func (m *ItemMetadata) GetAttribute(key string) string

GetAttribute returns an attribute value.

func (*ItemMetadata) HasAttribute

func (m *ItemMetadata) HasAttribute(key string) bool

HasAttribute checks if an attribute exists.

func (*ItemMetadata) Marshal

func (m *ItemMetadata) Marshal() ([]byte, error)

Marshal serializes metadata to JSON bytes.

func (*ItemMetadata) RemoveAttribute

func (m *ItemMetadata) RemoveAttribute(key string)

RemoveAttribute removes an attribute and updates modification time.

func (*ItemMetadata) SetAttribute

func (m *ItemMetadata) SetAttribute(key, value string)

SetAttribute sets an attribute and updates modification time.

func (*ItemMetadata) Unmarshal

func (m *ItemMetadata) Unmarshal(data []byte) error

Unmarshal deserializes metadata from JSON bytes.

func (*ItemMetadata) UpdateModified

func (m *ItemMetadata) UpdateModified()

UpdateModified updates the modification timestamp to current time.

type Prompt

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

Prompt represents a user prompt for confirmation or input. This is used for operations that require user approval.

func NewPrompt

func NewPrompt(conn *dbus.Conn, callback func(bool), opts ...PromptOption) *Prompt

NewPrompt creates a new prompt object.

func (*Prompt) Dismiss

func (p *Prompt) Dismiss() *dbus.Error

Dismiss dismisses the prompt without user action. This is equivalent to the user rejecting the prompt.

func (*Prompt) Export

func (p *Prompt) Export() error

Export exports the prompt to D-Bus.

func (*Prompt) GetCreatedAt

func (p *Prompt) GetCreatedAt() time.Time

GetCreatedAt returns when the prompt was created.

func (*Prompt) GetHandler

func (p *Prompt) GetHandler() PromptHandler

GetHandler returns the current prompt handler.

func (*Prompt) GetMessage

func (p *Prompt) GetMessage() string

GetMessage returns the prompt message.

func (*Prompt) GetTimeout

func (p *Prompt) GetTimeout() time.Duration

GetTimeout returns the prompt timeout duration.

func (*Prompt) IsCompleted

func (p *Prompt) IsCompleted() bool

IsCompleted returns whether the prompt has been completed.

func (*Prompt) Path

func (p *Prompt) Path() dbus.ObjectPath

Path returns the D-Bus object path for this prompt.

func (*Prompt) Prompt

func (p *Prompt) Prompt(windowID string) *dbus.Error

Prompt prompts the user for confirmation. This method shows a prompt to the user and waits for their response.

func (*Prompt) SetHandler

func (p *Prompt) SetHandler(handler PromptHandler)

SetHandler sets a new prompt handler.

func (*Prompt) SetMessage

func (p *Prompt) SetMessage(message string)

SetMessage sets the prompt message.

func (*Prompt) Unexport

func (p *Prompt) Unexport() error

Unexport removes the prompt from D-Bus.

type PromptHandler

type PromptHandler interface {
	// ShowPrompt displays a prompt to the user and returns their decision.
	// windowID: The window ID that triggered the prompt (can be empty)
	// message: The message to display to the user
	// Returns: true if approved, false if rejected, error if failed
	ShowPrompt(windowID, message string) (bool, error)
}

PromptHandler defines the interface for handling user prompts. Applications can implement this interface to provide custom prompt behavior.

type PromptOption

type PromptOption func(*Prompt)

PromptOption represents a function that configures a Prompt.

func WithPromptHandler

func WithPromptHandler(handler PromptHandler) PromptOption

WithPromptHandler sets a custom prompt handler for the prompt.

func WithPromptMessage

func WithPromptMessage(message string) PromptOption

WithPromptMessage sets the message to display in the prompt.

func WithPromptTimeout

func WithPromptTimeout(timeout time.Duration) PromptOption

WithPromptTimeout sets the timeout for prompt response.

type PropertyChangeNotifier

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

PropertyChangeNotifier provides a convenient way to notify property changes.

func NewPropertyChangeNotifier

func NewPropertyChangeNotifier(bridge *Bridge) *PropertyChangeNotifier

NewPropertyChangeNotifier creates a new property change notifier.

func (*PropertyChangeNotifier) NotifyCollectionChanged

func (pcn *PropertyChangeNotifier) NotifyCollectionChanged(collectionPath dbus.ObjectPath)

NotifyCollectionChanged notifies that a collection was modified.

func (*PropertyChangeNotifier) NotifyCollectionCreated

func (pcn *PropertyChangeNotifier) NotifyCollectionCreated(collectionPath dbus.ObjectPath)

NotifyCollectionCreated notifies that a collection was created.

func (*PropertyChangeNotifier) NotifyCollectionDeleted

func (pcn *PropertyChangeNotifier) NotifyCollectionDeleted(collectionPath dbus.ObjectPath)

NotifyCollectionDeleted notifies that a collection was deleted.

func (*PropertyChangeNotifier) NotifyItemChanged

func (pcn *PropertyChangeNotifier) NotifyItemChanged(itemPath dbus.ObjectPath)

NotifyItemChanged notifies that an item was modified.

func (*PropertyChangeNotifier) NotifyItemCreated

func (pcn *PropertyChangeNotifier) NotifyItemCreated(collectionPath, itemPath dbus.ObjectPath)

NotifyItemCreated notifies that an item was created.

func (*PropertyChangeNotifier) NotifyItemDeleted

func (pcn *PropertyChangeNotifier) NotifyItemDeleted(collectionPath, itemPath dbus.ObjectPath)

NotifyItemDeleted notifies that an item was deleted.

type PropertyManager

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

PropertyManager manages service properties and signals.

func NewPropertyManager

func NewPropertyManager(bridge *Bridge) *PropertyManager

NewPropertyManager creates a new property manager.

func (*PropertyManager) EmitPropertiesChanged

func (pm *PropertyManager) EmitPropertiesChanged(interfaceName string, changedProperties map[string]dbus.Variant, invalidatedProperties []string)

EmitPropertiesChanged emits a properties changed signal.

type Secret

type Secret struct {
	Session     dbus.ObjectPath
	Parameters  []byte
	Value       []byte
	ContentType string
}

Secret represents a secret value transferred over D-Bus. The secret is encrypted using the session's negotiated algorithm.

type SecretProperties

type SecretProperties struct {
	Label      string
	Attributes map[string]string
}

SecretProperties represents properties for creating a secret item.

type Session

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

Session represents a client session for encrypted communication.

func NewSession

func NewSession(algorithm EncryptionAlgorithm) (*Session, []byte, error)

NewSession creates a new session with the specified algorithm.

func (*Session) Close

func (s *Session) Close() *dbus.Error

Close is the D-Bus method for closing a session.

func (*Session) CompleteKeyExchange

func (s *Session) CompleteKeyExchange(clientPublicKey []byte) error

CompleteKeyExchange completes the DH key exchange with the client's public key.

func (*Session) Decrypt

func (s *Session) Decrypt(parameters, value []byte) ([]byte, error)

Decrypt decrypts data using the session's algorithm and key.

func (*Session) Encrypt

func (s *Session) Encrypt(data []byte) ([]byte, []byte, error)

Encrypt encrypts data using the session's algorithm and key.

func (*Session) Export

func (s *Session) Export(conn *dbus.Conn) error

Export exports the session to D-Bus.

func (*Session) Introspect

func (s *Session) Introspect() *introspect.Node

Introspect returns XML introspection data.

func (*Session) Path

func (s *Session) Path() dbus.ObjectPath

Path returns the D-Bus object path for this session.

func (*Session) Unexport

func (s *Session) Unexport(conn *dbus.Conn)

Unexport removes the session from D-Bus.

type SessionManager

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

SessionManager manages active sessions.

func NewSessionManager

func NewSessionManager() *SessionManager

NewSessionManager creates a new session manager.

func (*SessionManager) CloseAll

func (sm *SessionManager) CloseAll(conn *dbus.Conn)

CloseAll closes all sessions and stops the cleanup goroutine.

func (*SessionManager) CloseSession

func (sm *SessionManager) CloseSession(conn *dbus.Conn, path dbus.ObjectPath) error

CloseSession closes and removes a session.

func (*SessionManager) CreateSession

func (sm *SessionManager) CreateSession(conn *dbus.Conn, algorithm EncryptionAlgorithm) (*Session, []byte, error)

CreateSession creates a new session.

func (*SessionManager) GetSession

func (sm *SessionManager) GetSession(path dbus.ObjectPath) (*Session, error)

GetSession retrieves a session by path.

type SignalManager

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

SignalManager manages D-Bus property change signals.

func NewSignalManager

func NewSignalManager(bridge *Bridge) *SignalManager

NewSignalManager creates a new signal manager.

func (*SignalManager) EmitCollectionAdded

func (sm *SignalManager) EmitCollectionAdded(collectionPath dbus.ObjectPath)

EmitCollectionAdded emits a signal when a collection is added.

func (*SignalManager) EmitCollectionChanged

func (sm *SignalManager) EmitCollectionChanged(collectionPath dbus.ObjectPath)

EmitCollectionChanged emits a signal when a collection changes.

func (*SignalManager) EmitCollectionDeleted

func (sm *SignalManager) EmitCollectionDeleted(collectionPath dbus.ObjectPath)

EmitCollectionDeleted emits a signal when a collection is deleted.

func (*SignalManager) EmitItemAdded

func (sm *SignalManager) EmitItemAdded(collectionPath, _ dbus.ObjectPath)

EmitItemAdded emits a signal when an item is added to a collection.

func (*SignalManager) EmitItemChanged

func (sm *SignalManager) EmitItemChanged(itemPath dbus.ObjectPath)

EmitItemChanged emits a signal when an item changes.

func (*SignalManager) EmitItemDeleted

func (sm *SignalManager) EmitItemDeleted(collectionPath, _ dbus.ObjectPath)

EmitItemDeleted emits a signal when an item is deleted from a collection.

type StandardAliasManager

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

StandardAliasManager manages standard aliases according to the FreeDesktop specification.

func NewStandardAliasManager

func NewStandardAliasManager(bridge *Bridge) *StandardAliasManager

NewStandardAliasManager creates a new standard alias manager.

func (*StandardAliasManager) GetAllAliases

func (am *StandardAliasManager) GetAllAliases() map[string]dbus.ObjectPath

GetAllAliases returns all aliases and their target paths.

func (*StandardAliasManager) GetStandardAliases

func (am *StandardAliasManager) GetStandardAliases() []string

GetStandardAliases returns the list of standard alias names.

func (*StandardAliasManager) Initialize

func (am *StandardAliasManager) Initialize() error

Initialize sets up standard aliases and exports collections after bridge start.

func (*StandardAliasManager) IsStandardAlias

func (am *StandardAliasManager) IsStandardAlias(name string) bool

IsStandardAlias checks if an alias name is a standard alias.

func (*StandardAliasManager) ReadAlias

func (am *StandardAliasManager) ReadAlias(name string) (dbus.ObjectPath, error)

ReadAlias resolves an alias to a collection path.

func (*StandardAliasManager) RemoveAlias

func (am *StandardAliasManager) RemoveAlias(name string) error

RemoveAlias removes an alias.

func (*StandardAliasManager) SetAlias

func (am *StandardAliasManager) SetAlias(name string, collectionPath dbus.ObjectPath) error

SetAlias sets an alias to point to a collection.

Jump to

Keyboard shortcuts

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