refactor: remove unused code related to whitelisted assets

This commit is contained in:
Prad Nukala 2024-09-27 20:58:05 -04:00
parent 88a3d9da1c
commit 92ff87cc2c
57 changed files with 25331 additions and 15090 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -9,123 +9,123 @@ import (
ormerrors "cosmossdk.io/orm/types/ormerrors" ormerrors "cosmossdk.io/orm/types/ormerrors"
) )
type AliasTable interface { type AuthenticationTable interface {
Insert(ctx context.Context, alias *Alias) error Insert(ctx context.Context, authentication *Authentication) error
Update(ctx context.Context, alias *Alias) error Update(ctx context.Context, authentication *Authentication) error
Save(ctx context.Context, alias *Alias) error Save(ctx context.Context, authentication *Authentication) error
Delete(ctx context.Context, alias *Alias) error Delete(ctx context.Context, authentication *Authentication) error
Has(ctx context.Context, id string) (found bool, err error) Has(ctx context.Context, did string) (found bool, err error)
// Get returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found. // Get returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
Get(ctx context.Context, id string) (*Alias, error) Get(ctx context.Context, did string) (*Authentication, error)
HasBySubjectOrigin(ctx context.Context, subject string, origin string) (found bool, err error) HasByControllerSubject(ctx context.Context, controller string, subject string) (found bool, err error)
// GetBySubjectOrigin returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found. // GetByControllerSubject returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
GetBySubjectOrigin(ctx context.Context, subject string, origin string) (*Alias, error) GetByControllerSubject(ctx context.Context, controller string, subject string) (*Authentication, error)
List(ctx context.Context, prefixKey AliasIndexKey, opts ...ormlist.Option) (AliasIterator, error) List(ctx context.Context, prefixKey AuthenticationIndexKey, opts ...ormlist.Option) (AuthenticationIterator, error)
ListRange(ctx context.Context, from, to AliasIndexKey, opts ...ormlist.Option) (AliasIterator, error) ListRange(ctx context.Context, from, to AuthenticationIndexKey, opts ...ormlist.Option) (AuthenticationIterator, error)
DeleteBy(ctx context.Context, prefixKey AliasIndexKey) error DeleteBy(ctx context.Context, prefixKey AuthenticationIndexKey) error
DeleteRange(ctx context.Context, from, to AliasIndexKey) error DeleteRange(ctx context.Context, from, to AuthenticationIndexKey) error
doNotImplement() doNotImplement()
} }
type AliasIterator struct { type AuthenticationIterator struct {
ormtable.Iterator ormtable.Iterator
} }
func (i AliasIterator) Value() (*Alias, error) { func (i AuthenticationIterator) Value() (*Authentication, error) {
var alias Alias var authentication Authentication
err := i.UnmarshalMessage(&alias) err := i.UnmarshalMessage(&authentication)
return &alias, err return &authentication, err
} }
type AliasIndexKey interface { type AuthenticationIndexKey interface {
id() uint32 id() uint32
values() []interface{} values() []interface{}
aliasIndexKey() authenticationIndexKey()
} }
// primary key starting index.. // primary key starting index..
type AliasPrimaryKey = AliasIdIndexKey type AuthenticationPrimaryKey = AuthenticationDidIndexKey
type AliasIdIndexKey struct { type AuthenticationDidIndexKey struct {
vs []interface{} vs []interface{}
} }
func (x AliasIdIndexKey) id() uint32 { return 0 } func (x AuthenticationDidIndexKey) id() uint32 { return 0 }
func (x AliasIdIndexKey) values() []interface{} { return x.vs } func (x AuthenticationDidIndexKey) values() []interface{} { return x.vs }
func (x AliasIdIndexKey) aliasIndexKey() {} func (x AuthenticationDidIndexKey) authenticationIndexKey() {}
func (this AliasIdIndexKey) WithId(id string) AliasIdIndexKey { func (this AuthenticationDidIndexKey) WithDid(did string) AuthenticationDidIndexKey {
this.vs = []interface{}{id} this.vs = []interface{}{did}
return this return this
} }
type AliasSubjectOriginIndexKey struct { type AuthenticationControllerSubjectIndexKey struct {
vs []interface{} vs []interface{}
} }
func (x AliasSubjectOriginIndexKey) id() uint32 { return 1 } func (x AuthenticationControllerSubjectIndexKey) id() uint32 { return 1 }
func (x AliasSubjectOriginIndexKey) values() []interface{} { return x.vs } func (x AuthenticationControllerSubjectIndexKey) values() []interface{} { return x.vs }
func (x AliasSubjectOriginIndexKey) aliasIndexKey() {} func (x AuthenticationControllerSubjectIndexKey) authenticationIndexKey() {}
func (this AliasSubjectOriginIndexKey) WithSubject(subject string) AliasSubjectOriginIndexKey { func (this AuthenticationControllerSubjectIndexKey) WithController(controller string) AuthenticationControllerSubjectIndexKey {
this.vs = []interface{}{subject} this.vs = []interface{}{controller}
return this return this
} }
func (this AliasSubjectOriginIndexKey) WithSubjectOrigin(subject string, origin string) AliasSubjectOriginIndexKey { func (this AuthenticationControllerSubjectIndexKey) WithControllerSubject(controller string, subject string) AuthenticationControllerSubjectIndexKey {
this.vs = []interface{}{subject, origin} this.vs = []interface{}{controller, subject}
return this return this
} }
type aliasTable struct { type authenticationTable struct {
table ormtable.Table table ormtable.Table
} }
func (this aliasTable) Insert(ctx context.Context, alias *Alias) error { func (this authenticationTable) Insert(ctx context.Context, authentication *Authentication) error {
return this.table.Insert(ctx, alias) return this.table.Insert(ctx, authentication)
} }
func (this aliasTable) Update(ctx context.Context, alias *Alias) error { func (this authenticationTable) Update(ctx context.Context, authentication *Authentication) error {
return this.table.Update(ctx, alias) return this.table.Update(ctx, authentication)
} }
func (this aliasTable) Save(ctx context.Context, alias *Alias) error { func (this authenticationTable) Save(ctx context.Context, authentication *Authentication) error {
return this.table.Save(ctx, alias) return this.table.Save(ctx, authentication)
} }
func (this aliasTable) Delete(ctx context.Context, alias *Alias) error { func (this authenticationTable) Delete(ctx context.Context, authentication *Authentication) error {
return this.table.Delete(ctx, alias) return this.table.Delete(ctx, authentication)
} }
func (this aliasTable) Has(ctx context.Context, id string) (found bool, err error) { func (this authenticationTable) Has(ctx context.Context, did string) (found bool, err error) {
return this.table.PrimaryKey().Has(ctx, id) return this.table.PrimaryKey().Has(ctx, did)
} }
func (this aliasTable) Get(ctx context.Context, id string) (*Alias, error) { func (this authenticationTable) Get(ctx context.Context, did string) (*Authentication, error) {
var alias Alias var authentication Authentication
found, err := this.table.PrimaryKey().Get(ctx, &alias, id) found, err := this.table.PrimaryKey().Get(ctx, &authentication, did)
if err != nil { if err != nil {
return nil, err return nil, err
} }
if !found { if !found {
return nil, ormerrors.NotFound return nil, ormerrors.NotFound
} }
return &alias, nil return &authentication, nil
} }
func (this aliasTable) HasBySubjectOrigin(ctx context.Context, subject string, origin string) (found bool, err error) { func (this authenticationTable) HasByControllerSubject(ctx context.Context, controller string, subject string) (found bool, err error) {
return this.table.GetIndexByID(1).(ormtable.UniqueIndex).Has(ctx, return this.table.GetIndexByID(1).(ormtable.UniqueIndex).Has(ctx,
controller,
subject, subject,
origin,
) )
} }
func (this aliasTable) GetBySubjectOrigin(ctx context.Context, subject string, origin string) (*Alias, error) { func (this authenticationTable) GetByControllerSubject(ctx context.Context, controller string, subject string) (*Authentication, error) {
var alias Alias var authentication Authentication
found, err := this.table.GetIndexByID(1).(ormtable.UniqueIndex).Get(ctx, &alias, found, err := this.table.GetIndexByID(1).(ormtable.UniqueIndex).Get(ctx, &authentication,
controller,
subject, subject,
origin,
) )
if err != nil { if err != nil {
return nil, err return nil, err
@ -133,37 +133,37 @@ func (this aliasTable) GetBySubjectOrigin(ctx context.Context, subject string, o
if !found { if !found {
return nil, ormerrors.NotFound return nil, ormerrors.NotFound
} }
return &alias, nil return &authentication, nil
} }
func (this aliasTable) List(ctx context.Context, prefixKey AliasIndexKey, opts ...ormlist.Option) (AliasIterator, error) { func (this authenticationTable) List(ctx context.Context, prefixKey AuthenticationIndexKey, opts ...ormlist.Option) (AuthenticationIterator, error) {
it, err := this.table.GetIndexByID(prefixKey.id()).List(ctx, prefixKey.values(), opts...) it, err := this.table.GetIndexByID(prefixKey.id()).List(ctx, prefixKey.values(), opts...)
return AliasIterator{it}, err return AuthenticationIterator{it}, err
} }
func (this aliasTable) ListRange(ctx context.Context, from, to AliasIndexKey, opts ...ormlist.Option) (AliasIterator, error) { func (this authenticationTable) ListRange(ctx context.Context, from, to AuthenticationIndexKey, opts ...ormlist.Option) (AuthenticationIterator, error) {
it, err := this.table.GetIndexByID(from.id()).ListRange(ctx, from.values(), to.values(), opts...) it, err := this.table.GetIndexByID(from.id()).ListRange(ctx, from.values(), to.values(), opts...)
return AliasIterator{it}, err return AuthenticationIterator{it}, err
} }
func (this aliasTable) DeleteBy(ctx context.Context, prefixKey AliasIndexKey) error { func (this authenticationTable) DeleteBy(ctx context.Context, prefixKey AuthenticationIndexKey) error {
return this.table.GetIndexByID(prefixKey.id()).DeleteBy(ctx, prefixKey.values()...) return this.table.GetIndexByID(prefixKey.id()).DeleteBy(ctx, prefixKey.values()...)
} }
func (this aliasTable) DeleteRange(ctx context.Context, from, to AliasIndexKey) error { func (this authenticationTable) DeleteRange(ctx context.Context, from, to AuthenticationIndexKey) error {
return this.table.GetIndexByID(from.id()).DeleteRange(ctx, from.values(), to.values()) return this.table.GetIndexByID(from.id()).DeleteRange(ctx, from.values(), to.values())
} }
func (this aliasTable) doNotImplement() {} func (this authenticationTable) doNotImplement() {}
var _ AliasTable = aliasTable{} var _ AuthenticationTable = authenticationTable{}
func NewAliasTable(db ormtable.Schema) (AliasTable, error) { func NewAuthenticationTable(db ormtable.Schema) (AuthenticationTable, error) {
table := db.GetTable(&Alias{}) table := db.GetTable(&Authentication{})
if table == nil { if table == nil {
return nil, ormerrors.TableNotFound.Wrap(string((&Alias{}).ProtoReflect().Descriptor().FullName())) return nil, ormerrors.TableNotFound.Wrap(string((&Authentication{}).ProtoReflect().Descriptor().FullName()))
} }
return aliasTable{table}, nil return authenticationTable{table}, nil
} }
type ControllerTable interface { type ControllerTable interface {
@ -692,7 +692,7 @@ func NewVerificationTable(db ormtable.Schema) (VerificationTable, error) {
} }
type StateStore interface { type StateStore interface {
AliasTable() AliasTable AuthenticationTable() AuthenticationTable
ControllerTable() ControllerTable ControllerTable() ControllerTable
VerificationTable() VerificationTable VerificationTable() VerificationTable
@ -700,13 +700,13 @@ type StateStore interface {
} }
type stateStore struct { type stateStore struct {
alias AliasTable authentication AuthenticationTable
controller ControllerTable controller ControllerTable
verification VerificationTable verification VerificationTable
} }
func (x stateStore) AliasTable() AliasTable { func (x stateStore) AuthenticationTable() AuthenticationTable {
return x.alias return x.authentication
} }
func (x stateStore) ControllerTable() ControllerTable { func (x stateStore) ControllerTable() ControllerTable {
@ -722,7 +722,7 @@ func (stateStore) doNotImplement() {}
var _ StateStore = stateStore{} var _ StateStore = stateStore{}
func NewStateStore(db ormtable.Schema) (StateStore, error) { func NewStateStore(db ormtable.Schema) (StateStore, error) {
aliasTable, err := NewAliasTable(db) authenticationTable, err := NewAuthenticationTable(db)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -738,7 +738,7 @@ func NewStateStore(db ormtable.Schema) (StateStore, error) {
} }
return stateStore{ return stateStore{
aliasTable, authenticationTable,
controllerTable, controllerTable,
verificationTable, verificationTable,
}, nil }, nil

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -19,10 +19,8 @@ import (
const _ = grpc.SupportPackageIsVersion7 const _ = grpc.SupportPackageIsVersion7
const ( const (
Msg_AuthorizeService_FullMethodName = "/did.v1.Msg/AuthorizeService"
Msg_ExecuteTx_FullMethodName = "/did.v1.Msg/ExecuteTx" Msg_ExecuteTx_FullMethodName = "/did.v1.Msg/ExecuteTx"
Msg_RegisterController_FullMethodName = "/did.v1.Msg/RegisterController" Msg_RegisterController_FullMethodName = "/did.v1.Msg/RegisterController"
Msg_RegisterService_FullMethodName = "/did.v1.Msg/RegisterService"
Msg_UpdateParams_FullMethodName = "/did.v1.Msg/UpdateParams" Msg_UpdateParams_FullMethodName = "/did.v1.Msg/UpdateParams"
) )
@ -30,18 +28,12 @@ const (
// //
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type MsgClient interface { type MsgClient interface {
// AuthorizeService asserts the given controller is the owner of the given
// address.
AuthorizeService(ctx context.Context, in *MsgAuthorizeService, opts ...grpc.CallOption) (*MsgAuthorizeServiceResponse, error)
// ExecuteTx executes a transaction on the Sonr Blockchain. It leverages // ExecuteTx executes a transaction on the Sonr Blockchain. It leverages
// Macaroon for verification. // Macaroon for verification.
ExecuteTx(ctx context.Context, in *MsgExecuteTx, opts ...grpc.CallOption) (*MsgExecuteTxResponse, error) ExecuteTx(ctx context.Context, in *MsgExecuteTx, opts ...grpc.CallOption) (*MsgExecuteTxResponse, error)
// RegisterController initializes a controller with the given authentication // RegisterController initializes a controller with the given authentication
// set, address, cid, publicKey, and user-defined alias. // set, address, cid, publicKey, and user-defined alias.
RegisterController(ctx context.Context, in *MsgRegisterController, opts ...grpc.CallOption) (*MsgRegisterControllerResponse, error) RegisterController(ctx context.Context, in *MsgRegisterController, opts ...grpc.CallOption) (*MsgRegisterControllerResponse, error)
// RegisterService initializes a Service with a given permission scope and
// URI. The domain must have a valid TXT record containing the public key.
RegisterService(ctx context.Context, in *MsgRegisterService, opts ...grpc.CallOption) (*MsgRegisterServiceResponse, error)
// UpdateParams defines a governance operation for updating the parameters. // UpdateParams defines a governance operation for updating the parameters.
UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error)
} }
@ -54,15 +46,6 @@ func NewMsgClient(cc grpc.ClientConnInterface) MsgClient {
return &msgClient{cc} return &msgClient{cc}
} }
func (c *msgClient) AuthorizeService(ctx context.Context, in *MsgAuthorizeService, opts ...grpc.CallOption) (*MsgAuthorizeServiceResponse, error) {
out := new(MsgAuthorizeServiceResponse)
err := c.cc.Invoke(ctx, Msg_AuthorizeService_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *msgClient) ExecuteTx(ctx context.Context, in *MsgExecuteTx, opts ...grpc.CallOption) (*MsgExecuteTxResponse, error) { func (c *msgClient) ExecuteTx(ctx context.Context, in *MsgExecuteTx, opts ...grpc.CallOption) (*MsgExecuteTxResponse, error) {
out := new(MsgExecuteTxResponse) out := new(MsgExecuteTxResponse)
err := c.cc.Invoke(ctx, Msg_ExecuteTx_FullMethodName, in, out, opts...) err := c.cc.Invoke(ctx, Msg_ExecuteTx_FullMethodName, in, out, opts...)
@ -81,15 +64,6 @@ func (c *msgClient) RegisterController(ctx context.Context, in *MsgRegisterContr
return out, nil return out, nil
} }
func (c *msgClient) RegisterService(ctx context.Context, in *MsgRegisterService, opts ...grpc.CallOption) (*MsgRegisterServiceResponse, error) {
out := new(MsgRegisterServiceResponse)
err := c.cc.Invoke(ctx, Msg_RegisterService_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) { func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) {
out := new(MsgUpdateParamsResponse) out := new(MsgUpdateParamsResponse)
err := c.cc.Invoke(ctx, Msg_UpdateParams_FullMethodName, in, out, opts...) err := c.cc.Invoke(ctx, Msg_UpdateParams_FullMethodName, in, out, opts...)
@ -103,18 +77,12 @@ func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts
// All implementations must embed UnimplementedMsgServer // All implementations must embed UnimplementedMsgServer
// for forward compatibility // for forward compatibility
type MsgServer interface { type MsgServer interface {
// AuthorizeService asserts the given controller is the owner of the given
// address.
AuthorizeService(context.Context, *MsgAuthorizeService) (*MsgAuthorizeServiceResponse, error)
// ExecuteTx executes a transaction on the Sonr Blockchain. It leverages // ExecuteTx executes a transaction on the Sonr Blockchain. It leverages
// Macaroon for verification. // Macaroon for verification.
ExecuteTx(context.Context, *MsgExecuteTx) (*MsgExecuteTxResponse, error) ExecuteTx(context.Context, *MsgExecuteTx) (*MsgExecuteTxResponse, error)
// RegisterController initializes a controller with the given authentication // RegisterController initializes a controller with the given authentication
// set, address, cid, publicKey, and user-defined alias. // set, address, cid, publicKey, and user-defined alias.
RegisterController(context.Context, *MsgRegisterController) (*MsgRegisterControllerResponse, error) RegisterController(context.Context, *MsgRegisterController) (*MsgRegisterControllerResponse, error)
// RegisterService initializes a Service with a given permission scope and
// URI. The domain must have a valid TXT record containing the public key.
RegisterService(context.Context, *MsgRegisterService) (*MsgRegisterServiceResponse, error)
// UpdateParams defines a governance operation for updating the parameters. // UpdateParams defines a governance operation for updating the parameters.
UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error)
mustEmbedUnimplementedMsgServer() mustEmbedUnimplementedMsgServer()
@ -124,18 +92,12 @@ type MsgServer interface {
type UnimplementedMsgServer struct { type UnimplementedMsgServer struct {
} }
func (UnimplementedMsgServer) AuthorizeService(context.Context, *MsgAuthorizeService) (*MsgAuthorizeServiceResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method AuthorizeService not implemented")
}
func (UnimplementedMsgServer) ExecuteTx(context.Context, *MsgExecuteTx) (*MsgExecuteTxResponse, error) { func (UnimplementedMsgServer) ExecuteTx(context.Context, *MsgExecuteTx) (*MsgExecuteTxResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ExecuteTx not implemented") return nil, status.Errorf(codes.Unimplemented, "method ExecuteTx not implemented")
} }
func (UnimplementedMsgServer) RegisterController(context.Context, *MsgRegisterController) (*MsgRegisterControllerResponse, error) { func (UnimplementedMsgServer) RegisterController(context.Context, *MsgRegisterController) (*MsgRegisterControllerResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method RegisterController not implemented") return nil, status.Errorf(codes.Unimplemented, "method RegisterController not implemented")
} }
func (UnimplementedMsgServer) RegisterService(context.Context, *MsgRegisterService) (*MsgRegisterServiceResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method RegisterService not implemented")
}
func (UnimplementedMsgServer) UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { func (UnimplementedMsgServer) UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented")
} }
@ -152,24 +114,6 @@ func RegisterMsgServer(s grpc.ServiceRegistrar, srv MsgServer) {
s.RegisterService(&Msg_ServiceDesc, srv) s.RegisterService(&Msg_ServiceDesc, srv)
} }
func _Msg_AuthorizeService_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgAuthorizeService)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).AuthorizeService(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Msg_AuthorizeService_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).AuthorizeService(ctx, req.(*MsgAuthorizeService))
}
return interceptor(ctx, in, info, handler)
}
func _Msg_ExecuteTx_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { func _Msg_ExecuteTx_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgExecuteTx) in := new(MsgExecuteTx)
if err := dec(in); err != nil { if err := dec(in); err != nil {
@ -206,24 +150,6 @@ func _Msg_RegisterController_Handler(srv interface{}, ctx context.Context, dec f
return interceptor(ctx, in, info, handler) return interceptor(ctx, in, info, handler)
} }
func _Msg_RegisterService_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgRegisterService)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).RegisterService(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Msg_RegisterService_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).RegisterService(ctx, req.(*MsgRegisterService))
}
return interceptor(ctx, in, info, handler)
}
func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgUpdateParams) in := new(MsgUpdateParams)
if err := dec(in); err != nil { if err := dec(in); err != nil {
@ -249,10 +175,6 @@ var Msg_ServiceDesc = grpc.ServiceDesc{
ServiceName: "did.v1.Msg", ServiceName: "did.v1.Msg",
HandlerType: (*MsgServer)(nil), HandlerType: (*MsgServer)(nil),
Methods: []grpc.MethodDesc{ Methods: []grpc.MethodDesc{
{
MethodName: "AuthorizeService",
Handler: _Msg_AuthorizeService_Handler,
},
{ {
MethodName: "ExecuteTx", MethodName: "ExecuteTx",
Handler: _Msg_ExecuteTx_Handler, Handler: _Msg_ExecuteTx_Handler,
@ -261,10 +183,6 @@ var Msg_ServiceDesc = grpc.ServiceDesc{
MethodName: "RegisterController", MethodName: "RegisterController",
Handler: _Msg_RegisterController_Handler, Handler: _Msg_RegisterController_Handler,
}, },
{
MethodName: "RegisterService",
Handler: _Msg_RegisterService_Handler,
},
{ {
MethodName: "UpdateParams", MethodName: "UpdateParams",
Handler: _Msg_UpdateParams_Handler, Handler: _Msg_UpdateParams_Handler,

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -19,7 +19,9 @@ import (
const _ = grpc.SupportPackageIsVersion7 const _ = grpc.SupportPackageIsVersion7
const ( const (
Query_Params_FullMethodName = "/macaroon.v1.Query/Params" Query_Params_FullMethodName = "/macaroon.v1.Query/Params"
Query_RefreshToken_FullMethodName = "/macaroon.v1.Query/RefreshToken"
Query_ValidateToken_FullMethodName = "/macaroon.v1.Query/ValidateToken"
) )
// QueryClient is the client API for Query service. // QueryClient is the client API for Query service.
@ -28,6 +30,10 @@ const (
type QueryClient interface { type QueryClient interface {
// Params queries all parameters of the module. // Params queries all parameters of the module.
Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error)
// RefreshToken refreshes a macaroon token as post authentication.
RefreshToken(ctx context.Context, in *QueryRefreshTokenRequest, opts ...grpc.CallOption) (*QueryRefreshTokenResponse, error)
// ValidateToken validates a macaroon token as pre authentication.
ValidateToken(ctx context.Context, in *QueryValidateTokenRequest, opts ...grpc.CallOption) (*QueryValidateTokenResponse, error)
} }
type queryClient struct { type queryClient struct {
@ -47,12 +53,34 @@ func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts .
return out, nil return out, nil
} }
func (c *queryClient) RefreshToken(ctx context.Context, in *QueryRefreshTokenRequest, opts ...grpc.CallOption) (*QueryRefreshTokenResponse, error) {
out := new(QueryRefreshTokenResponse)
err := c.cc.Invoke(ctx, Query_RefreshToken_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) ValidateToken(ctx context.Context, in *QueryValidateTokenRequest, opts ...grpc.CallOption) (*QueryValidateTokenResponse, error) {
out := new(QueryValidateTokenResponse)
err := c.cc.Invoke(ctx, Query_ValidateToken_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// QueryServer is the server API for Query service. // QueryServer is the server API for Query service.
// All implementations must embed UnimplementedQueryServer // All implementations must embed UnimplementedQueryServer
// for forward compatibility // for forward compatibility
type QueryServer interface { type QueryServer interface {
// Params queries all parameters of the module. // Params queries all parameters of the module.
Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error)
// RefreshToken refreshes a macaroon token as post authentication.
RefreshToken(context.Context, *QueryRefreshTokenRequest) (*QueryRefreshTokenResponse, error)
// ValidateToken validates a macaroon token as pre authentication.
ValidateToken(context.Context, *QueryValidateTokenRequest) (*QueryValidateTokenResponse, error)
mustEmbedUnimplementedQueryServer() mustEmbedUnimplementedQueryServer()
} }
@ -63,6 +91,12 @@ type UnimplementedQueryServer struct {
func (UnimplementedQueryServer) Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) { func (UnimplementedQueryServer) Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") return nil, status.Errorf(codes.Unimplemented, "method Params not implemented")
} }
func (UnimplementedQueryServer) RefreshToken(context.Context, *QueryRefreshTokenRequest) (*QueryRefreshTokenResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method RefreshToken not implemented")
}
func (UnimplementedQueryServer) ValidateToken(context.Context, *QueryValidateTokenRequest) (*QueryValidateTokenResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ValidateToken not implemented")
}
func (UnimplementedQueryServer) mustEmbedUnimplementedQueryServer() {} func (UnimplementedQueryServer) mustEmbedUnimplementedQueryServer() {}
// UnsafeQueryServer may be embedded to opt out of forward compatibility for this service. // UnsafeQueryServer may be embedded to opt out of forward compatibility for this service.
@ -94,6 +128,42 @@ func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interf
return interceptor(ctx, in, info, handler) return interceptor(ctx, in, info, handler)
} }
func _Query_RefreshToken_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryRefreshTokenRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).RefreshToken(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Query_RefreshToken_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).RefreshToken(ctx, req.(*QueryRefreshTokenRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_ValidateToken_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryValidateTokenRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).ValidateToken(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Query_ValidateToken_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).ValidateToken(ctx, req.(*QueryValidateTokenRequest))
}
return interceptor(ctx, in, info, handler)
}
// Query_ServiceDesc is the grpc.ServiceDesc for Query service. // Query_ServiceDesc is the grpc.ServiceDesc for Query service.
// It's only intended for direct use with grpc.RegisterService, // It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy) // and not to be introspected or modified (even as a copy)
@ -105,6 +175,14 @@ var Query_ServiceDesc = grpc.ServiceDesc{
MethodName: "Params", MethodName: "Params",
Handler: _Query_Params_Handler, Handler: _Query_Params_Handler,
}, },
{
MethodName: "RefreshToken",
Handler: _Query_RefreshToken_Handler,
},
{
MethodName: "ValidateToken",
Handler: _Query_ValidateToken_Handler,
},
}, },
Streams: []grpc.StreamDesc{}, Streams: []grpc.StreamDesc{},
Metadata: "macaroon/v1/query.proto", Metadata: "macaroon/v1/query.proto",

View File

@ -9,145 +9,185 @@ import (
ormerrors "cosmossdk.io/orm/types/ormerrors" ormerrors "cosmossdk.io/orm/types/ormerrors"
) )
type ExampleDataTable interface { type GrantTable interface {
Insert(ctx context.Context, exampleData *ExampleData) error Insert(ctx context.Context, grant *Grant) error
Update(ctx context.Context, exampleData *ExampleData) error InsertReturningId(ctx context.Context, grant *Grant) (uint64, error)
Save(ctx context.Context, exampleData *ExampleData) error LastInsertedSequence(ctx context.Context) (uint64, error)
Delete(ctx context.Context, exampleData *ExampleData) error Update(ctx context.Context, grant *Grant) error
Has(ctx context.Context, account []byte) (found bool, err error) Save(ctx context.Context, grant *Grant) error
Delete(ctx context.Context, grant *Grant) error
Has(ctx context.Context, id uint64) (found bool, err error)
// Get returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found. // Get returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
Get(ctx context.Context, account []byte) (*ExampleData, error) Get(ctx context.Context, id uint64) (*Grant, error)
List(ctx context.Context, prefixKey ExampleDataIndexKey, opts ...ormlist.Option) (ExampleDataIterator, error) HasBySubjectOrigin(ctx context.Context, subject string, origin string) (found bool, err error)
ListRange(ctx context.Context, from, to ExampleDataIndexKey, opts ...ormlist.Option) (ExampleDataIterator, error) // GetBySubjectOrigin returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
DeleteBy(ctx context.Context, prefixKey ExampleDataIndexKey) error GetBySubjectOrigin(ctx context.Context, subject string, origin string) (*Grant, error)
DeleteRange(ctx context.Context, from, to ExampleDataIndexKey) error List(ctx context.Context, prefixKey GrantIndexKey, opts ...ormlist.Option) (GrantIterator, error)
ListRange(ctx context.Context, from, to GrantIndexKey, opts ...ormlist.Option) (GrantIterator, error)
DeleteBy(ctx context.Context, prefixKey GrantIndexKey) error
DeleteRange(ctx context.Context, from, to GrantIndexKey) error
doNotImplement() doNotImplement()
} }
type ExampleDataIterator struct { type GrantIterator struct {
ormtable.Iterator ormtable.Iterator
} }
func (i ExampleDataIterator) Value() (*ExampleData, error) { func (i GrantIterator) Value() (*Grant, error) {
var exampleData ExampleData var grant Grant
err := i.UnmarshalMessage(&exampleData) err := i.UnmarshalMessage(&grant)
return &exampleData, err return &grant, err
} }
type ExampleDataIndexKey interface { type GrantIndexKey interface {
id() uint32 id() uint32
values() []interface{} values() []interface{}
exampleDataIndexKey() grantIndexKey()
} }
// primary key starting index.. // primary key starting index..
type ExampleDataPrimaryKey = ExampleDataAccountIndexKey type GrantPrimaryKey = GrantIdIndexKey
type ExampleDataAccountIndexKey struct { type GrantIdIndexKey struct {
vs []interface{} vs []interface{}
} }
func (x ExampleDataAccountIndexKey) id() uint32 { return 0 } func (x GrantIdIndexKey) id() uint32 { return 0 }
func (x ExampleDataAccountIndexKey) values() []interface{} { return x.vs } func (x GrantIdIndexKey) values() []interface{} { return x.vs }
func (x ExampleDataAccountIndexKey) exampleDataIndexKey() {} func (x GrantIdIndexKey) grantIndexKey() {}
func (this ExampleDataAccountIndexKey) WithAccount(account []byte) ExampleDataAccountIndexKey { func (this GrantIdIndexKey) WithId(id uint64) GrantIdIndexKey {
this.vs = []interface{}{account} this.vs = []interface{}{id}
return this return this
} }
type ExampleDataAmountIndexKey struct { type GrantSubjectOriginIndexKey struct {
vs []interface{} vs []interface{}
} }
func (x ExampleDataAmountIndexKey) id() uint32 { return 1 } func (x GrantSubjectOriginIndexKey) id() uint32 { return 1 }
func (x ExampleDataAmountIndexKey) values() []interface{} { return x.vs } func (x GrantSubjectOriginIndexKey) values() []interface{} { return x.vs }
func (x ExampleDataAmountIndexKey) exampleDataIndexKey() {} func (x GrantSubjectOriginIndexKey) grantIndexKey() {}
func (this ExampleDataAmountIndexKey) WithAmount(amount uint64) ExampleDataAmountIndexKey { func (this GrantSubjectOriginIndexKey) WithSubject(subject string) GrantSubjectOriginIndexKey {
this.vs = []interface{}{amount} this.vs = []interface{}{subject}
return this return this
} }
type exampleDataTable struct { func (this GrantSubjectOriginIndexKey) WithSubjectOrigin(subject string, origin string) GrantSubjectOriginIndexKey {
table ormtable.Table this.vs = []interface{}{subject, origin}
return this
} }
func (this exampleDataTable) Insert(ctx context.Context, exampleData *ExampleData) error { type grantTable struct {
return this.table.Insert(ctx, exampleData) table ormtable.AutoIncrementTable
} }
func (this exampleDataTable) Update(ctx context.Context, exampleData *ExampleData) error { func (this grantTable) Insert(ctx context.Context, grant *Grant) error {
return this.table.Update(ctx, exampleData) return this.table.Insert(ctx, grant)
} }
func (this exampleDataTable) Save(ctx context.Context, exampleData *ExampleData) error { func (this grantTable) Update(ctx context.Context, grant *Grant) error {
return this.table.Save(ctx, exampleData) return this.table.Update(ctx, grant)
} }
func (this exampleDataTable) Delete(ctx context.Context, exampleData *ExampleData) error { func (this grantTable) Save(ctx context.Context, grant *Grant) error {
return this.table.Delete(ctx, exampleData) return this.table.Save(ctx, grant)
} }
func (this exampleDataTable) Has(ctx context.Context, account []byte) (found bool, err error) { func (this grantTable) Delete(ctx context.Context, grant *Grant) error {
return this.table.PrimaryKey().Has(ctx, account) return this.table.Delete(ctx, grant)
} }
func (this exampleDataTable) Get(ctx context.Context, account []byte) (*ExampleData, error) { func (this grantTable) InsertReturningId(ctx context.Context, grant *Grant) (uint64, error) {
var exampleData ExampleData return this.table.InsertReturningPKey(ctx, grant)
found, err := this.table.PrimaryKey().Get(ctx, &exampleData, account) }
func (this grantTable) LastInsertedSequence(ctx context.Context) (uint64, error) {
return this.table.LastInsertedSequence(ctx)
}
func (this grantTable) Has(ctx context.Context, id uint64) (found bool, err error) {
return this.table.PrimaryKey().Has(ctx, id)
}
func (this grantTable) Get(ctx context.Context, id uint64) (*Grant, error) {
var grant Grant
found, err := this.table.PrimaryKey().Get(ctx, &grant, id)
if err != nil { if err != nil {
return nil, err return nil, err
} }
if !found { if !found {
return nil, ormerrors.NotFound return nil, ormerrors.NotFound
} }
return &exampleData, nil return &grant, nil
} }
func (this exampleDataTable) List(ctx context.Context, prefixKey ExampleDataIndexKey, opts ...ormlist.Option) (ExampleDataIterator, error) { func (this grantTable) HasBySubjectOrigin(ctx context.Context, subject string, origin string) (found bool, err error) {
return this.table.GetIndexByID(1).(ormtable.UniqueIndex).Has(ctx,
subject,
origin,
)
}
func (this grantTable) GetBySubjectOrigin(ctx context.Context, subject string, origin string) (*Grant, error) {
var grant Grant
found, err := this.table.GetIndexByID(1).(ormtable.UniqueIndex).Get(ctx, &grant,
subject,
origin,
)
if err != nil {
return nil, err
}
if !found {
return nil, ormerrors.NotFound
}
return &grant, nil
}
func (this grantTable) List(ctx context.Context, prefixKey GrantIndexKey, opts ...ormlist.Option) (GrantIterator, error) {
it, err := this.table.GetIndexByID(prefixKey.id()).List(ctx, prefixKey.values(), opts...) it, err := this.table.GetIndexByID(prefixKey.id()).List(ctx, prefixKey.values(), opts...)
return ExampleDataIterator{it}, err return GrantIterator{it}, err
} }
func (this exampleDataTable) ListRange(ctx context.Context, from, to ExampleDataIndexKey, opts ...ormlist.Option) (ExampleDataIterator, error) { func (this grantTable) ListRange(ctx context.Context, from, to GrantIndexKey, opts ...ormlist.Option) (GrantIterator, error) {
it, err := this.table.GetIndexByID(from.id()).ListRange(ctx, from.values(), to.values(), opts...) it, err := this.table.GetIndexByID(from.id()).ListRange(ctx, from.values(), to.values(), opts...)
return ExampleDataIterator{it}, err return GrantIterator{it}, err
} }
func (this exampleDataTable) DeleteBy(ctx context.Context, prefixKey ExampleDataIndexKey) error { func (this grantTable) DeleteBy(ctx context.Context, prefixKey GrantIndexKey) error {
return this.table.GetIndexByID(prefixKey.id()).DeleteBy(ctx, prefixKey.values()...) return this.table.GetIndexByID(prefixKey.id()).DeleteBy(ctx, prefixKey.values()...)
} }
func (this exampleDataTable) DeleteRange(ctx context.Context, from, to ExampleDataIndexKey) error { func (this grantTable) DeleteRange(ctx context.Context, from, to GrantIndexKey) error {
return this.table.GetIndexByID(from.id()).DeleteRange(ctx, from.values(), to.values()) return this.table.GetIndexByID(from.id()).DeleteRange(ctx, from.values(), to.values())
} }
func (this exampleDataTable) doNotImplement() {} func (this grantTable) doNotImplement() {}
var _ ExampleDataTable = exampleDataTable{} var _ GrantTable = grantTable{}
func NewExampleDataTable(db ormtable.Schema) (ExampleDataTable, error) { func NewGrantTable(db ormtable.Schema) (GrantTable, error) {
table := db.GetTable(&ExampleData{}) table := db.GetTable(&Grant{})
if table == nil { if table == nil {
return nil, ormerrors.TableNotFound.Wrap(string((&ExampleData{}).ProtoReflect().Descriptor().FullName())) return nil, ormerrors.TableNotFound.Wrap(string((&Grant{}).ProtoReflect().Descriptor().FullName()))
} }
return exampleDataTable{table}, nil return grantTable{table.(ormtable.AutoIncrementTable)}, nil
} }
type StateStore interface { type StateStore interface {
ExampleDataTable() ExampleDataTable GrantTable() GrantTable
doNotImplement() doNotImplement()
} }
type stateStore struct { type stateStore struct {
exampleData ExampleDataTable grant GrantTable
} }
func (x stateStore) ExampleDataTable() ExampleDataTable { func (x stateStore) GrantTable() GrantTable {
return x.exampleData return x.grant
} }
func (stateStore) doNotImplement() {} func (stateStore) doNotImplement() {}
@ -155,12 +195,12 @@ func (stateStore) doNotImplement() {}
var _ StateStore = stateStore{} var _ StateStore = stateStore{}
func NewStateStore(db ormtable.Schema) (StateStore, error) { func NewStateStore(db ormtable.Schema) (StateStore, error) {
exampleDataTable, err := NewExampleDataTable(db) grantTable, err := NewGrantTable(db)
if err != nil { if err != nil {
return nil, err return nil, err
} }
return stateStore{ return stateStore{
exampleDataTable, grantTable,
}, nil }, nil
} }

View File

@ -14,27 +14,33 @@ import (
) )
var ( var (
md_ExampleData protoreflect.MessageDescriptor md_Grant protoreflect.MessageDescriptor
fd_ExampleData_account protoreflect.FieldDescriptor fd_Grant_id protoreflect.FieldDescriptor
fd_ExampleData_amount protoreflect.FieldDescriptor fd_Grant_controller protoreflect.FieldDescriptor
fd_Grant_subject protoreflect.FieldDescriptor
fd_Grant_origin protoreflect.FieldDescriptor
fd_Grant_expiry_height protoreflect.FieldDescriptor
) )
func init() { func init() {
file_macaroon_v1_state_proto_init() file_macaroon_v1_state_proto_init()
md_ExampleData = File_macaroon_v1_state_proto.Messages().ByName("ExampleData") md_Grant = File_macaroon_v1_state_proto.Messages().ByName("Grant")
fd_ExampleData_account = md_ExampleData.Fields().ByName("account") fd_Grant_id = md_Grant.Fields().ByName("id")
fd_ExampleData_amount = md_ExampleData.Fields().ByName("amount") fd_Grant_controller = md_Grant.Fields().ByName("controller")
fd_Grant_subject = md_Grant.Fields().ByName("subject")
fd_Grant_origin = md_Grant.Fields().ByName("origin")
fd_Grant_expiry_height = md_Grant.Fields().ByName("expiry_height")
} }
var _ protoreflect.Message = (*fastReflection_ExampleData)(nil) var _ protoreflect.Message = (*fastReflection_Grant)(nil)
type fastReflection_ExampleData ExampleData type fastReflection_Grant Grant
func (x *ExampleData) ProtoReflect() protoreflect.Message { func (x *Grant) ProtoReflect() protoreflect.Message {
return (*fastReflection_ExampleData)(x) return (*fastReflection_Grant)(x)
} }
func (x *ExampleData) slowProtoReflect() protoreflect.Message { func (x *Grant) slowProtoReflect() protoreflect.Message {
mi := &file_macaroon_v1_state_proto_msgTypes[0] mi := &file_macaroon_v1_state_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -46,43 +52,43 @@ func (x *ExampleData) slowProtoReflect() protoreflect.Message {
return mi.MessageOf(x) return mi.MessageOf(x)
} }
var _fastReflection_ExampleData_messageType fastReflection_ExampleData_messageType var _fastReflection_Grant_messageType fastReflection_Grant_messageType
var _ protoreflect.MessageType = fastReflection_ExampleData_messageType{} var _ protoreflect.MessageType = fastReflection_Grant_messageType{}
type fastReflection_ExampleData_messageType struct{} type fastReflection_Grant_messageType struct{}
func (x fastReflection_ExampleData_messageType) Zero() protoreflect.Message { func (x fastReflection_Grant_messageType) Zero() protoreflect.Message {
return (*fastReflection_ExampleData)(nil) return (*fastReflection_Grant)(nil)
} }
func (x fastReflection_ExampleData_messageType) New() protoreflect.Message { func (x fastReflection_Grant_messageType) New() protoreflect.Message {
return new(fastReflection_ExampleData) return new(fastReflection_Grant)
} }
func (x fastReflection_ExampleData_messageType) Descriptor() protoreflect.MessageDescriptor { func (x fastReflection_Grant_messageType) Descriptor() protoreflect.MessageDescriptor {
return md_ExampleData return md_Grant
} }
// Descriptor returns message descriptor, which contains only the protobuf // Descriptor returns message descriptor, which contains only the protobuf
// type information for the message. // type information for the message.
func (x *fastReflection_ExampleData) Descriptor() protoreflect.MessageDescriptor { func (x *fastReflection_Grant) Descriptor() protoreflect.MessageDescriptor {
return md_ExampleData return md_Grant
} }
// Type returns the message type, which encapsulates both Go and protobuf // Type returns the message type, which encapsulates both Go and protobuf
// type information. If the Go type information is not needed, // type information. If the Go type information is not needed,
// it is recommended that the message descriptor be used instead. // it is recommended that the message descriptor be used instead.
func (x *fastReflection_ExampleData) Type() protoreflect.MessageType { func (x *fastReflection_Grant) Type() protoreflect.MessageType {
return _fastReflection_ExampleData_messageType return _fastReflection_Grant_messageType
} }
// New returns a newly allocated and mutable empty message. // New returns a newly allocated and mutable empty message.
func (x *fastReflection_ExampleData) New() protoreflect.Message { func (x *fastReflection_Grant) New() protoreflect.Message {
return new(fastReflection_ExampleData) return new(fastReflection_Grant)
} }
// Interface unwraps the message reflection interface and // Interface unwraps the message reflection interface and
// returns the underlying ProtoMessage interface. // returns the underlying ProtoMessage interface.
func (x *fastReflection_ExampleData) Interface() protoreflect.ProtoMessage { func (x *fastReflection_Grant) Interface() protoreflect.ProtoMessage {
return (*ExampleData)(x) return (*Grant)(x)
} }
// Range iterates over every populated field in an undefined order, // Range iterates over every populated field in an undefined order,
@ -90,16 +96,34 @@ func (x *fastReflection_ExampleData) Interface() protoreflect.ProtoMessage {
// Range returns immediately if f returns false. // Range returns immediately if f returns false.
// While iterating, mutating operations may only be performed // While iterating, mutating operations may only be performed
// on the current field descriptor. // on the current field descriptor.
func (x *fastReflection_ExampleData) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { func (x *fastReflection_Grant) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) {
if len(x.Account) != 0 { if x.Id != uint64(0) {
value := protoreflect.ValueOfBytes(x.Account) value := protoreflect.ValueOfUint64(x.Id)
if !f(fd_ExampleData_account, value) { if !f(fd_Grant_id, value) {
return return
} }
} }
if x.Amount != uint64(0) { if x.Controller != "" {
value := protoreflect.ValueOfUint64(x.Amount) value := protoreflect.ValueOfString(x.Controller)
if !f(fd_ExampleData_amount, value) { if !f(fd_Grant_controller, value) {
return
}
}
if x.Subject != "" {
value := protoreflect.ValueOfString(x.Subject)
if !f(fd_Grant_subject, value) {
return
}
}
if x.Origin != "" {
value := protoreflect.ValueOfString(x.Origin)
if !f(fd_Grant_origin, value) {
return
}
}
if x.ExpiryHeight != int64(0) {
value := protoreflect.ValueOfInt64(x.ExpiryHeight)
if !f(fd_Grant_expiry_height, value) {
return return
} }
} }
@ -116,17 +140,23 @@ func (x *fastReflection_ExampleData) Range(f func(protoreflect.FieldDescriptor,
// In other cases (aside from the nullable cases above), // In other cases (aside from the nullable cases above),
// a proto3 scalar field is populated if it contains a non-zero value, and // a proto3 scalar field is populated if it contains a non-zero value, and
// a repeated field is populated if it is non-empty. // a repeated field is populated if it is non-empty.
func (x *fastReflection_ExampleData) Has(fd protoreflect.FieldDescriptor) bool { func (x *fastReflection_Grant) Has(fd protoreflect.FieldDescriptor) bool {
switch fd.FullName() { switch fd.FullName() {
case "macaroon.v1.ExampleData.account": case "macaroon.v1.Grant.id":
return len(x.Account) != 0 return x.Id != uint64(0)
case "macaroon.v1.ExampleData.amount": case "macaroon.v1.Grant.controller":
return x.Amount != uint64(0) return x.Controller != ""
case "macaroon.v1.Grant.subject":
return x.Subject != ""
case "macaroon.v1.Grant.origin":
return x.Origin != ""
case "macaroon.v1.Grant.expiry_height":
return x.ExpiryHeight != int64(0)
default: default:
if fd.IsExtension() { if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: macaroon.v1.ExampleData")) panic(fmt.Errorf("proto3 declared messages do not support extensions: macaroon.v1.Grant"))
} }
panic(fmt.Errorf("message macaroon.v1.ExampleData does not contain field %s", fd.FullName())) panic(fmt.Errorf("message macaroon.v1.Grant does not contain field %s", fd.FullName()))
} }
} }
@ -136,17 +166,23 @@ func (x *fastReflection_ExampleData) Has(fd protoreflect.FieldDescriptor) bool {
// associated with the given field number. // associated with the given field number.
// //
// Clear is a mutating operation and unsafe for concurrent use. // Clear is a mutating operation and unsafe for concurrent use.
func (x *fastReflection_ExampleData) Clear(fd protoreflect.FieldDescriptor) { func (x *fastReflection_Grant) Clear(fd protoreflect.FieldDescriptor) {
switch fd.FullName() { switch fd.FullName() {
case "macaroon.v1.ExampleData.account": case "macaroon.v1.Grant.id":
x.Account = nil x.Id = uint64(0)
case "macaroon.v1.ExampleData.amount": case "macaroon.v1.Grant.controller":
x.Amount = uint64(0) x.Controller = ""
case "macaroon.v1.Grant.subject":
x.Subject = ""
case "macaroon.v1.Grant.origin":
x.Origin = ""
case "macaroon.v1.Grant.expiry_height":
x.ExpiryHeight = int64(0)
default: default:
if fd.IsExtension() { if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: macaroon.v1.ExampleData")) panic(fmt.Errorf("proto3 declared messages do not support extensions: macaroon.v1.Grant"))
} }
panic(fmt.Errorf("message macaroon.v1.ExampleData does not contain field %s", fd.FullName())) panic(fmt.Errorf("message macaroon.v1.Grant does not contain field %s", fd.FullName()))
} }
} }
@ -156,19 +192,28 @@ func (x *fastReflection_ExampleData) Clear(fd protoreflect.FieldDescriptor) {
// the default value of a bytes scalar is guaranteed to be a copy. // the default value of a bytes scalar is guaranteed to be a copy.
// For unpopulated composite types, it returns an empty, read-only view // For unpopulated composite types, it returns an empty, read-only view
// of the value; to obtain a mutable reference, use Mutable. // of the value; to obtain a mutable reference, use Mutable.
func (x *fastReflection_ExampleData) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { func (x *fastReflection_Grant) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value {
switch descriptor.FullName() { switch descriptor.FullName() {
case "macaroon.v1.ExampleData.account": case "macaroon.v1.Grant.id":
value := x.Account value := x.Id
return protoreflect.ValueOfBytes(value)
case "macaroon.v1.ExampleData.amount":
value := x.Amount
return protoreflect.ValueOfUint64(value) return protoreflect.ValueOfUint64(value)
case "macaroon.v1.Grant.controller":
value := x.Controller
return protoreflect.ValueOfString(value)
case "macaroon.v1.Grant.subject":
value := x.Subject
return protoreflect.ValueOfString(value)
case "macaroon.v1.Grant.origin":
value := x.Origin
return protoreflect.ValueOfString(value)
case "macaroon.v1.Grant.expiry_height":
value := x.ExpiryHeight
return protoreflect.ValueOfInt64(value)
default: default:
if descriptor.IsExtension() { if descriptor.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: macaroon.v1.ExampleData")) panic(fmt.Errorf("proto3 declared messages do not support extensions: macaroon.v1.Grant"))
} }
panic(fmt.Errorf("message macaroon.v1.ExampleData does not contain field %s", descriptor.FullName())) panic(fmt.Errorf("message macaroon.v1.Grant does not contain field %s", descriptor.FullName()))
} }
} }
@ -182,17 +227,23 @@ func (x *fastReflection_ExampleData) Get(descriptor protoreflect.FieldDescriptor
// empty, read-only value, then it panics. // empty, read-only value, then it panics.
// //
// Set is a mutating operation and unsafe for concurrent use. // Set is a mutating operation and unsafe for concurrent use.
func (x *fastReflection_ExampleData) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { func (x *fastReflection_Grant) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) {
switch fd.FullName() { switch fd.FullName() {
case "macaroon.v1.ExampleData.account": case "macaroon.v1.Grant.id":
x.Account = value.Bytes() x.Id = value.Uint()
case "macaroon.v1.ExampleData.amount": case "macaroon.v1.Grant.controller":
x.Amount = value.Uint() x.Controller = value.Interface().(string)
case "macaroon.v1.Grant.subject":
x.Subject = value.Interface().(string)
case "macaroon.v1.Grant.origin":
x.Origin = value.Interface().(string)
case "macaroon.v1.Grant.expiry_height":
x.ExpiryHeight = value.Int()
default: default:
if fd.IsExtension() { if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: macaroon.v1.ExampleData")) panic(fmt.Errorf("proto3 declared messages do not support extensions: macaroon.v1.Grant"))
} }
panic(fmt.Errorf("message macaroon.v1.ExampleData does not contain field %s", fd.FullName())) panic(fmt.Errorf("message macaroon.v1.Grant does not contain field %s", fd.FullName()))
} }
} }
@ -206,44 +257,56 @@ func (x *fastReflection_ExampleData) Set(fd protoreflect.FieldDescriptor, value
// It panics if the field does not contain a composite type. // It panics if the field does not contain a composite type.
// //
// Mutable is a mutating operation and unsafe for concurrent use. // Mutable is a mutating operation and unsafe for concurrent use.
func (x *fastReflection_ExampleData) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { func (x *fastReflection_Grant) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {
switch fd.FullName() { switch fd.FullName() {
case "macaroon.v1.ExampleData.account": case "macaroon.v1.Grant.id":
panic(fmt.Errorf("field account of message macaroon.v1.ExampleData is not mutable")) panic(fmt.Errorf("field id of message macaroon.v1.Grant is not mutable"))
case "macaroon.v1.ExampleData.amount": case "macaroon.v1.Grant.controller":
panic(fmt.Errorf("field amount of message macaroon.v1.ExampleData is not mutable")) panic(fmt.Errorf("field controller of message macaroon.v1.Grant is not mutable"))
case "macaroon.v1.Grant.subject":
panic(fmt.Errorf("field subject of message macaroon.v1.Grant is not mutable"))
case "macaroon.v1.Grant.origin":
panic(fmt.Errorf("field origin of message macaroon.v1.Grant is not mutable"))
case "macaroon.v1.Grant.expiry_height":
panic(fmt.Errorf("field expiry_height of message macaroon.v1.Grant is not mutable"))
default: default:
if fd.IsExtension() { if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: macaroon.v1.ExampleData")) panic(fmt.Errorf("proto3 declared messages do not support extensions: macaroon.v1.Grant"))
} }
panic(fmt.Errorf("message macaroon.v1.ExampleData does not contain field %s", fd.FullName())) panic(fmt.Errorf("message macaroon.v1.Grant does not contain field %s", fd.FullName()))
} }
} }
// NewField returns a new value that is assignable to the field // NewField returns a new value that is assignable to the field
// for the given descriptor. For scalars, this returns the default value. // for the given descriptor. For scalars, this returns the default value.
// For lists, maps, and messages, this returns a new, empty, mutable value. // For lists, maps, and messages, this returns a new, empty, mutable value.
func (x *fastReflection_ExampleData) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { func (x *fastReflection_Grant) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value {
switch fd.FullName() { switch fd.FullName() {
case "macaroon.v1.ExampleData.account": case "macaroon.v1.Grant.id":
return protoreflect.ValueOfBytes(nil)
case "macaroon.v1.ExampleData.amount":
return protoreflect.ValueOfUint64(uint64(0)) return protoreflect.ValueOfUint64(uint64(0))
case "macaroon.v1.Grant.controller":
return protoreflect.ValueOfString("")
case "macaroon.v1.Grant.subject":
return protoreflect.ValueOfString("")
case "macaroon.v1.Grant.origin":
return protoreflect.ValueOfString("")
case "macaroon.v1.Grant.expiry_height":
return protoreflect.ValueOfInt64(int64(0))
default: default:
if fd.IsExtension() { if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: macaroon.v1.ExampleData")) panic(fmt.Errorf("proto3 declared messages do not support extensions: macaroon.v1.Grant"))
} }
panic(fmt.Errorf("message macaroon.v1.ExampleData does not contain field %s", fd.FullName())) panic(fmt.Errorf("message macaroon.v1.Grant does not contain field %s", fd.FullName()))
} }
} }
// WhichOneof reports which field within the oneof is populated, // WhichOneof reports which field within the oneof is populated,
// returning nil if none are populated. // returning nil if none are populated.
// It panics if the oneof descriptor does not belong to this message. // It panics if the oneof descriptor does not belong to this message.
func (x *fastReflection_ExampleData) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { func (x *fastReflection_Grant) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor {
switch d.FullName() { switch d.FullName() {
default: default:
panic(fmt.Errorf("%s is not a oneof field in macaroon.v1.ExampleData", d.FullName())) panic(fmt.Errorf("%s is not a oneof field in macaroon.v1.Grant", d.FullName()))
} }
panic("unreachable") panic("unreachable")
} }
@ -251,7 +314,7 @@ func (x *fastReflection_ExampleData) WhichOneof(d protoreflect.OneofDescriptor)
// GetUnknown retrieves the entire list of unknown fields. // GetUnknown retrieves the entire list of unknown fields.
// The caller may only mutate the contents of the RawFields // The caller may only mutate the contents of the RawFields
// if the mutated bytes are stored back into the message with SetUnknown. // if the mutated bytes are stored back into the message with SetUnknown.
func (x *fastReflection_ExampleData) GetUnknown() protoreflect.RawFields { func (x *fastReflection_Grant) GetUnknown() protoreflect.RawFields {
return x.unknownFields return x.unknownFields
} }
@ -262,7 +325,7 @@ func (x *fastReflection_ExampleData) GetUnknown() protoreflect.RawFields {
// An empty RawFields may be passed to clear the fields. // An empty RawFields may be passed to clear the fields.
// //
// SetUnknown is a mutating operation and unsafe for concurrent use. // SetUnknown is a mutating operation and unsafe for concurrent use.
func (x *fastReflection_ExampleData) SetUnknown(fields protoreflect.RawFields) { func (x *fastReflection_Grant) SetUnknown(fields protoreflect.RawFields) {
x.unknownFields = fields x.unknownFields = fields
} }
@ -274,7 +337,7 @@ func (x *fastReflection_ExampleData) SetUnknown(fields protoreflect.RawFields) {
// message type, but the details are implementation dependent. // message type, but the details are implementation dependent.
// Validity is not part of the protobuf data model, and may not // Validity is not part of the protobuf data model, and may not
// be preserved in marshaling or other operations. // be preserved in marshaling or other operations.
func (x *fastReflection_ExampleData) IsValid() bool { func (x *fastReflection_Grant) IsValid() bool {
return x != nil return x != nil
} }
@ -284,9 +347,9 @@ func (x *fastReflection_ExampleData) IsValid() bool {
// The returned methods type is identical to // The returned methods type is identical to
// "google.golang.org/protobuf/runtime/protoiface".Methods. // "google.golang.org/protobuf/runtime/protoiface".Methods.
// Consult the protoiface package documentation for details. // Consult the protoiface package documentation for details.
func (x *fastReflection_ExampleData) ProtoMethods() *protoiface.Methods { func (x *fastReflection_Grant) ProtoMethods() *protoiface.Methods {
size := func(input protoiface.SizeInput) protoiface.SizeOutput { size := func(input protoiface.SizeInput) protoiface.SizeOutput {
x := input.Message.Interface().(*ExampleData) x := input.Message.Interface().(*Grant)
if x == nil { if x == nil {
return protoiface.SizeOutput{ return protoiface.SizeOutput{
NoUnkeyedLiterals: input.NoUnkeyedLiterals, NoUnkeyedLiterals: input.NoUnkeyedLiterals,
@ -298,12 +361,23 @@ func (x *fastReflection_ExampleData) ProtoMethods() *protoiface.Methods {
var n int var n int
var l int var l int
_ = l _ = l
l = len(x.Account) if x.Id != 0 {
n += 1 + runtime.Sov(uint64(x.Id))
}
l = len(x.Controller)
if l > 0 { if l > 0 {
n += 1 + l + runtime.Sov(uint64(l)) n += 1 + l + runtime.Sov(uint64(l))
} }
if x.Amount != 0 { l = len(x.Subject)
n += 1 + runtime.Sov(uint64(x.Amount)) if l > 0 {
n += 1 + l + runtime.Sov(uint64(l))
}
l = len(x.Origin)
if l > 0 {
n += 1 + l + runtime.Sov(uint64(l))
}
if x.ExpiryHeight != 0 {
n += 1 + runtime.Sov(uint64(x.ExpiryHeight))
} }
if x.unknownFields != nil { if x.unknownFields != nil {
n += len(x.unknownFields) n += len(x.unknownFields)
@ -315,7 +389,7 @@ func (x *fastReflection_ExampleData) ProtoMethods() *protoiface.Methods {
} }
marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) {
x := input.Message.Interface().(*ExampleData) x := input.Message.Interface().(*Grant)
if x == nil { if x == nil {
return protoiface.MarshalOutput{ return protoiface.MarshalOutput{
NoUnkeyedLiterals: input.NoUnkeyedLiterals, NoUnkeyedLiterals: input.NoUnkeyedLiterals,
@ -334,17 +408,36 @@ func (x *fastReflection_ExampleData) ProtoMethods() *protoiface.Methods {
i -= len(x.unknownFields) i -= len(x.unknownFields)
copy(dAtA[i:], x.unknownFields) copy(dAtA[i:], x.unknownFields)
} }
if x.Amount != 0 { if x.ExpiryHeight != 0 {
i = runtime.EncodeVarint(dAtA, i, uint64(x.Amount)) i = runtime.EncodeVarint(dAtA, i, uint64(x.ExpiryHeight))
i-- i--
dAtA[i] = 0x10 dAtA[i] = 0x28
} }
if len(x.Account) > 0 { if len(x.Origin) > 0 {
i -= len(x.Account) i -= len(x.Origin)
copy(dAtA[i:], x.Account) copy(dAtA[i:], x.Origin)
i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Account))) i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Origin)))
i-- i--
dAtA[i] = 0xa dAtA[i] = 0x22
}
if len(x.Subject) > 0 {
i -= len(x.Subject)
copy(dAtA[i:], x.Subject)
i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Subject)))
i--
dAtA[i] = 0x1a
}
if len(x.Controller) > 0 {
i -= len(x.Controller)
copy(dAtA[i:], x.Controller)
i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Controller)))
i--
dAtA[i] = 0x12
}
if x.Id != 0 {
i = runtime.EncodeVarint(dAtA, i, uint64(x.Id))
i--
dAtA[i] = 0x8
} }
if input.Buf != nil { if input.Buf != nil {
input.Buf = append(input.Buf, dAtA...) input.Buf = append(input.Buf, dAtA...)
@ -357,7 +450,7 @@ func (x *fastReflection_ExampleData) ProtoMethods() *protoiface.Methods {
}, nil }, nil
} }
unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) {
x := input.Message.Interface().(*ExampleData) x := input.Message.Interface().(*Grant)
if x == nil { if x == nil {
return protoiface.UnmarshalOutput{ return protoiface.UnmarshalOutput{
NoUnkeyedLiterals: input.NoUnkeyedLiterals, NoUnkeyedLiterals: input.NoUnkeyedLiterals,
@ -389,17 +482,17 @@ func (x *fastReflection_ExampleData) ProtoMethods() *protoiface.Methods {
fieldNum := int32(wire >> 3) fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7) wireType := int(wire & 0x7)
if wireType == 4 { if wireType == 4 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: ExampleData: wiretype end group for non-group") return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Grant: wiretype end group for non-group")
} }
if fieldNum <= 0 { if fieldNum <= 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: ExampleData: illegal tag %d (wire type %d)", fieldNum, wire) return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Grant: illegal tag %d (wire type %d)", fieldNum, wire)
} }
switch fieldNum { switch fieldNum {
case 1: case 1:
if wireType != 2 { if wireType != 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Account", wireType) return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Id", wireType)
} }
var byteLen int x.Id = 0
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
if shift >= 64 { if shift >= 64 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
@ -409,31 +502,48 @@ func (x *fastReflection_ExampleData) ProtoMethods() *protoiface.Methods {
} }
b := dAtA[iNdEx] b := dAtA[iNdEx]
iNdEx++ iNdEx++
byteLen |= int(b&0x7F) << shift x.Id |= uint64(b&0x7F) << shift
if b < 0x80 { if b < 0x80 {
break break
} }
} }
if byteLen < 0 { case 2:
if wireType != 2 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Controller", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
}
if iNdEx >= l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
} }
postIndex := iNdEx + byteLen postIndex := iNdEx + intStringLen
if postIndex < 0 { if postIndex < 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
} }
if postIndex > l { if postIndex > l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
} }
x.Account = append(x.Account[:0], dAtA[iNdEx:postIndex]...) x.Controller = string(dAtA[iNdEx:postIndex])
if x.Account == nil {
x.Account = []byte{}
}
iNdEx = postIndex iNdEx = postIndex
case 2: case 3:
if wireType != 0 { if wireType != 2 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Subject", wireType)
} }
x.Amount = 0 var stringLen uint64
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
if shift >= 64 { if shift >= 64 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
@ -443,7 +553,71 @@ func (x *fastReflection_ExampleData) ProtoMethods() *protoiface.Methods {
} }
b := dAtA[iNdEx] b := dAtA[iNdEx]
iNdEx++ iNdEx++
x.Amount |= uint64(b&0x7F) << shift stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
}
if postIndex > l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
x.Subject = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 4:
if wireType != 2 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Origin", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
}
if iNdEx >= l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
}
if postIndex > l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
x.Origin = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 5:
if wireType != 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ExpiryHeight", wireType)
}
x.ExpiryHeight = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
}
if iNdEx >= l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
x.ExpiryHeight |= int64(b&0x7F) << shift
if b < 0x80 { if b < 0x80 {
break break
} }
@ -496,17 +670,20 @@ const (
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
) )
type ExampleData struct { type Grant struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
Account []byte `protobuf:"bytes,1,opt,name=account,proto3" json:"account,omitempty"` Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
Amount uint64 `protobuf:"varint,2,opt,name=amount,proto3" json:"amount,omitempty"` Controller string `protobuf:"bytes,2,opt,name=controller,proto3" json:"controller,omitempty"`
Subject string `protobuf:"bytes,3,opt,name=subject,proto3" json:"subject,omitempty"`
Origin string `protobuf:"bytes,4,opt,name=origin,proto3" json:"origin,omitempty"`
ExpiryHeight int64 `protobuf:"varint,5,opt,name=expiry_height,json=expiryHeight,proto3" json:"expiry_height,omitempty"`
} }
func (x *ExampleData) Reset() { func (x *Grant) Reset() {
*x = ExampleData{} *x = Grant{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_macaroon_v1_state_proto_msgTypes[0] mi := &file_macaroon_v1_state_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -514,27 +691,48 @@ func (x *ExampleData) Reset() {
} }
} }
func (x *ExampleData) String() string { func (x *Grant) String() string {
return protoimpl.X.MessageStringOf(x) return protoimpl.X.MessageStringOf(x)
} }
func (*ExampleData) ProtoMessage() {} func (*Grant) ProtoMessage() {}
// Deprecated: Use ExampleData.ProtoReflect.Descriptor instead. // Deprecated: Use Grant.ProtoReflect.Descriptor instead.
func (*ExampleData) Descriptor() ([]byte, []int) { func (*Grant) Descriptor() ([]byte, []int) {
return file_macaroon_v1_state_proto_rawDescGZIP(), []int{0} return file_macaroon_v1_state_proto_rawDescGZIP(), []int{0}
} }
func (x *ExampleData) GetAccount() []byte { func (x *Grant) GetId() uint64 {
if x != nil { if x != nil {
return x.Account return x.Id
} }
return nil return 0
} }
func (x *ExampleData) GetAmount() uint64 { func (x *Grant) GetController() string {
if x != nil { if x != nil {
return x.Amount return x.Controller
}
return ""
}
func (x *Grant) GetSubject() string {
if x != nil {
return x.Subject
}
return ""
}
func (x *Grant) GetOrigin() string {
if x != nil {
return x.Origin
}
return ""
}
func (x *Grant) GetExpiryHeight() int64 {
if x != nil {
return x.ExpiryHeight
} }
return 0 return 0
} }
@ -546,23 +744,28 @@ var file_macaroon_v1_state_proto_rawDesc = []byte{
0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x6d, 0x61, 0x63, 0x61, 0x72, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x6d, 0x61, 0x63, 0x61, 0x72,
0x6f, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x1a, 0x17, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x6f, 0x6f, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x1a, 0x17, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x6f,
0x72, 0x6d, 0x2f, 0x76, 0x31, 0x2f, 0x6f, 0x72, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x72, 0x6d, 0x2f, 0x76, 0x31, 0x2f, 0x6f, 0x72, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22,
0x60, 0x0a, 0x0b, 0x45, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x44, 0x61, 0x74, 0x61, 0x12, 0x18, 0xb6, 0x01, 0x0a, 0x05, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18,
0x0a, 0x07, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x6f, 0x6e,
0x07, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x63,
0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x62,
0x3a, 0x1f, 0xf2, 0x9e, 0xd3, 0x8e, 0x03, 0x19, 0x0a, 0x09, 0x0a, 0x07, 0x61, 0x63, 0x63, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x75, 0x62, 0x6a,
0x75, 0x6e, 0x74, 0x12, 0x0a, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x10, 0x01, 0x18, 0x65, 0x63, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x18, 0x04, 0x20,
0x01, 0x42, 0x9d, 0x01, 0x0a, 0x0f, 0x63, 0x6f, 0x6d, 0x2e, 0x6d, 0x61, 0x63, 0x61, 0x72, 0x6f, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x12, 0x23, 0x0a, 0x0d, 0x65,
0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x42, 0x0a, 0x53, 0x74, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x78, 0x70, 0x69, 0x72, 0x79, 0x5f, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x05, 0x20, 0x01,
0x6f, 0x50, 0x01, 0x5a, 0x31, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x28, 0x03, 0x52, 0x0c, 0x65, 0x78, 0x70, 0x69, 0x72, 0x79, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74,
0x6f, 0x6e, 0x73, 0x6f, 0x6e, 0x72, 0x2f, 0x73, 0x6f, 0x6e, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x3a, 0x26, 0xf2, 0x9e, 0xd3, 0x8e, 0x03, 0x20, 0x0a, 0x06, 0x0a, 0x02, 0x69, 0x64, 0x10, 0x01,
0x6d, 0x61, 0x63, 0x61, 0x72, 0x6f, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x3b, 0x6d, 0x61, 0x63, 0x61, 0x12, 0x14, 0x0a, 0x0e, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2c, 0x6f, 0x72, 0x69, 0x67,
0x72, 0x6f, 0x6f, 0x6e, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x4d, 0x58, 0x58, 0xaa, 0x02, 0x0b, 0x4d, 0x69, 0x6e, 0x10, 0x01, 0x18, 0x01, 0x18, 0x01, 0x42, 0x9d, 0x01, 0x0a, 0x0f, 0x63, 0x6f, 0x6d,
0x61, 0x63, 0x61, 0x72, 0x6f, 0x6f, 0x6e, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x0b, 0x4d, 0x61, 0x63, 0x2e, 0x6d, 0x61, 0x63, 0x61, 0x72, 0x6f, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x42, 0x0a, 0x53, 0x74,
0x61, 0x72, 0x6f, 0x6f, 0x6e, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x17, 0x4d, 0x61, 0x63, 0x61, 0x72, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x31, 0x67, 0x69, 0x74, 0x68,
0x6f, 0x6f, 0x6e, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x6e, 0x73, 0x6f, 0x6e, 0x72, 0x2f, 0x73, 0x6f,
0x74, 0x61, 0xea, 0x02, 0x0c, 0x4d, 0x61, 0x63, 0x61, 0x72, 0x6f, 0x6f, 0x6e, 0x3a, 0x3a, 0x56, 0x6e, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6d, 0x61, 0x63, 0x61, 0x72, 0x6f, 0x6f, 0x6e, 0x2f,
0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x76, 0x31, 0x3b, 0x6d, 0x61, 0x63, 0x61, 0x72, 0x6f, 0x6f, 0x6e, 0x76, 0x31, 0xa2, 0x02, 0x03,
0x4d, 0x58, 0x58, 0xaa, 0x02, 0x0b, 0x4d, 0x61, 0x63, 0x61, 0x72, 0x6f, 0x6f, 0x6e, 0x2e, 0x56,
0x31, 0xca, 0x02, 0x0b, 0x4d, 0x61, 0x63, 0x61, 0x72, 0x6f, 0x6f, 0x6e, 0x5c, 0x56, 0x31, 0xe2,
0x02, 0x17, 0x4d, 0x61, 0x63, 0x61, 0x72, 0x6f, 0x6f, 0x6e, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50,
0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0c, 0x4d, 0x61, 0x63, 0x61,
0x72, 0x6f, 0x6f, 0x6e, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (
@ -579,7 +782,7 @@ func file_macaroon_v1_state_proto_rawDescGZIP() []byte {
var file_macaroon_v1_state_proto_msgTypes = make([]protoimpl.MessageInfo, 1) var file_macaroon_v1_state_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
var file_macaroon_v1_state_proto_goTypes = []interface{}{ var file_macaroon_v1_state_proto_goTypes = []interface{}{
(*ExampleData)(nil), // 0: macaroon.v1.ExampleData (*Grant)(nil), // 0: macaroon.v1.Grant
} }
var file_macaroon_v1_state_proto_depIdxs = []int32{ var file_macaroon_v1_state_proto_depIdxs = []int32{
0, // [0:0] is the sub-list for method output_type 0, // [0:0] is the sub-list for method output_type
@ -596,7 +799,7 @@ func file_macaroon_v1_state_proto_init() {
} }
if !protoimpl.UnsafeEnabled { if !protoimpl.UnsafeEnabled {
file_macaroon_v1_state_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { file_macaroon_v1_state_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ExampleData); i { switch v := v.(*Grant); i {
case 0: case 0:
return &v.state return &v.state
case 1: case 1:

File diff suppressed because it is too large Load Diff

View File

@ -19,7 +19,8 @@ import (
const _ = grpc.SupportPackageIsVersion7 const _ = grpc.SupportPackageIsVersion7
const ( const (
Msg_UpdateParams_FullMethodName = "/macaroon.v1.Msg/UpdateParams" Msg_UpdateParams_FullMethodName = "/macaroon.v1.Msg/UpdateParams"
Msg_AuthorizeService_FullMethodName = "/macaroon.v1.Msg/AuthorizeService"
) )
// MsgClient is the client API for Msg service. // MsgClient is the client API for Msg service.
@ -30,6 +31,9 @@ type MsgClient interface {
// //
// Since: cosmos-sdk 0.47 // Since: cosmos-sdk 0.47
UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error)
// AuthorizeService asserts the given controller is the owner of the given
// address.
AuthorizeService(ctx context.Context, in *MsgIssueMacaroon, opts ...grpc.CallOption) (*MsgIssueMacaroonResponse, error)
} }
type msgClient struct { type msgClient struct {
@ -49,6 +53,15 @@ func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts
return out, nil return out, nil
} }
func (c *msgClient) AuthorizeService(ctx context.Context, in *MsgIssueMacaroon, opts ...grpc.CallOption) (*MsgIssueMacaroonResponse, error) {
out := new(MsgIssueMacaroonResponse)
err := c.cc.Invoke(ctx, Msg_AuthorizeService_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// MsgServer is the server API for Msg service. // MsgServer is the server API for Msg service.
// All implementations must embed UnimplementedMsgServer // All implementations must embed UnimplementedMsgServer
// for forward compatibility // for forward compatibility
@ -57,6 +70,9 @@ type MsgServer interface {
// //
// Since: cosmos-sdk 0.47 // Since: cosmos-sdk 0.47
UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error)
// AuthorizeService asserts the given controller is the owner of the given
// address.
AuthorizeService(context.Context, *MsgIssueMacaroon) (*MsgIssueMacaroonResponse, error)
mustEmbedUnimplementedMsgServer() mustEmbedUnimplementedMsgServer()
} }
@ -67,6 +83,9 @@ type UnimplementedMsgServer struct {
func (UnimplementedMsgServer) UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { func (UnimplementedMsgServer) UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented")
} }
func (UnimplementedMsgServer) AuthorizeService(context.Context, *MsgIssueMacaroon) (*MsgIssueMacaroonResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method AuthorizeService not implemented")
}
func (UnimplementedMsgServer) mustEmbedUnimplementedMsgServer() {} func (UnimplementedMsgServer) mustEmbedUnimplementedMsgServer() {}
// UnsafeMsgServer may be embedded to opt out of forward compatibility for this service. // UnsafeMsgServer may be embedded to opt out of forward compatibility for this service.
@ -98,6 +117,24 @@ func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(in
return interceptor(ctx, in, info, handler) return interceptor(ctx, in, info, handler)
} }
func _Msg_AuthorizeService_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgIssueMacaroon)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).AuthorizeService(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Msg_AuthorizeService_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).AuthorizeService(ctx, req.(*MsgIssueMacaroon))
}
return interceptor(ctx, in, info, handler)
}
// Msg_ServiceDesc is the grpc.ServiceDesc for Msg service. // Msg_ServiceDesc is the grpc.ServiceDesc for Msg service.
// It's only intended for direct use with grpc.RegisterService, // It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy) // and not to be introspected or modified (even as a copy)
@ -109,6 +146,10 @@ var Msg_ServiceDesc = grpc.ServiceDesc{
MethodName: "UpdateParams", MethodName: "UpdateParams",
Handler: _Msg_UpdateParams_Handler, Handler: _Msg_UpdateParams_Handler,
}, },
{
MethodName: "AuthorizeService",
Handler: _Msg_AuthorizeService_Handler,
},
}, },
Streams: []grpc.StreamDesc{}, Streams: []grpc.StreamDesc{},
Metadata: "macaroon/v1/tx.proto", Metadata: "macaroon/v1/tx.proto",

