Node.js Fork#43
Node.js Fork#43luckybroman5 wants to merge 1 commit intoamazon-archives:masterfrom luckybroman5:node
Conversation
|
Thanks for providing this. Users mention that the authentication takes a long time (in the order of seconds). Have you explored using different big integer libraries for Node to speed it up? A user in another thread mentioned using big number instead of big integer in Node. #47 Or maybe experiment with the jsbn library we use in the Javascript implementation? |
|
I experimented with the fork and sometimes I cannot authenticate from my desktop and other users cannot authenticate from lambda as mentioned here #58 . I suspect this happens because of differences in big integer library implementations (not all big integers store data at the byte level or add padding the same way depending on the operation). I changed the big integer implementation from biginteger to jsbn which we use in this SDK as well (in the require for the CognitoUser, AuthenticationHandler, and src/index.js). https://www.npmjs.com/package/jsbn The authentication is much faster now (from around 7s to lower than 2s) and I can always reliably authenticate from node. |
|
Did you have to commit the whole node_modules folder? I mean, golly... |
|
@itrestian I used the Bignumber Library, it has a powM function, rather than a modPow. That was my corporate account in which I made the suggestion for big num This is kinda sloppy, my apologies, I was on a dead line. I would close it.. But i think there are people using it.. haha |
|
Hi @thaiphan, |
|
I replicated what you setup here, however for me it was insanely slow when calling cognitoUser.authenticateUser(). It would take at least 1 or 2 minutes to process. What was your experience like using this? |
|
Hi @jamesingham , I went into the function itself, changed all of the modpow Functions in the Authentication helper to use the BigNumber Library's powM. Because Node isn't very good at CPU intensive tasks, SRP doesn't play well. So I had to find a library that handled Numbers as strings rather than actual Numbers. |
Just a quick node.js implementation