contacts

package
v4.3.1+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 13, 2019 License: BSD-3-Clause, BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

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 (*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

type ContactLookupResult

type ContactLookupResult struct {
	UID     keybase1.UID `json:"uid,omitempty"`
	Coerced string       `json:"coerced,omitempty"`
	Error   string       `json:"err,omitempty"`
}

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 ContactUsernameAndFullName

type ContactUsernameAndFullName struct {
	Username string
	Fullname string
}

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 (*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 (*MockContactsProvider) LookupAll

type MockLookupUser

type MockLookupUser struct {
	UID      keybase1.UID
	Username string
	Fullname string
}

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)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL