B4B Show.js

by VeryGoodFiddle

HTML

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title></title>
</head>
<body>
  <h2>Show.js example</h2>

  <div id="secret-data"></div>
  <div id="secret-data2"></div>

  <button id="request-data">
    Request Sensitive Data
  </button>

  <pre id="state"></pre>

  <style media="screen">
    iframe {
      border: 0px solid transparent;
      height: 190px;
    }
  </style>
  <script type="text/javascript" src="https://js.verygoodvault.io/vgs-show/1.1/show.js"></script>
  <script type="text/javascript">

  const button = document.getElementById('request-data');

  button.addEventListener('click', function() {
    const show = VGSShow.create('tntseuctj4u', function(state) {
      document.getElementById('state').innerText = JSON.stringify(state, null, '  ');
    });

    const iframe = show.request({
      name: 'data-text',
      method: 'POST',
      path: '/decrypt2',
      htmlWrapper: 'image',
      xhrResponseType: 'arraybuffer',
      displayBase64Image: true,
    });

    iframe.render('#secret-data2',
    {
       border: '1px solid lightgrey',
    }
    );
  });

  </script>

</body>
</html>