Documentation ¶
Index ¶
- func AssertionFromComponent(actx libkb.AssertionContext, c keybase1.ContactComponent, coercedValue string) (string, error)
- func MakeContact(name string, args ...keybase1.ContactComponent) keybase1.Contact
- func MakeEmailComponent(label string, email string) keybase1.ContactComponent
- func MakePhoneComponent(label string, phone string) keybase1.ContactComponent
- func ResolveAndSaveContacts(mctx libkb.MetaContext, provider ContactsProvider, contacts []keybase1.Contact) (err error)
- func ResolveContacts(mctx libkb.MetaContext, provider ContactsProvider, contacts []keybase1.Contact, ...) (res []keybase1.ProcessedContact, err error)
- func ServiceInit(g *libkb.GlobalContext)
- type CachedContactsProvider
- func (c *CachedContactsProvider) FindFollowing(mctx libkb.MetaContext, uids []keybase1.UID) (map[keybase1.UID]bool, error)
- func (c *CachedContactsProvider) FindUsernames(mctx libkb.MetaContext, uids []keybase1.UID) (map[keybase1.UID]ContactUsernameAndFullName, error)
- func (c *CachedContactsProvider) LookupAll(mctx libkb.MetaContext, emails []keybase1.EmailAddress, ...) (res ContactLookupResults, err error)
- type ContactCacheStore
- type ContactLookupKey
- type ContactLookupResult
- type ContactLookupResults
- type ContactUsernameAndFullName
- type ContactsProvider
- type ErrorContactsProvider
- func (c *ErrorContactsProvider) FindFollowing(mctx libkb.MetaContext, uids []keybase1.UID) (map[keybase1.UID]bool, error)
- func (c *ErrorContactsProvider) FindUsernames(mctx libkb.MetaContext, uids []keybase1.UID) (map[keybase1.UID]ContactUsernameAndFullName, error)
- func (c *ErrorContactsProvider) LookupAll(mctx libkb.MetaContext, emails []keybase1.EmailAddress, ...) (ret ContactLookupResults, err error)
- type MockContactsProvider
- func (c *MockContactsProvider) FindFollowing(mctx libkb.MetaContext, uids []keybase1.UID) (map[keybase1.UID]bool, error)
- func (c *MockContactsProvider) FindUsernames(mctx libkb.MetaContext, uids []keybase1.UID) (map[keybase1.UID]ContactUsernameAndFullName, error)
- func (c *MockContactsProvider) LookupAll(mctx libkb.MetaContext, emails []keybase1.EmailAddress, ...) (ContactLookupResults, error)
- type MockLookupUser
- type SavedContactsStore
- func (s *SavedContactsStore) RetrieveContacts(mctx libkb.MetaContext) (ret []keybase1.ProcessedContact, err error)
- func (s *SavedContactsStore) SaveProcessedContacts(mctx libkb.MetaContext, contacts []keybase1.ProcessedContact) (err error)
- func (s *SavedContactsStore) UnresolveContactsWithComponent(mctx libkb.MetaContext, phoneNumber *keybase1.PhoneNumber, ...)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertionFromComponent ¶
func AssertionFromComponent(actx libkb.AssertionContext, c keybase1.ContactComponent, coercedValue string) (string, error)
func MakeContact ¶
func MakeContact(name string, args ...keybase1.ContactComponent) keybase1.Contact
func MakeEmailComponent ¶
func MakeEmailComponent(label string, email string) keybase1.ContactComponent
func MakePhoneComponent ¶
func MakePhoneComponent(label string, phone string) keybase1.ContactComponent
func ResolveAndSaveContacts ¶
func ResolveAndSaveContacts(mctx libkb.MetaContext, provider ContactsProvider, contacts []keybase1.Contact) (err error)
func ResolveContacts ¶
func ResolveContacts(mctx libkb.MetaContext, provider ContactsProvider, contacts []keybase1.Contact, regionCode keybase1.RegionCode) (res []keybase1.ProcessedContact, err error)
ResolveContacts resolves contacts with cache for UI. See API documentation in phone_numbers.avdl
regionCode is optional, user region should be provided if it's known. It's used when resolving local phone numbers, they are assumed to be local to the user, so in the same region.
func ServiceInit ¶
func ServiceInit(g *libkb.GlobalContext)
Types ¶
type CachedContactsProvider ¶
type CachedContactsProvider struct { Provider ContactsProvider Store *ContactCacheStore // contains filtered or unexported fields }
func (*CachedContactsProvider) FindFollowing ¶
func (c *CachedContactsProvider) FindFollowing(mctx libkb.MetaContext, uids []keybase1.UID) (map[keybase1.UID]bool, error)
func (*CachedContactsProvider) FindUsernames ¶
func (c *CachedContactsProvider) FindUsernames(mctx libkb.MetaContext, uids []keybase1.UID) (map[keybase1.UID]ContactUsernameAndFullName, error)
func (*CachedContactsProvider) LookupAll ¶
func (c *CachedContactsProvider) LookupAll(mctx libkb.MetaContext, emails []keybase1.EmailAddress, numbers []keybase1.RawPhoneNumber, userRegion keybase1.RegionCode) (res ContactLookupResults, err error)
type ContactCacheStore ¶
type ContactCacheStore struct {
// contains filtered or unexported fields
}
ContactCacheStore is used by CachedContactsProvider to store contact cache encrypted with device key.
func NewContactCacheStore ¶
func NewContactCacheStore(g *libkb.GlobalContext) *ContactCacheStore
NewContactCacheStore creates new ContactCacheStore for global context. The store is used to securely store cached contact resolutions.
func (*ContactCacheStore) ClearCache ¶
func (s *ContactCacheStore) ClearCache(mctx libkb.MetaContext) error
func (*ContactCacheStore) RemoveContactsCacheEntries ¶
func (s *ContactCacheStore) RemoveContactsCacheEntries(mctx libkb.MetaContext, phone *keybase1.PhoneNumber, email *keybase1.EmailAddress)
RemoveContactsCachePhoneEntry removes cached lookup for phone number.
type ContactLookupKey ¶
type ContactLookupKey string
func MakeEmailLookupKey ¶
func MakeEmailLookupKey(e keybase1.EmailAddress) ContactLookupKey
func MakePhoneLookupKey ¶
func MakePhoneLookupKey(p keybase1.RawPhoneNumber) ContactLookupKey
type ContactLookupResult ¶
type ContactLookupResults ¶
type ContactLookupResults struct { Results map[ContactLookupKey]ContactLookupResult // Results provided - or not provided - by this provider // should are valid for the following amount of time: ResolvedFreshness time.Duration UnresolvedFreshness time.Duration }
func BulkLookupContacts ¶
func BulkLookupContacts(mctx libkb.MetaContext, emailsContacts []keybase1.EmailAddress, phoneNumberContacts []keybase1.RawPhoneNumber, userRegionCode keybase1.RegionCode) (res ContactLookupResults, err error)
func NewContactLookupResults ¶
func NewContactLookupResults() ContactLookupResults
func (*ContactLookupResults) FindComponent ¶
func (r *ContactLookupResults) FindComponent(component keybase1.ContactComponent) (res ContactLookupResult, found bool)
type ContactsProvider ¶
type ContactsProvider interface { LookupAll(libkb.MetaContext, []keybase1.EmailAddress, []keybase1.RawPhoneNumber, keybase1.RegionCode) (ContactLookupResults, error) FindUsernames(libkb.MetaContext, []keybase1.UID) (map[keybase1.UID]ContactUsernameAndFullName, error) FindFollowing(libkb.MetaContext, []keybase1.UID) (map[keybase1.UID]bool, error) }
type ErrorContactsProvider ¶
type ErrorContactsProvider struct {
// contains filtered or unexported fields
}
func (*ErrorContactsProvider) FindFollowing ¶
func (c *ErrorContactsProvider) FindFollowing(mctx libkb.MetaContext, uids []keybase1.UID) (map[keybase1.UID]bool, error)
func (*ErrorContactsProvider) FindUsernames ¶
func (c *ErrorContactsProvider) FindUsernames(mctx libkb.MetaContext, uids []keybase1.UID) (map[keybase1.UID]ContactUsernameAndFullName, error)
func (*ErrorContactsProvider) LookupAll ¶
func (c *ErrorContactsProvider) LookupAll(mctx libkb.MetaContext, emails []keybase1.EmailAddress, numbers []keybase1.RawPhoneNumber, userRegion keybase1.RegionCode) (ret ContactLookupResults, err error)
type MockContactsProvider ¶
type MockContactsProvider struct { T libkb.TestingTB PhoneNumbers map[keybase1.RawPhoneNumber]MockLookupUser PhoneNumberErrors map[keybase1.RawPhoneNumber]string Emails map[keybase1.EmailAddress]MockLookupUser Following map[keybase1.UID]bool }
func MakeMockProvider ¶
func MakeMockProvider(t libkb.TestingTB) *MockContactsProvider
func (*MockContactsProvider) FindFollowing ¶
func (c *MockContactsProvider) FindFollowing(mctx libkb.MetaContext, uids []keybase1.UID) (map[keybase1.UID]bool, error)
func (*MockContactsProvider) FindUsernames ¶
func (c *MockContactsProvider) FindUsernames(mctx libkb.MetaContext, uids []keybase1.UID) (map[keybase1.UID]ContactUsernameAndFullName, error)
func (*MockContactsProvider) LookupAll ¶
func (c *MockContactsProvider) LookupAll(mctx libkb.MetaContext, emails []keybase1.EmailAddress, numbers []keybase1.RawPhoneNumber, userRegion keybase1.RegionCode) (ContactLookupResults, error)
type MockLookupUser ¶
func MakeMockLookupUser ¶
func MakeMockLookupUser(username, fullname string) MockLookupUser
type SavedContactsStore ¶
type SavedContactsStore struct {
// contains filtered or unexported fields
}
func NewSavedContactsStore ¶
func NewSavedContactsStore(g *libkb.GlobalContext) *SavedContactsStore
NewSavedContactsStore creates a new SavedContactsStore for global context. The store is used to securely store list of resolved contacts.
func (*SavedContactsStore) RetrieveContacts ¶
func (s *SavedContactsStore) RetrieveContacts(mctx libkb.MetaContext) (ret []keybase1.ProcessedContact, err error)
func (*SavedContactsStore) SaveProcessedContacts ¶
func (s *SavedContactsStore) SaveProcessedContacts(mctx libkb.MetaContext, contacts []keybase1.ProcessedContact) (err error)
func (*SavedContactsStore) UnresolveContactsWithComponent ¶
func (s *SavedContactsStore) UnresolveContactsWithComponent(mctx libkb.MetaContext, phoneNumber *keybase1.PhoneNumber, email *keybase1.EmailAddress)