Documentation ¶
Index ¶
- func FilePreview(filename string, password string) ([]byte, error)
- func GetMessagePreview(peer *Peer, dbFile string, dbId int64, password string) ([]byte, error)
- func InternalUserMessagePreview(msg *InternalUserMessage, password string) ([]byte, error)
- func ProcessForOutput(usermessage *meowlib.UserMessage, peer *Peer, servers *ServerList, ...) ([]byte, error)
- func ProcessOutboundTextMessage(peer *Peer, text string, srv *Server) ([]byte, error)
- func StoreMessage(peer *Peer, usermessage *meowlib.UserMessage, filenames []string, ...) error
- func UserMessageToDbMessage(outbound bool, um *meowlib.UserMessage, filepaths []string) *meowlib.DbMessage
- type BackgroundJob
- type Config
- func (c *Config) Clean()
- func (c *Config) GetIdentity() *Identity
- func (c *Config) GetMemPass() string
- func (c *Config) Load(filename string) error
- func (c *Config) Save(filename string) error
- func (c *Config) SaveIdentity() error
- func (c *Config) SetIdentity(id *Identity)
- func (c *Config) SetMemPass(pass string)
- type Identity
- func (id *Identity) AnswerInvitation(MyName string, ContactName string, MessageServerIdxs []string, ...) *Peer
- func (id *Identity) CheckInvitation(ReceivedContact *meowlib.ContactCard) (isAnswer bool, proposedNick string, receivedNick string, ...)
- func (id *Identity) CreateFolder() error
- func (id *Identity) FinalizeInvitation(ReceivedContact *meowlib.ContactCard) error
- func (id *Identity) GetRequestJobs() []*RequestsJob
- func (id *Identity) HidePeer(peerIdx int, password string) error
- func (id *Identity) InvitePeer(MyName string, ContactName string, MessageServerUids []string, ...) (*Peer, error)
- func (id *Identity) Save() error
- func (id *Identity) SaveBackgroundJob() error
- func (id *Identity) TryUnlockHidden(password string) error
- func (id *Identity) WipeFolder() error
- type InternalUserMessage
- func DbMessageToInternalUserMessage(id int64, dbFile string, dbm *meowlib.DbMessage) *InternalUserMessage
- func GetMessagesHistory(peer *Peer, inAppMsgCount int, lastDbId int, wantMore int, password string) ([]InternalUserMessage, error)
- func GetNewMessages(peer *Peer, lastDbId int, password string) ([]*InternalUserMessage, error)
- func InternalUserMessageFromUserMessage(peer *Peer, msg *meowlib.UserMessage) *InternalUserMessage
- type Peer
- func (p *Peer) AsymDecryptMessage(Message []byte, Signature []byte) (DecryptedMessage []byte, err error)
- func (p *Peer) AsymEncryptMessage(Message []byte) (*meowlib.EncryptedMessage, error)
- func (p *Peer) BuildInvitationAnswerMessage(myContactCard *meowlib.ContactCard) (*meowlib.UserMessage, error)
- func (p *Peer) BuildSimpleUserMessage(message []byte) (*meowlib.UserMessage, error)
- func (p *Peer) BuildSingleFileMessage(filename string, message []byte) ([]meowlib.UserMessage, error)
- func (p *Peer) DeserializeUserMessage(data []byte) (*meowlib.UserMessage, error)
- func (p *Peer) GetContact() *meowlib.ContactCard
- func (p *Peer) GetConversationRequest() *meowlib.ConversationRequest
- func (p *Peer) GetDbPassword() string
- func (p *Peer) GetFilePreview(filename string) ([]byte, error)
- func (p *Peer) GetLastMessageUuid(msg []byte)
- func (p *Peer) GetMyContact() *meowlib.ContactCard
- func (p *Peer) InvitationPending() bool
- func (p *Peer) LoadMessage(uid string) (*InternalUserMessage, error)
- func (p *Peer) LoadMessagesHistory(alreadyLoadedCount int, oldestMessageId int, qty int) ([]InternalUserMessage, error)
- func (p *Peer) LoadNewMessages(lastMessageId int) ([]*InternalUserMessage, error)
- func (p *Peer) PackUserMessage(message []byte, signature []byte) *meowlib.PackedUserMessage
- func (p *Peer) ProcessInboundUserMessage(message []byte, signature []byte) (*meowlib.UserMessage, error)
- func (p *Peer) ProcessOutboundUserMessage(usermessage *meowlib.UserMessage) (*meowlib.PackedUserMessage, error)
- func (p *Peer) SerializeUserMessage(msg *meowlib.UserMessage) ([]byte, error)
- func (p *Peer) SetDbPassword(password string)
- func (p *Peer) StoreMessage(msg *meowlib.UserMessage, filenames []string) error
- func (p *Peer) UnPackUserMessage(protoPackedMessage []byte) (payload []byte, signature []byte, err error)
- func (p *Peer) UpdateMessage(msg InternalUserMessage) error
- type PeerList
- func (pl *PeerList) GetConversationRequests() []*meowlib.ConversationRequest
- func (pl *PeerList) GetFromInvitationId(invitationId string) *Peer
- func (pl *PeerList) GetFromMyLookupKey(publickey string) *Peer
- func (pl *PeerList) GetFromName(name string) *Peer
- func (pl *PeerList) GetFromPublicKey(publickey string) *Peer
- type RequestsJob
- type Server
- func (ints *Server) AsymDecryptMessage(Message []byte, Signature []byte) (DecryptedMessage []byte, err error)
- func (ints *Server) AsymEncryptMessage(Message []byte) (*meowlib.EncryptedMessage, error)
- func (ints *Server) BuildMessageRequestMessage(lookupKeys []string) ([]byte, error)
- func (ints *Server) BuildMessageSendingMessage(usermsg *meowlib.PackedUserMessage) ([]byte, error)
- func (ints *Server) BuildToServerMessageFromUserMessage(usermsg *meowlib.PackedUserMessage) *meowlib.ToServerMessage
- func (ints *Server) BuildToServerMessageInvitationAnswer(invitationAnswer *meowlib.PackedUserMessage, myPublicKeyForThatPeer string, ...) (*meowlib.ToServerMessage, error)
- func (ints *Server) BuildToServerMessageInvitationAnswerRequest(invitationId string) (*meowlib.ToServerMessage, error)
- func (ints *Server) BuildToServerMessageInvitationCreation(invitation *meowlib.ContactCard, password string, timeout int, ...) (*meowlib.ToServerMessage, error)
- func (ints *Server) BuildToServerMessageInvitationRequest(shortcode string, password string) (*meowlib.ToServerMessage, error)
- func (sc *Server) GetMeowUrl() string
- func (ints *Server) GetServerCard() *meowlib.ServerCard
- func (sc *Server) GetUid() string
- func (ints *Server) PackServerMessage(payload []byte, signature []byte) (protoPackedMessage []byte, err error)
- func (srv *Server) ProcessInboundServerResponse(msg []byte) (*meowlib.FromServerMessage, error)
- func (srv *Server) ProcessOutboundMessage(toServerMessage *meowlib.ToServerMessage) ([]byte, error)
- func (ints *Server) UnPackServerMessage(protoPackedMessage []byte) (payload []byte, signature []byte, err error)
- type ServerList
- type ServerStorage
- func (ss *ServerStorage) DeleteServer(uid string) error
- func (ss *ServerStorage) LoadAllServerCards() ([]*meowlib.ServerCard, error)
- func (ss *ServerStorage) LoadAllServers() ([]*Server, error)
- func (ss *ServerStorage) LoadServer(uid string) (*Server, error)
- func (ss *ServerStorage) LoadServerCardsFromUids(uids []string) ([]*meowlib.ServerCard, error)
- func (ss *ServerStorage) LoadServersFromUids(uids []string) ([]*Server, error)
- func (ss *ServerStorage) StoreServer(sc *Server) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetMessagePreview ¶
Get old messages from a peer
func InternalUserMessagePreview ¶
func InternalUserMessagePreview(msg *InternalUserMessage, password string) ([]byte, error)
make an image from the files content (loads the first image, or build a more complex view)
func ProcessForOutput ¶
func ProcessForOutput(usermessage *meowlib.UserMessage, peer *Peer, servers *ServerList, trackingLookupKey string) ([]byte, error)
func StoreMessage ¶
func UserMessageToDbMessage ¶
Types ¶
type BackgroundJob ¶
type BackgroundJob struct { RootPublic string `json:"root_public,omitempty"` Device meowlib.KeyPair `json:"device,omitempty"` Jobs []*RequestsJob `json:"jobs,omitempty"` }
type Config ¶
type Config struct { // UserConfig SavePassword bool `json:"save_password,omitempty"` SavedPassword string `json:"saved_password,omitempty"` PasswordTip string `json:"password_tip,omitempty"` PasswordTipUnlock string `json:"password_tip_unlock,omitempty"` // Technical IdentityFile string `json:"identity_file,omitempty"` StoragePath string `json:"storage_path,omitempty"` MaxIdsPerUser int `json:"max_ids_per_user,omitempty"` MsgDbRollingPeriod int `json:"msg_db_rolling_period,omitempty"` Chunksize int64 `json:"chunksize,omitempty"` DbSize int `json:"db_size,omitempty"` UserAgent string `json:"user_agent,omitempty"` // Network ServerPollInterval int `json:"server_poll_interval,omitempty"` HttpTimeOut int `json:"http_timeout,omitempty"` HttpLongPoll int `json:"http_long_poll,omitempty"` // GUI LastOpenChat string `json:"last_open_chat,omitempty"` SoundNotificationEnable bool `json:"sound_notification_enable,omitempty"` DefaultNotificationSound string `json:"default_notification_sound,omitempty"` NotificationVibeEnable bool `json:"notification_vibe_enable,omitempty"` DefaultNotificationVibe string `json:"default_notification_vibe,omitempty"` NotificationLEDEnable bool `json:"notification_led_enable,omitempty"` DefaultNotificationLEDColor string `json:"default_notification_led_color,omitempty"` VisualNotificationEnable bool `json:"visual_notification_enable,omitempty"` VisualNotificationModes string `json:"visual_notifiaction_modes,omitempty"` PrivateChatNotificationsEnable bool `json:"private_chat_notifiactions_enable,omitempty"` GroupChatNotificationsEnable bool `json:"group_chat_notifiactions_enable,omitempty"` ChannelNotificationsEnable bool `json:"channel_notifications_enable,omitempty"` Language string `json:"language,omitempty"` Theme string `json:"theme,omitempty"` FingerprintEnable bool `json:"fingerprint_enable,omitempty"` ShowFavoriteContacts bool `json:"show_favorite_contacts,omitempty"` NightModeEnable bool `json:"night_mode_enable,omitempty"` // Debug DbSuffix string `json:"db_suffix,omitempty"` // contains filtered or unexported fields }
func (*Config) GetIdentity ¶
func (*Config) GetMemPass ¶
func (*Config) SaveIdentity ¶
func (*Config) SetIdentity ¶
func (*Config) SetMemPass ¶
type Identity ¶
type Identity struct { Nickname string `json:"nickname,omitempty"` DefaultAvatar string `json:"default_avatar,omitempty"` RootKp meowlib.KeyPair `json:"id_kp,omitempty"` Status string `json:"status,omitempty"` Peers PeerList `json:"peers,omitempty"` HiddenPeers [][]byte `json:"hidden_peers,omitempty"` Device meowlib.KeyPair `json:"device,omitempty"` KnownServers ServerList `json:"known_servers,omitempty"` MessageServers ServerStorage `json:"message_servers,omitempty"` DefaultDbPassword string `json:"default_db_password,omitempty"` DbPasswordStore bool `json:"db_password_store,omitempty"` OwnedDevices PeerList `json:"owned_devices,omitempty"` StaticMtkServerPaths []ServerList `json:"static_mtk_server_paths,omitempty"` DynamicMtkServeRules []string `json:"dynamic_mtk_serve_rules,omitempty"` InvitationTimeout int `json:"invitation_timeout,omitempty"` Uuid string `json:"uuid,omitempty"` // contains filtered or unexported fields }
func CreateIdentity ¶
func LoadIdentity ¶
LoadIdentity loads an identity from an encrypted file
func (*Identity) AnswerInvitation ¶
func (id *Identity) AnswerInvitation(MyName string, ContactName string, MessageServerIdxs []string, ReceivedContact *meowlib.ContactCard) *Peer
Answers an invitation, returns the newly created peer including infos to provide a ContactCard
func (*Identity) CheckInvitation ¶
func (id *Identity) CheckInvitation(ReceivedContact *meowlib.ContactCard) (isAnswer bool, proposedNick string, receivedNick string, invitationMessage string)
Checks if the received contact card is an answer to an invitation, returns true if it is, and the proposed and received nicknames
func (*Identity) CreateFolder ¶
func (*Identity) FinalizeInvitation ¶
func (id *Identity) FinalizeInvitation(ReceivedContact *meowlib.ContactCard) error
Finalizes an invitation, returns nil if successful
func (*Identity) GetRequestJobs ¶
func (id *Identity) GetRequestJobs() []*RequestsJob
func (*Identity) InvitePeer ¶
func (id *Identity) InvitePeer(MyName string, ContactName string, MessageServerUids []string, InvitationMessage string) (*Peer, error)
Creates an invitation for a peer, returns the newly created peer including infos to provide a ContactCard
func (*Identity) SaveBackgroundJob ¶
func (*Identity) TryUnlockHidden ¶
func (*Identity) WipeFolder ¶
type InternalUserMessage ¶
type InternalUserMessage struct { Outbound bool `json:"outbound"` Messagetype string `json:"messagetype,omitempty"` Message string `json:"message,omitempty"` ConversationStatus *meowlib.ConversationStatus `json:"conversation_status,omitempty"` Contact *meowlib.ContactCard `json:"contact,omitempty"` //Group group FilePaths []string `json:"file_paths,omitempty"` CurrentLocation *meowlib.Location `json:"current_location,omitempty"` Appdata []byte `json:"appdata,omitempty"` Dbfile string `json:"dbfile,omitempty"` Dbid int64 `json:"dbid,omitempty"` }
func DbMessageToInternalUserMessage ¶
func DbMessageToInternalUserMessage(id int64, dbFile string, dbm *meowlib.DbMessage) *InternalUserMessage
func GetMessagesHistory ¶
func GetMessagesHistory(peer *Peer, inAppMsgCount int, lastDbId int, wantMore int, password string) ([]InternalUserMessage, error)
Get old messages from a peer
func GetNewMessages ¶
func GetNewMessages(peer *Peer, lastDbId int, password string) ([]*InternalUserMessage, error)
Get new messages from a peer
func InternalUserMessageFromUserMessage ¶
func InternalUserMessageFromUserMessage(peer *Peer, msg *meowlib.UserMessage) *InternalUserMessage
InternalUserMessageFromUserMessage creates an InternalUserMessage from a UserMessage
type Peer ¶
type Peer struct { Uid string `json:"uid,omitempty"` Name string `json:"name,omitempty"` Avatar string `json:"avatar,omitempty"` MyName string `json:"my_name,omitempty"` MyAvatar string `json:"my_avatar,omitempty"` // Conversation []InternalMessage `json:"conversation,omitempty"` // My own keys for that peer MyIdentity meowlib.KeyPair `json:"my_identity,omitempty"` MyEncryptionKp meowlib.KeyPair `json:"my_encryption_kp,omitempty"` MyLookupKp meowlib.KeyPair `json:"my_lookup_kp,omitempty"` MyPullServers []string `json:"my_pull_servers,omitempty"` // Peer keys and infos //Contact meowlib.ContactCard `json:"contact,omitempty"` // todo : remove ContactPublicKey string `json:"contact_public_key,omitempty"` ContactLookupKey string `json:"contact_lookup_key,omitempty"` ContactEncryption string `json:"contact_encryption,omitempty"` ContactPullServers []string `json:"contact_pull_servers,omitempty"` InvitationId string `json:"invitation_id,omitempty"` InvitationUrl string `json:"invitation_url,omitempty"` InvitationMessage string `json:"invitation_message,omitempty"` InvitationExpiry time.Time `json:"invitation_expiry,omitempty"` LastMessage *InternalUserMessage `json:"last_message,omitempty"` // Internal management attributes Visible bool `json:"visible,omitempty"` VisiblePassword string `json:"visible_password,omitempty"` PasswordType string `json:"password_type,omitempty"` Blocked bool `json:"blocked,omitempty"` MessageNotification string `json:"message_notification,omitempty"` MatriochkaMode bool `json:"matriochka_mode,omitempty"` DirectMode bool `json:"direct_mode,omitempty"` DbIds []string `json:"db_ids,omitempty"` IsDevice bool `json:"is_device,omitempty"` // contains filtered or unexported fields }
Peer manages the peer messaging functions
- Building simple user messages
- Utility functions for packing/unpacking, encrypting/decrypting messages for peer communication
func (*Peer) AsymDecryptMessage ¶
func (p *Peer) AsymDecryptMessage(Message []byte, Signature []byte) (DecryptedMessage []byte, err error)
AsymDecryptMessage reads a message from a specific peer contact
func (*Peer) AsymEncryptMessage ¶
func (p *Peer) AsymEncryptMessage(Message []byte) (*meowlib.EncryptedMessage, error)
AsymEncryptMessage prepares a message to send to a specific peer contact
func (*Peer) BuildInvitationAnswerMessage ¶
func (p *Peer) BuildInvitationAnswerMessage(myContactCard *meowlib.ContactCard) (*meowlib.UserMessage, error)
Builds an invitation answer user message. it takes as input a contactcard generated by Identity.AnswerInvitation
func (*Peer) BuildSimpleUserMessage ¶
func (p *Peer) BuildSimpleUserMessage(message []byte) (*meowlib.UserMessage, error)
func (*Peer) BuildSingleFileMessage ¶
func (*Peer) DeserializeUserMessage ¶
func (p *Peer) DeserializeUserMessage(data []byte) (*meowlib.UserMessage, error)
func (*Peer) GetContact ¶
func (p *Peer) GetContact() *meowlib.ContactCard
func (*Peer) GetConversationRequest ¶
func (p *Peer) GetConversationRequest() *meowlib.ConversationRequest
func (*Peer) GetDbPassword ¶
func (*Peer) GetLastMessageUuid ¶
func (*Peer) GetMyContact ¶
func (p *Peer) GetMyContact() *meowlib.ContactCard
func (*Peer) InvitationPending ¶
func (*Peer) LoadMessage ¶
func (p *Peer) LoadMessage(uid string) (*InternalUserMessage, error)
func (*Peer) LoadMessagesHistory ¶
func (*Peer) LoadNewMessages ¶
func (p *Peer) LoadNewMessages(lastMessageId int) ([]*InternalUserMessage, error)
func (*Peer) PackUserMessage ¶
func (p *Peer) PackUserMessage(message []byte, signature []byte) *meowlib.PackedUserMessage
PackUserMessage will package the previously encrypted message
func (*Peer) ProcessInboundUserMessage ¶
func (p *Peer) ProcessInboundUserMessage(message []byte, signature []byte) (*meowlib.UserMessage, error)
ProcessInboundUserMessage is a helper function that decrypts and deserializes a user message
func (*Peer) ProcessOutboundUserMessage ¶
func (p *Peer) ProcessOutboundUserMessage(usermessage *meowlib.UserMessage) (*meowlib.PackedUserMessage, error)
ProcessOutboundUserMessage is a helper function that serializes, encrypts and packs a user message
func (*Peer) SerializeUserMessage ¶
func (p *Peer) SerializeUserMessage(msg *meowlib.UserMessage) ([]byte, error)
func (*Peer) SetDbPassword ¶
SetDbPassword sets a specific password for a hidden user, it won't be saved, but kept in memory only for the next operations
func (*Peer) StoreMessage ¶
func (p *Peer) StoreMessage(msg *meowlib.UserMessage, filenames []string) error
func (*Peer) UnPackUserMessage ¶
func (p *Peer) UnPackUserMessage(protoPackedMessage []byte) (payload []byte, signature []byte, err error)
UnPackUserMessage unpacks a user message
func (*Peer) UpdateMessage ¶
func (p *Peer) UpdateMessage(msg InternalUserMessage) error
type PeerList ¶
type PeerList []*Peer
func (*PeerList) GetConversationRequests ¶
func (pl *PeerList) GetConversationRequests() []*meowlib.ConversationRequest
! Wrong implementation, does not discriminate on different servers
func (*PeerList) GetFromInvitationId ¶
func (*PeerList) GetFromMyLookupKey ¶
func (*PeerList) GetFromName ¶
func (*PeerList) GetFromPublicKey ¶
type RequestsJob ¶
type Server ¶
type Server struct { //ServerCard meowlib.ServerCard `json:"server_data,omitempty"` Name string `json:"name,omitempty"` Description string `json:"description,omitempty"` PublicKey string `json:"public_key,omitempty"` Url string `json:"url,omitempty"` Login string `json:"login,omitempty"` Password string `json:"password,omitempty"` Presence bool `json:"presence,omitempty"` LastCheck time.Time `json:"last_check,omitempty"` Uptime time.Duration `json:"uptime,omitempty"` UserKp meowlib.KeyPair `json:"user_kp,omitempty"` ManagerKp meowlib.KeyPair `json:"manager_kp,omitempty"` Country string `json:"country,omitempty"` AllowedDelay int `json:"allowed_delay,omitempty"` Backup bool `json:"backup,omitempty"` }
Server manages server related operations
- Sending messages for server usage
- Two first steps of an invitation
- User message sending with UserKp identification
- Messages lookup requests
- Utility functions for packing/unpacking, encrypting/decrypting messages for server communication
- Server remote management if ManagerKp is available for that server
func CreateServerFromInvitationLink ¶
CreateServerFromInvitationLink creates a server from a meow url, ex : meow://mylogin:mypassword@https://my.meowserver.example:8443/meow?invitationCode
func CreateServerFromMeowUrl ¶
CreateServerFromMeowUrl creates a server from a meow url, ex : meow://mylogin:mypassword@https://my.meowserver.example:8443/meow/
func CreateServerFromServerCard ¶
func CreateServerFromServerCard(server *meowlib.ServerCard) *Server
Create a server from a server card
func CreateServerFromUid ¶
CreateServerFromUid creates a server from a uid string, ex : mylogin:mypassword@https://my.meowserver.example:8443/meow/
func CreateServerFromUrl ¶
CreateServerFromUrl creates a server from a basic url, ex : https://my.meowserver.example:8443/meow/
func (*Server) AsymDecryptMessage ¶
func (ints *Server) AsymDecryptMessage(Message []byte, Signature []byte) (DecryptedMessage []byte, err error)
AsymDecryptMessage reads a message from a specific internal server
func (*Server) AsymEncryptMessage ¶
func (ints *Server) AsymEncryptMessage(Message []byte) (*meowlib.EncryptedMessage, error)
AsymEncryptMessage prepares a message to send to a specific internal server
func (*Server) BuildMessageRequestMessage ¶
BuildMessageRequestMessage creates a message lookup message to server and returns it as protobuf serialized byte array
func (*Server) BuildMessageSendingMessage ¶
func (ints *Server) BuildMessageSendingMessage(usermsg *meowlib.PackedUserMessage) ([]byte, error)
BuildMessageSendingMessage creates a basic message to server from a single packed user message and returns it as protobuf serialized byte array
func (*Server) BuildToServerMessageFromUserMessage ¶
func (ints *Server) BuildToServerMessageFromUserMessage(usermsg *meowlib.PackedUserMessage) *meowlib.ToServerMessage
BuildToServerMessageFromUserMessage creates a basic message to server from a single packed user message and returns a meowlib.ToServerMessage
func (*Server) BuildToServerMessageInvitationAnswer ¶
func (ints *Server) BuildToServerMessageInvitationAnswer(invitationAnswer *meowlib.PackedUserMessage, myPublicKeyForThatPeer string, invitation_id string, timeout int) (*meowlib.ToServerMessage, error)
BuildToServerMessageInvitationAnswer creates an invitation answer to server and returns it as a meowlib.ToServerMessage it takes as input a contactcard generated by Identity.InvitePeer
func (*Server) BuildToServerMessageInvitationAnswerRequest ¶
func (ints *Server) BuildToServerMessageInvitationAnswerRequest(invitationId string) (*meowlib.ToServerMessage, error)
BuildToServerMessageInvitationAnswerRequest requests invitation answer with provided id from server and returns it as a meowlib.ToServerMessage
func (*Server) BuildToServerMessageInvitationCreation ¶
func (ints *Server) BuildToServerMessageInvitationCreation(invitation *meowlib.ContactCard, password string, timeout int, shortCodeLen int) (*meowlib.ToServerMessage, error)
BuildToServerMessageInvitation creates an invitation message to server and returns it as a meowlib.ToServerMessage it takes as input a contactcard generated by Identity.InvitePeer
func (*Server) BuildToServerMessageInvitationRequest ¶
func (ints *Server) BuildToServerMessageInvitationRequest(shortcode string, password string) (*meowlib.ToServerMessage, error)
BuildToServerMessageInvitationRequest requests invitation with provided id from server and returns it as a meowlib.ToServerMessage
func (*Server) GetMeowUrl ¶
func (*Server) GetServerCard ¶
func (ints *Server) GetServerCard() *meowlib.ServerCard
GetServerCard returns a server card from a server
func (*Server) PackServerMessage ¶
func (ints *Server) PackServerMessage(payload []byte, signature []byte) (protoPackedMessage []byte, err error)
PackServerMessage
func (*Server) ProcessInboundServerResponse ¶
func (srv *Server) ProcessInboundServerResponse(msg []byte) (*meowlib.FromServerMessage, error)
func (*Server) ProcessOutboundMessage ¶
func (srv *Server) ProcessOutboundMessage(toServerMessage *meowlib.ToServerMessage) ([]byte, error)
type ServerList ¶
type ServerList struct { Name string `json:"name,omitempty"` Servers []Server `json:"servers,omitempty"` }
ServerList manages lists that are used in Identity
- Message servers list
- ArchiveServers lists
- Owned servers lists
- Matriochka paths
func (*ServerList) AddUrls ¶
func (sl *ServerList) AddUrls(urls []string)
AddUrls is a simple utility functon used mainly as a shortcut for testing purposes
func (*ServerList) FilterByIdxs ¶
func (sl *ServerList) FilterByIdxs(MessageServerIdxs []int) (filtered *ServerList, err error)
FilterByIdxs returns a filtered server list filtered according to an index list
func (*ServerList) GetServerByIdx ¶
func (sl *ServerList) GetServerByIdx(idx int) (server *Server, err error)
GetServerByIdx returns a server from it's index
func (*ServerList) GetServerByPubkey ¶
func (sl *ServerList) GetServerByPubkey(pubkey string) (filtered *Server)
GetServerByPubkey returns a server from it's public key
type ServerStorage ¶
type ServerStorage struct { DbFile string `json:"db_file,omitempty"` // contains filtered or unexported fields }
func (*ServerStorage) DeleteServer ¶
func (ss *ServerStorage) DeleteServer(uid string) error
DeleteServer function deletes a Server from a badger database with Server.GetUid() as key
func (*ServerStorage) LoadAllServerCards ¶
func (ss *ServerStorage) LoadAllServerCards() ([]*meowlib.ServerCard, error)
LoadAllServers function loads all ServersCards from a badger database
func (*ServerStorage) LoadAllServers ¶
func (ss *ServerStorage) LoadAllServers() ([]*Server, error)
LoadAllServers function loads all Servers from a badger database
func (*ServerStorage) LoadServer ¶
func (ss *ServerStorage) LoadServer(uid string) (*Server, error)
LoadServer function loads a Server from a badger database with Server.GetUid() as key
func (*ServerStorage) LoadServerCardsFromUids ¶
func (ss *ServerStorage) LoadServerCardsFromUids(uids []string) ([]*meowlib.ServerCard, error)
LoadServersFromUids function loads Servers with id in []Uid parameter from a badger database
func (*ServerStorage) LoadServersFromUids ¶
func (ss *ServerStorage) LoadServersFromUids(uids []string) ([]*Server, error)
LoadServersFromUids function loads Servers with id in []Uid parameter from a badger database
func (*ServerStorage) StoreServer ¶
func (ss *ServerStorage) StoreServer(sc *Server) error
Store function StoreServer stores a server in a badger database with Server.GetUid() as key