Created
November 5, 2019 21:03
-
-
Save trevorfoskett/89dc6ac540aa51dfa5cf87bb6785ff20 to your computer and use it in GitHub Desktop.
Updated Virtru encrypt client to allow the emailing of the protected file.
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
const client = new Virtru.Client({email}); | |
const encryptParams = new Virtru.EncryptParamsBuilder() | |
.withArrayBufferSource(arrayBuffer) | |
.withDisplayFilename(`${docTitle}.pdf`) | |
.withPolicy(policy) | |
.withUsersWithAccess(authorizedUsers) | |
.build(); | |
const ct = await client.encrypt(encryptParams); | |
var ctString = await ct.toString(); // Encrypt to string rather than to file | |
// Run server-side function to generate an email | |
// to the list of authorized users and include | |
// the HTML generated above as an attachment. | |
var userMessage = $('#email-body').val().replace(/\n/g, '<br/>'); | |
// Take user input from a field in the sidebar and preserve line breaks | |
google.script.run.sendEmail(ctString, authorizedUsers, userMessage); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment