Read and write 'Password Safe Database'. Write support not implemented yet.
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
-----------------
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.
With npm do:
npm install password-safe
to get the command.
MIT