-
-
Notifications
You must be signed in to change notification settings - Fork 137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix/simplify-encoding-user-handle-in-assertion-response #120
fix/simplify-encoding-user-handle-in-assertion-response #120
Conversation
This is the opposite of how `user.id` is converted to an ArrayBuffer prior to being passed into `navigator.credentials.create()`, so when this value is returned to the RP in an assertion it will now look like the string value originally specified in attestation options, instead of the base64url-encoded version of that string “for some reason”.
This change makes sense but it will have to be indicated in the documentation because the userHandle is stored in Buffer in the DB, following Yubico's recommendations on the data structure and as we have already discussed in the past, which means that the search for information for usernameless / passwordless, which is based on this field, will have to be adapted because the transformation into Buffer will no longer have the base64 encoding And of course the types will also change at the typescript level between |
This is a good callout, I forgot about updating the types (because I think I'm terms of usability this'll be a better way to go. Developers can more easily pass in, say, a UUID string for a user and get it back later in a recognizable format. It'll still be up to the RP to choose the encoding of the |
I will be in that case that's why I told you 😀 and when I will finish to update my project with the latest version I will give you the link like this you will be able to see the implementation And maybe you have to check the server part as well if typings are changing |
No Base64URL-encoding/-decoding ever took place with this value. The server passes it to the browser in attestation options as-is, while `startAttestation()` merely converts it to an ArrayBuffer.
Good morning, |
While dogfooding my own library it confused me why I'd pass in
'5c240dc4-bfdf-474b-929c-c4484008a302'
asuser.id
in attestation options, but get back'NWMyNDBkYzQtYmZkZi00NzRiLTkyOWMtYzQ0ODQwMDhhMzAy'
asuserHandle
in the assertion.I realized that
userHandle
, returned in an assertion response, is Base64URL-encoded before coming out ofstartAssertion()
for transmission back to the RP. It doesn't make any sense to do this, though, as the value is never Base64URL-encoded coming out ofgenerateAttestationOptions()
or withinstartAttestation()
. This PR fixes this behavior so that the value ofuserHandle
in an assertion response is the same as the value ofuser.id
passed intonavigator.credentials.create()
.