pairing

package
v0.179.12 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: MPL-2.0 Imports: 55 Imported by: 0

Documentation

Index

Constants

View Source
const CertificateMaxClockDrift = time.Minute

Variables

View Source
var (
	ErrKeyFileAlreadyExists    = errors.New("key file already exists")
	ErrKeyUIDEmptyAsSender     = errors.New("keyUID must be provided as sender")
	ErrNodeConfigNilAsReceiver = errors.New("node config must be provided as receiver")
	ErrLoggedInKeyUIDConflict  = errors.New("logged in keyUID not same as keyUID in payload")
)

Functions

func FindNewInstallations added in v0.148.1

func FindNewInstallations(m *protocol.Messenger, prevInstallationIds map[string]struct{}) *multidevice.Installation

func GenerateCertFromKey

func GenerateCertFromKey(pk *ecdsa.PrivateKey, from time.Time, IPAddresses []net.IP, DNSNames []string) (tls.Certificate, []byte, error)

func GetMessengerInstallationsMap added in v0.148.1

func GetMessengerInstallationsMap(m *protocol.Messenger) map[string]struct{}

func MakeServerConfig added in v0.140.0

func MakeServerConfig(config *ServerConfig) error

func NewPayloadMounters added in v0.140.0

NewPayloadMounters returns PayloadMounter s configured to handle local pairing transfers of:

  • AccountPayload, RawMessagePayload and InstallationPayload

func NewPayloadReceivers added in v0.140.0

func ParseNetIps added in v0.164.0

func ParseNetIps(in []byte) ([]net.IP, error)

func SerializeNetIps added in v0.164.0

func SerializeNetIps(ips []net.IP) []byte

func StartUpKeystoreFilesReceivingClient added in v0.163.14

func StartUpKeystoreFilesReceivingClient(backend *api.GethStatusBackend, cs, configJSON string) error

StartUpKeystoreFilesReceivingClient creates a KeystoreFilesReceiverClient and triggers all `receive` calls in sequence to the KeystoreFilesSenderServer

func StartUpKeystoreFilesSenderServer added in v0.163.14

func StartUpKeystoreFilesSenderServer(backend *api.GethStatusBackend, configJSON string) (string, error)

StartUpKeystoreFilesSenderServer generates a KeystoreFilesSenderServer, starts the sending server and returns the ConnectionParams string to allow a ReceiverClient to make a successful connection.

func StartUpReceiverServer added in v0.140.0

func StartUpReceiverServer(backend *api.GethStatusBackend, configJSON string) (string, error)

StartUpReceiverServer generates a ReceiverServer, starts the sending server and returns the ConnectionParams string to allow a SenderClient to make a successful connection.

func StartUpReceivingClient added in v0.140.0

func StartUpReceivingClient(backend *api.GethStatusBackend, cs, configJSON string) error

StartUpReceivingClient creates a ReceiverClient and triggers all `receive` calls in sequence to the SenderServer

func StartUpSenderServer added in v0.140.0

func StartUpSenderServer(backend *api.GethStatusBackend, configJSON string) (string, error)

StartUpSenderServer generates a SenderServer, starts the sending server and returns the ConnectionParams string to allow a ReceiverClient to make a successful connection.

func StartUpSendingClient added in v0.140.0

func StartUpSendingClient(backend *api.GethStatusBackend, cs, configJSON string) error

StartUpSendingClient creates a SenderClient and triggers all `send` calls in sequence to the ReceiverServer

func ValidateConnectionString added in v0.131.7

func ValidateConnectionString(cs string) error

Types

type AccountData added in v0.154.0

type AccountData struct {
	Account  *multiaccounts.Account `json:"account,omitempty"`
	Password string                 `json:"password,omitempty"`
	ChatKey  string                 `json:"chatKey,omitempty"`
}

type AccountPayload

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

AccountPayload represents the payload structure a Server handles

type AccountPayloadLoader added in v0.140.0

type AccountPayloadLoader struct {
	*AccountPayload
	// contains filtered or unexported fields
}