File diff suppressed because it is too large Load Diff

View File

@ -9,145 +9,301 @@ import (
ormerrors "cosmossdk.io/orm/types/ormerrors" ormerrors "cosmossdk.io/orm/types/ormerrors"
) )
type ExampleDataTable interface { type BalanceTable interface {
Insert(ctx context.Context, exampleData *ExampleData) error Insert(ctx context.Context, balance *Balance) error
Update(ctx context.Context, exampleData *ExampleData) error Update(ctx context.Context, balance *Balance) error
Save(ctx context.Context, exampleData *ExampleData) error Save(ctx context.Context, balance *Balance) error
Delete(ctx context.Context, exampleData *ExampleData) error Delete(ctx context.Context, balance *Balance) error
Has(ctx context.Context, account []byte) (found bool, err error) Has(ctx context.Context, account string) (found bool, err error)
// Get returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found. // Get returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
Get(ctx context.Context, account []byte) (*ExampleData, error) Get(ctx context.Context, account string) (*Balance, error)
List(ctx context.Context, prefixKey ExampleDataIndexKey, opts ...ormlist.Option) (ExampleDataIterator, error) List(ctx context.Context, prefixKey BalanceIndexKey, opts ...ormlist.Option) (BalanceIterator, error)
ListRange(ctx context.Context, from, to ExampleDataIndexKey, opts ...ormlist.Option) (ExampleDataIterator, error) ListRange(ctx context.Context, from, to BalanceIndexKey, opts ...ormlist.Option) (BalanceIterator, error)
DeleteBy(ctx context.Context, prefixKey ExampleDataIndexKey) error DeleteBy(ctx context.Context, prefixKey BalanceIndexKey) error
DeleteRange(ctx context.Context, from, to ExampleDataIndexKey) error DeleteRange(ctx context.Context, from, to BalanceIndexKey) error
doNotImplement() doNotImplement()
} }
type ExampleDataIterator struct { type BalanceIterator struct {
ormtable.Iterator ormtable.Iterator
} }
func (i ExampleDataIterator) Value() (*ExampleData, error) { func (i BalanceIterator) Value() (*Balance, error) {
var exampleData ExampleData var balance Balance
err := i.UnmarshalMessage(&exampleData) err := i.UnmarshalMessage(&balance)
return &exampleData, err return &balance, err
} }
type ExampleDataIndexKey interface { type BalanceIndexKey interface {
id() uint32 id() uint32
values() []interface{} values() []interface{}
exampleDataIndexKey() balanceIndexKey()
} }
// primary key starting index.. // primary key starting index..
type ExampleDataPrimaryKey = ExampleDataAccountIndexKey type BalancePrimaryKey = BalanceAccountIndexKey
type ExampleDataAccountIndexKey struct { type BalanceAccountIndexKey struct {
vs []interface{} vs []interface{}
} }
func (x ExampleDataAccountIndexKey) id() uint32 { return 0 } func (x BalanceAccountIndexKey) id() uint32 { return 0 }
func (x ExampleDataAccountIndexKey) values() []interface{} { return x.vs } func (x BalanceAccountIndexKey) values() []interface{} { return x.vs }
func (x ExampleDataAccountIndexKey) exampleDataIndexKey() {} func (x BalanceAccountIndexKey) balanceIndexKey() {}
func (this ExampleDataAccountIndexKey) WithAccount(account []byte) ExampleDataAccountIndexKey { func (this BalanceAccountIndexKey) WithAccount(account string) BalanceAccountIndexKey {
this.vs = []interface{}{account} this.vs = []interface{}{account}
return this return this
} }
type ExampleDataAmountIndexKey struct { type BalanceAmountIndexKey struct {
vs []interface{} vs []interface{}
} }
func (x ExampleDataAmountIndexKey) id() uint32 { return 1 } func (x BalanceAmountIndexKey) id() uint32 { return 1 }
func (x ExampleDataAmountIndexKey) values() []interface{} { return x.vs } func (x BalanceAmountIndexKey) values() []interface{} { return x.vs }
func (x ExampleDataAmountIndexKey) exampleDataIndexKey() {} func (x BalanceAmountIndexKey) balanceIndexKey() {}
func (this ExampleDataAmountIndexKey) WithAmount(amount uint64) ExampleDataAmountIndexKey { func (this BalanceAmountIndexKey) WithAmount(amount uint64) BalanceAmountIndexKey {
this.vs = []interface{}{amount} this.vs = []interface{}{amount}
return this return this
} }
type exampleDataTable struct { type balanceTable struct {
table ormtable.Table table ormtable.Table
} }
func (this exampleDataTable) Insert(ctx context.Context, exampleData *ExampleData) error { func (this balanceTable) Insert(ctx context.Context, balance *Balance) error {
return this.table.Insert(ctx, exampleData) return this.table.Insert(ctx, balance)
} }
func (this exampleDataTable) Update(ctx context.Context, exampleData *ExampleData) error { func (this balanceTable) Update(ctx context.Context, balance *Balance) error {
return this.table.Update(ctx, exampleData) return this.table.Update(ctx, balance)
} }
func (this exampleDataTable) Save(ctx context.Context, exampleData *ExampleData) error { func (this balanceTable) Save(ctx context.Context, balance *Balance) error {
return this.table.Save(ctx, exampleData) return this.table.Save(ctx, balance)
} }
func (this exampleDataTable) Delete(ctx context.Context, exampleData *ExampleData) error { func (this balanceTable) Delete(ctx context.Context, balance *Balance) error {
return this.table.Delete(ctx, exampleData) return this.table.Delete(ctx, balance)
} }
func (this exampleDataTable) Has(ctx context.Context, account []byte) (found bool, err error) { func (this balanceTable) Has(ctx context.Context, account string) (found bool, err error) {
return this.table.PrimaryKey().Has(ctx, account) return this.table.PrimaryKey().Has(ctx, account)
} }
func (this exampleDataTable) Get(ctx context.Context, account []byte) (*ExampleData, error) { func (this balanceTable) Get(ctx context.Context, account string) (*Balance, error) {
var exampleData ExampleData var balance Balance
found, err := this.table.PrimaryKey().Get(ctx, &exampleData, account) found, err := this.table.PrimaryKey().Get(ctx, &balance, account)
if err != nil { if err != nil {
return nil, err return nil, err
} }
if !found { if !found {
return nil, ormerrors.NotFound return nil, ormerrors.NotFound
} }
return &exampleData, nil return &balance, nil
} }
func (this exampleDataTable) List(ctx context.Context, prefixKey ExampleDataIndexKey, opts ...ormlist.Option) (ExampleDataIterator, error) { func (this balanceTable) List(ctx context.Context, prefixKey BalanceIndexKey, opts ...ormlist.Option) (BalanceIterator, error) {
it, err := this.table.GetIndexByID(prefixKey.id()).List(ctx, prefixKey.values(), opts...) it, err := this.table.GetIndexByID(prefixKey.id()).List(ctx, prefixKey.values(), opts...)
return ExampleDataIterator{it}, err return BalanceIterator{it}, err
} }
func (this exampleDataTable) ListRange(ctx context.Context, from, to ExampleDataIndexKey, opts ...ormlist.Option) (ExampleDataIterator, error) { func (this balanceTable) ListRange(ctx context.Context, from, to BalanceIndexKey, opts ...ormlist.Option) (BalanceIterator, error) {
it, err := this.table.GetIndexByID(from.id()).ListRange(ctx, from.values(), to.values(), opts...) it, err := this.table.GetIndexByID(from.id()).ListRange(ctx, from.values(), to.values(), opts...)
return ExampleDataIterator{it}, err return BalanceIterator{it}, err
} }
func (this exampleDataTable) DeleteBy(ctx context.Context, prefixKey ExampleDataIndexKey) error { func (this balanceTable) DeleteBy(ctx context.Context, prefixKey BalanceIndexKey) error {
return this.table.GetIndexByID(prefixKey.id()).DeleteBy(ctx, prefixKey.values()...) return this.table.GetIndexByID(prefixKey.id()).DeleteBy(ctx, prefixKey.values()...)
} }
func (this exampleDataTable) DeleteRange(ctx context.Context, from, to ExampleDataIndexKey) error { func (this balanceTable) DeleteRange(ctx context.Context, from, to BalanceIndexKey) error {
return this.table.GetIndexByID(from.id()).DeleteRange(ctx, from.values(), to.values()) return this.table.GetIndexByID(from.id()).DeleteRange(ctx, from.values(), to.values())
} }
func (this exampleDataTable) doNotImplement() {} func (this balanceTable) doNotImplement() {}
var _ ExampleDataTable = exampleDataTable{} var _ BalanceTable = balanceTable{}
func NewExampleDataTable(db ormtable.Schema) (ExampleDataTable, error) { func NewBalanceTable(db ormtable.Schema) (BalanceTable, error) {
table := db.GetTable(&ExampleData{}) table := db.GetTable(&Balance{})
if table == nil { if table == nil {
return nil, ormerrors.TableNotFound.Wrap(string((&ExampleData{}).ProtoReflect().Descriptor().FullName())) return nil, ormerrors.TableNotFound.Wrap(string((&Balance{}).ProtoReflect().Descriptor().FullName()))
} }
return exampleDataTable{table}, nil return balanceTable{table}, nil
}
type AccountTable interface {
Insert(ctx context.Context, account *Account) error
Update(ctx context.Context, account *Account) error
Save(ctx context.Context, account *Account) error
Delete(ctx context.Context, account *Account) error
Has(ctx context.Context, id uint64) (found bool, err error)
// Get returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
Get(ctx context.Context, id uint64) (*Account, error)
HasByAccount(ctx context.Context, account string) (found bool, err error)
// GetByAccount returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
GetByAccount(ctx context.Context, account string) (*Account, error)
List(ctx context.Context, prefixKey AccountIndexKey, opts ...ormlist.Option) (AccountIterator, error)
ListRange(ctx context.Context, from, to AccountIndexKey, opts ...ormlist.Option) (AccountIterator, error)
DeleteBy(ctx context.Context, prefixKey AccountIndexKey) error
DeleteRange(ctx context.Context, from, to AccountIndexKey) error
doNotImplement()
}
type AccountIterator struct {
ormtable.Iterator
}
func (i AccountIterator) Value() (*Account, error) {
var account Account
err := i.UnmarshalMessage(&account)
return &account, err
}
type AccountIndexKey interface {
id() uint32
values() []interface{}
accountIndexKey()
}
// primary key starting index..
type AccountPrimaryKey = AccountIdIndexKey
type AccountIdIndexKey struct {
vs []interface{}
}
func (x AccountIdIndexKey) id() uint32 { return 0 }
func (x AccountIdIndexKey) values() []interface{} { return x.vs }
func (x AccountIdIndexKey) accountIndexKey() {}
func (this AccountIdIndexKey) WithId(id uint64) AccountIdIndexKey {
this.vs = []interface{}{id}
return this
}
type AccountAccountIndexKey struct {
vs []interface{}
}
func (x AccountAccountIndexKey) id() uint32 { return 1 }
func (x AccountAccountIndexKey) values() []interface{} { return x.vs }
func (x AccountAccountIndexKey) accountIndexKey() {}
func (this AccountAccountIndexKey) WithAccount(account string) AccountAccountIndexKey {
this.vs = []interface{}{account}
return this
}
type accountTable struct {
table ormtable.Table
}
func (this accountTable) Insert(ctx context.Context, account *Account) error {
return this.table.Insert(ctx, account)
}
func (this accountTable) Update(ctx context.Context, account *Account) error {
return this.table.Update(ctx, account)
}
func (this accountTable) Save(ctx context.Context, account *Account) error {
return this.table.Save(ctx, account)
}
func (this accountTable) Delete(ctx context.Context, account *Account) error {
return this.table.Delete(ctx, account)
}
func (this accountTable) Has(ctx context.Context, id uint64) (found bool, err error) {
return this.table.PrimaryKey().Has(ctx, id)
}
func (this accountTable) Get(ctx context.Context, id uint64) (*Account, error) {
var account Account
found, err := this.table.PrimaryKey().Get(ctx, &account, id)
if err != nil {
return nil, err
}
if !found {
return nil, ormerrors.NotFound
}
return &account, nil
}
func (this accountTable) HasByAccount(ctx context.Context, account string) (found bool, err error) {
return this.table.GetIndexByID(1).(ormtable.UniqueIndex).Has(ctx,
account,
)
}
func (this accountTable) GetByAccount(ctx context.Context, account string) (*Account, error) {
var account Account
found, err := this.table.GetIndexByID(1).(ormtable.UniqueIndex).Get(ctx, &account,
account,
)
if err != nil {
return nil, err
}
if !found {
return nil, ormerrors.NotFound
}
return &account, nil
}
func (this accountTable) List(ctx context.Context, prefixKey AccountIndexKey, opts ...ormlist.Option) (AccountIterator, error) {
it, err := this.table.GetIndexByID(prefixKey.id()).List(ctx, prefixKey.values(), opts...)
return AccountIterator{it}, err
}
func (this accountTable) ListRange(ctx context.Context, from, to AccountIndexKey, opts ...ormlist.Option) (AccountIterator, error) {
it, err := this.table.GetIndexByID(from.id()).ListRange(ctx, from.values(), to.values(), opts...)
return AccountIterator{it}, err
}
func (this accountTable) DeleteBy(ctx context.Context, prefixKey AccountIndexKey) error {
return this.table.GetIndexByID(prefixKey.id()).DeleteBy(ctx, prefixKey.values()...)
}
func (this accountTable) DeleteRange(ctx context.Context, from, to AccountIndexKey) error {
return this.table.GetIndexByID(from.id()).DeleteRange(ctx, from.values(), to.values())
}
func (this accountTable) doNotImplement() {}
var _ AccountTable = accountTable{}
func NewAccountTable(db ormtable.Schema) (AccountTable, error) {
table := db.GetTable(&Account{})
if table == nil {
return nil, ormerrors.TableNotFound.Wrap(string((&Account{}).ProtoReflect().Descriptor().FullName()))
}
return accountTable{table}, nil
} }
type StateStore interface { type StateStore interface {
ExampleDataTable() ExampleDataTable BalanceTable() BalanceTable
AccountTable() AccountTable
doNotImplement() doNotImplement()
} }
type stateStore struct { type stateStore struct {
exampleData ExampleDataTable balance BalanceTable
account AccountTable
} }
func (x stateStore) ExampleDataTable() ExampleDataTable { func (x stateStore) BalanceTable() BalanceTable {
return x.exampleData return x.balance
}
func (x stateStore) AccountTable() AccountTable {
return x.account
} }
func (stateStore) doNotImplement() {} func (stateStore) doNotImplement() {}
@ -155,12 +311,18 @@ func (stateStore) doNotImplement() {}
var _ StateStore = stateStore{} var _ StateStore = stateStore{}
func NewStateStore(db ormtable.Schema) (StateStore, error) { func NewStateStore(db ormtable.Schema) (StateStore, error) {
exampleDataTable, err := NewExampleDataTable(db) balanceTable, err := NewBalanceTable(db)
if err != nil {
return nil, err
}
accountTable, err := NewAccountTable(db)
if err != nil { if err != nil {
return nil, err return nil, err
} }
return stateStore{ return stateStore{
exampleDataTable, balanceTable,
accountTable,
}, nil }, nil
} }

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -9,145 +9,341 @@ import (
ormerrors "cosmossdk.io/orm/types/ormerrors" ormerrors "cosmossdk.io/orm/types/ormerrors"
) )
type ExampleDataTable interface { type MetadataTable interface {
Insert(ctx context.Context, exampleData *ExampleData) error Insert(ctx context.Context, metadata *Metadata) error
Update(ctx context.Context, exampleData *ExampleData) error InsertReturningId(ctx context.Context, metadata *Metadata) (uint64, error)
Save(ctx context.Context, exampleData *ExampleData) error LastInsertedSequence(ctx context.Context) (uint64, error)
Delete(ctx context.Context, exampleData *ExampleData) error Update(ctx context.Context, metadata *Metadata) error
Has(ctx context.Context, account []byte) (found bool, err error) Save(ctx context.Context, metadata *Metadata) error
Delete(ctx context.Context, metadata *Metadata) error
Has(ctx context.Context, id uint64) (found bool, err error)
// Get returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found. // Get returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
Get(ctx context.Context, account []byte) (*ExampleData, error) Get(ctx context.Context, id uint64) (*Metadata, error)
List(ctx context.Context, prefixKey ExampleDataIndexKey, opts ...ormlist.Option) (ExampleDataIterator, error) HasByOrigin(ctx context.Context, origin string) (found bool, err error)
ListRange(ctx context.Context, from, to ExampleDataIndexKey, opts ...ormlist.Option) (ExampleDataIterator, error) // GetByOrigin returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
DeleteBy(ctx context.Context, prefixKey ExampleDataIndexKey) error GetByOrigin(ctx context.Context, origin string) (*Metadata, error)
DeleteRange(ctx context.Context, from, to ExampleDataIndexKey) error List(ctx context.Context, prefixKey MetadataIndexKey, opts ...ormlist.Option) (MetadataIterator, error)
ListRange(ctx context.Context, from, to MetadataIndexKey, opts ...ormlist.Option) (MetadataIterator, error)
DeleteBy(ctx context.Context, prefixKey MetadataIndexKey) error
DeleteRange(ctx context.Context, from, to MetadataIndexKey) error
doNotImplement() doNotImplement()
} }
type ExampleDataIterator struct { type MetadataIterator struct {
ormtable.Iterator ormtable.Iterator
} }
func (i ExampleDataIterator) Value() (*ExampleData, error) { func (i MetadataIterator) Value() (*Metadata, error) {
var exampleData ExampleData var metadata Metadata
err := i.UnmarshalMessage(&exampleData) err := i.UnmarshalMessage(&metadata)
return &exampleData, err return &metadata, err
} }
type ExampleDataIndexKey interface { type MetadataIndexKey interface {
id() uint32 id() uint32
values() []interface{} values() []interface{}
exampleDataIndexKey() metadataIndexKey()
} }
// primary key starting index.. // primary key starting index..
type ExampleDataPrimaryKey = ExampleDataAccountIndexKey type MetadataPrimaryKey = MetadataIdIndexKey
type ExampleDataAccountIndexKey struct { type MetadataIdIndexKey struct {
vs []interface{} vs []interface{}
} }
func (x ExampleDataAccountIndexKey) id() uint32 { return 0 } func (x MetadataIdIndexKey) id() uint32 { return 0 }
func (x ExampleDataAccountIndexKey) values() []interface{} { return x.vs } func (x MetadataIdIndexKey) values() []interface{} { return x.vs }
func (x ExampleDataAccountIndexKey) exampleDataIndexKey() {} func (x MetadataIdIndexKey) metadataIndexKey() {}
func (this ExampleDataAccountIndexKey) WithAccount(account []byte) ExampleDataAccountIndexKey { func (this MetadataIdIndexKey) WithId(id uint64) MetadataIdIndexKey {
this.vs = []interface{}{account} this.vs = []interface{}{id}
return this return this
} }
type ExampleDataAmountIndexKey struct { type MetadataOriginIndexKey struct {
vs []interface{} vs []interface{}
} }
func (x ExampleDataAmountIndexKey) id() uint32 { return 1 } func (x MetadataOriginIndexKey) id() uint32 { return 1 }
func (x ExampleDataAmountIndexKey) values() []interface{} { return x.vs } func (x MetadataOriginIndexKey) values() []interface{} { return x.vs }
func (x ExampleDataAmountIndexKey) exampleDataIndexKey() {} func (x MetadataOriginIndexKey) metadataIndexKey() {}
func (this ExampleDataAmountIndexKey) WithAmount(amount uint64) ExampleDataAmountIndexKey { func (this MetadataOriginIndexKey) WithOrigin(origin string) MetadataOriginIndexKey {
this.vs = []interface{}{amount} this.vs = []interface{}{origin}
return this return this
} }
type exampleDataTable struct { type metadataTable struct {
table ormtable.Table table ormtable.AutoIncrementTable
} }
func (this exampleDataTable) Insert(ctx context.Context, exampleData *ExampleData) error { func (this metadataTable) Insert(ctx context.Context, metadata *Metadata) error {
return this.table.Insert(ctx, exampleData) return this.table.Insert(ctx, metadata)
} }
func (this exampleDataTable) Update(ctx context.Context, exampleData *ExampleData) error { func (this metadataTable) Update(ctx context.Context, metadata *Metadata) error {
return this.table.Update(ctx, exampleData) return this.table.Update(ctx, metadata)
} }
func (this exampleDataTable) Save(ctx context.Context, exampleData *ExampleData) error { func (this metadataTable) Save(ctx context.Context, metadata *Metadata) error {
return this.table.Save(ctx, exampleData) return this.table.Save(ctx, metadata)
} }
func (this exampleDataTable) Delete(ctx context.Context, exampleData *ExampleData) error { func (this metadataTable) Delete(ctx context.Context, metadata *Metadata) error {
return this.table.Delete(ctx, exampleData) return this.table.Delete(ctx, metadata)
} }
func (this exampleDataTable) Has(ctx context.Context, account []byte) (found bool, err error) { func (this metadataTable) InsertReturningId(ctx context.Context, metadata *Metadata) (uint64, error) {
return this.table.PrimaryKey().Has(ctx, account) return this.table.InsertReturningPKey(ctx, metadata)
} }
func (this exampleDataTable) Get(ctx context.Context, account []byte) (*ExampleData, error) { func (this metadataTable) LastInsertedSequence(ctx context.Context) (uint64, error) {
var exampleData ExampleData return this.table.LastInsertedSequence(ctx)
found, err := this.table.PrimaryKey().Get(ctx, &exampleData, account) }
func (this metadataTable) Has(ctx context.Context, id uint64) (found bool, err error) {
return this.table.PrimaryKey().Has(ctx, id)
}
func (this metadataTable) Get(ctx context.Context, id uint64) (*Metadata, error) {
var metadata Metadata
found, err := this.table.PrimaryKey().Get(ctx, &metadata, id)
if err != nil { if err != nil {
return nil, err return nil, err
} }
if !found { if !found {
return nil, ormerrors.NotFound return nil, ormerrors.NotFound
} }
return &exampleData, nil return &metadata, nil
} }
func (this exampleDataTable) List(ctx context.Context, prefixKey ExampleDataIndexKey, opts ...ormlist.Option) (ExampleDataIterator, error) { func (this metadataTable) HasByOrigin(ctx context.Context, origin string) (found bool, err error) {
return this.table.GetIndexByID(1).(ormtable.UniqueIndex).Has(ctx,
origin,
)
}
func (this metadataTable) GetByOrigin(ctx context.Context, origin string) (*Metadata, error) {
var metadata Metadata
found, err := this.table.GetIndexByID(1).(ormtable.UniqueIndex).Get(ctx, &metadata,
origin,
)
if err != nil {
return nil, err
}
if !found {
return nil, ormerrors.NotFound
}
return &metadata, nil
}
func (this metadataTable) List(ctx context.Context, prefixKey MetadataIndexKey, opts ...ormlist.Option) (MetadataIterator, error) {
it, err := this.table.GetIndexByID(prefixKey.id()).List(ctx, prefixKey.values(), opts...) it, err := this.table.GetIndexByID(prefixKey.id()).List(ctx, prefixKey.values(), opts...)
return ExampleDataIterator{it}, err return MetadataIterator{it}, err
} }
func (this exampleDataTable) ListRange(ctx context.Context, from, to ExampleDataIndexKey, opts ...ormlist.Option) (ExampleDataIterator, error) { func (this metadataTable) ListRange(ctx context.Context, from, to MetadataIndexKey, opts ...ormlist.Option) (MetadataIterator, error) {
it, err := this.table.GetIndexByID(from.id()).ListRange(ctx, from.values(), to.values(), opts...) it, err := this.table.GetIndexByID(from.id()).ListRange(ctx, from.values(), to.values(), opts...)
return ExampleDataIterator{it}, err return MetadataIterator{it}, err
} }
func (this exampleDataTable) DeleteBy(ctx context.Context, prefixKey ExampleDataIndexKey) error { func (this metadataTable) DeleteBy(ctx context.Context, prefixKey MetadataIndexKey) error {
return this.table.GetIndexByID(prefixKey.id()).DeleteBy(ctx, prefixKey.values()...) return this.table.GetIndexByID(prefixKey.id()).DeleteBy(ctx, prefixKey.values()...)
} }
func (this exampleDataTable) DeleteRange(ctx context.Context, from, to ExampleDataIndexKey) error { func (this metadataTable) DeleteRange(ctx context.Context, from, to MetadataIndexKey) error {
return this.table.GetIndexByID(from.id()).DeleteRange(ctx, from.values(), to.values()) return this.table.GetIndexByID(from.id()).DeleteRange(ctx, from.values(), to.values())
} }
func (this exampleDataTable) doNotImplement() {} func (this metadataTable) doNotImplement() {}
var _ ExampleDataTable = exampleDataTable{} var _ MetadataTable = metadataTable{}
func NewExampleDataTable(db ormtable.Schema) (ExampleDataTable, error) { func NewMetadataTable(db ormtable.Schema) (MetadataTable, error) {
table := db.GetTable(&ExampleData{}) table := db.GetTable(&Metadata{})
if table == nil { if table == nil {
return nil, ormerrors.TableNotFound.Wrap(string((&ExampleData{}).ProtoReflect().Descriptor().FullName())) return nil, ormerrors.TableNotFound.Wrap(string((&Metadata{}).ProtoReflect().Descriptor().FullName()))
} }
return exampleDataTable{table}, nil return metadataTable{table.(ormtable.AutoIncrementTable)}, nil
}
type ProfileTable interface {
Insert(ctx context.Context, profile *Profile) error
Update(ctx context.Context, profile *Profile) error
Save(ctx context.Context, profile *Profile) error
Delete(ctx context.Context, profile *Profile) error
Has(ctx context.Context, id string) (found bool, err error)
// Get returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
Get(ctx context.Context, id string) (*Profile, error)
HasBySubjectOrigin(ctx context.Context, subject string, origin string) (found bool, err error)
// GetBySubjectOrigin returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
GetBySubjectOrigin(ctx context.Context, subject string, origin string) (*Profile, error)
List(ctx context.Context, prefixKey ProfileIndexKey, opts ...ormlist.Option) (ProfileIterator, error)
ListRange(ctx context.Context, from, to ProfileIndexKey, opts ...ormlist.Option) (ProfileIterator, error)
DeleteBy(ctx context.Context, prefixKey ProfileIndexKey) error
DeleteRange(ctx context.Context, from, to ProfileIndexKey) error
doNotImplement()
}
type ProfileIterator struct {
ormtable.Iterator
}
func (i ProfileIterator) Value() (*Profile, error) {
var profile Profile
err := i.UnmarshalMessage(&profile)
return &profile, err
}
type ProfileIndexKey interface {
id() uint32
values() []interface{}
profileIndexKey()
}
// primary key starting index..
type ProfilePrimaryKey = ProfileIdIndexKey
type ProfileIdIndexKey struct {
vs []interface{}
}
func (x ProfileIdIndexKey) id() uint32 { return 0 }
func (x ProfileIdIndexKey) values() []interface{} { return x.vs }
func (x ProfileIdIndexKey) profileIndexKey() {}
func (this ProfileIdIndexKey) WithId(id string) ProfileIdIndexKey {
this.vs = []interface{}{id}
return this
}
type ProfileSubjectOriginIndexKey struct {
vs []interface{}
}
func (x ProfileSubjectOriginIndexKey) id() uint32 { return 1 }
func (x ProfileSubjectOriginIndexKey) values() []interface{} { return x.vs }
func (x ProfileSubjectOriginIndexKey) profileIndexKey() {}
func (this ProfileSubjectOriginIndexKey) WithSubject(subject string) ProfileSubjectOriginIndexKey {
this.vs = []interface{}{subject}
return this
}
func (this ProfileSubjectOriginIndexKey) WithSubjectOrigin(subject string, origin string) ProfileSubjectOriginIndexKey {
this.vs = []interface{}{subject, origin}
return this
}
type profileTable struct {
table ormtable.Table
}
func (this profileTable) Insert(ctx context.Context, profile *Profile) error {
return this.table.Insert(ctx, profile)
}
func (this profileTable) Update(ctx context.Context, profile *Profile) error {
return this.table.Update(ctx, profile)
}
func (this profileTable) Save(ctx context.Context, profile *Profile) error {
return this.table.Save(ctx, profile)
}
func (this profileTable) Delete(ctx context.Context, profile *Profile) error {
return this.table.Delete(ctx, profile)
}
func (this profileTable) Has(ctx context.Context, id string) (found bool, err error) {
return this.table.PrimaryKey().Has(ctx, id)
}
func (this profileTable) Get(ctx context.Context, id string) (*Profile, error) {
var profile Profile
found, err := this.table.PrimaryKey().Get(ctx, &profile, id)
if err != nil {
return nil, err
}
if !found {
return nil, ormerrors.NotFound
}
return &profile, nil
}
func (this profileTable) HasBySubjectOrigin(ctx context.Context, subject string, origin string) (found bool, err error) {
return this.table.GetIndexByID(1).(ormtable.UniqueIndex).Has(ctx,
subject,
origin,
)
}
func (this profileTable) GetBySubjectOrigin(ctx context.Context, subject string, origin string) (*Profile, error) {
var profile Profile
found, err := this.table.GetIndexByID(1).(ormtable.UniqueIndex).Get(ctx, &profile,
subject,
origin,
)
if err != nil {
return nil, err
}
if !found {
return nil, ormerrors.NotFound
}
return &profile, nil
}
func (this profileTable) List(ctx context.Context, prefixKey ProfileIndexKey, opts ...ormlist.Option) (ProfileIterator, error) {
it, err := this.table.GetIndexByID(prefixKey.id()).List(ctx, prefixKey.values(), opts...)
return ProfileIterator{it}, err
}
func (this profileTable) ListRange(ctx context.Context, from, to ProfileIndexKey, opts ...ormlist.Option) (ProfileIterator, error) {
it, err := this.table.GetIndexByID(from.id()).ListRange(ctx, from.values(), to.values(), opts...)
return ProfileIterator{it}, err
}
func (this profileTable) DeleteBy(ctx context.Context, prefixKey ProfileIndexKey) error {
return this.table.GetIndexByID(prefixKey.id()).DeleteBy(ctx, prefixKey.values()...)
}
func (this profileTable) DeleteRange(ctx context.Context, from, to ProfileIndexKey) error {
return this.table.GetIndexByID(from.id()).DeleteRange(ctx, from.values(), to.values())
}
func (this profileTable) doNotImplement() {}
var _ ProfileTable = profileTable{}
func NewProfileTable(db ormtable.Schema) (ProfileTable, error) {
table := db.GetTable(&Profile{})
if table == nil {
return nil, ormerrors.TableNotFound.Wrap(string((&Profile{}).ProtoReflect().Descriptor().FullName()))
}
return profileTable{table}, nil
} }
type StateStore interface { type StateStore interface {
ExampleDataTable() ExampleDataTable MetadataTable() MetadataTable
ProfileTable() ProfileTable
doNotImplement() doNotImplement()
} }
type stateStore struct { type stateStore struct {
exampleData ExampleDataTable metadata MetadataTable
profile ProfileTable
} }
func (x stateStore) ExampleDataTable() ExampleDataTable { func (x stateStore) MetadataTable() MetadataTable {
return x.exampleData return x.metadata
}
func (x stateStore) ProfileTable() ProfileTable {
return x.profile
} }
func (stateStore) doNotImplement() {} func (stateStore) doNotImplement() {}
@ -155,12 +351,18 @@ func (stateStore) doNotImplement() {}
var _ StateStore = stateStore{} var _ StateStore = stateStore{}
func NewStateStore(db ormtable.Schema) (StateStore, error) { func NewStateStore(db ormtable.Schema) (StateStore, error) {
exampleDataTable, err := NewExampleDataTable(db) metadataTable, err := NewMetadataTable(db)
if err != nil {
return nil, err
}
profileTable, err := NewProfileTable(db)
if err != nil { if err != nil {
return nil, err return nil, err
} }
return stateStore{ return stateStore{
exampleDataTable, metadataTable,
profileTable,
}, nil }, nil
} }

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -19,7 +19,8 @@ import (
const _ = grpc.SupportPackageIsVersion7 const _ = grpc.SupportPackageIsVersion7
const ( const (
Msg_UpdateParams_FullMethodName = "/service.v1.Msg/UpdateParams" Msg_UpdateParams_FullMethodName = "/service.v1.Msg/UpdateParams"
Msg_RegisterService_FullMethodName = "/service.v1.Msg/RegisterService"
) )
// MsgClient is the client API for Msg service. // MsgClient is the client API for Msg service.
@ -30,6 +31,9 @@ type MsgClient interface {
// //
// Since: cosmos-sdk 0.47 // Since: cosmos-sdk 0.47
UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error)
// RegisterService initializes a Service with a given permission scope and
// URI. The domain must have a valid TXT record containing the public key.
RegisterService(ctx context.Context, in *MsgRegisterService, opts ...grpc.CallOption) (*MsgRegisterServiceResponse, error)
} }
type msgClient struct { type msgClient struct {
@ -49,6 +53,15 @@ func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts
return out, nil return out, nil
} }
func (c *msgClient) RegisterService(ctx context.Context, in *MsgRegisterService, opts ...grpc.CallOption) (*MsgRegisterServiceResponse, error) {
out := new(MsgRegisterServiceResponse)
err := c.cc.Invoke(ctx, Msg_RegisterService_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// MsgServer is the server API for Msg service. // MsgServer is the server API for Msg service.
// All implementations must embed UnimplementedMsgServer // All implementations must embed UnimplementedMsgServer
// for forward compatibility // for forward compatibility
@ -57,6 +70,9 @@ type MsgServer interface {
// //
// Since: cosmos-sdk 0.47 // Since: cosmos-sdk 0.47
UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error)
// RegisterService initializes a Service with a given permission scope and
// URI. The domain must have a valid TXT record containing the public key.
RegisterService(context.Context, *MsgRegisterService) (*MsgRegisterServiceResponse, error)
mustEmbedUnimplementedMsgServer() mustEmbedUnimplementedMsgServer()
} }
@ -67,6 +83,9 @@ type UnimplementedMsgServer struct {
func (UnimplementedMsgServer) UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { func (UnimplementedMsgServer) UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented")
} }
func (UnimplementedMsgServer) RegisterService(context.Context, *MsgRegisterService) (*MsgRegisterServiceResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method RegisterService not implemented")
}
func (UnimplementedMsgServer) mustEmbedUnimplementedMsgServer() {} func (UnimplementedMsgServer) mustEmbedUnimplementedMsgServer() {}
// UnsafeMsgServer may be embedded to opt out of forward compatibility for this service. // UnsafeMsgServer may be embedded to opt out of forward compatibility for this service.
@ -98,6 +117,24 @@ func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(in
return interceptor(ctx, in, info, handler) return interceptor(ctx, in, info, handler)
} }
func _Msg_RegisterService_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgRegisterService)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).RegisterService(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Msg_RegisterService_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).RegisterService(ctx, req.(*MsgRegisterService))
}
return interceptor(ctx, in, info, handler)
}
// Msg_ServiceDesc is the grpc.ServiceDesc for Msg service. // Msg_ServiceDesc is the grpc.ServiceDesc for Msg service.
// It's only intended for direct use with grpc.RegisterService, // It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy) // and not to be introspected or modified (even as a copy)
@ -109,6 +146,10 @@ var Msg_ServiceDesc = grpc.ServiceDesc{
MethodName: "UpdateParams", MethodName: "UpdateParams",
Handler: _Msg_UpdateParams_Handler, Handler: _Msg_UpdateParams_Handler,
}, },
{
MethodName: "RegisterService",
Handler: _Msg_RegisterService_Handler,
},
}, },
Streams: []grpc.StreamDesc{}, Streams: []grpc.StreamDesc{},
Metadata: "service/v1/tx.proto", Metadata: "service/v1/tx.proto",

