Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
@evervault/react
Advanced tools
The Evervault React.js SDK is a toolkit for encrypting data on the client. Using the Evervault React.js SDK means your customer's data never leaves their device unencrypted.
Before starting with the Evervault Node.js SDK, you will need to create an account and a team.
For full installation support, book time here.
See the Evervault React.js SDK documentation.
Our React.js SDK is distributed via npm, and can be installed using your preferred package manager.
npm i @evervault/react
Once installed, initialize the React.js SDK with your team's unique ID found in the Settings. 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>;
);
The Evervault React.js SDK exposes two functions.
evervault.encrypt()
encrypts data for use in your Cages. To encrypt data on the client, simply pass the value into the evervault.encrypt()
function. Store the encrypted data in your database as normal. Send it to your API and use our Node.js SDK to forward the data to your Cage.
async evervault.encrypt(data: Object | Array | String | Number);
Parameter | Type | Description |
---|---|---|
data | Object , Array , String or Number | Data to be encrypted. |
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>}
);
}
evervault.inputs()
initializes Evervault Inputs which make it easy to collect encrypted cardholder data in a completely PCI-compliant environment.
Evervault Inputs are served within an iFrame retrieved directly from Evervault’s PCI-compliant infrastructure, which can reduce your PCI DSS compliance scope to the simplest form (SAQ-A) once integrated correctly.
Simply pass the id of the element in which the iFrame should be embedded.
We also support themes so you can customise how Inputs looks in your UI.
evervault.inputs(id: String, theme: String);
Parameter | Type | Description |
---|---|---|
id | string | Id of the element in which the Evervault Inputs iFrame should be embedded |
theme | string | Optional theme for styling Inputs, currently supported: minimal |
There are two ways of accessing encrypted card data once it has been entered.
In each case, a cardData
object containing details about the card data your user has entered is returned.
{
"card": {
"type": "visa_credit",
"number": "ev:encrypted:abc123",
"cvc": "ev:encrypted:def456",
"expMonth": "01",
"expYear": "23"
},
"isValid": true,
"isPotentiallyValid": true,
"isEmpty": false,
"error": {
"type": "invalid_pan",
"message": "The credit card number you entered was invalid"
}
}
onChange
hookThis option is best when you are looking to handle the card values in realtime, like displaying validation errors as a user is inputting their card data. The callback for the hook is run every time your user updates the card data.
const evervault = useEvervault();
const [encryptedData, setEncryptedData] = useState(undefined);
const initEvForm = async () => {
const encryptedInput = evervault?.input?.generate("encryptedInput");
encryptedInput?.on("change", async (cardData) => {
setEncryptedData(cardData);
});
useEffect(() => {
initEvForm();
}, [evervault]);
};
getData
methodThis option is best when you are looking to retrieve card data occasionally, like when your form is submitted.
const cardData = await inputs.getData();
Bug reports and pull requests are welcome on GitHub at https://github.com/evervault/evervault-react.
Questions or feedback? Let us know.
FAQs
React package for the Evervault SDK
The npm package @evervault/react receives a total of 1,394 weekly downloads. As such, @evervault/react popularity was classified as popular.
We found that @evervault/react demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.