AccountPayloadLoader is responsible for loading, parsing and validating AccountPayload data

func NewAccountPayloadLoader added in v0.140.0

func NewAccountPayloadLoader(p *AccountPayload, config *SenderConfig) (*AccountPayloadLoader, error)

func (*AccountPayloadLoader) Load added in v0.140.0

func (apl *AccountPayloadLoader) Load() error

type AccountPayloadMarshaller

type AccountPayloadMarshaller struct {
	*AccountPayload
	// contains filtered or unexported fields
}

AccountPayloadMarshaller is responsible for marshalling and unmarshalling Server payload data

func NewPairingPayloadMarshaller

func NewPairingPayloadMarshaller(ap *AccountPayload, logger *zap.Logger) *AccountPayloadMarshaller

func (*AccountPayloadMarshaller) MarshalProtobuf added in v0.140.0

func (ppm *AccountPayloadMarshaller) MarshalProtobuf() ([]byte, error)

func (*AccountPayloadMarshaller) UnmarshalProtobuf

func (ppm *AccountPayloadMarshaller) UnmarshalProtobuf(data []byte) error

type AccountPayloadStorer added in v0.140.0

type AccountPayloadStorer struct {
	*AccountPayload
	// contains filtered or unexported fields
}

AccountPayloadStorer is responsible for parsing, validating and storing AccountPayload data

func NewAccountPayloadStorer added in v0.140.0

func NewAccountPayloadStorer(p *AccountPayload, config *ReceiverConfig) (*AccountPayloadStorer, error)

func (*AccountPayloadStorer) Store added in v0.140.0

func (aps *AccountPayloadStorer) Store() error

type Action

type Action int
const (
	ActionConnect Action = iota + 1
	ActionPairingAccount
	ActionSyncDevice
	ActionPairingInstallation
	ActionPeerDiscovery
	ActionKeystoreFilesTransfer
)

type BaseClient added in v0.140.0

type BaseClient struct {
	*http.Client
	// contains filtered or unexported fields
}

BaseClient is responsible for lower level pairing.Client functionality common to dependent Client types

func NewBaseClient added in v0.140.0

func NewBaseClient(c *ConnectionParams, logger *zap.Logger) (*BaseClient, error)

NewBaseClient returns a fully qualified BaseClient from the given ConnectionParams

type BasePayloadMounter added in v0.142.9

type BasePayloadMounter struct {
	*PayloadLockPayload
	*PayloadToSend
	// contains filtered or unexported fields
}

func NewAccountPayloadMounter added in v0.140.0

func NewAccountPayloadMounter(pe *PayloadEncryptor, config *SenderConfig, logger *zap.Logger) (*BasePayloadMounter, error)

NewAccountPayloadMounter generates a new and initialised AccountPayload flavoured BasePayloadMounter responsible for the whole lifecycle of an AccountPayload

func NewBasePayloadMounter added in v0.142.9

func NewBasePayloadMounter(loader PayloadLoader, marshaller ProtobufMarshaller, e *PayloadEncryptor) *BasePayloadMounter

func NewInstallationPayloadMounter added in v0.140.0

func NewInstallationPayloadMounter(pe *PayloadEncryptor, backend *api.GethStatusBackend, deviceType string) *BasePayloadMounter

NewInstallationPayloadMounter generates a new and initialised InstallationPayload flavoured BasePayloadMounter responsible for the whole lifecycle of an InstallationPayload

func NewKeystoreFilesPayloadMounter added in v0.163.14

func NewKeystoreFilesPayloadMounter(backend *api.GethStatusBackend, pe *PayloadEncryptor, config *KeystoreFilesSenderConfig, logger *zap.Logger) (*BasePayloadMounter, error)

func NewRawMessagePayloadMounter added in v0.140.0

func NewRawMessagePayloadMounter(logger *zap.Logger, pe *PayloadEncryptor, backend *api.GethStatusBackend, config *SenderConfig) *BasePayloadMounter

NewRawMessagePayloadMounter generates a new and initialised RawMessagePayload flavoured BasePayloadMounter responsible for the whole lifecycle of an RawMessagePayload

