MCPcopy Index your code
hub / github.com/mailvelope/mailvelope / encryptFiles

Method encryptFiles

src/controller/editor.controller.js:572–589  ·  view source on GitHub ↗
({files, keyFprs, signKeyFpr, unlockKey, noCache})

Source from the content-addressed store, hash-verified

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

Callers 2

signAndEncryptMethod · 0.95
handleEncryptFunction · 0.80

Calls 4

extractFileExtensionFunction · 0.90
byteCountFunction · 0.90
encryptFileMethod · 0.80
emitMethod · 0.45

Tested by

no test coverage detected