View File

@ -1,8 +1,8 @@
version: v1 version: v1
name: buf.build/onsonr/sonr name: buf.build/onsonr/sonr
deps: deps:
- buf.build/cosmos/cosmos-sdk:9000fcc585a046c9881271d53dd40c34 - buf.build/cosmos/cosmos-sdk
- buf.build/cosmos/cosmos-proto:1935555c206d4afb9e94615dfd0fad31 - buf.build/cosmos/cosmos-proto
- buf.build/cosmos/gogo-proto - buf.build/cosmos/gogo-proto
- buf.build/googleapis/googleapis - buf.build/googleapis/googleapis
lint: lint:
@ -10,13 +10,9 @@ lint:
- DEFAULT - DEFAULT
- COMMENTS - COMMENTS
- FILE_LOWER_SNAKE_CASE - FILE_LOWER_SNAKE_CASE
ignore: except:
- UNARY_RPC - UNARY_RPC
- COMMENT_FIELD - COMMENT_FIELD
- SERVICE_SUFFIX - SERVICE_SUFFIX
- PACKAGE_VERSION_SUFFIX - PACKAGE_VERSION_SUFFIX
- RPC_REQUEST_STANDARD_NAME - RPC_REQUEST_STANDARD_NAME
- FILE_OPTIONS_REQUIRE_GO_PACKAGE
- FILE_OPTIONS_REQUIRE_GO_PACKAGE
- PACKAGE_VERSION_SUFFIX
- IMPORT_NO_PUBLIC