func (*BasePayloadMounter) Mount added in v0.142.9

func (bpm *BasePayloadMounter) Mount() error

Mount loads and prepares the payload to be stored in the PayloadLoader's state ready for later access

type BasePayloadReceiver added in v0.142.9

type BasePayloadReceiver struct {
	*PayloadLockPayload
	*PayloadReceived
	// contains filtered or unexported fields
}

func NewAccountPayloadReceiver added in v0.140.0

func NewAccountPayloadReceiver(e *PayloadEncryptor, p *AccountPayload, config *ReceiverConfig, logger *zap.Logger) (*BasePayloadReceiver, error)

NewAccountPayloadReceiver generates a new and initialised AccountPayload flavoured BasePayloadReceiver AccountPayloadReceiver is responsible for the whole receive and store cycle of an AccountPayload

func NewBasePayloadReceiver added in v0.154.0

func NewBasePayloadReceiver(e *PayloadEncryptor, um ProtobufUnmarshaller, s PayloadStorer, callback func()) *BasePayloadReceiver

func NewInstallationPayloadReceiver added in v0.140.0

func NewInstallationPayloadReceiver(e *PayloadEncryptor, backend *api.GethStatusBackend, deviceType string) *BasePayloadReceiver

NewInstallationPayloadReceiver generates a new and initialised InstallationPayload flavoured BasePayloadReceiver InstallationPayloadReceiver is responsible for the whole receive and store cycle of a RawMessagesPayload specifically for sending / requesting installation data from the Receiver device.

func NewKeystoreFilesPayloadReceiver added in v0.163.14

func NewKeystoreFilesPayloadReceiver(backend *api.GethStatusBackend, e *PayloadEncryptor, config *KeystoreFilesReceiverConfig, logger *zap.Logger) (*BasePayloadReceiver, error)

func NewRawMessagePayloadReceiver added in v0.140.0

func NewRawMessagePayloadReceiver(accountPayload *AccountPayload, e *PayloadEncryptor, backend *api.GethStatusBackend, config *ReceiverConfig) *BasePayloadReceiver

NewRawMessagePayloadReceiver generates a new and initialised RawMessagesPayload flavoured BasePayloadReceiver RawMessagePayloadReceiver is responsible for the whole receive and store cycle of a RawMessagesPayload

func (*BasePayloadReceiver) Receive added in v0.142.9

func (bpr *BasePayloadReceiver) Receive(data []byte) error

Receive takes a []byte representing raw data, parses and stores the data

type BaseServer added in v0.140.0

type BaseServer struct {
	server.Server
	// contains filtered or unexported fields
}

func NewBaseServer added in v0.140.0

func NewBaseServer(logger *zap.Logger, e *PayloadEncryptor, config *ServerConfig) (*BaseServer, error)

NewBaseServer returns a *BaseServer init from the given *SenderServerConfig

func (*BaseServer) MakeConnectionParams added in v0.140.0

func (s *BaseServer) MakeConnectionParams() (*ConnectionParams, error)

MakeConnectionParams generates a *ConnectionParams based on the Server's current state

type ChallengeError added in v0.140.2

type ChallengeError struct {
	Text     string
	HTTPCode int
}

func (*ChallengeError) Error added in v0.140.2

func (ce *ChallengeError) Error() string

type ChallengeGiver added in v0.140.2

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

ChallengeGiver is responsible for generating challenges and checking challenge responses

func NewChallengeGiver added in v0.140.2

func NewChallengeGiver(e *PayloadEncryptor, logger *zap.Logger) (*ChallengeGiver, error)

type ChallengeTaker added in v0.140.2

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

ChallengeTaker is responsible for storing and performing server challenges

func NewChallengeTaker added in v0.140.2

func NewChallengeTaker(e *PayloadEncryptor) *ChallengeTaker

func (*ChallengeTaker) DoChallenge added in v0.140.2

func (ct *ChallengeTaker) DoChallenge(req *http.Request) error

func (*ChallengeTaker) SetChallenge added in v0.140.2

