multidevice

package
v0.26.0-alpha.39 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2019 License: MPL-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	MaxInstallations int
	ProtocolVersion  uint32
	InstallationID   string
}

type IdentityAndID

type IdentityAndID struct {
	Identity string
	ID       string
}

type Installation

type Installation struct {
	// The installation-id of the device
	ID string
	// The last known protocol version of the device
	Version uint32
}

type Persistence

type Persistence interface {
	// GetActiveInstallations returns the active installations for a given identity.
	GetActiveInstallations(maxInstallations int, identity []byte) ([]*Installation, error)
	// EnableInstallation enables the installation.
	EnableInstallation(identity []byte, installationID string) error
	// DisableInstallation disable the installation.
	DisableInstallation(identity []byte, installationID string) error
	// AddInstallations adds the installations for a given identity, maintaining the enabled flag
	AddInstallations(identity []byte, timestamp int64, installations []*Installation, defaultEnabled bool) error
}

type SQLLitePersistence

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

SQLLitePersistence represents a persistence service tied to an SQLite database

func NewSQLLitePersistence

func NewSQLLitePersistence(db *sql.DB) *SQLLitePersistence

NewSQLLitePersistence creates a new SQLLitePersistence instance, given a path and a key

func (*SQLLitePersistence) AddInstallations

func (s *SQLLitePersistence) AddInstallations(identity []byte, timestamp int64, installations []*Installation, defaultEnabled bool) error

AddInstallations adds the installations for a given identity, maintaining the enabled flag

func (*SQLLitePersistence) DisableInstallation

func (s *SQLLitePersistence) DisableInstallation(identity []byte, installationID string) error

DisableInstallation disable the installation

func (*SQLLitePersistence) EnableInstallation

func (s *SQLLitePersistence) EnableInstallation(identity []byte, installationID string) error

EnableInstallation enables the installation

func (*SQLLitePersistence) GetActiveInstallations

func (s *SQLLitePersistence) GetActiveInstallations(maxInstallations int, identity []byte) ([]*Installation, error)

GetActiveInstallations returns the active installations for a given identity

type Service

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

func New

func New(config *Config, persistence Persistence) *Service

func (*Service) DisableInstallation

func (s *Service) DisableInstallation(myIdentityKey *ecdsa.PublicKey, installationID string) error

func (*Service) EnableInstallation

func (s *Service) EnableInstallation(identity *ecdsa.PublicKey, installationID string) error

func (*Service) GetActiveInstallations

func (s *Service) GetActiveInstallations(identity *ecdsa.PublicKey) ([]*Installation, error)

func (*Service) GetOurActiveInstallations

func (s *Service) GetOurActiveInstallations(identity *ecdsa.PublicKey) ([]*Installation, error)

func (*Service) ProcessPublicBundle

func (s *Service) ProcessPublicBundle(myIdentityKey *ecdsa.PrivateKey, theirIdentity *ecdsa.PublicKey, b *protobuf.Bundle) ([]*IdentityAndID, error)

ProcessPublicBundle persists a bundle and returns a list of tuples identity/installationID

Jump to

Keyboard shortcuts

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