npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@virgilsecurity/keyknox

v1.0.4

Published

Keyknox SDK allows developers to communicate with Virgil Keyknox Service to upload, download, and synchronize encrypted sensitive data (private keys) between different devices.

Downloads

1,849

Readme

This README is for Keyknox v1.0.0. Check the v0.3.x branch for Keyknox v0.3.x docs.

Virgil Keyknox JavaScript SDK

npm Build Status GitHub license

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

Introduction

Virgil Security provides an SDK which allows you to communicate with Virgil Keyknox Service. Virgil Keyknox Service allows users to store their sensitive data (such as Private Key) encrypted (with end-to-end encryption) for using and sharing it between different devices.

SDK Features

  • use Virgil Crypto library
  • 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 via script tag in browser.

npm

You will need to install @virgilsecurity/keyknox.

npm install @virgilsecurity/keyknox

You will also need to install virgil-crypto and virgil-sdk from npm.

npm install virgil-crypto virgil-sdk

Note that minimum supported version of virgil-crypto is 4.0.0 and minimum supported version of virgil-sdk is 6.0.0.

In browser via script tag

You will need to add @virgilsecurity/keyknox script.

<script src="https://unpkg.com/@virgilsecurity/keyknox@^1.0.0/dist/keyknox.umd.js"></script>

You will also need to add virgil-crypto and virgil-sdk scripts.

<script src="https://unpkg.com/virgil-crypto@^4.0.0/dist/browser.umd.js"></script>
<script src="https://unpkg.com/virgil-sdk@^6.0.0/dist/virgil-sdk.browser.umd.js"></script>

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 initialize SyncKeyStorage 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
const { SyncKeyStorage } = require('@virgilsecurity/keyknox');
const { initCrypto, VirgilCrypto } = require('virgil-crypto');

initCrypto().then(() => {
  // Identity of the user
  const identity = ...;

  // Setup Access Token provider to provide access token for Virgil services
  // Check https://github.com/VirgilSecurity/virgil-sdk-javascript
  const accessTokenProvider = ...;

  // Setup Key Entry Storage to store data locally
  // Check https://github.com/VirgilSecurity/virgil-sdk-javascript
  const keyEntryStorage = ...;

  // Public keys of users that should have access to data
  const publicKeys = ...;

  // Private key of current user
  const privateKey = ...;

  // An instance of `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.

What if I lost my private key?

If you lost your private key, you are not able to decrypt saved data anymore. So you need to reset your stored data in the Virgil Keyknox Service and start over.

import { KeyknoxClient } from '@virgilsecurity/keyknox';

const tokenPromise = accessTokenProvider.getToken({ operation: 'delete' });
const resetPromise = tokenPromise.then(token => new KeyknoxClient().resetValue(token.toString()));
const syncKeyStorage = SyncKeyStorage.create(...);

resetPromise.then(() => syncKeyStorage.sync());

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 BSD 3-Clause 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 [email protected].

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