sync

package
v0.0.0-...-da001d4 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2017 License: MPL-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const USER_AGENT = "SyncAPI/0.1 (https://github.com/st3fan/moz-syncapi)"

Variables

This section is empty.

Functions

func RandomRecordId

func RandomRecordId() string

func TimestampNow

func TimestampNow() float64

Types

type EncryptedPayload

type EncryptedPayload struct {
	CipherText string `json:"ciphertext"`
	IV         string `json:"IV"`
	HMAC       string `json:"hmac"`
}

type GetRecordsOptions

type GetRecordsOptions struct {
	Limit int
	Sort  string
}

type KeyBundle

type KeyBundle struct {
	EncryptionKey []byte
	ValidationKey []byte
}

func NewKeyBundle

func NewKeyBundle(key []byte) (*KeyBundle, error)

type KeysPayload

type KeysPayload struct {
	Default []string `json:"default"`
}

type Record

type Record struct {
	Id        string  `json:"id"`
	Modified  float64 `json:"modified,omitempty"`
	Payload   string  `json:"payload"`
	SortIndex int     `json:"sortindex"`
}

func (*Record) Decrypt

func (r *Record) Decrypt(keyBundle *KeyBundle) error

func (*Record) Encrypt

func (r *Record) Encrypt(keyBundle *KeyBundle) error

type StorageClient

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

func NewStorageClient

func NewStorageClient(endpoint, hawkKeyId, hawkKey string, secret []byte) (*StorageClient, error)

func (*StorageClient) DeleteCollection

func (sc *StorageClient) DeleteCollection(collectionName string) error

func (*StorageClient) FetchKeys

func (sc *StorageClient) FetchKeys() (KeyBundle, error)

func (*StorageClient) GetEncryptedRecord

func (sc *StorageClient) GetEncryptedRecord(collectionName, recordId string, keyBundle *KeyBundle) (Record, error)

func (*StorageClient) GetEncryptedRecords

func (sc *StorageClient) GetEncryptedRecords(collectionName string, keyBundle *KeyBundle, options *GetRecordsOptions) ([]Record, error)

func (*StorageClient) GetRecord

func (sc *StorageClient) GetRecord(collectionName, recordId string) (Record, error)

func (*StorageClient) Login

func (sc *StorageClient) Login() error

func (*StorageClient) PutEncryptedRecord

func (sc *StorageClient) PutEncryptedRecord(collectionName string, record Record, keyBundle *KeyBundle) (string, error)

func (*StorageClient) PutEncryptedRecords

func (sc *StorageClient) PutEncryptedRecords(collectionName string, records []Record, keyBundle *KeyBundle) error

Jump to

Keyboard shortcuts

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