|
@@ -9,6 +9,12 @@ import (
|
|
|
"github.com/godbus/dbus/v5/introspect"
|
|
|
)
|
|
|
|
|
|
+const (
|
|
|
+ dbusName = "org.freedesktop.secrets"
|
|
|
+ objPath = "/org/freedesktop/secrets/collection/default"
|
|
|
+ iface = "org.freedesktop.Secret.Collection"
|
|
|
+)
|
|
|
+
|
|
|
func main() {
|
|
|
conn, err := dbus.ConnectSessionBus()
|
|
|
if err != nil {
|
|
@@ -20,42 +26,51 @@ func main() {
|
|
|
service := keychainlinker.NewService(dbus.ObjectPath(path))
|
|
|
|
|
|
conn.Export(service, dbus.ObjectPath(path), "org.freedesktop.Secret.Service")
|
|
|
- conn.Export(service.Cache["/org/freedesktop/secrets/collection/default"], "/org/freedesktop/secrets/collection/default", "org.freedesktop.DBus.Properties")
|
|
|
|
|
|
conn.Export(introspect.Introspectable(keychainlinker.DbusAdv), dbus.ObjectPath(path),
|
|
|
"org.freedesktop.DBus.Introspectable")
|
|
|
-<<<<<<< HEAD
|
|
|
- conn.Export(introspect.Introspectable(keychainlinker.DbusAdv), "/org/freedesktop/secrets/collection/default", "org.freedesktop.DBus.Introspectable")
|
|
|
- reply, err := conn.RequestName("org.freedesktop.secrets",
|
|
|
-=======
|
|
|
- node := introspect.Node{
|
|
|
- Interfaces: []introspect.Interface{
|
|
|
- {
|
|
|
- Name: "org.freedesktop.secret.Service",
|
|
|
- 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"}}},
|
|
|
+
|
|
|
+ /*
|
|
|
+ node := introspect.Node{
|
|
|
+ Interfaces: []introspect.Interface{
|
|
|
+ {
|
|
|
+ Name: "org.freedesktop.Secret.Service",
|
|
|
+ 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"}}},
|
|
|
+ },
|
|
|
},
|
|
|
},
|
|
|
- },
|
|
|
- }
|
|
|
- conn.Export(introspect.Introspectable(introspect.NewIntrospectable(&node)), "/org/freedesktop/secret", "org.freedesktop.DBus.Introspectable")
|
|
|
- node = introspect.Node{
|
|
|
- Interfaces: []introspect.Interface{
|
|
|
- {
|
|
|
- Name: "org.freedesktop.secret.Collection",
|
|
|
- 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"}}},
|
|
|
+ }
|
|
|
+ */
|
|
|
+ conn.Export(introspect.NewIntrospectable(&keychainlinker.ServiceNode), dbus.ObjectPath(path), "org.freedesktop.DBus.Introspectable")
|
|
|
+ collection := &keychainlinker.Collection{}
|
|
|
+ conn.Export(collection, objPath, iface)
|
|
|
+ /*
|
|
|
+ collectionNode := introspect.Node{
|
|
|
+ Interfaces: []introspect.Interface{
|
|
|
+ {
|
|
|
+ Name: iface,
|
|
|
+ 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: "SearchItems",
|
|
|
+ Args: []introspect.Arg{
|
|
|
+ {Name: "attributes", Type: "a{ss}", Direction: "in"},
|
|
|
+ {Name: "locked", Type: "ao", Direction: "out"},
|
|
|
+ {Name: "unlocked", Type: "ao", Direction: "out"},
|
|
|
+ },
|
|
|
+ },
|
|
|
+ },
|
|
|
},
|
|
|
},
|
|
|
- },
|
|
|
- }
|
|
|
- conn.Export(introspect.Introspectable(introspect.NewIntrospectable(&node)), "/org/freedesktop/secret", "org.freedesktop.DBus.IntrospectData")
|
|
|
+ }
|
|
|
+ */
|
|
|
+ conn.Export(introspect.NewIntrospectable(&keychainlinker.CollectionNode), dbus.ObjectPath(path+"/collection/default"), "org.freedesktop.DBus.Introspectable")
|
|
|
|
|
|
- reply, err := conn.RequestName("dev.aetherial.git.KeychainLinker.Service",
|
|
|
->>>>>>> 2946fa107c12a5e2d1c88f3b60f8bea802b19fd7
|
|
|
+ reply, err := conn.RequestName(dbusName,
|
|
|
dbus.NameFlagDoNotQueue)
|
|
|
if err != nil {
|
|
|
panic(err)
|