multidevice

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2024 License: MPL-2.0, MPL-2.0 Imports: 4 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateInstallationID added in v0.184.43

func GenerateInstallationID() string

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"`
}

func (*Installation) UniqueKey added in v0.182.40

func (i *Installation) UniqueKey() string

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

func (*Multidevice) SetInstallationName added in v0.138.8

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

Jump to

Keyboard shortcuts

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