fix(keycard): subaccounts updated wiht keyuid, colorhash and colorid

This commit is contained in:
Sale Djenic 2022-10-19 17:19:30 +02:00 committed by saledjenic
parent 63d46481fd
commit b18ae7b617
1 changed files with 21 additions and 0 deletions

View File

@ -362,6 +362,27 @@ func SaveAccountAndLoginWithKeycard(accountData, password, settingsJSON, configJ
if err != nil {
return makeJSONResponse(err)
}
for i, acc := range subaccs {
subaccs[i].KeyUID = account.KeyUID
if acc.Chat {
colorHash, err := colorhash.GenerateFor(string(acc.PublicKey.Bytes()))
if err != nil {
return makeJSONResponse(err)
}
account.ColorHash = colorHash
colorID, err := identityUtils.ToColorID(string(acc.PublicKey.Bytes()))
if err != nil {
return makeJSONResponse(err)
}
account.ColorID = colorID
break
}
}
api.RunAsync(func() error {
log.Debug("starting a node, and saving account with configuration", "key-uid", account.KeyUID)
err := statusBackend.SaveAccountAndStartNodeWithKey(account, password, settings, &conf, subaccs, keyHex)