Skip to content

Instantly share code, notes, and snippets.

@Yukaii
Created May 24, 2020
Embed
What would you like to do?
GNU Pass to Bitwarden migration

GNU Pass to Bitwarden migration

  1. Use pass2csv to export generic csv
  2. Add header folder,name,password,comments to first line of that csv file
  3. Use the script to convert file
  4. Import password with "Bitwarden (csv)" format

Remeber to delete your csv file safely once it's imported!

const fs = require('fs');
const path = require('path');
const csv = require('fast-csv');
fs.createReadStream(path.resolve(__dirname, 'pass.csv'))
.pipe(csv.parse({ headers: true }))
.pipe(csv.format({ headers: true }))
// .on('data', row => console.log(row))
.transform((row, next) => {
let login = ''
let url = ''
if (row.comments && row.comments.match(/login: (.+)/)) {
let match = row.comments.match(/login: (.+)/)
login = match[1]
}
if (!login) {
login = row.name
}
if (row.comments && row.comments.match(/url: (.+)/)) {
let match = row.comments.match(/url: (.+)/)
url = match[1]
}
return next(null, {
folder: row.folder,
favorite: '',
type: 'login',
name: row.name,
notes: row.comments,
fields: '',
login_uri: url,
login_username: login,
login_password: row.password,
login_totp: ''
})
})
.pipe(process.stdout)
.on('end', process.exit);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment