Closed arkag closed 7 years ago
@cwre Thanks! Found the issue, and it has been fixed in this repo.
I've submitted the patch to pass
as well, but not sure when it will be merged. The following patch will apply to the version of my script there (with git am
or just patch
), from the root of the pass
repository. Or you could just apply it manually, it's just one added line of code.
Cheers!
diff --git a/contrib/importers/1password2pass.rb b/contrib/importers/1password2pass.rb
index 79318ee..5ea4523 100755
--- a/contrib/importers/1password2pass.rb
+++ b/contrib/importers/1password2pass.rb
@@ -95,8 +95,10 @@ if File.extname(filename) =~ /.txt/i
elsif File.extname(filename) =~ /.1pif/i
require "json"
- # 1PIF is almost JSON, but not quite
pif = "[#{File.open(filename).read}]"
+ # Normalize line endings, explicitly preserving encoding just to be sure
+ pif.encode!(pif.encoding, universal_newline: true)
+ # 1PIF is almost JSON, but not quite:
pif.gsub!(/^\*\*\*.*\*\*\*$/, ",")
pif = JSON.parse(pif, {symbolize_names: true})
It seems like I'm still having trouble...
/usr/local/Cellar/ruby/2.3.0/lib/ruby/2.3.0/json/common.rb:156:in `parse': 419: unexpected token at ']' (JSON::ParserError)
from /usr/local/Cellar/ruby/2.3.0/lib/ruby/2.3.0/json/common.rb:156:in `parse'
from ./1password2pass.rb:104:in `<main>'
@cwre Gods almighty. Try now.
⇒ ./1password2pass.rb -d Logins ../logins.1pif/data.1pif
./1password2pass.rb:116:in `block in <main>': undefined method `[]' for nil:NilClass (NoMethodError)
from ./1password2pass.rb:111:in `each'
from ./1password2pass.rb:111:in `<main>'
Sorry 1password sucks, lol.
@cwre No worries, sorry for the trouble. This issue so far contains three different bugs, the last two apparently due to the 1PIF format being undocumented. Apparently your file has a lot more edge cases than I had tested for. So this is pretty useful actually.
This last error is apparently because one of the entries in your file doesn't have a "secureContents"
key in it. Can you confirm that? If you find such an entry, how does it look (with a censored password)?
Might be related to #2.
The field is in every line of my data... Is there some way it needs to be formatted?
This format looks a little weird...
{"uuid":"D26E912EFBB04C4A99A51B62245CE83E","updatedAt":1446947608,"locationKey":"domain.com","securityLevel":"SL5","contentsHash":"d049e692","title":"title","location":"url.domain.com","secureContents":{"fields":[{"id":"email;opid=__3","value":"user@email.com","name":"email","designation":"username","type":"E"},{"id":"password;opid=__4","value":"password","name":"password","designation":"password","type":"P"},{"id":";opid=__5","value":"✓","name":"remember","type":"C"}],"passwordHistory":[{"value":"password1","time":1446947608}],"sections":[{"fields":[{"k":"string","n":"2C70DB01658A491388A24AD8012071E4","v":"(none)","t":"grouping"}],"title":"Other Fields","name":"5e93f226-dc79-94d1-5b9e-a788c9f3ce35"}],"URLs":[{"url":"domain.url"}]},"txTimestamp":1456083029,"createdAt":1444527911,"typeName":"webforms.WebForm"}
***5642bee8-a5ff-11dc-8314-0800200c9a66***
Aaaaah, indeed. I've used the value of name
to decide whether something is a username or a password or whatnot. However, that one you just commented with has an email
instead which 1Password knows to use as username by having "designation": "username"
.
Try, try again…
What are standards, anyway?
On Thu, May 26, 2016 at 6:45 AM Tobias V. Langhoff notifications@github.com wrote:
Aaaaah, indeed. I've used the value of name to decide whether something is a username or a password or whatnot. However, that one you just commented with has an email instead which 1Password knows to use as username by having "designation": "username".
Try, try again…
— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/tobiasvl/1password2pass/issues/1#issuecomment-221849083
Hope this was resolved way back when, please reopen if not.
I'm using your script to import my 1password keychain into a pass store... I'm getting a
/usr/lib/ruby/2.3.0/json/common.rb:156:in `parse': 419: unexpected token at '{
error and I don't really know enough about ruby to know why it's doing this. I've exported only my logins to a .1pif file and it's doing this. Is it something to do with my ruby version?
First 2 entries of my .1pif, because it fails at the first entry.