mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-22 01:56:44 +00:00
GODT-1779: Remove go-imap
This commit is contained in:
30
internal/user/crypto.go
Normal file
30
internal/user/crypto.go
Normal file
@ -0,0 +1,30 @@
|
||||
package user
|
||||
|
||||
import (
|
||||
"github.com/ProtonMail/gopenpgp/v2/crypto"
|
||||
"gitlab.protontech.ch/go/liteapi"
|
||||
)
|
||||
|
||||
func unlockKeyRings(user liteapi.User, addresses []liteapi.Address, keyPass []byte) (*crypto.KeyRing, map[string]*crypto.KeyRing, error) {
|
||||
userKR, err := user.Keys.Unlock(keyPass, nil)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
addrKRs := make(map[string]*crypto.KeyRing)
|
||||
|
||||
for _, address := range addresses {
|
||||
if !address.HasKeys.Bool() {
|
||||
continue
|
||||
}
|
||||
|
||||
addrKR, err := address.Keys.Unlock(keyPass, userKR)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
addrKRs[address.ID] = addrKR
|
||||
}
|
||||
|
||||
return userKR, addrKRs, nil
|
||||
}
|
||||
Reference in New Issue
Block a user