wallet

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2018 License: MIT Imports: 50 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultPointerPrefixLength = 14
)

Variables

View Source
var ErrNoCafeHost = errors.New("cafe host address is not set")
View Source
var ErrOffline = errors.New("node is offline")
View Source
var ErrStarted = errors.New("node is started")
View Source
var ErrStopped = errors.New("node is stopped")
View Source
var ErrThreadLoaded = errors.New("thread is loaded")

Functions

This section is empty.

Types

type AddDataResult

type AddDataResult struct {
	Id      string          `json:"id"`
	Key     string          `json:"key"`
	Archive *client.Archive `json:"archive,omitempty"`
}

AddDataResult wraps added data content id and key

type Config

type Config struct {
	Version  string
	RepoPath string
	Mnemonic *string

	SwarmPorts string

	IsMobile bool
	IsServer bool

	CafeAddr string
}

type Contact

type Contact struct {
	Id        string   `json:"id"`
	Pk        string   `json:"pk"`
	ThreadIds []string `json:"thread_ids"`
}

Contact is wrapper around Peer, with thread info

type Overview

type Overview struct {
	SwarmSize    int `json:"swarm_size"`
	DeviceCount  int `json:"device_count"`
	ThreadCount  int `json:"thread_count"`
	PhotoCount   int `json:"photo_count"`
	ContactCount int `json:"contact_count"`
}

Overview is a wallet overview object

type Profile

type Profile struct {
	Id       string `json:"id"`
	Username string `json:"username,omitempty"`
	AvatarId string `json:"avatar_id,omitempty"`
}

type Update

type Update struct {
	Id   string     `json:"id"`
	Name string     `json:"name"`
	Type UpdateType `json:"type"`
}

type UpdateType

type UpdateType int
const (
	ThreadAdded UpdateType = iota
	ThreadRemoved
	DeviceAdded
	DeviceRemoved
)

type Wallet

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

Wallet is the main Textile node structure

func NewWallet

func NewWallet(config Config) (*Wallet, string, error)

func (*Wallet) AcceptExternalThreadInvite

func (w *Wallet) AcceptExternalThreadInvite(blockId string, key []byte) (mh.Multihash, error)

AcceptExternalThreadInvite attemps to download an encrypted thread key from an external invite, add the thread, and notify the inviter of the join

func (*Wallet) AcceptThreadInvite

func (w *Wallet) AcceptThreadInvite(blockId string) (mh.Multihash, error)

AcceptThreadInvite attemps to download an encrypted thread key from an internal invite, add the thread, and notify the inviter of the join

func (*Wallet) AcceptThreadInviteViaNotification

func (w *Wallet) AcceptThreadInviteViaNotification(id string) (mh.Multihash, error)

AcceptThreadInviteViaNotification uses an invite notification to accept an invite to a thread

func (*Wallet) AddDevice

func (w *Wallet) AddDevice(name string, pk libp2pc.PubKey) error

AddDevice creates an invite for every current and future thread

func (*Wallet) AddPhoto

func (w *Wallet) AddPhoto(path string) (*AddDataResult, error)

AddPhoto add a photo to the local ipfs node

func (*Wallet) AddThread

func (w *Wallet) AddThread(name string, secret libp2pc.PrivKey, join bool) (*thread.Thread, error)

AddThread adds a thread with a given name and secret key

func (*Wallet) ConnectPeer

func (w *Wallet) ConnectPeer(addrs []string) ([]string, error)

ConnectPeer connect to another ipfs peer (i.e., ipfs swarm connect)

func (*Wallet) ContactThreads

func (w *Wallet) ContactThreads(id string) []*thread.Thread

ContactThreads returns all threads with the given peer

func (*Wallet) Contacts

func (w *Wallet) Contacts() []*Contact

GetContacts returns all contacts this peer has interacted with

func (*Wallet) CountUnreadNotifications

func (w *Wallet) CountUnreadNotifications() int

CountUnreadNotifications counts unread notifications

func (*Wallet) CreateReferral

func (w *Wallet) CreateReferral(req *cmodels.ReferralRequest) (*cmodels.ReferralResponse, error)

CreateReferral requests a referral from a cafe via key

func (*Wallet) Devices

func (w *Wallet) Devices() []repo.Device

Devices lists all devices

func (*Wallet) Done

func (w *Wallet) Done() <-chan struct{}

func (*Wallet) FetchMessages

func (w *Wallet) FetchMessages() error

func (*Wallet) GetAvatarId

func (w *Wallet) GetAvatarId() (*string, error)

GetAvatarId returns the current user's avatar id, which will be the id of a photo

func (*Wallet) GetBlock

func (w *Wallet) GetBlock(id string) (*repo.Block, error)

GetBlock searches for a local block associated with the given target

func (*Wallet) GetBlockByDataId

func (w *Wallet) GetBlockByDataId(dataId string) (*repo.Block, error)

GetBlockByDataId searches for a local block associated with the given data id

func (*Wallet) GetCafeAddr

func (w *Wallet) GetCafeAddr() string

GetCafeAddr returns the cafe address if set

func (*Wallet) GetCafeApiAddr

func (w *Wallet) GetCafeApiAddr() string

GetCafeApiAddr returns the cafe address if set

func (*Wallet) GetDataAtPath

func (w *Wallet) GetDataAtPath(path string) ([]byte, error)

GetDataAtPath returns raw data behind an ipfs path

func (*Wallet) GetId

func (w *Wallet) GetId() (string, error)

GetId returns peer id

func (*Wallet) GetNotifications

func (w *Wallet) GetNotifications(offset string, limit int) []repo.Notification

