mirror of
https://github.com/sonr-io/sonr.git
synced 2026-08-03 18:01:39 +00:00
feat: add passkey creation functionality
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/onsonr/sonr/crypto/mpc"
|
||||
"github.com/onsonr/sonr/pkg/common"
|
||||
"github.com/onsonr/sonr/pkg/common/passkeys"
|
||||
"github.com/onsonr/sonr/pkg/common/response"
|
||||
"github.com/onsonr/sonr/pkg/gateway/config"
|
||||
"github.com/onsonr/sonr/pkg/gateway/internal/pages/register"
|
||||
@@ -28,7 +29,9 @@ func HandleRegisterStart(c echo.Context) error {
|
||||
return echo.NewHTTPError(http.StatusInternalServerError, err.Error())
|
||||
}
|
||||
|
||||
return response.TemplEcho(c, register.LinkCredentialView(ks.Address(), handle))
|
||||
opts := passkeys.Create(c, handle, ks)
|
||||
|
||||
return response.TemplEcho(c, register.LinkCredentialView(ks.Address(), handle, opts))
|
||||
}
|
||||
|
||||
func HandleRegisterFinish(c echo.Context) error {
|
||||
|
||||
@@ -21,11 +21,11 @@ templ ProfileFormView(turnstileSiteKey string) {
|
||||
}
|
||||
}
|
||||
|
||||
templ LinkCredentialView(addr string, handle string) {
|
||||
templ LinkCredentialView(addr string, handle string, registerOptions form.RegisterOptions) {
|
||||
@layout.Root("Register | Sonr.ID") {
|
||||
@layout.Container() {
|
||||
@text.Header("Link a PassKey", "This will be used to login to your vault.")
|
||||
@form.Form("/register/finish", "POST", form.PasskeyInput("passkey"), "65", false) {
|
||||
@form.Form("/register/finish", "POST", form.PasskeyInput(registerOptions), "65", false) {
|
||||
@details.PropertyList() {
|
||||
@details.Property("Address", addr, "wallet")
|
||||
@details.Property("Handle", handle, "at-sign")
|
||||
|
||||
@@ -122,7 +122,7 @@ func ProfileFormView(turnstileSiteKey string) templ.Component {
|
||||
})
|
||||
}
|
||||
|
||||
func LinkCredentialView(addr string, handle string) templ.Component {
|
||||
func LinkCredentialView(addr string, handle string, registerOptions form.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 {
|
||||
@@ -219,7 +219,7 @@ func LinkCredentialView(addr string, handle string) templ.Component {
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
templ_7745c5c3_Err = form.Form("/register/finish", "POST", form.PasskeyInput("passkey"), "65", false).Render(templ.WithChildren(ctx, templ_7745c5c3_Var8), templ_7745c5c3_Buffer)
|
||||
templ_7745c5c3_Err = form.Form("/register/finish", "POST", form.PasskeyInput(registerOptions), "65", false).Render(templ.WithChildren(ctx, templ_7745c5c3_Var8), templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user