by jcoglan

jcoglan / vault

Generates safe passwords so you never need to remember them

457 Stars 66 Forks Last release: Not found 337 Commits 3 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:


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

take over a million times the age of the observable universe to crack by brute force.


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.


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 you need to serve the static files found in the

folder using your favourite web server.


The most basic usage involves passing your passphrase and the service name; when you pass the

flag you will be prompted for your passphrase:
$ vault google -p
Passphrase: *********

You can set the desired length using

$ vault google -p -l 6
Passphrase: *********

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: *********

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

$ vault google -p --dash 1 --upper 1
Passphrase: *********

Available character classes include:

  • lower
    : lowercase letters,
  • upper
    : uppercase letters,
  • number
    : the digits
  • 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

because of the 3
lets you express this requirement using
; 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,

can use a value signed using your SSH private key as its input. Use the
$ vault twitter -k

Which key would you like to use?

1: [email protected], AAAAB3NzaC1y...+XRS6wsfyB7D 2: [email protected], 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

are printed to stderr and the generated password to stdout, so you can pipe
and you'll just get the password in your clipboard, i.e.:
$ vault twitter -k | pbcopy

Which key would you like to use?


Saving your settings

If you like, you can store your passphrase on disk;

will save it in a file called
in your home directory.


file is encrypted with AES-256, using your username as the key by default. You can set your own key using the
environment variable. You can also change the location of the file using the
variable, for example you might set
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

$ vault -c -p
Passphrase: *********
$ vault google

You can also configure character class settings this way:

$ vault -c --upper 0
$ vault google -p
Passphrase: *********

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

setting. The config file ends up storing the public key, not the private key or any value derived from it. Next time you run
, the public key is used to find the corresponding private key from
$ vault -c -k

Which key would you like to use?

1: [email protected], AAAAB3NzaC1y...+XRS6wsfyB7D 2: [email protected], 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

writes the contents of the
file to the given path, while
reads the given file and stores it encrypted in your
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

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


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

$ vault -c -n google

This opens your

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

When you ask for the password for a service,

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

options. (
is aliased as lowercase
as uppercase
removes settings for an individual service,
removes your global settings and
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?

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.


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

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.