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

Function createFileObject

src/app/decrypt/Decrypt.js:134–148  ·  view source on GitHub ↗
({content, filename, signer, mimeType, armored})

Source from the content-addressed store, hash-verified

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');

Callers

nothing calls this directly

Calls 2

getUUIDFunction · 0.90
str2abFunction · 0.90

Tested by

no test coverage detected