Skip to content

Instantly share code, notes, and snippets.

@trevorfoskett
Last active November 5, 2019 20:47
Show Gist options
  • Save trevorfoskett/6348256b20effc879f1f1aed330b5790 to your computer and use it in GitHub Desktop.
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
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