twpayne / chezmoi

Manage your dotfiles across multiple diverse machines, securely.
https://www.chezmoi.io/
MIT License
13.36k stars 493 forks source link

Add Dashlane support #2791

Closed XaF closed 1 year ago

XaF commented 1 year ago

Is your feature request related to a problem? Please describe.

Dashlane is a password manager that could be integrated with chezmoi. This was initially open then closed-not-solved in #1037.

Describe the solution you'd like

It would be great if chezmoi include a template function called dashlane that allowed users to retrieve secrets from Dashlane. It could even be dashlanePassword for a password entry, and dashlaneNote for a secure note.

Additional context

Since #1037 there is now an experimental-but-official CLI for Dashlane which is available at Dashlane/dashlane-cli. This supports outputting passwords in the JSON format, and can be either built locally or used through binaries provided with releases. This is also seems to be actively developed at the moment.

twpayne commented 1 year ago

Sure. Could you post the output of:

$ dcli password --output json filter

for some filter so I have some example output to test with, please?

XaF commented 1 year ago

The filters are very basic "string matching" it seems.

The format is:

[
    {
        "title": "<name of the entry>",
        "useFixedUrl": "<true/false>",
        "login": "<login>",
        "status": "ACCOUNT_NOT_VERIFIED",
        "note": "<any note>",
        "autoLogin": "<true/false>",
        "modificationDatetime": "<timestamp>",
        "checked": "<true/false>",
        "id": "<id>",
        "anonId": "<anonymous id>",
        "localeFormat": "UNIVERSAL",
        "password": "<password>",
        "creationDatetime": "<timestamp>",
        "userModificationDatetime": "<timestamp>",
        "lastBackupTime": "<timestamp>",
        "autoProtected": "<true/false>",
        "strength": "<int representing password strenght - probably a percentage 0-100>",
        "subdomainOnly": "<true/false>"
    },
    ...
]

When a single match is found, only one entry is returned in the list, but it still returns the list. When called with --output json and no filter, it returns the entire list of password entries.

There is also sometimes a appMetaData field in the objects, when the entry is linked to a phone application.

XaF commented 1 year ago

The note|n command returns the content of the note directly on the output, without any formatting:

$ dcli n testdata
This is my

note
.
XaF commented 1 year ago

When calling commands with a filter that does not return any results:

$ dcli password --output json DoesNotExist
[]
$ dcli note DoesNotExist
Error: No note found
    at getNote (xxxxx\getSecureNotes.js:37:15)
    at async Command.<anonymous> (xxxxx\index.js:87:5)
    at async Command.parseAsync (xxxxx\command.js:917:5)
$ echo $?
1