diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 73a247c..52823fc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -33,6 +33,7 @@ jobs: publish_dir: _site publish_branch: gh-pages github_token: ${{ secrets.GITHUB_TOKEN }} + cname: nebulaui.org publish: needs: deploy-docs diff --git a/Taskfile.yml b/Taskfile.yml new file mode 100644 index 0000000..e18a8d9 --- /dev/null +++ b/Taskfile.yml @@ -0,0 +1,11 @@ +# https://taskfile.dev + +version: '3' + +vars: + GREETING: Hello, World! + +tasks: + templ-gen: + cmd: templ generate + silent: true diff --git a/go.mod b/go.mod index eaa1574..92e6c83 100644 --- a/go.mod +++ b/go.mod @@ -3,6 +3,18 @@ module github.com/onsonr/nebula go 1.23.3 require ( - github.com/a-h/templ v0.2.793 // indirect - github.com/go-webauthn/webauthn v0.11.2 // indirect + github.com/a-h/templ v0.2.793 + github.com/go-webauthn/webauthn v0.11.2 +) + +require ( + github.com/fxamacker/cbor/v2 v2.7.0 // indirect + github.com/go-webauthn/x v0.1.14 // indirect + github.com/golang-jwt/jwt/v5 v5.2.1 // indirect + github.com/google/go-tpm v0.9.1 // indirect + github.com/google/uuid v1.6.0 // indirect + github.com/mitchellh/mapstructure v1.5.0 // indirect + github.com/x448/float16 v0.8.4 // indirect + golang.org/x/crypto v0.26.0 // indirect + golang.org/x/sys v0.23.0 // indirect ) diff --git a/go.sum b/go.sum index 732a4e2..836a6eb 100644 --- a/go.sum +++ b/go.sum @@ -1,4 +1,32 @@ github.com/a-h/templ v0.2.793 h1:Io+/ocnfGWYO4VHdR0zBbf39PQlnzVCVVD+wEEs6/qY= github.com/a-h/templ v0.2.793/go.mod h1:lq48JXoUvuQrU0VThrK31yFwdRjTCnIE5bcPCM9IP1w= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/fxamacker/cbor/v2 v2.7.0 h1:iM5WgngdRBanHcxugY4JySA0nk1wZorNOpTgCMedv5E= +github.com/fxamacker/cbor/v2 v2.7.0/go.mod h1:pxXPTn3joSm21Gbwsv0w9OSA2y1HFR9qXEeXQVeNoDQ= github.com/go-webauthn/webauthn v0.11.2 h1:Fgx0/wlmkClTKlnOsdOQ+K5HcHDsDcYIvtYmfhEOSUc= github.com/go-webauthn/webauthn v0.11.2/go.mod h1:aOtudaF94pM71g3jRwTYYwQTG1KyTILTcZqN1srkmD0= +github.com/go-webauthn/x v0.1.14 h1:1wrB8jzXAofojJPAaRxnZhRgagvLGnLjhCAwg3kTpT0= +github.com/go-webauthn/x v0.1.14/go.mod h1:UuVvFZ8/NbOnkDz3y1NaxtUN87pmtpC1PQ+/5BBQRdc= +github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk= +github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-tpm v0.9.1 h1:0pGc4X//bAlmZzMKf8iz6IsDo1nYTbYJ6FZN/rg4zdM= +github.com/google/go-tpm v0.9.1/go.mod h1:h9jEsEECg7gtLis0upRBQU+GhYVH6jMjrFxI8u6bVUY= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= +github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= +github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg= +golang.org/x/crypto v0.26.0 h1:RrRspgV4mU+YwB4FYnuBoKsUapNIL5cohGAmSH3azsw= +golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54= +golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM= +golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/ui/form/scripts.templ b/ui/form/credentials.templ similarity index 96% rename from ui/form/scripts.templ rename to ui/form/credentials.templ index 40b9946..6ddc3aa 100644 --- a/ui/form/scripts.templ +++ b/ui/form/credentials.templ @@ -1,7 +1,5 @@ package form -import "github.com/go-webauthn/webauthn/protocol" - var credentialsHandle = templ.NewOnceHandle() // Base credentials script template @@ -31,11 +29,11 @@ templ CredentialsScripts() { timeout: options.timeout || 60000, attestation: options.attestationType || "none", }; - + const credential = await navigator.credentials.create({ publicKey: publicKey }); - + return { id: credential.id, rawId: arrayBufferToBase64URL(credential.rawId), @@ -127,7 +125,7 @@ script CreatePasskey(id string) { } // Template for creating credentials -templ CreateCredential(options *protocol.PublicKeyCredentialCreationOptions) { +templ CreateCredential(options *RegisterOptions) { @CredentialsScripts() ") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -74,7 +72,7 @@ func CreatePasskey(id string) templ.ComponentScript { } // Template for creating credentials -func CreateCredential(options *protocol.PublicKeyCredentialCreationOptions) templ.Component { +func CreateCredential(options *RegisterOptions) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { @@ -108,7 +106,7 @@ func CreateCredential(options *protocol.PublicKeyCredentialCreationOptions) temp } // Template for getting credentials -func GetCredential(options *protocol.PublicKeyCredentialRequestOptions) templ.Component { +func GetCredential(options *LoginOptions) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { diff --git a/ui/form/model.go b/ui/form/model.go new file mode 100644 index 0000000..229577d --- /dev/null +++ b/ui/form/model.go @@ -0,0 +1,10 @@ +package form + +import "github.com/go-webauthn/webauthn/protocol" + +type ( + CredentialDescriptor = protocol.CredentialDescriptor + AuthenticationExtensions = protocol.AuthenticationExtensions + LoginOptions = protocol.PublicKeyCredentialRequestOptions + RegisterOptions = protocol.PublicKeyCredentialCreationOptions +)