hydra-webauthn/internal/webauthn/provider.go

30 lines
813 B
Go

package webauthn
import (
"github.com/go-webauthn/webauthn/webauthn"
"github.com/pkg/errors"
"gitlab.com/wpetit/goweb/service"
)
type Config = webauthn.Config
type TimeoutsConfig = webauthn.TimeoutsConfig
type TimeoutConfig = webauthn.TimeoutConfig
type LoginOption = webauthn.LoginOption
type SessionData = webauthn.SessionData
var WithAllowedCredentials = webauthn.WithAllowedCredentials
var WithAssertionExtensions = webauthn.WithAssertionExtensions
var WithUserVerification = webauthn.WithUserVerification
var WithAppIdExtension = webauthn.WithAppIdExtension
func ServiceProvider(config *Config) service.Provider {
webauthn, err := webauthn.New(config)
return func(ctn *service.Container) (interface{}, error) {
if err != nil {
return nil, errors.WithStack(err)
}
return webauthn, nil
}
}