Protect, Track & Control Data.
Anywhere. Anytime.

Get started in JavaScript, Node.js, Python, or C++.

Client-side JS Access Controls

Virtru SDKs support many Information Rights Management (IRM) controls. These controls enable you to have a fine-grained way to control access to protected files even after they have been shared with employees, contractors or partners.

Controls

Revoke Revoke

The "Revoke" control allows the owner of the object (or an administrator) to revoke access from one or more users on a file protected with any Virtru SDK. Once access is revoked, a user can no longer decrypt the protected file.

<!DOCTYPE html>
<html>
<head>
    <title>Virtru SDK for JavaScript - Sample Application</title>
    <link href="https://sdk.virtru.com/js/latest/auth-widget/index.css" rel="stylesheet"/>
    <script src="https://sdk.virtru.com/js/latest/auth-widget/index.js"></script>
    <script src="https://sdk.virtru.com/js/1.6.11/virtru-sdk.min.js"></script>
</head>

<body>
  <div id="virtru-auth-widget-mount"></div>
  <script type="text/javascript">
    async function afterAuth(email) {
      const client = new Virtru.Client({email});
      const params = new Virtru.DecryptParamsBuilder()
        .withFileSource("/tmp/darmok.html") 
        .build();
          
      const policyId = await client.getPolicyId(params);
      const origPolicy = await client.fetchPolicy(policyId);
      
      const updatedPolicy  = policy.builder()
        .removeUsersWithAccess("[email protected]")
        .build();
      await client.updatePolicy(updatedPolicy)
    }
    Virtru.AuthWidget('virtru-auth-widget-mount', {afterAuth});
  </script>
</body>
</html>

How revoke affects owners and admins

Even if all users' access is revoked, the owner (who originally protected the file) and admin will continue to have access.

Revoke All Revoke All

The "Revoke All" control allows the owner of the protected file (or the admin) to revoke access from all users on a Virtru protected file. In other words, any users who were previously granted access will lose it. The owner and the admin will continue to have access.

<!DOCTYPE html>
<html>
<head>
    <title>Virtru SDK for JavaScript - Sample Application</title>
    <link href="https://sdk.virtru.com/js/latest/auth-widget/index.css" rel="stylesheet"/>
    <script src="https://sdk.virtru.com/js/latest/auth-widget/index.js"></script>
    <script src="https://sdk.virtru.com/js/1.6.11/virtru-sdk.min.js"></script>
</head>

<body>
  <div id="virtru-auth-widget-mount"></div>
  <script type="text/javascript">
    async function afterAuth(email) {
      const client = new Virtru.Client({email});
      const params = new Virtru.DecryptParamsBuilder()
        .withFileSource("/tmp/darmok.html") 
        .build();
          
      const policyId = await client.getPolicyId(params);
     
      await client.revokePolicy(policyId)
    }
    Virtru.AuthWidget('virtru-auth-widget-mount', {afterAuth});
  </script>
</body>
</html>

Reverse Revoke All

This operation is reversible. The owner (or the admin) can grant access via the Virtru Dashboard or via "Grant Access" SDK policy call.

Grant

The "Grant" control allows the owner of the object (or an administrator) to grant access to one or more users on a file protected with any Virtru SDK. Once access is granted, a user can decrypt the protected file.

<!DOCTYPE html>
<html>
<head>
    <title>Virtru SDK for JavaScript - Sample Application</title>
    <link href="https://sdk.virtru.com/js/latest/auth-widget/index.css" rel="stylesheet"/>
    <script src="https://sdk.virtru.com/js/latest/auth-widget/index.js"></script>
    <script src="https://sdk.virtru.com/js/1.6.11/virtru-sdk.min.js"></script>
</head>

<body>
  <div id="virtru-auth-widget-mount"></div>
  <script type="text/javascript">
    async function afterAuth(email) {
      const client = new Virtru.Client({email});
      const users = ["[email protected]"];
      const yourString = prompt('Type a sting to encrypt: ', 'Hello, world!');
      const policy = new Virtru.PolicyBuilder()
        .addUsersWithAccess(users)
        .build();
    
      const encryptParams = new Virtru.EncryptParamsBuilder()
        .withStringSource(yourString)
        .withDisplayFilename('hello.txt')
        .withPolicy(policy)
        .build();
    
      ct = await client.encrypt(encryptParams);
      await ct.toFile('hello.txt.tdf3.html');
    }
    Virtru.AuthWidget('virtru-auth-widget-mount', {afterAuth});
  </script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
    <title>Virtru SDK for JavaScript - Sample Application</title>
    <link href="https://sdk.virtru.com/js/latest/auth-widget/index.css" rel="stylesheet"/>
    <script src="https://sdk.virtru.com/js/latest/auth-widget/index.js"></script>
    <script src="https://sdk.virtru.com/js/1.6.11/virtru-sdk.min.js"></script>
</head>

<body>
  <div id="virtru-auth-widget-mount"></div>
  <script type="text/javascript">
    async function afterAuth(email) {
      const client = new Virtru.Client({email});
      const params = new Virtru.DecryptParamsBuilder()
        .withFileSource("hello.txt.tdf3.html")
        .build();
      const policyId = await client.getPolicyId(params);
      const existingPolicy = await client.fetchPolicy(policyId);
      
      const users = ["[email protected]"];
      const updatedPolicy  = existingPolicy.builder()
        .addUsersWithAccess(users)
        .build();
    
      await client.updatePolicy(updatedPolicy)
    }
    Virtru.AuthWidget('virtru-auth-widget-mount', {afterAuth});
  </script>
</body>
</html>

Expire Expire

The "Expire" control allows the owner (or the admin) to set an expiration date/time on a file protected with the Virtru SDK. After the expiration date/time has passed, any users who were previously granted access will be unable to decrypt.

Expiration can be specified in relative time with:

  • enableExpirationDeadlineFromNow(Int) - Int in seconds from creation
  • enableExpirationDeadline("2022-08-12T14:37:26.101Z") - Time of expiration
<!DOCTYPE html>
<html>
<head>
    <title>Virtru SDK for JavaScript - Sample Application</title>
    <link href="https://sdk.virtru.com/js/latest/auth-widget/index.css" rel="stylesheet"/>
    <script src="https://sdk.virtru.com/js/latest/auth-widget/index.js"></script>
    <script src="https://sdk.virtru.com/js/1.6.11/virtru-sdk.min.js"></script>
</head>

<body>
  <div id="virtru-auth-widget-mount"></div>
  <script type="text/javascript">
    async function afterAuth(email) {
      const client = new Virtru.Client({email});
      const yourString = prompt('Type a sting to encrypt: ', 'Hello, world!');
    
      const policy = new Virtru.PolicyBuilder()
        .enableExpirationDeadlineFromNow(60*10) // 10 Minutes
        .build();    
    
      const encryptParams = new Virtru.EncryptParamsBuilder()
        .withStringSource(yourString)
        .withDisplayFilename('hello.txt')
        .withPolicy(policy)
        .build();
    
      ct = await client.encrypt(encryptParams);
      await ct.toFile('hello.txt.tdf3.html');
    }
    Virtru.AuthWidget('virtru-auth-widget-mount', {afterAuth});
  </script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
    <title>Virtru SDK for JavaScript - Sample Application</title>
    <link href="https://sdk.virtru.com/js/latest/auth-widget/index.css" rel="stylesheet"/>
    <script src="https://sdk.virtru.com/js/latest/auth-widget/index.js"></script>
    <script src="https://sdk.virtru.com/js/1.6.11/virtru-sdk.min.js"></script>
</head>

<body>
  <div id="virtru-auth-widget-mount"></div>
  <script type="text/javascript">
    async function afterAuth(email) {
      const client = new Virtru.Client({email});
      const params = new Virtru.DecryptParamsBuilder()
        .withFileSource("hello.txt.tdf3.html")
        .build();
    
      const policyId = await client.getPolicyId(params);
      const existingPolicy = await client.fetchPolicy(policyId);
      
      const updatedPolicy  = existingPolicy.builder()
        .enableExpirationDeadline("2022-08-12T14:37:26.101Z")
        .build();
    
      await client.updatePolicy(updatedPolicy)
    }
    Virtru.AuthWidget('virtru-auth-widget-mount', {afterAuth});
  </script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
    <title>Virtru SDK for JavaScript - Sample Application</title>
    <link href="https://sdk.virtru.com/js/latest/auth-widget/index.css" rel="stylesheet"/>
    <script src="https://sdk.virtru.com/js/latest/auth-widget/index.js"></script>
    <script src="https://sdk.virtru.com/js/1.6.11/virtru-sdk.min.js"></script>
</head>

