(encFiles)
| 413 | } |
| 414 | |
| 415 | async decryptFiles(encFiles) { |
| 416 | try { |
| 417 | const unlockKey = async options => { |
| 418 | const result = await this.unlockKey(options); |
| 419 | if (this.state.popupId) { |
| 420 | this.ports.editor.emit('hide-pwd-dialog'); |
| 421 | } |
| 422 | return result; |
| 423 | }; |
| 424 | await Promise.all(encFiles.map(async file => { |
| 425 | const {filename, data} = await model.decryptFile({ |
| 426 | encryptedFile: {content: file.data, name: file.filename}, |
| 427 | unlockKey, |
| 428 | uiLogSource: 'security_log_editor' |
| 429 | }); |
| 430 | this.ports.editor.emit('set-attachment', {attachment: {content: data, filename, mimeType: file.mimeType}}); |
| 431 | })); |
| 432 | |
| 433 | this.ports.editor.emit('decrypt-end'); |
| 434 | } catch (error) { |
| 435 | this.ports.editor.emit('decrypt-failed', {error: mapError(error)}); |
| 436 | } |
| 437 | } |
| 438 | |
| 439 | /** |
| 440 | * Receive plaintext from editor, initiate encryption |
no test coverage detected