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

2
go.mod
View File

@ -7,7 +7,7 @@ require (
github.com/Masterminds/semver/v3 v3.2.0 github.com/Masterminds/semver/v3 v3.2.0
github.com/ProtonMail/gluon v0.17.1-0.20230817061728-c2e6c5429251 github.com/ProtonMail/gluon v0.17.1-0.20230817061728-c2e6c5429251
github.com/ProtonMail/go-autostart v0.0.0-20210130080809-00ed301c8e9a github.com/ProtonMail/go-autostart v0.0.0-20210130080809-00ed301c8e9a
github.com/ProtonMail/go-proton-api v0.4.1-0.20230727082146-c761773c5126 github.com/ProtonMail/go-proton-api v0.4.1-0.20230814133746-f04227131310
github.com/ProtonMail/gopenpgp/v2 v2.7.1-proton github.com/ProtonMail/gopenpgp/v2 v2.7.1-proton
github.com/PuerkitoBio/goquery v1.8.1 github.com/PuerkitoBio/goquery v1.8.1
github.com/abiosoft/ishell v2.0.0+incompatible github.com/abiosoft/ishell v2.0.0+incompatible

4
go.sum
View File

@ -35,8 +35,8 @@ github.com/ProtonMail/go-message v0.13.1-0.20230526094639-b62c999c85b7 h1:+j+Kd/
github.com/ProtonMail/go-message v0.13.1-0.20230526094639-b62c999c85b7/go.mod h1:NBAn21zgCJ/52WLDyed18YvYFm5tEoeDauubFqLokM4= github.com/ProtonMail/go-message v0.13.1-0.20230526094639-b62c999c85b7/go.mod h1:NBAn21zgCJ/52WLDyed18YvYFm5tEoeDauubFqLokM4=
github.com/ProtonMail/go-mime v0.0.0-20230322103455-7d82a3887f2f h1:tCbYj7/299ekTTXpdwKYF8eBlsYsDVoggDAuAjoK66k= github.com/ProtonMail/go-mime v0.0.0-20230322103455-7d82a3887f2f h1:tCbYj7/299ekTTXpdwKYF8eBlsYsDVoggDAuAjoK66k=
github.com/ProtonMail/go-mime v0.0.0-20230322103455-7d82a3887f2f/go.mod h1:gcr0kNtGBqin9zDW9GOHcVntrwnjrK+qdJ06mWYBybw= github.com/ProtonMail/go-mime v0.0.0-20230322103455-7d82a3887f2f/go.mod h1:gcr0kNtGBqin9zDW9GOHcVntrwnjrK+qdJ06mWYBybw=
github.com/ProtonMail/go-proton-api v0.4.1-0.20230727082146-c761773c5126 h1:H9/7F5A8IBHIAIYpxLtaD4PeMCnC+f32Wt7bPL9EGcU= github.com/ProtonMail/go-proton-api v0.4.1-0.20230814133746-f04227131310 h1:phvSTOUN0dIJmt/WSjpQcxcF0jG43+RBtlDpBAYLBKo=
github.com/ProtonMail/go-proton-api v0.4.1-0.20230727082146-c761773c5126/go.mod h1:nS8hMGjJLgC0Iej0JMYbsI388LesEkM1Hj/jCCxQeaQ= github.com/ProtonMail/go-proton-api v0.4.1-0.20230814133746-f04227131310/go.mod h1:nS8hMGjJLgC0Iej0JMYbsI388LesEkM1Hj/jCCxQeaQ=
github.com/ProtonMail/go-srp v0.0.7 h1:Sos3Qk+th4tQR64vsxGIxYpN3rdnG9Wf9K4ZloC1JrI= github.com/ProtonMail/go-srp v0.0.7 h1:Sos3Qk+th4tQR64vsxGIxYpN3rdnG9Wf9K4ZloC1JrI=
github.com/ProtonMail/go-srp v0.0.7/go.mod h1:giCp+7qRnMIcCvI6V6U3S1lDDXDQYx2ewJ6F/9wdlJk= github.com/ProtonMail/go-srp v0.0.7/go.mod h1:giCp+7qRnMIcCvI6V6U3S1lDDXDQYx2ewJ6F/9wdlJk=
github.com/ProtonMail/gopenpgp/v2 v2.7.1-proton h1:YS6M20yvjCJPR1r4ADW5TPn6rahs4iAyZaACei86bEc= github.com/ProtonMail/gopenpgp/v2 v2.7.1-proton h1:YS6M20yvjCJPR1r4ADW5TPn6rahs4iAyZaACei86bEc=

View File

@ -53,12 +53,14 @@ func WithAddrKRs(apiUser proton.User, apiAddr map[string]proton.Address, keyPass
for addrID, apiAddr := range apiAddr { for addrID, apiAddr := range apiAddr {
addrKR, err := apiAddr.Keys.Unlock(keyPass, userKR) addrKR, err := apiAddr.Keys.Unlock(keyPass, userKR)
if err != nil { 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() defer addrKR.ClearPrivateParams()
if addrKR.CountDecryptionEntities() == 0 { if addrKR.CountDecryptionEntities() == 0 {
logrus.WithField("addressID", addrID).Warn("Address keyring has no decryption entities") logrus.WithField("addressID", addrID).Warn("Address keyring has no decryption entities")
continue
} }
addrKRs[addrID] = addrKR addrKRs[addrID] = addrKR