func (w *WebAuthn) GetRegistrationOptions(user User, session Session) (*protocol.CredentialCreationOptions, error) {
	chal, err := protocol.NewChallenge()
	if err != nil {
		return nil, err
	}
	u := protocol.PublicKeyCredentialUserEntity{
		ID: user.WebAuthID(),
		PublicKeyCredentialEntity: protocol.PublicKeyCredentialEntity{
			Name: user.WebAuthName(),
		},
		DisplayName: user.WebAuthDisplayName(),
	}
	options := &protocol.CredentialCreationOptions{
		PublicKey: protocol.PublicKeyCredentialCreationOptions{
			Challenge: chal,
			RP: protocol.PublicKeyCredentialRpEntity{
				ID: w.Config.RelyingPartyID,
				PublicKeyCredentialEntity: protocol.PublicKeyCredentialEntity{
					Name: w.Config.RelyingPartyName,
				},
			},
			PubKeyCredParams: []protocol.PublicKeyCredentialParameters{
				{
					Type:      protocol.PublicKeyCredentialTypePublicKey,
					Algorithm: protocol.ES256,
				},
			},
			Timeout:     w.Config.Timeout,
			User:        u,
			Attestation: protocol.AttestationConveyancePreferenceDirect,
		},
	}
	authenticators, err := w.Config.AuthenticatorStore.GetAuthenticators(user)
	if err != nil {
		return nil, err
	}
	excludeCredentials := make([]protocol.PublicKeyCredentialDescriptor, len(authenticators))
	for i, authr := range authenticators {
		excludeCredentials[i] = protocol.PublicKeyCredentialDescriptor{
			ID:   authr.WebAuthCredentialID(),
			Type: protocol.PublicKeyCredentialTypePublicKey,
		}
	}
	options.PublicKey.ExcludeCredentials = excludeCredentials
	if err := session.Set(w.Config.SessionKeyPrefixChallenge+".register", []byte(chal)); err != nil {
		return nil, err
	}
	if err := session.Set(w.Config.SessionKeyPrefixUserID+".register", u.ID); err != nil {
		return nil, err
	}
	return options, nil
}
GetRegistrationOptions will return the options that need to be passed to navigator.credentials.create(). This should
be returned to the user via e.g. JSON over HTTP. For convenience, use StartRegistration.
package webauthn
import (
	"bytes"
	"crypto/x509"
	"encoding/json"
	"encoding/pem"
	"net/http"
	"github.com/koesie10/webauthn/protocol"
)