Documentation ¶
Index ¶
- Constants
- func GetIdentities() ([]string, error)
- func ReadDir(root string) ([]string, error)
- func SetIdentityAsDefault(name string) bool
- type BrokerEvent
- type Configuration
- type Conversation
- type Device
- type DeviceRequest
- type DevicesDatabase
- type DevicesSqliteDB
- func (d DevicesSqliteDB) ConfirmRequest(request DeviceRequest, sharedKey string) (*Device, error)
- func (d DevicesSqliteDB) DeleteDevice(device Device) error
- func (d DevicesSqliteDB) DeleteRequest(request DeviceRequest) error
- func (d DevicesSqliteDB) GetDeviceByPublicKey(publicKey string) *Device
- func (d DevicesSqliteDB) GetDeviceByURL(url string) *Device
- func (d DevicesSqliteDB) GetDevices() []Device
- func (d DevicesSqliteDB) GetRequestByURL(url string) *DeviceRequest
- func (d DevicesSqliteDB) GetRequests() []DeviceRequest
- func (d DevicesSqliteDB) StoreDevice(device Device) error
- func (d DevicesSqliteDB) StoreRequest(request DeviceRequest) error
- type Identity
- type Message
- type MessageDB
- type MessagesSqliteDB
- func (m MessagesSqliteDB) GetConversationByID(conversationID string) *Conversation
- func (m MessagesSqliteDB) GetConversations() []Conversation
- func (m MessagesSqliteDB) GetConversationsByRecipient(recipient string) []Conversation
- func (m MessagesSqliteDB) GetNewestMessages(conversationID string, count int) []Message
- func (m MessagesSqliteDB) RefreshConversationLastUpdate(conversationID string, timestamp string) error
- func (m MessagesSqliteDB) StoreConversation(conversation Conversation) error
- func (m MessagesSqliteDB) StoreMessage(message Message) error
- type OfflineRequest
- type OfflineSqliteDB
- type Presence
- type PrimalInterface
- type RequestStatus
- type SqliteDB
Constants ¶
View Source
const (
DeviceDbName = "devices.db"
)
implementation of devices/request db in sqlite3
View Source
const (
OfflineDbName = "offline.db"
)
implementation of devices/request db in sqlite3
Variables ¶
This section is empty.
Functions ¶
func GetIdentities ¶
func SetIdentityAsDefault ¶
Types ¶
type BrokerEvent ¶
type BrokerEvent struct { Event string `json:"event"` Payload interface{} `json:"payload"` }
type Configuration ¶
type Conversation ¶
type Conversation struct { ConversationID string `json:"conversation_id"` // it's the conversation name sha Name string `json:"name"` Recipients []string `json:"recipients"` // recipient's publickey, for now with size 1, this will be used for group chats Lastupdate string `json:"-"` }
func GenerateConversation ¶
func GenerateConversation(name string, recipients []string) Conversation
type DeviceRequest ¶
type DeviceRequest struct { URL string `json:"url"` PublicKey string `json:"public_key"` Alias string `json:"alias"` Status RequestStatus `json:"status"` }
type DevicesDatabase ¶
type DevicesDatabase interface { StoreRequest(request DeviceRequest) error GetRequests() []DeviceRequest GetRequestByURL(url string) *DeviceRequest DeleteRequest(request DeviceRequest) error StoreDevice(device Device) error GetDevices() []Device GetDeviceByURL(url string) *Device GetDeviceByPublicKey(publicKey string) *Device DeleteDevice(device Device) error ConfirmRequest(request DeviceRequest, sharedKey string) (*Device, error) }
type DevicesSqliteDB ¶
type DevicesSqliteDB struct {
SqliteDB
}
func InitDevicesSqlite ¶
func InitDevicesSqlite(path string) DevicesSqliteDB
func (DevicesSqliteDB) ConfirmRequest ¶
func (d DevicesSqliteDB) ConfirmRequest(request DeviceRequest, sharedKey string) (*Device, error)
func (DevicesSqliteDB) DeleteDevice ¶
func (d DevicesSqliteDB) DeleteDevice(device Device) error
func (DevicesSqliteDB) DeleteRequest ¶
func (d DevicesSqliteDB) DeleteRequest(request DeviceRequest) error
func (DevicesSqliteDB) GetDeviceByPublicKey ¶
func (d DevicesSqliteDB) GetDeviceByPublicKey(publicKey string) *Device
func (DevicesSqliteDB) GetDeviceByURL ¶
func (d DevicesSqliteDB) GetDeviceByURL(url string) *Device
func (DevicesSqliteDB) GetDevices ¶
func (d DevicesSqliteDB) GetDevices() []Device
func (DevicesSqliteDB) GetRequestByURL ¶
func (d DevicesSqliteDB) GetRequestByURL(url string) *DeviceRequest
func (DevicesSqliteDB) GetRequests ¶
func (d DevicesSqliteDB) GetRequests() []DeviceRequest
func (DevicesSqliteDB) StoreDevice ¶
func (d DevicesSqliteDB) StoreDevice(device Device) error
func (DevicesSqliteDB) StoreRequest ¶
func (d DevicesSqliteDB) StoreRequest(request DeviceRequest) error
type Identity ¶
type Identity struct { Name string `json:"name"` PublicServiceKeys torHiddenServiceKeys `json:"public_service_keys"` PrivateServiceKeys torHiddenServiceKeys `json:"private_service_keys"` PublicKey string `json:"public_key"` PrivateKey string `json:"private_key"` }
func GenerateIdentity ¶
func (*Identity) GetDataDir ¶
type MessageDB ¶
type MessageDB interface { GetConversations() []Conversation //sorted by lastupdate GetConversationByID(conversationID string) *Conversation GetConversationsByRecipient(recipient string) []Conversation StoreConversation(conversation Conversation) error RefreshConversationLastUpdate(conversationID string, timestamp string) error GetNewestMessages(conversationID string, count int) []Message //GetMessagesPage(conversationID string, limit int, offset int) []Message StoreMessage(message Message) error }
type MessagesSqliteDB ¶
type MessagesSqliteDB struct {
SqliteDB
}
func InitMessagesSqlite ¶
func InitMessagesSqlite(path string) MessagesSqliteDB
func (MessagesSqliteDB) GetConversationByID ¶
func (m MessagesSqliteDB) GetConversationByID(conversationID string) *Conversation
func (MessagesSqliteDB) GetConversations ¶
func (m MessagesSqliteDB) GetConversations() []Conversation
func (MessagesSqliteDB) GetConversationsByRecipient ¶
func (m MessagesSqliteDB) GetConversationsByRecipient(recipient string) []Conversation
func (MessagesSqliteDB) GetNewestMessages ¶
func (m MessagesSqliteDB) GetNewestMessages(conversationID string, count int) []Message
func (MessagesSqliteDB) RefreshConversationLastUpdate ¶
func (m MessagesSqliteDB) RefreshConversationLastUpdate(conversationID string, timestamp string) error
func (MessagesSqliteDB) StoreConversation ¶
func (m MessagesSqliteDB) StoreConversation(conversation Conversation) error
func (MessagesSqliteDB) StoreMessage ¶
func (m MessagesSqliteDB) StoreMessage(message Message) error
type OfflineRequest ¶
type OfflineSqliteDB ¶
type OfflineSqliteDB struct {
SqliteDB
}
func InitOfflineSqlite ¶
func InitOfflineSqlite(path string) OfflineSqliteDB
func (OfflineSqliteDB) DeleteRequest ¶
func (d OfflineSqliteDB) DeleteRequest(request OfflineRequest) bool
func (OfflineSqliteDB) GetRequests ¶
func (d OfflineSqliteDB) GetRequests(publicKey string) []OfflineRequest
func (OfflineSqliteDB) StoreRequest ¶
func (d OfflineSqliteDB) StoreRequest(publicKey string, request OfflineRequest) bool
type Presence ¶
type Presence struct {
// contains filtered or unexported fields
}
func InitPresence ¶
func InitPresence() *Presence
type PrimalInterface ¶
type PrimalInterface interface { GetPublicURL() string GetPublicKey() string Notify(event BrokerEvent) Send(request http.Request, encrypt bool) (*http.Response, error) GetMiddleware(next http.Handler) func(w http.ResponseWriter, r *http.Request) GetDevices() []Device GetOfflineQueue() OfflineSqliteDB SendPendingRequests(publicKey string) IsURLOnline(url string) bool }
type RequestStatus ¶
type RequestStatus int
const ( RequestSentStatus RequestStatus = iota + 1 RequestPendingStatus )
Click to show internal directories.
Click to hide internal directories.