contacts

package
v5.0.0+incompatible Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const ContactResolutionEncryptionVersion = 1

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) (newlyResolved []keybase1.ProcessedContact, err error)

func ResolveContacts

func ResolveContacts(mctx libkb.MetaContext, provider ContactsProvider, contacts []keybase1.Contact) (res []keybase1.ProcessedContact, err error)

ResolveContacts resolves contacts with cache for UI. See API documentation in phone_numbers.avdl

func SendEncryptedContactResolutionToServer

func SendEncryptedContactResolutionToServer(mctx libkb.MetaContext,
	resolutions []ContactResolution) error

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) FindServiceMaps

func (*CachedContactsProvider) FindUsernames

func (*CachedContactsProvider) LookupAll

func (*CachedContactsProvider) LookupAllWithToken

func (c *CachedContactsProvider) LookupAllWithToken(mctx libkb.MetaContext, emails []keybase1.EmailAddress,
	numbers []keybase1.RawPhoneNumber, _ Token) (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
	Token               Token
}

func BulkLookupContacts

func BulkLookupContacts(mctx libkb.MetaContext, emailsContacts []keybase1.EmailAddress,
	phoneNumberContacts []keybase1.RawPhoneNumber, token Token) (res ContactLookupResults, err error)

func NewContactLookupResults

func NewContactLookupResults() ContactLookupResults

func (*ContactLookupResults) FindComponent

func (r *ContactLookupResults) FindComponent(component keybase1.ContactComponent) (res ContactLookupResult, found bool)

type ContactResolution

type ContactResolution struct {
	Description  string
	ResolvedUser keybase1.User
}

func DecryptContactBlob

func DecryptContactBlob(mctx libkb.MetaContext,
	contactResBlob string) (res ContactResolution, err error)

type ContactResolutionForEncryption

type ContactResolutionForEncryption struct {
	ContactResolution
	EncryptionVersion int
}

type ContactUsernameAndFullName

type ContactUsernameAndFullName struct {
	Username string
	Fullname string
}

type EncryptedContactResolution

type EncryptedContactResolution struct {
	Blob          []byte
	PukGeneration keybase1.PerUserKeyGeneration
}

type ErrorContactsProvider

type ErrorContactsProvider struct {
	NoFail bool
	T      libkb.TestingTB
}

func (*ErrorContactsProvider) FindFollowing

func (c *ErrorContactsProvider) FindFollowing(mctx libkb.MetaContext, uids []keybase1.UID) (map[keybase1.UID]bool, error)

func (*ErrorContactsProvider) FindServiceMaps

func (c *ErrorContactsProvider) FindServiceMaps(mctx libkb.MetaContext, uids []keybase1.UID) (map[keybase1.UID]libkb.UserServiceSummary, error)

func (*ErrorContactsProvider) FindUsernames

func (*ErrorContactsProvider) LookupAll

func (*ErrorContactsProvider) LookupAllWithToken

func (c *ErrorContactsProvider) LookupAllWithToken(mctx libkb.MetaContext, emails []keybase1.EmailAddress,
	numbers []keybase1.RawPhoneNumber, _ Token) (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) FindServiceMaps

func (c *MockContactsProvider) FindServiceMaps(mctx libkb.MetaContext, uids []keybase1.UID) (res map[keybase1.UID]libkb.UserServiceSummary, err error)

func (*MockContactsProvider) FindUsernames

func (*MockContactsProvider) LookupAll

func (*MockContactsProvider) LookupAllWithToken

func (c *MockContactsProvider) LookupAllWithToken(mctx libkb.MetaContext, emails []keybase1.EmailAddress,
	numbers []keybase1.RawPhoneNumber, _ Token) (ContactLookupResults, error)

type MockLookupUser

type MockLookupUser struct {
	UID        keybase1.UID
	Username   string
	Fullname   string
	ServiceMap libkb.UserServiceSummary
}

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) RetrieveAssertionToName

func (s *SavedContactsStore) RetrieveAssertionToName(mctx libkb.MetaContext) (ret map[string]string, err error)

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)

type Token

type Token string
const NoneToken Token = ""

Jump to

Keyboard shortcuts

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