mirror of
https://github.com/sonr-io/sonr.git
synced 2026-08-04 18:31:41 +00:00
feature/implement wss routes (#1196)
* feat(database): create schema for hway and motr * fix(gateway): correct naming inconsistencies in handlers * build: update schema file to be compatible with postgresql syntax * fix: update schema to be compatible with PostgreSQL syntax * chore: update query_hway.sql to follow sqlc syntax * ```text refactor: update query_hway.sql for PostgreSQL and sqlc ``` * feat: add vaults table to store encrypted data * refactor: Update vaults table schema for sqlc compatibility * chore(deps): Upgrade dependencies and add pgx/v5 * refactor(Makefile): move sqlc generate to internal/models * docs(foundations): remove outdated pages * chore(build): add Taskfile for build tasks * refactor(embed): move embed files to internal package * docs: add documentation for Cosmos SDK ORM
This commit is contained in:
@@ -3,13 +3,16 @@ package handlers
|
||||
import (
|
||||
"github.com/labstack/echo/v4"
|
||||
|
||||
"github.com/onsonr/sonr/pkg/gateway/middleware"
|
||||
"github.com/onsonr/sonr/internal/nebula/input"
|
||||
"github.com/onsonr/sonr/pkg/gateway/middleware"
|
||||
)
|
||||
|
||||
// ValidateProfileHandle finds the chosen handle and verifies it is unique
|
||||
func ValidateProfileHandle(c echo.Context) error {
|
||||
// CheckProfileHandle finds the chosen handle and verifies it is unique
|
||||
func CheckProfileHandle(c echo.Context) error {
|
||||
handle := c.FormValue("handle")
|
||||
if handle == "" {
|
||||
return middleware.Render(c, input.HandleError(handle, "Please enter a valid handle"))
|
||||
}
|
||||
//
|
||||
// if ok {
|
||||
// return middleware.Render(c, input.HandleError(handle))
|
||||
@@ -19,7 +22,7 @@ func ValidateProfileHandle(c echo.Context) error {
|
||||
}
|
||||
|
||||
// ValidateProfileHandle finds the chosen handle and verifies it is unique
|
||||
func ValidateIsHumanSum(c echo.Context) error {
|
||||
func CheckIsHumanSum(c echo.Context) error {
|
||||
// data := context.GetCreateProfileData(c)
|
||||
// value := c.FormValue("is_human")
|
||||
// intValue, err := strconv.Atoi(value)
|
||||
|
||||
@@ -5,12 +5,24 @@ import (
|
||||
"github.com/onsonr/sonr/pkg/gateway/middleware"
|
||||
)
|
||||
|
||||
func RenderIndex(c echo.Context) error {
|
||||
func HandleIndex(c echo.Context) error {
|
||||
id := middleware.GetSessionID(c)
|
||||
if id == "" {
|
||||
return startNewSession(c)
|
||||
}
|
||||
return middleware.RenderInitial(c)
|
||||
}
|
||||
|
||||
func startNewSession(c echo.Context) error {
|
||||
// Initialize the session
|
||||
err := middleware.NewSession(c)
|
||||
if err != nil {
|
||||
return middleware.RenderError(c, err)
|
||||
}
|
||||
// Render the initial view
|
||||
return middleware.RenderInitial(c)
|
||||
}
|
||||
|
||||
func continueExistingSession(c echo.Context, id string) error {
|
||||
// Do some auth checks here
|
||||
return middleware.RenderInitial(c)
|
||||
}
|
||||
|
||||
@@ -3,21 +3,20 @@ package handlers
|
||||
import (
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/onsonr/sonr/pkg/gateway/middleware"
|
||||
"github.com/onsonr/sonr/pkg/gateway/types"
|
||||
"github.com/onsonr/sonr/pkg/gateway/views"
|
||||
)
|
||||
|
||||
func RenderProfileCreate(c echo.Context) error {
|
||||
// numF, numL := middleware.GetHumanVerificationNumbers(c)
|
||||
params := types.CreateProfileParams{
|
||||
params := middleware.CreateProfileParams{
|
||||
FirstNumber: int(middleware.CurrentBlock(c)),
|
||||
LastNumber: int(middleware.CurrentBlock(c)),
|
||||
}
|
||||
return middleware.Render(c, views.RegisterProfileView(params))
|
||||
return middleware.Render(c, views.RegisterProfileView(params.FirstNumber, params.LastNumber))
|
||||
}
|
||||
|
||||
func RenderPasskeyCreate(c echo.Context) error {
|
||||
return middleware.Render(c, views.RegisterPasskeyView(types.CreatePasskeyParams{}))
|
||||
return middleware.Render(c, views.RegisterPasskeyView("", "", "", "", ""))
|
||||
}
|
||||
|
||||
func RenderVaultLoading(c echo.Context) error {
|
||||
|
||||
@@ -4,7 +4,6 @@ import (
|
||||
"encoding/json"
|
||||
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/onsonr/sonr/pkg/gateway/types"
|
||||
"github.com/onsonr/sonr/pkg/gateway/middleware"
|
||||
)
|
||||
|
||||
@@ -16,7 +15,7 @@ func SubmitProfileHandle(c echo.Context) error {
|
||||
// SubmitPublicKeyCredential submits a public key credential
|
||||
func SubmitPublicKeyCredential(c echo.Context) error {
|
||||
credentialJSON := c.FormValue("credential")
|
||||
cred := &types.CredentialDescriptor{}
|
||||
cred := &middleware.CredentialDescriptor{}
|
||||
// Unmarshal the credential JSON
|
||||
if err := json.Unmarshal([]byte(credentialJSON), cred); err != nil {
|
||||
return middleware.RenderError(c, err)
|
||||
|
||||
Reference in New Issue
Block a user