View File

@ -19,7 +19,6 @@ message Params {
option (gogoproto.goproto_stringer) = false; option (gogoproto.goproto_stringer) = false;
// Whitelisted Assets // Whitelisted Assets
repeated AssetInfo whitelisted_assets = 1;
// Whitelisted Key Types // Whitelisted Key Types
map<string, KeyInfo> allowed_public_keys = 2; map<string, KeyInfo> allowed_public_keys = 2;
@ -31,38 +30,6 @@ message Params {
repeated string attestation_formats = 4; repeated string attestation_formats = 4;
} }
// AssetInfo defines the asset info
message AssetInfo {
// The coin type index for bip44 path
int64 index = 1;
// The hrp for bech32 address
string hrp = 2;
// The coin symbol
string symbol = 3;
// The coin name
string asset_type = 4;
// The name of the asset
string name = 5;
// The icon url
string icon_url = 6;
}
// Document defines a DID document
message Document {
string id = 1;
string controller = 2; // The DID of the controller
repeated string authentication = 3;
repeated string assertion_method = 4;
repeated string capability_delegation = 5;
repeated string capability_invocation = 6;
repeated string service = 7;
}
// KeyInfo defines information for accepted PubKey types // KeyInfo defines information for accepted PubKey types
message KeyInfo { message KeyInfo {
string role = 1; string role = 1;
@ -70,26 +37,4 @@ message KeyInfo {
string encoding = 3; // e.g., "hex", "base64", "multibase" string encoding = 3; // e.g., "hex", "base64", "multibase"
string curve = 4; // e.g., "P256", "P384", "P521", "X25519", "X448", string curve = 4; // e.g., "P256", "P384", "P521", "X25519", "X448",
// "Ed25519", "Ed448", "secp256k1" // "Ed25519", "Ed448", "secp256k1"
string type = 5; // e.g., "Octet", "Elliptic", "RSA", "Symmetric", "HMAC"
}
// PubKey defines a public key for a did
message PubKey {
string role = 1;
string algorithm = 2;
string encoding = 3;
string curve = 4;
string key_type = 5;
bytes raw = 6;
JWK jwk = 7;
// JWK represents a JSON Web Key
message JWK {
string kty = 1; // Key Type
string crv = 2; // Curve (for EC and OKP keys)
string x = 3; // X coordinate (for EC and OKP keys)
string y = 4; // Y coordinate (for EC keys)
string n = 5; // Modulus (for RSA keys)
string e = 6; // Exponent (for RSA keys)
}
} }

View File

@ -38,3 +38,14 @@ message QueryResolveResponse {
// document is the DID document // document is the DID document
Document document = 1; Document document = 1;
} }
// Document defines a DID document
message Document {
string id = 1;
string controller = 2; // The DID of the controller
repeated string authentication = 3;
repeated string assertion_method = 4;
repeated string capability_delegation = 5;
repeated string capability_invocation = 6;
repeated string service = 7;
}

View File

@ -3,30 +3,31 @@ syntax = "proto3";
package did.v1; package did.v1;
import "cosmos/orm/v1/orm.proto"; import "cosmos/orm/v1/orm.proto";
import "did/v1/genesis.proto";
option go_package = "github.com/onsonr/sonr/x/did/types"; option go_package = "github.com/onsonr/sonr/x/did/types";
// Alias represents a DID alias message Authentication {
message Alias {
option (cosmos.orm.v1.table) = { option (cosmos.orm.v1.table) = {
id: 1 id: 1
primary_key: {fields: "id"} primary_key: {fields: "did"}
index: { index: {
id: 1 id: 1
fields: "subject,origin" fields: "controller,subject"
unique: true unique: true
} }
}; };
// The unique identifier of the alias // The unique identifier of the authentication
string id = 1; string did = 1;
// The alias of the DID // The authentication of the DID
string subject = 2; string controller = 2;
// Origin of the alias // Origin of the authentication
string origin = 3; string subject = 3;
// PubKey is the verification method
PubKey public_key = 4;
} }
// Controller represents a Sonr DWN Vault // Controller represents a Sonr DWN Vault
@ -75,7 +76,7 @@ message Controller {
string btc_address = 5; string btc_address = 5;
// PubKey is the verification method // PubKey is the verification method
bytes public_key = 6; PubKey public_key = 6;
// Val Keyshare // Val Keyshare
string ks_val = 7; string ks_val = 7;
@ -128,3 +129,28 @@ message Verification {
// CapabilityInvocation) // CapabilityInvocation)
string verification_type = 7; string verification_type = 7;
} }
// PubKey defines a public key for a did
message PubKey {
string role = 1;
string key_type = 2;
RawKey raw_key = 3;
JSONWebKey jwk = 4;
}
// JWK represents a JSON Web Key
message JSONWebKey {
string kty = 1; // Key Type
string crv = 2; // Curve (for EC and OKP keys)
string x = 3; // X coordinate (for EC and OKP keys)
string y = 4; // Y coordinate (for EC keys)
string n = 5; // Modulus (for RSA keys)
string e = 6; // Exponent (for RSA keys)
}
message RawKey {
string algorithm = 1;
string encoding = 2;
string curve = 3;
bytes key = 4;
}

View File

@ -13,10 +13,6 @@ option go_package = "github.com/onsonr/sonr/x/did/types";
service Msg { service Msg {
option (cosmos.msg.v1.service) = true; option (cosmos.msg.v1.service) = true;
// AuthorizeService asserts the given controller is the owner of the given
// address.
rpc AuthorizeService(MsgAuthorizeService) returns (MsgAuthorizeServiceResponse);
// ExecuteTx executes a transaction on the Sonr Blockchain. It leverages // ExecuteTx executes a transaction on the Sonr Blockchain. It leverages
// Macaroon for verification. // Macaroon for verification.
rpc ExecuteTx(MsgExecuteTx) returns (MsgExecuteTxResponse); rpc ExecuteTx(MsgExecuteTx) returns (MsgExecuteTxResponse);
@ -25,10 +21,6 @@ service Msg {
// set, address, cid, publicKey, and user-defined alias. // set, address, cid, publicKey, and user-defined alias.
rpc RegisterController(MsgRegisterController) returns (MsgRegisterControllerResponse); rpc RegisterController(MsgRegisterController) returns (MsgRegisterControllerResponse);
// RegisterService initializes a Service with a given permission scope and
// URI. The domain must have a valid TXT record containing the public key.
rpc RegisterService(MsgRegisterService) returns (MsgRegisterServiceResponse);
// UpdateParams defines a governance operation for updating the parameters. // UpdateParams defines a governance operation for updating the parameters.
rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse);
} }
@ -85,48 +77,6 @@ message MsgExecuteTxResponse {
string tx_hash = 2; string tx_hash = 2;
} }
// MsgAuthorizeService is the message type for the AuthorizeService RPC.
message MsgAuthorizeService {
option (cosmos.msg.v1.signer) = "controller";
// Controller is the address of the controller to authenticate.
string controller = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// Origin is the origin of the request in wildcard form.
string origin = 2;
// Permissions is the scope of the service.
map<string, string> permissions = 3;
// token is the macron token to authenticate the operation.
string token = 4;
}
// MsgAuthorizeServiceResponse is the response type for the AuthorizeService
// RPC.
message MsgAuthorizeServiceResponse {
bool success = 1;
string token = 2;
}
// MsgRegisterService is the message type for the RegisterService RPC.
message MsgRegisterService {
option (cosmos.msg.v1.signer) = "controller";
// authority is the address of the governance account.
string controller = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// origin is the origin of the request in wildcard form. Requires valid TXT
// record in DNS.
Service service = 2;
}
// MsgRegisterServiceResponse is the response type for the RegisterService RPC.
message MsgRegisterServiceResponse {
bool success = 1;
string did = 2;
}
// MsgUpdateParams is the Msg/UpdateParams request type. // MsgUpdateParams is the Msg/UpdateParams request type.
// //
// Since: cosmos-sdk 0.47 // Since: cosmos-sdk 0.47

View File

@ -1,8 +1,8 @@
syntax = "proto3"; syntax = "proto3";
package macaroon.v1; package macaroon.v1;
import "gogoproto/gogo.proto";
import "amino/amino.proto"; import "amino/amino.proto";
import "gogoproto/gogo.proto";
option go_package = "github.com/onsonr/sonr/x/macaroon/types"; option go_package = "github.com/onsonr/sonr/x/macaroon/types";
@ -18,5 +18,39 @@ message Params {
option (gogoproto.equal) = true; option (gogoproto.equal) = true;
option (gogoproto.goproto_stringer) = false; option (gogoproto.goproto_stringer) = false;
bool some_value = 2; // The list of methods
Methods methods = 1;
// The list of scopes
Scopes scopes = 2;
// The list of caveats
Caveats caveats = 3;
}
// Methods defines the available DID methods
message Methods {
option (amino.name) = "macaroon/methods";
option (gogoproto.equal) = true;
option (gogoproto.goproto_stringer) = false;
repeated string methods = 1;
}
// Scopes defines the set of scopes
message Scopes {
option (amino.name) = "macaroon/scopes";
option (gogoproto.equal) = true;
option (gogoproto.goproto_stringer) = false;
repeated string scopes = 1;
}
// Caveats defines the available caveats
message Caveats {
option (amino.name) = "macaroon/caveat";
option (gogoproto.equal) = true;
option (gogoproto.goproto_stringer) = false;
repeated string caveats = 1;
} }

View File

@ -12,6 +12,16 @@ service Query {
rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { rpc Params(QueryParamsRequest) returns (QueryParamsResponse) {
option (google.api.http).get = "/macaroon/v1/params"; option (google.api.http).get = "/macaroon/v1/params";
} }
// RefreshToken refreshes a macaroon token as post authentication.
rpc RefreshToken(QueryRefreshTokenRequest) returns (QueryRefreshTokenResponse) {
option (google.api.http).post = "/macaroon/v1/refresh";
}
// ValidateToken validates a macaroon token as pre authentication.
rpc ValidateToken(QueryValidateTokenRequest) returns (QueryValidateTokenResponse) {
option (google.api.http).post = "/macaroon/v1/validate";
}
} }
// QueryParamsRequest is the request type for the Query/Params RPC method. // QueryParamsRequest is the request type for the Query/Params RPC method.
@ -22,3 +32,31 @@ message QueryParamsResponse {
// params defines the parameters of the module. // params defines the parameters of the module.
Params params = 1; Params params = 1;
} }
// QueryRefreshTokenRequest is the request type for the Query/RefreshToken RPC
// method.
message QueryRefreshTokenRequest {
// The macaroon token to refresh
string token = 1;
}
// QueryRefreshTokenResponse is the response type for the Query/RefreshToken
// RPC method.
message QueryRefreshTokenResponse {
// The macaroon token
string token = 1;
}
// QueryValidateTokenRequest is the request type for the Query/ValidateToken
// RPC method.
message QueryValidateTokenRequest {
// The macaroon token to validate
string token = 1;
}
// QueryValidateTokenResponse is the response type for the Query/ValidateToken
// RPC method.
message QueryValidateTokenResponse {
// The macaroon token
bool valid = 1;
}

View File

@ -7,13 +7,23 @@ option go_package = "github.com/onsonr/sonr/x/macaroon/types";
// https://github.com/cosmos/cosmos-sdk/blob/main/orm/README.md // https://github.com/cosmos/cosmos-sdk/blob/main/orm/README.md
message ExampleData { message Grant {
option (cosmos.orm.v1.table) = { option (cosmos.orm.v1.table) = {
id: 1; id: 1
primary_key: { fields: "account" } primary_key: {
index: { id: 1 fields: "amount" } fields: "id"
}; auto_increment: true
}
index: {
id: 1
fields: "subject,origin"
unique: true
}
};
bytes account = 1; uint64 id = 1;
uint64 amount = 2; string controller = 2;
string subject = 3;
string origin = 4;
int64 expiry_height = 5;
} }

