user

package
v0.0.0-...-6333696 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2020 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUserAlreadyLoggedIn = errors.New("user already logged in")
	ErrInvalidUserName     = errors.New("invalid user name")
	ErrUserAlreadyPresent  = errors.New("user name already present")
	ErrUserNotLoggedIn     = errors.New("user not logged in")
	ErrInvalidPassword     = errors.New("invalid password")
)

Functions

This section is empty.

Types

type Address

type Address struct {
	AddressLine1 string `json:"address_line_1"`
	AddressLine2 string `json:"address_line_2"`
	State        string `json:"state/Province/Region"`
	ZipCode      string `json:"zip_code"`
}

type Contacts

type Contacts struct {
	Phone  string  `json:"phone_number"`
	Mobile string  `json:"mobile"`
	Addr   Address `json:"address"`
}

type Inbox

type Inbox struct {
	Entries []SharingEntry `json:"entries"`
}

type Info

type Info struct {
	// contains filtered or unexported fields
}

func (*Info) GetAccount

func (i *Info) GetAccount() *account.Account

func (*Info) GetFeed

func (i *Info) GetFeed() *feed.API

func (*Info) GetPod

func (i *Info) GetPod() *pod.Pod

func (*Info) GetPodName

func (i *Info) GetPodName() string

func (*Info) GetSessionId

func (i *Info) GetSessionId() string

func (*Info) GetUserName

func (i *Info) GetUserName() string

func (*Info) RemovePodName

func (i *Info) RemovePodName()

func (*Info) SetPodName

func (i *Info) SetPodName(podName string)

type Name

type Name struct {
	FirstName  string `json:"first_name"`
	MiddleName string `json:"middle_name"`
	LastName   string `json:"last_name"`
	SurName    string `json:"surname"`
}

type Outbox

type Outbox struct {
	Entries []SharingEntry `json:"entries"`
}

type ReceiveFileInfo

type ReceiveFileInfo struct {
	FileName       string `json:"name"`
	Size           string `json:"size"`
	BlockSize      string `json:"block_size"`
	NumberOfBlocks string `json:"number_of_blocks"`
	ContentType    string `json:"content_type"`
	Compression    string `json:"compression"`
	PodName        string `json:"pod_name"`
	FileMetaHash   string `json:"meta_ref"`
	Sender         string `json:"source_address"`
	Receiver       string `json:"dest_address"`
	SharedTime     string `json:"shared_time"`
}

type SharingEntry

type SharingEntry struct {
	FileName     string `json:"name"`
	PodName      string `json:"pod_name"`
	FileMetaHash string `json:"meta_ref"`
	Sender       string `json:"source_address"`
	Receiver     string `json:"dest_address"`
	SharedTime   string `json:"shared_time"`
}

type Stat

type Stat struct {
	Name      string `json:"name"`
	Reference string `json:"reference"`
}

type Users

type Users struct {
	// contains filtered or unexported fields
}

func NewUsers

func NewUsers(dataDir string, client blockstore.Client, logger logging.Logger) *Users

func (*Users) CreateNewUser

func (u *Users) CreateNewUser(userName, passPhrase, mnemonic, dataDir string, client blockstore.Client, response http.ResponseWriter, sessionId string) (string, string, *Info, error)

func (*Users) CreateRootFeeds

func (u *Users) CreateRootFeeds(userInfo *Info) error

func (*Users) CreateSettingsFeeds

func (u *Users) CreateSettingsFeeds(rootAddress utils.Address, userInfo *Info) error

func (*Users) CreateSharingFeeds

func (u *Users) CreateSharingFeeds(rootAddress utils.Address, userInfo *Info) error

func (*Users) DeleteUser

func (u *Users) DeleteUser(userName, dataDir, password, sessionId string, response http.ResponseWriter, ui *Info) error

func (*Users) ExportUser

func (u *Users) ExportUser(ui *Info) (string, string, error)

func (*Users) GetAvatar

func (u *Users) GetAvatar(userInfo *Info) ([]byte, error)

func (*Users) GetContacts

func (u *Users) GetContacts(userInfo *Info) (*Contacts, error)

func (*Users) GetLoggedInUserInfo

func (u *Users) GetLoggedInUserInfo(sessionId string) *Info

func (*Users) GetName

func (u *Users) GetName(userInfo *Info) (*Name, error)

func (*Users) GetSharingInbox

func (u *Users) GetSharingInbox(userInfo *Info) (*Inbox, error)

func (*Users) GetSharingOutbox

func (u *Users) GetSharingOutbox(userInfo *Info) (*Outbox, error)

func (*Users) GetUserStat

func (u *Users) GetUserStat(userInfo *Info) (*Stat, error)

func (*Users) ImportUsingAddress

func (u *Users) ImportUsingAddress(userName, passPhrase, addressString, dataDir string, client blockstore.Client, response http.ResponseWriter, sessionId string) error

func (*Users) IsUserLoggedIn

func (u *Users) IsUserLoggedIn(sessionId string) bool

func (*Users) IsUserNameLoggedIn

func (u *Users) IsUserNameLoggedIn(userName string) bool

func (*Users) IsUsernameAvailable

func (u *Users) IsUsernameAvailable(userName string, dataDir string) bool

func (*Users) ListAllUsers

func (u *Users) ListAllUsers(dataDir string) []string

func (*Users) Login

func (u *Users) Login(ui *Info, response http.ResponseWriter) error

func (*Users) LoginUser

func (u *Users) LoginUser(userName, passPhrase, dataDir string, client blockstore.Client, response http.ResponseWriter, sessionId string) error

func (*Users) Logout

func (u *Users) Logout(sessionId string, response http.ResponseWriter) error

func (*Users) LogoutUser

func (u *Users) LogoutUser(userName, dataDir, sessionId string, response http.ResponseWriter) error

func (*Users) ReceiveFileFromUser

func (u *Users) ReceiveFileFromUser(podName string, sharingRef utils.SharingReference, userInfo *Info, pod *pod.Pod, podDir string) (string, string, error)

func (*Users) ReceiveFileInfo

func (u *Users) ReceiveFileInfo(podName string, sharingRef utils.SharingReference, userInfo *Info, pod *pod.Pod) (*ReceiveFileInfo, error)

func (*Users) SaveAvatar

func (u *Users) SaveAvatar(avatar []byte, userInfo *Info) error

func (*Users) SaveContacts

func (u *Users) SaveContacts(phone, mobile string, address *Address, userInfo *Info) error

func (*Users) SaveName

func (u *Users) SaveName(firstName, lastName, middleName, surName string, userInfo *Info) error

func (*Users) ShareFileWithUser

func (u *Users) ShareFileWithUser(podName, podFilePath, destinationRef string, userInfo *Info, pod *pod.Pod) (string, error)

Jump to

Keyboard shortcuts

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