| 132 | } |
| 133 | |
| 134 | createFileObject({content, filename, signer, mimeType, armored}) { |
| 135 | const file = { |
| 136 | id: getUUID(), |
| 137 | name: filename, |
| 138 | signer, |
| 139 | }; |
| 140 | if (armored) { |
| 141 | file.onShowPopup = () => this.handleOpenDecryptMessagePopup(armored); |
| 142 | } |
| 143 | // set MIME type fix to application/octet-stream as other types can be exploited in Chrome |
| 144 | mimeType = 'application/octet-stream'; |
| 145 | const blob = new Blob([typeof content === 'string' ? str2ab(content) : content], {type: mimeType}); |
| 146 | file.objectURL = window.URL.createObjectURL(blob); |
| 147 | return file; |
| 148 | } |
| 149 | |
| 150 | async handleOpenDecryptMessagePopup(armored) { |
| 151 | await port.send('decrypt-message-init'); |