View File

@ -2,9 +2,9 @@ syntax = "proto3";
package macaroon.v1; package macaroon.v1;
import "cosmos/msg/v1/msg.proto"; import "cosmos/msg/v1/msg.proto";
import "macaroon/v1/genesis.proto";
import "gogoproto/gogo.proto";
import "cosmos_proto/cosmos.proto"; import "cosmos_proto/cosmos.proto";
import "gogoproto/gogo.proto";
import "macaroon/v1/genesis.proto";
option go_package = "github.com/onsonr/sonr/x/macaroon/types"; option go_package = "github.com/onsonr/sonr/x/macaroon/types";
@ -16,6 +16,10 @@ service Msg {
// //
// Since: cosmos-sdk 0.47 // Since: cosmos-sdk 0.47
rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse);
// AuthorizeService asserts the given controller is the owner of the given
// address.
rpc AuthorizeService(MsgIssueMacaroon) returns (MsgIssueMacaroonResponse);
} }
// MsgUpdateParams is the Msg/UpdateParams request type. // MsgUpdateParams is the Msg/UpdateParams request type.
@ -38,3 +42,27 @@ message MsgUpdateParams {
// //
// Since: cosmos-sdk 0.47 // Since: cosmos-sdk 0.47
message MsgUpdateParamsResponse {} message MsgUpdateParamsResponse {}
// MsgIssueMacaroon is the message type for the AuthorizeService RPC.
message MsgIssueMacaroon {
option (cosmos.msg.v1.signer) = "controller";
// Controller is the address of the controller to authenticate.
string controller = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// Origin is the origin of the request in wildcard form.
string origin = 2;
// Permissions is the scope of the service.
map<string, string> permissions = 3;
// token is the macron token to authenticate the operation.
string token = 4;
}
// MsgIssueMacaroonResponse is the response type for the AuthorizeService
// RPC.
message MsgIssueMacaroonResponse {
bool success = 1;
string token = 2;
}

View File

@ -1,8 +1,8 @@
syntax = "proto3"; syntax = "proto3";
package oracle.v1; package oracle.v1;
import "gogoproto/gogo.proto";
import "amino/amino.proto"; import "amino/amino.proto";
import "gogoproto/gogo.proto";
option go_package = "github.com/onsonr/sonr/x/oracle/types"; option go_package = "github.com/onsonr/sonr/x/oracle/types";
@ -18,5 +18,34 @@ message Params {
option (gogoproto.equal) = true; option (gogoproto.equal) = true;
option (gogoproto.goproto_stringer) = false; option (gogoproto.goproto_stringer) = false;
bool some_value = 2; Assets assets = 1;
}
message Assets {
option (amino.name) = "oracle/assets";
option (gogoproto.equal) = true;
option (gogoproto.goproto_stringer) = false;
repeated AssetInfo assets = 1;
}
// AssetInfo defines the asset info
message AssetInfo {
// The coin type index for bip44 path
int64 index = 1;
// The hrp for bech32 address
string hrp = 2;
// The coin symbol
string symbol = 3;
// The coin name
string asset_type = 4;
// The name of the asset
string name = 5;
// The icon url
string icon_url = 6;
} }

View File

@ -7,13 +7,33 @@ option go_package = "github.com/onsonr/sonr/x/oracle/types";
// https://github.com/cosmos/cosmos-sdk/blob/main/orm/README.md // https://github.com/cosmos/cosmos-sdk/blob/main/orm/README.md
message ExampleData { message Balance {
option (cosmos.orm.v1.table) = { option (cosmos.orm.v1.table) = {
id: 1; id: 1
primary_key: { fields: "account" } primary_key: {fields: "account"}
index: { id: 1 fields: "amount" } index: {
}; id: 1
fields: "amount"
}
};
bytes account = 1; string account = 1;
uint64 amount = 2; uint64 amount = 2;
}
message Account {
option (cosmos.orm.v1.table) = {
id: 2
primary_key: {fields: "id"}
index: {
id: 1
fields: "account"
unique: true
}
};
uint64 id = 1;
string account = 2;
string chain = 3;
string network = 4;
} }

View File

@ -18,16 +18,34 @@ message Params {
option (gogoproto.equal) = true; option (gogoproto.equal) = true;
option (gogoproto.goproto_stringer) = false; option (gogoproto.goproto_stringer) = false;
bool some_value = 2; ServiceCategories categories = 1;
ServiceTypes types = 2;
}
message ServiceCategories {
option (amino.name) = "service/categories";
option (gogoproto.equal) = true;
option (gogoproto.goproto_stringer) = false;
repeated string categories = 1;
}
message ServiceTypes {
option (amino.name) = "service/types";
option (gogoproto.equal) = true;
option (gogoproto.goproto_stringer) = false;
repeated string types = 1;
} }
// Service defines a Decentralized Service on the Sonr Blockchain // Service defines a Decentralized Service on the Sonr Blockchain
message Service { message Service {
string id = 1; string id = 1;
string service_type = 2; string authority = 2;
string authority = 3; string origin = 3;
string origin = 4; string name = 4;
string description = 5; string description = 5;
map<string, string> service_endpoints = 6; string category = 6;
map<string, string> permissions = 7; repeated string tags = 7;
int64 expiry_height = 8;
} }

View File

@ -7,13 +7,60 @@ option go_package = "github.com/onsonr/sonr/x/service/types";
// https://github.com/cosmos/cosmos-sdk/blob/main/orm/README.md // https://github.com/cosmos/cosmos-sdk/blob/main/orm/README.md
message ExampleData { message Metadata {
option (cosmos.orm.v1.table) = { option (cosmos.orm.v1.table) = {
id: 1; id: 1
primary_key: { fields: "account" } primary_key: {
index: { id: 1 fields: "amount" } fields: "id"
}; auto_increment: true
}
index: {
id: 1
fields: "origin"
unique: true
}
};
bytes account = 1; uint64 id = 1;
uint64 amount = 2; string origin = 2;
string name = 3;
string description = 4;
string category = 5;
URI icon = 6;
repeated string tags = 7;
}
// Profile represents a DID alias
message Profile {
option (cosmos.orm.v1.table) = {
id: 2
primary_key: {fields: "id"}
index: {
id: 1
fields: "subject,origin"
unique: true
}
};
// The unique identifier of the alias
string id = 1;
// The alias of the DID
string subject = 2;
// Origin of the alias
string origin = 3;
// Controller of the alias
string controller = 4;
}
message URI {
enum Protocol {
HTTPS = 0;
IPFS = 1;
}
Protocol protocol = 1;
string uri = 2;
} }

View File

@ -2,9 +2,9 @@ syntax = "proto3";
package service.v1; package service.v1;
import "cosmos/msg/v1/msg.proto"; import "cosmos/msg/v1/msg.proto";
import "service/v1/genesis.proto";
import "gogoproto/gogo.proto";
import "cosmos_proto/cosmos.proto"; import "cosmos_proto/cosmos.proto";
import "gogoproto/gogo.proto";
import "service/v1/genesis.proto";
option go_package = "github.com/onsonr/sonr/x/service/types"; option go_package = "github.com/onsonr/sonr/x/service/types";
@ -16,6 +16,10 @@ service Msg {
// //
// Since: cosmos-sdk 0.47 // Since: cosmos-sdk 0.47
rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse);
// RegisterService initializes a Service with a given permission scope and
// URI. The domain must have a valid TXT record containing the public key.
rpc RegisterService(MsgRegisterService) returns (MsgRegisterServiceResponse);
} }
// MsgUpdateParams is the Msg/UpdateParams request type. // MsgUpdateParams is the Msg/UpdateParams request type.
@ -38,3 +42,21 @@ message MsgUpdateParams {
// //
// Since: cosmos-sdk 0.47 // Since: cosmos-sdk 0.47
message MsgUpdateParamsResponse {} message MsgUpdateParamsResponse {}
// MsgRegisterService is the message type for the RegisterService RPC.
message MsgRegisterService {
option (cosmos.msg.v1.signer) = "controller";
// authority is the address of the governance account.
string controller = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// origin is the origin of the request in wildcard form. Requires valid TXT
// record in DNS.
Service service = 2;
}
// MsgRegisterServiceResponse is the response type for the RegisterService RPC.
message MsgRegisterServiceResponse {
bool success = 1;
string did = 2;
}

View File

@ -27,17 +27,6 @@ func (ms msgServer) RegisterController(goCtx context.Context, msg *types.MsgRegi
return &types.MsgRegisterControllerResponse{}, nil return &types.MsgRegisterControllerResponse{}, nil
} }
// RegisterService implements types.MsgServer.
func (ms msgServer) RegisterService(goCtx context.Context, msg *types.MsgRegisterService) (*types.MsgRegisterServiceResponse, error) {
// ctx := sdk.UnwrapSDKContext(goCtx)
// 1.Check if the service origin is valid
// if !ms.k.IsValidServiceOrigin(ctx, msg.Service.Origin) {
// return nil, types.ErrInvalidServiceOrigin
// }
return nil, errors.Wrapf(types.ErrInvalidServiceOrigin, "invalid service origin")
}
// AuthorizeService implements types.MsgServer. // AuthorizeService implements types.MsgServer.
func (ms msgServer) AuthorizeService(goCtx context.Context, msg *types.MsgAuthorizeService) (*types.MsgAuthorizeServiceResponse, error) { func (ms msgServer) AuthorizeService(goCtx context.Context, msg *types.MsgAuthorizeService) (*types.MsgAuthorizeServiceResponse, error) {
if ms.k.authority != msg.Controller { if ms.k.authority != msg.Controller {

View File

@ -25,7 +25,6 @@ func init() {
func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {
cdc.RegisterConcrete(&MsgUpdateParams{}, ModuleName+"/MsgUpdateParams", nil) cdc.RegisterConcrete(&MsgUpdateParams{}, ModuleName+"/MsgUpdateParams", nil)
cdc.RegisterConcrete(&MsgRegisterController{}, ModuleName+"/MsgRegisterController", nil) cdc.RegisterConcrete(&MsgRegisterController{}, ModuleName+"/MsgRegisterController", nil)
cdc.RegisterConcrete(&MsgRegisterService{}, ModuleName+"/MsgRegisterService", nil)
} }
func RegisterInterfaces(registry types.InterfaceRegistry) { func RegisterInterfaces(registry types.InterfaceRegistry) {
@ -38,7 +37,6 @@ func RegisterInterfaces(registry types.InterfaceRegistry) {
(*sdk.Msg)(nil), (*sdk.Msg)(nil),
&MsgUpdateParams{}, &MsgUpdateParams{},
&MsgRegisterController{}, &MsgRegisterController{},
&MsgRegisterService{},
) )
msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc)
} }

View File

@ -9,6 +9,7 @@ import (
type ControllerI interface { type ControllerI interface {
ChainID() string ChainID() string
GetPubKey() *didv1.PubKey
SonrAddress() string SonrAddress() string
EthAddress() string EthAddress() string
BtcAddress() string BtcAddress() string
@ -77,6 +78,17 @@ func (c *controller) ExportUserKs() (string, error) {
return c.userKs.Marshal() return c.userKs.Marshal()
} }
func (c *controller) GetPubKey() *didv1.PubKey {
return &didv1.PubKey{
KeyType: "ecdsa",
RawKey: &didv1.RawKey{
Algorithm: "secp256k1",
Key: c.publicKey,
},
Role: "authentication",
}
}
func (c *controller) GetTableEntry() (*didv1.Controller, error) { func (c *controller) GetTableEntry() (*didv1.Controller, error) {
valKs, err := c.valKs.Marshal() valKs, err := c.valKs.Marshal()
if err != nil { if err != nil {
@ -88,7 +100,7 @@ func (c *controller) GetTableEntry() (*didv1.Controller, error) {
SonrAddress: c.address, SonrAddress: c.address,
EthAddress: c.ethAddr, EthAddress: c.ethAddr,
BtcAddress: c.btcAddr, BtcAddress: c.btcAddr,
PublicKey: c.publicKey, PublicKey: c.GetPubKey(),
}, nil }, nil
} }

File diff suppressed because it is too large Load Diff

View File

@ -48,41 +48,6 @@ func (msg *MsgUpdateParams) Validate() error {
return msg.Params.Validate() return msg.Params.Validate()
} }
//
// [RegisterService]
//
// NewMsgRegisterController creates a new instance of MsgRegisterController
func NewMsgRegisterService(
sender sdk.Address,
) (*MsgRegisterService, error) {
return &MsgRegisterService{
Controller: sender.String(),
}, nil
}
// Route returns the name of the module
func (msg MsgRegisterService) Route() string { return ModuleName }
// Type returns the the action
func (msg MsgRegisterService) Type() string { return "register_service" }
// GetSignBytes implements the LegacyMsg interface.
func (msg MsgRegisterService) GetSignBytes() []byte {
return sdk.MustSortJSON(AminoCdc.MustMarshalJSON(&msg))
}
// GetSigners returns the expected signers for a MsgUpdateParams message.
func (msg *MsgRegisterService) GetSigners() []sdk.AccAddress {
addr, _ := sdk.AccAddressFromBech32(msg.Controller)
return []sdk.AccAddress{addr}
}
// ValidateBasic does a sanity check on the provided data.
func (msg *MsgRegisterService) Validate() error {
return nil
}
// //
// [RegisterController] // [RegisterController]
// //

View File

@ -1 +1,12 @@
package types package types
import (
didv1 "github.com/onsonr/sonr/api/did/v1"
)
type PubKeyI interface {
GetRole() string
GetKeyType() string
GetRawKey() *didv1.RawKey
GetJwk() *didv1.JSONWebKey
}

View File

@ -189,39 +189,141 @@ func (m *QueryResolveResponse) GetDocument() *Document {
return nil return nil
} }
// Document defines a DID document
type Document struct {
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
Controller string `protobuf:"bytes,2,opt,name=controller,proto3" json:"controller,omitempty"`
Authentication []string `protobuf:"bytes,3,rep,name=authentication,proto3" json:"authentication,omitempty"`
AssertionMethod []string `protobuf:"bytes,4,rep,name=assertion_method,json=assertionMethod,proto3" json:"assertion_method,omitempty"`
CapabilityDelegation []string `protobuf:"bytes,5,rep,name=capability_delegation,json=capabilityDelegation,proto3" json:"capability_delegation,omitempty"`
CapabilityInvocation []string `protobuf:"bytes,6,rep,name=capability_invocation,json=capabilityInvocation,proto3" json:"capability_invocation,omitempty"`
Service []string `protobuf:"bytes,7,rep,name=service,proto3" json:"service,omitempty"`
}
func (m *Document) Reset() { *m = Document{} }
func (m *Document) String() string { return proto.CompactTextString(m) }
func (*Document) ProtoMessage() {}
func (*Document) Descriptor() ([]byte, []int) {
return fileDescriptor_ae1fa9bb626e2869, []int{3}
}
func (m *Document) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *Document) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_Document.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 *Document) XXX_Merge(src proto.Message) {
xxx_messageInfo_Document.Merge(m, src)
}
func (m *Document) XXX_Size() int {
return m.Size()
}
func (m *Document) XXX_DiscardUnknown() {
xxx_messageInfo_Document.DiscardUnknown(m)
}
var xxx_messageInfo_Document proto.InternalMessageInfo
func (m *Document) GetId() string {
if m != nil {
return m.Id
}
return ""
}
func (m *Document) GetController() string {
if m != nil {
return m.Controller
}
return ""
}
func (m *Document) GetAuthentication() []string {
if m != nil {
return m.Authentication
}
return nil
}
func (m *Document) GetAssertionMethod() []string {
if m != nil {
return m.AssertionMethod
}
return nil
}
func (m *Document) GetCapabilityDelegation() []string {
if m != nil {
return m.CapabilityDelegation
}
return nil
}
func (m *Document) GetCapabilityInvocation() []string {
if m != nil {
return m.CapabilityInvocation
}
return nil
}
func (m *Document) GetService() []string {
if m != nil {
return m.Service
}
return nil
}
func init() { func init() {
proto.RegisterType((*QueryRequest)(nil), "did.v1.QueryRequest") proto.RegisterType((*QueryRequest)(nil), "did.v1.QueryRequest")
proto.RegisterType((*QueryParamsResponse)(nil), "did.v1.QueryParamsResponse") proto.RegisterType((*QueryParamsResponse)(nil), "did.v1.QueryParamsResponse")
proto.RegisterType((*QueryResolveResponse)(nil), "did.v1.QueryResolveResponse") proto.RegisterType((*QueryResolveResponse)(nil), "did.v1.QueryResolveResponse")
proto.RegisterType((*Document)(nil), "did.v1.Document")
} }
func init() { proto.RegisterFile("did/v1/query.proto", fileDescriptor_ae1fa9bb626e2869) } func init() { proto.RegisterFile("did/v1/query.proto", fileDescriptor_ae1fa9bb626e2869) }
var fileDescriptor_ae1fa9bb626e2869 = []byte{ var fileDescriptor_ae1fa9bb626e2869 = []byte{
// 362 bytes of a gzipped FileDescriptorProto // 484 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x51, 0xc1, 0x4e, 0xea, 0x40, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x92, 0xc1, 0x6e, 0xd3, 0x40,
0x14, 0xa5, 0xf0, 0x28, 0x8f, 0x79, 0xe4, 0x3d, 0x32, 0xaf, 0x31, 0x0d, 0x92, 0xc6, 0x74, 0x61, 0x10, 0x86, 0xeb, 0xa4, 0x71, 0x9a, 0xa1, 0x4a, 0xa3, 0xc5, 0x20, 0x2b, 0x54, 0x56, 0xe5, 0x43,
0x5c, 0x98, 0x4e, 0xc0, 0xad, 0x6e, 0x0c, 0x4b, 0x17, 0xd2, 0xa5, 0x2b, 0x0b, 0x73, 0x53, 0x27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5, 0xe7, 0x83, 0xce, 0x56, 0x75,
0x8e, 0x72, 0x6e, 0xeb, 0xa7, 0x7e, 0xf9, 0x37, 0x00, 0x00, 0xff, 0xff, 0x9e, 0x85, 0xed, 0xe7,
0x3c, 0x03, 0x00, 0x00,
} }
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
@ -465,6 +567,88 @@ func (m *QueryResolveResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
return len(dAtA) - i, nil return len(dAtA) - i, nil
} }
func (m *Document) 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 *Document) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *Document) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.Service) > 0 {
for iNdEx := len(m.Service) - 1; iNdEx >= 0; iNdEx-- {
i -= len(m.Service[iNdEx])
copy(dAtA[i:], m.Service[iNdEx])
i = encodeVarintQuery(dAtA, i, uint64(len(m.Service[iNdEx])))
i--
dAtA[i] = 0x3a
}
}
if len(m.CapabilityInvocation) > 0 {
for iNdEx := len(m.CapabilityInvocation) - 1; iNdEx >= 0; iNdEx-- {
i -= len(m.CapabilityInvocation[iNdEx])
copy(dAtA[i:], m.CapabilityInvocation[iNdEx])
i = encodeVarintQuery(dAtA, i, uint64(len(m.CapabilityInvocation[iNdEx])))
i--
dAtA[i] = 0x32
}
}
if len(m.CapabilityDelegation) > 0 {
for iNdEx := len(m.CapabilityDelegation) - 1; iNdEx >= 0; iNdEx-- {
i -= len(m.CapabilityDelegation[iNdEx])
copy(dAtA[i:], m.CapabilityDelegation[iNdEx])
i = encodeVarintQuery(dAtA, i, uint64(len(m.CapabilityDelegation[iNdEx])))
i--
dAtA[i] = 0x2a
}
}
if len(m.AssertionMethod) > 0 {
for iNdEx := len(m.AssertionMethod) - 1; iNdEx >= 0; iNdEx-- {
i -= len(m.AssertionMethod[iNdEx])
copy(dAtA[i:], m.AssertionMethod[iNdEx])
i = encodeVarintQuery(dAtA, i, uint64(len(m.AssertionMethod[iNdEx])))
i--
dAtA[i] = 0x22
}
}
if len(m.Authentication) > 0 {
for iNdEx := len(m.Authentication) - 1; iNdEx >= 0; iNdEx-- {
i -= len(m.Authentication[iNdEx])
copy(dAtA[i:], m.Authentication[iNdEx])
i = encodeVarintQuery(dAtA, i, uint64(len(m.Authentication[iNdEx])))
i--
dAtA[i] = 0x1a
}
}
if len(m.Controller) > 0 {
i -= len(m.Controller)
copy(dAtA[i:], m.Controller)
i = encodeVarintQuery(dAtA, i, uint64(len(m.Controller)))
i--
dAtA[i] = 0x12
}
if len(m.Id) > 0 {
i -= len(m.Id)
copy(dAtA[i:], m.Id)
i = encodeVarintQuery(dAtA, i, uint64(len(m.Id)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { func encodeVarintQuery(dAtA []byte, offset int, v uint64) int {
offset -= sovQuery(v) offset -= sovQuery(v)
base := offset base := offset
@ -527,6 +711,53 @@ func (m *QueryResolveResponse) Size() (n int) {
return n return n
} }
func (m *Document) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Id)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
l = len(m.Controller)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
if len(m.Authentication) > 0 {
for _, s := range m.Authentication {
l = len(s)
n += 1 + l + sovQuery(uint64(l))
}
}
if len(m.AssertionMethod) > 0 {
for _, s := range m.AssertionMethod {
l = len(s)
n += 1 + l + sovQuery(uint64(l))
}
}
if len(m.CapabilityDelegation) > 0 {
for _, s := range m.CapabilityDelegation {
l = len(s)
n += 1 + l + sovQuery(uint64(l))
}
}
if len(m.CapabilityInvocation) > 0 {
for _, s := range m.CapabilityInvocation {
l = len(s)
n += 1 + l + sovQuery(uint64(l))
}
}
if len(m.Service) > 0 {
for _, s := range m.Service {
l = len(s)
n += 1 + l + sovQuery(uint64(l))
}
}
return n
}
func sovQuery(x uint64) (n int) { func sovQuery(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7 return (math_bits.Len64(x|1) + 6) / 7
} }
@ -883,6 +1114,280 @@ func (m *QueryResolveResponse) Unmarshal(dAtA []byte) error {
} }
return nil return nil
} }
func (m *Document) 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 ErrIntOverflowQuery
}
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: Document: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: Document: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
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 ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Id = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Controller", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
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 ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Controller = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Authentication", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
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 ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Authentication = append(m.Authentication, string(dAtA[iNdEx:postIndex]))
iNdEx = postIndex
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field AssertionMethod", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
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 ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.AssertionMethod = append(m.AssertionMethod, string(dAtA[iNdEx:postIndex]))
iNdEx = postIndex
case 5:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field CapabilityDelegation", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
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 ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.CapabilityDelegation = append(m.CapabilityDelegation, string(dAtA[iNdEx:postIndex]))
iNdEx = postIndex
case 6:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field CapabilityInvocation", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
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 ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.CapabilityInvocation = append(m.CapabilityInvocation, string(dAtA[iNdEx:postIndex]))
iNdEx = postIndex
case 7:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Service", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
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 ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Service = append(m.Service, string(dAtA[iNdEx:postIndex]))
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipQuery(dAtA []byte) (n int, err error) { func skipQuery(dAtA []byte) (n int, err error) {
l := len(dAtA) l := len(dAtA)
iNdEx := 0 iNdEx := 0

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -28,3 +28,17 @@ func (k Querier) Params(c context.Context, req *types.QueryParamsRequest) (*type
return &types.QueryParamsResponse{Params: &p}, nil return &types.QueryParamsResponse{Params: &p}, nil
} }
// RefreshToken implements types.QueryServer.
func (k Querier) RefreshToken(goCtx context.Context, req *types.QueryRefreshTokenRequest) (*types.QueryRefreshTokenResponse, error) {
// ctx := sdk.UnwrapSDKContext(goCtx)
panic("RefreshToken is unimplemented")
return &types.QueryRefreshTokenResponse{}, nil
}
// ValidateToken implements types.QueryServer.
func (k Querier) ValidateToken(goCtx context.Context, req *types.QueryValidateTokenRequest) (*types.QueryValidateTokenResponse, error) {
// ctx := sdk.UnwrapSDKContext(goCtx)
panic("ValidateToken is unimplemented")
return &types.QueryValidateTokenResponse{}, nil
}

View File

@ -27,3 +27,10 @@ func (ms msgServer) UpdateParams(ctx context.Context, msg *types.MsgUpdateParams
return nil, ms.k.Params.Set(ctx, msg.Params) return nil, ms.k.Params.Set(ctx, msg.Params)
} }
// AuthorizeService implements types.MsgServer.
func (ms msgServer) AuthorizeService(ctx context.Context, msg *types.MsgIssueMacaroon) (*types.MsgIssueMacaroonResponse, error) {
// ctx := sdk.UnwrapSDKContext(goCtx)
panic("AuthorizeService is unimplemented")
return &types.MsgIssueMacaroonResponse{}, nil
}

View File

