diff --git a/bindings/ud.go b/bindings/ud.go index d3883fb973a1f0a44f55efce797f367772a9f0a1..f9a12eb39972f94743a833e9ec4e081139b5ac40 100644 --- a/bindings/ud.go +++ b/bindings/ud.go @@ -17,14 +17,13 @@ import ( "time" ) -//This package wraps the user discovery system +// This package wraps the user discovery system -// User Discovery object type UserDiscovery struct { ud *ud.Manager } -// Returns a new user discovery object. Only call this once. It must be called +// NewUserDiscovery returns a new user discovery object. Only call this once. It must be called // after StartNetworkFollower is called and will fail if the network has never // been contacted. // This function technically has a memory leak because it causes both sides of @@ -55,7 +54,7 @@ func (ud *UserDiscovery) Register(username string) error { return ud.ud.Register(username) } -// Adds a fact for the user to user discovery. Will only succeed if the +// AddFact adds a fact for the user to user discovery. Will only succeed if the // user is already registered and the system does not have the fact currently // registered for any user. // Will fail if the fact string is not well formed. @@ -73,14 +72,14 @@ func (ud *UserDiscovery) AddFact(fStr string) (string, error) { return ud.ud.SendRegisterFact(f) } -// Confirms a fact first registered via AddFact. The confirmation ID comes from +// ConfirmFact confirms a fact first registered via AddFact. The confirmation ID comes from // AddFact while the code will come over the associated communications system func (ud *UserDiscovery) ConfirmFact(confirmationID, code string) error { return ud.ud.SendConfirmFact(confirmationID, code) } -// Removes a previously confirmed fact. Will fail if the passed fact string is -// not well formed or if the fact is not associated with this client. +// RemoveFact removes a previously confirmed fact. Will fail if the passed fact string is +// not well-formed or if the fact is not associated with this client. // Users cannot remove username facts and must instead remove the user. func (ud *UserDiscovery) RemoveFact(fStr string) error { f, err := fact.UnstringifyFact(fStr) @@ -108,7 +107,7 @@ type SearchCallback interface { Callback(contacts *ContactList, error string) } -// Searches for the passed Facts. The factList is the stringification of a +// Search for the passed Facts. The factList is the stringification of a // fact list object, look at /bindings/list.go for more on that object. // This will reject if that object is malformed. The SearchCallback will return // a list of contacts, each having the facts it hit against. @@ -141,7 +140,7 @@ type SingleSearchCallback interface { Callback(contact *Contact, error string) } -// Searches for the passed Facts. The fact is the stringification of a +// SearchSingle searches for the passed Facts. The fact is the stringification of a // fact object, look at /bindings/contact.go for more on that object. // This will reject if that object is malformed. The SearchCallback will return // a list of contacts, each having the facts it hit against. @@ -173,7 +172,7 @@ type LookupCallback interface { Callback(contact *Contact, error string) } -// Looks for the contact object associated with the given userID. The +// Lookup the contact object associated with the given userID. The // id is the byte representation of an id. // This will reject if that id is malformed. The LookupCallback will return // the associated contact if it exists. @@ -202,7 +201,7 @@ func (ud UserDiscovery) Lookup(idBytes []byte, callback LookupCallback, } -// MultiLookupCallback returns the result of many paralel lookups +// MultiLookupCallback returns the result of many parallel lookups type MultiLookupCallback interface { Callback(Succeeded *ContactList, failed *IdList, errors string) } diff --git a/cmd/ud.go b/cmd/ud.go index 34fff1c098f490195a952ac302cc7256ccf7b577..f334918ba20f9af6ca5a728f0bf49afcc0f5fb76 100644 --- a/cmd/ud.go +++ b/cmd/ud.go @@ -127,7 +127,6 @@ var udCmd = &cobra.Command{ confirmID := viper.GetString("confirm") if confirmID != "" { - // TODO: Lookup code err = userDiscoveryMgr.SendConfirmFact(confirmID, confirmID) if err != nil { fmt.Printf("Couldn't confirm fact: %s\n", @@ -136,6 +135,8 @@ var udCmd = &cobra.Command{ } } + // Handle lookup (verification) process + // Note: Cryptographic verification occurs above the bindings layer lookupIDStr := viper.GetString("lookup") if lookupIDStr != "" { lookupID, ok := parseRecipient(lookupIDStr)