You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a feature request to improve the flexibility of the WebAuthn library by decoupling the FinishRegistration method (and similar methods) from being tied to net/http. Currently, frameworks like Fiber, which are based on fasthttp, encounter compatibility issues because the library only supports *http.Request.
When using Fiber’s c.Request() (which returns a *fasthttp.Request), developers encounter a type mismatch error, forcing them to rely on adaptors (such as fasthttpadaptor) to convert between fasthttp.Request and *http.Request. While this workaround works, it adds unnecessary complexity and dependency bloat to the application.
Frameworks like Fiber are popular for their performance and low resource usage.
Adding native support for fasthttp or abstracting the HTTP request layer will remove the need for adaptors and keep applications lightweight. A more flexible API will broaden the potential use of the library across a wider range of Go web frameworks.
Proposed Solution:
Consider decoupling the WebAuthn methods like FinishRegistration from being tightly bound to *http.Request.
Implement an abstraction layer using interfaces that can support both net/http and fasthttp.
Allow developers to pass custom request-handling logic, making the library more flexible across different frameworks.
Steps to Reproduce:
Use the WebAuthn library in a Fiber-based application.
Attempt to call FinishRegistration using c.Request() (Fiber's fasthttp.Request).
Observe the type mismatch error: cannot use c.Request() (value of type *fasthttp.Request) as *http.Request.
Current Workaround:
To bypass the type incompatibility, developers must use an adaptor:
req, err := fasthttpadaptor.ConvertRequest(c.Context())
if err != nil {
// Handle error
}
credential, err := webAuthn.FinishRegistration(authAuth, user, sessionData, req)
Use Case
No response
Documentation
No response
The text was updated successfully, but these errors were encountered:
It's already supported. Take a look at the implementation specifics of these functions, you'll realize they're just decorators for lower lower level functions which can parse bytes and io.Readers.
Hello James,
Thank you for your prompt response! I really appreciate the clarification. I have implemented the suggested changes, and everything is working smoothly now—no more errors!
I also think it would be beneficial to update the documentation with these examples. If you're open to it, I would be happy to assist with that.
Lastly, I'm encountering a minor challenge when I log the error from the credential creation process. I'm receiving the message: "Error validating origin." Below is the relevant test code for my WebAuthn configuration:
Description
This is a feature request to improve the flexibility of the WebAuthn library by decoupling the FinishRegistration method (and similar methods) from being tied to net/http. Currently, frameworks like Fiber, which are based on fasthttp, encounter compatibility issues because the library only supports *http.Request.
When using Fiber’s c.Request() (which returns a *fasthttp.Request), developers encounter a type mismatch error, forcing them to rely on adaptors (such as fasthttpadaptor) to convert between fasthttp.Request and *http.Request. While this workaround works, it adds unnecessary complexity and dependency bloat to the application.
Frameworks like Fiber are popular for their performance and low resource usage.
Adding native support for fasthttp or abstracting the HTTP request layer will remove the need for adaptors and keep applications lightweight. A more flexible API will broaden the potential use of the library across a wider range of Go web frameworks.
Proposed Solution:
Steps to Reproduce:
Current Workaround:
To bypass the type incompatibility, developers must use an adaptor:
req, err := fasthttpadaptor.ConvertRequest(c.Context())
if err != nil {
// Handle error
}
credential, err := webAuthn.FinishRegistration(authAuth, user, sessionData, req)
Use Case
No response
Documentation
No response
The text was updated successfully, but these errors were encountered: