browserpass-native
browserpass-native copied to clipboard
Add more locations to check for default store path
Fixes #107
Hey @mastertinner, thanks for a quick PR! We had a quick discussion internally and decided to go with another approach, we will keep the list of such lookup paths on extension side and rewrite the native component to make it generic - it is our goal to change native host as little as possible, such that if gopass changes folders lookup, if pass finally decides something on #95 or if yet another tool becomes popular, we will be able to simply add support to these new locations in the extension, without having to change native component.
Sorry that I initially gave you a different suggestion, and thanks again for the PR! I'll have a look into it and ping you once it's ready, so that you can test if you'd like to!
OK, sounds good. So should I close this PR?
It's fine to keep it for now, I'll reference it in that other PR and it will be closed then :)
@maximbaz, is there any progress on this matter?
Unfortunately, no, sorry it took so long 😞 If you have time, would you like to try to help out? We haven't discussed exactly how to implement this correctly, but I'll outline my idea below, and ping @erayd to confirm whether I'm not missing something 🙂
We can extend request settings to contain a list of strings, a list of paths to look for default password store location, this list should be used in this function instead of the hardcoded $PASSWORD_STORE_DIR or ~/.password-store/. This list would receive paths, that can contain ~ or environment variables, and we have a handy helper function that can be used to normalize it all.
Then to determine a default password store, we simply iterate that list, returning the first folder that exists.
Then on the extension side, we'd pass this list as following, in this order:
$PASSWORD_STORE_DIR$GOPASS_HOMEDIR$HOME/.password-store~/.password-store$XDG_DATA_HOME/gopass/stores/root$HOME/.local/share/gopass/stores/root~/.local/share/gopass/stores/root
And then we'd need to test this, to make sure that new extension can run with old native host, and maybe if old extension can run with new native host.