Skip to content

Commit 3790e92

Browse files
authored
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** - **<no value>** - **refactor: remove unused identifier type** - **feat: integrate Macaroon Keeper with Service Module** - **refactor: rename worker routes for clarity**
1 parent 1d569d3 commit 3790e92

121 files changed

Lines changed: 865 additions & 585 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
title: "[Milestone] "
2+
labels: ["#OKR", "#PLANNING"]
3+
body:
4+
- type: input
5+
id: has-version
6+
attributes:
7+
label: Version
8+
description: A tag for the associated milestone.
9+
placeholder: v0.6.0
10+
validations:
11+
required: true
12+
- type: textarea
13+
attributes:
14+
label: Objective
15+
description: Explain the objective of the OKR in less than 100 characters.
16+
placeholder: Ethereum IBC integration with Sonr.
17+
render: markdown
18+
validations:
19+
required: true
20+
- type: textarea
21+
attributes:
22+
label: Task List
23+
description: |
24+
Break down the objective into a list of tasks to be completed.
25+
value: |
26+
- [ ] #
27+
- [ ] #
28+
- [ ] #
29+
validations:
30+
required: true

.github/ISSUE_TEMPLATE/okr.yml

Lines changed: 0 additions & 30 deletions
This file was deleted.

.github/pr-labeler.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1-
feature: ["feature/*", "feat/*"]
2-
fix: fix/*
3-
chore :hammer:: chore/*
1+
"@pr/feature": ["feature/*", "feat/*"]
2+
"@pr/fix": fix/*
3+
"@pr/chore": chore/*
4+
"@pr/docs": docs/*
5+
"@pr/refactor": refactor/*

.github/workflows/deploy-hway.yml

Lines changed: 0 additions & 20 deletions
This file was deleted.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ nebula/node_modules
7575

7676
mprocs.yaml
7777
build
78+
sonr.wiki
7879

7980
!devbox.lock
8081
!buf.lock

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ draw-deps:
113113
@goviz -i ./cmd/sonrd -d 2 | dot -Tpng -o dependency-graph.png
114114

115115
clean:
116+
rm -rf pkg/nebula/node_modules
116117
rm -rf snapcraft-local.yaml build/
117118

118119
distclean: clean
@@ -315,10 +316,9 @@ pkl-gen:
315316

316317
nebula-build:
317318
@echo "(ui) Building nebula"
318-
cd nebula && bun install && bun run build
319-
rm -rf ./nebula/node_modules
319+
cd pkg/nebula && bun install && bun run build
320320

321-
motr-build: templ-gen pkl-gen
321+
motr-build: nebula-build templ-gen pkl-gen
322322
@echo "(dwn) Building motr.wasm -> Service Worker IPFS Vault"
323323
GOOS=js GOARCH=wasm go build -o ./pkg/dwn/app.wasm ./cmd/motr/main.go
324324

app/app.go

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -632,23 +632,25 @@ func NewChainApp(
632632
app.StakingKeeper,
633633
)
634634

635-
// Create the vault Keeper
636-
app.VaultKeeper = vaultkeeper.NewKeeper(
635+
// Create the macaroon Keeper
636+
app.MacaroonKeeper = macaroonkeeper.NewKeeper(
637637
appCodec,
638-
sdkruntime.NewKVStoreService(keys[vaulttypes.StoreKey]),
638+
sdkruntime.NewKVStoreService(keys[macaroontypes.StoreKey]),
639639
logger,
640640
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
641641
app.AccountKeeper,
642642
app.DidKeeper,
643643
)
644-
// Create the macaroon Keeper
645-
app.MacaroonKeeper = macaroonkeeper.NewKeeper(
644+
645+
// Create the vault Keeper
646+
app.VaultKeeper = vaultkeeper.NewKeeper(
646647
appCodec,
647-
sdkruntime.NewKVStoreService(keys[macaroontypes.StoreKey]),
648+
sdkruntime.NewKVStoreService(keys[vaulttypes.StoreKey]),
648649
logger,
649650
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
650651
app.AccountKeeper,
651652
app.DidKeeper,
653+
app.MacaroonKeeper,
652654
)
653655

654656
// Create the service Keeper
@@ -661,6 +663,7 @@ func NewChainApp(
661663
app.GroupKeeper,
662664
app.MacaroonKeeper,
663665
app.NFTKeeper,
666+
app.VaultKeeper,
664667
)
665668

666669
// Create the globalfee keeper

cmd/hway/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ package main
55
import (
66
"github.com/labstack/echo/v4"
77
"github.com/onsonr/sonr/internal/ctx"
8-
"github.com/onsonr/sonr/workers/routes"
8+
"github.com/onsonr/sonr/pkg/workers/routes"
99
"github.com/syumai/workers"
1010
)
1111

1212
func main() {
1313
s := echo.New()
14-
s.Use(ctx.UseSession)
14+
s.Use(ctx.SessionMiddleware)
1515
routes.RegisterProxyViews(s)
1616
routes.RegisterProxyAPI(s)
1717
workers.Serve(s)

cmd/motr/main.go

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,43 @@
44
package main
55

66
import (
7+
"encoding/json"
8+
"os"
9+
710
"github.com/labstack/echo/v4"
8-
"github.com/onsonr/sonr/cmd/motr/fetch"
911
"github.com/onsonr/sonr/internal/ctx"
10-
"github.com/onsonr/sonr/workers/routes"
12+
"github.com/onsonr/sonr/internal/dwn"
13+
dwngen "github.com/onsonr/sonr/internal/dwn/gen"
14+
"github.com/onsonr/sonr/pkg/workers/routes"
1115
)
1216

17+
var config *dwngen.Config
18+
1319
func main() {
20+
// Load dwn config
21+
if err := loadDwnConfig(); err != nil {
22+
panic(err)
23+
}
24+
25+
// Setup HTTP server
1426
e := echo.New()
15-
e.Use(ctx.UseSession)
16-
routes.RegisterClientViews(e)
27+
e.Use(ctx.SessionMiddleware)
1728
routes.RegisterClientAPI(e)
18-
fetch.Serve(e)
29+
routes.RegisterClientViews(e)
30+
dwn.Serve(e)
31+
}
32+
33+
func loadDwnConfig() error {
34+
// Read dwn.json config
35+
dwnBz, err := os.ReadFile("dwn.json")
36+
if err != nil {
37+
return err
38+
}
39+
dwnConfig := &dwngen.Config{}
40+
err = json.Unmarshal(dwnBz, dwnConfig)
41+
if err != nil {
42+
return err
43+
}
44+
config = dwnConfig
45+
return nil
1946
}

devbox.lock

Lines changed: 0 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -49,54 +49,6 @@
4949
}
5050
}
5151
},
52-
"cloudflared@latest": {
53-
"last_modified": "2024-09-10T15:01:03Z",
54-
"resolved": "github:NixOS/nixpkgs/5ed627539ac84809c78b2dd6d26a5cebeb5ae269#cloudflared",
55-
"source": "devbox-search",
56-
"version": "2024.8.3",
57-
"systems": {
58-
"aarch64-darwin": {
59-
"outputs": [
60-
{
61-
"name": "out",
62-
"path": "/nix/store/nmmh1dx4rvqayxq31c99gxpbwvcchx9w-cloudflared-2024.8.3",
63-
"default": true
64-
}
65-
],
66-
"store_path": "/nix/store/nmmh1dx4rvqayxq31c99gxpbwvcchx9w-cloudflared-2024.8.3"
67-
},
68-
"aarch64-linux": {
69-
"outputs": [
70-
{
71-
"name": "out",
72-
"path": "/nix/store/kwikn13v0rddmr8kjhnj67li8aq8qwa6-cloudflared-2024.8.3",
73-
"default": true
74-
}
75-
],
76-
"store_path": "/nix/store/kwikn13v0rddmr8kjhnj67li8aq8qwa6-cloudflared-2024.8.3"
77-
},
78-
"x86_64-darwin": {
79-
"outputs": [
80-
{
81-
"name": "out",
82-
"path": "/nix/store/9630bavr6jb44g0pcwwqn0zpgin39dc7-cloudflared-2024.8.3",
83-
"default": true
84-
}
85-
],
86-
"store_path": "/nix/store/9630bavr6jb44g0pcwwqn0zpgin39dc7-cloudflared-2024.8.3"
87-
},
88-
"x86_64-linux": {
89-
"outputs": [
90-
{
91-
"name": "out",
92-
"path": "/nix/store/hybva7brncispiqm6f0qrpn897r3y3ja-cloudflared-2024.8.3",
93-
"default": true
94-
}
95-
],
96-
"store_path": "/nix/store/hybva7brncispiqm6f0qrpn897r3y3ja-cloudflared-2024.8.3"
97-
}
98-
}
99-
},
10052
"go@1.22": {
10153
"last_modified": "2024-09-12T11:58:09Z",
10254
"resolved": "github:NixOS/nixpkgs/280db3decab4cbeb22a4599bd472229ab74d25e1#go",
@@ -151,54 +103,6 @@
151103
"source": "devbox-search",
152104
"version": "0.17.0"
153105
},
154-
"skate@latest": {
155-
"last_modified": "2024-09-10T15:01:03Z",
156-
"resolved": "github:NixOS/nixpkgs/5ed627539ac84809c78b2dd6d26a5cebeb5ae269#skate",
157-
"source": "devbox-search",
158-
"version": "1.0.0",
159-
"systems": {
160-
"aarch64-darwin": {
161-
"outputs": [
162-
{
163-
"name": "out",
164-
"path": "/nix/store/5hn4s18zy08inhimckf3794zszxjn077-skate-1.0.0",
165-
"default": true
166-
}
167-
],
168-
"store_path": "/nix/store/5hn4s18zy08inhimckf3794zszxjn077-skate-1.0.0"
169-
},
170-
"aarch64-linux": {
171-
"outputs": [
172-
{
173-
"name": "out",
174-
"path": "/nix/store/jxwx4fn5qbaz2nan3gmpydqx6vv8ldp1-skate-1.0.0",
175-
"default": true
176-
}
177-
],
178-
"store_path": "/nix/store/jxwx4fn5qbaz2nan3gmpydqx6vv8ldp1-skate-1.0.0"
179-
},
180-
"x86_64-darwin": {
181-
"outputs": [
182-
{
183-
"name": "out",
184-
"path": "/nix/store/zs6ik66kpz9q8mdmzxqmgjv51y39r76h-skate-1.0.0",
185-
"default": true
186-
}
187-
],
188-
"store_path": "/nix/store/zs6ik66kpz9q8mdmzxqmgjv51y39r76h-skate-1.0.0"
189-
},
190-
"x86_64-linux": {
191-
"outputs": [
192-
{
193-
"name": "out",
194-
"path": "/nix/store/6zbyhj72wh0645lj6b9c392aqqg11a84-skate-1.0.0",
195-
"default": true
196-
}
197-
],
198-
"store_path": "/nix/store/6zbyhj72wh0645lj6b9c392aqqg11a84-skate-1.0.0"
199-
}
200-
}
201-
},
202106
"templ@latest": {
203107
"last_modified": "2024-09-10T15:01:03Z",
204108
"resolved": "github:NixOS/nixpkgs/5ed627539ac84809c78b2dd6d26a5cebeb5ae269#templ",

0 commit comments

Comments
 (0)