<body>
  <div id="virtru-auth-widget-mount"></div>
  <script type="text/javascript">
    async function afterAuth(email) {
      const client = new Virtru.Client({email});
      const params = new Virtru.DecryptParamsBuilder()
        .withFileSource("hello.txt.tdf3.html")
        .build();
    
      const policyId = await client.getPolicyId(params);
      const existingPolicy = await client.fetchPolicy(policyId);
      
      const updatedPolicy  = existingPolicy.builder()
        .disableExpirationDeadline()
        .build();
    
      await client.updatePolicy(updatedPolicy)
    }
    Virtru.AuthWidget('virtru-auth-widget-mount', {afterAuth});
  </script>
</body>
</html>

How expiration affects owners and admins

The owner and the admin will continue to have access to protected files even after the expiration date and time have passed.

Watermark Watermark

Watermarking provides persistent control and individualized tracking for sensitive documents. A watermark is typically an authenticated user's email address that overlays a protected file when that file is accessed.

<!DOCTYPE html>
<html>
<head>
    <title>Virtru SDK for JavaScript - Sample Application</title>
    <link href="https://sdk.virtru.com/js/latest/auth-widget/index.css" rel="stylesheet"/>
    <script src="https://sdk.virtru.com/js/latest/auth-widget/index.js"></script>
    <script src="https://sdk.virtru.com/js/1.6.11/virtru-sdk.min.js"></script>
</head>

<body>
  <div id="virtru-auth-widget-mount"></div>
  <script type="text/javascript">
    async function afterAuth(email) {     
      const client = new Virtru.Client({email});
      const yourString = prompt('Type a sting to encrypt: ', 'Hello, world!');
    
      const policy = new Virtru.PolicyBuilder()
        .enableWatermarking()
        .build();    
    
      const encryptParams = new Virtru.EncryptParamsBuilder()
        .withStringSource(yourString)
        .withDisplayFilename('hello.txt')
        .withPolicy(policy)
        .build();
    
      ct = await client.encrypt(encryptParams);
      await ct.toFile('hello.txt.tdf3.html');
    }
    Virtru.AuthWidget('virtru-auth-widget-mount', {afterAuth});
  </script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
    <title>Virtru SDK for JavaScript - Sample Application</title>
    <link href="https://sdk.virtru.com/js/latest/auth-widget/index.css" rel="stylesheet"/>
    <script src="https://sdk.virtru.com/js/latest/auth-widget/index.js"></script>
    <script src="https://sdk.virtru.com/js/1.6.11/virtru-sdk.min.js"></script>
</head>

<body>
  <div id="virtru-auth-widget-mount"></div>
  <script type="text/javascript">
    async function afterAuth(email) {     
      const client = new Virtru.Client({email});
      const params = new Virtru.DecryptParamsBuilder()
        .withFileSource("hello.txt.tdf3.html")
        .build();
    
      const policyId = await client.getPolicyId(params);
      const existingPolicy = await client.fetchPolicy(policyId);
      
      const updatedPolicy  = existingPolicy.builder()
        .enableWatermarking()
        .build();
    
      await client.updatePolicy(updatedPolicy)
    }
    Virtru.AuthWidget('virtru-auth-widget-mount', {afterAuth});
  </script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
    <title>Virtru SDK for JavaScript - Sample Application</title>
    <link href="https://sdk.virtru.com/js/latest/auth-widget/index.css" rel="stylesheet"/>
    <script src="https://sdk.virtru.com/js/latest/auth-widget/index.js"></script>
    <script src="https://sdk.virtru.com/js/1.6.11/virtru-sdk.min.js"></script>
</head>

<body>
  <div id="virtru-auth-widget-mount"></div>
  <script type="text/javascript">
    async function afterAuth(email) {      
      const client = new Virtru.Client({email});
      const params = new Virtru.DecryptParamsBuilder()
        .withFileSource("hello.txt.tdf3.html")
        .build();
    
      const policyId = await client.getPolicyId(params);
      const existingPolicy = await client.fetchPolicy(policyId);
      
      const updatedPolicy  = existingPolicy.builder()
        .disableWatermarking()
        .build();
    
      await client.updatePolicy(updatedPolicy)
    }
    Virtru.AuthWidget('virtru-auth-widget-mount', {afterAuth});
  </script>
</body>
</html>

Where is watermarking supported?

Currently, a watermark is only visible when a protected file is accessed via Virtru's Secure Reader. With watermarking enabled, attempting to decrypt that file with the Virtru SDK will fail.

Updated 14 days ago


Client-side JS Access Controls


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.