go-webauthn / webauthn

Webauthn/FIDO2 library in golang
Other
749 stars 68 forks source link

Methods should be designed to be flexible and not dictate or constrain the project’s API /Protocol definitions #248

Closed igorrendulic closed 2 months ago

igorrendulic commented 2 months ago

Description

The problem is if you wan't to use another protocol to communicate with the server, method that require http.Request such as FinishRegistration makes it tedious to use the library.

The issue is that if you include additional data in the same request (which is my current approach), the library cannot be used according to the documentation.

Use Case

Documentation

credential, err := webAuthn.FinishRegistration(user, session, r)
credential, err := webAuthn.FinishLogin(user, session, r)
james-d-elliott commented 2 months ago

All of the methods which take a *http.Request have an equivalent method that takes an io.Reader in the protocol package. In addition if you want to parse the JSON yourself that's also supported using the Parse() method on each JSON structure.

igorrendulic commented 2 months ago

Silly me. You're right. Sorry about that. It's clear in the documentation too.