@evervault/react
Advanced tools
Comparing version 0.2.4 to 0.2.5
@@ -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(){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)}}])})); | ||
!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.customConfig,n=e.children,c=a(e,["teamId","customConfig","children"]),l=i(o.a.useState(void 0),2),f=l[0],v=l[1];return o.a.useEffect((function(){s().then((function(e){return v(new e(t,r))}))}),[s]),o.a.createElement(p.Provider,u({},c,{value:f}),n)};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)}}])})); |
@@ -114,7 +114,7 @@ /** @format */ | ||
export const EvervaultProvider = ({ teamId, children, ...props }) => { | ||
export const EvervaultProvider = ({ teamId, customConfig, children, ...props }) => { | ||
const [ev, setEv] = React.useState(undefined); | ||
React.useEffect(() => { | ||
loadEvervault().then((evervault) => setEv(new evervault(teamId))); | ||
loadEvervault().then((evervault) => setEv(new evervault(teamId, customConfig))); | ||
}, [loadEvervault]); | ||
@@ -121,0 +121,0 @@ |
{ | ||
"name": "@evervault/react", | ||
"version": "0.2.4", | ||
"version": "0.2.5", | ||
"description": "React package for the Evervault SDK", | ||
@@ -5,0 +5,0 @@ "main": "./build/lib/index.js", |
@@ -1,7 +0,21 @@ | ||
# evervault-react | ||
The official React SDK for interacting with Evervault. | ||
[![Evervault](https://evervault.com/evervault.svg)](https://evervault.com/) | ||
To learn more about Evervault, visit [the docs](https://docs.evervault.com/). | ||
# Evervault React.js SDK | ||
## Installing | ||
The [Evervault](https://evervault.com) 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. | ||
## Getting Started | ||
Before starting with the Evervault Node.js SDK, you will need to [create an account](https://app.evervault.com/register) and a team. | ||
For full installation support, [book time here](https://calendly.com/evervault/cages-onboarding). | ||
## Documentation | ||
See the Evervault [React.js SDK documentation](https://docs.evervault.com/reactjs). | ||
## Installation | ||
Our React.js SDK is distributed via [npm](https://www.npmjs.com/), and can be installed using your preferred package manager. | ||
```shell | ||
@@ -11,5 +25,6 @@ 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. | ||
## Setup | ||
To make Evervault available for use in your app, use an `EvervaultProvider` component as a provider for your app. | ||
```javascript | ||
@@ -48,7 +63,24 @@ import { EvervaultProvider } from '@evervault/react'; | ||
## Using Evervault React with Evervault Cages | ||
Using Evervault react means your customer's data never leaves their device unencrypted. | ||
## Reference | ||
Evervault React encrypts data that can be sent directly into an Evervault Cage and operated on. | ||
The Evervault React.js SDK exposes one function. | ||
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. | ||
### evervault.encrypt() | ||
`evervault.encrypt()` encrypts data for use in your [Cages](https://docs.evervault.com/tutorial). To encrypt data on the client, simply pass an object or string 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](https://docs.evervault.com/nodejs) to forward the data to your Cage. | ||
```javascript | ||
async evervault.encrypt(data: Object | String); | ||
``` | ||
| Parameter | Type | Description | | ||
| --------- | ---- | ----------- | | ||
| data | Object or String | Data to be encrypted. | | ||
## Contributing | ||
Bug reports and pull requests are welcome on GitHub at https://github.com/evervault/evervault-react. | ||
## Feedback | ||
Questions or feedback? [Let us know](mailto:support@evervault.com). |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13851
85