Workaround for missing Type property
Some poor decisions that have been made made by KeePassXC lead to the case where they diverge from libsecret's implementation and implement their own incompatible API in the same Dbus namespace. But they still call their API "Secret Service". Well then.
This commit is contained in:
parent
bb85cb8b52
commit
b4419a6f8c
@ -80,7 +80,9 @@ func (c *Collection) CreateItem(label string, attrs map[string]string, secret *S
|
|||||||
}
|
}
|
||||||
|
|
||||||
props[DbusItemLabel] = dbus.MakeVariant(label)
|
props[DbusItemLabel] = dbus.MakeVariant(label)
|
||||||
|
if !c.service.Legacy {
|
||||||
props[DbusItemType] = dbus.MakeVariant(typeString)
|
props[DbusItemType] = dbus.MakeVariant(typeString)
|
||||||
|
}
|
||||||
props[DbusItemAttributes] = dbus.MakeVariant(attrs)
|
props[DbusItemAttributes] = dbus.MakeVariant(attrs)
|
||||||
props[DbusItemCreated] = dbus.MakeVariant(uint64(time.Now().Unix()))
|
props[DbusItemCreated] = dbus.MakeVariant(uint64(time.Now().Unix()))
|
||||||
// props[DbusItemModified] = dbus.MakeVariant(uint64(time.Now().Unix()))
|
// props[DbusItemModified] = dbus.MakeVariant(uint64(time.Now().Unix()))
|
||||||
|
@ -282,6 +282,11 @@ func (i *Item) Type() (itemType string, err error) {
|
|||||||
|
|
||||||
var variant dbus.Variant
|
var variant dbus.Variant
|
||||||
|
|
||||||
|
// Legacy spec.
|
||||||
|
if i.collection.service.Legacy {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if variant, err = i.Dbus.GetProperty(DbusItemType); err != nil {
|
if variant, err = i.Dbus.GetProperty(DbusItemType); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
13
types.go
13
types.go
@ -74,6 +74,17 @@ type Service struct {
|
|||||||
Session *Session `json:"-"`
|
Session *Session `json:"-"`
|
||||||
// IsLocked indicates if the Service is locked or not. Status updated by Service.Locked.
|
// IsLocked indicates if the Service is locked or not. Status updated by Service.Locked.
|
||||||
IsLocked bool `json:"locked"`
|
IsLocked bool `json:"locked"`
|
||||||
|
/*
|
||||||
|
Legacy indicates that this SecretService implementation
|
||||||
|
breaks current spec by implementing the legacy/obsolete draft spec rather than current libsecret spec
|
||||||
|
for the Dbus API.
|
||||||
|
|
||||||
|
If you're using SecretService with KeePassXC, for instance, or a much older version of Gnome-Keyring *before* libsecret integration(?),
|
||||||
|
or if you are getting strange errors when performing a Service.SearchItems, you probably need to enable this field on the Service returned
|
||||||
|
by NewService. The coverage of this field may expand in the future, but currently it only prevents the (non-existent, in legacy spec)
|
||||||
|
Type property from being read or written on Items during NewItem and Collection.CreateItem.
|
||||||
|
*/
|
||||||
|
Legacy bool `json:"is_legacy"`
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -83,7 +94,7 @@ type Service struct {
|
|||||||
*/
|
*/
|
||||||
type Session struct {
|
type Session struct {
|
||||||
*DbusObject
|
*DbusObject
|
||||||
// collection tracks the Service this Session was created from.
|
// service tracks the Service this Session was created from.
|
||||||
service *Service
|
service *Service
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user