func (ct *ChallengeTaker) SetChallenge(resp *http.Response) error

type ClientConfig added in v0.140.0

type ClientConfig struct{}

type ConnectionParams

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

func NewConnectionParams

func NewConnectionParams(netIPs []net.IP, port int, publicKey *ecdsa.PublicKey, aesKey []byte) *ConnectionParams

func (*ConnectionParams) BuildURL added in v0.167.2

func (cp *ConnectionParams) BuildURL(ip net.IP) *url.URL

func (*ConnectionParams) FromString

func (cp *ConnectionParams) FromString(s string) error

FromString parses a connection params string required for to securely connect to another Status device. This function parses a connection string generated by ToString

func (*ConnectionParams) ToString

func (cp *ConnectionParams) ToString() string

ToString generates a string required for generating a secure connection to another Status device.

The returned string will look like below:

  • "cs2:4FHRnp:H6G:uqnnMwVUfJc2Fkcaojet8F1ufKC3hZdGEt47joyBx9yd:BbnZ7Gc66t54a9kEFCf7FW8SGQuYypwHVeNkRYeNoqV6"

Format bytes encoded into a base58 string, delimited by ":"

  • string type identifier
  • version
  • net.IP
  • version 1: a single net.IP
  • version 2: array of IPs in next form: | 1 byte | 4*N bytes | 1 byte | 16*N bytes | | N | N * IPv4 | M | M * IPv6 |
  • port
  • ecdsa CompressedPublicKey
  • AES encryption key

func (*ConnectionParams) URL

func (cp *ConnectionParams) URL(IPIndex int) (*url.URL, error)

type EncryptionPayload

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

EncryptionPayload represents the plain text and encrypted text of payload data

type Event

type Event struct {
	Type   EventType `json:"type"`
	Error  string    `json:"error,omitempty"`
	Action Action    `json:"action"`
	Data   any       `json:"data,omitempty"`
}

Event is a type for transfer events.

type EventType

type EventType string

EventType type for event types.

const (
	EventPeerDiscovered       EventType = "peer-discovered"
	EventConnectionError      EventType = "connection-error"
	EventConnectionSuccess    EventType = "connection-success"
	EventTransferError        EventType = "transfer-error"
	EventTransferSuccess      EventType = "transfer-success"
	EventReceivedInstallation EventType = "received-installation"

	EventReceivedAccount       EventType = "received-account"
	EventProcessSuccess        EventType = "process-success"
	EventProcessError          EventType = "process-error"
	EventReceivedKeystoreFiles EventType = "received-keystore-files"
)

type InstallationPayloadLoader added in v0.140.0

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

func NewInstallationPayloadLoader added in v0.140.0

func NewInstallationPayloadLoader(backend *api.GethStatusBackend, payload *RawMessagesPayload, deviceType string) *InstallationPayloadLoader

func (*InstallationPayloadLoader) Load added in v0.140.0

func (r *InstallationPayloadLoader) Load() error

type InstallationPayloadMounterReceiver added in v0.140.0

type InstallationPayloadMounterReceiver struct {
	PayloadMounter
	PayloadReceiver
}

InstallationPayloadMounterReceiver represents an InstallationPayload Repository

func NewInstallationPayloadMounterReceiver added in v0.140.0

func NewInstallationPayloadMounterReceiver(encryptor *PayloadEncryptor, backend *api.GethStatusBackend, deviceType string) *InstallationPayloadMounterReceiver

func (*InstallationPayloadMounterReceiver) LockPayload added in v0.140.0

func (i *InstallationPayloadMounterReceiver) LockPayload()

type InstallationPayloadStorer added in v0.140.0

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

func NewInstallationPayloadStorer added in v0.140.0

func NewInstallationPayloadStorer(backend *api.GethStatusBackend, payload *RawMessagesPayload, deviceType string) *InstallationPayloadStorer

func (*InstallationPayloadStorer) Store added in v0.140.0

func (r *InstallationPayloadStorer) Store() error

type KeystoreFilesConfig added in v0.163.14

