ashtuchkin / u2f

U2F Authentication for Node.js
399 stars 47 forks source link

challenge: toWebsafeBase64(crypto.pseudoRandomBytes(16)) #1

Closed jhiver closed 9 years ago

jhiver commented 9 years ago

Thanks for this great piece of work... However it seems slightly broken with Yubikey U2F / chrome U2F extension.

Changing crypto.pseudoRandomBytes(16) to crypto.pseudoRandomBytes(32) fixes it.

Is there any way you could make the challenge length a configurable variable? I.e.

u2f = require 'u2f'
u2f.CHALLENGE_LENGTH = 32

Or something?

Thanks JM

ashtuchkin commented 9 years ago

Hi! Thanks for trying this project. Are you sure the problem is with the length? I just tested it with my Yubico U2F key and it worked fine, maybe something else is the reason? What error do you get?

jhiver commented 9 years ago

Hi there,

I got errorCode: 2 in the response. I changed to 32 because that's what the yubico python server implementation uses and that seemed to have fixed it.

Le Wed Dec 10 2014 at 06:09:02, Alexander Shtuchkin < notifications@github.com> a écrit :

Hi! Thanks for trying this project. Are you sure the problem is with the length? I just tested it with my Yubico U2F key http://jsbin.com/xipumipidi/1/edit?html,js,output and it worked fine, maybe something else is the reason? What error do you get?

— Reply to this email directly or view it on GitHub https://github.com/ashtuchkin/u2f/issues/1#issuecomment-66393806.

ashtuchkin commented 9 years ago

OK, could you confirm that the code at the jsbin link I provided returns error, while if the challenge string is doubled, succeeds? The thing with length seems suspicious to me, I still think that it could be due to some other config error. The spec says nothing about it either. I want to be sure it's the reason, not blindly copy python implementation details. I hope you understand. On Dec 9, 2014 8:48 PM, "Jean-Michel Hiver" notifications@github.com wrote:

Hi there,

I got errorCode: 2 in the response. I changed to 32 because that's what the yubico python server implementation uses and that seemed to have fixed it.

Le Wed Dec 10 2014 at 06:09:02, Alexander Shtuchkin < notifications@github.com> a écrit :

Hi! Thanks for trying this project. Are you sure the problem is with the length? I just tested it with my Yubico U2F key http://jsbin.com/xipumipidi/1/edit?html,js,output and it worked fine, maybe something else is the reason? What error do you get?

— Reply to this email directly or view it on GitHub https://github.com/ashtuchkin/u2f/issues/1#issuecomment-66393806.

— Reply to this email directly or view it on GitHub https://github.com/ashtuchkin/u2f/issues/1#issuecomment-66404264.

jhiver commented 9 years ago

You're right, I probably barfed up something as I was implementing... sorry about that and thanks for your awesome module.

ashtuchkin commented 9 years ago

No problem) Hope it'll be useful for you.

Alexander Shtuchkin

On Wed, Dec 10, 2014 at 5:31 AM, Jean-Michel Hiver <notifications@github.com

wrote:

You're right, I probably barfed up something as I was implementing... sorry about that and thanks for your awesome module.

— Reply to this email directly or view it on GitHub https://github.com/ashtuchkin/u2f/issues/1#issuecomment-66451363.