refactor: move gateway and vault packages to internal directory

This commit is contained in:
Prad Nukala 2024-12-10 12:52:19 -05:00
parent b81bdebd64
commit dc6f02a000
73 changed files with 58 additions and 59 deletions

View File

@ -9,9 +9,9 @@ import (
"github.com/labstack/echo/v4"
"github.com/labstack/echo/v4/middleware"
"github.com/onsonr/sonr/app/gateway"
"github.com/onsonr/sonr/app/gateway/config"
"github.com/onsonr/sonr/crypto/ucan"
"github.com/onsonr/sonr/internal/gateway"
"github.com/onsonr/sonr/internal/gateway/config"
"github.com/onsonr/sonr/pkg/common/ipfs"
"github.com/onsonr/sonr/pkg/didauth/producer"
)

View File

@ -8,8 +8,8 @@ import (
"syscall/js"
"github.com/labstack/echo/v4"
"github.com/onsonr/sonr/app/vault"
"github.com/onsonr/sonr/app/vault/types"
"github.com/onsonr/sonr/internal/vault"
"github.com/onsonr/sonr/internal/vault/types"
"github.com/onsonr/sonr/pkg/didauth/controller"
)

View File

@ -49,51 +49,51 @@
}
}
},
"gum@latest": {
"last_modified": "2024-11-16T04:25:12Z",
"resolved": "github:NixOS/nixpkgs/34a626458d686f1b58139620a8b2793e9e123bba#gum",
"go@latest": {
"last_modified": "2024-11-28T07:51:56Z",
"resolved": "github:NixOS/nixpkgs/226216574ada4c3ecefcbbec41f39ce4655f78ef#go",
"source": "devbox-search",
"version": "0.14.5",
"version": "1.23.3",
"systems": {
"aarch64-darwin": {
"outputs": [
{
"name": "out",
"path": "/nix/store/rzqm62ixipbzbhfagqlic5xxag9a2v82-gum-0.14.5",
"path": "/nix/store/qrj2wp6vzfpjfrrlcmr22818zg83fb73-go-1.23.3",
"default": true
}
],
"store_path": "/nix/store/rzqm62ixipbzbhfagqlic5xxag9a2v82-gum-0.14.5"
"store_path": "/nix/store/qrj2wp6vzfpjfrrlcmr22818zg83fb73-go-1.23.3"
},
"aarch64-linux": {
"outputs": [
{
"name": "out",
"path": "/nix/store/3ick2j8z9jgkk3cyc1ik4zkbs3m4583n-gum-0.14.5",
"path": "/nix/store/dm66qyl19skrwcmk4rb9xcs64xc1d071-go-1.23.3",
"default": true
}
],
"store_path": "/nix/store/3ick2j8z9jgkk3cyc1ik4zkbs3m4583n-gum-0.14.5"
"store_path": "/nix/store/dm66qyl19skrwcmk4rb9xcs64xc1d071-go-1.23.3"
},
"x86_64-darwin": {
"outputs": [
{
"name": "out",
"path": "/nix/store/9rh8qxbxgb07v3a62mx9404ynk2yhxrj-gum-0.14.5",
"path": "/nix/store/vkjn6njpz4gy5ma763vh8hh93bgjwycr-go-1.23.3",
"default": true
}
],
"store_path": "/nix/store/9rh8qxbxgb07v3a62mx9404ynk2yhxrj-gum-0.14.5"
"store_path": "/nix/store/vkjn6njpz4gy5ma763vh8hh93bgjwycr-go-1.23.3"
},
"x86_64-linux": {
"outputs": [
{
"name": "out",
"path": "/nix/store/1bnivwijzrnzx5h0hd5rywwy8rlhxmw5-gum-0.14.5",
"path": "/nix/store/bavnchxi7v6xs077jxv7fl5rrqc3y87w-go-1.23.3",
"default": true
}
],
"store_path": "/nix/store/1bnivwijzrnzx5h0hd5rywwy8rlhxmw5-gum-0.14.5"
"store_path": "/nix/store/bavnchxi7v6xs077jxv7fl5rrqc3y87w-go-1.23.3"
}
}
},

View File

@ -1,4 +1,4 @@
package internal
package embed
import (
_ "embed"

View File

@ -4,7 +4,7 @@ import (
"reflect"
"strings"
"github.com/onsonr/sonr/app/vault/types"
"github.com/onsonr/sonr/internal/vault/types"
"github.com/onsonr/sonr/pkg/common/models"
)

View File

@ -4,8 +4,8 @@ import (
"encoding/json"
"github.com/ipfs/boxo/files"
"github.com/onsonr/sonr/app/gateway/config/internal"
"github.com/onsonr/sonr/app/vault/types"
"github.com/onsonr/sonr/internal/gateway/config/embed"
"github.com/onsonr/sonr/internal/vault/types"
)
const SchemaVersion = 1
@ -30,9 +30,9 @@ func NewFS(cfg *types.Config) (files.Directory, error) {
return files.NewMapDirectory(map[string]files.Node{
AppManifestFileName: files.NewBytesFile(manifestBz),
DWNConfigFileName: files.NewBytesFile(cnfBz),
IndexHTMLFileName: files.NewBytesFile(internal.IndexHTML),
MainJSFileName: files.NewBytesFile(internal.MainJS),
ServiceWorkerFileName: files.NewBytesFile(internal.WorkerJS),
IndexHTMLFileName: files.NewBytesFile(embed.IndexHTML),
MainJSFileName: files.NewBytesFile(embed.MainJS),
ServiceWorkerFileName: files.NewBytesFile(embed.WorkerJS),
}), nil
}

View File

@ -4,7 +4,7 @@ import (
"os"
"path/filepath"
"github.com/onsonr/sonr/app/gateway/config"
"github.com/onsonr/sonr/internal/gateway/config"
"gorm.io/driver/sqlite"
"gorm.io/gorm"
)

View File

@ -2,8 +2,8 @@ package handlers
import (
"github.com/labstack/echo/v4"
"github.com/onsonr/sonr/app/gateway/internal/pages/index"
"github.com/onsonr/sonr/app/gateway/internal/session"
"github.com/onsonr/sonr/internal/gateway/pages/index"
"github.com/onsonr/sonr/internal/gateway/session"
"github.com/onsonr/sonr/pkg/common/response"
)

View File

@ -8,15 +8,14 @@ import (
"github.com/go-webauthn/webauthn/protocol"
"github.com/labstack/echo/v4"
"github.com/onsonr/sonr/app/gateway/internal/database"
"github.com/onsonr/sonr/app/gateway/internal/pages/register"
"github.com/onsonr/sonr/crypto/mpc"
"github.com/onsonr/sonr/internal/gateway/database"
"github.com/onsonr/sonr/internal/gateway/pages/register"
"github.com/onsonr/sonr/pkg/common/response"
"github.com/onsonr/sonr/pkg/common/styles/forms"
)
func HandleRegisterView(c echo.Context) error {
dat := forms.CreateProfileData{
dat := register.CreateProfileData{
FirstNumber: 1,
LastNumber: 2,
}
@ -33,7 +32,7 @@ func HandleRegisterStart(c echo.Context) error {
if err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, err.Error())
}
dat := forms.RegisterPasskeyData{
dat := register.RegisterPasskeyData{
Address: ks.Address(),
Handle: handle,
Name: fmt.Sprintf("%s %s", firstName, lastName),

View File

@ -53,7 +53,7 @@ func formRegisterPasskey(action, method string, data RegisterPasskeyData) templ.
var templ_7745c5c3_Var3 string
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(method)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `app/gateway/internal/pages/register/creds.templ`, Line: 12, Col: 55}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/gateway/pages/register/creds.templ`, Line: 12, Col: 55}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
if templ_7745c5c3_Err != nil {
@ -304,7 +304,7 @@ func sonrProfile(addr string, name string, handle string, creationBlock string)
var templ_7745c5c3_Var7 string
templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(handle)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `app/gateway/internal/pages/register/creds.templ`, Line: 173, Col: 43}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/gateway/pages/register/creds.templ`, Line: 173, Col: 43}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7))
if templ_7745c5c3_Err != nil {
@ -317,7 +317,7 @@ func sonrProfile(addr string, name string, handle string, creationBlock string)
var templ_7745c5c3_Var8 string
templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(shortenAddress(addr))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `app/gateway/internal/pages/register/creds.templ`, Line: 180, Col: 58}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/gateway/pages/register/creds.templ`, Line: 180, Col: 58}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8))
if templ_7745c5c3_Err != nil {
@ -330,7 +330,7 @@ func sonrProfile(addr string, name string, handle string, creationBlock string)
var templ_7745c5c3_Var9 string
templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(creationBlock)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `app/gateway/internal/pages/register/creds.templ`, Line: 185, Col: 55}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/gateway/pages/register/creds.templ`, Line: 185, Col: 55}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9))
if templ_7745c5c3_Err != nil {
@ -343,7 +343,7 @@ func sonrProfile(addr string, name string, handle string, creationBlock string)
var templ_7745c5c3_Var10 string
templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(name)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `app/gateway/internal/pages/register/creds.templ`, Line: 189, Col: 32}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/gateway/pages/register/creds.templ`, Line: 189, Col: 32}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10))
if templ_7745c5c3_Err != nil {
@ -386,7 +386,7 @@ func cryptoWalletOption(ticker string, name string, isDefault bool) templ.Compon
var templ_7745c5c3_Var12 string
templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(ticker)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `app/gateway/internal/pages/register/creds.templ`, Line: 198, Col: 27}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/gateway/pages/register/creds.templ`, Line: 198, Col: 27}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var12))
if templ_7745c5c3_Err != nil {
@ -399,7 +399,7 @@ func cryptoWalletOption(ticker string, name string, isDefault bool) templ.Compon
var templ_7745c5c3_Var13 string
templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(ticker)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `app/gateway/internal/pages/register/creds.templ`, Line: 199, Col: 39}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/gateway/pages/register/creds.templ`, Line: 199, Col: 39}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13))
if templ_7745c5c3_Err != nil {
@ -412,7 +412,7 @@ func cryptoWalletOption(ticker string, name string, isDefault bool) templ.Compon
var templ_7745c5c3_Var14 string
templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(name)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `app/gateway/internal/pages/register/creds.templ`, Line: 200, Col: 9}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/gateway/pages/register/creds.templ`, Line: 200, Col: 9}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var14))
if templ_7745c5c3_Err != nil {
@ -430,7 +430,7 @@ func cryptoWalletOption(ticker string, name string, isDefault bool) templ.Compon
var templ_7745c5c3_Var15 string
templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs(ticker)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `app/gateway/internal/pages/register/creds.templ`, Line: 204, Col: 27}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/gateway/pages/register/creds.templ`, Line: 204, Col: 27}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var15))
if templ_7745c5c3_Err != nil {
@ -443,7 +443,7 @@ func cryptoWalletOption(ticker string, name string, isDefault bool) templ.Compon
var templ_7745c5c3_Var16 string
templ_7745c5c3_Var16, templ_7745c5c3_Err = templ.JoinStringErrs(ticker)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `app/gateway/internal/pages/register/creds.templ`, Line: 205, Col: 39}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/gateway/pages/register/creds.templ`, Line: 205, Col: 39}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var16))
if templ_7745c5c3_Err != nil {
@ -456,7 +456,7 @@ func cryptoWalletOption(ticker string, name string, isDefault bool) templ.Compon
var templ_7745c5c3_Var17 string
templ_7745c5c3_Var17, templ_7745c5c3_Err = templ.JoinStringErrs(name)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `app/gateway/internal/pages/register/creds.templ`, Line: 206, Col: 9}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/gateway/pages/register/creds.templ`, Line: 206, Col: 9}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var17))
if templ_7745c5c3_Err != nil {

View File

@ -60,7 +60,7 @@ func formCreateProfile(action string, method string, data CreateProfileData) tem
var templ_7745c5c3_Var3 string
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(method)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `app/gateway/internal/pages/register/profile.templ`, Line: 19, Col: 55}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/gateway/pages/register/profile.templ`, Line: 19, Col: 55}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
if templ_7745c5c3_Err != nil {
@ -111,7 +111,7 @@ func formCreateProfile(action string, method string, data CreateProfileData) tem
var templ_7745c5c3_Var5 string
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(data.IsHumanLabel())
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `app/gateway/internal/pages/register/profile.templ`, Line: 37, Col: 56}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/gateway/pages/register/profile.templ`, Line: 37, Col: 56}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
if templ_7745c5c3_Err != nil {

View File

@ -3,10 +3,10 @@ package gateway
import (
"github.com/labstack/echo/v4"
"github.com/onsonr/sonr/app/gateway/config"
"github.com/onsonr/sonr/app/gateway/handlers"
"github.com/onsonr/sonr/app/gateway/internal/database"
"github.com/onsonr/sonr/app/gateway/internal/session"
"github.com/onsonr/sonr/internal/gateway/config"
"github.com/onsonr/sonr/internal/gateway/database"
"github.com/onsonr/sonr/internal/gateway/handlers"
"github.com/onsonr/sonr/internal/gateway/session"
"github.com/onsonr/sonr/pkg/common/response"
)

View File

@ -5,7 +5,7 @@ import (
"strings"
"github.com/labstack/echo/v4"
"github.com/onsonr/sonr/app/gateway/internal/database"
"github.com/onsonr/sonr/internal/gateway/database"
"github.com/onsonr/sonr/pkg/common"
"github.com/segmentio/ksuid"
)

View File

@ -4,8 +4,8 @@ import (
"net/http"
"github.com/labstack/echo/v4"
"github.com/onsonr/sonr/app/gateway/config"
"github.com/onsonr/sonr/app/gateway/internal/database"
"github.com/onsonr/sonr/internal/gateway/config"
"github.com/onsonr/sonr/internal/gateway/database"
"gorm.io/gorm"
)

View File

@ -2,7 +2,7 @@ package session
import (
"github.com/labstack/echo/v4"
"github.com/onsonr/sonr/app/gateway/internal/database"
"github.com/onsonr/sonr/internal/gateway/database"
)
// ╭───────────────────────────────────────────────────────╮

View File

@ -4,8 +4,8 @@ import (
"net/http"
"github.com/labstack/echo/v4"
session "github.com/onsonr/sonr/app/vault/internal"
"github.com/onsonr/sonr/app/vault/internal/pages/index"
"github.com/onsonr/sonr/internal/vault/pages/index"
session "github.com/onsonr/sonr/internal/vault/session"
"github.com/onsonr/sonr/pkg/common/response"
)

View File

@ -7,9 +7,9 @@ package vault
import (
"github.com/labstack/echo/v4"
"github.com/onsonr/sonr/app/vault/handlers"
session "github.com/onsonr/sonr/app/vault/internal"
"github.com/onsonr/sonr/app/vault/types"
"github.com/onsonr/sonr/internal/vault/handlers"
session "github.com/onsonr/sonr/internal/vault/session"
"github.com/onsonr/sonr/internal/vault/types"
)
// RegisterRoutes registers the Decentralized Web Node API routes.

View File

@ -6,7 +6,7 @@ import (
"github.com/labstack/echo/v4"
"github.com/onsonr/sonr/app/vault/types"
"github.com/onsonr/sonr/internal/vault/types"
"github.com/onsonr/sonr/pkg/common"
)

View File

@ -4,7 +4,7 @@ import (
"net/http"
"github.com/labstack/echo/v4"
"github.com/onsonr/sonr/app/gateway/config"
"github.com/onsonr/sonr/internal/gateway/config"
"google.golang.org/grpc"
)