({files, keyFprs, signKeyFpr, unlockKey, noCache})
| 570 | } |
| 571 | |
| 572 | encryptFiles({files, keyFprs, signKeyFpr, unlockKey, noCache}) { |
| 573 | this.ports.editor.emit('encrypt-in-progress'); |
| 574 | return Promise.all(files.map(async file => { |
| 575 | const fileExt = extractFileExtension(file.name); |
| 576 | const encrypted = await model.encryptFile({ |
| 577 | plainFile: file, |
| 578 | armor: fileExt === 'txt', |
| 579 | keyringId: this.state.keyringId, |
| 580 | encryptionKeyFprs: keyFprs, |
| 581 | signingKeyFpr: signKeyFpr, |
| 582 | unlockKey, |
| 583 | noCache, |
| 584 | uiLogSource: 'security_log_editor' |
| 585 | }); |
| 586 | const base64encoded = btoa(encrypted); |
| 587 | return {content: `data:application/octet-stream;base64,${base64encoded}`, size: byteCount(base64encoded), name: fileExt === 'txt' ? `${file.name}.asc` : `${file.name}.gpg`}; |
| 588 | })); |
| 589 | } |
| 590 | |
| 591 | /** |
| 592 | * Create a cleartext signature |
no test coverage detected