From 5ee6cd8fe6cad7c96fc6f300f507312a3dd001ce Mon Sep 17 00:00:00 2001 From: Benjamin Wenger <ben@elixxir.ioo> Date: Fri, 16 Oct 2020 10:58:29 -0700 Subject: [PATCH] added HasAuthenticatedChannel --- api/authenticatedChannel.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/api/authenticatedChannel.go b/api/authenticatedChannel.go index 8b898acaf..cb12a826e 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) { -- GitLab