package main import ( "fmt" "os" keychainlinker "git.aetherial.dev/aeth/keychain-linker/pkg" "github.com/godbus/dbus/v5" "github.com/godbus/dbus/v5/introspect" ) func main() { conn, err := dbus.ConnectSessionBus() if err != nil { panic(err) } defer conn.Close() path := "/dev/aetherial/KeychainLinker" session := &keychainlinker.Service{SessionBase: "/dev/aetherial/KeychainLinker/session/", CollectionBase: "/dev/aetherial/KeychainLinker/collection/", Collections: []dbus.ObjectPath{}} conn.Export(session, dbus.ObjectPath(path), "dev.aetherial.git.KeychainLinker.Service") conn.Export(introspect.Introspectable(keychainlinker.DbusAdv), dbus.ObjectPath(path), "org.freedesktop.DBus.Introspectable") conn.Export(introspect.Introspectable(introspect.Node{ Interfaces: []introspect.Interface{ introspect.Interface{ Name: "org.freedesktop.secret.Servic", Methods: []introspect.Method{ {Name: "Get", Args: []introspect.Arg{{Name: "interface_name", Type: "s", Direction: "in"}, {Name: "property_name", Type: "s", Direction: "in"}, {Name: "value", Type: "v", Direction: "out"}}}, {Name: "Set", Args: []introspect.Arg{{Name: "interface_name", Type: "s", Direction: "in"}, {Name: "property_name", Type: "s", Direction: "in"}, {Name: "value", Type: "v", Direction: "in"}}}, {Name: "GetAll", Args: []introspect.Arg{{Name: "interface_name", Type: "s", Direction: "in"}, {Name: "props", Type: "a{sv}", Direction: "out"}}}, }, }, }, }), "/org/freedesktop/secret", "org.freedesktop.DBus.Introspectable") reply, err := conn.RequestName("dev.aetherial.git.KeychainLinker.Service", dbus.NameFlagDoNotQueue) if err != nil { panic(err) } if reply != dbus.RequestNameReplyPrimaryOwner { fmt.Fprintln(os.Stderr, "name already taken") os.Exit(1) } fmt.Println("Listening on dev.aetherial.git.KeychainLinker.Service / /dev/aetherial/git/KeychainLinker/Service ...") select {} }