gosecret/session_funcs.go
brent s b6ba0f9736
improvements, start integration tests
improved various funcs, removed extraneous things (e.g. Item.Attrs).

first integration test. more will come.
2021-12-07 02:56:15 -05:00

41 lines
766 B
Go

package gosecret
import (
"github.com/godbus/dbus/v5"
)
// I'm still not 100% certain what Sessions are used for, aside from getting Secrets from Items.
/*
NewSession returns a pointer to a new Session based on a Service and a dbus.ObjectPath.
You will almost always want to use Service.GetSession or Service.OpenSession instead.
*/
func NewSession(service *Service, path dbus.ObjectPath) (session *Session) {
var ssn Session = Session{
DbusObject: &DbusObject{
Conn: service.Conn,
},
service: service,
}
ssn.Dbus = ssn.Conn.Object(DbusInterfaceSession, path)
session = &ssn
return
}
// Close cleanly closes a Session.
func (s *Session) Close() (err error) {
var c *dbus.Call
c = s.Dbus.Call(
DbusSessionClose, 0,
)
_ = c
return
}