type KeystoreFilesConfig struct {
	KeystorePath   string `json:"keystorePath" validate:"required,keystorepath"`
	LoggedInKeyUID string `json:"loggedInKeyUid" validate:"required,keyuid"`
	Password       string `json:"password" validate:"required"`
}

type KeystoreFilesPayloadLoader added in v0.163.14

type KeystoreFilesPayloadLoader struct {
	*AccountPayload
	// contains filtered or unexported fields
}

func NewKeystoreFilesPayloadLoader added in v0.163.14

func NewKeystoreFilesPayloadLoader(backend *api.GethStatusBackend, p *AccountPayload, config *KeystoreFilesSenderConfig) (*KeystoreFilesPayloadLoader, error)

func (*KeystoreFilesPayloadLoader) Load added in v0.163.14

func (kfpl *KeystoreFilesPayloadLoader) Load() error

type KeystoreFilesPayloadStorer added in v0.163.14

type KeystoreFilesPayloadStorer struct {
	*AccountPayload
	// contains filtered or unexported fields
}

func NewKeystoreFilesPayloadStorer added in v0.163.14

func NewKeystoreFilesPayloadStorer(backend *api.GethStatusBackend, p *AccountPayload, config *KeystoreFilesReceiverConfig) (*KeystoreFilesPayloadStorer, error)

func (*KeystoreFilesPayloadStorer) Store added in v0.163.14

func (kfps *KeystoreFilesPayloadStorer) Store() error

type KeystoreFilesReceiverClient added in v0.163.14

type KeystoreFilesReceiverClient struct {
	*BaseClient
	// contains filtered or unexported fields
}

func NewKeystoreFilesReceiverClient added in v0.163.14

func NewKeystoreFilesReceiverClient(backend *api.GethStatusBackend, c *ConnectionParams, config *KeystoreFilesReceiverClientConfig) (*KeystoreFilesReceiverClient, error)

type KeystoreFilesReceiverClientConfig added in v0.163.14

type KeystoreFilesReceiverClientConfig struct {
	ReceiverConfig *KeystoreFilesReceiverConfig `json:"receiverConfig" validate:"required"`
	ClientConfig   *ClientConfig                `json:"clientConfig"`
}

func NewKeystoreFilesReceiverClientConfig added in v0.163.14

func NewKeystoreFilesReceiverClientConfig() *KeystoreFilesReceiverClientConfig

type KeystoreFilesReceiverConfig added in v0.163.14

type KeystoreFilesReceiverConfig struct {
	KeystoreFilesConfig
	KeypairsToImport []string `json:"keypairsToImport" validate:"required"`
}

type KeystoreFilesSenderConfig added in v0.163.14

type KeystoreFilesSenderConfig struct {
	KeystoreFilesConfig
	KeypairsToExport []string `json:"keypairsToExport" validate:"required"`
}

type KeystoreFilesSenderServer added in v0.163.14

type KeystoreFilesSenderServer struct {
	*BaseServer
	// contains filtered or unexported fields
}

func MakeKeystoreFilesSenderServer added in v0.163.14

func MakeKeystoreFilesSenderServer(backend *api.GethStatusBackend, config *KeystoreFilesSenderServerConfig) (*KeystoreFilesSenderServer, error)

MakeFullSenderServer generates a fully configured and randomly seeded KeystoreFilesSenderServer

func NewKeystoreFilesSenderServer added in v0.163.14

func NewKeystoreFilesSenderServer(backend *api.GethStatusBackend, config *KeystoreFilesSenderServerConfig) (*KeystoreFilesSenderServer, error)

type KeystoreFilesSenderServerConfig added in v0.163.14

type KeystoreFilesSenderServerConfig struct {
	SenderConfig *KeystoreFilesSenderConfig `json:"senderConfig" validate:"required"`
	ServerConfig *ServerConfig              `json:"serverConfig" validate:"omitempty,dive"`
}

func NewKeystoreFilesSenderServerConfig added in v0.163.14

func NewKeystoreFilesSenderServerConfig() *KeystoreFilesSenderServerConfig

