feature/1118 formatter interface creation (#1147)

- **refactor: improve query service code structure**
- **chore(deps): update protoc-gen-go-grpc to v1.5.1**
- **refactor: replace  package with**
- **chore(deps): update dependencies**
- **fix(deps): update webauthn to v0.11.2**
- **refactor: remove onsonr.sonr from package names**
- **refactor: improve code readability in vault querier**
- **refactor: simplify controller initialization**
- **fix: remove unnecessary function for counter data**
- **refactor: update button component file paths**
- **refactor(authentication): simplify register page**
- **fix: update error filenames in marketing section templates**
This commit is contained in:
Prad Nukala
2024-10-21 11:30:52 -04:00
committed by GitHub
parent 3ad6036eb8
commit 311b957550
57 changed files with 722 additions and 548 deletions
+4 -54
View File
@@ -1,8 +1,6 @@
package types
import (
fmt "fmt"
"github.com/onsonr/crypto/mpc"
sdk "github.com/cosmos/cosmos-sdk/types"
@@ -13,53 +11,34 @@ type ControllerI interface {
ChainID() string
GetPubKey() *didv1.PubKey
SonrAddress() string
EthAddress() string
BtcAddress() string
RawPublicKey() []byte
// StdPublicKey() cryptotypes.PubKey
GetTableEntry() (*didv1.Controller, error)
ExportUserKs() (string, error)
}
func NewController(ctx sdk.Context, shares []mpc.Share) (ControllerI, error) {
func NewController(shares []mpc.Share) (ControllerI, error) {
var (
valKs = shares[0]
userKs = shares[1]
)
pbBz := valKs.GetPublicKey()
sonrAddr, err := ComputeSonrAddress(pbBz)
pb, err := valKs.PublicKey()
if err != nil {
return nil, err
}
btcAddr, err := ComputeBitcoinAddress(pbBz)
sonrAddr, err := ComputeSonrAddress(pb)
if err != nil {
return nil, err
}
ecdsaPub, err := valKs.ECDSAPublicKey()
if err != nil {
return nil, err
}
ethAddr := ComputeEthAddress(ecdsaPub)
return &controller{
valKs: valKs,
userKs: userKs,
address: sonrAddr,
btcAddr: btcAddr,
ethAddr: ethAddr,
chainID: ctx.ChainID(),
publicKey: pbBz,
publicKey: pb,
}, nil
}
func LoadControllerFromTableEntry(ctx sdk.Context, entry *didv1.Controller) (ControllerI, error) {
return &controller{
address: entry.Did,
btcAddr: entry.BtcAddress,
ethAddr: entry.EthAddress,
chainID: ctx.ChainID(),
publicKey: entry.PublicKey.RawKey.Key,
}, nil
@@ -70,28 +49,14 @@ type controller struct {
valKs mpc.Share
address string
chainID string
ethAddr string
btcAddr string
publicKey []byte
did string
}
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) GetPubKey() *didv1.PubKey {
return &didv1.PubKey{
KeyType: "ecdsa",
@@ -103,21 +68,6 @@ func (c *controller) GetPubKey() *didv1.PubKey {
}
}
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.GetPubKey(),
}, nil
}
func (c *controller) RawPublicKey() []byte {
return c.publicKey
}
+1
View File
@@ -764,6 +764,7 @@ func _Query_Verify_Handler(srv interface{}, ctx context.Context, dec func(interf
return interceptor(ctx, in, info, handler)
}
var Query_serviceDesc = _Query_serviceDesc
var _Query_serviceDesc = grpc.ServiceDesc{
ServiceName: "did.v1.Query",
HandlerType: (*QueryServer)(nil),
+1
View File
@@ -1075,6 +1075,7 @@ func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(in
return interceptor(ctx, in, info, handler)
}
var Msg_serviceDesc = _Msg_serviceDesc
var _Msg_serviceDesc = grpc.ServiceDesc{
ServiceName: "did.v1.Msg",
HandlerType: (*MsgServer)(nil),