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
- func CombineMetadataWithSecret(metadata *ItemMetadata, secret []byte) ([]byte, error)
- func CreateDefaultAttributes(label string) map[string]string
- type AuthManager
- func (am *AuthManager) Authenticate(password string) (bool, error)
- func (am *AuthManager) ChangePassword(oldPassword, newPassword string) (bool, error)
- func (am *AuthManager) GetStatus() (bool, bool, int)
- func (am *AuthManager) IsLocked() bool
- func (am *AuthManager) Lock()
- func (am *AuthManager) SetAutoLockTimeout(timeout time.Duration)
- func (am *AuthManager) SetEnabled(enabled bool)
- func (am *AuthManager) Unlock(password string) (bool, error)
- func (am *AuthManager) UpdateActivity()
- type AuthPromptHandler
- func (h *AuthPromptHandler) GetAuthenticationPromptMessage(operation string) string
- func (h *AuthPromptHandler) HandleChangePasswordPrompt(_ string) (bool, string, string, error)
- func (h *AuthPromptHandler) HandleUnlockPrompt(_ string) (bool, error)
- func (h *AuthPromptHandler) IsAuthenticationRequired(operation string) bool
- type Bridge
- func (b *Bridge) ChangeLock(objects []dbus.ObjectPath) ([]dbus.ObjectPath, dbus.ObjectPath, *dbus.Error)
- func (b *Bridge) Close() *dbus.Error
- func (b *Bridge) CreateCollection(properties map[string]dbus.Variant, alias string) (dbus.ObjectPath, dbus.ObjectPath, *dbus.Error)
- func (b *Bridge) DeleteCollection(collectionPath dbus.ObjectPath) *dbus.Error
- func (b *Bridge) GetProperty(interfaceName, propertyName string) (dbus.Variant, *dbus.Error)
- func (b *Bridge) GetSecrets(items []dbus.ObjectPath, sessionPath dbus.ObjectPath) (map[dbus.ObjectPath]Secret, *dbus.Error)
- func (b *Bridge) GetServiceInfo() (string, []string, *dbus.Error)
- func (b *Bridge) GetServiceProperties() map[string]dbus.Variant
- func (b *Bridge) GetSession(sessionPath dbus.ObjectPath) (EncryptionAlgorithm, []byte, *dbus.Error)
- func (b *Bridge) Lock(objects []dbus.ObjectPath) ([]dbus.ObjectPath, dbus.ObjectPath, *dbus.Error)
- func (b *Bridge) OpenSession(algorithm string, input dbus.Variant) (dbus.Variant, dbus.ObjectPath, *dbus.Error)
- func (b *Bridge) ReadAlias(name string) (dbus.ObjectPath, *dbus.Error)
- func (b *Bridge) SearchCollections(attributes map[string]string) ([]dbus.ObjectPath, *dbus.Error)
- func (b *Bridge) SearchItems(attributes map[string]string) ([]dbus.ObjectPath, []dbus.ObjectPath, *dbus.Error)
- func (b *Bridge) SetAlias(name string, collectionPath dbus.ObjectPath) *dbus.Error
- func (b *Bridge) SetProperty(interfaceName, propertyName string, value dbus.Variant) *dbus.Error
- func (b *Bridge) Start() error
- func (b *Bridge) Stop() error
- func (b *Bridge) Unlock(objects []dbus.ObjectPath) ([]dbus.ObjectPath, dbus.ObjectPath, *dbus.Error)
- type Collection
- func (c *Collection) CreateItem(properties map[string]dbus.Variant, secret Secret, replace bool) (dbus.ObjectPath, dbus.ObjectPath, *dbus.Error)
- func (c *Collection) Delete() (dbus.ObjectPath, *dbus.Error)
- func (c *Collection) DeleteAllItems() error
- func (c *Collection) Export(conn *dbus.Conn) error
- func (c *Collection) GetSecrets(items []dbus.ObjectPath, sessionPath dbus.ObjectPath) (map[dbus.ObjectPath]Secret, *dbus.Error)
- func (c *Collection) Introspect() *introspect.Node
- func (c *Collection) IsLocked() bool
- func (c *Collection) Lock()
- func (c *Collection) Path() dbus.ObjectPath
- func (c *Collection) SearchItems(attributes map[string]string) ([]dbus.ObjectPath, error)
- func (c *Collection) SetProperties(properties map[string]dbus.Variant) *dbus.Error
- func (c *Collection) Unexport(conn *dbus.Conn)
- func (c *Collection) Unlock()
- type DHKeyExchange
- type DefaultPromptHandler
- type EncryptionAlgorithm
- type Item
- func (i *Item) Delete() (dbus.ObjectPath, *dbus.Error)
- func (i *Item) Export(conn *dbus.Conn, _ *prop.Properties) error
- func (i *Item) GetAttributes() map[string]string
- func (i *Item) GetLabel() string
- func (i *Item) GetSecret(sessionPath dbus.ObjectPath) (Secret, *dbus.Error)
- func (i *Item) Introspect() *introspect.Node
- func (i *Item) IsLocked() bool
- func (i *Item) Lock()
- func (i *Item) MatchesAttributes(attributes map[string]string) bool
- func (i *Item) Path() dbus.ObjectPath
- func (i *Item) SetProperties(properties map[string]dbus.Variant) *dbus.Error
- func (i *Item) SetSecret(secret Secret) *dbus.Error
- func (i *Item) Unexport(conn *dbus.Conn)
- func (i *Item) Unlock()
- type ItemMetadata
- func (m *ItemMetadata) GetAttribute(key string) string
- func (m *ItemMetadata) HasAttribute(key string) bool
- func (m *ItemMetadata) Marshal() ([]byte, error)
- func (m *ItemMetadata) RemoveAttribute(key string)
- func (m *ItemMetadata) SetAttribute(key, value string)
- func (m *ItemMetadata) Unmarshal(data []byte) error
- func (m *ItemMetadata) UpdateModified()
- type Prompt
- func (p *Prompt) Dismiss() *dbus.Error
- func (p *Prompt) Export() error
- func (p *Prompt) GetCreatedAt() time.Time
- func (p *Prompt) GetHandler() PromptHandler
- func (p *Prompt) GetMessage() string
- func (p *Prompt) GetTimeout() time.Duration
- func (p *Prompt) IsCompleted() bool
- func (p *Prompt) Path() dbus.ObjectPath
- func (p *Prompt) Prompt(windowID string) *dbus.Error
- func (p *Prompt) SetHandler(handler PromptHandler)
- func (p *Prompt) SetMessage(message string)
- func (p *Prompt) Unexport() error
- type PromptHandler
- type PromptOption
- type PropertyChangeNotifier
- func (pcn *PropertyChangeNotifier) NotifyCollectionChanged(collectionPath dbus.ObjectPath)
- func (pcn *PropertyChangeNotifier) NotifyCollectionCreated(collectionPath dbus.ObjectPath)
- func (pcn *PropertyChangeNotifier) NotifyCollectionDeleted(collectionPath dbus.ObjectPath)
- func (pcn *PropertyChangeNotifier) NotifyItemChanged(itemPath dbus.ObjectPath)
- func (pcn *PropertyChangeNotifier) NotifyItemCreated(collectionPath, itemPath dbus.ObjectPath)
- func (pcn *PropertyChangeNotifier) NotifyItemDeleted(collectionPath, itemPath dbus.ObjectPath)
- type PropertyManager
- type Secret
- type SecretProperties
- type Session
- func (s *Session) Close() *dbus.Error
- func (s *Session) CompleteKeyExchange(clientPublicKey []byte) error
- func (s *Session) Decrypt(parameters, value []byte) ([]byte, error)
- func (s *Session) Encrypt(data []byte) ([]byte, []byte, error)
- func (s *Session) Export(conn *dbus.Conn) error
- func (s *Session) Introspect() *introspect.Node
- func (s *Session) Path() dbus.ObjectPath
- func (s *Session) Unexport(conn *dbus.Conn)
- type SessionManager
- func (sm *SessionManager) CloseAll(conn *dbus.Conn)
- func (sm *SessionManager) CloseSession(conn *dbus.Conn, path dbus.ObjectPath) error
- func (sm *SessionManager) CreateSession(conn *dbus.Conn, algorithm EncryptionAlgorithm) (*Session, []byte, error)
- func (sm *SessionManager) GetSession(path dbus.ObjectPath) (*Session, error)
- type SignalManager
- func (sm *SignalManager) EmitCollectionAdded(collectionPath dbus.ObjectPath)
- func (sm *SignalManager) EmitCollectionChanged(collectionPath dbus.ObjectPath)
- func (sm *SignalManager) EmitCollectionDeleted(collectionPath dbus.ObjectPath)
- func (sm *SignalManager) EmitItemAdded(collectionPath, _ dbus.ObjectPath)
- func (sm *SignalManager) EmitItemChanged(itemPath dbus.ObjectPath)
- func (sm *SignalManager) EmitItemDeleted(collectionPath, _ dbus.ObjectPath)
- type StandardAliasManager
- func (am *StandardAliasManager) GetAllAliases() map[string]dbus.ObjectPath
- func (am *StandardAliasManager) GetStandardAliases() []string
- func (am *StandardAliasManager) Initialize() error
- func (am *StandardAliasManager) IsStandardAlias(name string) bool
- func (am *StandardAliasManager) ReadAlias(name string) (dbus.ObjectPath, error)
- func (am *StandardAliasManager) RemoveAlias(name string) error
- func (am *StandardAliasManager) SetAlias(name string, collectionPath dbus.ObjectPath) error
Constants ¶
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.
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 ¶
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) 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 ¶
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 (*Bridge) ChangeLock ¶
func (b *Bridge) ChangeLock(objects []dbus.ObjectPath) ([]dbus.ObjectPath, dbus.ObjectPath, *dbus.Error)
ChangeLock changes the lock state of objects.
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 ¶
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 ¶
GetServiceInfo returns service information and capabilities.
func (*Bridge) GetServiceProperties ¶
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) SearchCollections ¶
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) SetProperty ¶
SetProperty sets a service property.
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) 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 ¶
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) GetAttributes ¶
GetAttributes returns the item's attributes.
func (*Item) Introspect ¶
func (i *Item) Introspect() *introspect.Node
Introspect returns XML introspection data.
func (*Item) MatchesAttributes ¶
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 ¶
SetProperties sets properties on 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 ¶
Dismiss dismisses the prompt without user action. This is equivalent to the user rejecting the prompt.
func (*Prompt) GetCreatedAt ¶
GetCreatedAt returns when the prompt was created.
func (*Prompt) GetHandler ¶
func (p *Prompt) GetHandler() PromptHandler
GetHandler returns the current prompt handler.
func (*Prompt) GetMessage ¶
GetMessage returns the prompt message.
func (*Prompt) GetTimeout ¶
GetTimeout returns the prompt timeout duration.
func (*Prompt) IsCompleted ¶
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 ¶
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 ¶
SetMessage sets the prompt message.
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 ¶
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) CompleteKeyExchange ¶
CompleteKeyExchange completes the DH key exchange with the client's public key.
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.
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.