JSPM

  • Created
  • Published
  • Downloads 35431
  • Score
    100M100P100Q140807F
  • License ISC

React package for the Evervault SDK

Package Exports

  • @evervault/react

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@evervault/react) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

evervault-react

The official React SDK for interacting with Evervault.

To learn more about Evervault, visit the docs.

Installing

npm i @evervault/react

Getting started

To make Evervault available for use in your application, use an EvervaultProvider component as a provider for your App.

import { EvervaultProvider } from '@evervault/react';

export const App = () => {
  <EvervaultProvider teamId={'<YOUR-TEAM-ID>'}>
    <ChildComponent />
  </EvervaultProvider>
}

Then any time you want to encrypt data, simply import useEvervault in your component.

import React from 'react';
import { useEvervault } from '@evervault/react';

export const MyComponent = ({ someState }) => { 
  const evervault = useEvervault();
  const [encryptedState, setEncryptedState] = React.useState(undefined);
  
  const encryptState = React.useCallback(
    async () => setEncryptedState(await evervault.encrypt(someState)), 
    [setEncryptedState, evervault]  
  );

  React.useEffect(() => encryptState(), [encryptState])
  
  return (
    { encryptedState && (<p>encryptedState</p>) }
  );
}

Using Evervault React with Evervault Cages

Using Evervault react means your customer's data never leaves their device unencrypted.

Evervault React encrypts data that can be sent directly into an Evervault Cage and operated on.

Once your data is encrypted, send it to your API and use our Node SDK to forward the data to your cage.