type PayloadEncryptor added in v0.140.0

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

PayloadEncryptor is responsible for encrypting and decrypting payload data

func NewPayloadEncryptor added in v0.140.0

func NewPayloadEncryptor(aesKey []byte) *PayloadEncryptor

func (*PayloadEncryptor) Renew added in v0.140.0

func (pem *PayloadEncryptor) Renew() *PayloadEncryptor

Renew regenerates the whole PayloadEncryptor and returns the new instance, only the aesKey is preserved

type PayloadLoader added in v0.140.0

type PayloadLoader interface {
	Load() error
}

type PayloadLockPayload added in v0.142.9

type PayloadLockPayload struct {
	*PayloadEncryptor
}

PayloadLockPayload Embeds a *PayloadEncryptor to give all embedding structs EncryptionPayload Locking

func (*PayloadLockPayload) LockPayload added in v0.142.9

func (pl *PayloadLockPayload) LockPayload()

type PayloadLocker added in v0.140.0

type PayloadLocker interface {
	// LockPayload prevents future excess to outbound safe and received data
	LockPayload()
}

type PayloadMounter added in v0.140.0

type PayloadMounter interface {
	PayloadLocker

	// Mount Loads the payload into the PayloadManager's state
	Mount() error

	// ToSend returns an outbound safe (encrypted) payload
	ToSend() []byte
}

type PayloadMounterReceiver added in v0.140.0

type PayloadMounterReceiver interface {
	PayloadMounter
	PayloadReceiver
}

PayloadMounterReceiver represents a struct that can:

  • mount payload data from a PayloadRepository or a PayloadLoader into memory (PayloadMounter.Mount)
  • prepare data to be sent encrypted (PayloadMounter.ToSend) via some transport
  • receive and prepare encrypted transport data (PayloadReceiver.Receive) to be stored
  • prepare the received (PayloadReceiver.Received) data to be stored to a PayloadRepository or a PayloadStorer

type PayloadReceived added in v0.142.9

type PayloadReceived struct {
	*PayloadEncryptor
}

PayloadReceived Embeds a *PayloadEncryptor to give all embedding structs EncryptionPayload Received() functionality Useful to securely implement the PayloadReceiver interface

func (*PayloadReceived) Received added in v0.142.9

func (pr *PayloadReceived) Received() []byte

type PayloadReceiver added in v0.140.0

type PayloadReceiver interface {
	PayloadLocker

	// Receive accepts data from an inbound source into the PayloadReceiver's state
	Receive(data []byte) error

	// Received returns a decrypted and parsed payload from an inbound source
	Received() []byte
}

type PayloadRepository

type PayloadRepository interface {
	PayloadLoader
	PayloadStorer
}

PayloadRepository represents a struct that can both load and store data to an internally managed data store

type PayloadStorer added in v0.140.0

type PayloadStorer interface {
	Store() error
}

type PayloadToSend added in v0.142.9

type PayloadToSend struct {
	*PayloadEncryptor
}

PayloadToSend Embeds a *PayloadEncryptor to give all embedding structs EncryptionPayload ToSend() functionality Useful to securely implement the PayloadMounter interface

func (*PayloadToSend) ToSend added in v0.142.9

func (pts *PayloadToSend) ToSend() []byte

type PeerNotifier added in v0.146.3

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

func NewPeerNotifier added in v0.146.3

func NewPeerNotifier() *PeerNotifier

func (*PeerNotifier) Search added in v0.146.3

func (p *PeerNotifier) Search() error

type ProtobufMarshaller added in v0.142.9

type ProtobufMarshaller interface {
	MarshalProtobuf() ([]byte, error)
}

type ProtobufUnmarshaller added in v0.142.9

type ProtobufUnmarshaller interface {
	UnmarshalProtobuf([]byte) error
}

type RawMessageCollector

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

type RawMessageLoader added in v0.140.0

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

func NewRawMessageLoader added in v0.140.0

func NewRawMessageLoader(backend *api.GethStatusBackend, payload *RawMessagesPayload, config *SenderConfig) *RawMessageLoader

