Documentation ¶
Index ¶
- Constants
- func NewGenesisProfile(password string) error
- func ProfilesExist() (bool, error)
- type CipherType
- type NonceType
- type Profile
- type SecretBoxCipher
- type Session
- func (s *Session) AddPeerToHandshake(body []byte) (bool, error)
- func (s *Session) Close() error
- func (s *Session) GetChatlog(chatID string) (chatLog, error)
- func (s *Session) GetHandshakePeerConfig(sortNumber int) ([]byte, error)
- func (s *Session) GetHandshakePeerTotal() int
- func (s *Session) GetMyPeerID(chatID string) (string, error)
- func (s *Session) GetProfile() Profile
- func (s *Session) ListChats() ([]byte, error)
- func (s *Session) NewChat() (string, error)
- func (s *Session) NewInitiatorWithDefaults()
- func (s *Session) NewPeerWithDefaults()
- func (s *Session) RetrieveMessages(chatID string) ([]byte, error)
- func (s *Session) SendMessage(chatID string, b []byte) ([]byte, error)
- func (s *Session) ShareHandshakePosition() (b []byte, err error)
- type SessionOptions
- type StorageEngine
- type StorageOptions
Constants ¶
const ( // DefaultSessionTTL is the default TTL before a Session closes DefaultSessionTTL = 15 * 60 // 15 minutes in seconds // DefaultMaxLoginAttempts is the number of times failed login attempts are allowed DefaultMaxLoginAttempts = 10 )
const (
// Version is the hard coded version of handshake-core running
Version = "0.0.1"
)
Variables ¶
This section is empty.
Functions ¶
func NewGenesisProfile ¶
NewGenesisProfile takes password and
func ProfilesExist ¶
ProfilesExist configures a storage engine and checks `profilesExist`. It returns a bool and error. This is used on app startup to check to see if this is the first time running the tool. If this function returns `false` and no errors, the next step would be to prompt the user to setup a new profile using `NewGenesisProfile()`.
Types ¶
type CipherType ¶
type CipherType int
CipherType is used for type enumeration of Ciphers
const ( // SecretBox is a CipherType SecretBox CipherType = iota )
type Profile ¶
Profile represents a profile that has been accessed this would contain successfully decrypted profile data
type SecretBoxCipher ¶
SecretBoxCipher is a struct and method set that conforms to the Cipher interface. This is the primary cipher used for all blob encryption and decryption for handshake
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
Session is the primary struct for a logged in user. It holds the profile data as well as settings information
func NewDefaultSession ¶
NewDefaultSession is a wrapper around NewSession and applies simple defaults. This is intended to be used by the reference apps.
func NewSession ¶
func NewSession(password string, opts SessionOptions) (*Session, error)
NewSession takes a password and opts and returns a pointer to Session and an error
func (*Session) AddPeerToHandshake ¶
AddPeerToHandshake takes a json encoded peerConfig, attempts to unmarshal it and add it as a peer. It returns a bool and an error. The bool indicates if handshake.AllPeersReceived == true, in which case the handshake can safely be conversted int a chat.
func (*Session) GetChatlog ¶
func (*Session) GetHandshakePeerConfig ¶
GetHandshakePeerConfig returns the json bytes encoded peerConfig based on peerID or and an error
func (*Session) GetHandshakePeerTotal ¶
GetHandshakePeerTotal returns an int count of the number of peers to expect for a handshake
func (*Session) GetMyPeerID ¶
GetMyPeerID returns a string of the profile user's peerID for a specific chat, returns the peerID and an error
func (*Session) GetProfile ¶
GetProfile returns the profile in the Session struct
func (*Session) NewChat ¶
NewChat creates a new chat from the activeHandshake and returns a chat ID string and error. If the chat is successfully created, it deletes the contents of the activeHandshake
func (*Session) NewInitiatorWithDefaults ¶
func (s *Session) NewInitiatorWithDefaults()
NewInitiatorWithDefaults provides a simple method with no arguments to create a default handshake for an initiator. Adds this handshake pointer to the ActiveHandshake in the session.
func (*Session) NewPeerWithDefaults ¶
func (s *Session) NewPeerWithDefaults()
NewPeerWithDefaults provides a simple method with no arguments to create a default handshake for an peer. Adds this handshake pointer to the ActiveHandshake in the session.
func (*Session) RetrieveMessages ¶
RetrieveMessages takes a chatID and initiates the retrieval process for all peers it returns a json encoded chatLogList and error
func (*Session) SendMessage ¶
SendMessage takes a chatID and message bytes and submits the message to the message storage and rendezvous point. It returns a json encoded chatLogList and error
func (*Session) ShareHandshakePosition ¶
ShareHandshakePosition returns the values from negotiator.Share() from the ActiveHandshake
type SessionOptions ¶
type SessionOptions struct { StorageEngine StorageEngine StorageFilePath string }
SessionOptions holds session options for initialization
type StorageEngine ¶
type StorageEngine int
StorageEngine type for enum
const ( // BoltEngine is the default storage engine for device storage BoltEngine StorageEngine = iota // HashmapEngine is the default Rendezvous storage type HashmapEngine // IPFSEngine is the default message storage type IPFSEngine )
type StorageOptions ¶
type StorageOptions struct { Engine StorageEngine FilePath string Signatures []signatureAlgorithm ReadNodes []node WriteNodes []node ReadRule consensusRule WriteRule consensusRule }
StorageOptions are used to pass in initialization settings