{"id":19198454,"url":"https://github.com/virgilsecurity/virgil-keyknox-javascript","last_synced_at":"2025-05-09T01:15:31.168Z","repository":{"id":52857954,"uuid":"138856023","full_name":"VirgilSecurity/virgil-keyknox-javascript","owner":"VirgilSecurity","description":"Keyknox SDK allows developers to communicate with Virgil Keyknox Service to upload, download, and synchronize encrypted sensitive data (private keys) between different devices.","archived":false,"fork":false,"pushed_at":"2024-04-19T14:09:01.000Z","size":387,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-05-09T01:15:23.575Z","etag":null,"topics":["cryptography","data-sharing","keyknox","sdk"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/VirgilSecurity.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-06-27T08:58:43.000Z","updated_at":"2024-04-19T14:07:26.000Z","dependencies_parsed_at":"2024-04-17T12:44:26.189Z","dependency_job_id":"7f1f1cc0-c0c2-4912-854d-8dfacc759358","html_url":"https://github.com/VirgilSecurity/virgil-keyknox-javascript","commit_stats":null,"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VirgilSecurity%2Fvirgil-keyknox-javascript","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VirgilSecurity%2Fvirgil-keyknox-javascript/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VirgilSecurity%2Fvirgil-keyknox-javascript/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VirgilSecurity%2Fvirgil-keyknox-javascript/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/VirgilSecurity","download_url":"https://codeload.github.com/VirgilSecurity/virgil-keyknox-javascript/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253171272,"owners_count":21865297,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cryptography","data-sharing","keyknox","sdk"],"created_at":"2024-11-09T12:22:06.508Z","updated_at":"2025-05-09T01:15:31.142Z","avatar_url":"https://github.com/VirgilSecurity.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003e This README is for Keyknox v1.0.0. Check the [v0.3.x branch](https://github.com/VirgilSecurity/virgil-keyknox-javascript/tree/v0.3.x) for Keyknox v0.3.x docs.\n\n# Virgil Keyknox JavaScript SDK\n\n[![npm](https://img.shields.io/npm/v/@virgilsecurity/keyknox.svg)](https://www.npmjs.com/package/@virgilsecurity/keyknox)\n[![Build Status](https://img.shields.io/travis/VirgilSecurity/virgil-keyknox-javascript.svg)](https://travis-ci.org/VirgilSecurity/virgil-keyknox-javascript)\n[![GitHub license](https://img.shields.io/badge/license-BSD%203--Clause-blue.svg)](https://github.com/VirgilSecurity/virgil-keyknox-javascript/blob/master/LICENSE)\n\n[Introduction](#introduction) | [SDK Features](#sdk-features) | [Installation](#installation) | [Usage Example](#usage-example) | [Docs](#docs) | [Support](#support)\n\n## Introduction\n\u003ca href=\"https://developer.virgilsecurity.com/docs\"\u003e\u003cimg width=\"230px\" src=\"https://cdn.virgilsecurity.com/assets/images/github/logos/virgil-logo-red.png\" align=\"left\" hspace=\"10\" vspace=\"6\"\u003e\u003c/a\u003e[Virgil Security](https://virgilsecurity.com) provides an SDK which allows you to communicate with Virgil Keyknox Service.\nVirgil 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.\n\n## SDK Features\n- use [Virgil Crypto library](https://github.com/VirgilSecurity/virgil-crypto-javascript)\n- use [Virgil SDK](https://github.com/VirgilSecurity/virgil-sdk-javascript)\n- upload encrypted sensitive data to Virgil Keyknox Service\n- download the data from Virgil Keyknox Service\n- update and synchronize the data\n\n## Installation\nYou can install this module from npm. Another option is to add it via `script` tag in browser.\n\n### npm\nYou will need to install `@virgilsecurity/keyknox`.\n```sh\nnpm install @virgilsecurity/keyknox\n```\n\nYou will also need to install `virgil-crypto` and `virgil-sdk` from npm.\n```sh\nnpm install virgil-crypto virgil-sdk\n```\n\u003e Note that minimum supported version of `virgil-crypto` is `4.0.0` and minimum supported version of `virgil-sdk` is `6.0.0`.\n\n### In browser via `script` tag\nYou will need to add `@virgilsecurity/keyknox` script.\n```html\n\u003cscript src=\"https://unpkg.com/@virgilsecurity/keyknox@^1.0.0/dist/keyknox.umd.js\"\u003e\u003c/script\u003e\n```\n\nYou will also need to add `virgil-crypto` and `virgil-sdk` scripts.\n```html\n\u003cscript src=\"https://unpkg.com/virgil-crypto@^4.0.0/dist/browser.umd.js\"\u003e\u003c/script\u003e\n\u003cscript src=\"https://unpkg.com/virgil-sdk@^6.0.0/dist/virgil-sdk.browser.umd.js\"\u003e\u003c/script\u003e\n```\n\nNow 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.\n\n## Usage Example\nTo 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:\n- `identity` of the user\n- `accessTokenProvider` to provide access token for Virgil services\n- `keyEntryStorage` to store data locally\n- `privateKey` of current device/user\n- `publicKeys` of all devices/users that should have access to data\n- `virgilCrypto` to perform all cryptographic operations\n\n```js\nconst { SyncKeyStorage } = require('@virgilsecurity/keyknox');\nconst { initCrypto, VirgilCrypto } = require('virgil-crypto');\n\ninitCrypto().then(() =\u003e {\n  // Identity of the user\n  const identity = ...;\n\n  // Setup Access Token provider to provide access token for Virgil services\n  // Check https://github.com/VirgilSecurity/virgil-sdk-javascript\n  const accessTokenProvider = ...;\n\n  // Setup Key Entry Storage to store data locally\n  // Check https://github.com/VirgilSecurity/virgil-sdk-javascript\n  const keyEntryStorage = ...;\n\n  // Public keys of users that should have access to data\n  const publicKeys = ...;\n\n  // Private key of current user\n  const privateKey = ...;\n\n  // An instance of `VirgilCrypto` class\n  const virgilCrypto = new VirgilCrypto();\n\n  const syncKeyStorage = SyncKeyStorage.create({\n    identity,\n    accessTokenProvider,\n    keyEntryStorage,\n    privateKey,\n    publicKeys,\n    virgilCrypto,\n  });\n});\n```\nYou can find a complete example of simple client-server application [here](example).\n\n### What if I lost my private key?\n\nIf 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.\n\n```js\nimport { KeyknoxClient } from '@virgilsecurity/keyknox';\n\nconst tokenPromise = accessTokenProvider.getToken({ operation: 'delete' });\nconst resetPromise = tokenPromise.then(token =\u003e new KeyknoxClient().resetValue(token.toString()));\nconst syncKeyStorage = SyncKeyStorage.create(...);\n\nresetPromise.then(() =\u003e syncKeyStorage.sync());\n```\n\n## Docs\nVirgil Security has a powerful set of APIs, and the documentation below can get you started today.\n\n* [Virgil Security Documentation](https://developer.virgilsecurity.com)\n\n## License\nThis library is released under the [BSD 3-Clause License](LICENSE).\n\n## Support\nOur developer support team is here to help you. Find out more information on our [Help Center](https://help.virgilsecurity.com).\n\nYou can find us on [Twitter](https://twitter.com/VirgilSecurity) or send us email support@VirgilSecurity.com.\n\nAlso, get extra help from our support team on [Slack](https://virgilsecurity.com/join-community).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvirgilsecurity%2Fvirgil-keyknox-javascript","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvirgilsecurity%2Fvirgil-keyknox-javascript","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvirgilsecurity%2Fvirgil-keyknox-javascript/lists"}