@ -72,7 +72,12 @@ func (m *GenesisState) GetParams() Params {
// Params defines the set of module parameters. // Params defines the set of module parameters.
type Params struct { type Params struct {
SomeValue bool `protobuf:"varint,2,opt,name=some_value,json=someValue,proto3" json:"some_value,omitempty"` // The list of methods
Methods *Methods `protobuf:"bytes,1,opt,name=methods,proto3" json:"methods,omitempty"`
// The list of scopes
Scopes *Scopes `protobuf:"bytes,2,opt,name=scopes,proto3" json:"scopes,omitempty"`
// The list of caveats
Caveats *Caveats `protobuf:"bytes,3,opt,name=caveats,proto3" json:"caveats,omitempty"`
} }
func (m *Params) Reset() { *m = Params{} } func (m *Params) Reset() { *m = Params{} }
@ -107,38 +112,193 @@ func (m *Params) XXX_DiscardUnknown() {
var xxx_messageInfo_Params proto.InternalMessageInfo var xxx_messageInfo_Params proto.InternalMessageInfo
func (m *Params) GetSomeValue() bool { func (m *Params) GetMethods() *Methods {
if m != nil { if m != nil {
return m.SomeValue return m.Methods
} }
return false return nil
}
func (m *Params) GetScopes() *Scopes {
if m != nil {
return m.Scopes
}
return nil
}
func (m *Params) GetCaveats() *Caveats {
if m != nil {
return m.Caveats
}
return nil
}
// Methods defines the available DID methods
type Methods struct {
Methods []string `protobuf:"bytes,1,rep,name=methods,proto3" json:"methods,omitempty"`
}
func (m *Methods) Reset() { *m = Methods{} }
func (*Methods) ProtoMessage() {}
func (*Methods) Descriptor() ([]byte, []int) {
return fileDescriptor_06e0b5dfdf5e52ba, []int{2}
}
func (m *Methods) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *Methods) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_Methods.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 *Methods) XXX_Merge(src proto.Message) {
xxx_messageInfo_Methods.Merge(m, src)
}
func (m *Methods) XXX_Size() int {
return m.Size()
}
func (m *Methods) XXX_DiscardUnknown() {
xxx_messageInfo_Methods.DiscardUnknown(m)
}
var xxx_messageInfo_Methods proto.InternalMessageInfo
func (m *Methods) GetMethods() []string {
if m != nil {
return m.Methods
}
return nil
}
// Scopes defines the set of scopes
type Scopes struct {
Scopes []string `protobuf:"bytes,1,rep,name=scopes,proto3" json:"scopes,omitempty"`
}
func (m *Scopes) Reset() { *m = Scopes{} }
func (*Scopes) ProtoMessage() {}
func (*Scopes) Descriptor() ([]byte, []int) {
return fileDescriptor_06e0b5dfdf5e52ba, []int{3}
}
func (m *Scopes) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *Scopes) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_Scopes.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 *Scopes) XXX_Merge(src proto.Message) {
xxx_messageInfo_Scopes.Merge(m, src)
}
func (m *Scopes) XXX_Size() int {
return m.Size()
}
func (m *Scopes) XXX_DiscardUnknown() {
xxx_messageInfo_Scopes.DiscardUnknown(m)
}
var xxx_messageInfo_Scopes proto.InternalMessageInfo
func (m *Scopes) GetScopes() []string {
if m != nil {
return m.Scopes
}
return nil
}
// Caveats defines the available caveats
type Caveats struct {
Caveats []string `protobuf:"bytes,1,rep,name=caveats,proto3" json:"caveats,omitempty"`
}
func (m *Caveats) Reset() { *m = Caveats{} }
func (*Caveats) ProtoMessage() {}
func (*Caveats) Descriptor() ([]byte, []int) {
return fileDescriptor_06e0b5dfdf5e52ba, []int{4}
}
func (m *Caveats) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *Caveats) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_Caveats.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 *Caveats) XXX_Merge(src proto.Message) {
xxx_messageInfo_Caveats.Merge(m, src)
}
func (m *Caveats) XXX_Size() int {
return m.Size()
}
func (m *Caveats) XXX_DiscardUnknown() {
xxx_messageInfo_Caveats.DiscardUnknown(m)
}
var xxx_messageInfo_Caveats proto.InternalMessageInfo
func (m *Caveats) GetCaveats() []string {
if m != nil {
return m.Caveats
}
return nil
} }
func init() { func init() {
proto.RegisterType((*GenesisState)(nil), "macaroon.v1.GenesisState") proto.RegisterType((*GenesisState)(nil), "macaroon.v1.GenesisState")
proto.RegisterType((*Params)(nil), "macaroon.v1.Params") proto.RegisterType((*Params)(nil), "macaroon.v1.Params")
proto.RegisterType((*Methods)(nil), "macaroon.v1.Methods")
proto.RegisterType((*Scopes)(nil), "macaroon.v1.Scopes")
proto.RegisterType((*Caveats)(nil), "macaroon.v1.Caveats")
} }
func init() { proto.RegisterFile("macaroon/v1/genesis.proto", fileDescriptor_06e0b5dfdf5e52ba) } func init() { proto.RegisterFile("macaroon/v1/genesis.proto", fileDescriptor_06e0b5dfdf5e52ba) }
var fileDescriptor_06e0b5dfdf5e52ba = []byte{ var fileDescriptor_06e0b5dfdf5e52ba = []byte{
// 245 bytes of a gzipped FileDescriptorProto // 340 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xcc, 0x4d, 0x4c, 0x4e, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xcc, 0x4d, 0x4c, 0x4e,
0x2c, 0xca, 0xcf, 0xcf, 0xd3, 0x2f, 0x33, 0xd4, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2c, 0xca, 0xcf, 0xcf, 0xd3, 0x2f, 0x33, 0xd4, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6,
0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x86, 0x49, 0xe9, 0x95, 0x19, 0x4a, 0x89, 0xa4, 0xe7, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x86, 0x49, 0xe9, 0x95, 0x19, 0x4a, 0x09, 0x26, 0xe6,
0xa7, 0xe7, 0x83, 0xc5, 0xf5, 0x41, 0x2c, 0x88, 0x12, 0x29, 0xc1, 0xc4, 0xdc, 0xcc, 0xbc, 0x7c, 0x66, 0xe6, 0xe5, 0xeb, 0x83, 0x49, 0x88, 0xbc, 0x94, 0x48, 0x7a, 0x7e, 0x7a, 0x3e, 0x98, 0xa9,
0x7d, 0x30, 0x09, 0x11, 0x52, 0x72, 0xe4, 0xe2, 0x71, 0x87, 0x18, 0x13, 0x5c, 0x92, 0x58, 0x92, 0x0f, 0x62, 0x41, 0x44, 0x95, 0x1c, 0xb9, 0x78, 0xdc, 0x21, 0xc6, 0x04, 0x97, 0x24, 0x96, 0xa4,
0x2a, 0x64, 0xc8, 0xc5, 0x56, 0x90, 0x58, 0x94, 0x98, 0x5b, 0x2c, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, 0x0a, 0x19, 0x72, 0xb1, 0x15, 0x24, 0x16, 0x25, 0xe6, 0x16, 0x4b, 0x30, 0x2a, 0x30, 0x6a, 0x70,
0x6d, 0x24, 0xac, 0x87, 0x64, 0xac, 0x5e, 0x00, 0x58, 0xca, 0x89, 0xe5, 0xc4, 0x3d, 0x79, 0x86, 0x1b, 0x09, 0xeb, 0x21, 0x19, 0xab, 0x17, 0x00, 0x96, 0x72, 0x62, 0x39, 0x71, 0x4f, 0x9e, 0x21,
0x20, 0xa8, 0x42, 0x25, 0x57, 0x2e, 0x36, 0x88, 0xb8, 0x90, 0x2c, 0x17, 0x57, 0x71, 0x7e, 0x6e, 0x08, 0xaa, 0x50, 0x69, 0x33, 0x23, 0x17, 0x1b, 0x44, 0x42, 0x48, 0x8f, 0x8b, 0x3d, 0x37, 0xb5,
0x6a, 0x7c, 0x59, 0x62, 0x4e, 0x69, 0xaa, 0x04, 0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0x24, 0x36, 0xb0, 0x9f, 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xc2, 0xd2, 0x5a, 0x08, 0xa8, 0xb4, 0x92, 0x1d, 0x17, 0x1b, 0xc4, 0x8d, 0x42, 0x62, 0x70, 0x8f, 0x40, 0x4c, 0x80,
0x72, 0x26, 0x01, 0x00, 0x00, 0xf2, 0x70, 0xb9, 0x01, 0x22, 0xab, 0xe4, 0xc8, 0xc5, 0x0e, 0x75, 0x35, 0xc8, 0x0d, 0x30, 0xcf,
0x41, 0xdd, 0x40, 0xc0, 0x1b, 0x10, 0x69, 0x27, 0xc7, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92,
0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc2, 0x63, 0x39, 0x86, 0x0b, 0x8f, 0xe5, 0x18, 0x6e, 0x3c,
0x96, 0x63, 0x88, 0x52, 0x4f, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0xcf,
0xcf, 0x2b, 0xce, 0xcf, 0x2b, 0xd2, 0x07, 0x13, 0x15, 0xfa, 0x70, 0x33, 0x4a, 0x2a, 0x0b, 0x52,
0x8b, 0x93, 0xd8, 0xc0, 0x29, 0xc1, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0xe1, 0xf9, 0x89, 0xc0,
0x5c, 0x02, 0x00, 0x00,
} }
func (this *Params) Equal(that interface{}) bool { func (this *Params) Equal(that interface{}) bool {
@ -160,9 +320,102 @@ func (this *Params) Equal(that interface{}) bool {
} else if this == nil { } else if this == nil {
return false return false
} }
if this.SomeValue != that1.SomeValue { if !this.Methods.Equal(that1.Methods) {
return false return false
} }
if !this.Scopes.Equal(that1.Scopes) {
return false
}
if !this.Caveats.Equal(that1.Caveats) {
return false
}
return true
}
func (this *Methods) Equal(that interface{}) bool {
if that == nil {
return this == nil
}
that1, ok := that.(*Methods)
if !ok {
that2, ok := that.(Methods)
if ok {
that1 = &that2
} else {
return false
}
}
if that1 == nil {
return this == nil
} else if this == nil {
return false
}
if len(this.Methods) != len(that1.Methods) {
return false
}
for i := range this.Methods {
if this.Methods[i] != that1.Methods[i] {
return false
}
}
return true
}
func (this *Scopes) Equal(that interface{}) bool {
if that == nil {
return this == nil
}
that1, ok := that.(*Scopes)
if !ok {
that2, ok := that.(Scopes)
if ok {
that1 = &that2
} else {
return false
}
}
if that1 == nil {
return this == nil
} else if this == nil {
return false
}
if len(this.Scopes) != len(that1.Scopes) {
return false
}
for i := range this.Scopes {
if this.Scopes[i] != that1.Scopes[i] {
return false
}
}
return true
}
func (this *Caveats) Equal(that interface{}) bool {
if that == nil {
return this == nil
}
that1, ok := that.(*Caveats)
if !ok {
that2, ok := that.(Caveats)
if ok {
that1 = &that2
} else {
return false
}
}
if that1 == nil {
return this == nil
} else if this == nil {
return false
}
if len(this.Caveats) != len(that1.Caveats) {
return false
}
for i := range this.Caveats {
if this.Caveats[i] != that1.Caveats[i] {
return false
}
}
return true return true
} }
func (m *GenesisState) Marshal() (dAtA []byte, err error) { func (m *GenesisState) Marshal() (dAtA []byte, err error) {
@ -218,15 +471,137 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) {
_ = i _ = i
var l int var l int
_ = l _ = l
if m.SomeValue { if m.Caveats != nil {
i-- {
if m.SomeValue { size, err := m.Caveats.MarshalToSizedBuffer(dAtA[:i])
dAtA[i] = 1 if err != nil {
} else { return 0, err
dAtA[i] = 0 }
i -= size
i = encodeVarintGenesis(dAtA, i, uint64(size))
} }
i-- i--
dAtA[i] = 0x10 dAtA[i] = 0x1a
}
if m.Scopes != nil {
{
size, err := m.Scopes.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintGenesis(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x12
}
if m.Methods != nil {
{
size, err := m.Methods.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 *Methods) 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 *Methods) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *Methods) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.Methods) > 0 {
for iNdEx := len(m.Methods) - 1; iNdEx >= 0; iNdEx-- {
i -= len(m.Methods[iNdEx])
copy(dAtA[i:], m.Methods[iNdEx])
i = encodeVarintGenesis(dAtA, i, uint64(len(m.Methods[iNdEx])))
i--
dAtA[i] = 0xa
}
}
return len(dAtA) - i, nil
}
func (m *Scopes) 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 *Scopes) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *Scopes) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.Scopes) > 0 {
for iNdEx := len(m.Scopes) - 1; iNdEx >= 0; iNdEx-- {
i -= len(m.Scopes[iNdEx])
copy(dAtA[i:], m.Scopes[iNdEx])
i = encodeVarintGenesis(dAtA, i, uint64(len(m.Scopes[iNdEx])))
i--
dAtA[i] = 0xa
}
}
return len(dAtA) - i, nil
}
func (m *Caveats) 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 *Caveats) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *Caveats) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.Caveats) > 0 {
for iNdEx := len(m.Caveats) - 1; iNdEx >= 0; iNdEx-- {
i -= len(m.Caveats[iNdEx])
copy(dAtA[i:], m.Caveats[iNdEx])
i = encodeVarintGenesis(dAtA, i, uint64(len(m.Caveats[iNdEx])))
i--
dAtA[i] = 0xa
}
} }
return len(dAtA) - i, nil return len(dAtA) - i, nil
} }
@ -259,8 +634,62 @@ func (m *Params) Size() (n int) {
} }
var l int var l int
_ = l _ = l
if m.SomeValue { if m.Methods != nil {
n += 2 l = m.Methods.Size()
n += 1 + l + sovGenesis(uint64(l))
}
if m.Scopes != nil {
l = m.Scopes.Size()
n += 1 + l + sovGenesis(uint64(l))
}
if m.Caveats != nil {
l = m.Caveats.Size()
n += 1 + l + sovGenesis(uint64(l))
}
return n
}
func (m *Methods) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if len(m.Methods) > 0 {
for _, s := range m.Methods {
l = len(s)
n += 1 + l + sovGenesis(uint64(l))
}
}
return n
}
func (m *Scopes) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if len(m.Scopes) > 0 {
for _, s := range m.Scopes {
l = len(s)
n += 1 + l + sovGenesis(uint64(l))
}
}
return n
}
func (m *Caveats) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if len(m.Caveats) > 0 {
for _, s := range m.Caveats {
l = len(s)
n += 1 + l + sovGenesis(uint64(l))
}
} }
return n return n
} }
@ -383,11 +812,11 @@ func (m *Params) Unmarshal(dAtA []byte) error {
return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire)
} }
switch fieldNum { switch fieldNum {
case 2: case 1:
if wireType != 0 { if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field SomeValue", wireType) return fmt.Errorf("proto: wrong wireType = %d for field Methods", wireType)
} }
var v int var msglen int
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
if shift >= 64 { if shift >= 64 {
return ErrIntOverflowGenesis return ErrIntOverflowGenesis
@ -397,12 +826,346 @@ func (m *Params) Unmarshal(dAtA []byte) error {
} }
b := dAtA[iNdEx] b := dAtA[iNdEx]
iNdEx++ iNdEx++
v |= int(b&0x7F) << shift msglen |= int(b&0x7F) << shift
if b < 0x80 { if b < 0x80 {
break break
} }
} }
m.SomeValue = bool(v != 0) if msglen < 0 {
return ErrInvalidLengthGenesis
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthGenesis
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.Methods == nil {
m.Methods = &Methods{}
}
if err := m.Methods.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Scopes", 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 m.Scopes == nil {
m.Scopes = &Scopes{}
}
if err := m.Scopes.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Caveats", 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 m.Caveats == nil {
m.Caveats = &Caveats{}
}
if err := m.Caveats.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 *Methods) 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: Methods: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: Methods: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Methods", 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.Methods = append(m.Methods, 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 (m *Scopes) 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: Scopes: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: Scopes: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Scopes", 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.Scopes = append(m.Scopes, 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 (m *Caveats) 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: Caveats: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: Caveats: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Caveats", 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.Caveats = append(m.Caveats, string(dAtA[iNdEx:postIndex]))
iNdEx = postIndex
default: default:
iNdEx = preIndex iNdEx = preIndex
skippy, err := skipGenesis(dAtA[iNdEx:]) skippy, err := skipGenesis(dAtA[iNdEx:])

View File

@ -111,31 +111,231 @@ func (m *QueryParamsResponse) GetParams() *Params {
return nil return nil
} }
// QueryRefreshTokenRequest is the request type for the Query/RefreshToken RPC
// method.
type QueryRefreshTokenRequest struct {
// The macaroon token to refresh
Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"`
}
func (m *QueryRefreshTokenRequest) Reset() { *m = QueryRefreshTokenRequest{} }
func (m *QueryRefreshTokenRequest) String() string { return proto.CompactTextString(m) }
func (*QueryRefreshTokenRequest) ProtoMessage() {}
func (*QueryRefreshTokenRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_ce46a74a5956a389, []int{2}
}
func (m *QueryRefreshTokenRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryRefreshTokenRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryRefreshTokenRequest.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 *QueryRefreshTokenRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryRefreshTokenRequest.Merge(m, src)
}
func (m *QueryRefreshTokenRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryRefreshTokenRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryRefreshTokenRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryRefreshTokenRequest proto.InternalMessageInfo
func (m *QueryRefreshTokenRequest) GetToken() string {
if m != nil {
return m.Token
}
return ""
}
// QueryRefreshTokenResponse is the response type for the Query/RefreshToken
// RPC method.
type QueryRefreshTokenResponse struct {
// The macaroon token
Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"`
}
func (m *QueryRefreshTokenResponse) Reset() { *m = QueryRefreshTokenResponse{} }
func (m *QueryRefreshTokenResponse) String() string { return proto.CompactTextString(m) }
func (*QueryRefreshTokenResponse) ProtoMessage() {}
func (*QueryRefreshTokenResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_ce46a74a5956a389, []int{3}
}
func (m *QueryRefreshTokenResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryRefreshTokenResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryRefreshTokenResponse.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 *QueryRefreshTokenResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryRefreshTokenResponse.Merge(m, src)
}
func (m *QueryRefreshTokenResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryRefreshTokenResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryRefreshTokenResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryRefreshTokenResponse proto.InternalMessageInfo
func (m *QueryRefreshTokenResponse) GetToken() string {
if m != nil {
return m.Token
}
return ""
}
// QueryValidateTokenRequest is the request type for the Query/ValidateToken
// RPC method.
type QueryValidateTokenRequest struct {
// The macaroon token to validate
Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"`
}
func (m *QueryValidateTokenRequest) Reset() { *m = QueryValidateTokenRequest{} }
func (m *QueryValidateTokenRequest) String() string { return proto.CompactTextString(m) }
func (*QueryValidateTokenRequest) ProtoMessage() {}
func (*QueryValidateTokenRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_ce46a74a5956a389, []int{4}
}
func (m *QueryValidateTokenRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryValidateTokenRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryValidateTokenRequest.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 *QueryValidateTokenRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryValidateTokenRequest.Merge(m, src)
}
func (m *QueryValidateTokenRequest) XXX_Size() int {
return m.Size()
}
func (m *QueryValidateTokenRequest) XXX_DiscardUnknown() {
xxx_messageInfo_QueryValidateTokenRequest.DiscardUnknown(m)
}
var xxx_messageInfo_QueryValidateTokenRequest proto.InternalMessageInfo
func (m *QueryValidateTokenRequest) GetToken() string {
if m != nil {
return m.Token
}
return ""
}
// QueryValidateTokenResponse is the response type for the Query/ValidateToken
// RPC method.
type QueryValidateTokenResponse struct {
// The macaroon token
Valid bool `protobuf:"varint,1,opt,name=valid,proto3" json:"valid,omitempty"`
}
func (m *QueryValidateTokenResponse) Reset() { *m = QueryValidateTokenResponse{} }
func (m *QueryValidateTokenResponse) String() string { return proto.CompactTextString(m) }
func (*QueryValidateTokenResponse) ProtoMessage() {}
func (*QueryValidateTokenResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_ce46a74a5956a389, []int{5}
}
func (m *QueryValidateTokenResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *QueryValidateTokenResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_QueryValidateTokenResponse.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 *QueryValidateTokenResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_QueryValidateTokenResponse.Merge(m, src)
}
func (m *QueryValidateTokenResponse) XXX_Size() int {
return m.Size()
}
func (m *QueryValidateTokenResponse) XXX_DiscardUnknown() {
xxx_messageInfo_QueryValidateTokenResponse.DiscardUnknown(m)
}
var xxx_messageInfo_QueryValidateTokenResponse proto.InternalMessageInfo
func (m *QueryValidateTokenResponse) GetValid() bool {
if m != nil {
return m.Valid
}
return false
}
func init() { func init() {
proto.RegisterType((*QueryParamsRequest)(nil), "macaroon.v1.QueryParamsRequest") proto.RegisterType((*QueryParamsRequest)(nil), "macaroon.v1.QueryParamsRequest")
proto.RegisterType((*QueryParamsResponse)(nil), "macaroon.v1.QueryParamsResponse") proto.RegisterType((*QueryParamsResponse)(nil), "macaroon.v1.QueryParamsResponse")
proto.RegisterType((*QueryRefreshTokenRequest)(nil), "macaroon.v1.QueryRefreshTokenRequest")
proto.RegisterType((*QueryRefreshTokenResponse)(nil), "macaroon.v1.QueryRefreshTokenResponse")
proto.RegisterType((*QueryValidateTokenRequest)(nil), "macaroon.v1.QueryValidateTokenRequest")
proto.RegisterType((*QueryValidateTokenResponse)(nil), "macaroon.v1.QueryValidateTokenResponse")
} }
func init() { proto.RegisterFile("macaroon/v1/query.proto", fileDescriptor_ce46a74a5956a389) } func init() { proto.RegisterFile("macaroon/v1/query.proto", fileDescriptor_ce46a74a5956a389) }
var fileDescriptor_ce46a74a5956a389 = []byte{ var fileDescriptor_ce46a74a5956a389 = []byte{
// 253 bytes of a gzipped FileDescriptorProto // 379 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0xcf, 0x4d, 0x4c, 0x4e, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0xc1, 0x4e, 0xc2, 0x30,
0x2c, 0xca, 0xcf, 0xcf, 0xd3, 0x2f, 0x33, 0xd4, 0x2f, 0x2c, 0x4d, 0x2d, 0xaa, 0xd4, 0x2b, 0x28, 0x1c, 0xc6, 0x19, 0x09, 0x44, 0x8b, 0x5e, 0x0a, 0x08, 0x4c, 0x9c, 0x64, 0x89, 0x62, 0x62, 0xb2,
0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x86, 0x49, 0xe8, 0x95, 0x19, 0x4a, 0xc9, 0xa4, 0xe7, 0xe7, 0xa7, 0x09, 0x3e, 0x81, 0x3c, 0x81, 0x2e, 0xc6, 0x83, 0xb7, 0x82, 0x75, 0x2c, 0x42, 0x3b, 0xda, 0xb2,
0xe7, 0xa4, 0xea, 0x27, 0x16, 0x64, 0xea, 0x27, 0xe6, 0xe5, 0xe5, 0x97, 0x24, 0x96, 0x64, 0xe6, 0x48, 0x3c, 0x98, 0xf8, 0x04, 0x26, 0xbe, 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 0x00, 0xf7, 0x13, 0x97, 0x5f, 0x2d, 0xd1, 0x6c, 0xfc, 0x2e, 0x50, 0x30, 0x7b, 0xf7, 0xe9, 0xed, 0xf3,
0x25, 0x5b, 0x86, 0x45, 0x37, 0xfe, 0x81, 0x54, 0x7f, 0xf0, 0x01, 0x6c, 0xc5, 0x8b, 0x80, 0x07,
0xab, 0x71, 0x29, 0xd5, 0x9a, 0x87, 0xeb, 0x64, 0x9a, 0x5d, 0x97, 0xec, 0x1d, 0xbb, 0x94, 0x60,
0x33, 0x25, 0x85, 0x8f, 0x60, 0x3b, 0xd1, 0x0f, 0x4c, 0x89, 0x4d, 0xeb, 0xdc, 0x6c, 0xae, 0xd5,
0x69, 0xfe, 0x9e, 0xe4, 0x57, 0xec, 0x72, 0x82, 0x1f, 0x69, 0x6d, 0xe7, 0xec, 0x75, 0x66, 0x19,
0xd3, 0x99, 0x65, 0x7c, 0xcc, 0x2c, 0xe3, 0x79, 0x6e, 0x65, 0xa6, 0x73, 0x2b, 0xf3, 0x3e, 0xb7,
0x32, 0xd7, 0x4d, 0x3f, 0x10, 0xfd, 0x71, 0xd7, 0xe9, 0xd1, 0xa1, 0x4b, 0x09, 0xa7, 0x84, 0xb9,
0xf2, 0x71, 0xbf, 0x0c, 0x12, 0x93, 0x10, 0xf3, 0x6e, 0x5e, 0xfe, 0xe1, 0xa7, 0xdf, 0x01, 0x00,
0x00, 0xff, 0xff, 0xfd, 0x69, 0x19, 0xa1, 0x42, 0x03, 0x00, 0x00,
} }
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
@ -152,6 +352,10 @@ const _ = grpc.SupportPackageIsVersion4
type QueryClient interface { type QueryClient interface {
// Params queries all parameters of the module. // Params queries all parameters of the module.
Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error)
// RefreshToken refreshes a macaroon token as post authentication.
RefreshToken(ctx context.Context, in *QueryRefreshTokenRequest, opts ...grpc.CallOption) (*QueryRefreshTokenResponse, error)
// ValidateToken validates a macaroon token as pre authentication.
ValidateToken(ctx context.Context, in *QueryValidateTokenRequest, opts ...grpc.CallOption) (*QueryValidateTokenResponse, error)
} }
type queryClient struct { type queryClient struct {
@ -171,10 +375,32 @@ func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts .
return out, nil return out, nil
} }
func (c *queryClient) RefreshToken(ctx context.Context, in *QueryRefreshTokenRequest, opts ...grpc.CallOption) (*QueryRefreshTokenResponse, error) {
out := new(QueryRefreshTokenResponse)
err := c.cc.Invoke(ctx, "/macaroon.v1.Query/RefreshToken", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) ValidateToken(ctx context.Context, in *QueryValidateTokenRequest, opts ...grpc.CallOption) (*QueryValidateTokenResponse, error) {
out := new(QueryValidateTokenResponse)
err := c.cc.Invoke(ctx, "/macaroon.v1.Query/ValidateToken", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// QueryServer is the server API for Query service. // QueryServer is the server API for Query service.
type QueryServer interface { type QueryServer interface {
// Params queries all parameters of the module. // Params queries all parameters of the module.
Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error)
// RefreshToken refreshes a macaroon token as post authentication.
RefreshToken(context.Context, *QueryRefreshTokenRequest) (*QueryRefreshTokenResponse, error)
// ValidateToken validates a macaroon token as pre authentication.
ValidateToken(context.Context, *QueryValidateTokenRequest) (*QueryValidateTokenResponse, error)
} }
// UnimplementedQueryServer can be embedded to have forward compatible implementations. // UnimplementedQueryServer can be embedded to have forward compatible implementations.
@ -184,6 +410,12 @@ type UnimplementedQueryServer struct {
func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") return nil, status.Errorf(codes.Unimplemented, "method Params not implemented")
} }
func (*UnimplementedQueryServer) RefreshToken(ctx context.Context, req *QueryRefreshTokenRequest) (*QueryRefreshTokenResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method RefreshToken not implemented")
}
func (*UnimplementedQueryServer) ValidateToken(ctx context.Context, req *QueryValidateTokenRequest) (*QueryValidateTokenResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ValidateToken not implemented")
}
func RegisterQueryServer(s grpc1.Server, srv QueryServer) { func RegisterQueryServer(s grpc1.Server, srv QueryServer) {
s.RegisterService(&_Query_serviceDesc, srv) s.RegisterService(&_Query_serviceDesc, srv)
@ -207,6 +439,42 @@ func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interf
return interceptor(ctx, in, info, handler) return interceptor(ctx, in, info, handler)
} }
func _Query_RefreshToken_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryRefreshTokenRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).RefreshToken(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/macaroon.v1.Query/RefreshToken",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).RefreshToken(ctx, req.(*QueryRefreshTokenRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_ValidateToken_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryValidateTokenRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).ValidateToken(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/macaroon.v1.Query/ValidateToken",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).ValidateToken(ctx, req.(*QueryValidateTokenRequest))
}
return interceptor(ctx, in, info, handler)
}
var _Query_serviceDesc = grpc.ServiceDesc{ var _Query_serviceDesc = grpc.ServiceDesc{
ServiceName: "macaroon.v1.Query", ServiceName: "macaroon.v1.Query",
HandlerType: (*QueryServer)(nil), HandlerType: (*QueryServer)(nil),
@ -215,6 +483,14 @@ var _Query_serviceDesc = grpc.ServiceDesc{
MethodName: "Params", MethodName: "Params",
Handler: _Query_Params_Handler, Handler: _Query_Params_Handler,
}, },
{
MethodName: "RefreshToken",
Handler: _Query_RefreshToken_Handler,
},
{
MethodName: "ValidateToken",
Handler: _Query_ValidateToken_Handler,
},
}, },
Streams: []grpc.StreamDesc{}, Streams: []grpc.StreamDesc{},
Metadata: "macaroon/v1/query.proto", Metadata: "macaroon/v1/query.proto",
@ -278,6 +554,129 @@ func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
return len(dAtA) - i, nil return len(dAtA) - i, nil
} }
func (m *QueryRefreshTokenRequest) 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 *QueryRefreshTokenRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryRefreshTokenRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.Token) > 0 {
i -= len(m.Token)
copy(dAtA[i:], m.Token)
i = encodeVarintQuery(dAtA, i, uint64(len(m.Token)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *QueryRefreshTokenResponse) 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 *QueryRefreshTokenResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryRefreshTokenResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.Token) > 0 {
i -= len(m.Token)
copy(dAtA[i:], m.Token)
i = encodeVarintQuery(dAtA, i, uint64(len(m.Token)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *QueryValidateTokenRequest) 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 *QueryValidateTokenRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryValidateTokenRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.Token) > 0 {
i -= len(m.Token)
copy(dAtA[i:], m.Token)
i = encodeVarintQuery(dAtA, i, uint64(len(m.Token)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *QueryValidateTokenResponse) 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 *QueryValidateTokenResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *QueryValidateTokenResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.Valid {
i--
if m.Valid {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i--
dAtA[i] = 0x8
}
return len(dAtA) - i, nil
}
func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { func encodeVarintQuery(dAtA []byte, offset int, v uint64) int {
offset -= sovQuery(v) offset -= sovQuery(v)
base := offset base := offset
@ -311,6 +710,57 @@ func (m *QueryParamsResponse) Size() (n int) {
return n return n
} }
func (m *QueryRefreshTokenRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Token)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryRefreshTokenResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Token)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryValidateTokenRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Token)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *QueryValidateTokenResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.Valid {
n += 2
}
return n
}
func sovQuery(x uint64) (n int) { func sovQuery(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7 return (math_bits.Len64(x|1) + 6) / 7
} }
@ -453,6 +903,322 @@ func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error {
} }
return nil return nil
} }
func (m *QueryRefreshTokenRequest) 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 ErrIntOverflowQuery
}
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: QueryRefreshTokenRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryRefreshTokenRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Token", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
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 ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Token = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryRefreshTokenResponse) 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 ErrIntOverflowQuery
}
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: QueryRefreshTokenResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryRefreshTokenResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Token", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
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 ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Token = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryValidateTokenRequest) 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 ErrIntOverflowQuery
}
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: QueryValidateTokenRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryValidateTokenRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Token", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
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 ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Token = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *QueryValidateTokenResponse) 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 ErrIntOverflowQuery
}
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: QueryValidateTokenResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: QueryValidateTokenResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Valid", wireType)
}
var v int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
v |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
m.Valid = bool(v != 0)
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipQuery(dAtA []byte) (n int, err error) { func skipQuery(dAtA []byte) (n int, err error) {
l := len(dAtA) l := len(dAtA)
iNdEx := 0 iNdEx := 0

View File

@ -51,6 +51,78 @@ func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshal
} }
var (
filter_Query_RefreshToken_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
)
func request_Query_RefreshToken_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryRefreshTokenRequest
var metadata runtime.ServerMetadata
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_RefreshToken_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.RefreshToken(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_RefreshToken_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryRefreshTokenRequest
var metadata runtime.ServerMetadata
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_RefreshToken_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.RefreshToken(ctx, &protoReq)
return msg, metadata, err
}
var (
filter_Query_ValidateToken_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
)
func request_Query_ValidateToken_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryValidateTokenRequest
var metadata runtime.ServerMetadata
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_ValidateToken_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.ValidateToken(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_ValidateToken_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryValidateTokenRequest
var metadata runtime.ServerMetadata
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_ValidateToken_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.ValidateToken(ctx, &protoReq)
return msg, metadata, err
}
// RegisterQueryHandlerServer registers the http handlers for service Query to "mux". // RegisterQueryHandlerServer registers the http handlers for service Query to "mux".
// UnaryRPC :call QueryServer directly. // UnaryRPC :call QueryServer directly.
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
@ -80,6 +152,52 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
}) })
mux.Handle("POST", pattern_Query_RefreshToken_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_RefreshToken_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_RefreshToken_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("POST", pattern_Query_ValidateToken_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_ValidateToken_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_ValidateToken_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil return nil
} }
@ -141,13 +259,61 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie
}) })
mux.Handle("POST", pattern_Query_RefreshToken_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_RefreshToken_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_RefreshToken_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("POST", pattern_Query_ValidateToken_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_ValidateToken_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_ValidateToken_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil return nil
} }
var ( var (
pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"macaroon", "v1", "params"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"macaroon", "v1", "params"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_RefreshToken_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"macaroon", "v1", "refresh"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_ValidateToken_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"macaroon", "v1", "validate"}, "", runtime.AssumeColonVerbOpt(false)))
) )
var ( var (
forward_Query_Params_0 = runtime.ForwardResponseMessage forward_Query_Params_0 = runtime.ForwardResponseMessage
forward_Query_RefreshToken_0 = runtime.ForwardResponseMessage
forward_Query_ValidateToken_0 = runtime.ForwardResponseMessage
) )

View File

@ -23,23 +23,26 @@ var _ = math.Inf
// proto package needs to be updated. // proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
type ExampleData struct { type Grant struct {
Account []byte `protobuf:"bytes,1,opt,name=account,proto3" json:"account,omitempty"` Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
Amount uint64 `protobuf:"varint,2,opt,name=amount,proto3" json:"amount,omitempty"` Controller string `protobuf:"bytes,2,opt,name=controller,proto3" json:"controller,omitempty"`
Subject string `protobuf:"bytes,3,opt,name=subject,proto3" json:"subject,omitempty"`
Origin string `protobuf:"bytes,4,opt,name=origin,proto3" json:"origin,omitempty"`
ExpiryHeight int64 `protobuf:"varint,5,opt,name=expiry_height,json=expiryHeight,proto3" json:"expiry_height,omitempty"`
} }
func (m *ExampleData) Reset() { *m = ExampleData{} } func (m *Grant) Reset() { *m = Grant{} }
func (m *ExampleData) String() string { return proto.CompactTextString(m) } func (m *Grant) String() string { return proto.CompactTextString(m) }
func (*ExampleData) ProtoMessage() {} func (*Grant) ProtoMessage() {}
func (*ExampleData) Descriptor() ([]byte, []int) { func (*Grant) Descriptor() ([]byte, []int) {
return fileDescriptor_2ade56339acadfd8, []int{0} return fileDescriptor_2ade56339acadfd8, []int{0}
} }
func (m *ExampleData) XXX_Unmarshal(b []byte) error { func (m *Grant) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b) return m.Unmarshal(b)
} }
func (m *ExampleData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { func (m *Grant) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic { if deterministic {
return xxx_messageInfo_ExampleData.Marshal(b, m, deterministic) return xxx_messageInfo_Grant.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b) n, err := m.MarshalToSizedBuffer(b)
@ -49,57 +52,82 @@ func (m *ExampleData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
return b[:n], nil return b[:n], nil
} }
} }
func (m *ExampleData) XXX_Merge(src proto.Message) { func (m *Grant) XXX_Merge(src proto.Message) {
xxx_messageInfo_ExampleData.Merge(m, src) xxx_messageInfo_Grant.Merge(m, src)
} }
func (m *ExampleData) XXX_Size() int { func (m *Grant) XXX_Size() int {
return m.Size() return m.Size()
} }
func (m *ExampleData) XXX_DiscardUnknown() { func (m *Grant) XXX_DiscardUnknown() {
xxx_messageInfo_ExampleData.DiscardUnknown(m) xxx_messageInfo_Grant.DiscardUnknown(m)
} }
var xxx_messageInfo_ExampleData proto.InternalMessageInfo var xxx_messageInfo_Grant proto.InternalMessageInfo
func (m *ExampleData) GetAccount() []byte { func (m *Grant) GetId() uint64 {
if m != nil { if m != nil {
return m.Account return m.Id
} }
return nil return 0
} }
func (m *ExampleData) GetAmount() uint64 { func (m *Grant) GetController() string {
if m != nil { if m != nil {
return m.Amount return m.Controller
}
return ""
}
func (m *Grant) GetSubject() string {
if m != nil {
return m.Subject
}
return ""
}
func (m *Grant) GetOrigin() string {
if m != nil {
return m.Origin
}
return ""
}
func (m *Grant) GetExpiryHeight() int64 {
if m != nil {
return m.ExpiryHeight
} }
return 0 return 0
} }
func init() { func init() {
proto.RegisterType((*ExampleData)(nil), "macaroon.v1.ExampleData") proto.RegisterType((*Grant)(nil), "macaroon.v1.Grant")
} }
func init() { proto.RegisterFile("macaroon/v1/state.proto", fileDescriptor_2ade56339acadfd8) } func init() { proto.RegisterFile("macaroon/v1/state.proto", fileDescriptor_2ade56339acadfd8) }
var fileDescriptor_2ade56339acadfd8 = []byte{ var fileDescriptor_2ade56339acadfd8 = []byte{
// 209 bytes of a gzipped FileDescriptorProto // 280 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0xcf, 0x4d, 0x4c, 0x4e, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0xcf, 0x4d, 0x4c, 0x4e,
0x2c, 0xca, 0xcf, 0xcf, 0xd3, 0x2f, 0x33, 0xd4, 0x2f, 0x2e, 0x49, 0x2c, 0x49, 0xd5, 0x2b, 0x28, 0x2c, 0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x47, 0x72, 0x8c, 0x13, 0x1e, 0xcb, 0x31, 0x5c, 0x78, 0x2c,
0xc7, 0x70, 0xe3, 0xb1, 0x1c, 0x43, 0x94, 0x7a, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72,
0x7e, 0xae, 0x7e, 0x7e, 0x5e, 0x71, 0x7e, 0x5e, 0x91, 0x3e, 0x98, 0xa8, 0xd0, 0x87, 0x07, 0x55,
0x49, 0x65, 0x41, 0x6a, 0x71, 0x12, 0x1b, 0x38, 0x08, 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff,
0x83, 0x14, 0xb8, 0x7a, 0x43, 0x01, 0x00, 0x00,
} }
func (m *ExampleData) Marshal() (dAtA []byte, err error) { func (m *Grant) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size]) n, err := m.MarshalToSizedBuffer(dAtA[:size])
@ -109,27 +137,46 @@ func (m *ExampleData) Marshal() (dAtA []byte, err error) {
return dAtA[:n], nil return dAtA[:n], nil
} }
func (m *ExampleData) MarshalTo(dAtA []byte) (int, error) { func (m *Grant) MarshalTo(dAtA []byte) (int, error) {
size := m.Size() size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size]) return m.MarshalToSizedBuffer(dAtA[:size])
} }
func (m *ExampleData) MarshalToSizedBuffer(dAtA []byte) (int, error) { func (m *Grant) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA) i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if m.Amount != 0 { if m.ExpiryHeight != 0 {
i = encodeVarintState(dAtA, i, uint64(m.Amount)) i = encodeVarintState(dAtA, i, uint64(m.ExpiryHeight))
i-- i--
dAtA[i] = 0x10 dAtA[i] = 0x28
} }
if len(m.Account) > 0 { if len(m.Origin) > 0 {
i -= len(m.Account) i -= len(m.Origin)
copy(dAtA[i:], m.Account) copy(dAtA[i:], m.Origin)
i = encodeVarintState(dAtA, i, uint64(len(m.Account))) i = encodeVarintState(dAtA, i, uint64(len(m.Origin)))
i-- i--
dAtA[i] = 0xa dAtA[i] = 0x22
}
if len(m.Subject) > 0 {
i -= len(m.Subject)
copy(dAtA[i:], m.Subject)
i = encodeVarintState(dAtA, i, uint64(len(m.Subject)))
i--
dAtA[i] = 0x1a
}
if len(m.Controller) > 0 {
i -= len(m.Controller)
copy(dAtA[i:], m.Controller)
i = encodeVarintState(dAtA, i, uint64(len(m.Controller)))
i--
dAtA[i] = 0x12
}
if m.Id != 0 {
i = encodeVarintState(dAtA, i, uint64(m.Id))
i--
dAtA[i] = 0x8
} }
return len(dAtA) - i, nil return len(dAtA) - i, nil
} }
@ -145,18 +192,29 @@ func encodeVarintState(dAtA []byte, offset int, v uint64) int {
dAtA[offset] = uint8(v) dAtA[offset] = uint8(v)
return base return base
} }
func (m *ExampleData) Size() (n int) { func (m *Grant) Size() (n int) {
if m == nil { if m == nil {
return 0 return 0
} }
var l int var l int
_ = l _ = l
l = len(m.Account) if m.Id != 0 {
n += 1 + sovState(uint64(m.Id))
}
l = len(m.Controller)
if l > 0 { if l > 0 {
n += 1 + l + sovState(uint64(l)) n += 1 + l + sovState(uint64(l))
} }
if m.Amount != 0 { l = len(m.Subject)
n += 1 + sovState(uint64(m.Amount)) if l > 0 {
n += 1 + l + sovState(uint64(l))
}
l = len(m.Origin)
if l > 0 {
n += 1 + l + sovState(uint64(l))
}
if m.ExpiryHeight != 0 {
n += 1 + sovState(uint64(m.ExpiryHeight))
} }
return n return n
} }
@ -167,7 +225,7 @@ func sovState(x uint64) (n int) {
func sozState(x uint64) (n int) { func sozState(x uint64) (n int) {
return sovState(uint64((x << 1) ^ uint64((int64(x) >> 63)))) return sovState(uint64((x << 1) ^ uint64((int64(x) >> 63))))
} }
func (m *ExampleData) Unmarshal(dAtA []byte) error { func (m *Grant) Unmarshal(dAtA []byte) error {
l := len(dAtA) l := len(dAtA)
iNdEx := 0 iNdEx := 0
for iNdEx < l { for iNdEx < l {
@ -190,17 +248,17 @@ func (m *ExampleData) Unmarshal(dAtA []byte) error {
fieldNum := int32(wire >> 3) fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7) wireType := int(wire & 0x7)
if wireType == 4 { if wireType == 4 {
return fmt.Errorf("proto: ExampleData: wiretype end group for non-group") return fmt.Errorf("proto: Grant: wiretype end group for non-group")
} }
if fieldNum <= 0 { if fieldNum <= 0 {
return fmt.Errorf("proto: ExampleData: illegal tag %d (wire type %d)", fieldNum, wire) return fmt.Errorf("proto: Grant: illegal tag %d (wire type %d)", fieldNum, wire)
} }
switch fieldNum { switch fieldNum {
case 1: case 1:
if wireType != 2 { if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Account", wireType) return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType)
} }
var byteLen int m.Id = 0
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
if shift >= 64 { if shift >= 64 {
return ErrIntOverflowState return ErrIntOverflowState
@ -210,31 +268,48 @@ func (m *ExampleData) Unmarshal(dAtA []byte) error {
} }
b := dAtA[iNdEx] b := dAtA[iNdEx]
iNdEx++ iNdEx++
byteLen |= int(b&0x7F) << shift m.Id |= uint64(b&0x7F) << shift
if b < 0x80 { if b < 0x80 {
break break
} }
} }
if byteLen < 0 { case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Controller", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowState
}
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 ErrInvalidLengthState return ErrInvalidLengthState
} }
postIndex := iNdEx + byteLen postIndex := iNdEx + intStringLen
if postIndex < 0 { if postIndex < 0 {
return ErrInvalidLengthState return ErrInvalidLengthState
} }
if postIndex > l { if postIndex > l {
return io.ErrUnexpectedEOF return io.ErrUnexpectedEOF
} }
m.Account = append(m.Account[:0], dAtA[iNdEx:postIndex]...) m.Controller = string(dAtA[iNdEx:postIndex])
if m.Account == nil {
m.Account = []byte{}
}
iNdEx = postIndex iNdEx = postIndex
case 2: case 3:
if wireType != 0 { if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) return fmt.Errorf("proto: wrong wireType = %d for field Subject", wireType)
} }
m.Amount = 0 var stringLen uint64
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
if shift >= 64 { if shift >= 64 {
return ErrIntOverflowState return ErrIntOverflowState
@ -244,7 +319,71 @@ func (m *ExampleData) Unmarshal(dAtA []byte) error {
} }
b := dAtA[iNdEx] b := dAtA[iNdEx]
iNdEx++ iNdEx++
m.Amount |= uint64(b&0x7F) << shift stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthState
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthState
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Subject = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Origin", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowState
}
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 ErrInvalidLengthState
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthState
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Origin = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 5:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field ExpiryHeight", wireType)
}
m.ExpiryHeight = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowState
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.ExpiryHeight |= int64(b&0x7F) << shift
if b < 0x80 { if b < 0x80 {
break break
} }

View File

@ -129,35 +129,177 @@ func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() {
var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo
// MsgIssueMacaroon is the message type for the AuthorizeService RPC.
type MsgIssueMacaroon struct {
// Controller is the address of the controller to authenticate.
Controller string `protobuf:"bytes,1,opt,name=controller,proto3" json:"controller,omitempty"`
// Origin is the origin of the request in wildcard form.
Origin string `protobuf:"bytes,2,opt,name=origin,proto3" json:"origin,omitempty"`
// Permissions is the scope of the service.
Permissions map[string]string `protobuf:"bytes,3,rep,name=permissions,proto3" json:"permissions,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
// token is the macron token to authenticate the operation.
Token string `protobuf:"bytes,4,opt,name=token,proto3" json:"token,omitempty"`
}
func (m *MsgIssueMacaroon) Reset() { *m = MsgIssueMacaroon{} }
func (m *MsgIssueMacaroon) String() string { return proto.CompactTextString(m) }
func (*MsgIssueMacaroon) ProtoMessage() {}
func (*MsgIssueMacaroon) Descriptor() ([]byte, []int) {
return fileDescriptor_68f908349d9da51a, []int{2}
}
func (m *MsgIssueMacaroon) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgIssueMacaroon) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgIssueMacaroon.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 *MsgIssueMacaroon) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgIssueMacaroon.Merge(m, src)
}
func (m *MsgIssueMacaroon) XXX_Size() int {
return m.Size()
}
func (m *MsgIssueMacaroon) XXX_DiscardUnknown() {
xxx_messageInfo_MsgIssueMacaroon.DiscardUnknown(m)
}
var xxx_messageInfo_MsgIssueMacaroon proto.InternalMessageInfo
func (m *MsgIssueMacaroon) GetController() string {
if m != nil {
return m.Controller
}
return ""
}
func (m *MsgIssueMacaroon) GetOrigin() string {
if m != nil {
return m.Origin
}
return ""
}
func (m *MsgIssueMacaroon) GetPermissions() map[string]string {
if m != nil {
return m.Permissions
}
return nil
}
func (m *MsgIssueMacaroon) GetToken() string {
if m != nil {
return m.Token
}
return ""
}
// MsgIssueMacaroonResponse is the response type for the AuthorizeService
// RPC.
type MsgIssueMacaroonResponse struct {
Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"`
Token string `protobuf:"bytes,2,opt,name=token,proto3" json:"token,omitempty"`
}
func (m *MsgIssueMacaroonResponse) Reset() { *m = MsgIssueMacaroonResponse{} }
func (m *MsgIssueMacaroonResponse) String() string { return proto.CompactTextString(m) }
func (*MsgIssueMacaroonResponse) ProtoMessage() {}
func (*MsgIssueMacaroonResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_68f908349d9da51a, []int{3}
}
func (m *MsgIssueMacaroonResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgIssueMacaroonResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgIssueMacaroonResponse.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 *MsgIssueMacaroonResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgIssueMacaroonResponse.Merge(m, src)
}
func (m *MsgIssueMacaroonResponse) XXX_Size() int {
return m.Size()
}
func (m *MsgIssueMacaroonResponse) XXX_DiscardUnknown() {
xxx_messageInfo_MsgIssueMacaroonResponse.DiscardUnknown(m)
}
var xxx_messageInfo_MsgIssueMacaroonResponse proto.InternalMessageInfo
func (m *MsgIssueMacaroonResponse) GetSuccess() bool {
if m != nil {
return m.Success
}
return false
}
func (m *MsgIssueMacaroonResponse) GetToken() string {
if m != nil {
return m.Token
}
return ""
}
func init() { func init() {
proto.RegisterType((*MsgUpdateParams)(nil), "macaroon.v1.MsgUpdateParams") proto.RegisterType((*MsgUpdateParams)(nil), "macaroon.v1.MsgUpdateParams")
proto.RegisterType((*MsgUpdateParamsResponse)(nil), "macaroon.v1.MsgUpdateParamsResponse") proto.RegisterType((*MsgUpdateParamsResponse)(nil), "macaroon.v1.MsgUpdateParamsResponse")
proto.RegisterType((*MsgIssueMacaroon)(nil), "macaroon.v1.MsgIssueMacaroon")
proto.RegisterMapType((map[string]string)(nil), "macaroon.v1.MsgIssueMacaroon.PermissionsEntry")
proto.RegisterType((*MsgIssueMacaroonResponse)(nil), "macaroon.v1.MsgIssueMacaroonResponse")
} }
func init() { proto.RegisterFile("macaroon/v1/tx.proto", fileDescriptor_68f908349d9da51a) } func init() { proto.RegisterFile("macaroon/v1/tx.proto", fileDescriptor_68f908349d9da51a) }
var fileDescriptor_68f908349d9da51a = []byte{ var fileDescriptor_68f908349d9da51a = []byte{
// 318 bytes of a gzipped FileDescriptorProto // 507 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0xc9, 0x4d, 0x4c, 0x4e, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x53, 0x4f, 0x6b, 0x13, 0x4f,
0x2c, 0xca, 0xcf, 0xcf, 0xd3, 0x2f, 0x33, 0xd4, 0x2f, 0xa9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x18, 0xce, 0x24, 0x6d, 0x7e, 0xbf, 0x4c,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 0x42, 0x39, 0xc9, 0xcf,
0xb9, 0x73, 0xf3, 0x40, 0xf4, 0x32, 0xa4, 0x70, 0x52, 0x4f, 0x1e, 0xc7, 0xf3, 0xbf, 0x01, 0x00,
0x00, 0xff, 0xff, 0x0d, 0x7b, 0xef, 0xfd, 0xa6, 0x03, 0x00, 0x00,
} }
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
@ -176,6 +318,9 @@ type MsgClient interface {
// //
// Since: cosmos-sdk 0.47 // Since: cosmos-sdk 0.47
UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error)
// AuthorizeService asserts the given controller is the owner of the given
// address.
AuthorizeService(ctx context.Context, in *MsgIssueMacaroon, opts ...grpc.CallOption) (*MsgIssueMacaroonResponse, error)
} }
type msgClient struct { type msgClient struct {
@ -195,12 +340,24 @@ func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts
return out, nil return out, nil
} }
func (c *msgClient) AuthorizeService(ctx context.Context, in *MsgIssueMacaroon, opts ...grpc.CallOption) (*MsgIssueMacaroonResponse, error) {
out := new(MsgIssueMacaroonResponse)
err := c.cc.Invoke(ctx, "/macaroon.v1.Msg/AuthorizeService", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// MsgServer is the server API for Msg service. // MsgServer is the server API for Msg service.
type MsgServer interface { type MsgServer interface {
// UpdateParams defines a governance operation for updating the parameters. // UpdateParams defines a governance operation for updating the parameters.
// //
// Since: cosmos-sdk 0.47 // Since: cosmos-sdk 0.47
UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error)
// AuthorizeService asserts the given controller is the owner of the given
// address.
AuthorizeService(context.Context, *MsgIssueMacaroon) (*MsgIssueMacaroonResponse, error)
} }
// UnimplementedMsgServer can be embedded to have forward compatible implementations. // UnimplementedMsgServer can be embedded to have forward compatible implementations.
@ -210,6 +367,9 @@ type UnimplementedMsgServer struct {
func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented")
} }
func (*UnimplementedMsgServer) AuthorizeService(ctx context.Context, req *MsgIssueMacaroon) (*MsgIssueMacaroonResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method AuthorizeService not implemented")
}
func RegisterMsgServer(s grpc1.Server, srv MsgServer) { func RegisterMsgServer(s grpc1.Server, srv MsgServer) {
s.RegisterService(&_Msg_serviceDesc, srv) s.RegisterService(&_Msg_serviceDesc, srv)
@ -233,6 +393,24 @@ func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(in
return interceptor(ctx, in, info, handler) return interceptor(ctx, in, info, handler)
} }
func _Msg_AuthorizeService_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgIssueMacaroon)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).AuthorizeService(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/macaroon.v1.Msg/AuthorizeService",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).AuthorizeService(ctx, req.(*MsgIssueMacaroon))
}
return interceptor(ctx, in, info, handler)
}
var _Msg_serviceDesc = grpc.ServiceDesc{ var _Msg_serviceDesc = grpc.ServiceDesc{
ServiceName: "macaroon.v1.Msg", ServiceName: "macaroon.v1.Msg",
HandlerType: (*MsgServer)(nil), HandlerType: (*MsgServer)(nil),
@ -241,6 +419,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{
MethodName: "UpdateParams", MethodName: "UpdateParams",
Handler: _Msg_UpdateParams_Handler, Handler: _Msg_UpdateParams_Handler,
}, },
{
MethodName: "AuthorizeService",
Handler: _Msg_AuthorizeService_Handler,
},
}, },
Streams: []grpc.StreamDesc{}, Streams: []grpc.StreamDesc{},
Metadata: "macaroon/v1/tx.proto", Metadata: "macaroon/v1/tx.proto",
@ -309,6 +491,109 @@ func (m *MsgUpdateParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)
return len(dAtA) - i, nil return len(dAtA) - i, nil
} }
func (m *MsgIssueMacaroon) 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 *MsgIssueMacaroon) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgIssueMacaroon) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.Token) > 0 {
i -= len(m.Token)
copy(dAtA[i:], m.Token)
i = encodeVarintTx(dAtA, i, uint64(len(m.Token)))
i--
dAtA[i] = 0x22
}
if len(m.Permissions) > 0 {
for k := range m.Permissions {
v := m.Permissions[k]
baseI := i
i -= len(v)
copy(dAtA[i:], v)
i = encodeVarintTx(dAtA, i, uint64(len(v)))
i--
dAtA[i] = 0x12
i -= len(k)
copy(dAtA[i:], k)
i = encodeVarintTx(dAtA, i, uint64(len(k)))
i--
dAtA[i] = 0xa
i = encodeVarintTx(dAtA, i, uint64(baseI-i))
i--
dAtA[i] = 0x1a
}
}
if len(m.Origin) > 0 {
i -= len(m.Origin)
copy(dAtA[i:], m.Origin)
i = encodeVarintTx(dAtA, i, uint64(len(m.Origin)))
i--
dAtA[i] = 0x12
}
if len(m.Controller) > 0 {
i -= len(m.Controller)
copy(dAtA[i:], m.Controller)
i = encodeVarintTx(dAtA, i, uint64(len(m.Controller)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *MsgIssueMacaroonResponse) 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 *MsgIssueMacaroonResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgIssueMacaroonResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.Token) > 0 {
i -= len(m.Token)
copy(dAtA[i:], m.Token)
i = encodeVarintTx(dAtA, i, uint64(len(m.Token)))
i--
dAtA[i] = 0x12
}
if m.Success {
i--
if m.Success {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i--
dAtA[i] = 0x8
}
return len(dAtA) - i, nil
}
func encodeVarintTx(dAtA []byte, offset int, v uint64) int { func encodeVarintTx(dAtA []byte, offset int, v uint64) int {
offset -= sovTx(v) offset -= sovTx(v)
base := offset base := offset
@ -344,6 +629,51 @@ func (m *MsgUpdateParamsResponse) Size() (n int) {
return n return n
} }
func (m *MsgIssueMacaroon) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Controller)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
l = len(m.Origin)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
if len(m.Permissions) > 0 {
for k, v := range m.Permissions {
_ = k
_ = v
mapEntrySize := 1 + len(k) + sovTx(uint64(len(k))) + 1 + len(v) + sovTx(uint64(len(v)))
n += mapEntrySize + 1 + sovTx(uint64(mapEntrySize))
}
}
l = len(m.Token)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
return n
}
func (m *MsgIssueMacaroonResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.Success {
n += 2
}
l = len(m.Token)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
return n
}
func sovTx(x uint64) (n int) { func sovTx(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7 return (math_bits.Len64(x|1) + 6) / 7
} }
@ -515,6 +845,381 @@ func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error {
} }
return nil return nil
} }
func (m *MsgIssueMacaroon) 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 ErrIntOverflowTx
}
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: MsgIssueMacaroon: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgIssueMacaroon: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Controller", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
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 ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Controller = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Origin", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
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 ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Origin = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Permissions", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.Permissions == nil {
m.Permissions = make(map[string]string)
}
var mapkey string
var mapvalue string
for iNdEx < postIndex {
entryPreIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
if fieldNum == 1 {
var stringLenmapkey uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLenmapkey |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLenmapkey := int(stringLenmapkey)
if intStringLenmapkey < 0 {
return ErrInvalidLengthTx
}
postStringIndexmapkey := iNdEx + intStringLenmapkey
if postStringIndexmapkey < 0 {
return ErrInvalidLengthTx
}
if postStringIndexmapkey > l {
return io.ErrUnexpectedEOF
}
mapkey = string(dAtA[iNdEx:postStringIndexmapkey])
iNdEx = postStringIndexmapkey
} else if fieldNum == 2 {
var stringLenmapvalue uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLenmapvalue |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLenmapvalue := int(stringLenmapvalue)
if intStringLenmapvalue < 0 {
return ErrInvalidLengthTx
}
postStringIndexmapvalue := iNdEx + intStringLenmapvalue
if postStringIndexmapvalue < 0 {
return ErrInvalidLengthTx
}
if postStringIndexmapvalue > l {
return io.ErrUnexpectedEOF
}
mapvalue = string(dAtA[iNdEx:postStringIndexmapvalue])
iNdEx = postStringIndexmapvalue
} else {
iNdEx = entryPreIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > postIndex {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
m.Permissions[mapkey] = mapvalue
iNdEx = postIndex
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Token", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
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 ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Token = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *MsgIssueMacaroonResponse) 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 ErrIntOverflowTx
}
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: MsgIssueMacaroonResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgIssueMacaroonResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Success", wireType)
}
var v int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
v |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
m.Success = bool(v != 0)
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Token", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
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 ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Token = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipTx(dAtA []byte) (n int, err error) { func skipTx(dAtA []byte) (n int, err error) {
l := len(dAtA) l := len(dAtA)
iNdEx := 0 iNdEx := 0

View File

@ -72,7 +72,7 @@ func (m *GenesisState) GetParams() Params {
// Params defines the set of module parameters. // Params defines the set of module parameters.
type Params struct { type Params struct {
SomeValue bool `protobuf:"varint,2,opt,name=some_value,json=someValue,proto3" json:"some_value,omitempty"` Assets *Assets `protobuf:"bytes,1,opt,name=assets,proto3" json:"assets,omitempty"`
} }
func (m *Params) Reset() { *m = Params{} } func (m *Params) Reset() { *m = Params{} }
@ -107,38 +107,181 @@ func (m *Params) XXX_DiscardUnknown() {
var xxx_messageInfo_Params proto.InternalMessageInfo var xxx_messageInfo_Params proto.InternalMessageInfo
func (m *Params) GetSomeValue() bool { func (m *Params) GetAssets() *Assets {
if m != nil { if m != nil {
return m.SomeValue return m.Assets
} }
return false return nil
}
type Assets struct {
Assets []*AssetInfo `protobuf:"bytes,1,rep,name=assets,proto3" json:"assets,omitempty"`
}
func (m *Assets) Reset() { *m = Assets{} }
func (*Assets) ProtoMessage() {}
func (*Assets) Descriptor() ([]byte, []int) {
return fileDescriptor_14b982a0a6345d1d, []int{2}
}
func (m *Assets) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *Assets) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_Assets.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 *Assets) XXX_Merge(src proto.Message) {
xxx_messageInfo_Assets.Merge(m, src)
}
func (m *Assets) XXX_Size() int {
return m.Size()
}
func (m *Assets) XXX_DiscardUnknown() {
xxx_messageInfo_Assets.DiscardUnknown(m)
}
var xxx_messageInfo_Assets proto.InternalMessageInfo
func (m *Assets) GetAssets() []*AssetInfo {
if m != nil {
return m.Assets
}
return nil
}
// AssetInfo defines the asset info
type AssetInfo struct {
// The coin type index for bip44 path
Index int64 `protobuf:"varint,1,opt,name=index,proto3" json:"index,omitempty"`
// The hrp for bech32 address
Hrp string `protobuf:"bytes,2,opt,name=hrp,proto3" json:"hrp,omitempty"`
// The coin symbol
Symbol string `protobuf:"bytes,3,opt,name=symbol,proto3" json:"symbol,omitempty"`
// The coin name
AssetType string `protobuf:"bytes,4,opt,name=asset_type,json=assetType,proto3" json:"asset_type,omitempty"`
// The name of the asset
Name string `protobuf:"bytes,5,opt,name=name,proto3" json:"name,omitempty"`
// The icon url
IconUrl string `protobuf:"bytes,6,opt,name=icon_url,json=iconUrl,proto3" json:"icon_url,omitempty"`
}
func (m *AssetInfo) Reset() { *m = AssetInfo{} }
func (m *AssetInfo) String() string { return proto.CompactTextString(m) }
func (*AssetInfo) ProtoMessage() {}
func (*AssetInfo) Descriptor() ([]byte, []int) {
return fileDescriptor_14b982a0a6345d1d, []int{3}
}
func (m *AssetInfo) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *AssetInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_AssetInfo.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 *AssetInfo) XXX_Merge(src proto.Message) {
xxx_messageInfo_AssetInfo.Merge(m, src)
}
func (m *AssetInfo) XXX_Size() int {
return m.Size()
}
func (m *AssetInfo) XXX_DiscardUnknown() {
xxx_messageInfo_AssetInfo.DiscardUnknown(m)
}
var xxx_messageInfo_AssetInfo proto.InternalMessageInfo
func (m *AssetInfo) GetIndex() int64 {
if m != nil {
return m.Index
}
return 0
}
func (m *AssetInfo) GetHrp() string {
if m != nil {
return m.Hrp
}
return ""
}
func (m *AssetInfo) GetSymbol() string {
if m != nil {
return m.Symbol
}
return ""
}
func (m *AssetInfo) GetAssetType() string {
if m != nil {
return m.AssetType
}
return ""
}
func (m *AssetInfo) GetName() string {
if m != nil {
return m.Name
}
return ""
}
func (m *AssetInfo) GetIconUrl() string {
if m != nil {
return m.IconUrl
}
return ""
} }
func init() { func init() {
proto.RegisterType((*GenesisState)(nil), "oracle.v1.GenesisState") proto.RegisterType((*GenesisState)(nil), "oracle.v1.GenesisState")
proto.RegisterType((*Params)(nil), "oracle.v1.Params") proto.RegisterType((*Params)(nil), "oracle.v1.Params")
proto.RegisterType((*Assets)(nil), "oracle.v1.Assets")
proto.RegisterType((*AssetInfo)(nil), "oracle.v1.AssetInfo")
} }
func init() { proto.RegisterFile("oracle/v1/genesis.proto", fileDescriptor_14b982a0a6345d1d) } func init() { proto.RegisterFile("oracle/v1/genesis.proto", fileDescriptor_14b982a0a6345d1d) }
var fileDescriptor_14b982a0a6345d1d = []byte{ var fileDescriptor_14b982a0a6345d1d = []byte{
// 243 bytes of a gzipped FileDescriptorProto // 366 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0xcf, 0x2f, 0x4a, 0x4c, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x91, 0xc1, 0x4a, 0xeb, 0x40,
0xce, 0x49, 0xd5, 0x2f, 0x33, 0xd4, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0x14, 0x86, 0x33, 0x37, 0x6d, 0xee, 0xcd, 0xf4, 0x0a, 0x76, 0x28, 0x1a, 0x0b, 0xa6, 0xa5, 0x20,
0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x84, 0x48, 0xe8, 0x95, 0x19, 0x4a, 0x89, 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xc2, 0xe6, 0x7a,
0x12, 0x1b, 0xd8, 0x37, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x0e, 0x80, 0x35, 0x92, 0x1c, 0x83, 0x54, 0x70, 0x31, 0xe0, 0xb7, 0x6c, 0x02, 0xff, 0xa9, 0xbb, 0xaa, 0x21, 0x9b, 0x58, 0x1f,
0x01, 0x00, 0x00, 0x26, 0xb1, 0xf5, 0xa7, 0x8e, 0x9a, 0xa6, 0x9b, 0x49, 0xb2, 0x85, 0x0d, 0x39, 0x8d, 0xfa, 0x22,
0xb4, 0x74, 0x30, 0xf3, 0x8e, 0xec, 0x62, 0x0c, 0xdc, 0x5e, 0x3a, 0x8d, 0x99, 0x55, 0x80, 0xcc,
0x04, 0xe7, 0x6a, 0x1a, 0x33, 0x42, 0x70, 0x81, 0x7b, 0x11, 0xb3, 0x8a, 0x10, 0x80, 0x26, 0x3b,
0xf8, 0x5f, 0x30, 0x10, 0xbc, 0x37, 0x4a, 0x42, 0xcb, 0x00, 0xff, 0x6f, 0xd6, 0x5f, 0x27, 0x61,
0xb7, 0x33, 0x5f, 0xda, 0x68, 0xb1, 0xb4, 0xd1, 0xdb, 0xd2, 0x46, 0x0f, 0x2b, 0x5b, 0x5b, 0xac,
0x6c, 0xed, 0x65, 0x65, 0x6b, 0x37, 0x7b, 0x7e, 0x90, 0x0e, 0x47, 0x7d, 0x67, 0x20, 0x22, 0x2a,
0xb8, 0x14, 0x3c, 0xa1, 0x50, 0x26, 0x34, 0xbf, 0x2e, 0xfb, 0xbe, 0xec, 0x1b, 0xf0, 0x92, 0x47,
0x9f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xdf, 0xd4, 0x42, 0x19, 0x18, 0x02, 0x00, 0x00,
} }
func (this *Params) Equal(that interface{}) bool { func (this *Params) Equal(that interface{}) bool {
@ -160,11 +303,40 @@ func (this *Params) Equal(that interface{}) bool {
} else if this == nil { } else if this == nil {
return false return false
} }
if this.SomeValue != that1.SomeValue { if !this.Assets.Equal(that1.Assets) {
return false return false
} }
return true return true
} }
func (this *Assets) Equal(that interface{}) bool {
if that == nil {
return this == nil
}
that1, ok := that.(*Assets)
if !ok {
that2, ok := that.(Assets)
if ok {
that1 = &that2
} else {
return false
}
}
if that1 == nil {
return this == nil
} else if this == nil {
return false
}
if len(this.Assets) != len(that1.Assets) {
return false
}
for i := range this.Assets {
if !this.Assets[i].Equal(that1.Assets[i]) {
return false
}
}
return true
}
func (m *GenesisState) Marshal() (dAtA []byte, err error) { func (m *GenesisState) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
@ -218,15 +390,117 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) {
_ = i _ = i
var l int var l int
_ = l _ = l
if m.SomeValue { if m.Assets != nil {
i-- {
if m.SomeValue { size, err := m.Assets.MarshalToSizedBuffer(dAtA[:i])
dAtA[i] = 1 if err != nil {
} else { return 0, err
dAtA[i] = 0 }
i -= size
i = encodeVarintGenesis(dAtA, i, uint64(size))
} }
i-- i--
dAtA[i] = 0x10 dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *Assets) 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 *Assets) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *Assets) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.Assets) > 0 {
for iNdEx := len(m.Assets) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.Assets[iNdEx].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 *AssetInfo) 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 *AssetInfo) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *AssetInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.IconUrl) > 0 {
i -= len(m.IconUrl)
copy(dAtA[i:], m.IconUrl)
i = encodeVarintGenesis(dAtA, i, uint64(len(m.IconUrl)))
i--
dAtA[i] = 0x32
}
if len(m.Name) > 0 {
i -= len(m.Name)
copy(dAtA[i:], m.Name)
i = encodeVarintGenesis(dAtA, i, uint64(len(m.Name)))
i--
dAtA[i] = 0x2a
}
if len(m.AssetType) > 0 {
i -= len(m.AssetType)
copy(dAtA[i:], m.AssetType)
i = encodeVarintGenesis(dAtA, i, uint64(len(m.AssetType)))
i--
dAtA[i] = 0x22
}
if len(m.Symbol) > 0 {
i -= len(m.Symbol)
copy(dAtA[i:], m.Symbol)
i = encodeVarintGenesis(dAtA, i, uint64(len(m.Symbol)))
i--
dAtA[i] = 0x1a
}
if len(m.Hrp) > 0 {
i -= len(m.Hrp)
copy(dAtA[i:], m.Hrp)
i = encodeVarintGenesis(dAtA, i, uint64(len(m.Hrp)))
i--
dAtA[i] = 0x12
}
if m.Index != 0 {
i = encodeVarintGenesis(dAtA, i, uint64(m.Index))
i--
dAtA[i] = 0x8
} }
return len(dAtA) - i, nil return len(dAtA) - i, nil
} }
@ -259,8 +533,56 @@ func (m *Params) Size() (n int) {
} }
var l int var l int
_ = l _ = l
if m.SomeValue { if m.Assets != nil {
n += 2 l = m.Assets.Size()
n += 1 + l + sovGenesis(uint64(l))
}
return n
}
func (m *Assets) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if len(m.Assets) > 0 {
for _, e := range m.Assets {
l = e.Size()
n += 1 + l + sovGenesis(uint64(l))
}
}
return n
}
func (m *AssetInfo) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.Index != 0 {
n += 1 + sovGenesis(uint64(m.Index))
}
l = len(m.Hrp)
if l > 0 {
n += 1 + l + sovGenesis(uint64(l))
}
l = len(m.Symbol)
if l > 0 {
n += 1 + l + sovGenesis(uint64(l))
}
l = len(m.AssetType)
if l > 0 {
n += 1 + l + sovGenesis(uint64(l))
}
l = len(m.Name)
if l > 0 {
n += 1 + l + sovGenesis(uint64(l))
}
l = len(m.IconUrl)
if l > 0 {
n += 1 + l + sovGenesis(uint64(l))
} }
return n return n
} }
@ -383,11 +705,11 @@ func (m *Params) Unmarshal(dAtA []byte) error {
return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire)
} }
switch fieldNum { switch fieldNum {
case 2: case 1:
if wireType != 0 { if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field SomeValue", wireType) return fmt.Errorf("proto: wrong wireType = %d for field Assets", wireType)
} }
var v int var msglen int
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
if shift >= 64 { if shift >= 64 {
return ErrIntOverflowGenesis return ErrIntOverflowGenesis
@ -397,12 +719,341 @@ func (m *Params) Unmarshal(dAtA []byte) error {
} }
b := dAtA[iNdEx] b := dAtA[iNdEx]
iNdEx++ iNdEx++
v |= int(b&0x7F) << shift msglen |= int(b&0x7F) << shift
if b < 0x80 { if b < 0x80 {
break break
} }
} }
m.SomeValue = bool(v != 0) if msglen < 0 {
return ErrInvalidLengthGenesis
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthGenesis
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.Assets == nil {
m.Assets = &Assets{}
}
if err := m.Assets.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 *Assets) 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: Assets: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: Assets: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Assets", 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
}
m.Assets = append(m.Assets, &AssetInfo{})
if err := m.Assets[len(m.Assets)-1].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 *AssetInfo) 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: AssetInfo: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: AssetInfo: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType)
}
m.Index = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenesis
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.Index |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Hrp", 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.Hrp = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Symbol", 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.Symbol = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field AssetType", 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.AssetType = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 5:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Name", 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.Name = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 6:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field IconUrl", 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.IconUrl = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default: default:
iNdEx = preIndex iNdEx = preIndex
skippy, err := skipGenesis(dAtA[iNdEx:]) skippy, err := skipGenesis(dAtA[iNdEx:])

View File

@ -23,23 +23,23 @@ var _ = math.Inf
// proto package needs to be updated. // proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
type ExampleData struct { type Balance struct {
Account []byte `protobuf:"bytes,1,opt,name=account,proto3" json:"account,omitempty"` Account string `protobuf:"bytes,1,opt,name=account,proto3" json:"account,omitempty"`
Amount uint64 `protobuf:"varint,2,opt,name=amount,proto3" json:"amount,omitempty"` Amount uint64 `protobuf:"varint,2,opt,name=amount,proto3" json:"amount,omitempty"`
} }
func (m *ExampleData) Reset() { *m = ExampleData{} } func (m *Balance) Reset() { *m = Balance{} }
func (m *ExampleData) String() string { return proto.CompactTextString(m) } func (m *Balance) String() string { return proto.CompactTextString(m) }
func (*ExampleData) ProtoMessage() {} func (*Balance) ProtoMessage() {}
func (*ExampleData) Descriptor() ([]byte, []int) { func (*Balance) Descriptor() ([]byte, []int) {
return fileDescriptor_8840885873256d8c, []int{0} return fileDescriptor_8840885873256d8c, []int{0}
} }
func (m *ExampleData) XXX_Unmarshal(b []byte) error { func (m *Balance) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b) return m.Unmarshal(b)
} }
func (m *ExampleData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { func (m *Balance) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic { if deterministic {
return xxx_messageInfo_ExampleData.Marshal(b, m, deterministic) return xxx_messageInfo_Balance.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b) n, err := m.MarshalToSizedBuffer(b)
@ -49,56 +49,130 @@ func (m *ExampleData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
return b[:n], nil return b[:n], nil
} }
} }
func (m *ExampleData) XXX_Merge(src proto.Message) { func (m *Balance) XXX_Merge(src proto.Message) {
xxx_messageInfo_ExampleData.Merge(m, src) xxx_messageInfo_Balance.Merge(m, src)
} }
func (m *ExampleData) XXX_Size() int { func (m *Balance) XXX_Size() int {
return m.Size() return m.Size()
} }
func (m *ExampleData) XXX_DiscardUnknown() { func (m *Balance) XXX_DiscardUnknown() {
xxx_messageInfo_ExampleData.DiscardUnknown(m) xxx_messageInfo_Balance.DiscardUnknown(m)
} }
var xxx_messageInfo_ExampleData proto.InternalMessageInfo var xxx_messageInfo_Balance proto.InternalMessageInfo
func (m *ExampleData) GetAccount() []byte { func (m *Balance) GetAccount() string {
if m != nil { if m != nil {
return m.Account return m.Account
} }
return nil return ""
} }
func (m *ExampleData) GetAmount() uint64 { func (m *Balance) GetAmount() uint64 {
if m != nil { if m != nil {
return m.Amount return m.Amount
} }
return 0 return 0
} }
type Account struct {
Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
Account string `protobuf:"bytes,2,opt,name=account,proto3" json:"account,omitempty"`
Chain string `protobuf:"bytes,3,opt,name=chain,proto3" json:"chain,omitempty"`
Network string `protobuf:"bytes,4,opt,name=network,proto3" json:"network,omitempty"`
}
func (m *Account) Reset() { *m = Account{} }
func (m *Account) String() string { return proto.CompactTextString(m) }
func (*Account) ProtoMessage() {}
func (*Account) Descriptor() ([]byte, []int) {
return fileDescriptor_8840885873256d8c, []int{1}
}
func (m *Account) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *Account) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_Account.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 *Account) XXX_Merge(src proto.Message) {
xxx_messageInfo_Account.Merge(m, src)
}
func (m *Account) XXX_Size() int {
return m.Size()
}
func (m *Account) XXX_DiscardUnknown() {
xxx_messageInfo_Account.DiscardUnknown(m)
}
var xxx_messageInfo_Account proto.InternalMessageInfo
func (m *Account) GetId() uint64 {
if m != nil {
return m.Id
}
return 0
}
func (m *Account) GetAccount() string {
if m != nil {
return m.Account
}
return ""
}
func (m *Account) GetChain() string {
if m != nil {
return m.Chain
}
return ""
}
func (m *Account) GetNetwork() string {
if m != nil {
return m.Network
}
return ""
}
func init() { func init() {
proto.RegisterType((*ExampleData)(nil), "oracle.v1.ExampleData") proto.RegisterType((*Balance)(nil), "oracle.v1.Balance")
proto.RegisterType((*Account)(nil), "oracle.v1.Account")
} }
func init() { proto.RegisterFile("oracle/v1/state.proto", fileDescriptor_8840885873256d8c) } func init() { proto.RegisterFile("oracle/v1/state.proto", fileDescriptor_8840885873256d8c) }
var fileDescriptor_8840885873256d8c = []byte{ var fileDescriptor_8840885873256d8c = []byte{
// 207 bytes of a gzipped FileDescriptorProto // 275 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0xcd, 0x2f, 0x4a, 0x4c, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0xcd, 0x2f, 0x4a, 0x4c,
0xce, 0x49, 0xd5, 0x2f, 0x33, 0xd4, 0x2f, 0x2e, 0x49, 0x2c, 0x49, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xce, 0x49, 0xd5, 0x2f, 0x33, 0xd4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0x63, 0x39, 0x86, 0x1b, 0x8f, 0xe5,
0x18, 0xa2, 0x54, 0xd3, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0xf3, 0xf3,
0x8a, 0xf3, 0xf3, 0x8a, 0xf4, 0xc1, 0x44, 0x85, 0x3e, 0x34, 0x40, 0x4b, 0x2a, 0x0b, 0x52, 0x8b,
0x93, 0xd8, 0xc0, 0x41, 0x65, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0xff, 0x11, 0xbc, 0xfd, 0x67,
0x01, 0x00, 0x00,
} }
func (m *ExampleData) Marshal() (dAtA []byte, err error) { func (m *Balance) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size]) n, err := m.MarshalToSizedBuffer(dAtA[:size])
@ -108,12 +182,12 @@ func (m *ExampleData) Marshal() (dAtA []byte, err error) {
return dAtA[:n], nil return dAtA[:n], nil
} }
func (m *ExampleData) MarshalTo(dAtA []byte) (int, error) { func (m *Balance) MarshalTo(dAtA []byte) (int, error) {
size := m.Size() size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size]) return m.MarshalToSizedBuffer(dAtA[:size])
} }
func (m *ExampleData) MarshalToSizedBuffer(dAtA []byte) (int, error) { func (m *Balance) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA) i := len(dAtA)
_ = i _ = i
var l int var l int
@ -133,6 +207,55 @@ func (m *ExampleData) MarshalToSizedBuffer(dAtA []byte) (int, error) {
return len(dAtA) - i, nil return len(dAtA) - i, nil
} }
func (m *Account) 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 *Account) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *Account) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.Network) > 0 {
i -= len(m.Network)
copy(dAtA[i:], m.Network)
i = encodeVarintState(dAtA, i, uint64(len(m.Network)))
i--
dAtA[i] = 0x22
}
if len(m.Chain) > 0 {
i -= len(m.Chain)
copy(dAtA[i:], m.Chain)
i = encodeVarintState(dAtA, i, uint64(len(m.Chain)))
i--
dAtA[i] = 0x1a
}
if len(m.Account) > 0 {
i -= len(m.Account)
copy(dAtA[i:], m.Account)
i = encodeVarintState(dAtA, i, uint64(len(m.Account)))
i--
dAtA[i] = 0x12
}
if m.Id != 0 {
i = encodeVarintState(dAtA, i, uint64(m.Id))
i--
dAtA[i] = 0x8
}
return len(dAtA) - i, nil
}
func encodeVarintState(dAtA []byte, offset int, v uint64) int { func encodeVarintState(dAtA []byte, offset int, v uint64) int {
offset -= sovState(v) offset -= sovState(v)
base := offset base := offset
@ -144,7 +267,7 @@ func encodeVarintState(dAtA []byte, offset int, v uint64) int {
dAtA[offset] = uint8(v) dAtA[offset] = uint8(v)
return base return base
} }
func (m *ExampleData) Size() (n int) { func (m *Balance) Size() (n int) {
if m == nil { if m == nil {
return 0 return 0
} }
@ -160,13 +283,37 @@ func (m *ExampleData) Size() (n int) {
return n return n
} }
func (m *Account) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.Id != 0 {
n += 1 + sovState(uint64(m.Id))
}
l = len(m.Account)
if l > 0 {
n += 1 + l + sovState(uint64(l))
}
l = len(m.Chain)
if l > 0 {
n += 1 + l + sovState(uint64(l))
}
l = len(m.Network)
if l > 0 {
n += 1 + l + sovState(uint64(l))
}
return n
}
func sovState(x uint64) (n int) { func sovState(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7 return (math_bits.Len64(x|1) + 6) / 7
} }
func sozState(x uint64) (n int) { func sozState(x uint64) (n int) {
return sovState(uint64((x << 1) ^ uint64((int64(x) >> 63)))) return sovState(uint64((x << 1) ^ uint64((int64(x) >> 63))))
} }
func (m *ExampleData) Unmarshal(dAtA []byte) error { func (m *Balance) Unmarshal(dAtA []byte) error {
l := len(dAtA) l := len(dAtA)
iNdEx := 0 iNdEx := 0
for iNdEx < l { for iNdEx < l {
@ -189,17 +336,17 @@ func (m *ExampleData) Unmarshal(dAtA []byte) error {
fieldNum := int32(wire >> 3) fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7) wireType := int(wire & 0x7)
if wireType == 4 { if wireType == 4 {
return fmt.Errorf("proto: ExampleData: wiretype end group for non-group") return fmt.Errorf("proto: Balance: wiretype end group for non-group")
} }
if fieldNum <= 0 { if fieldNum <= 0 {
return fmt.Errorf("proto: ExampleData: illegal tag %d (wire type %d)", fieldNum, wire) return fmt.Errorf("proto: Balance: illegal tag %d (wire type %d)", fieldNum, wire)
} }
switch fieldNum { switch fieldNum {
case 1: case 1:
if wireType != 2 { if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Account", wireType) return fmt.Errorf("proto: wrong wireType = %d for field Account", wireType)
} }
var byteLen int var stringLen uint64
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
if shift >= 64 { if shift >= 64 {
return ErrIntOverflowState return ErrIntOverflowState
@ -209,25 +356,23 @@ func (m *ExampleData) Unmarshal(dAtA []byte) error {
} }
b := dAtA[iNdEx] b := dAtA[iNdEx]
iNdEx++ iNdEx++
byteLen |= int(b&0x7F) << shift stringLen |= uint64(b&0x7F) << shift
if b < 0x80 { if b < 0x80 {
break break
} }
} }
if byteLen < 0 { intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthState return ErrInvalidLengthState
} }
postIndex := iNdEx + byteLen postIndex := iNdEx + intStringLen
if postIndex < 0 { if postIndex < 0 {
return ErrInvalidLengthState return ErrInvalidLengthState
} }
if postIndex > l { if postIndex > l {
return io.ErrUnexpectedEOF return io.ErrUnexpectedEOF
} }
m.Account = append(m.Account[:0], dAtA[iNdEx:postIndex]...) m.Account = string(dAtA[iNdEx:postIndex])
if m.Account == nil {
m.Account = []byte{}
}
iNdEx = postIndex iNdEx = postIndex
case 2: case 2:
if wireType != 0 { if wireType != 0 {
@ -269,6 +414,171 @@ func (m *ExampleData) Unmarshal(dAtA []byte) error {
} }
return nil return nil
} }
func (m *Account) 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 ErrIntOverflowState
}
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: Account: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: Account: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType)
}
m.Id = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowState
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.Id |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Account", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowState
}
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 ErrInvalidLengthState
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthState
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Account = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Chain", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowState
}
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 ErrInvalidLengthState
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthState
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Chain = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Network", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowState
}
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 ErrInvalidLengthState
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthState
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Network = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipState(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthState
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipState(dAtA []byte) (n int, err error) { func skipState(dAtA []byte) (n int, err error) {
l := len(dAtA) l := len(dAtA)
iNdEx := 0 iNdEx := 0

View File

@ -27,3 +27,10 @@ func (ms msgServer) UpdateParams(ctx context.Context, msg *types.MsgUpdateParams
return nil, ms.k.Params.Set(ctx, msg.Params) return nil, ms.k.Params.Set(ctx, msg.Params)
} }
// RegisterService implements types.MsgServer.
func (ms msgServer) RegisterService(ctx context.Context, msg *types.MsgRegisterService) (*types.MsgRegisterServiceResponse, error) {
// ctx := sdk.UnwrapSDKContext(goCtx)
panic("RegisterService is unimplemented")
return &types.MsgRegisterServiceResponse{}, nil
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -129,35 +129,153 @@ func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() {
var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo
// MsgRegisterService is the message type for the RegisterService RPC.
type MsgRegisterService struct {
// authority is the address of the governance account.
Controller string `protobuf:"bytes,1,opt,name=controller,proto3" json:"controller,omitempty"`
// origin is the origin of the request in wildcard form. Requires valid TXT
// record in DNS.
Service *Service `protobuf:"bytes,2,opt,name=service,proto3" json:"service,omitempty"`
}
func (m *MsgRegisterService) Reset() { *m = MsgRegisterService{} }
func (m *MsgRegisterService) String() string { return proto.CompactTextString(m) }
func (*MsgRegisterService) ProtoMessage() {}
func (*MsgRegisterService) Descriptor() ([]byte, []int) {
return fileDescriptor_361c6b19b8fa4769, []int{2}
}
func (m *MsgRegisterService) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgRegisterService) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgRegisterService.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 *MsgRegisterService) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgRegisterService.Merge(m, src)
}
func (m *MsgRegisterService) XXX_Size() int {
return m.Size()
}
func (m *MsgRegisterService) XXX_DiscardUnknown() {
xxx_messageInfo_MsgRegisterService.DiscardUnknown(m)
}
var xxx_messageInfo_MsgRegisterService proto.InternalMessageInfo
func (m *MsgRegisterService) GetController() string {
if m != nil {
return m.Controller
}
return ""
}
func (m *MsgRegisterService) GetService() *Service {
if m != nil {
return m.Service
}
return nil
}
// MsgRegisterServiceResponse is the response type for the RegisterService RPC.
type MsgRegisterServiceResponse struct {
Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"`
Did string `protobuf:"bytes,2,opt,name=did,proto3" json:"did,omitempty"`
}
func (m *MsgRegisterServiceResponse) Reset() { *m = MsgRegisterServiceResponse{} }
func (m *MsgRegisterServiceResponse) String() string { return proto.CompactTextString(m) }
func (*MsgRegisterServiceResponse) ProtoMessage() {}
func (*MsgRegisterServiceResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_361c6b19b8fa4769, []int{3}
}
func (m *MsgRegisterServiceResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgRegisterServiceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgRegisterServiceResponse.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 *MsgRegisterServiceResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgRegisterServiceResponse.Merge(m, src)
}
func (m *MsgRegisterServiceResponse) XXX_Size() int {
return m.Size()
}
func (m *MsgRegisterServiceResponse) XXX_DiscardUnknown() {
xxx_messageInfo_MsgRegisterServiceResponse.DiscardUnknown(m)
}
var xxx_messageInfo_MsgRegisterServiceResponse proto.InternalMessageInfo
func (m *MsgRegisterServiceResponse) GetSuccess() bool {
if m != nil {
return m.Success
}
return false
}
func (m *MsgRegisterServiceResponse) GetDid() string {
if m != nil {
return m.Did
}
return ""
}
func init() { func init() {
proto.RegisterType((*MsgUpdateParams)(nil), "service.v1.MsgUpdateParams") proto.RegisterType((*MsgUpdateParams)(nil), "service.v1.MsgUpdateParams")
proto.RegisterType((*MsgUpdateParamsResponse)(nil), "service.v1.MsgUpdateParamsResponse") proto.RegisterType((*MsgUpdateParamsResponse)(nil), "service.v1.MsgUpdateParamsResponse")
proto.RegisterType((*MsgRegisterService)(nil), "service.v1.MsgRegisterService")
proto.RegisterType((*MsgRegisterServiceResponse)(nil), "service.v1.MsgRegisterServiceResponse")
} }
func init() { proto.RegisterFile("service/v1/tx.proto", fileDescriptor_361c6b19b8fa4769) } func init() { proto.RegisterFile("service/v1/tx.proto", fileDescriptor_361c6b19b8fa4769) }
var fileDescriptor_361c6b19b8fa4769 = []byte{ var fileDescriptor_361c6b19b8fa4769 = []byte{
// 318 bytes of a gzipped FileDescriptorProto // 430 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x2e, 0x4e, 0x2d, 0x2a, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x92, 0x41, 0x8b, 0xd3, 0x40,
0xcb, 0x4c, 0x4e, 0xd5, 0x2f, 0x33, 0xd4, 0x2f, 0xa9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x14, 0xc7, 0x33, 0xae, 0xee, 0xda, 0xa7, 0x58, 0x99, 0x5d, 0xd8, 0x6c, 0x84, 0xb8, 0x44, 0x58,
0xe2, 0x82, 0x0a, 0xea, 0x95, 0x19, 0x4a, 0x89, 0x27, 0xe7, 0x17, 0xe7, 0xe6, 0x17, 0xeb, 0xe7, 0x96, 0x85, 0x4d, 0xdc, 0x15, 0x44, 0xf6, 0xa4, 0x3d, 0x79, 0x29, 0x94, 0x14, 0x0f, 0x7a, 0x91,
0x16, 0xa7, 0x83, 0xd4, 0xe4, 0x16, 0xa7, 0x43, 0x14, 0x49, 0x49, 0x20, 0xe9, 0x4c, 0x4f, 0xcd, 0x34, 0x19, 0xa6, 0x81, 0x26, 0x13, 0xe6, 0x4d, 0x4b, 0x7b, 0x13, 0xaf, 0x82, 0xf8, 0x51, 0x7a,
0x4b, 0x2d, 0xce, 0x2c, 0x86, 0xca, 0x88, 0xa4, 0xe7, 0xa7, 0xe7, 0x83, 0x99, 0xfa, 0x20, 0x16, 0xf0, 0xe2, 0x37, 0xe8, 0xb1, 0x78, 0xf2, 0x24, 0xd2, 0x1e, 0xfa, 0x35, 0x24, 0xc9, 0xc4, 0xc6,
0x54, 0x54, 0x12, 0x62, 0x50, 0x3c, 0x44, 0x02, 0xc2, 0x81, 0x48, 0x29, 0x75, 0x33, 0x72, 0xf1, 0x08, 0xf5, 0x12, 0xe6, 0xbd, 0xff, 0x7f, 0xfe, 0xef, 0x97, 0x99, 0x81, 0x43, 0x64, 0x72, 0x12,
0xfb, 0x16, 0xa7, 0x87, 0x16, 0xa4, 0x24, 0x96, 0xa4, 0x06, 0x24, 0x16, 0x25, 0xe6, 0x16, 0x0b, 0x87, 0xcc, 0x9b, 0x5c, 0x79, 0x6a, 0xea, 0x66, 0x52, 0x28, 0x41, 0x41, 0x37, 0xdd, 0xc9, 0x95,
0x99, 0x71, 0x71, 0x26, 0x96, 0x96, 0x64, 0xe4, 0x17, 0x65, 0x96, 0x54, 0x4a, 0x30, 0x2a, 0x30, 0x75, 0x1c, 0x0a, 0x4c, 0x04, 0x7a, 0x09, 0xf2, 0xdc, 0x93, 0x20, 0x2f, 0x4d, 0xd6, 0x49, 0x29,
0x6a, 0x70, 0x3a, 0x49, 0x5c, 0xda, 0xa2, 0x2b, 0x02, 0xd5, 0xe8, 0x98, 0x92, 0x52, 0x94, 0x5a, 0xbc, 0x2f, 0x2a, 0xaf, 0x2c, 0xb4, 0x74, 0xc4, 0x05, 0x17, 0x65, 0x3f, 0x5f, 0xe9, 0xae, 0x59,
0x5c, 0x1c, 0x5c, 0x52, 0x94, 0x99, 0x97, 0x1e, 0x84, 0x50, 0x2a, 0x64, 0xc0, 0xc5, 0x56, 0x00, 0x1b, 0xc5, 0x59, 0xca, 0x30, 0xd6, 0x7e, 0xe7, 0x13, 0x81, 0x76,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b, 0x9b, 0x2c, 0x57, 0x36, 0xf9, 0xb5, 0xb2, 0xc9, 0x97, 0xb5, 0x6d, 0x2c, 0xd7, 0xb6, 0xf1,
0x63, 0x6d, 0x1b, 0xef, 0xce, 0x78, 0xac, 0x86, 0xe3, 0x81, 0x1b, 0x8a, 0xc4, 0x13, 0x29, 0x8a,
0x54, 0x7a, 0xc5, 0x67, 0xea, 0x55, 0x8f, 0x51, 0xcd, 0x32, 0x86, 0x83, 0xfd, 0xe2, 0x21, 0x3e,
0xfb, 0x1d, 0x00, 0x00, 0xff, 0xff, 0xc6, 0x80, 0x50, 0xdb, 0x0f, 0x03, 0x00, 0x00,
} }
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
@ -176,6 +294,9 @@ type MsgClient interface {
// //
// Since: cosmos-sdk 0.47 // Since: cosmos-sdk 0.47
UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error)
// RegisterService initializes a Service with a given permission scope and
// URI. The domain must have a valid TXT record containing the public key.
RegisterService(ctx context.Context, in *MsgRegisterService, opts ...grpc.CallOption) (*MsgRegisterServiceResponse, error)
} }
type msgClient struct { type msgClient struct {
@ -195,12 +316,24 @@ func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts
return out, nil return out, nil
} }
func (c *msgClient) RegisterService(ctx context.Context, in *MsgRegisterService, opts ...grpc.CallOption) (*MsgRegisterServiceResponse, error) {
out := new(MsgRegisterServiceResponse)
err := c.cc.Invoke(ctx, "/service.v1.Msg/RegisterService", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// MsgServer is the server API for Msg service. // MsgServer is the server API for Msg service.
type MsgServer interface { type MsgServer interface {
// UpdateParams defines a governance operation for updating the parameters. // UpdateParams defines a governance operation for updating the parameters.
// //
// Since: cosmos-sdk 0.47 // Since: cosmos-sdk 0.47
UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error)
// RegisterService initializes a Service with a given permission scope and
// URI. The domain must have a valid TXT record containing the public key.
RegisterService(context.Context, *MsgRegisterService) (*MsgRegisterServiceResponse, error)
} }
// UnimplementedMsgServer can be embedded to have forward compatible implementations. // UnimplementedMsgServer can be embedded to have forward compatible implementations.
@ -210,6 +343,9 @@ type UnimplementedMsgServer struct {
func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented")
} }
func (*UnimplementedMsgServer) RegisterService(ctx context.Context, req *MsgRegisterService) (*MsgRegisterServiceResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method RegisterService not implemented")
}
func RegisterMsgServer(s grpc1.Server, srv MsgServer) { func RegisterMsgServer(s grpc1.Server, srv MsgServer) {
s.RegisterService(&_Msg_serviceDesc, srv) s.RegisterService(&_Msg_serviceDesc, srv)
@ -233,6 +369,24 @@ func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(in
return interceptor(ctx, in, info, handler) return interceptor(ctx, in, info, handler)
} }
func _Msg_RegisterService_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgRegisterService)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).RegisterService(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/service.v1.Msg/RegisterService",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).RegisterService(ctx, req.(*MsgRegisterService))
}
return interceptor(ctx, in, info, handler)
}
var _Msg_serviceDesc = grpc.ServiceDesc{ var _Msg_serviceDesc = grpc.ServiceDesc{
ServiceName: "service.v1.Msg", ServiceName: "service.v1.Msg",
HandlerType: (*MsgServer)(nil), HandlerType: (*MsgServer)(nil),
@ -241,6 +395,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{
MethodName: "UpdateParams", MethodName: "UpdateParams",
Handler: _Msg_UpdateParams_Handler, Handler: _Msg_UpdateParams_Handler,
}, },
{
MethodName: "RegisterService",
Handler: _Msg_RegisterService_Handler,
},
}, },
Streams: []grpc.StreamDesc{}, Streams: []grpc.StreamDesc{},
Metadata: "service/v1/tx.proto", Metadata: "service/v1/tx.proto",
@ -309,6 +467,88 @@ func (m *MsgUpdateParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)
return len(dAtA) - i, nil return len(dAtA) - i, nil
} }
func (m *MsgRegisterService) 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 *MsgRegisterService) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgRegisterService) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.Service != nil {
{
size, err := m.Service.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintTx(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x12
}
if len(m.Controller) > 0 {
i -= len(m.Controller)
copy(dAtA[i:], m.Controller)
i = encodeVarintTx(dAtA, i, uint64(len(m.Controller)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *MsgRegisterServiceResponse) 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 *MsgRegisterServiceResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgRegisterServiceResponse) 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 = encodeVarintTx(dAtA, i, uint64(len(m.Did)))
i--
dAtA[i] = 0x12
}
if m.Success {
i--
if m.Success {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i--
dAtA[i] = 0x8
}
return len(dAtA) - i, nil
}
func encodeVarintTx(dAtA []byte, offset int, v uint64) int { func encodeVarintTx(dAtA []byte, offset int, v uint64) int {
offset -= sovTx(v) offset -= sovTx(v)
base := offset base := offset
@ -344,6 +584,39 @@ func (m *MsgUpdateParamsResponse) Size() (n int) {
return n return n
} }
func (m *MsgRegisterService) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Controller)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
if m.Service != nil {
l = m.Service.Size()
n += 1 + l + sovTx(uint64(l))
}
return n
}
func (m *MsgRegisterServiceResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.Success {
n += 2
}
l = len(m.Did)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
return n
}
func sovTx(x uint64) (n int) { func sovTx(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7 return (math_bits.Len64(x|1) + 6) / 7
} }
@ -515,6 +788,226 @@ func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error {
} }
return nil return nil
} }
func (m *MsgRegisterService) 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 ErrIntOverflowTx
}
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: MsgRegisterService: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgRegisterService: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Controller", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
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 ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Controller = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Service", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.Service == nil {
m.Service = &Service{}
}
if err := m.Service.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *MsgRegisterServiceResponse) 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 ErrIntOverflowTx
}
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: MsgRegisterServiceResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgRegisterServiceResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Success", wireType)
}
var v int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
v |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
m.Success = bool(v != 0)
case 2:
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 ErrIntOverflowTx
}
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 ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Did = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipTx(dAtA []byte) (n int, err error) { func skipTx(dAtA []byte) (n int, err error) {
l := len(dAtA) l := len(dAtA)
iNdEx := 0 iNdEx := 0