This README is for Keyknox v1.0.0. Check the v0.3.x branch for Keyknox v0.3.x docs.
Virgil Keyknox JavaScript SDK
Introduction

SDK Features
- use Virgil SDK
- upload encrypted sensitive data to Virgil Keyknox Service
- download the data from Virgil Keyknox Service
- update and synchronize the data
Installation
You can install this module from npm. Another option is to add it viascript
tag in browser.
npm
You will need to install@virgilsecurity/keyknox
.
```sh
npm install @virgilsecurity/keyknox
```
You will also need to install virgil-crypto
and virgil-sdk
from npm.
```sh
npm install virgil-crypto virgil-sdk
```
Note that minimum supported version ofvirgil-crypto
is4.0.0
and minimum supported version ofvirgil-sdk
is6.0.0
.
In browser via script
tag
You will need to add @virgilsecurity/keyknox
script.
```html
```
You will also need to add virgil-crypto
and virgil-sdk
scripts.
```html
```
Now you can use global variables Keyknox
, Virgil
and VirgilCrypto
as namespace objects, containing all of @virgilsecurity/keyknox
, virgil-sdk
and virgil-crypto
exports as properties.
Usage Example
To begin using Virgil Keyknox SDK you'll need to initializeSyncKeyStorage
class. This class is responsible for synchronization between device storage - IndexedDB in a browser or file system in Node.js - and Keyknox Cloud. In order to initialize SyncKeyStorage
class you'll need the following values:
identity
of the user
accessTokenProvider
to provide access token for Virgil services
keyEntryStorage
to store data locally
privateKey
of current device/user
publicKeys
of all devices/users that should have access to data
virgilCrypto
to perform all cryptographic operations
VirgilCrypto
class
const virgilCrypto = new VirgilCrypto();
const syncKeyStorage = SyncKeyStorage.create({
identity,
accessTokenProvider,
keyEntryStorage,
privateKey,
publicKeys,
virgilCrypto,
});
});
```
You can find a complete example of simple client-server application here.