Skip to content
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/parse-auth-data-extension-data #125

Merged
merged 4 commits into from
Apr 6, 2022

Conversation

MasterKale
Copy link
Collaborator

Issue #124 highlighted how the library incorrectly parses a response's authenticatorData. For example, data containing extension data would return a malformed credential public key containing the extension data.

This diff enhances authenticator data parsing to always correctly return the credential public key, and also return the CBOR-encoded bytes structure representing any included extension data.

NOTE: Parsing extension data into something intelligible will come later when I get around to addressing Issue #104. For now if you want the extension data in authenticatorData (instead of what is returned from getclientextensionresults() in the browser) you can do something like this:

import cbor2
from webauthn.helpers import parse_authenticator_data
from webauthn.helpers.structs import RegistrationCredential  # Should work for AuthenticationCredential too

credential = RegistrationCredential.parse_raw(credential_json)
parsed_auth_data = parse_authenticator_data(credential.response.authenticator_data)
parsed_extension_data: dict = cbor2.loads(parsed_auth_data.extensions)

@MasterKale MasterKale merged commit 81f7d86 into master Apr 6, 2022
@MasterKale MasterKale deleted the fix/parse-auth-data-extension-data branch April 6, 2022 17:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant