panthalassa

package module
v0.0.0-...-32f009b Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2018 License: MIT Imports: 39 Imported by: 0

README

panthalassa

standard-readme compliant Build Status (Develop) Build Status (Master)

Backend for Pangea

TODO: Fill out this long description.

Table of Contents

Security

If you find a bug / vulnerability please DO NOT open an issue. Write to security@bitnation.co PLEASE use this PGP key to encrypt your report / email.

Background

Pangea is the mobile interface to our blockchain jurisdiction. While smart contract's are "onchain" (on a blockchain like Ethereum) communication happens offchain. Since current chat systems like WhatsApp and Telegram are hevaly centralized, we are using a p2p system to send messages between peers to avoid Bitnaiton becoming a central point of failure. We are using libp2p developed by Protocol Laboratories for the p2p network.

Install

First clone the project. You can run the commands from the Usage section.

Usage

We are using GX as the dependency manager since libp2p (and almost all go projects from Protocol Labs) use it as the dependecny manager. However, you don't need to pay attention to it, since you just have to use the make file. The following commands are available:

  • make list (or just make) will list all commands from the Makefile.
  • make deps will fetch tools that you need in order to work with the project.
  • make install will install all dependencies needed in order to work with the project.
  • make deps_hack will "hack" your dependencies. GX rewrites your import paths github.com/libp2p/go-libp2p e.g. becomes gx/ipfs/QmNh1kGFFdsPu79KNSaL4NUKUPb4Eiz4KHdMtFY6664RDp/go-libp2p. You need this in order to work with the package versions specified in the package.json.
  • make deps_hack_revert will undo make deps_hack. We never want to commit the GX import paths.
  • make deps_mobile will install some tools needed to build panthalassa for mobile. You need to run this before you can build for ios and android.
  • make ios will build panthalassa for ios and place it in the build folder.
  • make android will build panthalassa for android and place it in the build folder.
  • make test will format the code and run all tests.
  • make test_coverage will test the code and open the coverage report.

API

TODO - add link to godoc.org

Maintainers

@borjantrajanoski

Contribute

Pull requests are accepted.

Small note: If editing the README, please conform to the standard-readme specifications.

License

MIT © 2018 BITNATION

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddUsersToGroupChat

func AddUsersToGroupChat(users string, chatID int) error

func AllChats

func AllChats() (string, error)

func Call

func Call(command, payload string) (string, error)

func CallDAppFunction

func CallDAppFunction(signingKey string, id int, args string) error

func ConnectLogger

func ConnectLogger(address string) error

func ConnectToDAppDevHost

func ConnectToDAppDevHost(address string) error

connect the host to DApp development server

func CreateGroupChat

func CreateGroupChat(users string, name string) (int, error)

return chatID

func CreatePrivateChat

func CreatePrivateChat(partnerStr string) (int, error)

func DApps

func DApps() (string, error)

func EthAddress

func EthAddress() (string, error)

func EthPrivateKey

func EthPrivateKey() (string, error)

Eth Private key

func EthPubToAddress

func EthPubToAddress(pub string) (string, error)

converts an ethereum public key to address

func ExportAccountStore

func ExportAccountStore(pw, pwConfirm string) (string, error)

Export the current account store with given password

func GetIdentityPublicKey

func GetIdentityPublicKey() (string, error)

fetch the identity public key of the

func GetMnemonic

func GetMnemonic() (string, error)

func IdentityPublicKey

func IdentityPublicKey() (string, error)

func IsValidMnemonic

func IsValidMnemonic(mne string) bool

Check if mnemonic is valid

func MarkMessagesAsRead

func MarkMessagesAsRead(chatID int) error

func Messages

func Messages(chatID int, startStr string, amount int) (string, error)

func NewAccountKeys

func NewAccountKeys(pw, pwConfirm string) (string, error)

Creates an new set of encrypted account key's

func NewAccountKeysFromMnemonic

func NewAccountKeysFromMnemonic(mne, pw, pwConfirm string) (string, error)

Create new account store from mnemonic This can e.g. be used in case you need to recover your account

func OpenDApp

func OpenDApp(id, context string) error

func RegisterContactCalls

func RegisterContactCalls(dcr *dyncall.Registry, dbInstance *storm.DB) error

func RegisterDocumentCalls

func RegisterDocumentCalls(dcr *dyncall.Registry, docStorage *documents.Storage, km *keyManager.KeyManager) error

func RenderMessage

func RenderMessage(signingKey, payload string) (string, error)

func SendMessage

func SendMessage(chatID int, message string) error

func SendResponse

func SendResponse(id string, data string, responseError string, timeout int) error

func SetLogger

func SetLogger(level string) error

func SignProfile

func SignProfile(name, location, image string) (string, error)

func SignProfileStandAlone

func SignProfileStandAlone(name, location, image, keyManagerStore, password string) (string, error)

sign profile

func Start

func Start(dbDir, config, password string, client, uiUpstream UpStream) error

start panthalassa

func StartDApp

func StartDApp(dAppSingingKeyStr string, timeout int) error

func StartFromMnemonic

func StartFromMnemonic(dbDir, config, mnemonic string, client, uiUpstream UpStream) error

create a new panthalassa instance with the mnemonic

func Stop

func Stop() error

Stop panthalassa

func StopDApp

func StopDApp(dAppSingingKeyStr string) error

Types

type Panthalassa

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

func (*Panthalassa) AddContact

func (p *Panthalassa) AddContact(pubKey string) error

add friend to peer store

func (*Panthalassa) Export

func (p *Panthalassa) Export(pw, pwConfirm string) (string, error)

Export account with the given password

func (*Panthalassa) Stop

func (p *Panthalassa) Stop() error

Stop the panthalassa instance this becomes interesting when we start to use the mesh network

type StartConfig

type StartConfig struct {
	EncryptedKeyManager string `json:"encrypted_key_manager"`
	SignedProfile       string `json:"signed_profile"`
	EthWsEndpoint       string `json:"eth_ws_endpoint"`
	EnableDebugging     bool   `json:"enable_debugging"`
	PrivChatEndpoint    string `json:"private_chat_endpoint"`
	PrivChatBearerToken string `json:"private_chat_bearer_token"`
}

type UpStream

type UpStream interface {
	Send(data string)
}

Jump to

Keyboard shortcuts

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