GetNotifications lists notifications

func (*Wallet) GetPeerStatus

func (w *Wallet) GetPeerStatus(peerId string) (string, error)

func (*Wallet) GetPhotoKey

func (w *Wallet) GetPhotoKey(id string) (string, error)

GetPhotoKey returns a the decrypted AES key for a photo set

func (*Wallet) GetPrivKey

func (w *Wallet) GetPrivKey() (libp2pc.PrivKey, error)

GetPrivKey returns the current user's master secret key

func (*Wallet) GetProfile

func (w *Wallet) GetProfile(peerId string) (*Profile, error)

GetProfile return a model representation of a peer profile

func (*Wallet) GetPubKey

func (w *Wallet) GetPubKey() (libp2pc.PubKey, error)

GetPubKey returns the current user's master public key

func (*Wallet) GetPubKeyString

func (w *Wallet) GetPubKeyString() (string, error)

GetPubKeyString returns the base64 encoded public ipfs peer key

func (*Wallet) GetRepoPath

func (w *Wallet) GetRepoPath() string

func (*Wallet) GetThread

func (w *Wallet) GetThread(id string) (*int, *thread.Thread)

GetThread get a thread by id from loaded threads

func (*Wallet) GetTokens

func (w *Wallet) GetTokens(forceRefresh bool) (*repo.CafeTokens, error)

GetTokens returns cafe json web tokens, refreshing if needed or if forceRefresh is true

func (*Wallet) GetUsername

func (w *Wallet) GetUsername() (*string, error)

GetUsername returns the current user's username

func (*Wallet) InviteDevices

func (w *Wallet) InviteDevices(thrd *thread.Thread) error

InviteDevices sends a thread invite to all devices

func (*Wallet) Ipfs

func (w *Wallet) Ipfs() *core.IpfsNode

func (*Wallet) IsOnline

func (w *Wallet) IsOnline() bool

func (*Wallet) IsSignedIn

func (w *Wallet) IsSignedIn() (bool, error)

IsSignedIn returns whether or not a user is signed in

func (*Wallet) ListReferrals

func (w *Wallet) ListReferrals(key string) (*cmodels.ReferralResponse, error)

ListReferrals lists existing referrals from a cafe via key

func (*Wallet) NewEnvelope

func (w *Wallet) NewEnvelope(message *pb.Message) (*pb.Envelope, error)

func (*Wallet) Notifications

func (w *Wallet) Notifications() <-chan repo.Notification

func (*Wallet) Online

func (w *Wallet) Online() <-chan struct{}

func (*Wallet) Overview

func (w *Wallet) Overview() (*Overview, error)

Overview returns an overview object

func (*Wallet) Peers

func (w *Wallet) Peers() ([]libp2pn.Conn, error)

func (*Wallet) PhotoThreads

func (w *Wallet) PhotoThreads(id string) []*thread.Thread

PhotoThreads lists threads which contain a photo (known to the local peer)

func (*Wallet) PingPeer

func (w *Wallet) PingPeer(addrs string, num int, out chan string) error

PingPeer pings a peer num times, returning the result to out chan

func (*Wallet) PublishProfile

func (w *Wallet) PublishProfile(prof *Profile) (*util.IpnsEntry, error)

PublishProfile publishes the peer profile to ipns

func (*Wallet) ReadAllNotifications

func (w *Wallet) ReadAllNotifications() error

ReadAllNotifications marks all notification as read

func (*Wallet) ReadNotification

func (w *Wallet) ReadNotification(id string) error

ReadNotification marks a notification as read

func (*Wallet) RemoveDevice

func (w *Wallet) RemoveDevice(id string) error

RemoveDevice removes a device

func (*Wallet) RemoveThread

func (w *Wallet) RemoveThread(id string) (mh.Multihash, error)

RemoveThread removes a thread

func (*Wallet) ResolveProfile

func (w *Wallet) ResolveProfile(name string) (*path.Path, error)

ResolveProfile looks up a peer's profile on ipns

func (*Wallet) SendMessage

func (w *Wallet) SendMessage(env *pb.Envelope, peerId string, hash *string) error

func (*Wallet) SetAvatarId

func (w *Wallet) SetAvatarId(id string) error

SetAvatarId updates profile at our peer id with new avatar address

func (*Wallet) SignIn

func (w *Wallet) SignIn(creds *cmodels.Credentials) error

SignIn requests a token with a username from a cafe and saves them locally

func (*Wallet) SignOut

func (w *Wallet) SignOut() error

SignOut deletes the locally saved user info (username and tokens)

func (*Wallet) SignUp

func (w *Wallet) SignUp(reg *cmodels.Registration) error

SignUp requests a new username and token from a cafe and saves them locally

func (*Wallet) Start

func (w *Wallet) Start() error

Start

func (*Wallet) Started

func (w *Wallet) Started() bool

func (*Wallet) Stop

func (w *Wallet) Stop() error

Stop the node

func (*Wallet) ThreadInfo

func (w *Wallet) ThreadInfo(id string) (*thread.Info, error)

ThreadInfo gets thread info

func (*Wallet) ThreadUpdates

func (w *Wallet) ThreadUpdates() <-chan thread.Update

func (*Wallet) Threads

func (w *Wallet) Threads() []*thread.Thread

Threads lists loaded threads

func (*Wallet) Updates

func (w *Wallet) Updates() <-chan Update

func (*Wallet) VerifyEnvelope

func (w *Wallet) VerifyEnvelope(env *pb.Envelope) error

func (*Wallet) Version

func (w *Wallet) Version() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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