Skip to content

refactor pwd messages to only create pgpmime attachments once per batch #4495

@tomholub

Description

@tomholub

For a refactor in another issue:

  • this sendablePwdMsg method could be removed
  • formatSendablePwdMsgs could call const emailIntroAndLinkBody = await this.formatPwdEncryptedMsgBodyLink(msgUrl); and return await SendableMsg.createPwdMsg(this.acctEmail, this.headers(newMsg), emailIntroAndLinkBody, messageBodyAsPgpMimeAttachmentsEncryptedForSender, { isDraft: this.isDraft, externalId });
  • messageBodyAsPgpMimeAttachmentsEncryptedForSender could be created only once, and reused in each cycle of the loop in formatSendablePwdMsgs
  • to create messageBodyAsPgpMimeMetaAttachmentsEncryptedForSender you could reuse most of existing sendablePwdMsg that relates to creating this pgpmime attachments, and this new method could be called encryptMessageBodyAsPgpMimeMetaAttachments and only sender pubkeys would be passed into it to create messageBodyAsPgpMimeMetaAttachmentsEncryptedForSender

The point is that this encryption only needs to happen once per batch, not once per each pwd msg, and it only needs to use pubkeys of sender, not everybody's pubkeys.

Originally posted by @tomholub in #4284 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions