diff --git a/api/authenticatedChannel.go b/api/authenticatedChannel.go index 8b898acaf44a3a7b5378e00c66cf33fad952a5f3..cb12a826ee93eb0001d12f638d593fa0cf53ab5f 100644 --- a/api/authenticatedChannel.go +++ b/api/authenticatedChannel.go @@ -4,6 +4,7 @@ import ( jww "github.com/spf13/jwalterweatherman" "gitlab.com/elixxir/client/interfaces/contact" "gitlab.com/elixxir/client/storage/e2e" + "gitlab.com/xx_network/primitives/id" ) // CreateAuthenticatedChannel creates a 1-way authenticated channel @@ -31,6 +32,13 @@ func (c *Client) RegisterAuthRequestCb(cb func(contact contact.Contact, jww.INFO.Printf("RegisterAuthRequestCb(...)") } +// HasAuthenticatedChannel returns true if an authenticated channel exists for +// the partner +func (c *Client) HasAuthenticatedChannel(partner *id.ID) bool { + m, err := c.storage.E2e().GetPartner(partner) + return m != nil && err == nil +} + // Create an insecure e2e relationship with a precanned user func (c *Client) MakePrecannedAuthenticatedChannel(precannedID uint) (contact.Contact, error) {