github.com/status-im/status-go@v1.1.0/server/pairing/events.go (about)

     1  package pairing
     2  
     3  import "github.com/status-im/status-go/multiaccounts"
     4  
     5  // EventType type for event types.
     6  type EventType string
     7  
     8  const (
     9  	// Both Sender and Receiver
    10  
    11  	EventPeerDiscovered       EventType = "peer-discovered"
    12  	EventConnectionError      EventType = "connection-error"
    13  	EventConnectionSuccess    EventType = "connection-success"
    14  	EventTransferError        EventType = "transfer-error"
    15  	EventTransferSuccess      EventType = "transfer-success"
    16  	EventReceivedInstallation EventType = "received-installation"
    17  
    18  	// Only Receiver side
    19  
    20  	EventReceivedAccount       EventType = "received-account"
    21  	EventProcessSuccess        EventType = "process-success"
    22  	EventProcessError          EventType = "process-error"
    23  	EventReceivedKeystoreFiles EventType = "received-keystore-files"
    24  )
    25  
    26  // Event is a type for transfer events.
    27  type Event struct {
    28  	Type   EventType `json:"type"`
    29  	Error  string    `json:"error,omitempty"`
    30  	Action Action    `json:"action"`
    31  	Data   any       `json:"data,omitempty"`
    32  }
    33  
    34  type Action int
    35  
    36  const (
    37  	ActionConnect Action = iota + 1
    38  	ActionPairingAccount
    39  	ActionSyncDevice
    40  	ActionPairingInstallation
    41  	ActionPeerDiscovery
    42  	ActionKeystoreFilesTransfer
    43  )
    44  
    45  type AccountData struct {
    46  	Account  *multiaccounts.Account `json:"account,omitempty"`
    47  	Password string                 `json:"password,omitempty"`
    48  	ChatKey  string                 `json:"chatKey,omitempty"`
    49  }