jspass
JavaScript implementation of standard UNIX password manager pass.
Last updated 3 years ago by michal.chroust .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install jspass 
SYNC missed versions from official npm registry.

JSPass

JavaScript implementation of password store using OpenPGP.js. This library is inspired by standard UNIX password manager pass and compatible with it. It supports git versioning and encrypting password both in node.js and in browser. Library implements functionality similiar to gpg daemon, so it can store decrypted private keys for user specified time.

Documentation

Getting started

Npm

npm install --save jspass

Alternatively, you can downlaod a minified build under dist.

Examples

In the next examples I will be using co library, but you can also use .then() method of Promise. Library uses Promises for all asynchronous operations.

Basic operations

var JSPass = require("jspass");
var co = require("co");

var publicKey = "-----BEGIN PGP PUBLIC KEY BLOCK ... END PGP PUBLIC KEY BLOCK-----";
var privateKey = "-----BEGIN PGP PRIVATE KEY BLOCK ... END PGP PRIVATE KEY BLOCK-----";

//create new store with name example, which will hold decrypted private keys for 10 seconds and store keys in LocalStorage
//Name of password store will be also prefix for saving in localStorage
var store = new JSPass(10, true, "example");

store.importKey(publicKey);
store.importKey(privateKey);

co(function* () {
  //set key ids for root directory
  yield store.setKeyIds("fingerprint-or-long-key")
  //you can add password directly on JSPass object, which will add password to the root directory
  yield store.addPassword("example", "example content");

  var exampleDir = store.addDirectory("exampleDirectory");
  //you can also add directories recursively
  var anotherDir = exampleDir.addDirectoryRecursive("subDir/anotherDir/");

  yield anotherDir.addPassword("anotherPassword", "secret content");
});

Working with git

var JSPass = require("jspass");
var co = require("co");

var publicKey = "-----BEGIN PGP PUBLIC KEY BLOCK ... END PGP PUBLIC KEY BLOCK-----";
var privateKey = "-----BEGIN PGP PRIVATE KEY BLOCK ... END PGP PRIVATE KEY BLOCK-----";

var store = new JSPass(10, true, "example");

store.importKey(publicKey);
store.importKey(privateKey);

co(function* () {
  store.setRepository("https://github.com/exampleUser/password-store", "jspass"); //initialize git, password store currently supports GitHub, also set UserAgent header value, in this case jspass
  store.git.setToken("auth-token") //set OAuth token, you can create one using JSPass with method JSPass.git.createAuthToken, see documentation

  yield store.clone();

  //do changes

  yield store.commit("Changes");
});

Current Tags

  • 1.1.1                                ...           latest (3 years ago)

2 Versions

  • 1.1.1                                ...           3 years ago
  • 1.0.0                                ...           3 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (2)
Dev Dependencies (8)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |