Last active
November 5, 2019 20:47
-
-
Save trevorfoskett/6348256b20effc879f1f1aed330b5790 to your computer and use it in GitHub Desktop.
Customize the default Virtru client to accept arrayBuffer input and output pdf.tdf3.html
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
async function afterAuth(email) { | |
// Run all client code from here. | |
// This will only be called when the user is successfully authenticated. | |
const client = new Virtru.Client({email}); | |
const yourString = prompt('Type a sting to encrypt: ', 'Hello, world!'); | |
const encryptParams = new Virtru.EncryptParamsBuilder() | |
.withArrayBufferSource(arrayBuffer) // Change input to accept arrayBuffer | |
.withDisplayFilename('hello.pdf') // Change display filename to reflect PDF | |
.build(); | |
const ct = await client.encrypt(encryptParams); | |
await ct.toFile('hello.pdf.tdf3.html'); // Change output file extension to pdf.tdf3.html | |
} | |
// Set up the auth widget. | |
Virtru.AuthWidget('virtru-auth-widget-mount', {afterAuth}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment