MCPcopy Create free account
hub / github.com/mailvelope/mailvelope / createFileObject

Function createFileObject

src/app/encrypt/Encrypt.js:193–206  ·  view source on GitHub ↗
({content, filename, mimeType})

Source from the content-addressed store, hash-verified

191 }
192
193 createFileObject({content, filename, mimeType}) {
194 // set MIME type fix to application/octet-stream as other types can be exploited in Chrome
195 mimeType = 'application/octet-stream';
196 const file = {id: getUUID()};
197 if (fileLib.extractFileExtension(filename) === 'txt') {
198 file.name = `${filename}.asc`;
199 file.content = content;
200 } else {
201 file.name = `${filename}.gpg`;
202 }
203 const blob = new Blob([str2ab(content)], {type: mimeType});
204 file.objectURL = window.URL.createObjectURL(blob);
205 return file;
206 }
207
208 async handleChangeSigningKey() {
209 const signingKeys = await port.send('get-signing-keys', {keyringId: this.state.keyringId});

Callers

nothing calls this directly

Calls 2

getUUIDFunction · 0.90
str2abFunction · 0.90

Tested by

no test coverage detected