func (*RawMessageLoader) Load added in v0.140.0

func (r *RawMessageLoader) Load() (err error)

type RawMessagePayloadMarshaller added in v0.142.9

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

RawMessagePayloadMarshaller is responsible for marshalling and unmarshalling raw message data

func NewRawMessagePayloadMarshaller added in v0.142.9

func NewRawMessagePayloadMarshaller(payload *RawMessagesPayload) *RawMessagePayloadMarshaller

func (*RawMessagePayloadMarshaller) MarshalProtobuf added in v0.142.9

func (rmm *RawMessagePayloadMarshaller) MarshalProtobuf() (data []byte, err error)

func (*RawMessagePayloadMarshaller) UnmarshalProtobuf added in v0.142.9

func (rmm *RawMessagePayloadMarshaller) UnmarshalProtobuf(data []byte) error

type RawMessageStorer added in v0.140.0

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

func NewRawMessageStorer added in v0.140.0

func NewRawMessageStorer(backend *api.GethStatusBackend, payload *RawMessagesPayload, accountPayload *AccountPayload, config *ReceiverConfig) *RawMessageStorer

func (*RawMessageStorer) Store added in v0.140.0

func (r *RawMessageStorer) Store() error

type RawMessagesPayload added in v0.142.9

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

func NewRawMessagesPayload added in v0.142.9

func NewRawMessagesPayload() *RawMessagesPayload

type ReceiverClient added in v0.140.0

type ReceiverClient struct {
	*BaseClient
	// contains filtered or unexported fields
}

ReceiverClient is responsible for accepting pairing data to a SenderServer

func NewReceiverClient added in v0.140.0

func NewReceiverClient(backend *api.GethStatusBackend, c *ConnectionParams, config *ReceiverClientConfig) (*ReceiverClient, error)

NewReceiverClient returns a fully qualified ReceiverClient created with the incoming parameters

type ReceiverClientConfig added in v0.140.0

type ReceiverClientConfig struct {
	ReceiverConfig *ReceiverConfig `json:"receiverConfig" validate:"required"`
	ClientConfig   *ClientConfig   `json:"clientConfig"`
}

func NewReceiverClientConfig added in v0.140.0

func NewReceiverClientConfig() *ReceiverClientConfig

type ReceiverConfig added in v0.140.0

type ReceiverConfig struct {
	// nodeConfig is required, but we'll validate it separately
	NodeConfig *params.NodeConfig `json:"nodeConfig"`

	// ReceiverConfig.KeystorePath must not end with keyUID (because keyUID is not known yet)
	KeystorePath string `json:"keystorePath" validate:"required,not_end_keyuid"`

	// DeviceType SendPairInstallation need this information
	DeviceType    string `json:"deviceType" validate:"required"`
	KDFIterations int    `json:"kdfIterations" validate:"gte=0"`

	// SettingCurrentNetwork corresponding to field current_network from table settings, so that we can override current network from sender
	SettingCurrentNetwork string `json:"settingCurrentNetwork" validate:"required"`

	DeviceName     string                  `json:"deviceName"`
	DB             *multiaccounts.Database `json:"-"`
	LoggedInKeyUID string                  `json:"-"`
}

type ReceiverServer added in v0.140.0

type ReceiverServer struct {
	*BaseServer
	// contains filtered or unexported fields
}

func MakeFullReceiverServer added in v0.140.0

func MakeFullReceiverServer(backend *api.GethStatusBackend, config *ReceiverServerConfig) (*ReceiverServer, error)

MakeFullReceiverServer generates a fully configured and randomly seeded ReceiverServer

func NewReceiverServer added in v0.140.0

func NewReceiverServer(backend *api.GethStatusBackend, config *ReceiverServerConfig) (*ReceiverServer, error)

NewReceiverServer returns a *SenderServer init from the given *ReceiverServerConfig

type ReceiverServerConfig added in v0.140.0

