Skip to content
E3Kit is an SDK that simplifies work with Virgil services and presents the easiest way to add full end-to-end (E2EE) security to their applications to become HIPAA and GDPR compliant and more.
Branch: master
Clone or download
xlwknx Merge pull request #23 from VirgilSecurity/cardoso-patch-1
Change readme.io to dev docs use cases
Latest commit 3b40474 Mar 20, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
config add apiUrl to EThree constructor and initialize method Feb 22, 2019
example migrate from jest to karma+mocha+expect from jest Jan 29, 2019
src review fix Mar 19, 2019
.editorconfig
.env.example fix encrypting for own key Dec 22, 2018
.gitignore add EThree comments Mar 18, 2019
.prettierrc
.travis.yml update travis to run before deploy Mar 19, 2019
CHANGELOG.md fix mistake Feb 21, 2019
LICENSE Initial commit Oct 17, 2018
README.md Merge branch 'master' into cardoso-patch-1 Mar 20, 2019
karma.conf.js add apiUrl to EThree constructor and initialize method Feb 22, 2019
package-lock.json add EThree comments Mar 18, 2019
package.json add EThree comments Mar 18, 2019
tsconfig.json error comments Mar 18, 2019
tslint.json init Oct 17, 2018

README.md

Virgil E3Kit Typescript/Javascript SDK

Build Status npm GitHub license

Introduction | SDK Features | Installation | Usage Example | Docs | Support

Introduction

Virgil Security provides an SDK which simplifies work with Virgil services and presents easy to use API for adding security to any application. In a few simple steps you can setup user encryption with multidevice support.

SDK Features

  • multidevice support
  • manage users' Public Keys

Installation

You can install this module from npm. Another option is to add it via script tag in browser.

npm

You will need to install @virgilsecurity/e3kit.

npm install @virgilsecurity/e3kit

In browser via script tag

You will need to add @virgilsecurity/e3kit script.

<script src="https://unpkg.com/@virgilsecurity/e3kit/dist/e3kit.browser.umd.js"></script>

Usage Example

Initialize & Register

import { EThree } from '@virgilsecurity/e3kit-js'
// get virgil token from you backend (better to protect it!)
const getToken = () => fetch('http://localhost:3000/get-virgil-jwt/')
    .then(res => res.json())
    .then(data =>  data.token);

// get your unique identity from backend
const sdk = await EThree.initialize(getToken);
// create private key and upload it to our protected cloud service
await sdk.register();
await sdk.backupPrivateKey('encryption_pwd');

Encrypt & Decrypt

const usersToEncryptTo = ["alice@myapp.com", "bob@myapp.com", 'sofia@myapp.com'];
const userThatEncrypts = "alex@myapp.com";
const [receiverPublicKeys, senderPublicKey] = await Promise.all([
    eThree.lookupPublicKeys(usersToEncryptTo),
    eThree.lookupPublicKeys(userThatEncrypts)
]);

const encryptedMsg = await eThree.encrypt('Send you my sensitive information!', receiversPublicKeys);
const decryptedMsg = await eThree.decrypt(encryptedMsg, senderPublicKey);
// we decrypt the message and check that it is sent by "alex@myapp.com"

You can find more examples in examples folder and on https://developer.virgilsecurity.com/docs/use-cases.

React Native usage

This package works with https://github.com/VirgilSecurity/virgil-key-storage-rn

import { EThree } from '@virgilsecurity/e3kit';
import createNativeKeyEntryStorage from '@virgilsecurity/key-storage-rn/native';
// or
import createExpoKeyEntryStorage from '@virgilsecurity/key-storage-rn/expo';

const keyEntryStorage = createNativeKeyEntryStorage();
// or
const keyEntryStorage = createExpoKeyEntryStorage();

EThree.initialize(getTokenCallback, { keyEntryStorage });

Docs

Virgil Security has a powerful set of APIs, and the documentation below can get you started today.

License

This library is released under the 3-clause BSD License.

Support

Our developer support team is here to help you. Find out more information on our Help Center.

You can find us on Twitter or send us email support@VirgilSecurity.com.

Also, get extra help from our support team on Slack.

You can’t perform that action at this time.