feature/refactor did state (#10)

* feat(did): remove account types

* feat: Refactor Property to Proof in zkprop.go

* feat: add ZKP proof mechanism for verifications

* fix: return bool and error from pinInitialVault

* feat: implement KeyshareSet for managing user and validator keyshares

* feat: Update Credential type in protobuf

* feat: update credential schema with sign count

* feat: migrate  and  modules to middleware

* refactor: rename vault module to ORM

* chore(dwn): add service worker registration to index template

* feat: integrate service worker for offline functionality

* refactor(did): use DIDNamespace enum for verification method in proto reflection

* refactor: update protobuf definitions to support Keyshare

* feat: expose did keeper in app keepers

* Add Motr Web App

* refactor: rename motr/handlers/discovery.go to motr/handlers/openid.go

* refactor: move session related code to middleware

* feat: add database operations for managing assets, chains, and credentials

* feat: add htmx support for UI updates

* refactor: extract common helper scripts

* chore: remove unused storage GUI components

* refactor: Move frontend rendering to dedicated handlers

* refactor: rename  to

* refactor: move alert implementation to templ

* feat: add alert component with icon, title, and message

* feat: add new RequestHeaders struct to store request headers

* Feature/create home view (#9)

* refactor: move view logic to new htmx handler

* refactor: remove unnecessary dependencies

* refactor: remove unused dependencies

* feat(devbox): integrate air for local development

* feat: implement openid connect discovery document

* refactor: rename  to

* refactor(did): update service handling to support DNS discovery

* feat: add support for user and validator keyshares

* refactor: move keyshare signing logic to signer
This commit is contained in:
Prad Nukala
2024-09-11 15:10:54 -04:00
committed by GitHub
parent 4f2d342649
commit bbfe2a2329
197 changed files with 14668 additions and 27810 deletions
+10 -40
View File
@@ -2,11 +2,6 @@ package keeper
import (
"context"
"fmt"
sdk "github.com/cosmos/cosmos-sdk/types"
"google.golang.org/genproto/googleapis/api/httpbody"
"google.golang.org/grpc/peer"
"github.com/onsonr/sonr/x/did/types"
)
@@ -23,52 +18,27 @@ func NewQuerier(keeper Keeper) Querier {
// Params returns the total set of did parameters.
func (k Querier) Params(
c context.Context,
goCtx context.Context,
req *types.QueryRequest,
) (*types.QueryParamsResponse, error) {
ctx := sdk.UnwrapSDKContext(c)
p, err := k.Keeper.Params.Get(ctx)
if err != nil {
return nil, err
}
params := p.ActiveParams(k.HasIPFSConnection())
return &types.QueryParamsResponse{Params: &params}, nil
) (*types.QueryResponse, error) {
ctx := k.CurrentCtx(goCtx)
return &types.QueryResponse{Params: k.GetParams(ctx.SDK())}, nil
}
// Resolve implements types.QueryServer.
func (k Querier) Resolve(
goCtx context.Context,
req *types.QueryRequest,
) (*types.QueryResolveResponse, error) {
// ctx := sdk.UnwrapSDKContext(goCtx)
return &types.QueryResolveResponse{}, nil
) (*types.QueryResponse, error) {
ctx := k.CurrentCtx(goCtx)
return &types.QueryResponse{Params: k.GetParams(ctx.SDK())}, nil
}
// Service implements types.QueryServer.
func (k Querier) Service(
goCtx context.Context,
req *types.QueryRequest,
) (*types.QueryServiceResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)
_, ok := peer.FromContext(goCtx)
if !ok {
return nil, fmt.Errorf("failed to get peer from context")
}
rec, err := k.OrmDB.ServiceRecordTable().GetByOriginUri(ctx, req.Origin)
if err != nil {
return nil, err
}
return &types.QueryServiceResponse{Service: convertServiceRecord(rec)}, nil
}
// HTMX implements types.QueryServer.
func (k Querier) HTMX(goCtx context.Context, req *types.QueryRequest) (*httpbody.HttpBody, error) {
// ctx := sdk.UnwrapSDKContext(goCtx)
return &httpbody.HttpBody{
ContentType: "text/html",
Data: []byte("<html><body>HTMX</body></html>"),
}, nil
) (*types.QueryResponse, error) {
ctx := k.CurrentCtx(goCtx)
return &types.QueryResponse{Service: ctx.GetServiceInfo(req.GetOrigin()), Params: ctx.Params()}, nil
}