mirror of
https://github.com/onsonr/sonr.git
synced 2025-03-10 13:07:09 +00:00
refactor: use htmx instead of dwn for vault client
This commit is contained in:
parent
7057332163
commit
0df3762f13
2
Makefile
2
Makefile
@ -301,7 +301,7 @@ sh-testnet: mod-tidy
|
||||
|
||||
dwn:
|
||||
@echo "(dwn) Building dwn.wasm -> IPFS Vault"
|
||||
GOOS=js GOARCH=wasm go build -o ./x/vault/internal/app.wasm ./x/vault/client/dwn/main.go
|
||||
GOOS=js GOARCH=wasm go build -o ./x/vault/internal/app.wasm ./x/vault/client/htmx/dwn.go
|
||||
|
||||
templ:
|
||||
@echo "(templ) Generating templ files"
|
||||
|
@ -7,55 +7,6 @@ import (
|
||||
didv1 "github.com/onsonr/sonr/api/did/v1"
|
||||
)
|
||||
|
||||
type controller struct {
|
||||
userKs mpc.Share
|
||||
valKs mpc.Share
|
||||
address string
|
||||
chainID string
|
||||
ethAddr string
|
||||
btcAddr string
|
||||
publicKey []byte
|
||||
}
|
||||
|
||||
func (c *controller) GetTableEntry() (*didv1.Controller, error) {
|
||||
valKs, err := c.valKs.Marshal()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &didv1.Controller{
|
||||
KsVal: valKs,
|
||||
Did: fmt.Sprintf("did:sonr:%s", c.address),
|
||||
SonrAddress: c.address,
|
||||
EthAddress: c.ethAddr,
|
||||
BtcAddress: c.btcAddr,
|
||||
PublicKey: c.publicKey,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (c *controller) ExportUserKs() (string, error) {
|
||||
return c.userKs.Marshal()
|
||||
}
|
||||
|
||||
func (c *controller) ChainID() string {
|
||||
return c.chainID
|
||||
}
|
||||
|
||||
func (c *controller) SonrAddress() string {
|
||||
return c.address
|
||||
}
|
||||
|
||||
func (c *controller) EthAddress() string {
|
||||
return c.ethAddr
|
||||
}
|
||||
|
||||
func (c *controller) BtcAddress() string {
|
||||
return c.btcAddr
|
||||
}
|
||||
|
||||
func (c *controller) PublicKey() []byte {
|
||||
return c.publicKey
|
||||
}
|
||||
|
||||
type ControllerI interface {
|
||||
ChainID() string
|
||||
SonrAddress() string
|
||||
@ -99,3 +50,52 @@ func NewController(shares []mpc.Share) (ControllerI, error) {
|
||||
publicKey: pbBz,
|
||||
}, nil
|
||||
}
|
||||
|
||||
type controller struct {
|
||||
userKs mpc.Share
|
||||
valKs mpc.Share
|
||||
address string
|
||||
chainID string
|
||||
ethAddr string
|
||||
btcAddr string
|
||||
publicKey []byte
|
||||
}
|
||||
|
||||
func (c *controller) BtcAddress() string {
|
||||
return c.btcAddr
|
||||
}
|
||||
|
||||
func (c *controller) ChainID() string {
|
||||
return c.chainID
|
||||
}
|
||||
|
||||
func (c *controller) EthAddress() string {
|
||||
return c.ethAddr
|
||||
}
|
||||
|
||||
func (c *controller) ExportUserKs() (string, error) {
|
||||
return c.userKs.Marshal()
|
||||
}
|
||||
|
||||
func (c *controller) GetTableEntry() (*didv1.Controller, error) {
|
||||
valKs, err := c.valKs.Marshal()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &didv1.Controller{
|
||||
KsVal: valKs,
|
||||
Did: fmt.Sprintf("did:sonr:%s", c.address),
|
||||
SonrAddress: c.address,
|
||||
EthAddress: c.ethAddr,
|
||||
BtcAddress: c.btcAddr,
|
||||
PublicKey: c.publicKey,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (c *controller) PublicKey() []byte {
|
||||
return c.publicKey
|
||||
}
|
||||
|
||||
func (c *controller) SonrAddress() string {
|
||||
return c.address
|
||||
}
|
||||
|
1
x/did/types/identifier.go
Normal file
1
x/did/types/identifier.go
Normal file
@ -0,0 +1 @@
|
||||
package types
|
@ -15,8 +15,8 @@ import (
|
||||
"github.com/labstack/echo/v4"
|
||||
promise "github.com/nlepage/go-js-promise"
|
||||
"github.com/onsonr/sonr/nebula/pages"
|
||||
"github.com/onsonr/sonr/x/vault/client/dwn/middleware"
|
||||
"github.com/onsonr/sonr/x/vault/client/dwn/state"
|
||||
"github.com/onsonr/sonr/x/vault/client/htmx/middleware"
|
||||
"github.com/onsonr/sonr/x/vault/client/htmx/state"
|
||||
)
|
||||
|
||||
func main() {
|
@ -2,7 +2,6 @@ package state
|
||||
|
||||
import (
|
||||
"github.com/labstack/echo/v4"
|
||||
middleware "github.com/onsonr/sonr/x/vault/client/dwn/middleware"
|
||||
)
|
||||
|
||||
func RegisterHandlers(e *echo.Echo) {
|
||||
@ -15,8 +14,3 @@ func RegisterHandlers(e *echo.Echo) {
|
||||
g.POST("/register/:subject", handleCredentialCreation)
|
||||
g.POST("/register/:subject/check", checkSubjectIsValid)
|
||||
}
|
||||
|
||||
func RegisterSync(e *echo.Echo) {
|
||||
g := e.Group("sync")
|
||||
g.Use(middleware.MacaroonMiddleware("test", "test"))
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user