type ReceiverServerConfig struct {
	ReceiverConfig *ReceiverConfig `json:"receiverConfig" validate:"required"`
	ServerConfig   *ServerConfig   `json:"serverConfig" validate:"omitempty,dive"`
}

func NewReceiverServerConfig added in v0.140.0

func NewReceiverServerConfig() *ReceiverServerConfig

type SenderClient added in v0.140.0

type SenderClient struct {
	*BaseClient
	// contains filtered or unexported fields
}

SenderClient is responsible for sending pairing data to a ReceiverServer

func NewSenderClient added in v0.140.0

func NewSenderClient(backend *api.GethStatusBackend, c *ConnectionParams, config *SenderClientConfig) (*SenderClient, error)

NewSenderClient returns a fully qualified SenderClient created with the incoming parameters

type SenderClientConfig added in v0.140.0

type SenderClientConfig struct {
	SenderConfig *SenderConfig `json:"senderConfig" validate:"required"`
	ClientConfig *ClientConfig `json:"clientConfig"`
}

func NewSenderClientConfig added in v0.140.0

func NewSenderClientConfig() *SenderClientConfig

type SenderConfig added in v0.140.0

type SenderConfig struct {
	// SenderConfig.KeystorePath must end with keyUID
	KeystorePath string `json:"keystorePath" validate:"required,keystorepath"`
	// DeviceType SendPairInstallation need this information
	DeviceType string `json:"deviceType" validate:"required"`

	KeyUID   string `json:"keyUID" validate:"required,keyuid"`
	Password string `json:"password" validate:"required"`
	ChatKey  string `json:"chatKey"` // set only in case of a Keycard user, otherwise empty

	DB *multiaccounts.Database `json:"-"`
}

type SenderServer added in v0.140.0

type SenderServer struct {
	*BaseServer
	// contains filtered or unexported fields
}

func MakeFullSenderServer added in v0.140.0

func MakeFullSenderServer(backend *api.GethStatusBackend, config *SenderServerConfig) (*SenderServer, error)

MakeFullSenderServer generates a fully configured and randomly seeded SenderServer

func NewSenderServer added in v0.140.0

func NewSenderServer(backend *api.GethStatusBackend, config *SenderServerConfig) (*SenderServer, error)

NewSenderServer returns a *SenderServer init from the given *SenderServerConfig

type SenderServerConfig added in v0.140.0

type SenderServerConfig struct {
	SenderConfig *SenderConfig `json:"senderConfig" validate:"required"`
	ServerConfig *ServerConfig `json:"serverConfig" validate:"omitempty,dive"`
}

func NewSenderServerConfig added in v0.140.0

func NewSenderServerConfig() *SenderServerConfig

type ServerConfig added in v0.140.0

type ServerConfig struct {
	// Timeout the number of milliseconds after which the pairing server will automatically terminate
	Timeout uint `json:"timeout" validate:"omitempty,gte=0"`

	PK          *ecdsa.PublicKey `json:"-"`
	EK          []byte           `json:"-"`
	Cert        *tls.Certificate `json:"-"`
	ListenIP    net.IP           `json:"-"`
	IPAddresses []net.IP         `json:"-"`
}

type SyncRawMessageHandler

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

func NewSyncRawMessageHandler

func NewSyncRawMessageHandler(backend *api.GethStatusBackend) *SyncRawMessageHandler

func (*SyncRawMessageHandler) CollectInstallationData added in v0.134.0

func (s *SyncRawMessageHandler) CollectInstallationData(rawMessageCollector *RawMessageCollector, deviceType string) error

func (*SyncRawMessageHandler) HandleRawMessage

func (s *SyncRawMessageHandler) HandleRawMessage(accountPayload *AccountPayload, nodeConfig *params.NodeConfig, settingCurrentNetwork, deviceType string, deviceName string, rmp *RawMessagesPayload) (err error)

func (*SyncRawMessageHandler) PrepareRawMessage

func (s *SyncRawMessageHandler) PrepareRawMessage(keyUID, deviceType string) (rm []*protobuf.RawMessage, kp *accounts.Keypair, syncSettings *settings.Settings, err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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