multidevice

package
v0.92.1 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2021 License: MPL-2.0, MPL-2.0 Imports: 3 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 Installation

type Installation struct {
	// Identity is the string identity of the owner
	Identity string `json:"identity"`
	// The installation-id of the device
	ID string `json:"id"`
	// The last known protocol version of the device
	Version uint32 `json:"version"`
	// Enabled is whether the installation is enabled
	Enabled bool `json:"enabled"`
	// Timestamp is the last time we saw this device
	Timestamp int64 `json:"timestamp"`
	// InstallationMetadata
	InstallationMetadata *InstallationMetadata `json:"metadata"`
}

type InstallationMetadata

type InstallationMetadata struct {
	// The name of the device
	Name string `json:"name"`
	// The type of device
	DeviceType string `json:"deviceType"`
	// The FCMToken for mobile devices
	FCMToken string `json:"fcmToken"`
}

type Multidevice

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

func New

func New(db *sql.DB, config *Config) *Multidevice

func (*Multidevice) AddInstallations

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

func (*Multidevice) DisableInstallation

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

func (*Multidevice) EnableInstallation

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

func (*Multidevice) GetActiveInstallations

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

func (*Multidevice) GetOurActiveInstallations

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

func (*Multidevice) GetOurInstallations

func (s *Multidevice) GetOurInstallations(identity *ecdsa.PublicKey) ([]*Installation, error)

func (*Multidevice) InstallationID

func (s *Multidevice) InstallationID() string

func (*Multidevice) SetInstallationMetadata

func (s *Multidevice) SetInstallationMetadata(identity *ecdsa.PublicKey, installationID string, metadata *InstallationMetadata) error

Jump to

Keyboard shortcuts

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