get_decrypted_password appends \n
pw_store = pypass.PasswordStore()
password = pw_store.get_decrypted_password('[email protected]')
Expected value of password variable would be, e.g., password1234, but instead a \n is appended, so the actual value is password1234\n.
Did you compare it with pass? Does pass append a newline?
Maybe we need to print the newline in shells but not return it with the get_decrypted_password method
PasswordStore.get_decrypted_password() has a little bit misleading name, because as its doc string sugests, it returns the full decrypted content of the requested entry (.gpg file). It only returns a newline character at the end of the string, if the file contained one.
As long as you use the pypass API to create the entry, you won't be getting a newline at the end.
If pass or other tools added an undesired \n, you can always get rid of it with str.strip().
Did you compare it with pass? Does pass append a newline?
Maybe we need to print the newline in shells but not return it with the get_decrypted_password method
When I do pass -c [email protected] and paste the output to a text editor, there's no new line.
When I do pass [email protected], it looks like this
➜ ~ pass [email protected]
password1234
➜ ~
So I would expect that get_decrypted_password() works in the same manner as pass -c, since the password that was inserted, did not contain a new line.
If pass or other tools added an undesired \n, you can always get rid of it with str.strip().
I'm using some workaround at the moment, but it feels like there a bug either in pypass or in pass.
Maybe we should merge this issue with #5 and make get_decrypted_password() return some Password object instead of an str.
It could have a password field that would contain the decoded first line without any disturbing newlines, and a content field with the full unaltered content. Also other fields already handled by the current implementation to not lose functionality.
Is this proposal a satisfactory solution to this issue? Any suggestions?