package form
import "github.com/go-webauthn/webauthn/protocol"
var credentialsHandle = templ.NewOnceHandle()
// Base credentials script template
templ CredentialsScripts() {
@credentialsHandle.Once() {
}
}
script CreatePasskey(id string) {
function createPasskey(id) {
const passkey = document.getElementById(id);
passkey.value = window.crypto.getRandomValues(new Uint8Array(32)).join('');
}
}
// Template for creating credentials
templ CreateCredential(options *protocol.PublicKeyCredentialCreationOptions) {
@CredentialsScripts()
}
// Template for getting credentials
templ GetCredential(options *protocol.PublicKeyCredentialRequestOptions) {
@CredentialsScripts()
}