mirror of
https://github.com/status-im/status-go.git
synced 2025-01-10 06:36:32 +00:00
49eaabaca5
* chore_: remove duplicated `StartNodeWithKey` * feat(KeycardPairing)_: added GetPairings method * chore_: simplify startNode... methods * chore_: added encryption path to be derived * fix_: error handling in StartNodeWithKey * feat_: added keycard properties to CreateAccount * feat_: moved KeycardWhisperPrivateKey to LoginAccount * fix_: LoginAccount during local pairing * feat_: added chat key handling to loginAccount * chore_: struct response from generateOrImportAccount * fix_: do not store keycard account to keystore * feat_: added Mnemonic parameter to LoginAccount * chore_: wrap loginAccount errors * feat_: RestoreKeycardAccountAndLogin endpoint * chore_: merge RestoreKeycardAccountRequest into RestoreAccountRequest * fix_: TestRestoreKeycardAccountAndLogin * fix_: MessengerRawMessageResendTest * chore_: cleanup * chore_: cleanup according to pr comments * chore_: better doc for Login.Mnemonic * chore_: add/fix comments * fix_: lint
50 lines
1.4 KiB
Go
50 lines
1.4 KiB
Go
package requests
|
|
|
|
import (
|
|
"errors"
|
|
)
|
|
|
|
var (
|
|
ErrRestoreAccountInvalidMnemonic = errors.New("restore-account: no mnemonic or keycard is set")
|
|
ErrRestoreAccountMnemonicAndKeycard = errors.New("restore-account: both mnemonic and keycard info are set")
|
|
)
|
|
|
|
type RestoreAccount struct {
|
|
Mnemonic string `json:"mnemonic"`
|
|
|
|
// Keycard info can be set instead of Mnemonic.
|
|
// This is to log in using a keycard with existing account.
|
|
Keycard *KeycardData `json:"keycard"`
|
|
|
|
FetchBackup bool `json:"fetchBackup"`
|
|
|
|
CreateAccount
|
|
}
|
|
|
|
func (c *RestoreAccount) Validate() error {
|
|
if len(c.Mnemonic) == 0 && c.Keycard == nil {
|
|
return ErrRestoreAccountInvalidMnemonic
|
|
}
|
|
|
|
if len(c.Mnemonic) > 0 && c.Keycard != nil {
|
|
return ErrRestoreAccountMnemonicAndKeycard
|
|
}
|
|
|
|
return c.CreateAccount.Validate(&CreateAccountValidation{
|
|
AllowEmptyDisplayName: true,
|
|
})
|
|
}
|
|
|
|
type KeycardData struct {
|
|
KeyUID string `json:"keyUID"`
|
|
Address string `json:"address"`
|
|
WhisperPrivateKey string `json:"whisperPrivateKey"`
|
|
WhisperPublicKey string `json:"whisperPublicKey"`
|
|
WhisperAddress string `json:"whisperAddress"`
|
|
WalletPublicKey string `json:"walletPublicKey"`
|
|
WalletAddress string `json:"walletAddress"`
|
|
WalletRootAddress string `json:"walletRootAddress"`
|
|
Eip1581Address string `json:"eip1581Address"`
|
|
EncryptionPublicKey string `json:"encryptionPublicKey"`
|
|
}
|