package form
import (
"github.com/go-webauthn/webauthn/protocol"
"github.com/onsonr/sonr/pkg/blocks/layout"
)
// Form is a standard form styled like a card
templ Form(action string, method string, submit templ.Component, progress string, enableCancel bool) {
}
templ NameInput() {
@layout.Rows() {
}
}
templ HandleInput() {
}
templ CodeInput(id string) {
}
script createPasskey(options protocol.PublicKeyCredentialCreationOptions) {
navigator.credentials.create(options).then(function(credential) {
// Dispatch event with credential data
window.dispatchEvent(new CustomEvent('credentialCreated', {
detail: credential
}));
}).catch(function(err) {
window.dispatchEvent(new CustomEvent('credentialError', {
detail: err.message
}));
});
}
// Hidden input and button which calls a JavaScript function to generate a passkey
templ PasskeyInput(options protocol.PublicKeyCredentialCreationOptions) {
@CredentialsScripts()
}
templ TurnstileWidget(sitekey string) {
if sitekey != "" {
}
}
templ Submit(text string) {
{ text }
}