Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@evervault/react

Package Overview
Dependencies
Maintainers
7
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@evervault/react - npm Package Compare versions

Comparing version 0.2.3 to 0.2.4

.github/pull_request_template.md

2

build/lib/index.js

@@ -1,1 +0,1 @@

!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("react"));else if("function"==typeof define&&define.amd)define(["react"],t);else{var r="object"==typeof exports?t(require("react")):t(e.react);for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}(window,(function(e){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=1)}([function(t,r){t.exports=e},function(e,t,r){"use strict";r.r(t),r.d(t,"EvervaultContext",(function(){return p})),r.d(t,"EvervaultProvider",(function(){return y})),r.d(t,"useEvervault",(function(){return b}));var n=r(0),o=r.n(n);function u(){return(u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function i(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var r=[],n=!0,o=!1,u=void 0;try{for(var i,a=e[Symbol.iterator]();!(n=(i=a.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){o=!0,u=e}finally{try{n||null==a.return||a.return()}finally{if(o)throw u}}return r}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function a(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},u=Object.keys(e);for(n=0;n<u.length;n++)r=u[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(e);for(n=0;n<u.length;n++)r=u[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function c(e,t,r,n,o,u,i){try{var a=e[u](i),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,o)}var l=/^https:\/\/js\.evervault\.com\/v1\/?(\?.*)?$/,f=null,v=function(){return null!==f?f:f=new Promise((function(e,t){if("undefined"!=typeof window)if(window.Evervault&&console.warn("Evervault has already been loaded"),window.Evervault)e(window.Evervault);else try{var r=d();r?console.warn("Evervault has already been loaded"):r||(r=function(){var e=document.createElement("script");e.src="https://js.evervault.com/v1";var t=document.head||document.body;if(!t)throw new Error("Expected document.body not to be null. Evervault.js requires a <body> element.");return t.appendChild(e),e}()),r.addEventListener("load",(function(){window.Evervault?e(window.Evervault):t(new Error("Evervault.js not available"))})),r.addEventListener("error",(function(){t(new Error("Failed to load Evervault.js"))}))}catch(e){return void t(e)}else e(null)}))},d=function(){for(var e=document.querySelectorAll<HTMLScriptElement>'script[src^="'.concat("https://js.evervault.com/v1",'"]'),t=0;t<e.length;t++){var r=e[t];if(l.test(r.src))return r}return null},s=function(){var e,t=(e=regeneratorRuntime.mark((function e(){var t,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=Promise.resolve().then((function(){return v()})),r=!1,t.catch((function(e){r||console.warn(e)})),r=!0,e.abrupt("return",t.then((function(){"undefined"!=typeof window&&window.Evervault})));case 5:case"end":return e.stop()}}),e)})),function(){var t=this,r=arguments;return new Promise((function(n,o){var u=e.apply(t,r);function i(e){c(u,n,o,i,a,"next",e)}function a(e){c(u,n,o,i,a,"throw",e)}i(void 0)}))});return function(){return t.apply(this,arguments)}}(),p=o.a.createContext(void 0),y=function(e){var t=e.teamId,r=e.children,n=a(e,["teamId","children"]),c=i(o.a.useState(void 0),2),l=c[0],f=c[1];return o.a.useEffect((function(){s().then((function(e){return f(new e(t))}))}),[s]),o.a.createElement(p.Provider,u({},n,{value:l}),r)};function b(){if("function"!=typeof o.a.useContext)throw new Error("You must use React >= 16.8 in order to use useEvervault()");return o.a.useContext(p)}}])}));
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("react"));else if("function"==typeof define&&define.amd)define(["react"],t);else{var r="object"==typeof exports?t(require("react")):t(e.react);for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}(window,(function(e){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=1)}([function(t,r){t.exports=e},function(e,t,r){"use strict";r.r(t),r.d(t,"EvervaultContext",(function(){return p})),r.d(t,"EvervaultProvider",(function(){return y})),r.d(t,"useEvervault",(function(){return b}));var n=r(0),o=r.n(n);function u(){return(u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function i(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var r=[],n=!0,o=!1,u=void 0;try{for(var i,a=e[Symbol.iterator]();!(n=(i=a.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){o=!0,u=e}finally{try{n||null==a.return||a.return()}finally{if(o)throw u}}return r}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function a(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},u=Object.keys(e);for(n=0;n<u.length;n++)r=u[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(e);for(n=0;n<u.length;n++)r=u[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function c(e,t,r,n,o,u,i){try{var a=e[u](i),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,o)}var l=/^https:\/\/js\.evervault\.com\/v1\/?(\?.*)?$/,f=null,v=function(){return null!==f?f:f=new Promise((function(e,t){if("undefined"!=typeof window)if(window.Evervault&&console.warn("Evervault has already been loaded"),window.Evervault)e(window.Evervault);else try{var r=d();r?console.warn("Evervault has already been loaded"):r||(r=function(){var e=document.createElement("script");e.src="https://js.evervault.com/v1";var t=document.head||document.body;if(!t)throw new Error("Expected document.body not to be null. Evervault.js requires a <body> element.");return t.appendChild(e),e}()),r.addEventListener("load",(function(){window.Evervault?e(window.Evervault):t(new Error("Evervault.js not available"))})),r.addEventListener("error",(function(){t(new Error("Failed to load Evervault.js"))}))}catch(e){return void t(e)}else e(null)}))},d=function(){for(var e=document.querySelectorAll<HTMLScriptElement>'script[src^="'.concat("https://js.evervault.com/v1",'"]'),t=0;t<e.length;t++){var r=e[t];if(l.test(r.src))return r}return null},s=function(){var e,t=(e=regeneratorRuntime.mark((function e(){var t,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=Promise.resolve().then((function(){return v()})),r=!1,t.catch((function(e){r||console.warn(e)})),r=!0,e.abrupt("return",t.then((function(){if("undefined"!=typeof window)return window.Evervault})));case 5:case"end":return e.stop()}}),e)})),function(){var t=this,r=arguments;return new Promise((function(n,o){var u=e.apply(t,r);function i(e){c(u,n,o,i,a,"next",e)}function a(e){c(u,n,o,i,a,"throw",e)}i(void 0)}))});return function(){return t.apply(this,arguments)}}(),p=o.a.createContext(void 0),y=function(e){var t=e.teamId,r=e.children,n=a(e,["teamId","children"]),c=i(o.a.useState(void 0),2),l=c[0],f=c[1];return o.a.useEffect((function(){s().then((function(e){return f(new e(t))}))}),[s]),o.a.createElement(p.Provider,u({},n,{value:l}),r)};function b(){if("function"!=typeof o.a.useContext)throw new Error("You must use React >= 16.8 in order to use useEvervault()");return o.a.useContext(p)}}])}));

@@ -77,5 +77,6 @@ /** @format */

const findScript = () => {
const scripts = document.querySelectorAll<HTMLScriptElement>(
`script[src^="${EVERVAULT_URL}"]`
);
const scripts =
document.querySelectorAll <
HTMLScriptElement >
`script[src^="${EVERVAULT_URL}"]`;

@@ -95,3 +96,3 @@ for (let i = 0; i < scripts.length; i++) {

const loadEvervault = async () => {
const loadEvervault = async () => {
const evervaultPromise = Promise.resolve().then(() => loadScript());

@@ -109,5 +110,5 @@

return evervaultPromise.then(() => {
if (typeof window !== 'undefined') window.Evervault
})
}
if (typeof window !== 'undefined') return window.Evervault;
});
};

@@ -120,7 +121,11 @@ export const EvervaultContext = React.createContext(undefined);

React.useEffect(() => {
loadEvervault().then((evervault) => setEv(new evervault(teamId)))
loadEvervault().then((evervault) => setEv(new evervault(teamId)));
}, [loadEvervault]);
return <EvervaultContext.Provider {...props} value={ev}>{children}</EvervaultContext.Provider>;
}
return (
<EvervaultContext.Provider {...props} value={ev}>
{children}
</EvervaultContext.Provider>
);
};

@@ -127,0 +132,0 @@ export function useEvervault() {

{
"name": "@evervault/react",
"version": "0.2.3",
"version": "0.2.4",
"description": "React package for the Evervault SDK",

@@ -5,0 +5,0 @@ "main": "./build/lib/index.js",

@@ -1,1 +0,52 @@

# evervault-react
# evervault-react
The official React SDK for interacting with Evervault.
To learn more about Evervault, visit [the docs](https://docs.evervault.com/).
## Installing
```shell
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.
```javascript
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.
```javascript
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](https://github.com/evervault/evervault-node-sdk) to forward the data to your cage.
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc