/virgil-e3kit-js

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.

Primary LanguageTypeScriptBSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

Virgil E3Kit Typescript/Javascript SDK

Build Status npm GitHub license

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

This library currently in active development.

Don't use it in the production apps. Future API can be changed! More info in Slack

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://e3kit.readme.io.

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.