Created
November 25, 2019 19:15
-
-
Save trevorfoskett/99b424bc49ace765300b225249699af9 to your computer and use it in GitHub Desktop.
Encrypting to a file instead of to string.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Encryption function. | |
* | |
* @param {string} fileName Name of the file to encrypt. | |
*/ | |
async function encrypt(fileName){ | |
const encryptParams = new Virtru.EncryptParamsBuilder() | |
.withFileSource(`./encrypt-in/${fileName}`) | |
.withDisplayfileName(fileName) | |
.build(); | |
ct = await client.encrypt(encryptParams); | |
//var ctString = await ct.toString(); | |
await ct.toFile(`./encrypt-out/${fileName}`); // Encrypt directly to file instead of string. | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment