Introduction | SDK Features | Installation | Usage Example | Docs | Support
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.
- multidevice support
- manage users' Public Keys
You can install this module from npm. Another option is to add it via script tag in browser.
You will need to install @virgilsecurity/e3kit
.
npm install @virgilsecurity/e3kit
You will need to add @virgilsecurity/e3kit
script.
<script src="https://unpkg.com/@virgilsecurity/e3kit/dist/e3kit.browser.umd.js"></script>
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');
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.
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 });
Virgil Security has a powerful set of APIs, and the documentation below can get you started today.
This library is released under the 3-clause BSD License.
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.