Exception after loading a different key #66

Open
bkeepers opened this Issue Jan 16, 2013 · 6 comments

Projects

None yet

3 participants

@bkeepers

If you already have a key set in localStorage, but go to #/key/load to load a different one, then stuff blows up:

Uncaught TypeError: Cannot call method 'decrypt' of undefined keypair.js:40
Keypair.Keypair.decrypt keypair.js:40
Item.Item.key item.js:30
Item.Item.data item.js:34
Item.Views.Show.Show.serialize show.js:31

Need to come up with a better way of passing the key around (or better yet, not passing it around and fetching it from a "global" whenever it's needed).

@tombell

I'm going to take a stab at this issue. When I unlock and visit #/key/load in Chrome, I just got an empty box, but I don't that any exceptions or errors. Has something changed in master since this issue?

@bkeepers

Hmmm, I'm getting the empty box too. Not sure what changed.

@tombell

What's the final behaviour we're aiming for?

@bkeepers

You should be able to pick a different key (sign in as a different user) without any errors.

@tombell

Seems like something might be swallowing the exceptions now, it's loading the template just not setting the content of section.

@danthompson

Aiming to help out a bit, I took a look 👀 into this to see what I could find. It turns out, both the original issue mentioned by @bkeepers and the other reported by @tombell still exist.

The original:

Uncaught TypeError: Cannot call method 'decrypt' of undefined keypair.js:40
Keypair.Keypair.decrypt keypair.js:40
Item.Item.key item.js:30
Item.Item.data item.js:34
Item.Views.ListItem.ListItem.serialize list_item.js:25
render

Can be reproduced by following these steps:
1. Visit /#key/new
2. Enter new passphrase, and generate key
3. Create a new Item
4. Lock
5. Repeat 1-4 with for a new key
6. Visit /#key/load and select the first key generated
7. Enter first key passphrase
8. 💥

visit_loading_original_key

The second issue can be reproduced by repeating steps 1-3, then visiting /#key/load which results in .

visit_loading_key

I'm still digging into this, but figured I would share my findings so far.

The first appears to be a failing to load the privateKey after saving a new one to localStorage which you allude to. The second may be an issue with backbone.layoutManager.js which from what I gathered suffered from a view rendering issues in earlier versions. An upgrade of that requires an upgrade of backbone.js which may have some breaking changes.

Any new thoughts on this? Are these still a concern or does teams remove the need to load multiple keys? Is it present in any other newer branches that you're aware of?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment