Skip to content
Snippets Groups Projects
Select Git revision
  • 6d2304df43d7d73c0ec1d5e69b8aa808c3666d6c
  • release default protected
  • XX-4719/announcementChannels
  • jonah/channelCodenames
  • master protected
  • XX-4601/HavenInvites
  • sihSize
  • project/HavenNotifications
  • hotfix/base8KeySizes
  • Anne/Project/DM
  • XX-4004_ownership_vector_test
  • XX-3566_constant_time_comparison
  • XX-4132-upgrade-channel-keying
  • XX-4133-rsa-to-private
  • XX-3958/ConnectionCLI
  • xx-3893/asymmetric
  • xx-3891/symmetric-integration
  • hotfix/groupChat
  • XX-3770/UpdateExternalDeps
  • dev
  • waitingRoundsRewrite
  • v0.0.9
  • v0.0.8
  • v0.0.7
  • v0.0.6
  • v0.0.5
  • v0.0.4
  • v0.0.3
  • v0.0.2
  • v0.0.1
30 results

responseKey.go

  • userDiscovery.go 2.75 KiB
    package api
    
    import (
    	jww "github.com/spf13/jwalterweatherman"
    	"gitlab.com/elixxir/client/interfaces/contact"
    )
    
    // Returns true if the cryptographic identity has been registered with
    // the CMIX user discovery agent.
    // Note that clients do not need to perform this step if they use
    // out of band methods to exchange cryptographic identities
    // (e.g., QR codes), but failing to be registered precludes usage
    // of the user discovery mechanism (this may be preferred by user).
    func (c *Client) IsRegistered() bool {
    	jww.INFO.Printf("IsRegistered()")
    	return false
    }
    
    // RegisterIdentity registers an arbitrary username with the user
    // discovery protocol. Returns an error when it cannot connect or
    // the username is already registered.
    func (c *Client) RegisterIdentity(username string) error {
    	jww.INFO.Printf("RegisterIdentity(%s)", username)
    	return nil
    }
    
    // RegisterEmail makes the users email searchable after confirmation.
    // It returns a registration confirmation token to be used with
    // ConfirmRegistration or an error on failure.
    func (c *Client) RegisterEmail(email string) ([]byte, error) {
    	jww.INFO.Printf("RegisterEmail(%s)", email)
    	return nil, nil
    }
    
    // RegisterPhone makes the users phone searchable after confirmation.
    // It returns a registration confirmation token to be used with
    // ConfirmRegistration or an error on failure.
    func (c *Client) RegisterPhone(phone string) ([]byte, error) {
    	jww.INFO.Printf("RegisterPhone(%s)", phone)
    	return nil, nil
    }
    
    // ConfirmRegistration sends the user discovery agent a confirmation
    // token (from register Email/Phone) and code (string sent via Email
    // or SMS to confirm ownership) to confirm ownership.
    func (c *Client) ConfirmRegistration(token, code []byte) error {
    	jww.INFO.Printf("ConfirmRegistration(%s, %s)", token, code)
    	return nil
    }
    
    // Search accepts a "separator" separated list of search elements with
    // an associated list of searchTypes. It returns a ContactList which
    // allows you to iterate over the found contact objects.
    func (c *Client) Search(data, separator string, searchTypes []byte) []contact.Contact {
    	jww.INFO.Printf("Search(%s, %s, %s)", data, separator, searchTypes)
    	return nil
    }
    
    // SearchWithHandler is a non-blocking search that also registers
    // a callback interface for user disovery events.
    func (c *Client) SearchWithCallback(data, separator string, searchTypes []byte,
    	cb func(results []contact.Contact)) {
    	resultCh := make(chan []contact.Contact, 1)
    	go func(out chan []contact.Contact, data, separator string, srchTypes []byte) {
    		out <- c.Search(data, separator, srchTypes)
    		close(out)
    	}(resultCh, data, separator, searchTypes)
    
    	go func(in chan []contact.Contact, cb func(results []contact.Contact)) {
    		select {
    		case contacts := <-in:
    			cb(contacts)
    			//TODO: Timer
    		}
    	}(resultCh, cb)
    }