mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-17 15:46:44 +00:00
feat: migrate to gopenpgp v2
This commit is contained in:
@ -80,11 +80,10 @@ func buildMessage(client pmapi.Client, message *pmapi.Message) (*bytes.Buffer, e
|
||||
}
|
||||
|
||||
func encryptMessage(client pmapi.Client, message *pmapi.Message) error {
|
||||
addresses, err := client.GetAddresses()
|
||||
kr, err := client.KeyRingForAddressID(message.AddressID)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to get address")
|
||||
return errors.Wrap(err, "failed to get keyring for address")
|
||||
}
|
||||
kr := addresses.ByID(message.AddressID).KeyRing()
|
||||
|
||||
if err = message.Encrypt(kr, nil); err != nil {
|
||||
return errors.Wrap(err, "failed to encrypt message body")
|
||||
|
||||
@ -34,21 +34,25 @@ func (ctl *Controller) AddUser(user *pmapi.User, addresses *pmapi.AddressList, p
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to get auth info")
|
||||
}
|
||||
auth, err := client.Auth(user.Name, password, authInfo)
|
||||
|
||||
_, err = client.Auth(user.Name, password, authInfo)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to auth user")
|
||||
}
|
||||
|
||||
mailboxPassword, err := pmapi.HashMailboxPassword(password, auth.KeySalt)
|
||||
salt, err := client.AuthSalt()
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to get salt")
|
||||
}
|
||||
|
||||
mailboxPassword, err := pmapi.HashMailboxPassword(password, salt)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to hash mailbox password")
|
||||
}
|
||||
if _, err := client.Unlock(mailboxPassword); err != nil {
|
||||
|
||||
if err := client.Unlock([]byte(mailboxPassword)); err != nil {
|
||||
return errors.Wrap(err, "failed to unlock user")
|
||||
}
|
||||
if err := client.UnlockAddresses([]byte(mailboxPassword)); err != nil {
|
||||
return errors.Wrap(err, "failed to unlock addresses")
|
||||
}
|
||||
|
||||
if err := cleanup(client, addresses); err != nil {
|
||||
return errors.Wrap(err, "failed to clean user")
|
||||
|
||||
Reference in New Issue
Block a user