Skip to content

Instantly share code, notes, and snippets.

@donmccurdy
Last active May 23, 2020 00:34
Show Gist options
  • Save donmccurdy/4f408622a72384ba110a24d9675fcd0f to your computer and use it in GitHub Desktop.
Save donmccurdy/4f408622a72384ba110a24d9675fcd0f to your computer and use it in GitHub Desktop.
Convert Dashlane JSON export to 1Password CSV import.

I've been a Dashlane user since July 2016, and am finally moving to 1Password because of problems with the macOS app and browser extensions, several of which I've reported repeatedly since 2016. In order of severity:

(1) Do not prompt users to install the browser extensions indefinitely. I'm unwilling and unable to install the extensions on certain browsers at work, because of both work policy and personal security preference. For the past two years, the Dashlane app has prompted me aggressively – opening a prompt, opening a browser tab when I try to close that prompt, and then prompting AGAIN when I try to close that browser tab. Dashlane needs to provide a way to opt out of this, for users with legitimate reasons to not want a browser extension to have access to each website they visit, or who use multiple browsers for e.g. work purposes.

(2) The macOS app regularly locks up on my Macbook Pro, and may require a forced restart and several minutes to load and authenticate.

(3) CSV exports, when I tried to move my data out of Dashlane, were malformed. I had to use a JSON export instead, then write a script myself to reformat it into a valid CSV. Most of your users cannot do this, and shouldn't have to.

#!/usr/bin/env node
/**
* Dashlane's app exports badly-formed CSVs. Their JSON export is correct,
* so to move passwords to another app (1Password in this case) I need to
* export to JSON, reformat that JSON to a CSV for 1Password, then import
* the CSV.
*
* Dashlane exported JSON fields, unordered –
* - domain,email,login,note,password,secondaryLogin,title
*
* 1Password CSV expected input, ordered –
* - title,website,username,password,notes,custom field 1,custom field 2, …
* - https://support.1password.com/create-csv-files/
*
* USAGE: dashlane_to_1password.js input.json output.csv
*
* NOTICE: This script converts only logins. Notes, credit cards, and other
* information must be moved manually.
*/
const fs = require('fs');
const path = require('path');
const stringify = require('csv-stringify');
if (process.argv.length !== 4) {
throw new Error('Usage: `dashlane_to_1password.js input.json output.csv`');
}
const inputPath = path.resolve(__dirname, process.argv[2]);
const outputPath = path.resolve(__dirname, process.argv[3]);
const input = require(inputPath);
const sanitize = (value) => (value||'').replace(/\n/g, '/');
const rows = input.AUTHENTIFIANT.map((entry) => {
return [
entry.title || entry.domain,
entry.domain,
entry.login || entry.email,
entry.password,
entry.note,
entry.secondaryLogin
].map(sanitize);
});
stringify(rows, {}, (err, output) => {
if (err) throw err;
fs.writeFile(outputPath, output, (err) => {
if (err) throw err;
console.log(`${outputPath} saved.`);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment