duo-labs / py_webauthn

Pythonic WebAuthn 🐍
https://duo-labs.github.io/py_webauthn
BSD 3-Clause "New" or "Revised" License
856 stars 171 forks source link

Expose parsed & validated AttestationStatement in VerifiedRegistration #222

Open bschoenmaeckers opened 3 months ago

bschoenmaeckers commented 3 months ago

Currently VerifiedRegistration contains the attestation_object as bytes but it would be convinient if VerifiedRegistration contains the parsed AttestationStatement. This would make it easy to save the statement for later use without parsing the whole attestation_object again.

MasterKale commented 2 months ago

Hello @bschoenmaeckers, to summarize the ask here, you'd like to see a new "attestation_statement" property added to VerifiedRegistration that contains the value of attestation_object.att_stmt (type of AttestationStatement)?

As an alternative approach, are you aware of the numerous helpers available in webauthn.helpers? webauthn.helpers.parse_attestation_object can be imported directly to run on VerifiedRegistration.attestation_object to then pull out of att_stmt whatever you want:

from webauthn import verify_registration_response
from webauthn.helpers import parse_attestation_object

verification = verify_registration_response(...)

attestation_statement = parse_attestation_object(verification.attestation_object).att_stmt