fix(@desktop/keycard): convert to keycard account process fixed
- converting to keycard account 3 words alias was used instead of display name
This commit is contained in:
parent
a3b71c7d91
commit
d985e347ce
|
@ -348,8 +348,19 @@ proc setupAccountKeycard*(self: Service, keycardData: KeycardEvent) =
|
||||||
let installationId = $genUUID()
|
let installationId = $genUUID()
|
||||||
|
|
||||||
let alias = generateAliasFromPk(keycardData.whisperKey.publicKey)
|
let alias = generateAliasFromPk(keycardData.whisperKey.publicKey)
|
||||||
|
|
||||||
|
let openedAccounts = self.openedAccounts()
|
||||||
|
var displayName: string
|
||||||
|
for acc in openedAccounts:
|
||||||
|
if acc.keyUid == keycardData.keyUid:
|
||||||
|
displayName = acc.name
|
||||||
|
break
|
||||||
|
if displayName.len == 0:
|
||||||
|
displayName = self.getLoggedInAccount().name
|
||||||
|
|
||||||
var accountDataJson = %* {
|
var accountDataJson = %* {
|
||||||
"name": alias,
|
"name": alias,
|
||||||
|
"display-name": displayName,
|
||||||
"address": keycardData.masterKey.address,
|
"address": keycardData.masterKey.address,
|
||||||
"key-uid": keycardData.keyUid
|
"key-uid": keycardData.keyUid
|
||||||
}
|
}
|
||||||
|
@ -529,9 +540,15 @@ proc loginAccountKeycard*(self: Service, keycardData: KeycardEvent): string =
|
||||||
try:
|
try:
|
||||||
self.setKeyStoreDir(keycardData.keyUid)
|
self.setKeyStoreDir(keycardData.keyUid)
|
||||||
|
|
||||||
let alias = generateAliasFromPk(keycardData.whisperKey.publicKey)
|
let openedAccounts = self.openedAccounts()
|
||||||
|
var accToBeLoggedIn: AccountDto
|
||||||
|
for acc in openedAccounts:
|
||||||
|
if acc.keyUid == keycardData.keyUid:
|
||||||
|
accToBeLoggedIn = acc
|
||||||
|
break
|
||||||
|
|
||||||
var accountDataJson = %* {
|
var accountDataJson = %* {
|
||||||
"name": alias,
|
"name": accToBeLoggedIn.name,
|
||||||
"address": keycardData.masterKey.address,
|
"address": keycardData.masterKey.address,
|
||||||
"key-uid": keycardData.keyUid
|
"key-uid": keycardData.keyUid
|
||||||
}
|
}
|
||||||
|
@ -550,8 +567,7 @@ proc loginAccountKeycard*(self: Service, keycardData: KeycardEvent): string =
|
||||||
if error == "":
|
if error == "":
|
||||||
debug "Account logged in succesfully"
|
debug "Account logged in succesfully"
|
||||||
# this should be fetched later from waku
|
# this should be fetched later from waku
|
||||||
self.loggedInAccount.name = alias
|
self.loggedInAccount = accToBeLoggedIn
|
||||||
self.loggedInAccount.keyUid = keycardData.keyUid
|
|
||||||
self.loggedInAccount.keycardPairing = accountDataJson{"keycard-pairing"}.getStr
|
self.loggedInAccount.keycardPairing = accountDataJson{"keycard-pairing"}.getStr
|
||||||
return
|
return
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
@ -580,7 +596,9 @@ proc convertToKeycardAccount*(self: Service, keyUid: string, password: string):
|
||||||
"name": self.getLoggedInAccount().name,
|
"name": self.getLoggedInAccount().name,
|
||||||
"key-uid": keyUid
|
"key-uid": keyUid
|
||||||
}
|
}
|
||||||
var settingsJson = %* { }
|
var settingsJson = %* {
|
||||||
|
"display-name": self.getLoggedInAccount().name
|
||||||
|
}
|
||||||
|
|
||||||
self.addKeycardDetails(settingsJson, accountDataJson)
|
self.addKeycardDetails(settingsJson, accountDataJson)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue