MasterKale / SimpleWebAuthn

WebAuthn, Simplified. A collection of TypeScript-first libraries for simpler WebAuthn integration. Supports modern browsers, Node, Deno, and more.
https://simplewebauthn.dev
MIT License
1.62k stars 137 forks source link

Regarding the inconsistency of padding = at the end of base64 userId #640

Closed Veclea closed 3 days ago

Veclea commented 3 days ago

Hello . Thanks for writing this great library. This is much more streamlined than my original manual fido implementation. Now I have implemented the registration part in windows. But when I started to test the login, the login assertion userHandle returned by the browser had an "=" at the end, but the userId of the registration request generated by your verification library did not have "=" at the end. I use string equality to determine credentials. Now the string judgment is not equal. I would like to ask you if this is a mistake in my use case?

image image

Veclea commented 3 days ago

I have fixed it

samepant commented 23 hours ago

@Veclea what was your fix? I am seeing this as well, that calls to verifyRegistrationResponse result in credential ids with the padding (=) stripped out.

Veclea commented 17 hours ago

@Veclea what was your fix? I am seeing this as well, that calls to verifyRegistrationResponse result in credential ids with the padding (=) stripped out.

Use this author's library on both the browser and server sides

samepant commented 4 hours ago

for anyone searching for similar problems in the future, the root cause of these issues is SimpleWebAuthn uses base64URL encoding, which is good, but you do need to make sure your client is handling encoded values in that specific encoding (it's different from normal base64 in that a couple characters are switched and padding [=] is stripped out)