chore: pairings file related properties removed from the local pairing

The pairings file is transferred along with the `SyncKeypair` message.
This commit is contained in:
Sale Djenic 2023-09-12 21:31:46 +02:00 committed by saledjenic
parent 6894295ac3
commit 3bacb84a02
5 changed files with 15 additions and 20 deletions

View File

@ -15,10 +15,9 @@ type SenderConfig struct {
// DeviceType SendPairInstallation need this information // DeviceType SendPairInstallation need this information
DeviceType string `json:"deviceType" validate:"required"` DeviceType string `json:"deviceType" validate:"required"`
KeyUID string `json:"keyUID" validate:"required,keyuid"` KeyUID string `json:"keyUID" validate:"required,keyuid"`
Password string `json:"password" validate:"required"` Password string `json:"password" validate:"required"`
ChatKey string `json:"chatKey"` // set only in case of a Keycard user, otherwise empty ChatKey string `json:"chatKey"` // set only in case of a Keycard user, otherwise empty
KeycardPairings string `json:"keycardPairings"`
DB *multiaccounts.Database `json:"-"` DB *multiaccounts.Database `json:"-"`
} }

View File

@ -43,8 +43,7 @@ const (
) )
type AccountData struct { type AccountData struct {
Account *multiaccounts.Account `json:"account,omitempty"` Account *multiaccounts.Account `json:"account,omitempty"`
Password string `json:"password,omitempty"` Password string `json:"password,omitempty"`
ChatKey string `json:"chatKey,omitempty"` ChatKey string `json:"chatKey,omitempty"`
KeycardPairings string `json:"keycardPairings,omitempty"`
} }

View File

@ -25,11 +25,10 @@ var (
// AccountPayload represents the payload structure a Server handles // AccountPayload represents the payload structure a Server handles
type AccountPayload struct { type AccountPayload struct {
keys map[string][]byte // nolint: structcheck keys map[string][]byte // nolint: structcheck
multiaccount *multiaccounts.Account multiaccount *multiaccounts.Account
password string password string
chatKey string chatKey string
keycardPairings string
//flag if account already exist before sync account //flag if account already exist before sync account
exist bool exist bool
} }
@ -46,10 +45,9 @@ func NewPairingPayloadMarshaller(ap *AccountPayload, logger *zap.Logger) *Accoun
func (ppm *AccountPayloadMarshaller) MarshalProtobuf() ([]byte, error) { func (ppm *AccountPayloadMarshaller) MarshalProtobuf() ([]byte, error) {
lpp := &protobuf.LocalPairingPayload{ lpp := &protobuf.LocalPairingPayload{
Keys: ppm.accountKeysToProtobuf(), Keys: ppm.accountKeysToProtobuf(),
Password: ppm.password, Password: ppm.password,
ChatKey: ppm.chatKey, ChatKey: ppm.chatKey,
KeycardPairings: ppm.keycardPairings,
} }
if ppm.multiaccount != nil { if ppm.multiaccount != nil {
lpp.Multiaccount = ppm.multiaccount.ToProtobuf() lpp.Multiaccount = ppm.multiaccount.ToProtobuf()
@ -87,7 +85,7 @@ func (ppm *AccountPayloadMarshaller) UnmarshalProtobuf(data []byte) error {
} }
ppm.password = pb.Password ppm.password = pb.Password
ppm.chatKey = pb.ChatKey ppm.chatKey = pb.ChatKey
ppm.keycardPairings = pb.KeycardPairings
return nil return nil
} }

View File

@ -112,7 +112,6 @@ func NewAccountPayloadLoader(p *AccountPayload, config *SenderConfig) (*AccountP
ppr.keyUID = config.KeyUID ppr.keyUID = config.KeyUID
ppr.password = config.Password ppr.password = config.Password
ppr.chatKey = config.ChatKey ppr.chatKey = config.ChatKey
ppr.keycardPairings = config.KeycardPairings
ppr.keystorePath = config.KeystorePath ppr.keystorePath = config.KeystorePath
return ppr, nil return ppr, nil
} }

View File

@ -101,7 +101,7 @@ func NewAccountPayloadReceiver(e *PayloadEncryptor, p *AccountPayload, config *R
return NewBasePayloadReceiver(e, NewPairingPayloadMarshaller(p, l), aps, return NewBasePayloadReceiver(e, NewPairingPayloadMarshaller(p, l), aps,
func() { func() {
data := AccountData{Account: p.multiaccount, Password: p.password, ChatKey: p.chatKey, KeycardPairings: p.keycardPairings} data := AccountData{Account: p.multiaccount, Password: p.password, ChatKey: p.chatKey}
signal.SendLocalPairingEvent(Event{Type: EventReceivedAccount, Action: ActionPairingAccount, Data: data}) signal.SendLocalPairingEvent(Event{Type: EventReceivedAccount, Action: ActionPairingAccount, Data: data})
}, },
), nil ), nil