Skip to content

Instantly share code, notes, and snippets.

@trevorfoskett
Created November 5, 2019 16:59
Show Gist options
  • Save trevorfoskett/6caec35d38e73fa2a6349e8cd118e8be to your computer and use it in GitHub Desktop.
Save trevorfoskett/6caec35d38e73fa2a6349e8cd118e8be to your computer and use it in GitHub Desktop.
Default Virtru JS Client from quickstart.
<body>
<div id="virtru-auth-widget-mount"></div>
<script type="text/javascript">
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()
.withStringSource(yourString)
.withDisplayFilename('hello.txt')
.build();
const ct = await client.encrypt(encryptParams);
await ct.toFile('hello.html');
}
// Set up the auth widget.
Virtru.AuthWidget('virtru-auth-widget-mount', {afterAuth});
</script>
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment