Part of #1051
Relevant test here https://github.com/FlowCrypt/flowcrypt-mobile-core/blob/master/source/test.ts#L53
Only port encryptFile for now (which results in binary - unarmored - output). Don't port decryptFile because there are many error scenarios that we want to behave the same as before.
for(constkeypairNameofallKeypairNames.filter(name=>name!='expired')){ava.default(`encryptFile -> decryptFile ${keypairName}`,asynct=>{const{ pubKeys, keys }=getKeypairs(keypairName);constname='myfile.txt';constcontent=Buffer.from([10,20,40,80,160,0,25,50,75,100,125,150,175,200,225,250]);const{data: encryptedFile,json: encryptJson}=awaitrequest('encryptFile',{ pubKeys, name },content);expectEmptyJson(encryptJson);expectData(encryptedFile);const{data: decryptedContent,json: decryptJson}=awaitrequest('decryptFile',{ keys },encryptedFile);expect(decryptJson).to.deep.equal({success: true, name });expectData(decryptedContent,'binary',content);t.pass();});}Current implementation here https://github.com/FlowCrypt/flowcrypt-mobile-core/blob/master/source/mobile-interface/endpoints.ts
publicencryptFile=async(uncheckedReq: any,data: Buffers): Promise<Buffers>=>{constreq=ValidateInput.encryptFile(uncheckedReq);constencrypted=awaitPgpMsg.encrypt({pubkeys: req.pubKeys,data: Buf.concat(data),filename: req.name,armor: false})asOpenPGP.EncryptBinaryResult;returnfmtRes({},encrypted.message.packets.write());}
Part of #1051
Relevant test here https://github.com/FlowCrypt/flowcrypt-mobile-core/blob/master/source/test.ts#L53
Only port
encryptFilefor now (which results in binary - unarmored - output). Don't portdecryptFilebecause there are many error scenarios that we want to behave the same as before.Current implementation here https://github.com/FlowCrypt/flowcrypt-mobile-core/blob/master/source/mobile-interface/endpoints.ts