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

enceeper-jslib

v1.2.2

Published

A reference library for building JS apps on top of the Enceeper service. Our own cross-platform Enceeper app is based on this library.

Downloads

39

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 and the Enceeper service 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 service

For 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 and TweetNaCl
  • Handle all network communication with the Enceeper service 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

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 keys

Only 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 message

The following example illustrates how to sign-in to a user account and then retrieve various details about the stored keys.

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, password

  console.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.