Skip to content

Node module to read and write 'Password Safe Database' files

License

Notifications You must be signed in to change notification settings

dol/node-passwordsafe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

password-safe

Read and write 'Password Safe Database'. Write support not implemented yet.

build status

example

load.js

var PasswordSafe = require('password-safe');
var PasswordDb = require('fs').readFileSync('my.psafe3');

var Safe = new PasswordSafe({
    password: 'dbPassword',
});

Safe.load(PasswordDb, function(err, headerRecord, databaseRecords) {
    for (var i = 0; i < databaseRecords.length; i++) {
        var record = databaseRecords[i];
        console.log("Username: " + record.getUsername());
        console.log("Password: " + record.getPassword());
        console.log("-----------------");
    }
}

Output

Username: myusername1
Password: mypassword1
-----------------
Username: myusername2
Password: mypassword2
-----------------

store.js

var PasswordSafe = require('password-safe');
var PasswordDb = require('fs').readFileSync('my.psafe3');

var Safe = new PasswordSafe({
    password: 'dbPassword',
});

var headerRecord = safe.createHeaderRecord();
var databaseRecords = [
    safe.createDatabaseRecord('title1', 'my first password entry')
];
var encryptedData = safe.store(headerRecord, databaseRecords);
fs.writeFile('my_safe.psafe3', encryptedData);

Note: There are some setters missing for the header and database fields.

install

With npm do:

npm install password-safe

to get the command.

license

MIT

About

Node module to read and write 'Password Safe Database' files

Resources

License

Stars

Watchers

Forks

Packages

No packages published