joebandenburg / libaxolotl-javascript

A JavaScript implementation of axolotl. Axolotl is a ratcheting forward secrecy protocol.
GNU Lesser General Public License v3.0
75 stars 13 forks source link

Please check SessionFactory->createSessionFromPreKeyBundle() line 74 #4

Closed CharlesOkwuagwu closed 9 years ago

CharlesOkwuagwu commented 9 years ago

Hi, var sessionStateList = new SessionStateList((serialisedState) => { return store.putSession(toIdentity, serialisedState); });

you never initialize serialisedState prior to this call. I've been trying to figure out what exactly you are doing here?

joebandenburg commented 9 years ago

I'm passing a callback to the SessionStateList constructor. serialisedState is a parameter passed to the callback. It is called from SessionStateList.js, with a JSON string.

CharlesOkwuagwu commented 9 years ago

still struggling to follow the logic :(

joebandenburg commented 9 years ago

I wanted to make SessionStateList have a save method (for use by Session), but I didn't want to pass the entire Store interface through to the SessionStateList constructor as it only really needed one method. Instead I pass in a callback that provides only the saving ability. It means the SessionStateList constructor is only passed the minimum dependency it requires.

Perhaps it would be simpler if the SessionStateList constructor is passed the Store and the identity and calls store.putSession itself.

joebandenburg commented 9 years ago

I've changed this quite a lot in the latest version. It's much simpler now. Reopen if you're still having problems :)