mirror of
https://github.com/sonr-io/sonr.git
synced 2026-08-02 17:31:39 +00:00
(no commit message provided)
This commit is contained in:
@@ -0,0 +1,73 @@
|
||||
# `x/did`
|
||||
|
||||
The Decentralized Identity module is responsible for managing native Sonr Accounts, their derived wallets, and associated user identification information.
|
||||
|
||||
## Concepts
|
||||
|
||||
### Account
|
||||
|
||||
An Account represents a user's identity within the Sonr ecosystem. It includes information such as the user's public key, associated wallets, and other identification details.
|
||||
|
||||
### Decentralized Identifier (DID)
|
||||
|
||||
A Decentralized Identifier (DID) is a unique identifier that is created, owned, and controlled by the user. It is used to establish a secure and verifiable digital identity.
|
||||
|
||||
### Verifiable Credential (VC)
|
||||
|
||||
A Verifiable Credential (VC) is a digital statement that can be cryptographically verified. It contains claims about a subject (e.g., a user) and is issued by a trusted authority.
|
||||
|
||||
## State
|
||||
|
||||
Specify and describe structures expected to marshalled into the store, and their keys
|
||||
|
||||
### Account State
|
||||
|
||||
The Account state includes the user's public key, associated wallets, and other identification details. It is stored using the user's DID as the key.
|
||||
|
||||
### Credential State
|
||||
|
||||
The Credential state includes the claims about a subject and is stored using the credential ID as the key.
|
||||
|
||||
## State Transitions
|
||||
|
||||
Standard state transition operations triggered by hooks, messages, etc.
|
||||
|
||||
## Messages
|
||||
|
||||
Specify message structure(s) and expected state machine behaviour(s).
|
||||
|
||||
## Begin Block
|
||||
|
||||
Specify any begin-block operations.
|
||||
|
||||
## End Block
|
||||
|
||||
Specify any end-block operations.
|
||||
|
||||
## Hooks
|
||||
|
||||
Describe available hooks to be called by/from this module.
|
||||
|
||||
## Events
|
||||
|
||||
List and describe event tags used.
|
||||
|
||||
## Client
|
||||
|
||||
List and describe CLI commands and gRPC and REST endpoints.
|
||||
|
||||
## Params
|
||||
|
||||
List all module parameters, their types (in JSON) and identitys.
|
||||
|
||||
## Future Improvements
|
||||
|
||||
Describe future improvements of this module.
|
||||
|
||||
## Tests
|
||||
|
||||
Acceptance tests.
|
||||
|
||||
## Appendix
|
||||
|
||||
Supplementary details referenced elsewhere within the spec.
|
||||
@@ -0,0 +1,32 @@
|
||||
package module
|
||||
|
||||
import (
|
||||
autocliv1 "cosmossdk.io/api/cosmos/autocli/v1"
|
||||
|
||||
modulev1 "github.com/onsonr/hway/api/did/v1"
|
||||
)
|
||||
|
||||
// AutoCLIOptions implements the autocli.HasAutoCLIConfig interface.
|
||||
func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions {
|
||||
return &autocliv1.ModuleOptions{
|
||||
Query: &autocliv1.ServiceCommandDescriptor{
|
||||
Service: modulev1.Query_ServiceDesc.ServiceName,
|
||||
RpcCommandOptions: []*autocliv1.RpcCommandOptions{
|
||||
{
|
||||
RpcMethod: "Params",
|
||||
Use: "params",
|
||||
Short: "Query the current consensus parameters",
|
||||
},
|
||||
},
|
||||
},
|
||||
Tx: &autocliv1.ServiceCommandDescriptor{
|
||||
Service: modulev1.Msg_ServiceDesc.ServiceName,
|
||||
RpcCommandOptions: []*autocliv1.RpcCommandOptions{
|
||||
{
|
||||
RpcMethod: "UpdateParams",
|
||||
Skip: false, // set to true if authority gated
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package module
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
|
||||
slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper"
|
||||
|
||||
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
|
||||
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
|
||||
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
|
||||
|
||||
"cosmossdk.io/core/address"
|
||||
"cosmossdk.io/core/appmodule"
|
||||
"cosmossdk.io/core/store"
|
||||
"cosmossdk.io/depinject"
|
||||
"cosmossdk.io/log"
|
||||
|
||||
modulev1 "github.com/onsonr/hway/api/did/module/v1"
|
||||
"github.com/onsonr/hway/x/did/keeper"
|
||||
)
|
||||
|
||||
var _ appmodule.AppModule = AppModule{}
|
||||
|
||||
// IsOnePerModuleType implements the depinject.OnePerModuleType interface.
|
||||
func (am AppModule) IsOnePerModuleType() {}
|
||||
|
||||
// IsAppModule implements the appmodule.AppModule interface.
|
||||
func (am AppModule) IsAppModule() {}
|
||||
|
||||
func init() {
|
||||
appmodule.Register(
|
||||
&modulev1.Module{},
|
||||
appmodule.Provide(ProvideModule),
|
||||
)
|
||||
}
|
||||
|
||||
type ModuleInputs struct {
|
||||
depinject.In
|
||||
|
||||
Cdc codec.Codec
|
||||
StoreService store.KVStoreService
|
||||
AddressCodec address.Codec
|
||||
|
||||
AccountKeeper authkeeper.AccountKeeper
|
||||
StakingKeeper stakingkeeper.Keeper
|
||||
SlashingKeeper slashingkeeper.Keeper
|
||||
}
|
||||
|
||||
type ModuleOutputs struct {
|
||||
depinject.Out
|
||||
|
||||
Module appmodule.AppModule
|
||||
Keeper keeper.Keeper
|
||||
}
|
||||
|
||||
func ProvideModule(in ModuleInputs) ModuleOutputs {
|
||||
govAddr := authtypes.NewModuleAddress(govtypes.ModuleName).String()
|
||||
|
||||
k := keeper.NewKeeper(in.Cdc, in.StoreService, in.AccountKeeper, log.NewLogger(os.Stderr), govAddr)
|
||||
m := NewAppModule(in.Cdc, k)
|
||||
|
||||
return ModuleOutputs{Module: m, Keeper: k, Out: depinject.Out{}}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package keeper
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"cosmossdk.io/log"
|
||||
"github.com/onsonr/hway/x/did/types"
|
||||
)
|
||||
|
||||
// Logger returns the logger
|
||||
func (k Keeper) Logger() log.Logger {
|
||||
return k.logger
|
||||
}
|
||||
|
||||
// InitGenesis initializes the module's state from a genesis state.
|
||||
func (k *Keeper) InitGenesis(ctx context.Context, data *types.GenesisState) error {
|
||||
// this line is used by starport scaffolding # genesis/module/init
|
||||
if err := data.Params.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return k.Params.Set(ctx, data.Params)
|
||||
}
|
||||
|
||||
// ExportGenesis exports the module's state to a genesis state.
|
||||
func (k *Keeper) ExportGenesis(ctx context.Context) *types.GenesisState {
|
||||
params, err := k.Params.Get(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
// this line is used by starport scaffolding # genesis/module/export
|
||||
|
||||
return &types.GenesisState{
|
||||
Params: params,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package keeper_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/onsonr/hway/x/did/types"
|
||||
)
|
||||
|
||||
func TestGenesis(t *testing.T) {
|
||||
f := SetupTest(t)
|
||||
|
||||
genesisState := &types.GenesisState{
|
||||
Params: types.DefaultParams(),
|
||||
|
||||
// this line is used by starport scaffolding # genesis/test/state
|
||||
}
|
||||
|
||||
err := f.k.InitGenesis(f.ctx, genesisState)
|
||||
require.NoError(t, err)
|
||||
|
||||
|
||||
got := f.k.ExportGenesis(f.ctx)
|
||||
require.NotNil(t, got)
|
||||
|
||||
// this line is used by starport scaffolding # genesis/test/assert
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package keeper
|
||||
|
||||
import (
|
||||
"cosmossdk.io/collections"
|
||||
storetypes "cosmossdk.io/core/store"
|
||||
"cosmossdk.io/log"
|
||||
"cosmossdk.io/orm/model/ormdb"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
|
||||
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
|
||||
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
|
||||
|
||||
apiv1 "github.com/onsonr/hway/api/did/v1"
|
||||
"github.com/onsonr/hway/x/did/types"
|
||||
)
|
||||
|
||||
// Keeper defines the middleware keeper.
|
||||
type Keeper struct {
|
||||
cdc codec.BinaryCodec
|
||||
|
||||
logger log.Logger
|
||||
|
||||
// state management
|
||||
OrmDB apiv1.StateStore
|
||||
Params collections.Item[types.Params]
|
||||
Schema collections.Schema
|
||||
|
||||
AccountKeeper authkeeper.AccountKeeper
|
||||
|
||||
authority string
|
||||
}
|
||||
|
||||
// NewKeeper creates a new poa Keeper instance
|
||||
func NewKeeper(cdc codec.BinaryCodec, storeService storetypes.KVStoreService, accKeeper authkeeper.AccountKeeper, logger log.Logger, authority string) Keeper {
|
||||
logger = logger.With(log.ModuleKey, "x/"+types.ModuleName)
|
||||
sb := collections.NewSchemaBuilder(storeService)
|
||||
if authority == "" {
|
||||
authority = authtypes.NewModuleAddress(govtypes.ModuleName).String()
|
||||
}
|
||||
db, err := ormdb.NewModuleDB(&types.ORMModuleSchema, ormdb.ModuleDBOptions{KVStoreService: storeService})
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
store, err := apiv1.NewStateStore(db)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
k := Keeper{
|
||||
cdc: cdc,
|
||||
logger: logger,
|
||||
Params: collections.NewItem(sb, types.ParamsKey, "params", codec.CollValue[types.Params](cdc)),
|
||||
authority: authority,
|
||||
OrmDB: store,
|
||||
AccountKeeper: accKeeper,
|
||||
}
|
||||
schema, err := sb.Build()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
k.Schema = schema
|
||||
return k
|
||||
}
|
||||
@@ -0,0 +1,143 @@
|
||||
package keeper_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
"cosmossdk.io/log"
|
||||
storetypes "cosmossdk.io/store/types"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/runtime"
|
||||
"github.com/cosmos/cosmos-sdk/testutil"
|
||||
simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil"
|
||||
authcodec "github.com/cosmos/cosmos-sdk/x/auth/codec"
|
||||
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
|
||||
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
|
||||
bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
|
||||
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
|
||||
mintkeeper "github.com/cosmos/cosmos-sdk/x/mint/keeper"
|
||||
minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"
|
||||
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
|
||||
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
|
||||
|
||||
"cosmossdk.io/core/store"
|
||||
|
||||
module "github.com/onsonr/hway/x/did"
|
||||
"github.com/onsonr/hway/x/did/keeper"
|
||||
"github.com/onsonr/hway/x/did/types"
|
||||
"github.com/strangelove-ventures/poa"
|
||||
)
|
||||
|
||||
var maccPerms = map[string][]string{
|
||||
authtypes.FeeCollectorName: nil,
|
||||
stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking},
|
||||
stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking},
|
||||
minttypes.ModuleName: {authtypes.Minter},
|
||||
govtypes.ModuleName: {authtypes.Burner},
|
||||
}
|
||||
|
||||
type testFixture struct {
|
||||
suite.Suite
|
||||
|
||||
ctx sdk.Context
|
||||
k keeper.Keeper
|
||||
msgServer types.MsgServer
|
||||
queryServer types.QueryServer
|
||||
appModule *module.AppModule
|
||||
|
||||
accountkeeper authkeeper.AccountKeeper
|
||||
bankkeeper bankkeeper.BaseKeeper
|
||||
stakingKeeper *stakingkeeper.Keeper
|
||||
mintkeeper mintkeeper.Keeper
|
||||
|
||||
addrs []sdk.AccAddress
|
||||
govModAddr string
|
||||
}
|
||||
|
||||
func SetupTest(t *testing.T) *testFixture {
|
||||
t.Helper()
|
||||
f := new(testFixture)
|
||||
require := require.New(t)
|
||||
|
||||
// Base setup
|
||||
logger := log.NewTestLogger(t)
|
||||
encCfg := moduletestutil.MakeTestEncodingConfig()
|
||||
|
||||
f.govModAddr = authtypes.NewModuleAddress(govtypes.ModuleName).String()
|
||||
f.addrs = simtestutil.CreateIncrementalAccounts(3)
|
||||
|
||||
key := storetypes.NewKVStoreKey(poa.ModuleName)
|
||||
storeService := runtime.NewKVStoreService(key)
|
||||
testCtx := testutil.DefaultContextWithDB(t, key, storetypes.NewTransientStoreKey("transient_test"))
|
||||
|
||||
f.ctx = testCtx.Ctx
|
||||
|
||||
// Register SDK modules.
|
||||
registerBaseSDKModules(f, encCfg, storeService, logger, require)
|
||||
|
||||
// Setup POA Keeper.
|
||||
f.k = keeper.NewKeeper(encCfg.Codec, storeService, f.accountkeeper, logger, f.govModAddr)
|
||||
f.msgServer = keeper.NewMsgServerImpl(f.k)
|
||||
f.queryServer = keeper.NewQuerier(f.k)
|
||||
f.appModule = module.NewAppModule(encCfg.Codec, f.k)
|
||||
|
||||
return f
|
||||
}
|
||||
|
||||
func registerModuleInterfaces(encCfg moduletestutil.TestEncodingConfig) {
|
||||
authtypes.RegisterInterfaces(encCfg.InterfaceRegistry)
|
||||
stakingtypes.RegisterInterfaces(encCfg.InterfaceRegistry)
|
||||
|
||||
types.RegisterInterfaces(encCfg.InterfaceRegistry)
|
||||
}
|
||||
|
||||
func registerBaseSDKModules(
|
||||
f *testFixture,
|
||||
encCfg moduletestutil.TestEncodingConfig,
|
||||
storeService store.KVStoreService,
|
||||
logger log.Logger,
|
||||
require *require.Assertions,
|
||||
) {
|
||||
registerModuleInterfaces(encCfg)
|
||||
|
||||
// Auth Keeper.
|
||||
f.accountkeeper = authkeeper.NewAccountKeeper(
|
||||
encCfg.Codec, storeService,
|
||||
authtypes.ProtoBaseAccount,
|
||||
maccPerms,
|
||||
authcodec.NewBech32Codec(sdk.Bech32MainPrefix), sdk.Bech32MainPrefix,
|
||||
f.govModAddr,
|
||||
)
|
||||
|
||||
// Bank Keeper.
|
||||
f.bankkeeper = bankkeeper.NewBaseKeeper(
|
||||
encCfg.Codec, storeService,
|
||||
f.accountkeeper,
|
||||
nil,
|
||||
f.govModAddr, logger,
|
||||
)
|
||||
|
||||
// Staking Keeper.
|
||||
f.stakingKeeper = stakingkeeper.NewKeeper(
|
||||
encCfg.Codec, storeService,
|
||||
f.accountkeeper, f.bankkeeper, f.govModAddr,
|
||||
authcodec.NewBech32Codec(sdk.Bech32PrefixValAddr),
|
||||
authcodec.NewBech32Codec(sdk.Bech32PrefixConsAddr),
|
||||
)
|
||||
require.NoError(f.stakingKeeper.SetParams(f.ctx, stakingtypes.DefaultParams()))
|
||||
f.accountkeeper.SetModuleAccount(f.ctx, f.stakingKeeper.GetNotBondedPool(f.ctx))
|
||||
f.accountkeeper.SetModuleAccount(f.ctx, f.stakingKeeper.GetBondedPool(f.ctx))
|
||||
|
||||
// Mint Keeper.
|
||||
f.mintkeeper = mintkeeper.NewKeeper(
|
||||
encCfg.Codec, storeService,
|
||||
f.stakingKeeper, f.accountkeeper, f.bankkeeper,
|
||||
authtypes.FeeCollectorName, f.govModAddr,
|
||||
)
|
||||
f.accountkeeper.SetModuleAccount(f.ctx, f.accountkeeper.GetModuleAccount(f.ctx, minttypes.ModuleName))
|
||||
f.mintkeeper.InitGenesis(f.ctx, f.accountkeeper, minttypes.DefaultGenesisState())
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package keeper
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
|
||||
// "github.com/onsonr/hway/internal/local"
|
||||
"github.com/onsonr/hway/x/did/types"
|
||||
)
|
||||
|
||||
var _ types.QueryServer = Querier{}
|
||||
|
||||
type Querier struct {
|
||||
Keeper
|
||||
}
|
||||
|
||||
func NewQuerier(keeper Keeper) Querier {
|
||||
return Querier{Keeper: keeper}
|
||||
}
|
||||
|
||||
// Params returns the total set of did parameters.
|
||||
func (k Querier) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) {
|
||||
ctx := sdk.UnwrapSDKContext(c)
|
||||
|
||||
p, err := k.Keeper.Params.Get(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &types.QueryParamsResponse{Params: &p}, nil
|
||||
}
|
||||
|
||||
// LoginOptions implements types.QueryServer.
|
||||
func (k Querier) LoginOptions(goCtx context.Context, req *types.QueryLoginOptionsRequest) (*types.QueryLoginOptionsResponse, error) {
|
||||
// ctx := sdk.UnwrapSDKContext(goCtx)
|
||||
panic("LoginOptions is unimplemented")
|
||||
return &types.QueryLoginOptionsResponse{}, nil
|
||||
}
|
||||
|
||||
// RegisterOptions implements types.QueryServer.
|
||||
func (k Querier) RegisterOptions(goCtx context.Context, req *types.QueryRegisterOptionsRequest) (*types.QueryRegisterOptionsResponse, error) {
|
||||
panic("RegisterOptions is unimplemented")
|
||||
return &types.QueryRegisterOptionsResponse{}, nil
|
||||
}
|
||||
|
||||
// PropertyExists implements types.QueryServer.
|
||||
func (k Querier) PropertyExists(goCtx context.Context, req *types.QueryExistsRequest) (*types.QueryExistsResponse, error) {
|
||||
// ctx := sdk.UnwrapSDKContext(goCtx)
|
||||
panic("PropertyExists is unimplemented")
|
||||
return &types.QueryExistsResponse{}, nil
|
||||
}
|
||||
|
||||
// ResolveIdentifier implements types.QueryServer.
|
||||
func (k Querier) ResolveIdentifier(goCtx context.Context, req *types.QueryResolveRequest) (*types.QueryResolveResponse, error) {
|
||||
// ctx := sdk.UnwrapSDKContext(goCtx)
|
||||
panic("ResolveIdentifier is unimplemented")
|
||||
return &types.QueryResolveResponse{}, nil
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package keeper
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
|
||||
|
||||
"cosmossdk.io/errors"
|
||||
"github.com/onsonr/hway/x/did/types"
|
||||
)
|
||||
|
||||
type msgServer struct {
|
||||
k Keeper
|
||||
}
|
||||
|
||||
var _ types.MsgServer = msgServer{}
|
||||
|
||||
// NewMsgServerImpl returns an implementation of the module MsgServer interface.
|
||||
func NewMsgServerImpl(keeper Keeper) types.MsgServer {
|
||||
return &msgServer{k: keeper}
|
||||
}
|
||||
|
||||
// InitializeController implements types.MsgServer.
|
||||
func (ms msgServer) InitializeController(goCtx context.Context, msg *types.MsgInitializeController) (*types.MsgInitializeControllerResponse, error) {
|
||||
_ = sdk.UnwrapSDKContext(goCtx)
|
||||
return &types.MsgInitializeControllerResponse{}, nil
|
||||
}
|
||||
|
||||
// UpdateParams updates the x/did module parameters.
|
||||
func (ms msgServer) UpdateParams(ctx context.Context, msg *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) {
|
||||
if ms.k.authority != msg.Authority {
|
||||
return nil, errors.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", ms.k.authority, msg.Authority)
|
||||
}
|
||||
|
||||
return nil, ms.k.Params.Set(ctx, msg.Params)
|
||||
}
|
||||
|
||||
// AuthenticateController implements types.MsgServer.
|
||||
func (ms msgServer) AuthenticateController(ctx context.Context, msg *types.MsgAuthenticateController) (*types.MsgAuthenticateControllerResponse, error) {
|
||||
// ctx := sdk.UnwrapSDKContext(goCtx)
|
||||
panic("AuthenticateController is unimplemented")
|
||||
return &types.MsgAuthenticateControllerResponse{}, nil
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package keeper_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/onsonr/hway/x/did/types"
|
||||
)
|
||||
|
||||
func TestParams(t *testing.T) {
|
||||
f := SetupTest(t)
|
||||
require := require.New(t)
|
||||
|
||||
testCases := []struct {
|
||||
name string
|
||||
request *types.MsgUpdateParams
|
||||
err bool
|
||||
}{
|
||||
{
|
||||
name: "fail; invalid authority",
|
||||
request: &types.MsgUpdateParams{
|
||||
Authority: f.addrs[0].String(),
|
||||
Params: types.DefaultParams(),
|
||||
},
|
||||
err: true,
|
||||
},
|
||||
{
|
||||
name: "success",
|
||||
request: &types.MsgUpdateParams{
|
||||
Authority: f.govModAddr,
|
||||
Params: types.DefaultParams(),
|
||||
},
|
||||
err: false,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
_, err := f.msgServer.UpdateParams(f.ctx, tc.request)
|
||||
|
||||
if tc.err {
|
||||
require.Error(err)
|
||||
} else {
|
||||
require.NoError(err)
|
||||
|
||||
r, err := f.queryServer.Params(f.ctx, &types.QueryParamsRequest{})
|
||||
require.NoError(err)
|
||||
|
||||
require.EqualValues(&tc.request.Params, r.Params)
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
package keeper
|
||||
+147
@@ -0,0 +1,147 @@
|
||||
package module
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
"github.com/grpc-ecosystem/grpc-gateway/runtime"
|
||||
|
||||
abci "github.com/cometbft/cometbft/abci/types"
|
||||
|
||||
"cosmossdk.io/client/v2/autocli"
|
||||
errorsmod "cosmossdk.io/errors"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/types/module"
|
||||
|
||||
"github.com/onsonr/hway/x/did/keeper"
|
||||
"github.com/onsonr/hway/x/did/types"
|
||||
// this line is used by starport scaffolding # 1
|
||||
)
|
||||
|
||||
const (
|
||||
// ConsensusVersion defines the current x/did module consensus version.
|
||||
ConsensusVersion = 1
|
||||
|
||||
// this line is used by starport scaffolding # simapp/module/const
|
||||
)
|
||||
|
||||
var (
|
||||
_ module.AppModuleBasic = AppModuleBasic{}
|
||||
_ module.AppModuleGenesis = AppModule{}
|
||||
_ module.AppModule = AppModule{}
|
||||
|
||||
_ autocli.HasAutoCLIConfig = AppModule{}
|
||||
)
|
||||
|
||||
// AppModuleBasic defines the basic application module used by the wasm module.
|
||||
type AppModuleBasic struct {
|
||||
cdc codec.Codec
|
||||
}
|
||||
|
||||
type AppModule struct {
|
||||
AppModuleBasic
|
||||
|
||||
keeper keeper.Keeper
|
||||
}
|
||||
|
||||
// NewAppModule constructor
|
||||
func NewAppModule(
|
||||
cdc codec.Codec,
|
||||
keeper keeper.Keeper,
|
||||
) *AppModule {
|
||||
return &AppModule{
|
||||
AppModuleBasic: AppModuleBasic{cdc: cdc},
|
||||
keeper: keeper,
|
||||
}
|
||||
}
|
||||
|
||||
func (a AppModuleBasic) Name() string {
|
||||
return types.ModuleName
|
||||
}
|
||||
|
||||
func (a AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage {
|
||||
return cdc.MustMarshalJSON(&types.GenesisState{
|
||||
Params: types.DefaultParams(),
|
||||
})
|
||||
}
|
||||
|
||||
func (a AppModuleBasic) ValidateGenesis(marshaler codec.JSONCodec, _ client.TxEncodingConfig, message json.RawMessage) error {
|
||||
var data types.GenesisState
|
||||
err := marshaler.UnmarshalJSON(message, &data)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := data.Params.Validate(); err != nil {
|
||||
return errorsmod.Wrap(err, "params")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (a AppModuleBasic) RegisterRESTRoutes(_ client.Context, _ *mux.Router) {
|
||||
}
|
||||
|
||||
func (a AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) {
|
||||
err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx))
|
||||
if err != nil {
|
||||
// same behavior as in cosmos-sdk
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
// Disable in favor of autocli.go. If you wish to use these, it will override AutoCLI methods.
|
||||
/*
|
||||
func (a AppModuleBasic) GetTxCmd() *cobra.Command {
|
||||
return cli.NewTxCmd()
|
||||
}
|
||||
|
||||
func (a AppModuleBasic) GetQueryCmd() *cobra.Command {
|
||||
return cli.GetQueryCmd()
|
||||
}
|
||||
*/
|
||||
|
||||
func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {
|
||||
types.RegisterLegacyAminoCodec(cdc)
|
||||
}
|
||||
|
||||
func (a AppModuleBasic) RegisterInterfaces(r codectypes.InterfaceRegistry) {
|
||||
types.RegisterInterfaces(r)
|
||||
}
|
||||
|
||||
func (a AppModule) InitGenesis(ctx sdk.Context, marshaler codec.JSONCodec, message json.RawMessage) []abci.ValidatorUpdate {
|
||||
genesisState := types.DefaultGenesis()
|
||||
if err := a.keeper.Params.Set(ctx, genesisState.Params); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (a AppModule) ExportGenesis(ctx sdk.Context, marshaler codec.JSONCodec) json.RawMessage {
|
||||
genState := a.keeper.ExportGenesis(ctx)
|
||||
return marshaler.MustMarshalJSON(genState)
|
||||
}
|
||||
|
||||
func (a AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {
|
||||
}
|
||||
|
||||
func (a AppModule) QuerierRoute() string {
|
||||
return types.QuerierRoute
|
||||
}
|
||||
|
||||
func (a AppModule) RegisterServices(cfg module.Configurator) {
|
||||
types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(a.keeper))
|
||||
types.RegisterQueryServer(cfg.QueryServer(), keeper.NewQuerier(a.keeper))
|
||||
}
|
||||
|
||||
// ConsensusVersion is a sequence number for state-breaking change of the
|
||||
// module. It should be incremented on each consensus-breaking change
|
||||
// introduced by the module. To avoid wrong/empty versions, the initial version
|
||||
// should be set to 1.
|
||||
func (a AppModule) ConsensusVersion() uint64 {
|
||||
return ConsensusVersion
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,146 @@
|
||||
// Copyright Tharsis Labs Ltd.(Evmos)
|
||||
// SPDX-License-Identifier:ENCL-1.0(https://github.com/evmos/evmos/blob/main/LICENSE)
|
||||
package types
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
|
||||
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
|
||||
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/crypto"
|
||||
)
|
||||
|
||||
var (
|
||||
_ authtypes.AccountI = (*EthAccount)(nil)
|
||||
_ EthAccountI = (*EthAccount)(nil)
|
||||
_ authtypes.GenesisAccount = (*EthAccount)(nil)
|
||||
_ codectypes.UnpackInterfacesMessage = (*EthAccount)(nil)
|
||||
)
|
||||
|
||||
var emptyCodeHash = crypto.Keccak256(nil)
|
||||
|
||||
const (
|
||||
// AccountTypeEOA defines the type for externally owned accounts (EOAs)
|
||||
AccountTypeEOA = int8(iota + 1)
|
||||
// AccountTypeContract defines the type for contract accounts
|
||||
AccountTypeContract
|
||||
)
|
||||
|
||||
// EthAccountI represents the interface of an EVM compatible account
|
||||
type EthAccountI interface {
|
||||
authtypes.AccountI
|
||||
// EthAddress returns the ethereum Address representation of the AccAddress
|
||||
EthAddress() common.Address
|
||||
// CodeHash is the keccak256 hash of the contract code (if any)
|
||||
GetCodeHash() common.Hash
|
||||
// SetCodeHash sets the code hash to the account fields
|
||||
SetCodeHash(code common.Hash) error
|
||||
// Type returns the type of Ethereum Account (EOA or Contract)
|
||||
Type() int8
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Main Evmos account
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// ProtoAccount defines the prototype function for BaseAccount used for an
|
||||
// AccountKeeper.
|
||||
func ProtoAccount() authtypes.AccountI {
|
||||
return &EthAccount{
|
||||
BaseAccount: &authtypes.BaseAccount{},
|
||||
CodeHash: common.BytesToHash(emptyCodeHash).String(),
|
||||
}
|
||||
}
|
||||
|
||||
// GetAccountNumber returns account number.
|
||||
func (acc EthAccount) GetAccountNumber() uint64 {
|
||||
return acc.BaseAccount.AccountNumber
|
||||
}
|
||||
|
||||
// GetAddress returns account address.
|
||||
func (acc EthAccount) GetAddress() sdk.AccAddress {
|
||||
addr, _ := sdk.AccAddressFromBech32(acc.BaseAccount.Address)
|
||||
return addr
|
||||
}
|
||||
|
||||
// GetBaseAccount returns base account.
|
||||
func (acc EthAccount) GetBaseAccount() *authtypes.BaseAccount {
|
||||
return acc.BaseAccount
|
||||
}
|
||||
|
||||
// GetPubKey returns the PubKey
|
||||
func (acc EthAccount) GetPubKey() cryptotypes.PubKey {
|
||||
return acc.GetBaseAccount().GetPubKey()
|
||||
}
|
||||
|
||||
// GetSequence returns the sequence
|
||||
func (acc EthAccount) GetSequence() uint64 {
|
||||
return acc.BaseAccount.Sequence
|
||||
}
|
||||
|
||||
// EthAddress returns the account address ethereum format.
|
||||
func (acc EthAccount) EthAddress() common.Address {
|
||||
return common.BytesToAddress(acc.GetAddress().Bytes())
|
||||
}
|
||||
|
||||
// GetCodeHash returns the account code hash in byte format
|
||||
func (acc EthAccount) GetCodeHash() common.Hash {
|
||||
return common.HexToHash(acc.CodeHash)
|
||||
}
|
||||
|
||||
// SetAccountNumber sets the account number
|
||||
func (acc *EthAccount) SetAccountNumber(accNum uint64) error {
|
||||
acc.BaseAccount.AccountNumber = accNum
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetAddress sets the address
|
||||
func (acc *EthAccount) SetAddress(addr sdk.AccAddress) error {
|
||||
acc.BaseAccount.Address = addr.String()
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetCodeHash sets the account code hash to the EthAccount fields
|
||||
func (acc *EthAccount) SetCodeHash(codeHash common.Hash) error {
|
||||
acc.CodeHash = codeHash.Hex()
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetPubKey sets the pubkey
|
||||
func (acc *EthAccount) SetPubKey(pubkey cryptotypes.PubKey) error {
|
||||
acc.BaseAccount.PubKey = codectypes.UnsafePackAny(pubkey)
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetSequence sets the sequence
|
||||
func (acc *EthAccount) SetSequence(seq uint64) error {
|
||||
acc.BaseAccount.Sequence = seq
|
||||
return nil
|
||||
}
|
||||
|
||||
// Type returns the type of Ethereum Account (EOA or Contract)
|
||||
func (acc EthAccount) Type() int8 {
|
||||
if bytes.Equal(emptyCodeHash, common.HexToHash(acc.CodeHash).Bytes()) {
|
||||
return AccountTypeEOA
|
||||
}
|
||||
return AccountTypeContract
|
||||
}
|
||||
|
||||
// Stringreturns the string representation of the EthAccount
|
||||
func (acc EthAccount) String() string {
|
||||
return acc.EthAddress().String()
|
||||
}
|
||||
|
||||
// Validate checks if the Evmos account fields are valid
|
||||
func (acc EthAccount) Validate() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces
|
||||
func (acc EthAccount) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error {
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package types
|
||||
|
||||
import (
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
"github.com/cosmos/cosmos-sdk/codec/types"
|
||||
cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
|
||||
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/types/msgservice"
|
||||
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
|
||||
// this line is used by starport scaffolding # 1
|
||||
)
|
||||
|
||||
var (
|
||||
amino = codec.NewLegacyAmino()
|
||||
AminoCdc = codec.NewAminoCodec(amino)
|
||||
)
|
||||
|
||||
func init() {
|
||||
RegisterLegacyAminoCodec(amino)
|
||||
cryptocodec.RegisterCrypto(amino)
|
||||
sdk.RegisterLegacyAminoCodec(amino)
|
||||
}
|
||||
|
||||
// RegisterLegacyAminoCodec registers concrete types on the LegacyAmino codec
|
||||
func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {
|
||||
cdc.RegisterConcrete(&MsgUpdateParams{}, ModuleName+"/MsgUpdateParams", nil)
|
||||
}
|
||||
|
||||
func RegisterInterfaces(registry types.InterfaceRegistry) {
|
||||
registry.RegisterImplementations(
|
||||
(*authtypes.AccountI)(nil),
|
||||
&EthAccount{},
|
||||
)
|
||||
registry.RegisterImplementations(
|
||||
(*authtypes.GenesisAccount)(nil),
|
||||
&EthAccount{},
|
||||
)
|
||||
registry.RegisterImplementations(
|
||||
(*cryptotypes.PubKey)(nil),
|
||||
&PublicKey{},
|
||||
)
|
||||
|
||||
registry.RegisterImplementations(
|
||||
(*sdk.Msg)(nil),
|
||||
&MsgUpdateParams{},
|
||||
&MsgInitializeController{},
|
||||
)
|
||||
msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc)
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package types
|
||||
|
||||
import sdkerrors "cosmossdk.io/errors"
|
||||
|
||||
var (
|
||||
ErrInvalidGenesisState = sdkerrors.Register(ModuleName, 100, "invalid genesis state")
|
||||
ErrInvalidETHAddressFormat = sdkerrors.Register(ModuleName, 200, "invalid ETH address format")
|
||||
ErrInvalidBTCAddressFormat = sdkerrors.Register(ModuleName, 201, "invalid BTC address format")
|
||||
ErrInvalidIDXAddressFormat = sdkerrors.Register(ModuleName, 202, "invalid IDX address format")
|
||||
ErrInvalidEmailFormat = sdkerrors.Register(ModuleName, 203, "invalid email format")
|
||||
ErrInvalidPhoneFormat = sdkerrors.Register(ModuleName, 204, "invalid phone format")
|
||||
ErrMinimumAssertions = sdkerrors.Register(ModuleName, 300, "at least one assertion is required for account initialization")
|
||||
ErrInvalidControllers = sdkerrors.Register(ModuleName, 301, "no more than one controller can be used for account initialization")
|
||||
ErrMaximumAuthenticators = sdkerrors.Register(ModuleName, 302, "more authenticators provided than the total accepted count")
|
||||
)
|
||||
@@ -0,0 +1,56 @@
|
||||
package types
|
||||
|
||||
import "encoding/json"
|
||||
|
||||
// this line is used by starport scaffolding # genesis/types/import
|
||||
|
||||
// DefaultIndex is the default global index
|
||||
const DefaultIndex uint64 = 1
|
||||
|
||||
// DefaultGenesis returns the default genesis state
|
||||
func DefaultGenesis() *GenesisState {
|
||||
return &GenesisState{
|
||||
// this line is used by starport scaffolding # genesis/types/default
|
||||
Params: DefaultParams(),
|
||||
}
|
||||
}
|
||||
|
||||
// Validate performs basic genesis state validation returning an error upon any
|
||||
// failure.
|
||||
func (gs GenesisState) Validate() error {
|
||||
// this line is used by starport scaffolding # genesis/types/validate
|
||||
|
||||
return gs.Params.Validate()
|
||||
}
|
||||
|
||||
// DefaultParams returns default module parameters.
|
||||
func DefaultParams() Params {
|
||||
return Params{
|
||||
PropertyAllowlist: []string{
|
||||
"email",
|
||||
"phone",
|
||||
},
|
||||
AssertionRewardRate: 0.35,
|
||||
EncryptionRewardRate: 0.5,
|
||||
WhitelistedOrigins: []string{
|
||||
"sonr.local",
|
||||
"sonr.id",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// Stringer method for Params.
|
||||
func (p Params) String() string {
|
||||
bz, err := json.Marshal(p)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
return string(bz)
|
||||
}
|
||||
|
||||
// Validate does the sanity check on the params.
|
||||
func (p Params) Validate() error {
|
||||
// TODO:
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,947 @@
|
||||
// Code generated by protoc-gen-gogo. DO NOT EDIT.
|
||||
// source: did/v1/genesis.proto
|
||||
|
||||
package types
|
||||
|
||||
import (
|
||||
encoding_binary "encoding/binary"
|
||||
fmt "fmt"
|
||||
_ "github.com/cosmos/cosmos-sdk/types/tx/amino"
|
||||
_ "github.com/cosmos/gogoproto/gogoproto"
|
||||
proto "github.com/cosmos/gogoproto/proto"
|
||||
io "io"
|
||||
math "math"
|
||||
math_bits "math/bits"
|
||||
)
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the proto package it is being compiled against.
|
||||
// A compilation error at this line likely means your copy of the
|
||||
// proto package needs to be updated.
|
||||
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
|
||||
|
||||
// GenesisState defines the module genesis state
|
||||
type GenesisState struct {
|
||||
// Params defines all the paramaters of the module.
|
||||
Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"`
|
||||
}
|
||||
|
||||
func (m *GenesisState) Reset() { *m = GenesisState{} }
|
||||
func (m *GenesisState) String() string { return proto.CompactTextString(m) }
|
||||
func (*GenesisState) ProtoMessage() {}
|
||||
func (*GenesisState) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_fda181cae44f7c00, []int{0}
|
||||
}
|
||||
func (m *GenesisState) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_GenesisState.Marshal(b, m, deterministic)
|
||||
} else {
|
||||
b = b[:cap(b)]
|
||||
n, err := m.MarshalToSizedBuffer(b)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return b[:n], nil
|
||||
}
|
||||
}
|
||||
func (m *GenesisState) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_GenesisState.Merge(m, src)
|
||||
}
|
||||
func (m *GenesisState) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *GenesisState) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_GenesisState.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_GenesisState proto.InternalMessageInfo
|
||||
|
||||
func (m *GenesisState) GetParams() Params {
|
||||
if m != nil {
|
||||
return m.Params
|
||||
}
|
||||
return Params{}
|
||||
}
|
||||
|
||||
// Params defines the set of module parameters.
|
||||
type Params struct {
|
||||
// Property Allowlist
|
||||
PropertyAllowlist []string `protobuf:"bytes,2,rep,name=property_allowlist,json=propertyAllowlist,proto3" json:"property_allowlist,omitempty"`
|
||||
// Whitelisted Verifications
|
||||
WhitelistedOrigins []string `protobuf:"bytes,3,rep,name=whitelisted_origins,json=whitelistedOrigins,proto3" json:"whitelisted_origins,omitempty"`
|
||||
// Assertion Reward Rate
|
||||
AssertionRewardRate float64 `protobuf:"fixed64,4,opt,name=assertion_reward_rate,json=assertionRewardRate,proto3" json:"assertion_reward_rate,omitempty"`
|
||||
// Encryption Reward Rate
|
||||
EncryptionRewardRate float64 `protobuf:"fixed64,5,opt,name=encryption_reward_rate,json=encryptionRewardRate,proto3" json:"encryption_reward_rate,omitempty"`
|
||||
}
|
||||
|
||||
func (m *Params) Reset() { *m = Params{} }
|
||||
func (*Params) ProtoMessage() {}
|
||||
func (*Params) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_fda181cae44f7c00, []int{1}
|
||||
}
|
||||
func (m *Params) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_Params.Marshal(b, m, deterministic)
|
||||
} else {
|
||||
b = b[:cap(b)]
|
||||
n, err := m.MarshalToSizedBuffer(b)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return b[:n], nil
|
||||
}
|
||||
}
|
||||
func (m *Params) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_Params.Merge(m, src)
|
||||
}
|
||||
func (m *Params) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *Params) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_Params.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_Params proto.InternalMessageInfo
|
||||
|
||||
func (m *Params) GetPropertyAllowlist() []string {
|
||||
if m != nil {
|
||||
return m.PropertyAllowlist
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Params) GetWhitelistedOrigins() []string {
|
||||
if m != nil {
|
||||
return m.WhitelistedOrigins
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Params) GetAssertionRewardRate() float64 {
|
||||
if m != nil {
|
||||
return m.AssertionRewardRate
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *Params) GetEncryptionRewardRate() float64 {
|
||||
if m != nil {
|
||||
return m.EncryptionRewardRate
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// PublicKey is the struct that represents a public key
|
||||
type PublicKey struct {
|
||||
// Key is the public key
|
||||
Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
|
||||
// Type is the type of the public key
|
||||
KeyType string `protobuf:"bytes,2,opt,name=key_type,json=keyType,proto3" json:"key_type,omitempty"`
|
||||
// DID is the DID of the public key
|
||||
Did string `protobuf:"bytes,3,opt,name=did,proto3" json:"did,omitempty"`
|
||||
}
|
||||
|
||||
func (m *PublicKey) Reset() { *m = PublicKey{} }
|
||||
func (*PublicKey) ProtoMessage() {}
|
||||
func (*PublicKey) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_fda181cae44f7c00, []int{2}
|
||||
}
|
||||
func (m *PublicKey) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *PublicKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_PublicKey.Marshal(b, m, deterministic)
|
||||
} else {
|
||||
b = b[:cap(b)]
|
||||
n, err := m.MarshalToSizedBuffer(b)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return b[:n], nil
|
||||
}
|
||||
}
|
||||
func (m *PublicKey) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_PublicKey.Merge(m, src)
|
||||
}
|
||||
func (m *PublicKey) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *PublicKey) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_PublicKey.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_PublicKey proto.InternalMessageInfo
|
||||
|
||||
func (m *PublicKey) GetKey() []byte {
|
||||
if m != nil {
|
||||
return m.Key
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *PublicKey) GetKeyType() string {
|
||||
if m != nil {
|
||||
return m.KeyType
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *PublicKey) GetDid() string {
|
||||
if m != nil {
|
||||
return m.Did
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*GenesisState)(nil), "did.v1.GenesisState")
|
||||
proto.RegisterType((*Params)(nil), "did.v1.Params")
|
||||
proto.RegisterType((*PublicKey)(nil), "did.v1.PublicKey")
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("did/v1/genesis.proto", fileDescriptor_fda181cae44f7c00) }
|
||||
|
||||
var fileDescriptor_fda181cae44f7c00 = []byte{
|
||||
// 420 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x91, 0xb1, 0x6e, 0x14, 0x31,
|
||||
0x10, 0x86, 0xd7, 0xb9, 0x70, 0x70, 0x26, 0x20, 0xe2, 0x1c, 0xb0, 0xa4, 0xd8, 0x5b, 0x9d, 0x28,
|
||||
0x56, 0x11, 0x59, 0x2b, 0x81, 0x2a, 0x4a, 0x43, 0x1a, 0x0a, 0x0a, 0xa2, 0x85, 0x8a, 0x66, 0xe5,
|
||||
0x3b, 0x0f, 0x1b, 0x6b, 0xf7, 0xd6, 0x96, 0xed, 0xe4, 0xf0, 0x2b, 0x50, 0x21, 0x2a, 0xca, 0x3c,
|
||||
0x42, 0x1e, 0x23, 0x65, 0x4a, 0x2a, 0x84, 0xee, 0x8a, 0x20, 0xf1, 0x12, 0xc8, 0xde, 0x84, 0x20,
|
||||
0xa5, 0xb1, 0xc6, 0xff, 0x37, 0xf3, 0x8f, 0x67, 0x8c, 0x87, 0x5c, 0x70, 0x7a, 0xb2, 0x43, 0x2b,
|
||||
0x68, 0xc1, 0x08, 0x93, 0x2b, 0x2d, 0xad, 0x24, 0x7d, 0x2e, 0x78, 0x7e, 0xb2, 0xb3, 0x39, 0xac,
|
||||
0x64, 0x25, 0x83, 0x44, 0x7d, 0xd4, 0xd1, 0xcd, 0x75, 0x36, 0x13, 0xad, 0xa4, 0xe1, 0xec, 0xa4,
|
||||
0xf1, 0x3e, 0x5e, 0x7b, 0xd3, 0x39, 0xbc, 0xb7, 0xcc, 0x02, 0x79, 0x81, 0xfb, 0x8a, 0x69, 0x36,
|
||||
0x33, 0x31, 0x4a, 0x51, 0x76, 0x7f, 0xf7, 0x61, 0xde, 0x39, 0xe6, 0x87, 0x41, 0x3d, 0x58, 0x3d,
|
||||
0xff, 0x39, 0x8a, 0x8a, 0xab, 0x9c, 0xf1, 0x1f, 0x84, 0xfb, 0x1d, 0x20, 0xdb, 0x98, 0x28, 0x2d,
|
||||
0x15, 0x68, 0xeb, 0x4a, 0xd6, 0x34, 0x72, 0xde, 0x08, 0x63, 0xe3, 0x95, 0xb4, 0x97, 0x0d, 0x8a,
|
||||
0xf5, 0x6b, 0xf2, 0xfa, 0x1a, 0x10, 0x8a, 0x37, 0xe6, 0x47, 0xc2, 0x82, 0xbf, 0x00, 0x2f, 0xa5,
|
||||
0x16, 0x95, 0x68, 0x4d, 0xdc, 0x0b, 0xf9, 0xe4, 0x3f, 0xf4, 0xae, 0x23, 0x64, 0x17, 0x3f, 0x66,
|
||||
0xc6, 0x80, 0xb6, 0x42, 0xb6, 0xa5, 0x86, 0x39, 0xd3, 0xbc, 0xd4, 0xcc, 0x42, 0xbc, 0x9a, 0xa2,
|
||||
0x0c, 0x15, 0x1b, 0xff, 0x60, 0x11, 0x58, 0xe1, 0x87, 0x79, 0x85, 0x9f, 0x40, 0x3b, 0xd5, 0x4e,
|
||||
0xdd, 0x2a, 0xba, 0x13, 0x8a, 0x86, 0x37, 0xf4, 0xa6, 0x6a, 0xef, 0xe9, 0xf7, 0xd3, 0x51, 0xf4,
|
||||
0xfb, 0x74, 0x84, 0xbe, 0x5c, 0x9e, 0x6d, 0x61, 0xbf, 0xe6, 0xab, 0x69, 0x15, 0x1e, 0x1c, 0x1e,
|
||||
0x4f, 0x1a, 0x31, 0x7d, 0x0b, 0x8e, 0x3c, 0xc2, 0xbd, 0x1a, 0x5c, 0xd8, 0xd2, 0x5a, 0xe1, 0x43,
|
||||
0xf2, 0x0c, 0xdf, 0xab, 0xc1, 0x95, 0xd6, 0x29, 0x88, 0x57, 0x52, 0x94, 0x0d, 0x8a, 0xbb, 0x35,
|
||||
0xb8, 0x0f, 0x4e, 0x81, 0x4f, 0xe6, 0x82, 0xc7, 0xbd, 0xa0, 0xfa, 0x70, 0xef, 0xb9, 0x6f, 0xe2,
|
||||
0x1b, 0x3c, 0x08, 0x0d, 0x82, 0x6d, 0x0d, 0xee, 0xdb, 0xe5, 0xd9, 0xd6, 0xc0, 0xbb, 0x7c, 0x12,
|
||||
0xd0, 0xf0, 0x83, 0xfd, 0xf3, 0x45, 0x82, 0x2e, 0x16, 0x09, 0xfa, 0xb5, 0x48, 0xd0, 0xd7, 0x65,
|
||||
0x12, 0x5d, 0x2c, 0x93, 0xe8, 0xc7, 0x32, 0x89, 0x3e, 0x8e, 0x2b, 0x61, 0x8f, 0x8e, 0x27, 0xf9,
|
||||
0x54, 0xce, 0x28, 0x17, 0xdb, 0x9c, 0x49, 0x6a, 0x64, 0xab, 0xe9, 0x67, 0xea, 0xfd, 0xfc, 0x1b,
|
||||
0xcc, 0xa4, 0x1f, 0xbe, 0xf8, 0xe5, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xef, 0xdc, 0x79,
|
||||
0x2b, 0x02, 0x00, 0x00,
|
||||
}
|
||||
|
||||
func (this *Params) Equal(that interface{}) bool {
|
||||
if that == nil {
|
||||
return this == nil
|
||||
}
|
||||
|
||||
that1, ok := that.(*Params)
|
||||
if !ok {
|
||||
that2, ok := that.(Params)
|
||||
if ok {
|
||||
that1 = &that2
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
if that1 == nil {
|
||||
return this == nil
|
||||
} else if this == nil {
|
||||
return false
|
||||
}
|
||||
if len(this.PropertyAllowlist) != len(that1.PropertyAllowlist) {
|
||||
return false
|
||||
}
|
||||
for i := range this.PropertyAllowlist {
|
||||
if this.PropertyAllowlist[i] != that1.PropertyAllowlist[i] {
|
||||
return false
|
||||
}
|
||||
}
|
||||
if len(this.WhitelistedOrigins) != len(that1.WhitelistedOrigins) {
|
||||
return false
|
||||
}
|
||||
for i := range this.WhitelistedOrigins {
|
||||
if this.WhitelistedOrigins[i] != that1.WhitelistedOrigins[i] {
|
||||
return false
|
||||
}
|
||||
}
|
||||
if this.AssertionRewardRate != that1.AssertionRewardRate {
|
||||
return false
|
||||
}
|
||||
if this.EncryptionRewardRate != that1.EncryptionRewardRate {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
func (m *GenesisState) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return dAtA[:n], nil
|
||||
}
|
||||
|
||||
func (m *GenesisState) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
{
|
||||
size, err := m.Params.MarshalToSizedBuffer(dAtA[:i])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i -= size
|
||||
i = encodeVarintGenesis(dAtA, i, uint64(size))
|
||||
}
|
||||
i--
|
||||
dAtA[i] = 0xa
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *Params) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return dAtA[:n], nil
|
||||
}
|
||||
|
||||
func (m *Params) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if m.EncryptionRewardRate != 0 {
|
||||
i -= 8
|
||||
encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.EncryptionRewardRate))))
|
||||
i--
|
||||
dAtA[i] = 0x29
|
||||
}
|
||||
if m.AssertionRewardRate != 0 {
|
||||
i -= 8
|
||||
encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.AssertionRewardRate))))
|
||||
i--
|
||||
dAtA[i] = 0x21
|
||||
}
|
||||
if len(m.WhitelistedOrigins) > 0 {
|
||||
for iNdEx := len(m.WhitelistedOrigins) - 1; iNdEx >= 0; iNdEx-- {
|
||||
i -= len(m.WhitelistedOrigins[iNdEx])
|
||||
copy(dAtA[i:], m.WhitelistedOrigins[iNdEx])
|
||||
i = encodeVarintGenesis(dAtA, i, uint64(len(m.WhitelistedOrigins[iNdEx])))
|
||||
i--
|
||||
dAtA[i] = 0x1a
|
||||
}
|
||||
}
|
||||
if len(m.PropertyAllowlist) > 0 {
|
||||
for iNdEx := len(m.PropertyAllowlist) - 1; iNdEx >= 0; iNdEx-- {
|
||||
i -= len(m.PropertyAllowlist[iNdEx])
|
||||
copy(dAtA[i:], m.PropertyAllowlist[iNdEx])
|
||||
i = encodeVarintGenesis(dAtA, i, uint64(len(m.PropertyAllowlist[iNdEx])))
|
||||
i--
|
||||
dAtA[i] = 0x12
|
||||
}
|
||||
}
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *PublicKey) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return dAtA[:n], nil
|
||||
}
|
||||
|
||||
func (m *PublicKey) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *PublicKey) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if len(m.Did) > 0 {
|
||||
i -= len(m.Did)
|
||||
copy(dAtA[i:], m.Did)
|
||||
i = encodeVarintGenesis(dAtA, i, uint64(len(m.Did)))
|
||||
i--
|
||||
dAtA[i] = 0x1a
|
||||
}
|
||||
if len(m.KeyType) > 0 {
|
||||
i -= len(m.KeyType)
|
||||
copy(dAtA[i:], m.KeyType)
|
||||
i = encodeVarintGenesis(dAtA, i, uint64(len(m.KeyType)))
|
||||
i--
|
||||
dAtA[i] = 0x12
|
||||
}
|
||||
if len(m.Key) > 0 {
|
||||
i -= len(m.Key)
|
||||
copy(dAtA[i:], m.Key)
|
||||
i = encodeVarintGenesis(dAtA, i, uint64(len(m.Key)))
|
||||
i--
|
||||
dAtA[i] = 0xa
|
||||
}
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int {
|
||||
offset -= sovGenesis(v)
|
||||
base := offset
|
||||
for v >= 1<<7 {
|
||||
dAtA[offset] = uint8(v&0x7f | 0x80)
|
||||
v >>= 7
|
||||
offset++
|
||||
}
|
||||
dAtA[offset] = uint8(v)
|
||||
return base
|
||||
}
|
||||
func (m *GenesisState) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
l = m.Params.Size()
|
||||
n += 1 + l + sovGenesis(uint64(l))
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *Params) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
if len(m.PropertyAllowlist) > 0 {
|
||||
for _, s := range m.PropertyAllowlist {
|
||||
l = len(s)
|
||||
n += 1 + l + sovGenesis(uint64(l))
|
||||
}
|
||||
}
|
||||
if len(m.WhitelistedOrigins) > 0 {
|
||||
for _, s := range m.WhitelistedOrigins {
|
||||
l = len(s)
|
||||
n += 1 + l + sovGenesis(uint64(l))
|
||||
}
|
||||
}
|
||||
if m.AssertionRewardRate != 0 {
|
||||
n += 9
|
||||
}
|
||||
if m.EncryptionRewardRate != 0 {
|
||||
n += 9
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *PublicKey) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
l = len(m.Key)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovGenesis(uint64(l))
|
||||
}
|
||||
l = len(m.KeyType)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovGenesis(uint64(l))
|
||||
}
|
||||
l = len(m.Did)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovGenesis(uint64(l))
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func sovGenesis(x uint64) (n int) {
|
||||
return (math_bits.Len64(x|1) + 6) / 7
|
||||
}
|
||||
func sozGenesis(x uint64) (n int) {
|
||||
return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63))))
|
||||
}
|
||||
func (m *GenesisState) Unmarshal(dAtA []byte) error {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
preIndex := iNdEx
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowGenesis
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
fieldNum := int32(wire >> 3)
|
||||
wireType := int(wire & 0x7)
|
||||
if wireType == 4 {
|
||||
return fmt.Errorf("proto: GenesisState: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType)
|
||||
}
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowGenesis
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
msglen |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if msglen < 0 {
|
||||
return ErrInvalidLengthGenesis
|
||||
}
|
||||
postIndex := iNdEx + msglen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthGenesis
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipGenesis(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||
return ErrInvalidLengthGenesis
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *Params) Unmarshal(dAtA []byte) error {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
preIndex := iNdEx
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowGenesis
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
fieldNum := int32(wire >> 3)
|
||||
wireType := int(wire & 0x7)
|
||||
if wireType == 4 {
|
||||
return fmt.Errorf("proto: Params: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 2:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field PropertyAllowlist", wireType)
|
||||
}
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowGenesis
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
stringLen |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
intStringLen := int(stringLen)
|
||||
if intStringLen < 0 {
|
||||
return ErrInvalidLengthGenesis
|
||||
}
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthGenesis
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.PropertyAllowlist = append(m.PropertyAllowlist, string(dAtA[iNdEx:postIndex]))
|
||||
iNdEx = postIndex
|
||||
case 3:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field WhitelistedOrigins", wireType)
|
||||
}
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowGenesis
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
stringLen |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
intStringLen := int(stringLen)
|
||||
if intStringLen < 0 {
|
||||
return ErrInvalidLengthGenesis
|
||||
}
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthGenesis
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.WhitelistedOrigins = append(m.WhitelistedOrigins, string(dAtA[iNdEx:postIndex]))
|
||||
iNdEx = postIndex
|
||||
case 4:
|
||||
if wireType != 1 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field AssertionRewardRate", wireType)
|
||||
}
|
||||
var v uint64
|
||||
if (iNdEx + 8) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
v = uint64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:]))
|
||||
iNdEx += 8
|
||||
m.AssertionRewardRate = float64(math.Float64frombits(v))
|
||||
case 5:
|
||||
if wireType != 1 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field EncryptionRewardRate", wireType)
|
||||
}
|
||||
var v uint64
|
||||
if (iNdEx + 8) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
v = uint64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:]))
|
||||
iNdEx += 8
|
||||
m.EncryptionRewardRate = float64(math.Float64frombits(v))
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipGenesis(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||
return ErrInvalidLengthGenesis
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *PublicKey) Unmarshal(dAtA []byte) error {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
preIndex := iNdEx
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowGenesis
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
fieldNum := int32(wire >> 3)
|
||||
wireType := int(wire & 0x7)
|
||||
if wireType == 4 {
|
||||
return fmt.Errorf("proto: PublicKey: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: PublicKey: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType)
|
||||
}
|
||||
var byteLen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowGenesis
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
byteLen |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if byteLen < 0 {
|
||||
return ErrInvalidLengthGenesis
|
||||
}
|
||||
postIndex := iNdEx + byteLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthGenesis
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...)
|
||||
if m.Key == nil {
|
||||
m.Key = []byte{}
|
||||
}
|
||||
iNdEx = postIndex
|
||||
case 2:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field KeyType", wireType)
|
||||
}
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowGenesis
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
stringLen |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
intStringLen := int(stringLen)
|
||||
if intStringLen < 0 {
|
||||
return ErrInvalidLengthGenesis
|
||||
}
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthGenesis
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.KeyType = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 3:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Did", wireType)
|
||||
}
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowGenesis
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
stringLen |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
intStringLen := int(stringLen)
|
||||
if intStringLen < 0 {
|
||||
return ErrInvalidLengthGenesis
|
||||
}
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthGenesis
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.Did = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipGenesis(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||
return ErrInvalidLengthGenesis
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func skipGenesis(dAtA []byte) (n int, err error) {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
depth := 0
|
||||
for iNdEx < l {
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowGenesis
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= (uint64(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
wireType := int(wire & 0x7)
|
||||
switch wireType {
|
||||
case 0:
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowGenesis
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx++
|
||||
if dAtA[iNdEx-1] < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
case 1:
|
||||
iNdEx += 8
|
||||
case 2:
|
||||
var length int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowGenesis
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
length |= (int(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if length < 0 {
|
||||
return 0, ErrInvalidLengthGenesis
|
||||
}
|
||||
iNdEx += length
|
||||
case 3:
|
||||
depth++
|
||||
case 4:
|
||||
if depth == 0 {
|
||||
return 0, ErrUnexpectedEndOfGroupGenesis
|
||||
}
|
||||
depth--
|
||||
case 5:
|
||||
iNdEx += 4
|
||||
default:
|
||||
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
|
||||
}
|
||||
if iNdEx < 0 {
|
||||
return 0, ErrInvalidLengthGenesis
|
||||
}
|
||||
if depth == 0 {
|
||||
return iNdEx, nil
|
||||
}
|
||||
}
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
|
||||
var (
|
||||
ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling")
|
||||
ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow")
|
||||
ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group")
|
||||
)
|
||||
@@ -0,0 +1,42 @@
|
||||
package types_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/onsonr/hway/x/did/types"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestGenesisState_Validate(t *testing.T) {
|
||||
tests := []struct {
|
||||
desc string
|
||||
genState *types.GenesisState
|
||||
valid bool
|
||||
}{
|
||||
{
|
||||
desc: "default is valid",
|
||||
genState: types.DefaultGenesis(),
|
||||
valid: true,
|
||||
},
|
||||
{
|
||||
desc: "valid genesis state",
|
||||
genState: &types.GenesisState{
|
||||
|
||||
// this line is used by starport scaffolding # types/genesis/validField
|
||||
},
|
||||
valid: true,
|
||||
},
|
||||
// this line is used by starport scaffolding # types/genesis/testcase
|
||||
}
|
||||
for _, tc := range tests {
|
||||
t.Run(tc.desc, func(t *testing.T) {
|
||||
err := tc.genState.Validate()
|
||||
if tc.valid {
|
||||
require.NoError(t, err)
|
||||
} else {
|
||||
require.Error(t, err)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package types
|
||||
|
||||
import (
|
||||
"cosmossdk.io/collections"
|
||||
|
||||
ormv1alpha1 "cosmossdk.io/api/cosmos/orm/v1alpha1"
|
||||
)
|
||||
|
||||
var (
|
||||
// ParamsKey saves the current module params.
|
||||
ParamsKey = collections.NewPrefix(0)
|
||||
)
|
||||
|
||||
const (
|
||||
ModuleName = "did"
|
||||
|
||||
StoreKey = ModuleName
|
||||
|
||||
QuerierRoute = ModuleName
|
||||
)
|
||||
|
||||
var ORMModuleSchema = ormv1alpha1.ModuleSchemaDescriptor{
|
||||
SchemaFile: []*ormv1alpha1.ModuleSchemaDescriptor_FileEntry{
|
||||
{Id: 1, ProtoFileName: "did/v1/state.proto"},
|
||||
},
|
||||
Prefix: []byte{0},
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package types
|
||||
|
||||
import (
|
||||
"cosmossdk.io/errors"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
)
|
||||
|
||||
var _ sdk.Msg = &MsgUpdateParams{}
|
||||
|
||||
// NewMsgUpdateParams creates new instance of MsgUpdateParams
|
||||
func NewMsgUpdateParams(
|
||||
sender sdk.Address,
|
||||
someValue bool,
|
||||
) *MsgUpdateParams {
|
||||
return &MsgUpdateParams{
|
||||
Authority: sender.String(),
|
||||
Params: DefaultParams(),
|
||||
}
|
||||
}
|
||||
|
||||
// Route returns the name of the module
|
||||
func (msg MsgUpdateParams) Route() string { return ModuleName }
|
||||
|
||||
// Type returns the the action
|
||||
func (msg MsgUpdateParams) Type() string { return "update_params" }
|
||||
|
||||
// GetSignBytes implements the LegacyMsg interface.
|
||||
func (msg MsgUpdateParams) GetSignBytes() []byte {
|
||||
return sdk.MustSortJSON(AminoCdc.MustMarshalJSON(&msg))
|
||||
}
|
||||
|
||||
// GetSigners returns the expected signers for a MsgUpdateParams message.
|
||||
func (msg *MsgUpdateParams) GetSigners() []sdk.AccAddress {
|
||||
addr, _ := sdk.AccAddressFromBech32(msg.Authority)
|
||||
return []sdk.AccAddress{addr}
|
||||
}
|
||||
|
||||
// ValidateBasic does a sanity check on the provided data.
|
||||
func (msg *MsgUpdateParams) Validate() error {
|
||||
if _, err := sdk.AccAddressFromBech32(msg.Authority); err != nil {
|
||||
return errors.Wrap(err, "invalid authority address")
|
||||
}
|
||||
|
||||
return msg.Params.Validate()
|
||||
}
|
||||
|
||||
// NewMsgInitializeController creates a new instance of MsgInitializeController
|
||||
func NewMsgInitializeController(
|
||||
sender sdk.Address,
|
||||
) (*MsgInitializeController, error) {
|
||||
return &MsgInitializeController{
|
||||
Authority: sender.String(),
|
||||
}, nil
|
||||
}
|
||||
|
||||
// Route returns the name of the module
|
||||
func (msg MsgInitializeController) Route() string { return ModuleName }
|
||||
|
||||
// Type returns the the action
|
||||
func (msg MsgInitializeController) Type() string { return "initialize_controller" }
|
||||
|
||||
// GetSignBytes implements the LegacyMsg interface.
|
||||
func (msg MsgInitializeController) GetSignBytes() []byte {
|
||||
return sdk.MustSortJSON(AminoCdc.MustMarshalJSON(&msg))
|
||||
}
|
||||
|
||||
// GetSigners returns the expected signers for a MsgUpdateParams message.
|
||||
func (msg *MsgInitializeController) GetSigners() []sdk.AccAddress {
|
||||
addr, _ := sdk.AccAddressFromBech32(msg.Authority)
|
||||
return []sdk.AccAddress{addr}
|
||||
}
|
||||
|
||||
// ValidateBasic does a sanity check on the provided data.
|
||||
func (msg *MsgInitializeController) Validate() error {
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package types
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/hex"
|
||||
fmt "fmt"
|
||||
"math/big"
|
||||
|
||||
cmtcrypto "github.com/cometbft/cometbft/crypto"
|
||||
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
|
||||
"golang.org/x/crypto/sha3"
|
||||
|
||||
"github.com/onsonr/hway/crypto/core/curves"
|
||||
"github.com/onsonr/hway/crypto/signatures/ecdsa"
|
||||
)
|
||||
|
||||
// Address returns the address of the public key
|
||||
func (k *PublicKey) Address() cryptotypes.Address {
|
||||
return cmtcrypto.AddressHash(k.Key)
|
||||
}
|
||||
|
||||
// Bytes returns the byte representation of the public key
|
||||
func (k *PublicKey) Bytes() []byte {
|
||||
return k.Key
|
||||
}
|
||||
|
||||
// String returns the hex string representation of the public key
|
||||
func (k *PublicKey) String() string {
|
||||
return hex.EncodeToString(k.Key)
|
||||
}
|
||||
|
||||
// VerifySignature verifies the signature of a message
|
||||
func (k *PublicKey) VerifySignature(msg []byte, sig []byte) bool {
|
||||
pp, err := BuildEcPoint(k.Key)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
sigEd, err := ecdsa.DeserializeSecp256k1Signature(sig)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
hash := sha3.New256()
|
||||
_, err = hash.Write(msg)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
digest := hash.Sum(nil)
|
||||
return curves.VerifyEcdsa(pp, digest[:], sigEd)
|
||||
}
|
||||
|
||||
// Equals returns true if the public keys are equal
|
||||
func (k *PublicKey) Equals(other cryptotypes.PubKey) bool {
|
||||
return bytes.Equal(k.Key, other.Bytes())
|
||||
}
|
||||
|
||||
// Type returns the public key type
|
||||
func (k *PublicKey) Type() string {
|
||||
return k.KeyType
|
||||
}
|
||||
|
||||
// BuildEcPoint builds an elliptic curve point from a compressed byte slice
|
||||
func BuildEcPoint(pubKey []byte) (*curves.EcPoint, error) {
|
||||
crv := curves.K256()
|
||||
x := new(big.Int).SetBytes(pubKey[1:33])
|
||||
y := new(big.Int).SetBytes(pubKey[33:])
|
||||
ecCurve, err := crv.ToEllipticCurve()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error converting curve: %v", err)
|
||||
}
|
||||
return &curves.EcPoint{X: x, Y: y, Curve: ecCurve}, nil
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,623 @@
|
||||
// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
|
||||
// source: did/v1/query.proto
|
||||
|
||||
/*
|
||||
Package types is a reverse proxy.
|
||||
|
||||
It translates gRPC into RESTful JSON APIs.
|
||||
*/
|
||||
package types
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/golang/protobuf/descriptor"
|
||||
"github.com/golang/protobuf/proto"
|
||||
"github.com/grpc-ecosystem/grpc-gateway/runtime"
|
||||
"github.com/grpc-ecosystem/grpc-gateway/utilities"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/grpclog"
|
||||
"google.golang.org/grpc/metadata"
|
||||
"google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
// Suppress "imported and not used" errors
|
||||
var _ codes.Code
|
||||
var _ io.Reader
|
||||
var _ status.Status
|
||||
var _ = runtime.String
|
||||
var _ = utilities.NewDoubleArray
|
||||
var _ = descriptor.ForMessage
|
||||
var _ = metadata.Join
|
||||
|
||||
func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq QueryParamsRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq QueryParamsRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
msg, err := server.Params(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func request_Query_PropertyExists_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq QueryExistsRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
var (
|
||||
val string
|
||||
ok bool
|
||||
err error
|
||||
_ = err
|
||||
)
|
||||
|
||||
val, ok = pathParams["kind"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "kind")
|
||||
}
|
||||
|
||||
protoReq.Kind, err = runtime.String(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "kind", err)
|
||||
}
|
||||
|
||||
val, ok = pathParams["value"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "value")
|
||||
}
|
||||
|
||||
protoReq.Value, err = runtime.String(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "value", err)
|
||||
}
|
||||
|
||||
msg, err := client.PropertyExists(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func local_request_Query_PropertyExists_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq QueryExistsRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
var (
|
||||
val string
|
||||
ok bool
|
||||
err error
|
||||
_ = err
|
||||
)
|
||||
|
||||
val, ok = pathParams["kind"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "kind")
|
||||
}
|
||||
|
||||
protoReq.Kind, err = runtime.String(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "kind", err)
|
||||
}
|
||||
|
||||
val, ok = pathParams["value"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "value")
|
||||
}
|
||||
|
||||
protoReq.Value, err = runtime.String(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "value", err)
|
||||
}
|
||||
|
||||
msg, err := server.PropertyExists(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func request_Query_ResolveIdentifier_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq QueryResolveRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
var (
|
||||
val string
|
||||
ok bool
|
||||
err error
|
||||
_ = err
|
||||
)
|
||||
|
||||
val, ok = pathParams["id"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id")
|
||||
}
|
||||
|
||||
protoReq.Id, err = runtime.String(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err)
|
||||
}
|
||||
|
||||
msg, err := client.ResolveIdentifier(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func local_request_Query_ResolveIdentifier_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq QueryResolveRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
var (
|
||||
val string
|
||||
ok bool
|
||||
err error
|
||||
_ = err
|
||||
)
|
||||
|
||||
val, ok = pathParams["id"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id")
|
||||
}
|
||||
|
||||
protoReq.Id, err = runtime.String(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err)
|
||||
}
|
||||
|
||||
msg, err := server.ResolveIdentifier(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func request_Query_LoginOptions_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq QueryLoginOptionsRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
var (
|
||||
val string
|
||||
ok bool
|
||||
err error
|
||||
_ = err
|
||||
)
|
||||
|
||||
val, ok = pathParams["origin"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "origin")
|
||||
}
|
||||
|
||||
protoReq.Origin, err = runtime.String(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "origin", err)
|
||||
}
|
||||
|
||||
val, ok = pathParams["handle"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "handle")
|
||||
}
|
||||
|
||||
protoReq.Handle, err = runtime.String(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "handle", err)
|
||||
}
|
||||
|
||||
msg, err := client.LoginOptions(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func local_request_Query_LoginOptions_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq QueryLoginOptionsRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
var (
|
||||
val string
|
||||
ok bool
|
||||
err error
|
||||
_ = err
|
||||
)
|
||||
|
||||
val, ok = pathParams["origin"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "origin")
|
||||
}
|
||||
|
||||
protoReq.Origin, err = runtime.String(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "origin", err)
|
||||
}
|
||||
|
||||
val, ok = pathParams["handle"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "handle")
|
||||
}
|
||||
|
||||
protoReq.Handle, err = runtime.String(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "handle", err)
|
||||
}
|
||||
|
||||
msg, err := server.LoginOptions(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func request_Query_RegisterOptions_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq QueryRegisterOptionsRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
var (
|
||||
val string
|
||||
ok bool
|
||||
err error
|
||||
_ = err
|
||||
)
|
||||
|
||||
val, ok = pathParams["origin"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "origin")
|
||||
}
|
||||
|
||||
protoReq.Origin, err = runtime.String(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "origin", err)
|
||||
}
|
||||
|
||||
val, ok = pathParams["handle"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "handle")
|
||||
}
|
||||
|
||||
protoReq.Handle, err = runtime.String(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "handle", err)
|
||||
}
|
||||
|
||||
msg, err := client.RegisterOptions(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func local_request_Query_RegisterOptions_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq QueryRegisterOptionsRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
var (
|
||||
val string
|
||||
ok bool
|
||||
err error
|
||||
_ = err
|
||||
)
|
||||
|
||||
val, ok = pathParams["origin"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "origin")
|
||||
}
|
||||
|
||||
protoReq.Origin, err = runtime.String(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "origin", err)
|
||||
}
|
||||
|
||||
val, ok = pathParams["handle"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "handle")
|
||||
}
|
||||
|
||||
protoReq.Handle, err = runtime.String(val)
|
||||
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "handle", err)
|
||||
}
|
||||
|
||||
msg, err := server.RegisterOptions(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
// RegisterQueryHandlerServer registers the http handlers for service Query to "mux".
|
||||
// UnaryRPC :call QueryServer directly.
|
||||
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
|
||||
// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead.
|
||||
func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error {
|
||||
|
||||
mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
var stream runtime.ServerTransportStream
|
||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams)
|
||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Query_PropertyExists_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
var stream runtime.ServerTransportStream
|
||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_Query_PropertyExists_0(rctx, inboundMarshaler, server, req, pathParams)
|
||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_Query_PropertyExists_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Query_ResolveIdentifier_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
var stream runtime.ServerTransportStream
|
||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_Query_ResolveIdentifier_0(rctx, inboundMarshaler, server, req, pathParams)
|
||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_Query_ResolveIdentifier_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Query_LoginOptions_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
var stream runtime.ServerTransportStream
|
||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_Query_LoginOptions_0(rctx, inboundMarshaler, server, req, pathParams)
|
||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_Query_LoginOptions_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Query_RegisterOptions_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
var stream runtime.ServerTransportStream
|
||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_Query_RegisterOptions_0(rctx, inboundMarshaler, server, req, pathParams)
|
||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_Query_RegisterOptions_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but
|
||||
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
|
||||
func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
|
||||
conn, err := grpc.Dial(endpoint, opts...)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer func() {
|
||||
if err != nil {
|
||||
if cerr := conn.Close(); cerr != nil {
|
||||
grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
|
||||
}
|
||||
return
|
||||
}
|
||||
go func() {
|
||||
<-ctx.Done()
|
||||
if cerr := conn.Close(); cerr != nil {
|
||||
grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
|
||||
}
|
||||
}()
|
||||
}()
|
||||
|
||||
return RegisterQueryHandler(ctx, mux, conn)
|
||||
}
|
||||
|
||||
// RegisterQueryHandler registers the http handlers for service Query to "mux".
|
||||
// The handlers forward requests to the grpc endpoint over "conn".
|
||||
func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
|
||||
return RegisterQueryHandlerClient(ctx, mux, NewQueryClient(conn))
|
||||
}
|
||||
|
||||
// RegisterQueryHandlerClient registers the http handlers for service Query
|
||||
// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient".
|
||||
// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient"
|
||||
// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
|
||||
// "QueryClient" to call the correct interceptors.
|
||||
func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error {
|
||||
|
||||
mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateContext(ctx, mux, req)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_Query_Params_0(rctx, inboundMarshaler, client, req, pathParams)
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Query_PropertyExists_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateContext(ctx, mux, req)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_Query_PropertyExists_0(rctx, inboundMarshaler, client, req, pathParams)
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_Query_PropertyExists_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Query_ResolveIdentifier_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateContext(ctx, mux, req)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_Query_ResolveIdentifier_0(rctx, inboundMarshaler, client, req, pathParams)
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_Query_ResolveIdentifier_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Query_LoginOptions_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateContext(ctx, mux, req)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_Query_LoginOptions_0(rctx, inboundMarshaler, client, req, pathParams)
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_Query_LoginOptions_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Query_RegisterOptions_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateContext(ctx, mux, req)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_Query_RegisterOptions_0(rctx, inboundMarshaler, client, req, pathParams)
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_Query_RegisterOptions_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
var (
|
||||
pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"did", "params"}, "", runtime.AssumeColonVerbOpt(false)))
|
||||
|
||||
pattern_Query_PropertyExists_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 1, 0, 4, 1, 5, 3}, []string{"did", "exists", "kind", "value"}, "", runtime.AssumeColonVerbOpt(false)))
|
||||
|
||||
pattern_Query_ResolveIdentifier_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"did", "resolve", "id"}, "", runtime.AssumeColonVerbOpt(false)))
|
||||
|
||||
pattern_Query_LoginOptions_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 1, 0, 4, 1, 5, 3, 2, 4}, []string{"did", "login", "origin", "handle", "options"}, "", runtime.AssumeColonVerbOpt(false)))
|
||||
|
||||
pattern_Query_RegisterOptions_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 1, 0, 4, 1, 5, 3, 2, 4}, []string{"did", "register", "origin", "handle", "options"}, "", runtime.AssumeColonVerbOpt(false)))
|
||||
)
|
||||
|
||||
var (
|
||||
forward_Query_Params_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_Query_PropertyExists_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_Query_ResolveIdentifier_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_Query_LoginOptions_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_Query_RegisterOptions_0 = runtime.ForwardResponseMessage
|
||||
)
|
||||
@@ -0,0 +1,4 @@
|
||||
package types
|
||||
|
||||
// ByteArray is a list of byte arrays
|
||||
type ByteArray = [][]byte
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user