(attachments)
| 322 | } |
| 323 | |
| 324 | setAttachments(attachments) { |
| 325 | const encrypted = []; |
| 326 | const regex = /.*\.(gpg|pgp|asc)/; |
| 327 | for (const attachment of attachments) { |
| 328 | const content = dataURL2str(attachment.data); |
| 329 | if (regex.test(attachment.filename) && !/-----BEGIN\sPGP\sPUBLIC\sKEY\sBLOCK/.test(content)) { |
| 330 | encrypted.push(attachment); |
| 331 | } else { |
| 332 | this.ports.editor.emit('set-attachment', {attachment: {content, ...attachment}}); |
| 333 | } |
| 334 | } |
| 335 | if (encrypted.length) { |
| 336 | this.ports.editor.emit('decrypt-in-progress'); |
| 337 | this.decryptFiles(encrypted); |
| 338 | } |
| 339 | } |
| 340 | |
| 341 | /** |
| 342 | * Decrypt armored message |
no test coverage detected