railslove/epics

Handling of old keys with `"#USER": {},` raises error

leezu opened this issue · 1 comments

leezu commented

Hi railslove team,

I have an ebics key created a couple of years ago with epics. It contains an "#USER": {}, which confuses the current version of epics. Running Epics::Client.new will trigger

NoMethodError: undefined method `unpack1' for {}:Hash
/usr/lib64/ruby/2.6.0/base64.rb:74:in `strict_decode64'
/home/leonard/.gem/ruby/2.6.0/gems/epics-1.8.1/lib/epics/client.rb:280:in `decrypt'
/home/leonard/.gem/ruby/2.6.0/gems/epics-1.8.1/lib/epics/client.rb:260:in `block in extract_keys'
/home/leonard/.gem/ruby/2.6.0/gems/epics-1.8.1/lib/epics/client.rb:259:in `each'
/home/leonard/.gem/ruby/2.6.0/gems/epics-1.8.1/lib/epics/client.rb:259:in `each_with_object'
/home/leonard/.gem/ruby/2.6.0/gems/epics-1.8.1/lib/epics/client.rb:259:in `extract_keys'
/home/leonard/.gem/ruby/2.6.0/gems/epics-1.8.1/lib/epics/client.rb:12:in `initialize'

Deleting the "#USER": {}, field in the key file avoids the error.

Thank you for reporting the issue 👍

I don't expect that we are going to handle this automatically. I will therefore close this issue now as it is almost 3 years later now and it has not come up multiple times since then.