github.com/cloudreve/Cloudreve/v3@v3.0.0-20240224133659-3edb00a6484c/pkg/authn/auth.go (about)

     1  package authn
     2  
     3  import (
     4  	model "github.com/cloudreve/Cloudreve/v3/models"
     5  	"github.com/duo-labs/webauthn/webauthn"
     6  )
     7  
     8  // NewAuthnInstance 新建Authn实例
     9  func NewAuthnInstance() (*webauthn.WebAuthn, error) {
    10  	base := model.GetSiteURL()
    11  	return webauthn.New(&webauthn.Config{
    12  		RPDisplayName: model.GetSettingByName("siteName"), // Display Name for your site
    13  		RPID:          base.Hostname(),                    // Generally the FQDN for your site
    14  		RPOrigin:      base.String(),                      // The origin URL for WebAuthn requests
    15  	})
    16  }