mirror of
https://github.com/status-im/status-go.git
synced 2025-01-23 05:00:35 +00:00
feat_: add KeycardPairingKey for mobile (#6101)
This commit is contained in:
parent
735a422230
commit
c2d79e785e
@ -1713,6 +1713,12 @@ func (b *GethStatusBackend) prepareForKeycard(request *requests.CreateAccount, i
|
||||
return response, nil
|
||||
}
|
||||
|
||||
if request.KeycardPairingKey != "" {
|
||||
// KeycardPairingKey is used only on mobile
|
||||
response.settings.KeycardPairing = request.KeycardPairingKey
|
||||
response.account.KeycardPairing = request.KeycardPairingKey
|
||||
} else {
|
||||
// KeycardPairingDataFile is used only on desktop
|
||||
kp := wallet.NewKeycardPairings()
|
||||
kp.SetKeycardPairingsFile(response.nodeConfig.KeycardPairingDataFile)
|
||||
pairings, err := kp.GetPairings()
|
||||
@ -1725,12 +1731,15 @@ func (b *GethStatusBackend) prepareForKeycard(request *requests.CreateAccount, i
|
||||
return nil, errors.New("keycard not found in pairings file")
|
||||
}
|
||||
|
||||
response.settings.KeycardInstanceUID = request.KeycardInstanceUID
|
||||
response.settings.KeycardPairedOn = time.Now().Unix()
|
||||
response.settings.KeycardPairing = keycard.Key
|
||||
response.account.KeycardPairing = keycard.Key
|
||||
}
|
||||
|
||||
response.settings.KeycardInstanceUID = request.KeycardInstanceUID
|
||||
response.settings.KeycardPairedOn = time.Now().Unix()
|
||||
|
||||
privateKeyHex := strings.TrimPrefix(input.derivedAddresses[pathDefaultChat].PrivateKey, "0x")
|
||||
var err error
|
||||
response.chatPrivateKey, err = crypto.HexToECDSA(privateKeyHex)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "failed to parse chat private key hex")
|
||||
|
@ -80,6 +80,10 @@ type CreateAccount struct {
|
||||
APIConfig *APIConfig `json:"apiConfig"`
|
||||
|
||||
KeycardInstanceUID string `json:"keycardInstanceUID"`
|
||||
|
||||
// on mobile there is no KeycardPairingDataFile, so for now KeycardPairingKey will be used
|
||||
// for recovering account
|
||||
KeycardPairingKey string `json:"keycardPairingKey"`
|
||||
KeycardPairingDataFile *string `json:"keycardPairingDataFile"`
|
||||
StatusProxyEnabled bool `json:"statusProxyEnabled"`
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user