• Stars
    star
    471
  • Rank 93,216 (Top 2 %)
  • Language
    JavaScript
  • Created almost 13 years ago
  • Updated about 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Generates safe passwords so you never need to remember them

vault

vault is a simple password manager. Given a passphrase and the name of a service, it returns a strong password for that service. You only need to remember your passphrase, which you do not give to anyone, and vault will give a different password for every service you use. The passphrase can be any text you like.

Given the same passphrase and service name, the program will generate the same result every time, so you can use it to look up those impossible-to-remember passwords when you need them.

According to Dropbox's zxcvbn password strength measure, if your dictionary English password takes about a second to crack, those generated by vault take over a million times the age of the observable universe to crack by brute force.

Why?

I have a terrible memory and like keeping my stuff safe. Strong service-specific passwords are hard to remember, and many services have stupid restrictions on passwords. I want to remember one phrase and have a machine deal with making my passwords strong.

Installation

This program is written in JavaScript. It provides a CLI and a web-based interface. The command line interface is available as a Node program. To install with npm run:

npm install -g vault

To enable tab-completion for bash, add this to your .bashrc scripts:

which vault > /dev/null && . "$( vault --initpath )"

If you want to use the web interface provided with vault (like https://getvau.lt/) you need to serve the static files found in the web folder using your favourite web server.

Usage

The most basic usage involves passing your passphrase and the service name; when you pass the --phrase or -p flag you will be prompted for your passphrase:

$ vault google -p
Passphrase: *********
2hk!W[L,2rWWI=~=l>,E

You can set the desired length using --length or -l:

$ vault google -p -l 6
Passphrase: *********
Tc8k~8

You can control the character types present in the output, either to disable certain types or make sure they are present. For example, to get a password with no symbols in it:

$ vault google -p --symbol 0
Passphrase: *********
Bb4uFmAEUnTPJh23ecdQ

To get a password containing at least one dash and uppercase letter:

$ vault google -p --dash 1 --upper 1
Passphrase: *********
2-[w]thuTK8unIUVH"Lp

Available character classes include:

  • lower: lowercase letters, a-z
  • upper: uppercase letters, A-Z
  • number: the digits 0-9
  • space: the space character
  • dash: dashes (-) and underscores (_)
  • symbol: all other printable ASCII characters

Finally, some sites do not allow passwords containing strings of repeated characters beyond a certain length. For example, a site requiring passwords not to contain more than two of the same character in a row would reject the password ZOMG!!! because of the 3 ! characters. vault lets you express this requirement using --repeat or -r; this option sets the maximum number of times the same character can appear in a row.

$ vault google -p -r 2

Using your SSH private key

Instead of a simple passphrase, vault can use a value signed using your SSH private key as its input. Use the --key or -k option:

$ vault twitter -k

Which key would you like to use?

1: james@tesla, AAAAB3NzaC1y...+XRS6wsfyB7D
2: james@tesla, AAAAB3NzaC1y...B4vwPOArAIKb

Enter a number (1-2): 1
\vXY"xP}m7;,./eI{cz<

If you only have one private key, that is used automatically. If you have several, a menu is displayed as above using snippets from the corresponding public keys. You will be prompted to unlock the selected key if necessary.

Note that all the prompts shown to you while using vault are printed to stderr and the generated password to stdout, so you can pipe vault to pbcopy and you'll just get the password in your clipboard, i.e.:

$ vault twitter -k | pbcopy

Which key would you like to use?
# etc.

Saving your settings

If you like, you can store your passphrase on disk; vault will save it in a file called .vault in your home directory.

The .vault file is encrypted with AES-256, using your username as the key by default. You can set your own key using the VAULT_KEY environment variable. You can also change the location of the file using the VAULT_PATH variable, for example you might set VAULT_PATH=Dropbox/.vault to sync it using Dropbox. If you do this, make sure any files containing the key are NOT also exposed to third-party services.

To save your passphrase, pass the --config or -c flag:

$ vault -c -p
Passphrase: *********
$ vault google
2hk!W[L,2rWWI=~=l>,E

You can also configure character class settings this way:

$ vault -c --upper 0
$ vault google -p
Passphrase: *********
=hk|,;,>=r'}k=p-u>1p

Both the passphrase and the character class settings can be overridden on a per-service basis:

$ vault -c twitter --upper 1 --symbol 0

$ vault twitter -p
Passphrase: *********
Z2juOG1Z31BX1A9ET8Cn

$ vault google -p
Passphrase: *********
=hk|,;,>=r'}k=p-u>1p

If you're using your private key instead of a passphrase, you can save your --key setting. The config file ends up storing the public key, not the private key or any value derived from it. Next time you run vault, the public key is used to find the corresponding private key from ssh-agent.

$ vault -c -k

Which key would you like to use?

1: james@tesla, AAAAB3NzaC1y...+XRS6wsfyB7D
2: james@tesla, AAAAB3NzaC1y...B4vwPOArAIKb

Enter a number (1-2): 1

$ vault twitter
\vXY"xP}m7;,./eI{cz<

If you'd like to get a plain-text copy of the encrypted settings file, or import a previously exported settings file, you can use the --export and --import flags. --export writes the contents of the .vault file to the given path, while --import reads the given file and stores it encrypted in your .vault file. This can be used, for example, to change the encryption key:

$ VAULT_KEY=oldkey vault --export settings.json
$ VAULT_KEY=newkey valut --import settings.json

Or, you can use it if vault changes its encryption algorithm in the future. Just use your current installation to export the settings, upgrade, then import.

$ vault --export settings.json
$ npm install -g vault
$ vault --import settings.json

Notes

You can save notes for any of the services you use. Notes are stored in the service's settings, but are not used for generating passwords. To edit the notes for a service, use --config with --notes or -n:

$ vault -c -n google

This opens your $EDITOR where you can edit the notes. When you save the file and close the editor, the updated notes will be saved into your .vault file.

When you ask for the password for a service, vault will print any notes you have saved for it. It prints the password to stdout and the notes to stderr, so you can pipe the password to the clipboard if you like and still the notes printed in your terminal.

$ vault google | pbcopy

The notes will appear here. The password is saved to the clipboard.

Deleting saved settings

You can delete any saved setting using the --delete, --delete-globals and --clear options. (--delete is aliased as lowercase -x and --clear as uppercase -X.) --delete removes settings for an individual service, --delete-globals removes your global settings and --clear deletes all saved settings.

$ vault --delete twitter
This will delete your "twitter" settings. Are you sure? (Y/n): Y

$ vault --delete-globals
This will delete your global settings. Are you sure? (Y/n): Y

$ vault --clear
This will delete ALL your settings. Are you sure? (Y/n): Y

How does it work?

vault takes your passphrase and a service name and generates a hash from them using PBKDF2. It then encodes the bits of this hash using a 94-character alphabet, subject to the given character constraints. This design means that each password is very hard to break by brute force, and ensures that the discovery of one service's password does not lead to other accounts being compromised. It also means you can tailor the output to the character set accepted by each service. The use of a deterministic hash function means we don't need to store your passwords since they can easily be regenerated; this means there's no storage to sync or keep secure.

License

Copyright (C) 2012-2014 James Coglan

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

More Repositories

1

sylvester

Vector, matrix and geometry math JavaScript
JavaScript
1,141
star
2

jsclass

Implementation of the core of Ruby's object system in JavaScript.
JavaScript
509
star
3

canopy

A parser compiler for Java, JavaScript, Python, Ruby
JavaScript
418
star
4

heist

Scheme in as little Ruby and as much Scheme as possible. Supports macros, continuations, tail recursion and lazy evaluation.
Ruby
364
star
5

restore

Simple remoteStorage server written in Node.js
JavaScript
294
star
6

terminus

Capybara driver written mostly in client-side JavaScript for cross-browser automation
JavaScript
179
star
7

jit

The information manager from London
Ruby
172
star
8

fargo

Lisp with fibers for Node.js
JavaScript
157
star
9

eventful

Because Ruby's Observable never does quite what I want
Ruby
125
star
10

siren

JSON parser that understands cross-references and casts to typed Ruby objects. Implements JSONQuery against JSON trees and Ruby object graphs.
Ruby
116
star
11

bake

How to make a book
XSLT
99
star
12

primer

Intelligent caching, no observers necessary
Ruby
89
star
13

nand2tetris

Solutions for http://www.nand2tetris.org/
Assembly
87
star
14

jake

Builds JavaScript projects using PackR and ERB
Ruby
78
star
15

svn2git

Ruby tool for importing existing svn projects into git and github.
Ruby
71
star
16

packr

Ruby version of Dean Edwards' Packer
Ruby
65
star
17

consent

Access control layer for ActionPack, providing a DSL for writing a firewall to sit in front of Rails controllers
Ruby
52
star
18

bluff

JavaScript implementation of topfunky's Gruff graphing library
JavaScript
42
star
19

coping

An experimental type-safe/context-aware templating library
Ruby
41
star
20

unsafe_sjr

Demo of unsafe SJR in Rails
Ruby
39
star
21

jstest

The cross-platform JavaScript test framework
JavaScript
38
star
22

node-csprng

Secure random numbers of any size in any base
JavaScript
36
star
23

wake

A build tool for web stuff
JavaScript
29
star
24

rspec-eventmachine

RSpec extensions for testing EventMachine code
Ruby
26
star
25

lisp-dojo

Dojo designed to introduce interpreter writing
Ruby
24
star
26

stickup

Tiny Scheme interpreter, suitable for use as a livecoded demo
Ruby
23
star
27

kanrens

Various implementations of microKanren
JavaScript
19
star
28

oyster

Command-line input parser that doesn't hate you
Ruby
16
star
29

action_flow

Specify request sequences in Rails
Ruby
14
star
30

tnt

Proof assistant for Typographical Number Theory
JavaScript
14
star
31

infer

Interpreter for inference rules
Ruby
13
star
32

yui

Mirror of YUI releases back to 2.2.2
JavaScript
10
star
33

3s

Small Subset of Scheme
JavaScript
9
star
34

vault-cipher

High-level authenticated encryption API used by Vault
JavaScript
9
star
35

toml

Cross-platform JavaScript TOML parser
JavaScript
9
star
36

faye-cookie-auth

Ruby
8
star
37

js-loader-examples

JavaScript
8
star
38

js-test-examples

How to run JS tests using various frameworks on different platforms
JavaScript
8
star
39

birdie

Sinatra app for making portfolio sites
Ruby
8
star
40

acceptance

Reflect on your Rails validations and generate JavaScript from them
Ruby
8
star
41

dotfiles

Vim Script
8
star
42

storeroom

Portable encrypted storage for JavaScript apps
JavaScript
8
star
43

corrode

Rust
8
star
44

lemonga.rb

just a harmless prank... for laughs
Ruby
7
star
45

nicod

Experimental logic programming system, written in Rust
Rust
7
star
46

classy_inputs

Adds type-reflecting class names to input tags in Rails
Ruby
7
star
47

remotestorage-oauth

Node.js library for getting authorization from remoteStorage servers
JavaScript
7
star
48

presentations

Slides for JavaScript talks
Ruby
7
star
49

burn-your-getters

CSS
7
star
50

has_password

Simple password-hashing abstraction for Rails models
Ruby
6
star
51

soundcloud.js

SoundCloud API wrapper for client-side JavaScript
JavaScript
6
star
52

is-sandwich

Tells you whether a thing is a sandwich
JavaScript
5
star
53

frp-irc

JavaScript
5
star
54

attr_locked

Allows you to stop ActiveRecord fields changing after an object is first created
Ruby
5
star
55

pathology

The goggles: they do nothing.
JavaScript
5
star
56

acceptance-old

A port of Ojay.Forms to Prototype, with a Rails plugin to generate client-side validation code
JavaScript
5
star
57

outcast

Music Hack Day project: broadcast your iTunes library to others over the web
JavaScript
5
star
58

york

Jekyll plugin for writing about programming
Ruby
5
star
59

jsapp

JavaScript
4
star
60

frippery

Functional streams for JavaScript
JavaScript
4
star
61

reading-and-writing

Ruby
4
star
62

mu_trumps

Cannes Midem MHD project
Ruby
4
star
63

socknet

TCP over WebSockets
JavaScript
4
star
64

jsbuild

Build tool for the JS.Package dependency system
JavaScript
4
star
65

wake-assets-ruby

Ruby HTML helper for assets managed by wake
Ruby
4
star
66

cuke-web

Browse, search and run your cukes from your browser
JavaScript
4
star
67

include_by_default

Specifies that associations should be included automatically with find() calls in ActiveRecord
Ruby
4
star
68

acts_as_uploaded

File upload plugin for Rails models
Ruby
3
star
69

toledo

JavaScript
3
star
70

pinpoint

Map location editing widget, based on Ojay and Google Maps
JavaScript
3
star
71

poker

Poker simulator for learning stats
JavaScript
3
star
72

jsmod

JavaScript
3
star
73

wake-assets-python

Python HTML helper for assets managed by wake
Python
3
star
74

reiterate

Extension for Prototype that adds syntactic sugar to Enumerable methods
JavaScript
3
star
75

jsdom-example

JavaScript
3
star
76

sequin

Generate uniformly distributed ints in any base from a bit sequence
JavaScript
3
star
77

rustlings

Rust
3
star
78

scheme-dojo

Little exercises to get familiar with Scheme and recursion
Scheme
2
star
79

holly

JavaScript and CSS dependency manager for Rails projects
Ruby
2
star
80

everything

Mini-app to display random entries from Wikipedia
Ruby
2
star
81

fowd-js-testing

Demo application with JavaScript tests
JavaScript
2
star
82

recurse-lisp-workshop

Python
2
star
83

parsing-techniques

Ruby
2
star
84

george

Like vimtutor, with additional hot beverages
Ruby
2
star
85

ruby-pci

Ruby implementations of algorithms from 'Programming Collective Intelligence'
Ruby
2
star
86

bmc

Web app collecting data on journalistic accuracy
Ruby
2
star
87

guardian-politics

Prototypal Ruby client for the Guardian Politics API
Ruby
1
star
88

rust-os

Following along with https://os.phil-opp.com/
Rust
1
star
89

jstest-phantomjs

How to run JS.Test on PhantomJS
JavaScript
1
star
90

dlt

Prototype archive format and version control system
Ruby
1
star
91

horrorshow

Experiment involving JavaScript and Ruby
Ruby
1
star
92

skwizzes

Solutions to Songkick quiz problems
Ruby
1
star
93

zairecma

Music Hack Day project, SF 2011
JavaScript
1
star
94

gramophone

Listen to neighbourhoods from the past
JavaScript
1
star
95

claw

Command-line tool for searching and opening files
Ruby
1
star
96

npm-problem

I haz a problem.
JavaScript
1
star
97

cuke-macros

Experiment wherein Cucumber features are rewritten using Scheme
Ruby
1
star
98

terminus-rails

Ruby
1
star
99

ci_search

Rails implementation of search engine from 'Programming Collective Intelligence'
Ruby
1
star