Card Reveal

Once you have collected encrypted cardholder data, you may need to dislay the plaintext card number to your users. Our Card Reveal product allows you to do this safely, without ever handling the card data in plaintext.

Getting started


The Reveal component allows you to request and display decrypted card data inside of an iframe served from our PCI-compliant infrastructure. Because the request is made from within the Evervault iframe, the plaintext card data is never exposed to your application.

Retrieving the encrypted card data


To use Reveal, you will first need to have a JSON endpoint that returns the encrypted card data. It is important that this endpoint returns encrypted data, not plaintext. For example, let's say you have the following endpoint to retrieve a stored card:

It's also important that the endpoint that you create sets applicable CORS headers so that it can be accessed from the Reveal Component iframe. Otherwise your requests will fail.

Next, you will need to create a new Relay for your endpoint, and configure it to decrypt the card data on response. Reveal will only accept requests made to Evervault Relay domains so you must proxy your request through a Relay.

Install the Evervault SDK


Once you have an endpoint configured through Relay to retrieve the encrypted data, you can use our client side SDK to display the card data.

Our JavaScript SDK is distributed from our CDN, and can be installed by placing this script tag in the head of your HTML file. The SDK must be loaded directly from our CDN and cannot be bundled with your application or self hosted.

Once the SDK is installed, initialize it using your Team ID and App ID. You can find these in the Evervault Dashboard.

You can also install Evervault via the @evervault/js package on npm. This package is a light wrapper which handles loading the SDK from our CDN and also provides TypeScript definitions.

Frequently Asked Questions

Create a Reveal component


To create an instance of the Reveal component, you will need to pass in a request to your relay endpoint.

Once you have created an instance of the Reveal component, you can use the text method to display data that is returned from the decrypted response. The text method accepts a JSON path to the field inside of the response that you want to display. Once you have created a text instance, you must mount it to the DOM using the mount method. This will render an iframe that displays only the field data matching the provided JSON path.

Learn more about the Reveal component in the JavaScript SDK documentation.

Styling


The reveal component can be fully customised to match the design of your application. This can be done by passing a theme option when rendering the component. A theme is just an object with a styles property. This styles property uses a CSS-as-JS format to define CSS rules for the component. These rules will be compiled to CSS and injected into the iframe.