BenoitZugmeyer/pass-web

Parsing of .gpg-id fails when there is more than one key

Closed this issue · 10 comments

kochd commented

If you use pass in a team with more than just one key pass-web fails to read the .gpg-id file.
Keys are separated by \n but the whole file is red as one key.
If the key is parsed as one string of KEY1 KEY2 KEY3 ... you'll hit this throw:

if (!/^[0-9a-f]*$/i.test(fullKey)) throw new KeyError(`Invalid key id value ${fullKey}`)

Thank you for your feedback. I did try to import a PGP key file containing multiple keys, but kbpgp (the lib I use to handle those keys) does not allow to import such a file. How did you manage to import such a file?

Anyway, openpgp.js seems to allow reading multiple keys from a single file, so I may need to change the library.

kochd commented

Pass creates the file.
From the pass manpage:

init
Initialize new password storage and use gpg-id for encryption. Multiple gpg-ids may be specified, in order to encrypt each password with multiple ids.

You just do pass init finterprint1 fingerprint2 ...

Yes, parsing the pgp-id file is not a problem. But how are stored your keys? Are you launching the server with something like this?

pass-web -p 9082 <(gpg --export-secret-keys -a fingerprint1 fingerprint2 ...)
kochd commented

No there are multiple keys in it while pass-web is started with one of them.

Oh I see, I'll make something about this.

Can you try the master version to see if it fits your needs?

kochd commented

Sure. How can i start the master after is cloned it ?

Install dependencies with yarn or npm i, run ./node_modules/.bin/webpack, then node server secret-key.key
(EDIT: added the webpack command)

kochd commented

Yes good job. i can confirm that e8f97ad did the trick

Great. I'll publish it soon.