fix(GODT-2865): add error on failed unlock.

This commit is contained in:
Jakub
2023-08-15 11:46:31 +02:00
committed by Jakub Cuth
parent db77bd4983
commit 884c6ed932
3 changed files with 6 additions and 4 deletions

View File

@ -53,12 +53,14 @@ func WithAddrKRs(apiUser proton.User, apiAddr map[string]proton.Address, keyPass
for addrID, apiAddr := range apiAddr {
addrKR, err := apiAddr.Keys.Unlock(keyPass, userKR)
if err != nil {
return fmt.Errorf("failed to unlock address keys: %w", err)
logrus.WithField("addressID", addrID).WithError(err).Warn("Failed to unlock address keys")
continue
}
defer addrKR.ClearPrivateParams()
if addrKR.CountDecryptionEntities() == 0 {
logrus.WithField("addressID", addrID).Warn("Address keyring has no decryption entities")
continue
}
addrKRs[addrID] = addrKR