protonmail: Update MessagePackageSet BodyKey for new API.

This commit is contained in:
Brandon McDonnell 2018-10-20 14:30:03 +00:00
parent 95ee806a93
commit 9a6f7187a5
1 changed files with 5 additions and 3 deletions

View File

@ -403,7 +403,7 @@ type MessagePackageSet struct {
Body string // Encrypted body data packet
// Only if cleartext is sent
BodyKey string
BodyKey map[string]string
AttachmentKeys map[string]string
bodyKey *packet.EncryptedKey
@ -494,8 +494,10 @@ func (set *MessagePackageSet) AddCleartext(addr string) (*MessagePackage, error)
set.Addresses[addr] = pkg
set.Type |= MessagePackageCleartext
if set.BodyKey == "" || set.AttachmentKeys == nil {
set.BodyKey = base64.StdEncoding.EncodeToString(set.bodyKey.Key)
if set.BodyKey == nil || set.AttachmentKeys == nil {
set.BodyKey = make(map[string]string, 2)
set.BodyKey["Algorithm"] = "aes256"
set.BodyKey["Key"] = base64.StdEncoding.EncodeToString(set.bodyKey.Key)
set.AttachmentKeys = make(map[string]string, len(set.attachmentKeys))
for att, key := range set.attachmentKeys {