Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/enceeper/enceeper-jslib
A reference library for building JS apps on top of the Enceeper service. Our cross-platform Enceeper app is based on this library.
https://github.com/enceeper/enceeper-jslib
crypto enceeper encryption manager password safe secure storage
Last synced: about 1 month ago
JSON representation
A reference library for building JS apps on top of the Enceeper service. Our cross-platform Enceeper app is based on this library.
- Host: GitHub
- URL: https://github.com/enceeper/enceeper-jslib
- Owner: enceeper
- License: gpl-3.0
- Created: 2018-11-24T08:48:49.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2023-03-02T17:02:29.000Z (almost 2 years ago)
- Last Synced: 2024-12-16T00:13:31.562Z (about 1 month ago)
- Topics: crypto, enceeper, encryption, manager, password, safe, secure, storage
- Language: JavaScript
- Homepage:
- Size: 1.1 MB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Enceeper JS library
A reference library for building Javascript applications on top of the Enceeper service. Our cross-platform Enceeper app is using this library.
## Introduction
The [Enceeper app](https://github.com/enceeper/enceeper) and the [Enceeper service](https://www.enceeper.com/) are used to securely store and retrieve credentials (usernames, passwords, API keys etc). The Enceeper app is divided into two parts:
- The User Interface (UI) that handles all user input
- The core functionality and the utilization of the Enceeper serviceFor the latter, use this repository which serves as a basis project for easier integration (via npm) to other solutions.
Purpose of this library:
* To execute the SRP6a protocol both for user registration and authentication (https://github.com/alax/jsrp)
* Implement all cryptographic functionality, utilizing [SJCL](https://github.com/bitwiseshiftleft/sjcl) and [TweetNaCl](https://github.com/dchest/tweetnacl-js)
* Handle all network communication with the [Enceeper service](https://www.enceeper.com/) using ajax calls (via JQuery)
* Expose a convenient and abstract API to enable integration with other solutions
* Allow transparent re-authentication when the auth token expires## Installation with npm
```bash
npm install enceeper-jslib --save
```### Important notes
The library assumes that the machine we are running is not hostile. If another hostile process can acquire a memory segment previously used by our app it could gain access to important key information. Given that JS allocates memory dymanically, even considering zeroing variables after usage could add unnecessary complexity without accomplishing its goal.
*The safest way is to use the library in your personal machine.*
## Usage
The library is broken into the following files:
* enceeper.exceptions.js: contains the exceptions used throughout the library
* enceeper.network.js: handling the network communication with the Enceeper service
* enceeper.srp6a.js: the SRP6a protocol details for user registration and authentication
* enceeper.crypto.js: all the crypto related operations (keys, slots, key sharing etc.)
* enceeper.api.js: a low-level mapping of the Enceeper service API calls to Javascript functions
* enceeper.app.js: a high-level usage of the library with convenient methods and an internal data structure to access the keysOnly a small portion of the operations do not rely on network calls (i.e. logout or getCategories). Most operations will either perform a lengthy crypto calculation or communicate with the Enceeper service. This requires the use of callbacks in order to make the required operations asynchronous and report back the outcome. There are two types of callbacks available:
* a success callback that will provide the outcome of the request
* a failure callback providing the error code (most likely an HTTP status code) and an exception messageThe following example illustrates how to sign-in to a user account and then retrieve various details about the stored keys.
```javascript
const enceeper = require('enceeper-jslib')// This user is used by our test suite
var enc = new enceeper.app('[email protected]', 'ShareSecret')enc.signin(function (data) {
var categories, keys, passwordconsole.log('OK with data')
categories = enc.getCategories()
keys = enc.getKeys('Internet')
// Get the password of the first key
password = enc.getPassword(keys[0].key_id)// Since we store previous passwords we need to access the value of the first
// element of the array. We should also check the version of the structure (password.v)
// for completeness.
console.log('The password: ' + password.p[0].v)
}, function (status, errorMessage) {
console.log('Error: [' + status + '] [' + errorMessage + ']')
})
```## Copyright and license
Copyright 2019 Vassilis Poursalidis. Released under GNU GPL3 or later - see the `LICENSE` file for details.