From 3790e926debf1e7c0a3635518f26340fe9245299 Mon Sep 17 00:00:00 2001 From: Prad Nukala Date: Fri, 11 Oct 2024 16:47:52 -0400 Subject: [PATCH] feature/1109 grpc session model (#1141) - **feat: remove Hway deployment** - **feat: introduce session middleware for requests** - **refactor: update path imports to use new pkg folder** - **feat: add gRPC client for interacting with services** - **feat: remove grpc client and use REST api** - **refactor: move from to** - **feat: add client views endpoint** - **feat: add webauthn support** - **closes: #1124** - **refactor: Improve PR labeler configuration** - **feat: add milestone discussion template** - **feat: remove OKR tracking issue template** - **feat: use gorilla sessions for session management** - **refactor: move pubkey related code to** - **** - **refactor: remove unused identifier type** - **feat: integrate Macaroon Keeper with Service Module** - **refactor: rename worker routes for clarity** --- .github/DISCUSSION_TEMPLATE/milestone.yml | 30 ++++ .github/ISSUE_TEMPLATE/okr.yml | 30 ---- .github/pr-labeler.yml | 8 +- .github/workflows/deploy-hway.yml | 20 --- .gitignore | 1 + Makefile | 6 +- app/app.go | 21 ++- cmd/hway/main.go | 4 +- cmd/motr/main.go | 37 +++- devbox.lock | 96 ----------- go.mod | 11 +- go.sum | 14 +- internal/ctx/{macaroon.go => authorize.go} | 0 internal/ctx/cookies.go | 41 ----- internal/ctx/session.go | 81 +++++++-- internal/ctx/state.go | 61 +++++++ internal/ctx/store.go | 142 ++++++++++++++++ internal/dwn/embed.go | 2 +- {cmd/motr/fetch => internal/dwn}/serve.go | 2 +- .../marketing.go => marketing/models.go} | 2 +- internal/orm/webauthn.go | 58 +++++++ nebula/components/auth/modal.templ | 13 -- nebula/components/auth/modal_templ.go | 64 ------- nebula/components/dash/page.templ | 15 -- nebula/components/dash/page_templ.go | 87 ---------- nebula/components/dash/route.go | 10 -- nebula/components/pay/route.go | 10 -- {nebula => pkg/nebula}/README.md | 6 +- {nebula => pkg/nebula}/assets/css/styles.css | 0 .../fonts/ZTBrosOskon90s-BoldSemExp.woff | Bin .../fonts/ZTBrosOskon90s-BoldSemExp.woff2 | Bin .../fonts/ZTBrosOskon90s-BoldSemExpIta.woff | Bin .../fonts/ZTBrosOskon90s-BoldSemExpIta.woff2 | Bin .../nebula}/assets/js/alpine.min.js | 0 {nebula => pkg/nebula}/assets/js/dexie.min.js | 0 {nebula => pkg/nebula}/assets/js/htmx.min.js | 0 {nebula => pkg/nebula}/assets/js/sw.js | 0 {nebula => pkg/nebula}/bun.lockb | Bin .../auth/forms/consent_privacy.templ | 0 .../auth/forms/consent_privacy_templ.go | 0 .../auth/forms/credential_assert.templ | 0 .../auth/forms/credential_assert_templ.go | 0 .../auth/forms/credential_register.templ | 0 .../auth/forms/credential_register_templ.go | 0 .../components/auth/forms/details_basic.templ | 0 .../auth/forms/details_basic_templ.go | 0 pkg/nebula/components/auth/modal.templ | 25 +++ pkg/nebula/components/auth/modal_templ.go | 158 ++++++++++++++++++ .../nebula}/components/auth/route.go | 6 +- .../components/auth/sections/authorize.templ | 6 +- .../auth/sections/authorize_templ.go | 6 +- .../components/auth/sections/login.templ | 6 +- .../components/auth/sections/login_templ.go | 6 +- .../components/auth/sections/register.templ | 6 +- .../auth/sections/register_templ.go | 6 +- .../nebula}/components/home/page.templ | 4 +- .../nebula}/components/home/page_templ.go | 4 +- .../nebula}/components/home/route.go | 5 + .../home/sections/architecture.templ | 0 .../home/sections/architecture_templ.go | 0 .../components/home/sections/cta.templ | 0 .../components/home/sections/cta_templ.go | 0 .../components/home/sections/footer.templ | 0 .../components/home/sections/footer_templ.go | 0 .../components/home/sections/header.templ | 0 .../components/home/sections/header_templ.go | 0 .../components/home/sections/hero.templ | 8 +- .../components/home/sections/hero_templ.go | 36 ++-- .../components/home/sections/highlights.templ | 2 +- .../home/sections/highlights_templ.go | 6 +- .../components/home/sections/lowlights.templ | 0 .../home/sections/lowlights_templ.go | 0 .../components/home/sections/mission.templ | 0 .../components/home/sections/mission_templ.go | 0 .../nebula}/components/home/static.go | 2 +- .../nebula}/components/index/build.go | 0 .../nebula}/components/index/index.templ | 8 +- .../nebula}/components/index/index_templ.go | 8 +- {nebula => pkg/nebula}/deps.mjs | 0 .../nebula}/global/state/credentials.templ | 0 .../nebula}/global/state/credentials_templ.go | 0 .../nebula}/global/state/database.templ | 0 .../nebula}/global/state/database_templ.go | 0 pkg/nebula/global/state/state.go | 1 + .../nebula}/global/state/worker.templ | 0 .../nebula}/global/state/worker_templ.go | 0 .../nebula}/global/styles/globals.css | 0 .../nebula}/global/styles/layout.templ | 0 .../nebula}/global/styles/layout_templ.go | 8 +- .../nebula}/global/styles/scripts.templ | 0 .../nebula}/global/styles/scripts_templ.go | 8 +- .../nebula}/global/styles/sizes.templ | 0 .../nebula}/global/styles/sizes_templ.go | 0 .../nebula}/global/styles/typography.templ | 0 .../nebula}/global/styles/typography_templ.go | 16 +- {nebula => pkg/nebula}/global/ui/badge.templ | 0 .../nebula}/global/ui/badge_templ.go | 0 {nebula => pkg/nebula}/global/ui/button.templ | 2 +- .../nebula}/global/ui/button_templ.go | 26 +-- {nebula => pkg/nebula}/global/ui/card.templ | 2 +- .../nebula}/global/ui/card_templ.go | 4 +- {nebula => pkg/nebula}/global/ui/icons.templ | 0 .../nebula}/global/ui/icons_templ.go | 0 {nebula => pkg/nebula}/global/ui/panel.templ | 0 .../nebula}/global/ui/panel_templ.go | 4 +- {nebula => pkg/nebula}/package.json | 0 {nebula => pkg/nebula}/tailwind.config.js | 0 {workers => pkg/workers}/handlers/auth.go | 63 +++---- {workers => pkg/workers}/handlers/openid.go | 0 {workers => pkg/workers}/handlers/sync.go | 0 .../client.go => pkg/workers/routes/dwn.go | 6 +- .../proxy.go => pkg/workers/routes/gateway.go | 4 +- x/did/types/identifier.go | 1 - x/did/types/pubkey.go | 64 +++++++ x/did/types/signer.go | 30 ++++ x/service/depinject.go | 4 +- x/service/keeper/keeper.go | 3 + x/service/keeper/keeper_test.go | 4 +- x/vault/depinject.go | 4 +- x/vault/keeper/keeper.go | 20 ++- x/vault/keeper/keeper_test.go | 4 +- 121 files changed, 869 insertions(+), 589 deletions(-) create mode 100644 .github/DISCUSSION_TEMPLATE/milestone.yml delete mode 100644 .github/ISSUE_TEMPLATE/okr.yml delete mode 100644 .github/workflows/deploy-hway.yml rename internal/ctx/{macaroon.go => authorize.go} (100%) delete mode 100644 internal/ctx/cookies.go create mode 100644 internal/ctx/state.go create mode 100644 internal/ctx/store.go rename {cmd/motr/fetch => internal/dwn}/serve.go (99%) rename internal/orm/{models/marketing.go => marketing/models.go} (99%) create mode 100644 internal/orm/webauthn.go delete mode 100644 nebula/components/auth/modal.templ delete mode 100644 nebula/components/auth/modal_templ.go delete mode 100644 nebula/components/dash/page.templ delete mode 100644 nebula/components/dash/page_templ.go delete mode 100644 nebula/components/dash/route.go delete mode 100644 nebula/components/pay/route.go rename {nebula => pkg/nebula}/README.md (83%) rename {nebula => pkg/nebula}/assets/css/styles.css (100%) rename {nebula => pkg/nebula}/assets/fonts/ZTBrosOskon90s-BoldSemExp.woff (100%) rename {nebula => pkg/nebula}/assets/fonts/ZTBrosOskon90s-BoldSemExp.woff2 (100%) rename {nebula => pkg/nebula}/assets/fonts/ZTBrosOskon90s-BoldSemExpIta.woff (100%) rename {nebula => pkg/nebula}/assets/fonts/ZTBrosOskon90s-BoldSemExpIta.woff2 (100%) rename {nebula => pkg/nebula}/assets/js/alpine.min.js (100%) rename {nebula => pkg/nebula}/assets/js/dexie.min.js (100%) rename {nebula => pkg/nebula}/assets/js/htmx.min.js (100%) rename {nebula => pkg/nebula}/assets/js/sw.js (100%) rename {nebula => pkg/nebula}/bun.lockb (100%) rename {nebula => pkg/nebula}/components/auth/forms/consent_privacy.templ (100%) rename {nebula => pkg/nebula}/components/auth/forms/consent_privacy_templ.go (100%) rename {nebula => pkg/nebula}/components/auth/forms/credential_assert.templ (100%) rename {nebula => pkg/nebula}/components/auth/forms/credential_assert_templ.go (100%) rename {nebula => pkg/nebula}/components/auth/forms/credential_register.templ (100%) rename {nebula => pkg/nebula}/components/auth/forms/credential_register_templ.go (100%) rename {nebula => pkg/nebula}/components/auth/forms/details_basic.templ (100%) rename {nebula => pkg/nebula}/components/auth/forms/details_basic_templ.go (100%) create mode 100644 pkg/nebula/components/auth/modal.templ create mode 100644 pkg/nebula/components/auth/modal_templ.go rename {nebula => pkg/nebula}/components/auth/route.go (63%) rename {nebula => pkg/nebula}/components/auth/sections/authorize.templ (83%) rename {nebula => pkg/nebula}/components/auth/sections/authorize_templ.go (94%) rename {nebula => pkg/nebula}/components/auth/sections/login.templ (83%) rename {nebula => pkg/nebula}/components/auth/sections/login_templ.go (94%) rename {nebula => pkg/nebula}/components/auth/sections/register.templ (83%) rename {nebula => pkg/nebula}/components/auth/sections/register_templ.go (94%) rename {nebula => pkg/nebula}/components/home/page.templ (71%) rename {nebula => pkg/nebula}/components/home/page_templ.go (97%) rename {nebula => pkg/nebula}/components/home/route.go (75%) rename {nebula => pkg/nebula}/components/home/sections/architecture.templ (100%) rename {nebula => pkg/nebula}/components/home/sections/architecture_templ.go (100%) rename {nebula => pkg/nebula}/components/home/sections/cta.templ (100%) rename {nebula => pkg/nebula}/components/home/sections/cta_templ.go (100%) rename {nebula => pkg/nebula}/components/home/sections/footer.templ (100%) rename {nebula => pkg/nebula}/components/home/sections/footer_templ.go (100%) rename {nebula => pkg/nebula}/components/home/sections/header.templ (100%) rename {nebula => pkg/nebula}/components/home/sections/header_templ.go (100%) rename {nebula => pkg/nebula}/components/home/sections/hero.templ (96%) rename {nebula => pkg/nebula}/components/home/sections/hero_templ.go (90%) rename {nebula => pkg/nebula}/components/home/sections/highlights.templ (99%) rename {nebula => pkg/nebula}/components/home/sections/highlights_templ.go (96%) rename {nebula => pkg/nebula}/components/home/sections/lowlights.templ (100%) rename {nebula => pkg/nebula}/components/home/sections/lowlights_templ.go (100%) rename {nebula => pkg/nebula}/components/home/sections/mission.templ (100%) rename {nebula => pkg/nebula}/components/home/sections/mission_templ.go (100%) rename {nebula => pkg/nebula}/components/home/static.go (98%) rename {nebula => pkg/nebula}/components/index/build.go (100%) rename {nebula => pkg/nebula}/components/index/index.templ (77%) rename {nebula => pkg/nebula}/components/index/index_templ.go (93%) rename {nebula => pkg/nebula}/deps.mjs (100%) rename {nebula => pkg/nebula}/global/state/credentials.templ (100%) rename {nebula => pkg/nebula}/global/state/credentials_templ.go (100%) rename {nebula => pkg/nebula}/global/state/database.templ (100%) rename {nebula => pkg/nebula}/global/state/database_templ.go (100%) create mode 100644 pkg/nebula/global/state/state.go rename {nebula => pkg/nebula}/global/state/worker.templ (100%) rename {nebula => pkg/nebula}/global/state/worker_templ.go (100%) rename {nebula => pkg/nebula}/global/styles/globals.css (100%) rename {nebula => pkg/nebula}/global/styles/layout.templ (100%) rename {nebula => pkg/nebula}/global/styles/layout_templ.go (96%) rename {nebula => pkg/nebula}/global/styles/scripts.templ (100%) rename {nebula => pkg/nebula}/global/styles/scripts_templ.go (94%) rename {nebula => pkg/nebula}/global/styles/sizes.templ (100%) rename {nebula => pkg/nebula}/global/styles/sizes_templ.go (100%) rename {nebula => pkg/nebula}/global/styles/typography.templ (100%) rename {nebula => pkg/nebula}/global/styles/typography_templ.go (92%) rename {nebula => pkg/nebula}/global/ui/badge.templ (100%) rename {nebula => pkg/nebula}/global/ui/badge_templ.go (100%) rename {nebula => pkg/nebula}/global/ui/button.templ (99%) rename {nebula => pkg/nebula}/global/ui/button_templ.go (93%) rename {nebula => pkg/nebula}/global/ui/card.templ (97%) rename {nebula => pkg/nebula}/global/ui/card_templ.go (97%) rename {nebula => pkg/nebula}/global/ui/icons.templ (100%) rename {nebula => pkg/nebula}/global/ui/icons_templ.go (100%) rename {nebula => pkg/nebula}/global/ui/panel.templ (100%) rename {nebula => pkg/nebula}/global/ui/panel_templ.go (97%) rename {nebula => pkg/nebula}/package.json (100%) rename {nebula => pkg/nebula}/tailwind.config.js (100%) rename {workers => pkg/workers}/handlers/auth.go (58%) rename {workers => pkg/workers}/handlers/openid.go (100%) rename {workers => pkg/workers}/handlers/sync.go (100%) rename workers/routes/client.go => pkg/workers/routes/dwn.go (83%) rename workers/routes/proxy.go => pkg/workers/routes/gateway.go (69%) delete mode 100644 x/did/types/identifier.go create mode 100644 x/did/types/signer.go diff --git a/.github/DISCUSSION_TEMPLATE/milestone.yml b/.github/DISCUSSION_TEMPLATE/milestone.yml new file mode 100644 index 000000000..f82d88681 --- /dev/null +++ b/.github/DISCUSSION_TEMPLATE/milestone.yml @@ -0,0 +1,30 @@ +title: "[Milestone] " +labels: ["#OKR", "#PLANNING"] +body: + - type: input + id: has-version + attributes: + label: Version + description: A tag for the associated milestone. + placeholder: v0.6.0 + validations: + required: true + - type: textarea + attributes: + label: Objective + description: Explain the objective of the OKR in less than 100 characters. + placeholder: Ethereum IBC integration with Sonr. + render: markdown + validations: + required: true + - type: textarea + attributes: + label: Task List + description: | + Break down the objective into a list of tasks to be completed. + value: | + - [ ] # + - [ ] # + - [ ] # + validations: + required: true diff --git a/.github/ISSUE_TEMPLATE/okr.yml b/.github/ISSUE_TEMPLATE/okr.yml deleted file mode 100644 index c4ae72731..000000000 --- a/.github/ISSUE_TEMPLATE/okr.yml +++ /dev/null @@ -1,30 +0,0 @@ -name: Tracking issue -description: Use this template for tracking new features. -title: "(v0.6): FEATURE NAME" -labels: ["#TRACK", "#OKR"] -assignees: ["prnk28"] -projects: ["onsonr/37"] -body: - - type: checkboxes - attributes: - label: Is this associated with a milestone? - description: This is a tracking issue for tracking a new feature for a given milestone. - options: - - label: I have confirmed this is an OKR tracking issue - required: true - - type: textarea - attributes: - label: Objective - description: Explain the objective of the feature and add any relevant links. - render: markdown - validations: - required: false - - type: textarea - attributes: - label: Task List - description: | - Break down the objective into a list of tasks to be completed. - value: | - - [ ] - validations: - required: false diff --git a/.github/pr-labeler.yml b/.github/pr-labeler.yml index ca8451089..81299a2cd 100644 --- a/.github/pr-labeler.yml +++ b/.github/pr-labeler.yml @@ -1,3 +1,5 @@ -feature: ["feature/*", "feat/*"] -fix: fix/* -chore :hammer:: chore/* +"@pr/feature": ["feature/*", "feat/*"] +"@pr/fix": fix/* +"@pr/chore": chore/* +"@pr/docs": docs/* +"@pr/refactor": refactor/* diff --git a/.github/workflows/deploy-hway.yml b/.github/workflows/deploy-hway.yml deleted file mode 100644 index 05c09a6b4..000000000 --- a/.github/workflows/deploy-hway.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: Deploy Hway (sonr.id) - -on: - push: - branches: - - develop - -jobs: - deploy: - runs-on: ubuntu-latest - name: Deploy Sonr.ID on Cloudflare - steps: - - uses: actions/checkout@v4 - - name: Install devbox - uses: jetify-com/devbox-install-action@v0.11.0 - - name: Deploy - uses: cloudflare/wrangler-action@v3 - with: - apiToken: ${{ secrets.CF_WORKERS_TOKEN }} - workingDirectory: web diff --git a/.gitignore b/.gitignore index 35625dd53..1bf639ce3 100644 --- a/.gitignore +++ b/.gitignore @@ -75,6 +75,7 @@ nebula/node_modules mprocs.yaml build +sonr.wiki !devbox.lock !buf.lock diff --git a/Makefile b/Makefile index d07419580..89a8bc5ae 100644 --- a/Makefile +++ b/Makefile @@ -113,6 +113,7 @@ draw-deps: @goviz -i ./cmd/sonrd -d 2 | dot -Tpng -o dependency-graph.png clean: + rm -rf pkg/nebula/node_modules rm -rf snapcraft-local.yaml build/ distclean: clean @@ -315,10 +316,9 @@ pkl-gen: nebula-build: @echo "(ui) Building nebula" - cd nebula && bun install && bun run build - rm -rf ./nebula/node_modules + cd pkg/nebula && bun install && bun run build -motr-build: templ-gen pkl-gen +motr-build: nebula-build templ-gen pkl-gen @echo "(dwn) Building motr.wasm -> Service Worker IPFS Vault" GOOS=js GOARCH=wasm go build -o ./pkg/dwn/app.wasm ./cmd/motr/main.go diff --git a/app/app.go b/app/app.go index 1475a55f4..f8090e7e7 100644 --- a/app/app.go +++ b/app/app.go @@ -632,15 +632,6 @@ func NewChainApp( app.StakingKeeper, ) - // Create the vault Keeper - app.VaultKeeper = vaultkeeper.NewKeeper( - appCodec, - sdkruntime.NewKVStoreService(keys[vaulttypes.StoreKey]), - logger, - authtypes.NewModuleAddress(govtypes.ModuleName).String(), - app.AccountKeeper, - app.DidKeeper, - ) // Create the macaroon Keeper app.MacaroonKeeper = macaroonkeeper.NewKeeper( appCodec, @@ -651,6 +642,17 @@ func NewChainApp( app.DidKeeper, ) + // Create the vault Keeper + app.VaultKeeper = vaultkeeper.NewKeeper( + appCodec, + sdkruntime.NewKVStoreService(keys[vaulttypes.StoreKey]), + logger, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + app.AccountKeeper, + app.DidKeeper, + app.MacaroonKeeper, + ) + // Create the service Keeper app.ServiceKeeper = servicekeeper.NewKeeper( appCodec, @@ -661,6 +663,7 @@ func NewChainApp( app.GroupKeeper, app.MacaroonKeeper, app.NFTKeeper, + app.VaultKeeper, ) // Create the globalfee keeper diff --git a/cmd/hway/main.go b/cmd/hway/main.go index b35e69a3f..7cbd747ae 100644 --- a/cmd/hway/main.go +++ b/cmd/hway/main.go @@ -5,13 +5,13 @@ package main import ( "github.com/labstack/echo/v4" "github.com/onsonr/sonr/internal/ctx" - "github.com/onsonr/sonr/workers/routes" + "github.com/onsonr/sonr/pkg/workers/routes" "github.com/syumai/workers" ) func main() { s := echo.New() - s.Use(ctx.UseSession) + s.Use(ctx.SessionMiddleware) routes.RegisterProxyViews(s) routes.RegisterProxyAPI(s) workers.Serve(s) diff --git a/cmd/motr/main.go b/cmd/motr/main.go index b90903a63..2454db36a 100644 --- a/cmd/motr/main.go +++ b/cmd/motr/main.go @@ -4,16 +4,43 @@ package main import ( + "encoding/json" + "os" + "github.com/labstack/echo/v4" - "github.com/onsonr/sonr/cmd/motr/fetch" "github.com/onsonr/sonr/internal/ctx" - "github.com/onsonr/sonr/workers/routes" + "github.com/onsonr/sonr/internal/dwn" + dwngen "github.com/onsonr/sonr/internal/dwn/gen" + "github.com/onsonr/sonr/pkg/workers/routes" ) +var config *dwngen.Config + func main() { + // Load dwn config + if err := loadDwnConfig(); err != nil { + panic(err) + } + + // Setup HTTP server e := echo.New() - e.Use(ctx.UseSession) - routes.RegisterClientViews(e) + e.Use(ctx.SessionMiddleware) routes.RegisterClientAPI(e) - fetch.Serve(e) + routes.RegisterClientViews(e) + dwn.Serve(e) +} + +func loadDwnConfig() error { + // Read dwn.json config + dwnBz, err := os.ReadFile("dwn.json") + if err != nil { + return err + } + dwnConfig := &dwngen.Config{} + err = json.Unmarshal(dwnBz, dwnConfig) + if err != nil { + return err + } + config = dwnConfig + return nil } diff --git a/devbox.lock b/devbox.lock index 886cce0f1..19ddfab17 100644 --- a/devbox.lock +++ b/devbox.lock @@ -49,54 +49,6 @@ } } }, - "cloudflared@latest": { - "last_modified": "2024-09-10T15:01:03Z", - "resolved": "github:NixOS/nixpkgs/5ed627539ac84809c78b2dd6d26a5cebeb5ae269#cloudflared", - "source": "devbox-search", - "version": "2024.8.3", - "systems": { - "aarch64-darwin": { - "outputs": [ - { - "name": "out", - "path": "/nix/store/nmmh1dx4rvqayxq31c99gxpbwvcchx9w-cloudflared-2024.8.3", - "default": true - } - ], - "store_path": "/nix/store/nmmh1dx4rvqayxq31c99gxpbwvcchx9w-cloudflared-2024.8.3" - }, - "aarch64-linux": { - "outputs": [ - { - "name": "out", - "path": "/nix/store/kwikn13v0rddmr8kjhnj67li8aq8qwa6-cloudflared-2024.8.3", - "default": true - } - ], - "store_path": "/nix/store/kwikn13v0rddmr8kjhnj67li8aq8qwa6-cloudflared-2024.8.3" - }, - "x86_64-darwin": { - "outputs": [ - { - "name": "out", - "path": "/nix/store/9630bavr6jb44g0pcwwqn0zpgin39dc7-cloudflared-2024.8.3", - "default": true - } - ], - "store_path": "/nix/store/9630bavr6jb44g0pcwwqn0zpgin39dc7-cloudflared-2024.8.3" - }, - "x86_64-linux": { - "outputs": [ - { - "name": "out", - "path": "/nix/store/hybva7brncispiqm6f0qrpn897r3y3ja-cloudflared-2024.8.3", - "default": true - } - ], - "store_path": "/nix/store/hybva7brncispiqm6f0qrpn897r3y3ja-cloudflared-2024.8.3" - } - } - }, "go@1.22": { "last_modified": "2024-09-12T11:58:09Z", "resolved": "github:NixOS/nixpkgs/280db3decab4cbeb22a4599bd472229ab74d25e1#go", @@ -151,54 +103,6 @@ "source": "devbox-search", "version": "0.17.0" }, - "skate@latest": { - "last_modified": "2024-09-10T15:01:03Z", - "resolved": "github:NixOS/nixpkgs/5ed627539ac84809c78b2dd6d26a5cebeb5ae269#skate", - "source": "devbox-search", - "version": "1.0.0", - "systems": { - "aarch64-darwin": { - "outputs": [ - { - "name": "out", - "path": "/nix/store/5hn4s18zy08inhimckf3794zszxjn077-skate-1.0.0", - "default": true - } - ], - "store_path": "/nix/store/5hn4s18zy08inhimckf3794zszxjn077-skate-1.0.0" - }, - "aarch64-linux": { - "outputs": [ - { - "name": "out", - "path": "/nix/store/jxwx4fn5qbaz2nan3gmpydqx6vv8ldp1-skate-1.0.0", - "default": true - } - ], - "store_path": "/nix/store/jxwx4fn5qbaz2nan3gmpydqx6vv8ldp1-skate-1.0.0" - }, - "x86_64-darwin": { - "outputs": [ - { - "name": "out", - "path": "/nix/store/zs6ik66kpz9q8mdmzxqmgjv51y39r76h-skate-1.0.0", - "default": true - } - ], - "store_path": "/nix/store/zs6ik66kpz9q8mdmzxqmgjv51y39r76h-skate-1.0.0" - }, - "x86_64-linux": { - "outputs": [ - { - "name": "out", - "path": "/nix/store/6zbyhj72wh0645lj6b9c392aqqg11a84-skate-1.0.0", - "default": true - } - ], - "store_path": "/nix/store/6zbyhj72wh0645lj6b9c392aqqg11a84-skate-1.0.0" - } - } - }, "templ@latest": { "last_modified": "2024-09-10T15:01:03Z", "resolved": "github:NixOS/nixpkgs/5ed627539ac84809c78b2dd6d26a5cebeb5ae269#templ", diff --git a/go.mod b/go.mod index 38e515140..c7d53f314 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,8 @@ module github.com/onsonr/sonr -go 1.22.5 +go 1.23 + +toolchain go1.23.1 // overrides replace ( @@ -44,7 +46,7 @@ require ( cosmossdk.io/x/evidence v0.1.0 cosmossdk.io/x/feegrant v0.1.0 cosmossdk.io/x/nft v0.1.0 - cosmossdk.io/x/tx v0.13.3 + cosmossdk.io/x/tx v0.13.5 cosmossdk.io/x/upgrade v0.1.1 github.com/a-h/templ v0.2.778 github.com/apple/pkl-go v0.8.0 @@ -56,15 +58,15 @@ require ( github.com/cosmos/cosmos-db v1.0.2 github.com/cosmos/cosmos-proto v1.0.0-beta.5 github.com/cosmos/cosmos-sdk v0.50.5 - github.com/cosmos/gogoproto v1.4.12 + github.com/cosmos/gogoproto v1.7.0 github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v8 v8.0.2-0.20240228211029-91e486ec4dbb github.com/cosmos/ibc-go/modules/capability v1.0.0 github.com/cosmos/ibc-go/v8 v8.2.0 - github.com/donseba/go-htmx v1.10.0 github.com/ethereum/go-ethereum v1.14.6 github.com/go-webauthn/webauthn v0.10.2 github.com/golang/protobuf v1.5.4 github.com/gorilla/mux v1.8.1 + github.com/gorilla/sessions v1.4.0 github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/ipfs/boxo v0.21.0 github.com/ipfs/kubo v0.29.0 @@ -181,6 +183,7 @@ require ( github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect github.com/googleapis/gax-go/v2 v2.12.2 // indirect github.com/gorilla/handlers v1.5.2 // indirect + github.com/gorilla/securecookie v1.1.2 // indirect github.com/gorilla/websocket v1.5.3 // indirect github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect diff --git a/go.sum b/go.sum index 29da40697..0093bc405 100644 --- a/go.sum +++ b/go.sum @@ -794,8 +794,8 @@ cosmossdk.io/x/feegrant v0.1.0 h1:c7s3oAq/8/UO0EiN1H5BIjwVntujVTkYs35YPvvrdQk= cosmossdk.io/x/feegrant v0.1.0/go.mod h1:4r+FsViJRpcZif/yhTn+E0E6OFfg4n0Lx+6cCtnZElU= cosmossdk.io/x/nft v0.1.0 h1:VhcsFiEK33ODN27kxKLa0r/CeFd8laBfbDBwYqCyYCM= cosmossdk.io/x/nft v0.1.0/go.mod h1:ec4j4QAO4mJZ+45jeYRnW7awLHby1JZANqe1hNZ4S3g= -cosmossdk.io/x/tx v0.13.3 h1:Ha4mNaHmxBc6RMun9aKuqul8yHiL78EKJQ8g23Zf73g= -cosmossdk.io/x/tx v0.13.3/go.mod h1:I8xaHv0rhUdIvIdptKIqzYy27+n2+zBVaxO6fscFhys= +cosmossdk.io/x/tx v0.13.5 h1:FdnU+MdmFWn1pTsbfU0OCf2u6mJ8cqc1H4OMG418MLw= +cosmossdk.io/x/tx v0.13.5/go.mod h1:V6DImnwJMTq5qFjeGWpXNiT/fjgE4HtmclRmTqRVM3w= cosmossdk.io/x/upgrade v0.1.1 h1:aoPe2gNvH+Gwt/Pgq3dOxxQVU3j5P6Xf+DaUJTDZATc= cosmossdk.io/x/upgrade v0.1.1/go.mod h1:MNLptLPcIFK9CWt7Ra//8WUZAxweyRDNcbs5nkOcQy0= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= @@ -1024,8 +1024,8 @@ github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4x github.com/cosmos/gogogateway v1.2.0 h1:Ae/OivNhp8DqBi/sh2A8a1D0y638GpL3tkmLQAiKxTE= github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ4GUkT+tbFI= github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU= -github.com/cosmos/gogoproto v1.4.12 h1:vB6Lbe/rtnYGjQuFxkPiPYiCybqFT8QvLipDZP8JpFE= -github.com/cosmos/gogoproto v1.4.12/go.mod h1:LnZob1bXRdUoqMMtwYlcR3wjiElmlC+FkjaZRv1/eLY= +github.com/cosmos/gogoproto v1.7.0 h1:79USr0oyXAbxg3rspGh/m4SWNyoz/GLaAh0QlCe2fro= +github.com/cosmos/gogoproto v1.7.0/go.mod h1:yWChEv5IUEYURQasfyBW5ffkMHR/90hiHgbNgrtp4j0= github.com/cosmos/iavl v1.1.2 h1:zL9FK7C4L/P4IF1Dm5fIwz0WXCnn7Bp1M2FxH0ayM7Y= github.com/cosmos/iavl v1.1.2/go.mod h1:jLeUvm6bGT1YutCaL2fIar/8vGUE8cPZvh/gXEWDaDM= github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v8 v8.0.2-0.20240228211029-91e486ec4dbb h1:jcSPWsQTcbpQcFKmZppgD37GIXAzvFmYRH4E6kxPBFQ= @@ -1091,8 +1091,6 @@ github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5Xh github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE= -github.com/donseba/go-htmx v1.10.0 h1:ByeQd8frMPSX38vkjvsprSQ7+xTkHMDrkzBV0ljfYvA= -github.com/donseba/go-htmx v1.10.0/go.mod h1:8PTAYvNKf8+QYis+DpAsggKz+sa2qljtMgvdAeNBh5s= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= @@ -1377,6 +1375,10 @@ github.com/gorilla/handlers v1.5.2 h1:cLTUSsNkgcwhgRqvCNmdbRWG0A3N4F+M2nWKdScwyE github.com/gorilla/handlers v1.5.2/go.mod h1:dX+xVpaxdSw+q0Qek8SSsl3dfMk3jNddUkMzo0GtH0w= github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY= github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ= +github.com/gorilla/securecookie v1.1.2 h1:YCIWL56dvtr73r6715mJs5ZvhtnY73hBvEF8kXD8ePA= +github.com/gorilla/securecookie v1.1.2/go.mod h1:NfCASbcHqRSY+3a8tlWJwsQap2VX5pwzwo4h3eOamfo= +github.com/gorilla/sessions v1.4.0 h1:kpIYOp/oi6MG/p5PgxApU8srsSw9tuFbt46Lt7auzqQ= +github.com/gorilla/sessions v1.4.0/go.mod h1:FLWm50oby91+hl7p/wRxDth9bWSuk0qVL2emc7lT5ik= github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg= diff --git a/internal/ctx/macaroon.go b/internal/ctx/authorize.go similarity index 100% rename from internal/ctx/macaroon.go rename to internal/ctx/authorize.go diff --git a/internal/ctx/cookies.go b/internal/ctx/cookies.go deleted file mode 100644 index b747f657c..000000000 --- a/internal/ctx/cookies.go +++ /dev/null @@ -1,41 +0,0 @@ -package ctx - -import ( - "net/http" - "time" - - "github.com/donseba/go-htmx" - "github.com/labstack/echo/v4" -) - -type Session struct { - echo.Context - htmx *htmx.HTMX -} - -func (c *Session) Htmx() *htmx.HTMX { - return c.htmx -} - -func (c *Session) ID() string { - return ReadCookie(c, "session") -} - -func ReadCookie(c echo.Context, key string) string { - cookie, err := c.Cookie(key) - if err != nil { - return "" - } - if cookie == nil { - return "" - } - return cookie.Value -} - -func WriteCookie(c echo.Context, key string, value string) { - cookie := new(http.Cookie) - cookie.Name = key - cookie.Value = value - cookie.Expires = time.Now().Add(24 * time.Hour) - c.SetCookie(cookie) -} diff --git a/internal/ctx/session.go b/internal/ctx/session.go index 069cb1d97..1117a8400 100644 --- a/internal/ctx/session.go +++ b/internal/ctx/session.go @@ -1,33 +1,80 @@ package ctx import ( + "context" + "errors" + "net/http" + "time" + + "github.com/gorilla/sessions" "github.com/labstack/echo/v4" "github.com/segmentio/ksuid" ) -// GetSession returns the current Session -func GetSession(c echo.Context) *Session { - return c.(*Session) -} +var store sessions.Store -// UseSession establishes a Session Cookie. -func UseSession(next echo.HandlerFunc) echo.HandlerFunc { +type ctxKeySessionID struct{} + +// SessionMiddleware establishes a Session Cookie. +func SessionMiddleware(next echo.HandlerFunc) echo.HandlerFunc { + store = sessions.NewCookieStore([]byte("SESSION_KEY")) return func(c echo.Context) error { - sc := initSession(c) - headers := new(RequestHeaders) - err := sc.Bind(headers) + ctx := c.Request().Context() + + // Attempt to read the session ID from the "session" cookie + sessionID, err := readSessionIDFromCookie(c) if err != nil { - return err + // Generate a new KSUID if the session cookie is missing or invalid + sessionID = ksuid.New().String() + // Write the new session ID to the "session" cookie + err = writeSessionIDToCookie(c, sessionID) + if err != nil { + return c.JSON( + http.StatusInternalServerError, + map[string]string{"error": "Failed to set session cookie"}, + ) + } } - return next(sc) + + // Inject the session ID into the context + ctx = context.WithValue(ctx, ctxKeySessionID{}, sessionID) + // Update the request with the new context + c.SetRequest(c.Request().WithContext(ctx)) + + return next(c) } } -func initSession(c echo.Context) *Session { - s := &Session{Context: c} - if val := ReadCookie(c, "session"); val == "" { - id := ksuid.New().String() - WriteCookie(c, "session", id) +func getSessionID(ctx context.Context) (string, error) { + sessionID, ok := ctx.Value(ctxKeySessionID{}).(string) + if !ok || sessionID == "" { + return "", errors.New("session ID not found in context") } - return s + return sessionID, nil +} + +func readSessionIDFromCookie(c echo.Context) (string, error) { + cookie, err := c.Cookie("session") + if err != nil { + // Cookie not found or other error + return "", err + } + if cookie == nil || cookie.Value == "" { + // Cookie is empty + return "", http.ErrNoCookie + } + return cookie.Value, nil +} + +func writeSessionIDToCookie(c echo.Context, sessionID string) error { + cookie := &http.Cookie{ + Name: "session", + Value: sessionID, + Expires: time.Now().Add(24 * time.Hour), + HttpOnly: true, + Path: "/", + // Add Secure and SameSite attributes as needed + } + c.SetCookie(cookie) + return nil } diff --git a/internal/ctx/state.go b/internal/ctx/state.go new file mode 100644 index 000000000..a0c24662e --- /dev/null +++ b/internal/ctx/state.go @@ -0,0 +1,61 @@ +package ctx + +import "github.com/labstack/echo/v4" + +type State string + +const ( + StateAuthenticated State = "authenticated" + StateUnauthenticated State = "unauthenticated" + StatePendingCredentials State = "pending_credentials" + StatePendingAssertion State = "pending_assertion" + StateDisabled State = "disabled" + StateDisconnected State = "disconnected" +) + +func (s State) String() string { + return string(s) +} + +func StateFromString(s string) State { + switch s { + case StateAuthenticated.String(): + return StateAuthenticated + case StateUnauthenticated.String(): + return StateUnauthenticated + case StatePendingCredentials.String(): + return StatePendingCredentials + case StatePendingAssertion.String(): + return StatePendingAssertion + case StateDisabled.String(): + return StateDisabled + case StateDisconnected.String(): + return StateDisconnected + default: + return State("") + } +} + +func readSessionFromStore(c echo.Context, id string) (*session, error) { + sess, err := store.Get(c.Request(), id) + if err != nil { + return nil, err + } + return NewSessionFromValues(sess.Values), nil +} + +func writeSessionToStore( + c echo.Context, + id string, +) error { + sess, err := store.Get(c.Request(), id) + if err != nil { + return err + } + s := defaultSession(id, sess) + err = s.SaveHTTP(c) + if err != nil { + return err + } + return nil +} diff --git a/internal/ctx/store.go b/internal/ctx/store.go new file mode 100644 index 000000000..553b01908 --- /dev/null +++ b/internal/ctx/store.go @@ -0,0 +1,142 @@ +package ctx + +import ( + "fmt" + + "github.com/go-webauthn/webauthn/protocol" + "github.com/gorilla/sessions" + "github.com/labstack/echo/v4" +) + +type WebBytes = protocol.URLEncodedBase64 + +type Session interface { + ID() string + Origin() string + + Address() string + ChainID() string + + GetChallenge(subject string) (WebBytes, error) + ValidateChallenge(challenge WebBytes, subject string) error + + IsState(State) bool + SaveHTTP(c echo.Context) error +} + +func defaultSession(id string, s *sessions.Session) *session { + return &session{ + session: s, + id: id, + origin: "", + address: "", + chainID: "", + state: StateUnauthenticated, + } +} + +func NewSessionFromValues(vals map[interface{}]interface{}) *session { + s := &session{ + id: vals["id"].(string), + origin: vals["origin"].(string), + address: vals["address"].(string), + chainID: vals["chainID"].(string), + state: StateFromString(vals["state"].(string)), + challenge: vals["challenge"].(WebBytes), + subject: vals["subject"].(string), + } + return s +} + +type session struct { + // Defaults + session *sessions.Session + id string // Generated ksuid http cookie; Initialized on first request + origin string // Webauthn mapping to Relaying Party ID; Initialized on first request + + // Initialization + address string // Webauthn mapping to User ID; Supplied by DWN frontend + chainID string // Macaroon mapping to location; Supplied by DWN frontend + + // Authentication + challenge WebBytes // Webauthn mapping to Challenge; Per session based on origin + subject string // Webauthn mapping to User Displayable Name; Supplied by DWN frontend + + // State + state State +} + +func (s *session) ID() string { + return s.id +} + +func (s *session) Origin() string { + return s.origin +} + +func (s *session) Address() string { + return s.address +} + +func (s *session) ChainID() string { + return s.chainID +} + +func (s *session) GetChallenge(subject string) (WebBytes, error) { + if s.challenge == nil { + return nil, nil + } + return s.challenge, nil +} + +func (s *session) ValidateChallenge(challenge WebBytes, subject string) error { + if s.challenge == nil { + return nil + } + if s.challenge.String() != challenge.String() { + return fmt.Errorf("invalid challenge") + } + s.subject = subject + s.state = StateAuthenticated + return nil +} + +func (s *session) IsState(state State) bool { + return s.state == state +} + +func (s *session) SaveHTTP(c echo.Context) error { + sess, err := store.Get(c.Request(), s.id) + if err != nil { + return err + } + sess.Values = s.Values() + err = sess.Save(c.Request(), c.Response().Writer) + if err != nil { + return err + } + return nil +} + +func (s *session) Values() map[interface{}]interface{} { + vals := make(map[interface{}]interface{}) + vals["id"] = s.id + vals["address"] = s.address + vals["chainID"] = s.chainID + vals["state"] = s.state + vals["challenge"] = s.challenge + vals["subject"] = s.subject + return vals +} + +func GetSession(c echo.Context) Session { + id, _ := getSessionID(c.Request().Context()) + sess, _ := store.Get(c.Request(), id) + if sess.IsNew { + s := defaultSession(id, sess) + s.SaveHTTP(c) + return s + } + s, _ := readSessionFromStore(c, id) + return s +} diff --git a/internal/dwn/embed.go b/internal/dwn/embed.go index 23acfee28..aa8f5acbd 100644 --- a/internal/dwn/embed.go +++ b/internal/dwn/embed.go @@ -5,7 +5,7 @@ import ( "github.com/ipfs/boxo/files" "github.com/onsonr/sonr/internal/dwn/gen" - "github.com/onsonr/sonr/nebula/components/index" + "github.com/onsonr/sonr/pkg/nebula/components/index" ) //go:embed app.wasm diff --git a/cmd/motr/fetch/serve.go b/internal/dwn/serve.go similarity index 99% rename from cmd/motr/fetch/serve.go rename to internal/dwn/serve.go index 8e44b86ea..0de8251a2 100644 --- a/cmd/motr/fetch/serve.go +++ b/internal/dwn/serve.go @@ -1,7 +1,7 @@ //go:build js && wasm // +build js,wasm -package fetch +package dwn import ( "bytes" diff --git a/internal/orm/models/marketing.go b/internal/orm/marketing/models.go similarity index 99% rename from internal/orm/models/marketing.go rename to internal/orm/marketing/models.go index 95900129c..37739fc1c 100644 --- a/internal/orm/models/marketing.go +++ b/internal/orm/marketing/models.go @@ -1,4 +1,4 @@ -package models +package marketing type Button struct { Text string diff --git a/internal/orm/webauthn.go b/internal/orm/webauthn.go new file mode 100644 index 000000000..4927f44b5 --- /dev/null +++ b/internal/orm/webauthn.go @@ -0,0 +1,58 @@ +package orm + +import ( + "github.com/go-webauthn/webauthn/protocol" + "github.com/go-webauthn/webauthn/protocol/webauthncose" +) + +func NewCredentialCreationOptions(subject, address string) (*protocol.PublicKeyCredentialCreationOptions, error) { + chl, err := protocol.CreateChallenge() + if err != nil { + return nil, err + } + return &protocol.PublicKeyCredentialCreationOptions{ + Challenge: chl, + User: protocol.UserEntity{ + DisplayName: subject, + ID: address, + }, + Attestation: defaultAttestation(), + AuthenticatorSelection: defaultAuthenticatorSelection(), + Parameters: defaultCredentialParameters(), + }, nil +} + +func buildUserEntity(userID string) protocol.UserEntity { + return protocol.UserEntity{ + ID: userID, + } +} + +func defaultAttestation() protocol.ConveyancePreference { + return protocol.PreferDirectAttestation +} + +func defaultAuthenticatorSelection() protocol.AuthenticatorSelection { + return protocol.AuthenticatorSelection{ + AuthenticatorAttachment: "platform", + ResidentKey: protocol.ResidentKeyRequirementPreferred, + UserVerification: "preferred", + } +} + +func defaultCredentialParameters() []protocol.CredentialParameter { + return []protocol.CredentialParameter{ + { + Type: "public-key", + Algorithm: webauthncose.AlgES256, + }, + { + Type: "public-key", + Algorithm: webauthncose.AlgES256K, + }, + { + Type: "public-key", + Algorithm: webauthncose.AlgEdDSA, + }, + } +} diff --git a/nebula/components/auth/modal.templ b/nebula/components/auth/modal.templ deleted file mode 100644 index 1cb4718fe..000000000 --- a/nebula/components/auth/modal.templ +++ /dev/null @@ -1,13 +0,0 @@ -package auth - -import ( - "github.com/labstack/echo/v4" - "github.com/onsonr/sonr/nebula/components/auth/sections" - "github.com/onsonr/sonr/nebula/global/styles" -) - -templ Modal(c echo.Context) { - @styles.OpenModal("Account Registration", "Enter your account information below to create your account.") { - @sections.RegisterStart() - } -} diff --git a/nebula/components/auth/modal_templ.go b/nebula/components/auth/modal_templ.go deleted file mode 100644 index b4abfe0d0..000000000 --- a/nebula/components/auth/modal_templ.go +++ /dev/null @@ -1,64 +0,0 @@ -// Code generated by templ - DO NOT EDIT. - -// templ: version: v0.2.778 -package auth - -//lint:file-ignore SA4006 This context is only used if a nested component is present. - -import "github.com/a-h/templ" -import templruntime "github.com/a-h/templ/runtime" - -import ( - "github.com/labstack/echo/v4" - "github.com/onsonr/sonr/nebula/components/auth/sections" - "github.com/onsonr/sonr/nebula/global/styles" -) - -func Modal(c echo.Context) 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 { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var1 := templ.GetChildren(ctx) - if templ_7745c5c3_Var1 == nil { - templ_7745c5c3_Var1 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Var2 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Err = sections.RegisterStart().Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return templ_7745c5c3_Err - }) - templ_7745c5c3_Err = styles.OpenModal("Account Registration", "Enter your account information below to create your account.").Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return templ_7745c5c3_Err - }) -} - -var _ = templruntime.GeneratedTemplate diff --git a/nebula/components/dash/page.templ b/nebula/components/dash/page.templ deleted file mode 100644 index 179a0fa8f..000000000 --- a/nebula/components/dash/page.templ +++ /dev/null @@ -1,15 +0,0 @@ -package dash - -import ( - "github.com/onsonr/sonr/nebula/components/home/sections" - "github.com/onsonr/sonr/nebula/global/styles" -) - -templ View() { - @styles.LayoutNoBody("Sonr.ID", true) { - @sections.Header() - @sections.Lowlights() - @sections.CallToAction() - @sections.Footer() - } -} diff --git a/nebula/components/dash/page_templ.go b/nebula/components/dash/page_templ.go deleted file mode 100644 index 61b503086..000000000 --- a/nebula/components/dash/page_templ.go +++ /dev/null @@ -1,87 +0,0 @@ -// Code generated by templ - DO NOT EDIT. - -// templ: version: v0.2.778 -package dash - -//lint:file-ignore SA4006 This context is only used if a nested component is present. - -import "github.com/a-h/templ" -import templruntime "github.com/a-h/templ/runtime" - -import ( - "github.com/onsonr/sonr/nebula/components/home/sections" - "github.com/onsonr/sonr/nebula/global/styles" -) - -func View() 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 { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var1 := templ.GetChildren(ctx) - if templ_7745c5c3_Var1 == nil { - templ_7745c5c3_Var1 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Var2 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Err = sections.Header().Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = sections.Lowlights().Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = sections.CallToAction().Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = sections.Footer().Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return templ_7745c5c3_Err - }) - templ_7745c5c3_Err = styles.LayoutNoBody("Sonr.ID", true).Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return templ_7745c5c3_Err - }) -} - -var _ = templruntime.GeneratedTemplate diff --git a/nebula/components/dash/route.go b/nebula/components/dash/route.go deleted file mode 100644 index 2a039ff5f..000000000 --- a/nebula/components/dash/route.go +++ /dev/null @@ -1,10 +0,0 @@ -package dash - -import ( - "github.com/labstack/echo/v4" - "github.com/onsonr/sonr/internal/ctx" -) - -func Route(c echo.Context) error { - return ctx.RenderTempl(c, View()) -} diff --git a/nebula/components/pay/route.go b/nebula/components/pay/route.go deleted file mode 100644 index 9d070ab7d..000000000 --- a/nebula/components/pay/route.go +++ /dev/null @@ -1,10 +0,0 @@ -package pay - -import ( - "github.com/labstack/echo/v4" - "github.com/onsonr/sonr/internal/ctx" -) - -func Route(c echo.Context) error { - return ctx.RenderTempl(c, nil) -} diff --git a/nebula/README.md b/pkg/nebula/README.md similarity index 83% rename from nebula/README.md rename to pkg/nebula/README.md index 5d635ef7a..4ac359740 100644 --- a/nebula/README.md +++ b/pkg/nebula/README.md @@ -26,9 +26,9 @@ A Templ component library for the Sonr DWN (Decentralized Web Node) client. package main import ( - "github.com/onsonr/sonr/nebula" - "github.com/onsonr/sonr/nebula/components" - "github.com/onsonr/sonr/nebula/pages" + "github.com/onsonr/sonr/pkg/nebula" + "github.com/onsonr/sonr/pkg/nebula/components" + "github.com/onsonr/sonr/pkg/nebula/pages" ) func main() { diff --git a/nebula/assets/css/styles.css b/pkg/nebula/assets/css/styles.css similarity index 100% rename from nebula/assets/css/styles.css rename to pkg/nebula/assets/css/styles.css diff --git a/nebula/assets/fonts/ZTBrosOskon90s-BoldSemExp.woff b/pkg/nebula/assets/fonts/ZTBrosOskon90s-BoldSemExp.woff similarity index 100% rename from nebula/assets/fonts/ZTBrosOskon90s-BoldSemExp.woff rename to pkg/nebula/assets/fonts/ZTBrosOskon90s-BoldSemExp.woff diff --git a/nebula/assets/fonts/ZTBrosOskon90s-BoldSemExp.woff2 b/pkg/nebula/assets/fonts/ZTBrosOskon90s-BoldSemExp.woff2 similarity index 100% rename from nebula/assets/fonts/ZTBrosOskon90s-BoldSemExp.woff2 rename to pkg/nebula/assets/fonts/ZTBrosOskon90s-BoldSemExp.woff2 diff --git a/nebula/assets/fonts/ZTBrosOskon90s-BoldSemExpIta.woff b/pkg/nebula/assets/fonts/ZTBrosOskon90s-BoldSemExpIta.woff similarity index 100% rename from nebula/assets/fonts/ZTBrosOskon90s-BoldSemExpIta.woff rename to pkg/nebula/assets/fonts/ZTBrosOskon90s-BoldSemExpIta.woff diff --git a/nebula/assets/fonts/ZTBrosOskon90s-BoldSemExpIta.woff2 b/pkg/nebula/assets/fonts/ZTBrosOskon90s-BoldSemExpIta.woff2 similarity index 100% rename from nebula/assets/fonts/ZTBrosOskon90s-BoldSemExpIta.woff2 rename to pkg/nebula/assets/fonts/ZTBrosOskon90s-BoldSemExpIta.woff2 diff --git a/nebula/assets/js/alpine.min.js b/pkg/nebula/assets/js/alpine.min.js similarity index 100% rename from nebula/assets/js/alpine.min.js rename to pkg/nebula/assets/js/alpine.min.js diff --git a/nebula/assets/js/dexie.min.js b/pkg/nebula/assets/js/dexie.min.js similarity index 100% rename from nebula/assets/js/dexie.min.js rename to pkg/nebula/assets/js/dexie.min.js diff --git a/nebula/assets/js/htmx.min.js b/pkg/nebula/assets/js/htmx.min.js similarity index 100% rename from nebula/assets/js/htmx.min.js rename to pkg/nebula/assets/js/htmx.min.js diff --git a/nebula/assets/js/sw.js b/pkg/nebula/assets/js/sw.js similarity index 100% rename from nebula/assets/js/sw.js rename to pkg/nebula/assets/js/sw.js diff --git a/nebula/bun.lockb b/pkg/nebula/bun.lockb similarity index 100% rename from nebula/bun.lockb rename to pkg/nebula/bun.lockb diff --git a/nebula/components/auth/forms/consent_privacy.templ b/pkg/nebula/components/auth/forms/consent_privacy.templ similarity index 100% rename from nebula/components/auth/forms/consent_privacy.templ rename to pkg/nebula/components/auth/forms/consent_privacy.templ diff --git a/nebula/components/auth/forms/consent_privacy_templ.go b/pkg/nebula/components/auth/forms/consent_privacy_templ.go similarity index 100% rename from nebula/components/auth/forms/consent_privacy_templ.go rename to pkg/nebula/components/auth/forms/consent_privacy_templ.go diff --git a/nebula/components/auth/forms/credential_assert.templ b/pkg/nebula/components/auth/forms/credential_assert.templ similarity index 100% rename from nebula/components/auth/forms/credential_assert.templ rename to pkg/nebula/components/auth/forms/credential_assert.templ diff --git a/nebula/components/auth/forms/credential_assert_templ.go b/pkg/nebula/components/auth/forms/credential_assert_templ.go similarity index 100% rename from nebula/components/auth/forms/credential_assert_templ.go rename to pkg/nebula/components/auth/forms/credential_assert_templ.go diff --git a/nebula/components/auth/forms/credential_register.templ b/pkg/nebula/components/auth/forms/credential_register.templ similarity index 100% rename from nebula/components/auth/forms/credential_register.templ rename to pkg/nebula/components/auth/forms/credential_register.templ diff --git a/nebula/components/auth/forms/credential_register_templ.go b/pkg/nebula/components/auth/forms/credential_register_templ.go similarity index 100% rename from nebula/components/auth/forms/credential_register_templ.go rename to pkg/nebula/components/auth/forms/credential_register_templ.go diff --git a/nebula/components/auth/forms/details_basic.templ b/pkg/nebula/components/auth/forms/details_basic.templ similarity index 100% rename from nebula/components/auth/forms/details_basic.templ rename to pkg/nebula/components/auth/forms/details_basic.templ diff --git a/nebula/components/auth/forms/details_basic_templ.go b/pkg/nebula/components/auth/forms/details_basic_templ.go similarity index 100% rename from nebula/components/auth/forms/details_basic_templ.go rename to pkg/nebula/components/auth/forms/details_basic_templ.go diff --git a/pkg/nebula/components/auth/modal.templ b/pkg/nebula/components/auth/modal.templ new file mode 100644 index 000000000..924686bee --- /dev/null +++ b/pkg/nebula/components/auth/modal.templ @@ -0,0 +1,25 @@ +package auth + +import ( + "github.com/labstack/echo/v4" + "github.com/onsonr/sonr/pkg/nebula/components/auth/sections" + "github.com/onsonr/sonr/pkg/nebula/global/styles" +) + +templ RegisterModal(c echo.Context) { + @styles.OpenModal("Account Registration", "Enter your account information below to create your account.") { + @sections.RegisterStart() + } +} + +templ LoginModal(c echo.Context) { + @styles.OpenModal("Account Registration", "Enter your account information below to create your account.") { + @sections.RegisterStart() + } +} + +templ AuthorizeModal(c echo.Context) { + @styles.OpenModal("Account Registration", "Enter your account information below to create your account.") { + @sections.RegisterStart() + } +} diff --git a/pkg/nebula/components/auth/modal_templ.go b/pkg/nebula/components/auth/modal_templ.go new file mode 100644 index 000000000..4fa86f454 --- /dev/null +++ b/pkg/nebula/components/auth/modal_templ.go @@ -0,0 +1,158 @@ +// Code generated by templ - DO NOT EDIT. + +// templ: version: v0.2.778 +package auth + +//lint:file-ignore SA4006 This context is only used if a nested component is present. + +import "github.com/a-h/templ" +import templruntime "github.com/a-h/templ/runtime" + +import ( + "github.com/labstack/echo/v4" + "github.com/onsonr/sonr/pkg/nebula/components/auth/sections" + "github.com/onsonr/sonr/pkg/nebula/global/styles" +) + +func RegisterModal(c echo.Context) 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 { + return templ_7745c5c3_CtxErr + } + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) + if !templ_7745c5c3_IsBuffer { + defer func() { + templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) + if templ_7745c5c3_Err == nil { + templ_7745c5c3_Err = templ_7745c5c3_BufErr + } + }() + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var1 := templ.GetChildren(ctx) + if templ_7745c5c3_Var1 == nil { + templ_7745c5c3_Var1 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + templ_7745c5c3_Var2 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) + if !templ_7745c5c3_IsBuffer { + defer func() { + templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) + if templ_7745c5c3_Err == nil { + templ_7745c5c3_Err = templ_7745c5c3_BufErr + } + }() + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Err = sections.RegisterStart().Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + return templ_7745c5c3_Err + }) + templ_7745c5c3_Err = styles.OpenModal("Account Registration", "Enter your account information below to create your account.").Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + return templ_7745c5c3_Err + }) +} + +func LoginModal(c echo.Context) 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 { + return templ_7745c5c3_CtxErr + } + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) + if !templ_7745c5c3_IsBuffer { + defer func() { + templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) + if templ_7745c5c3_Err == nil { + templ_7745c5c3_Err = templ_7745c5c3_BufErr + } + }() + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var3 := templ.GetChildren(ctx) + if templ_7745c5c3_Var3 == nil { + templ_7745c5c3_Var3 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + templ_7745c5c3_Var4 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) + if !templ_7745c5c3_IsBuffer { + defer func() { + templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) + if templ_7745c5c3_Err == nil { + templ_7745c5c3_Err = templ_7745c5c3_BufErr + } + }() + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Err = sections.RegisterStart().Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + return templ_7745c5c3_Err + }) + templ_7745c5c3_Err = styles.OpenModal("Account Registration", "Enter your account information below to create your account.").Render(templ.WithChildren(ctx, templ_7745c5c3_Var4), templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + return templ_7745c5c3_Err + }) +} + +func AuthorizeModal(c echo.Context) 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 { + return templ_7745c5c3_CtxErr + } + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) + if !templ_7745c5c3_IsBuffer { + defer func() { + templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) + if templ_7745c5c3_Err == nil { + templ_7745c5c3_Err = templ_7745c5c3_BufErr + } + }() + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var5 := templ.GetChildren(ctx) + if templ_7745c5c3_Var5 == nil { + templ_7745c5c3_Var5 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + templ_7745c5c3_Var6 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) + if !templ_7745c5c3_IsBuffer { + defer func() { + templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) + if templ_7745c5c3_Err == nil { + templ_7745c5c3_Err = templ_7745c5c3_BufErr + } + }() + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Err = sections.RegisterStart().Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + return templ_7745c5c3_Err + }) + templ_7745c5c3_Err = styles.OpenModal("Account Registration", "Enter your account information below to create your account.").Render(templ.WithChildren(ctx, templ_7745c5c3_Var6), templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + return templ_7745c5c3_Err + }) +} + +var _ = templruntime.GeneratedTemplate diff --git a/nebula/components/auth/route.go b/pkg/nebula/components/auth/route.go similarity index 63% rename from nebula/components/auth/route.go rename to pkg/nebula/components/auth/route.go index 260bf49ee..73a376bc5 100644 --- a/nebula/components/auth/route.go +++ b/pkg/nebula/components/auth/route.go @@ -6,13 +6,13 @@ import ( ) func AuthorizeRoute(c echo.Context) error { - return ctx.RenderTempl(c, Modal(c)) + return ctx.RenderTempl(c, AuthorizeModal(c)) } func LoginRoute(c echo.Context) error { - return ctx.RenderTempl(c, Modal(c)) + return ctx.RenderTempl(c, LoginModal(c)) } func RegisterRoute(c echo.Context) error { - return ctx.RenderTempl(c, Modal(c)) + return ctx.RenderTempl(c, RegisterModal(c)) } diff --git a/nebula/components/auth/sections/authorize.templ b/pkg/nebula/components/auth/sections/authorize.templ similarity index 83% rename from nebula/components/auth/sections/authorize.templ rename to pkg/nebula/components/auth/sections/authorize.templ index 152e1b842..b52d47492 100644 --- a/nebula/components/auth/sections/authorize.templ +++ b/pkg/nebula/components/auth/sections/authorize.templ @@ -1,9 +1,9 @@ package sections import ( - "github.com/onsonr/sonr/nebula/components/auth/forms" - "github.com/onsonr/sonr/nebula/global/styles" - "github.com/onsonr/sonr/nebula/global/ui" + "github.com/onsonr/sonr/pkg/nebula/components/auth/forms" + "github.com/onsonr/sonr/pkg/nebula/global/styles" + "github.com/onsonr/sonr/pkg/nebula/global/ui" ) templ AuthorizeStart() { diff --git a/nebula/components/auth/sections/authorize_templ.go b/pkg/nebula/components/auth/sections/authorize_templ.go similarity index 94% rename from nebula/components/auth/sections/authorize_templ.go rename to pkg/nebula/components/auth/sections/authorize_templ.go index 83a0ca845..cfa05d036 100644 --- a/nebula/components/auth/sections/authorize_templ.go +++ b/pkg/nebula/components/auth/sections/authorize_templ.go @@ -9,9 +9,9 @@ import "github.com/a-h/templ" import templruntime "github.com/a-h/templ/runtime" import ( - "github.com/onsonr/sonr/nebula/components/auth/forms" - "github.com/onsonr/sonr/nebula/global/styles" - "github.com/onsonr/sonr/nebula/global/ui" + "github.com/onsonr/sonr/pkg/nebula/components/auth/forms" + "github.com/onsonr/sonr/pkg/nebula/global/styles" + "github.com/onsonr/sonr/pkg/nebula/global/ui" ) func AuthorizeStart() templ.Component { diff --git a/nebula/components/auth/sections/login.templ b/pkg/nebula/components/auth/sections/login.templ similarity index 83% rename from nebula/components/auth/sections/login.templ rename to pkg/nebula/components/auth/sections/login.templ index e8b596a0a..2c35ffc91 100644 --- a/nebula/components/auth/sections/login.templ +++ b/pkg/nebula/components/auth/sections/login.templ @@ -1,9 +1,9 @@ package sections import ( - "github.com/onsonr/sonr/nebula/components/auth/forms" - "github.com/onsonr/sonr/nebula/global/styles" - "github.com/onsonr/sonr/nebula/global/ui" + "github.com/onsonr/sonr/pkg/nebula/components/auth/forms" + "github.com/onsonr/sonr/pkg/nebula/global/styles" + "github.com/onsonr/sonr/pkg/nebula/global/ui" ) templ LoginStart() { diff --git a/nebula/components/auth/sections/login_templ.go b/pkg/nebula/components/auth/sections/login_templ.go similarity index 94% rename from nebula/components/auth/sections/login_templ.go rename to pkg/nebula/components/auth/sections/login_templ.go index db440a0ee..afe89f36d 100644 --- a/nebula/components/auth/sections/login_templ.go +++ b/pkg/nebula/components/auth/sections/login_templ.go @@ -9,9 +9,9 @@ import "github.com/a-h/templ" import templruntime "github.com/a-h/templ/runtime" import ( - "github.com/onsonr/sonr/nebula/components/auth/forms" - "github.com/onsonr/sonr/nebula/global/styles" - "github.com/onsonr/sonr/nebula/global/ui" + "github.com/onsonr/sonr/pkg/nebula/components/auth/forms" + "github.com/onsonr/sonr/pkg/nebula/global/styles" + "github.com/onsonr/sonr/pkg/nebula/global/ui" ) func LoginStart() templ.Component { diff --git a/nebula/components/auth/sections/register.templ b/pkg/nebula/components/auth/sections/register.templ similarity index 83% rename from nebula/components/auth/sections/register.templ rename to pkg/nebula/components/auth/sections/register.templ index eccefd2e8..123dc8045 100644 --- a/nebula/components/auth/sections/register.templ +++ b/pkg/nebula/components/auth/sections/register.templ @@ -1,9 +1,9 @@ package sections import ( - "github.com/onsonr/sonr/nebula/components/auth/forms" - "github.com/onsonr/sonr/nebula/global/styles" - "github.com/onsonr/sonr/nebula/global/ui" + "github.com/onsonr/sonr/pkg/nebula/components/auth/forms" + "github.com/onsonr/sonr/pkg/nebula/global/styles" + "github.com/onsonr/sonr/pkg/nebula/global/ui" ) templ RegisterStart() { diff --git a/nebula/components/auth/sections/register_templ.go b/pkg/nebula/components/auth/sections/register_templ.go similarity index 94% rename from nebula/components/auth/sections/register_templ.go rename to pkg/nebula/components/auth/sections/register_templ.go index fa3458dc1..7f30081d9 100644 --- a/nebula/components/auth/sections/register_templ.go +++ b/pkg/nebula/components/auth/sections/register_templ.go @@ -9,9 +9,9 @@ import "github.com/a-h/templ" import templruntime "github.com/a-h/templ/runtime" import ( - "github.com/onsonr/sonr/nebula/components/auth/forms" - "github.com/onsonr/sonr/nebula/global/styles" - "github.com/onsonr/sonr/nebula/global/ui" + "github.com/onsonr/sonr/pkg/nebula/components/auth/forms" + "github.com/onsonr/sonr/pkg/nebula/global/styles" + "github.com/onsonr/sonr/pkg/nebula/global/ui" ) func RegisterStart() templ.Component { diff --git a/nebula/components/home/page.templ b/pkg/nebula/components/home/page.templ similarity index 71% rename from nebula/components/home/page.templ rename to pkg/nebula/components/home/page.templ index 1f91b4a74..185f55012 100644 --- a/nebula/components/home/page.templ +++ b/pkg/nebula/components/home/page.templ @@ -1,8 +1,8 @@ package home import ( - "github.com/onsonr/sonr/nebula/components/home/sections" - "github.com/onsonr/sonr/nebula/global/styles" + "github.com/onsonr/sonr/pkg/nebula/components/home/sections" + "github.com/onsonr/sonr/pkg/nebula/global/styles" ) templ View() { diff --git a/nebula/components/home/page_templ.go b/pkg/nebula/components/home/page_templ.go similarity index 97% rename from nebula/components/home/page_templ.go rename to pkg/nebula/components/home/page_templ.go index e1df8e53e..378203192 100644 --- a/nebula/components/home/page_templ.go +++ b/pkg/nebula/components/home/page_templ.go @@ -9,8 +9,8 @@ import "github.com/a-h/templ" import templruntime "github.com/a-h/templ/runtime" import ( - "github.com/onsonr/sonr/nebula/components/home/sections" - "github.com/onsonr/sonr/nebula/global/styles" + "github.com/onsonr/sonr/pkg/nebula/components/home/sections" + "github.com/onsonr/sonr/pkg/nebula/global/styles" ) func View() templ.Component { diff --git a/nebula/components/home/route.go b/pkg/nebula/components/home/route.go similarity index 75% rename from nebula/components/home/route.go rename to pkg/nebula/components/home/route.go index bdd2c6cc4..737d37843 100644 --- a/nebula/components/home/route.go +++ b/pkg/nebula/components/home/route.go @@ -1,10 +1,15 @@ package home import ( + "log" + "github.com/labstack/echo/v4" + "github.com/onsonr/sonr/internal/ctx" ) func Route(c echo.Context) error { + s := ctx.GetSession(c) + log.Println(s.ID()) return ctx.RenderTempl(c, View()) } diff --git a/nebula/components/home/sections/architecture.templ b/pkg/nebula/components/home/sections/architecture.templ similarity index 100% rename from nebula/components/home/sections/architecture.templ rename to pkg/nebula/components/home/sections/architecture.templ diff --git a/nebula/components/home/sections/architecture_templ.go b/pkg/nebula/components/home/sections/architecture_templ.go similarity index 100% rename from nebula/components/home/sections/architecture_templ.go rename to pkg/nebula/components/home/sections/architecture_templ.go diff --git a/nebula/components/home/sections/cta.templ b/pkg/nebula/components/home/sections/cta.templ similarity index 100% rename from nebula/components/home/sections/cta.templ rename to pkg/nebula/components/home/sections/cta.templ diff --git a/nebula/components/home/sections/cta_templ.go b/pkg/nebula/components/home/sections/cta_templ.go similarity index 100% rename from nebula/components/home/sections/cta_templ.go rename to pkg/nebula/components/home/sections/cta_templ.go diff --git a/nebula/components/home/sections/footer.templ b/pkg/nebula/components/home/sections/footer.templ similarity index 100% rename from nebula/components/home/sections/footer.templ rename to pkg/nebula/components/home/sections/footer.templ diff --git a/nebula/components/home/sections/footer_templ.go b/pkg/nebula/components/home/sections/footer_templ.go similarity index 100% rename from nebula/components/home/sections/footer_templ.go rename to pkg/nebula/components/home/sections/footer_templ.go diff --git a/nebula/components/home/sections/header.templ b/pkg/nebula/components/home/sections/header.templ similarity index 100% rename from nebula/components/home/sections/header.templ rename to pkg/nebula/components/home/sections/header.templ diff --git a/nebula/components/home/sections/header_templ.go b/pkg/nebula/components/home/sections/header_templ.go similarity index 100% rename from nebula/components/home/sections/header_templ.go rename to pkg/nebula/components/home/sections/header_templ.go diff --git a/nebula/components/home/sections/hero.templ b/pkg/nebula/components/home/sections/hero.templ similarity index 96% rename from nebula/components/home/sections/hero.templ rename to pkg/nebula/components/home/sections/hero.templ index a6a8b94fd..c0dea16bc 100644 --- a/nebula/components/home/sections/hero.templ +++ b/pkg/nebula/components/home/sections/hero.templ @@ -1,8 +1,8 @@ package sections import ( - "github.com/onsonr/sonr/internal/orm/models" - "github.com/onsonr/sonr/nebula/global/ui" + models "github.com/onsonr/sonr/internal/orm/marketing" + "github.com/onsonr/sonr/pkg/nebula/global/ui" ) templ Hero(hero *models.Hero) { @@ -105,10 +105,10 @@ script counterAnimation() { } } this.animationRequestId = window.requestAnimationFrame(this.step); - }, + }, easeOut(t) { return 1 - Math.pow(1 - t, 5) - }, + }, destroy() { // Detach the handler, avoiding memory and side-effect leakage this.animationRequestId && window.cancelAnimationFrame(this.step) diff --git a/nebula/components/home/sections/hero_templ.go b/pkg/nebula/components/home/sections/hero_templ.go similarity index 90% rename from nebula/components/home/sections/hero_templ.go rename to pkg/nebula/components/home/sections/hero_templ.go index 0b37dde62..ed3a3b33f 100644 --- a/nebula/components/home/sections/hero_templ.go +++ b/pkg/nebula/components/home/sections/hero_templ.go @@ -9,8 +9,8 @@ import "github.com/a-h/templ" import templruntime "github.com/a-h/templ/runtime" import ( - "github.com/onsonr/sonr/internal/orm/models" - "github.com/onsonr/sonr/nebula/global/ui" + models "github.com/onsonr/sonr/internal/orm/marketing" + "github.com/onsonr/sonr/pkg/nebula/global/ui" ) func Hero(hero *models.Hero) templ.Component { @@ -41,7 +41,7 @@ func Hero(hero *models.Hero) templ.Component { var templ_7745c5c3_Var2 string templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(hero.TitleFirst) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/components/home/sections/hero.templ`, Line: 17, Col: 24} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/components/home/sections/hero.templ`, Line: 17, Col: 24} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2)) if templ_7745c5c3_Err != nil { @@ -54,7 +54,7 @@ func Hero(hero *models.Hero) templ.Component { var templ_7745c5c3_Var3 string templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(hero.TitleEmphasis) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/components/home/sections/hero.templ`, Line: 19, Col: 28} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/components/home/sections/hero.templ`, Line: 19, Col: 28} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) if templ_7745c5c3_Err != nil { @@ -67,7 +67,7 @@ func Hero(hero *models.Hero) templ.Component { var templ_7745c5c3_Var4 string templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(hero.TitleSecond) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/components/home/sections/hero.templ`, Line: 24, Col: 25} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/components/home/sections/hero.templ`, Line: 24, Col: 25} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4)) if templ_7745c5c3_Err != nil { @@ -80,7 +80,7 @@ func Hero(hero *models.Hero) templ.Component { var templ_7745c5c3_Var5 string templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(hero.Subtitle) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/components/home/sections/hero.templ`, Line: 27, Col: 22} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/components/home/sections/hero.templ`, Line: 27, Col: 22} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5)) if templ_7745c5c3_Err != nil { @@ -146,7 +146,7 @@ func heroImage(hero *models.Hero) templ.Component { var templ_7745c5c3_Var7 string templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(hero.Image.Src) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/components/home/sections/hero.templ`, Line: 47, Col: 23} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/components/home/sections/hero.templ`, Line: 47, Col: 23} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7)) if templ_7745c5c3_Err != nil { @@ -159,7 +159,7 @@ func heroImage(hero *models.Hero) templ.Component { var templ_7745c5c3_Var8 string templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(hero.Image.Width) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/components/home/sections/hero.templ`, Line: 48, Col: 27} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/components/home/sections/hero.templ`, Line: 48, Col: 27} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8)) if templ_7745c5c3_Err != nil { @@ -172,7 +172,7 @@ func heroImage(hero *models.Hero) templ.Component { var templ_7745c5c3_Var9 string templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(hero.Image.Height) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/components/home/sections/hero.templ`, Line: 49, Col: 29} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/components/home/sections/hero.templ`, Line: 49, Col: 29} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9)) if templ_7745c5c3_Err != nil { @@ -219,7 +219,7 @@ func stats(stats []*models.Stat) templ.Component { var templ_7745c5c3_Var11 string templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(item.Value) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/components/home/sections/hero.templ`, Line: 61, Col: 145} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/components/home/sections/hero.templ`, Line: 61, Col: 145} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11)) if templ_7745c5c3_Err != nil { @@ -232,7 +232,7 @@ func stats(stats []*models.Stat) templ.Component { var templ_7745c5c3_Var12 string templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(item.Denom) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/components/home/sections/hero.templ`, Line: 61, Col: 166} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/components/home/sections/hero.templ`, Line: 61, Col: 166} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var12)) if templ_7745c5c3_Err != nil { @@ -245,7 +245,7 @@ func stats(stats []*models.Stat) templ.Component { var templ_7745c5c3_Var13 string templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(item.Label) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/components/home/sections/hero.templ`, Line: 62, Col: 50} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/components/home/sections/hero.templ`, Line: 62, Col: 50} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13)) if templ_7745c5c3_Err != nil { @@ -274,8 +274,8 @@ func stats(stats []*models.Stat) templ.Component { func counterAnimation() templ.ComponentScript { return templ.ComponentScript{ - Name: `__templ_counterAnimation_524d`, - Function: `function __templ_counterAnimation_524d(){document.addEventListener('alpine:init', () => { + Name: `__templ_counterAnimation_cac3`, + Function: `function __templ_counterAnimation_cac3(){document.addEventListener('alpine:init', () => { Alpine.data('counter', (target = 0, duration = 3000) => ({ startTimestamp: null, step: null, @@ -312,10 +312,10 @@ func counterAnimation() templ.ComponentScript { } } this.animationRequestId = window.requestAnimationFrame(this.step); - }, + }, easeOut(t) { return 1 - Math.pow(1 - t, 5) - }, + }, destroy() { // Detach the handler, avoiding memory and side-effect leakage this.animationRequestId && window.cancelAnimationFrame(this.step) @@ -324,8 +324,8 @@ func counterAnimation() templ.ComponentScript { })) }) }`, - Call: templ.SafeScript(`__templ_counterAnimation_524d`), - CallInline: templ.SafeScriptInline(`__templ_counterAnimation_524d`), + Call: templ.SafeScript(`__templ_counterAnimation_cac3`), + CallInline: templ.SafeScriptInline(`__templ_counterAnimation_cac3`), } } diff --git a/nebula/components/home/sections/highlights.templ b/pkg/nebula/components/home/sections/highlights.templ similarity index 99% rename from nebula/components/home/sections/highlights.templ rename to pkg/nebula/components/home/sections/highlights.templ index df376f838..7a51227df 100644 --- a/nebula/components/home/sections/highlights.templ +++ b/pkg/nebula/components/home/sections/highlights.templ @@ -1,6 +1,6 @@ package sections -import "github.com/onsonr/sonr/internal/orm/models" +import models "github.com/onsonr/sonr/internal/orm/marketing" templ Highlights(highlights *models.Highlights) { diff --git a/nebula/components/home/sections/highlights_templ.go b/pkg/nebula/components/home/sections/highlights_templ.go similarity index 96% rename from nebula/components/home/sections/highlights_templ.go rename to pkg/nebula/components/home/sections/highlights_templ.go index a2d818def..e7cbe6dac 100644 --- a/nebula/components/home/sections/highlights_templ.go +++ b/pkg/nebula/components/home/sections/highlights_templ.go @@ -8,7 +8,7 @@ package sections import "github.com/a-h/templ" import templruntime "github.com/a-h/templ/runtime" -import "github.com/onsonr/sonr/internal/orm/models" +import models "github.com/onsonr/sonr/internal/orm/marketing" func Highlights(highlights *models.Highlights) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { @@ -38,7 +38,7 @@ func Highlights(highlights *models.Highlights) templ.Component { var templ_7745c5c3_Var2 string templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(highlights.Heading) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/components/home/sections/highlights.templ`, Line: 14, Col: 26} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/components/home/sections/highlights.templ`, Line: 14, Col: 26} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2)) if templ_7745c5c3_Err != nil { @@ -51,7 +51,7 @@ func Highlights(highlights *models.Highlights) templ.Component { var templ_7745c5c3_Var3 string templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(highlights.Subtitle) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/components/home/sections/highlights.templ`, Line: 17, Col: 27} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/components/home/sections/highlights.templ`, Line: 17, Col: 27} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) if templ_7745c5c3_Err != nil { diff --git a/nebula/components/home/sections/lowlights.templ b/pkg/nebula/components/home/sections/lowlights.templ similarity index 100% rename from nebula/components/home/sections/lowlights.templ rename to pkg/nebula/components/home/sections/lowlights.templ diff --git a/nebula/components/home/sections/lowlights_templ.go b/pkg/nebula/components/home/sections/lowlights_templ.go similarity index 100% rename from nebula/components/home/sections/lowlights_templ.go rename to pkg/nebula/components/home/sections/lowlights_templ.go diff --git a/nebula/components/home/sections/mission.templ b/pkg/nebula/components/home/sections/mission.templ similarity index 100% rename from nebula/components/home/sections/mission.templ rename to pkg/nebula/components/home/sections/mission.templ diff --git a/nebula/components/home/sections/mission_templ.go b/pkg/nebula/components/home/sections/mission_templ.go similarity index 100% rename from nebula/components/home/sections/mission_templ.go rename to pkg/nebula/components/home/sections/mission_templ.go diff --git a/nebula/components/home/static.go b/pkg/nebula/components/home/static.go similarity index 98% rename from nebula/components/home/static.go rename to pkg/nebula/components/home/static.go index 948860f56..8240eebc4 100644 --- a/nebula/components/home/static.go +++ b/pkg/nebula/components/home/static.go @@ -1,6 +1,6 @@ package home -import "github.com/onsonr/sonr/internal/orm/models" +import models "github.com/onsonr/sonr/internal/orm/marketing" var hero = &models.Hero{ TitleFirst: "Simplified", diff --git a/nebula/components/index/build.go b/pkg/nebula/components/index/build.go similarity index 100% rename from nebula/components/index/build.go rename to pkg/nebula/components/index/build.go diff --git a/nebula/components/index/index.templ b/pkg/nebula/components/index/index.templ similarity index 77% rename from nebula/components/index/index.templ rename to pkg/nebula/components/index/index.templ index ca1d256ee..9d85eba18 100644 --- a/nebula/components/index/index.templ +++ b/pkg/nebula/components/index/index.templ @@ -1,10 +1,14 @@ package index import ( - "github.com/onsonr/sonr/nebula/global/state" - "github.com/onsonr/sonr/nebula/global/styles" + "github.com/onsonr/sonr/internal/dwn/gen" + "github.com/onsonr/sonr/pkg/nebula/global/state" + "github.com/onsonr/sonr/pkg/nebula/global/styles" ) +func ConfigFile(dwnConfig *gen.Config) { +} + templ IndexFile() { diff --git a/nebula/components/index/index_templ.go b/pkg/nebula/components/index/index_templ.go similarity index 93% rename from nebula/components/index/index_templ.go rename to pkg/nebula/components/index/index_templ.go index a134bc196..7dc6f32d8 100644 --- a/nebula/components/index/index_templ.go +++ b/pkg/nebula/components/index/index_templ.go @@ -9,10 +9,14 @@ import "github.com/a-h/templ" import templruntime "github.com/a-h/templ/runtime" import ( - "github.com/onsonr/sonr/nebula/global/state" - "github.com/onsonr/sonr/nebula/global/styles" + "github.com/onsonr/sonr/internal/dwn/gen" + "github.com/onsonr/sonr/pkg/nebula/global/state" + "github.com/onsonr/sonr/pkg/nebula/global/styles" ) +func ConfigFile(dwnConfig *gen.Config) { +} + func IndexFile() 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 diff --git a/nebula/deps.mjs b/pkg/nebula/deps.mjs similarity index 100% rename from nebula/deps.mjs rename to pkg/nebula/deps.mjs diff --git a/nebula/global/state/credentials.templ b/pkg/nebula/global/state/credentials.templ similarity index 100% rename from nebula/global/state/credentials.templ rename to pkg/nebula/global/state/credentials.templ diff --git a/nebula/global/state/credentials_templ.go b/pkg/nebula/global/state/credentials_templ.go similarity index 100% rename from nebula/global/state/credentials_templ.go rename to pkg/nebula/global/state/credentials_templ.go diff --git a/nebula/global/state/database.templ b/pkg/nebula/global/state/database.templ similarity index 100% rename from nebula/global/state/database.templ rename to pkg/nebula/global/state/database.templ diff --git a/nebula/global/state/database_templ.go b/pkg/nebula/global/state/database_templ.go similarity index 100% rename from nebula/global/state/database_templ.go rename to pkg/nebula/global/state/database_templ.go diff --git a/pkg/nebula/global/state/state.go b/pkg/nebula/global/state/state.go new file mode 100644 index 000000000..7bf2df5b4 --- /dev/null +++ b/pkg/nebula/global/state/state.go @@ -0,0 +1 @@ +package state diff --git a/nebula/global/state/worker.templ b/pkg/nebula/global/state/worker.templ similarity index 100% rename from nebula/global/state/worker.templ rename to pkg/nebula/global/state/worker.templ diff --git a/nebula/global/state/worker_templ.go b/pkg/nebula/global/state/worker_templ.go similarity index 100% rename from nebula/global/state/worker_templ.go rename to pkg/nebula/global/state/worker_templ.go diff --git a/nebula/global/styles/globals.css b/pkg/nebula/global/styles/globals.css similarity index 100% rename from nebula/global/styles/globals.css rename to pkg/nebula/global/styles/globals.css diff --git a/nebula/global/styles/layout.templ b/pkg/nebula/global/styles/layout.templ similarity index 100% rename from nebula/global/styles/layout.templ rename to pkg/nebula/global/styles/layout.templ diff --git a/nebula/global/styles/layout_templ.go b/pkg/nebula/global/styles/layout_templ.go similarity index 96% rename from nebula/global/styles/layout_templ.go rename to pkg/nebula/global/styles/layout_templ.go index 0076fc4fe..b9d307b01 100644 --- a/nebula/global/styles/layout_templ.go +++ b/pkg/nebula/global/styles/layout_templ.go @@ -167,7 +167,7 @@ func Layout(title string, remote bool) templ.Component { var templ_7745c5c3_Var5 string templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(title) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/global/styles/layout.templ`, Line: 38, Col: 17} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/global/styles/layout.templ`, Line: 38, Col: 17} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5)) if templ_7745c5c3_Err != nil { @@ -237,7 +237,7 @@ func LayoutNoBody(title string, remote bool) templ.Component { var templ_7745c5c3_Var7 string templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(title) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/global/styles/layout.templ`, Line: 63, Col: 17} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/global/styles/layout.templ`, Line: 63, Col: 17} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7)) if templ_7745c5c3_Err != nil { @@ -287,7 +287,7 @@ func OpenModal(title, description string) templ.Component { var templ_7745c5c3_Var9 string templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(title) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/global/styles/layout.templ`, Line: 111, Col: 47} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/global/styles/layout.templ`, Line: 111, Col: 47} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9)) if templ_7745c5c3_Err != nil { @@ -300,7 +300,7 @@ func OpenModal(title, description string) templ.Component { var templ_7745c5c3_Var10 string templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(description) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/global/styles/layout.templ`, Line: 117, Col: 22} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/global/styles/layout.templ`, Line: 117, Col: 22} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10)) if templ_7745c5c3_Err != nil { diff --git a/nebula/global/styles/scripts.templ b/pkg/nebula/global/styles/scripts.templ similarity index 100% rename from nebula/global/styles/scripts.templ rename to pkg/nebula/global/styles/scripts.templ diff --git a/nebula/global/styles/scripts_templ.go b/pkg/nebula/global/styles/scripts_templ.go similarity index 94% rename from nebula/global/styles/scripts_templ.go rename to pkg/nebula/global/styles/scripts_templ.go index 5d5734639..474639ddb 100644 --- a/nebula/global/styles/scripts_templ.go +++ b/pkg/nebula/global/styles/scripts_templ.go @@ -76,7 +76,7 @@ func Styles() templ.Component { var templ_7745c5c3_Var3 string templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs("https://cdn.sonr.id/css/styles.css") if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/global/styles/scripts.templ`, Line: 20, Col: 50} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/global/styles/scripts.templ`, Line: 20, Col: 50} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) if templ_7745c5c3_Err != nil { @@ -118,7 +118,7 @@ func Alpine() templ.Component { var templ_7745c5c3_Var5 string templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs("https://cdn.sonr.id/js/alpine.min.js") if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/global/styles/scripts.templ`, Line: 24, Col: 53} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/global/styles/scripts.templ`, Line: 24, Col: 53} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5)) if templ_7745c5c3_Err != nil { @@ -160,7 +160,7 @@ func Dexie() templ.Component { var templ_7745c5c3_Var7 string templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs("https://cdn.sonr.id/js/dexie.min.js") if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/global/styles/scripts.templ`, Line: 28, Col: 52} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/global/styles/scripts.templ`, Line: 28, Col: 52} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7)) if templ_7745c5c3_Err != nil { @@ -202,7 +202,7 @@ func Htmx() templ.Component { var templ_7745c5c3_Var9 string templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs("https://cdn.sonr.id/js/htmx.min.js") if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/global/styles/scripts.templ`, Line: 32, Col: 51} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/global/styles/scripts.templ`, Line: 32, Col: 51} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9)) if templ_7745c5c3_Err != nil { diff --git a/nebula/global/styles/sizes.templ b/pkg/nebula/global/styles/sizes.templ similarity index 100% rename from nebula/global/styles/sizes.templ rename to pkg/nebula/global/styles/sizes.templ diff --git a/nebula/global/styles/sizes_templ.go b/pkg/nebula/global/styles/sizes_templ.go similarity index 100% rename from nebula/global/styles/sizes_templ.go rename to pkg/nebula/global/styles/sizes_templ.go diff --git a/nebula/global/styles/typography.templ b/pkg/nebula/global/styles/typography.templ similarity index 100% rename from nebula/global/styles/typography.templ rename to pkg/nebula/global/styles/typography.templ diff --git a/nebula/global/styles/typography_templ.go b/pkg/nebula/global/styles/typography_templ.go similarity index 92% rename from nebula/global/styles/typography_templ.go rename to pkg/nebula/global/styles/typography_templ.go index a35d9626e..fe140728b 100644 --- a/nebula/global/styles/typography_templ.go +++ b/pkg/nebula/global/styles/typography_templ.go @@ -54,7 +54,7 @@ func renderText(level int, text string) templ.Component { var templ_7745c5c3_Var2 string templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(text) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/global/styles/typography.templ`, Line: 23, Col: 10} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/global/styles/typography.templ`, Line: 23, Col: 10} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2)) if templ_7745c5c3_Err != nil { @@ -72,7 +72,7 @@ func renderText(level int, text string) templ.Component { var templ_7745c5c3_Var3 string templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(text) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/global/styles/typography.templ`, Line: 27, Col: 10} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/global/styles/typography.templ`, Line: 27, Col: 10} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) if templ_7745c5c3_Err != nil { @@ -90,7 +90,7 @@ func renderText(level int, text string) templ.Component { var templ_7745c5c3_Var4 string templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(text) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/global/styles/typography.templ`, Line: 31, Col: 10} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/global/styles/typography.templ`, Line: 31, Col: 10} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4)) if templ_7745c5c3_Err != nil { @@ -108,7 +108,7 @@ func renderText(level int, text string) templ.Component { var templ_7745c5c3_Var5 string templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(text) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/global/styles/typography.templ`, Line: 35, Col: 10} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/global/styles/typography.templ`, Line: 35, Col: 10} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5)) if templ_7745c5c3_Err != nil { @@ -159,7 +159,7 @@ func renderLink(attrs templ.Attributes, text string) templ.Component { var templ_7745c5c3_Var7 string templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(text) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/global/styles/typography.templ`, Line: 42, Col: 8} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/global/styles/typography.templ`, Line: 42, Col: 8} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7)) if templ_7745c5c3_Err != nil { @@ -209,7 +209,7 @@ func renderStrong(attrs templ.Attributes, text string) templ.Component { var templ_7745c5c3_Var9 string templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(text) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/global/styles/typography.templ`, Line: 48, Col: 8} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/global/styles/typography.templ`, Line: 48, Col: 8} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9)) if templ_7745c5c3_Err != nil { @@ -259,7 +259,7 @@ func renderEmphasis(attrs templ.Attributes, text string) templ.Component { var templ_7745c5c3_Var11 string templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(text) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/global/styles/typography.templ`, Line: 54, Col: 8} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/global/styles/typography.templ`, Line: 54, Col: 8} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11)) if templ_7745c5c3_Err != nil { @@ -309,7 +309,7 @@ func renderCode(attrs templ.Attributes, text string) templ.Component { var templ_7745c5c3_Var13 string templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(text) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/global/styles/typography.templ`, Line: 60, Col: 8} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/global/styles/typography.templ`, Line: 60, Col: 8} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13)) if templ_7745c5c3_Err != nil { diff --git a/nebula/global/ui/badge.templ b/pkg/nebula/global/ui/badge.templ similarity index 100% rename from nebula/global/ui/badge.templ rename to pkg/nebula/global/ui/badge.templ diff --git a/nebula/global/ui/badge_templ.go b/pkg/nebula/global/ui/badge_templ.go similarity index 100% rename from nebula/global/ui/badge_templ.go rename to pkg/nebula/global/ui/badge_templ.go diff --git a/nebula/global/ui/button.templ b/pkg/nebula/global/ui/button.templ similarity index 99% rename from nebula/global/ui/button.templ rename to pkg/nebula/global/ui/button.templ index 76fc34075..2e0f34d50 100644 --- a/nebula/global/ui/button.templ +++ b/pkg/nebula/global/ui/button.templ @@ -1,6 +1,6 @@ package ui -import "github.com/onsonr/sonr/nebula/global/styles" +import "github.com/onsonr/sonr/pkg/nebula/global/styles" templ PrimaryButton(href string, text string) {
diff --git a/nebula/global/ui/button_templ.go b/pkg/nebula/global/ui/button_templ.go similarity index 93% rename from nebula/global/ui/button_templ.go rename to pkg/nebula/global/ui/button_templ.go index 03cf22dd7..dc18247c8 100644 --- a/nebula/global/ui/button_templ.go +++ b/pkg/nebula/global/ui/button_templ.go @@ -8,7 +8,7 @@ package ui import "github.com/a-h/templ" import templruntime "github.com/a-h/templ/runtime" -import "github.com/onsonr/sonr/nebula/global/styles" +import "github.com/onsonr/sonr/pkg/nebula/global/styles" func PrimaryButton(href string, text string) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { @@ -38,7 +38,7 @@ func PrimaryButton(href string, text string) templ.Component { var templ_7745c5c3_Var2 string templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(href) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/global/ui/button.templ`, Line: 7, Col: 124} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/global/ui/button.templ`, Line: 7, Col: 124} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2)) if templ_7745c5c3_Err != nil { @@ -51,7 +51,7 @@ func PrimaryButton(href string, text string) templ.Component { var templ_7745c5c3_Var3 string templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(text) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/global/ui/button.templ`, Line: 7, Col: 133} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/global/ui/button.templ`, Line: 7, Col: 133} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) if templ_7745c5c3_Err != nil { @@ -93,7 +93,7 @@ func SecondaryButton(href string, text string) templ.Component { var templ_7745c5c3_Var5 string templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(href) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/global/ui/button.templ`, Line: 13, Col: 123} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/global/ui/button.templ`, Line: 13, Col: 123} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5)) if templ_7745c5c3_Err != nil { @@ -106,7 +106,7 @@ func SecondaryButton(href string, text string) templ.Component { var templ_7745c5c3_Var6 string templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(text) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/global/ui/button.templ`, Line: 13, Col: 132} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/global/ui/button.templ`, Line: 13, Col: 132} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6)) if templ_7745c5c3_Err != nil { @@ -269,7 +269,7 @@ func renderHxGetButton(c *button, attrs templ.Attributes) templ.Component { var templ_7745c5c3_Var9 string templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(c.hxGet) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/global/ui/button.templ`, Line: 100, Col: 25} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/global/ui/button.templ`, Line: 100, Col: 25} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9)) if templ_7745c5c3_Err != nil { @@ -282,7 +282,7 @@ func renderHxGetButton(c *button, attrs templ.Attributes) templ.Component { var templ_7745c5c3_Var10 string templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(c.hxTarget) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/global/ui/button.templ`, Line: 100, Col: 69} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/global/ui/button.templ`, Line: 100, Col: 69} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10)) if templ_7745c5c3_Err != nil { @@ -295,7 +295,7 @@ func renderHxGetButton(c *button, attrs templ.Attributes) templ.Component { var templ_7745c5c3_Var11 string templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(c.hxTrigger) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/global/ui/button.templ`, Line: 100, Col: 96} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/global/ui/button.templ`, Line: 100, Col: 96} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11)) if templ_7745c5c3_Err != nil { @@ -308,7 +308,7 @@ func renderHxGetButton(c *button, attrs templ.Attributes) templ.Component { var templ_7745c5c3_Var12 string templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(c.hxSwap) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/global/ui/button.templ`, Line: 100, Col: 117} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/global/ui/button.templ`, Line: 100, Col: 117} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var12)) if templ_7745c5c3_Err != nil { @@ -366,7 +366,7 @@ func renderHxPostButton(c *button, attrs templ.Attributes) templ.Component { var templ_7745c5c3_Var14 string templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(c.hxPost) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/global/ui/button.templ`, Line: 106, Col: 27} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/global/ui/button.templ`, Line: 106, Col: 27} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var14)) if templ_7745c5c3_Err != nil { @@ -379,7 +379,7 @@ func renderHxPostButton(c *button, attrs templ.Attributes) templ.Component { var templ_7745c5c3_Var15 string templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs(c.hxTarget) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/global/ui/button.templ`, Line: 106, Col: 52} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/global/ui/button.templ`, Line: 106, Col: 52} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var15)) if templ_7745c5c3_Err != nil { @@ -392,7 +392,7 @@ func renderHxPostButton(c *button, attrs templ.Attributes) templ.Component { var templ_7745c5c3_Var16 string templ_7745c5c3_Var16, templ_7745c5c3_Err = templ.JoinStringErrs(c.hxTrigger) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/global/ui/button.templ`, Line: 106, Col: 79} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/global/ui/button.templ`, Line: 106, Col: 79} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var16)) if templ_7745c5c3_Err != nil { @@ -405,7 +405,7 @@ func renderHxPostButton(c *button, attrs templ.Attributes) templ.Component { var templ_7745c5c3_Var17 string templ_7745c5c3_Var17, templ_7745c5c3_Err = templ.JoinStringErrs(c.hxSwap) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/global/ui/button.templ`, Line: 106, Col: 100} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/global/ui/button.templ`, Line: 106, Col: 100} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var17)) if templ_7745c5c3_Err != nil { diff --git a/nebula/global/ui/card.templ b/pkg/nebula/global/ui/card.templ similarity index 97% rename from nebula/global/ui/card.templ rename to pkg/nebula/global/ui/card.templ index 912016170..7e70704f2 100644 --- a/nebula/global/ui/card.templ +++ b/pkg/nebula/global/ui/card.templ @@ -1,6 +1,6 @@ package ui -import "github.com/onsonr/sonr/nebula/global/styles" +import "github.com/onsonr/sonr/pkg/nebula/global/styles" func Card(id string, size styles.Size) templ.Component { return renderCard(id, size.CardAttributes()) diff --git a/nebula/global/ui/card_templ.go b/pkg/nebula/global/ui/card_templ.go similarity index 97% rename from nebula/global/ui/card_templ.go rename to pkg/nebula/global/ui/card_templ.go index 90e9c406a..9d8188b80 100644 --- a/nebula/global/ui/card_templ.go +++ b/pkg/nebula/global/ui/card_templ.go @@ -8,7 +8,7 @@ package ui import "github.com/a-h/templ" import templruntime "github.com/a-h/templ/runtime" -import "github.com/onsonr/sonr/nebula/global/styles" +import "github.com/onsonr/sonr/pkg/nebula/global/styles" func Card(id string, size styles.Size) templ.Component { return renderCard(id, size.CardAttributes()) @@ -42,7 +42,7 @@ func renderCard(id string, attrs templ.Attributes) templ.Component { var templ_7745c5c3_Var2 string templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(id) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/global/ui/card.templ`, Line: 10, Col: 13} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/global/ui/card.templ`, Line: 10, Col: 13} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2)) if templ_7745c5c3_Err != nil { diff --git a/nebula/global/ui/icons.templ b/pkg/nebula/global/ui/icons.templ similarity index 100% rename from nebula/global/ui/icons.templ rename to pkg/nebula/global/ui/icons.templ diff --git a/nebula/global/ui/icons_templ.go b/pkg/nebula/global/ui/icons_templ.go similarity index 100% rename from nebula/global/ui/icons_templ.go rename to pkg/nebula/global/ui/icons_templ.go diff --git a/nebula/global/ui/panel.templ b/pkg/nebula/global/ui/panel.templ similarity index 100% rename from nebula/global/ui/panel.templ rename to pkg/nebula/global/ui/panel.templ diff --git a/nebula/global/ui/panel_templ.go b/pkg/nebula/global/ui/panel_templ.go similarity index 97% rename from nebula/global/ui/panel_templ.go rename to pkg/nebula/global/ui/panel_templ.go index f3d677983..ce84cd57b 100644 --- a/nebula/global/ui/panel_templ.go +++ b/pkg/nebula/global/ui/panel_templ.go @@ -100,7 +100,7 @@ func breadcrumbItem(title string, active bool) templ.Component { var templ_7745c5c3_Var3 string templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(title) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/global/ui/panel.templ`, Line: 26, Col: 126} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/global/ui/panel.templ`, Line: 26, Col: 126} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) if templ_7745c5c3_Err != nil { @@ -118,7 +118,7 @@ func breadcrumbItem(title string, active bool) templ.Component { var templ_7745c5c3_Var4 string templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(title) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/global/ui/panel.templ`, Line: 28, Col: 118} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/global/ui/panel.templ`, Line: 28, Col: 118} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4)) if templ_7745c5c3_Err != nil { diff --git a/nebula/package.json b/pkg/nebula/package.json similarity index 100% rename from nebula/package.json rename to pkg/nebula/package.json diff --git a/nebula/tailwind.config.js b/pkg/nebula/tailwind.config.js similarity index 100% rename from nebula/tailwind.config.js rename to pkg/nebula/tailwind.config.js diff --git a/workers/handlers/auth.go b/pkg/workers/handlers/auth.go similarity index 58% rename from workers/handlers/auth.go rename to pkg/workers/handlers/auth.go index a41117634..e12aad555 100644 --- a/workers/handlers/auth.go +++ b/pkg/workers/handlers/auth.go @@ -1,9 +1,6 @@ package handlers import ( - "encoding/json" - "fmt" - "github.com/go-webauthn/webauthn/protocol" "github.com/labstack/echo/v4" ) @@ -12,16 +9,24 @@ import ( // │ Login Handlers │ // ╰───────────────────────────────────────────────────────────╯ -func LoginSubjectStart(e echo.Context) error { - return e.JSON(200, "HandleCredentialAssertion") -} - func LoginSubjectCheck(e echo.Context) error { return e.JSON(200, "HandleCredentialAssertion") } +func LoginSubjectStart(e echo.Context) error { + opts := &protocol.PublicKeyCredentialRequestOptions{ + UserVerification: "preferred", + Challenge: []byte("challenge"), + } + return e.JSON(200, opts) +} + func LoginSubjectFinish(e echo.Context) error { - return e.JSON(200, "HandleCredentialAssertion") + var crr protocol.CredentialAssertionResponse + if err := e.Bind(&crr); err != nil { + return err + } + return e.JSON(200, crr) } // ╭───────────────────────────────────────────────────────────╮ @@ -34,39 +39,22 @@ func RegisterSubjectCheck(e echo.Context) error { } func RegisterSubjectStart(e echo.Context) error { - // Get the serialized credential data from the form - credentialDataJSON := e.FormValue("credentialData") - - // Deserialize the JSON into a temporary struct - var ccr protocol.CredentialCreationResponse - err := json.Unmarshal([]byte(credentialDataJSON), &ccr) - if err != nil { - return e.JSON(500, err.Error()) + opts := &protocol.PublicKeyCredentialCreationOptions{ + RelyingParty: protocol.RelyingPartyEntity{ + CredentialEntity: protocol.CredentialEntity{ + Name: "Sonr", + }, + ID: "https://sonr.io", + }, } - // - // // Parse the CredentialCreationResponse - // parsedData, err := ccr.Parse() - // if err != nil { - // return e.JSON(500, err.Error()) - // } - // - // // Create the Credential - // // credential := orm.NewCredential(parsedData, e.Request().Host, "") - // - // // Set additional fields - // credential.Controller = "" // Set this to the appropriate controller value - return e.JSON(200, fmt.Sprintf("REGISTER: %s", string(ccr.ID))) + return e.JSON(200, opts) } func RegisterSubjectFinish(e echo.Context) error { - // Get the serialized credential data from the form - credentialDataJSON := e.FormValue("credentialData") - // Deserialize the JSON into a temporary struct var ccr protocol.CredentialCreationResponse - err := json.Unmarshal([]byte(credentialDataJSON), &ccr) - if err != nil { - return e.JSON(500, err.Error()) + if err := e.Bind(&ccr); err != nil { + return err } // // // Parse the CredentialCreationResponse @@ -77,8 +65,5 @@ func RegisterSubjectFinish(e echo.Context) error { // // // Create the Credential // // credential := orm.NewCredential(parsedData, e.Request().Host, "") - // - // // Set additional fields - // credential.Controller = "" // Set this to the appropriate controller value - return e.JSON(200, fmt.Sprintf("REGISTER: %s", string(ccr.ID))) + return e.JSON(200, ccr) } diff --git a/workers/handlers/openid.go b/pkg/workers/handlers/openid.go similarity index 100% rename from workers/handlers/openid.go rename to pkg/workers/handlers/openid.go diff --git a/workers/handlers/sync.go b/pkg/workers/handlers/sync.go similarity index 100% rename from workers/handlers/sync.go rename to pkg/workers/handlers/sync.go diff --git a/workers/routes/client.go b/pkg/workers/routes/dwn.go similarity index 83% rename from workers/routes/client.go rename to pkg/workers/routes/dwn.go index 24b886194..8fd587d9f 100644 --- a/workers/routes/client.go +++ b/pkg/workers/routes/dwn.go @@ -3,9 +3,9 @@ package routes import ( "github.com/labstack/echo/v4" - "github.com/onsonr/sonr/nebula/components/auth" - "github.com/onsonr/sonr/nebula/components/home" - "github.com/onsonr/sonr/workers/handlers" + "github.com/onsonr/sonr/pkg/nebula/components/auth" + "github.com/onsonr/sonr/pkg/nebula/components/home" + "github.com/onsonr/sonr/pkg/workers/handlers" ) func RegisterClientAPI(e *echo.Echo) { diff --git a/workers/routes/proxy.go b/pkg/workers/routes/gateway.go similarity index 69% rename from workers/routes/proxy.go rename to pkg/workers/routes/gateway.go index 956fe8d4f..c3f3ab26c 100644 --- a/workers/routes/proxy.go +++ b/pkg/workers/routes/gateway.go @@ -3,8 +3,8 @@ package routes import ( "github.com/labstack/echo/v4" - "github.com/onsonr/sonr/nebula/components/auth" - "github.com/onsonr/sonr/nebula/components/home" + "github.com/onsonr/sonr/pkg/nebula/components/auth" + "github.com/onsonr/sonr/pkg/nebula/components/home" ) func RegisterProxyAPI(e *echo.Echo) { diff --git a/x/did/types/identifier.go b/x/did/types/identifier.go deleted file mode 100644 index ab1254f4c..000000000 --- a/x/did/types/identifier.go +++ /dev/null @@ -1 +0,0 @@ -package types diff --git a/x/did/types/pubkey.go b/x/did/types/pubkey.go index 36d7d5a67..97d17ee5f 100644 --- a/x/did/types/pubkey.go +++ b/x/did/types/pubkey.go @@ -1,6 +1,8 @@ package types import ( + "strings" + didv1 "github.com/onsonr/sonr/api/did/v1" ) @@ -10,3 +12,65 @@ type PubKeyI interface { GetRawKey() *didv1.RawKey GetJwk() *didv1.JSONWebKey } + +// PubKey defines a generic pubkey. +type PublicKey interface { + VerifySignature(msg, sig []byte) bool +} + +type PubKeyG[T any] interface { + *T + PublicKey +} + +type pubKeyImpl struct { + decode func(b []byte) (PublicKey, error) + validate func(key PublicKey) error +} + +// func WithSecp256K1PubKey() Option { +// return WithPubKeyWithValidationFunc(func(pt *secp256k1.PubKey) error { +// _, err := dcrd_secp256k1.ParsePubKey(pt.Key) +// return err +// }) +// } +// +// func WithPubKey[T any, PT PubKeyG[T]]() Option { +// return WithPubKeyWithValidationFunc[T, PT](func(_ PT) error { +// return nil +// }) +// } +// +// func WithPubKeyWithValidationFunc[T any, PT PubKeyG[T]](validateFn func(PT) error) Option { +// pkImpl := pubKeyImpl{ +// decode: func(b []byte) (PublicKey, error) { +// key := PT(new(T)) +// err := gogoproto.Unmarshal(b, key) +// if err != nil { +// return nil, err +// } +// return key, nil +// }, +// validate: func(k PublicKey) error { +// concrete, ok := k.(PT) +// if !ok { +// return fmt.Errorf( +// "invalid pubkey type passed for validation, wanted: %T, got: %T", +// concrete, +// k, +// ) +// } +// return validateFn(concrete) +// }, +// } +// return func(a *Account) { +// a.supportedPubKeys[gogoproto.MessageName(PT(new(T)))] = pkImpl +// } +// } +func nameFromTypeURL(url string) string { + name := url + if i := strings.LastIndexByte(url, '/'); i >= 0 { + name = name[i+len("/"):] + } + return name +} diff --git a/x/did/types/signer.go b/x/did/types/signer.go new file mode 100644 index 000000000..87f4336a8 --- /dev/null +++ b/x/did/types/signer.go @@ -0,0 +1,30 @@ +package types + +import ( + "context" + + signingv1beta1 "cosmossdk.io/api/cosmos/tx/signing/v1beta1" + "cosmossdk.io/x/tx/signing" + "github.com/cosmos/cosmos-sdk/types/tx" +) + +type directHandler struct{} + +func (s directHandler) Mode() signingv1beta1.SignMode { + return signingv1beta1.SignMode_SIGN_MODE_DIRECT_AUX +} + +func (s directHandler) GetSignBytes( + _ context.Context, + signerData signing.SignerData, + txData signing.TxData, +) ([]byte, error) { + txDoc := tx.SignDoc{ + BodyBytes: txData.BodyBytes, + AuthInfoBytes: txData.AuthInfoBytes, + ChainId: signerData.ChainID, + AccountNumber: signerData.AccountNumber, + } + + return txDoc.Marshal() +} diff --git a/x/service/depinject.go b/x/service/depinject.go index 21caa70a6..8f0ddad6a 100644 --- a/x/service/depinject.go +++ b/x/service/depinject.go @@ -20,6 +20,7 @@ import ( didkeeper "github.com/onsonr/sonr/x/did/keeper" macaroonkeeper "github.com/onsonr/sonr/x/macaroon/keeper" "github.com/onsonr/sonr/x/service/keeper" + vaultkeeper "github.com/onsonr/sonr/x/vault/keeper" ) var _ appmodule.AppModule = AppModule{} @@ -50,6 +51,7 @@ type ModuleInputs struct { NFTKeeper nftkeeper.Keeper StakingKeeper stakingkeeper.Keeper SlashingKeeper slashingkeeper.Keeper + VaultKeeper vaultkeeper.Keeper } type ModuleOutputs struct { @@ -62,7 +64,7 @@ type ModuleOutputs struct { func ProvideModule(in ModuleInputs) ModuleOutputs { govAddr := authtypes.NewModuleAddress(govtypes.ModuleName).String() - k := keeper.NewKeeper(in.Cdc, in.StoreService, log.NewLogger(os.Stderr), govAddr, in.DidKeeper, in.GroupKeeper, in.MacaroonKeeper, in.NFTKeeper) + k := keeper.NewKeeper(in.Cdc, in.StoreService, log.NewLogger(os.Stderr), govAddr, in.DidKeeper, in.GroupKeeper, in.MacaroonKeeper, in.NFTKeeper, in.VaultKeeper) m := NewAppModule(in.Cdc, k, in.DidKeeper, in.MacaroonKeeper) return ModuleOutputs{Module: m, Keeper: k, Out: depinject.Out{}} diff --git a/x/service/keeper/keeper.go b/x/service/keeper/keeper.go index 5c7bdd9b3..bc19097fa 100644 --- a/x/service/keeper/keeper.go +++ b/x/service/keeper/keeper.go @@ -15,6 +15,7 @@ import ( didkeeper "github.com/onsonr/sonr/x/did/keeper" macaroonkeeper "github.com/onsonr/sonr/x/macaroon/keeper" "github.com/onsonr/sonr/x/service/types" + vaultkeeper "github.com/onsonr/sonr/x/vault/keeper" ) type Keeper struct { @@ -33,6 +34,7 @@ type Keeper struct { GroupKeeper groupkeeper.Keeper MacaroonKeeper macaroonkeeper.Keeper NFTKeeper nftkeeper.Keeper + VaultKeeper vaultkeeper.Keeper } // NewKeeper creates a new Keeper instance @@ -45,6 +47,7 @@ func NewKeeper( groupKeeper groupkeeper.Keeper, macaroonKeeper macaroonkeeper.Keeper, nftKeeper nftkeeper.Keeper, + vaultKeeper vaultkeeper.Keeper, ) Keeper { logger = logger.With(log.ModuleKey, "x/"+types.ModuleName) diff --git a/x/service/keeper/keeper_test.go b/x/service/keeper/keeper_test.go index dfef57722..49f51f847 100644 --- a/x/service/keeper/keeper_test.go +++ b/x/service/keeper/keeper_test.go @@ -30,6 +30,7 @@ import ( module "github.com/onsonr/sonr/x/service" "github.com/onsonr/sonr/x/service/keeper" "github.com/onsonr/sonr/x/service/types" + vaultkeeper "github.com/onsonr/sonr/x/vault/keeper" ) var maccPerms = map[string][]string{ @@ -57,6 +58,7 @@ type testFixture struct { stakingKeeper *stakingkeeper.Keeper mintkeeper mintkeeper.Keeper nftkeeper nftkeeper.Keeper + vaultkeeper vaultkeeper.Keeper addrs []sdk.AccAddress govModAddr string @@ -84,7 +86,7 @@ func SetupTest(t *testing.T) *testFixture { registerBaseSDKModules(f, encCfg, storeService, logger, require) // Setup Keeper. - f.k = keeper.NewKeeper(encCfg.Codec, storeService, logger, f.govModAddr, f.didkeeper, f.groupkeeper, f.mack, f.nftkeeper) + f.k = keeper.NewKeeper(encCfg.Codec, storeService, logger, f.govModAddr, f.didkeeper, f.groupkeeper, f.mack, f.nftkeeper, f.vaultkeeper) f.msgServer = keeper.NewMsgServerImpl(f.k) f.queryServer = keeper.NewQuerier(f.k) f.appModule = module.NewAppModule(encCfg.Codec, f.k, f.didkeeper, f.mack) diff --git a/x/vault/depinject.go b/x/vault/depinject.go index 163a4c607..d4b879cd7 100644 --- a/x/vault/depinject.go +++ b/x/vault/depinject.go @@ -14,6 +14,7 @@ import ( govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper" stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" + macaroonkeeper "github.com/onsonr/sonr/x/macaroon/keeper" modulev1 "github.com/onsonr/sonr/api/vault/module/v1" didkeeper "github.com/onsonr/sonr/x/did/keeper" @@ -44,6 +45,7 @@ type ModuleInputs struct { AccountKeeper authkeeper.AccountKeeper DidKeeper didkeeper.Keeper + MacaroonKeeper macaroonkeeper.Keeper StakingKeeper stakingkeeper.Keeper SlashingKeeper slashingkeeper.Keeper } @@ -58,7 +60,7 @@ type ModuleOutputs struct { func ProvideModule(in ModuleInputs) ModuleOutputs { govAddr := authtypes.NewModuleAddress(govtypes.ModuleName).String() - k := keeper.NewKeeper(in.Cdc, in.StoreService, log.NewLogger(os.Stderr), govAddr, in.AccountKeeper, in.DidKeeper) + k := keeper.NewKeeper(in.Cdc, in.StoreService, log.NewLogger(os.Stderr), govAddr, in.AccountKeeper, in.DidKeeper, in.MacaroonKeeper) m := NewAppModule(in.Cdc, k, in.DidKeeper) return ModuleOutputs{Module: m, Keeper: k, Out: depinject.Out{}} diff --git a/x/vault/keeper/keeper.go b/x/vault/keeper/keeper.go index d4cb77e35..6e990dc55 100644 --- a/x/vault/keeper/keeper.go +++ b/x/vault/keeper/keeper.go @@ -13,6 +13,7 @@ import ( apiv1 "github.com/onsonr/sonr/api/vault/v1" didkeeper "github.com/onsonr/sonr/x/did/keeper" + macaroonkeeper "github.com/onsonr/sonr/x/macaroon/keeper" "github.com/onsonr/sonr/x/vault/types" ) @@ -30,8 +31,9 @@ type Keeper struct { ipfsClient *rpc.HttpApi - AccountKeeper authkeeper.AccountKeeper - DIDKeeper didkeeper.Keeper + AccountKeeper authkeeper.AccountKeeper + DIDKeeper didkeeper.Keeper + MacaroonKeeper macaroonkeeper.Keeper } // NewKeeper creates a new Keeper instance @@ -42,6 +44,7 @@ func NewKeeper( authority string, authKeeper authkeeper.AccountKeeper, didk didkeeper.Keeper, + macaroonKeeper macaroonkeeper.Keeper, ) Keeper { logger = logger.With(log.ModuleKey, "x/"+types.ModuleName) @@ -63,12 +66,13 @@ func NewKeeper( ipfsClient, _ := rpc.NewLocalApi() k := Keeper{ - cdc: cdc, - logger: logger, - DIDKeeper: didk, - AccountKeeper: authKeeper, - Params: collections.NewItem(sb, types.ParamsKey, "params", codec.CollValue[types.Params](cdc)), - OrmDB: store, + cdc: cdc, + logger: logger, + DIDKeeper: didk, + MacaroonKeeper: macaroonKeeper, + AccountKeeper: authKeeper, + Params: collections.NewItem(sb, types.ParamsKey, "params", codec.CollValue[types.Params](cdc)), + OrmDB: store, ipfsClient: ipfsClient, authority: authority, diff --git a/x/vault/keeper/keeper_test.go b/x/vault/keeper/keeper_test.go index 313bd65be..000b67273 100644 --- a/x/vault/keeper/keeper_test.go +++ b/x/vault/keeper/keeper_test.go @@ -24,6 +24,7 @@ import ( "github.com/stretchr/testify/suite" didkeeper "github.com/onsonr/sonr/x/did/keeper" + macaroonkeeper "github.com/onsonr/sonr/x/macaroon/keeper" module "github.com/onsonr/sonr/x/vault" "github.com/onsonr/sonr/x/vault/keeper" "github.com/onsonr/sonr/x/vault/types" @@ -51,6 +52,7 @@ type testFixture struct { stakingKeeper *stakingkeeper.Keeper mintkeeper mintkeeper.Keeper didk didkeeper.Keeper + mack macaroonkeeper.Keeper addrs []sdk.AccAddress govModAddr string @@ -78,7 +80,7 @@ func SetupTest(t *testing.T) *testFixture { registerBaseSDKModules(f, encCfg, storeService, logger, require) // Setup Keeper. - f.k = keeper.NewKeeper(encCfg.Codec, storeService, logger, f.govModAddr, f.accountkeeper, f.didk) + f.k = keeper.NewKeeper(encCfg.Codec, storeService, logger, f.govModAddr, f.accountkeeper, f.didk, f.mack) f.msgServer = keeper.NewMsgServerImpl(f.k) f.queryServer = keeper.NewQuerier(f.k) f.appModule = module.NewAppModule(encCfg.Codec, f.k, f.didk)