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
+14
View File
@@ -28,3 +28,17 @@ func (k Querier) Params(c context.Context, req *types.QueryParamsRequest) (*type
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
}
+7
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)
}
// 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
}
+798 -35
View File
@@ -72,7 +72,12 @@ func (m *GenesisState) GetParams() Params {
// Params defines the set of module parameters.
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{} }
@@ -107,38 +112,193 @@ func (m *Params) XXX_DiscardUnknown() {
var xxx_messageInfo_Params proto.InternalMessageInfo
func (m *Params) GetSomeValue() bool {
func (m *Params) GetMethods() *Methods {
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() {
proto.RegisterType((*GenesisState)(nil), "macaroon.v1.GenesisState")
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) }
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,
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,
0xa7, 0xe7, 0x83, 0xc5, 0xf5, 0x41, 0x2c, 0x88, 0x12, 0x29, 0xc1, 0xc4, 0xdc, 0xcc, 0xbc, 0x7c,
0x7d, 0x30, 0x09, 0x11, 0x52, 0x72, 0xe4, 0xe2, 0x71, 0x87, 0x18, 0x13, 0x5c, 0x92, 0x58, 0x92,
0x2a, 0x64, 0xc8, 0xc5, 0x56, 0x90, 0x58, 0x94, 0x98, 0x5b, 0x2c, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1,
0x6d, 0x24, 0xac, 0x87, 0x64, 0xac, 0x5e, 0x00, 0x58, 0xca, 0x89, 0xe5, 0xc4, 0x3d, 0x79, 0x86,
0x20, 0xa8, 0x42, 0x25, 0x57, 0x2e, 0x36, 0x88, 0xb8, 0x90, 0x2c, 0x17, 0x57, 0x71, 0x7e, 0x6e,
0x6a, 0x7c, 0x59, 0x62, 0x4e, 0x69, 0xaa, 0x04, 0x93, 0x02, 0xa3, 0x06, 0x47, 0x10, 0x27, 0x48,
0x24, 0x0c, 0x24, 0x60, 0x25, 0x33, 0x63, 0x81, 0x3c, 0xc3, 0x8b, 0x05, 0xf2, 0x8c, 0x5d, 0xcf,
0x37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b, 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 {
@@ -160,9 +320,102 @@ func (this *Params) Equal(that interface{}) bool {
} else if this == nil {
return false
}
if this.SomeValue != that1.SomeValue {
if !this.Methods.Equal(that1.Methods) {
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
}
func (m *GenesisState) Marshal() (dAtA []byte, err error) {
@@ -218,15 +471,137 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) {
_ = i
var l int
_ = l
if m.SomeValue {
i--
if m.SomeValue {
dAtA[i] = 1
} else {
dAtA[i] = 0
if m.Caveats != nil {
{
size, err := m.Caveats.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintGenesis(dAtA, i, uint64(size))
}
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
}
@@ -259,8 +634,62 @@ func (m *Params) Size() (n int) {
}
var l int
_ = l
if m.SomeValue {
n += 2
if m.Methods != nil {
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
}
@@ -383,11 +812,11 @@ func (m *Params) Unmarshal(dAtA []byte) error {
return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 2:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field SomeValue", wireType)
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Methods", wireType)
}
var v int
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenesis
@@ -397,12 +826,346 @@ func (m *Params) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
v |= int(b&0x7F) << shift
msglen |= int(b&0x7F) << shift
if b < 0x80 {
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:
iNdEx = preIndex
skippy, err := skipGenesis(dAtA[iNdEx:])
+783 -17
View File
@@ -111,31 +111,231 @@ func (m *QueryParamsResponse) GetParams() *Params {
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() {
proto.RegisterType((*QueryParamsRequest)(nil), "macaroon.v1.QueryParamsRequest")
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) }
var fileDescriptor_ce46a74a5956a389 = []byte{
// 253 bytes of a gzipped FileDescriptorProto
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, 0x2c, 0x4d, 0x2d, 0xaa, 0xd4, 0x2b, 0x28,
0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x86, 0x49, 0xe8, 0x95, 0x19, 0x4a, 0xc9, 0xa4, 0xe7, 0xe7, 0xa7,
0xe7, 0xa4, 0xea, 0x27, 0x16, 0x64, 0xea, 0x27, 0xe6, 0xe5, 0xe5, 0x97, 0x24, 0x96, 0x64, 0xe6,
0xe7, 0x15, 0x43, 0x94, 0x4a, 0x49, 0x22, 0x9b, 0x91, 0x9e, 0x9a, 0x97, 0x5a, 0x9c, 0x09, 0x95,
0x52, 0x12, 0xe1, 0x12, 0x0a, 0x04, 0x19, 0x1a, 0x90, 0x58, 0x94, 0x98, 0x5b, 0x1c, 0x94, 0x5a,
0x58, 0x9a, 0x5a, 0x5c, 0xa2, 0xe4, 0xc4, 0x25, 0x8c, 0x22, 0x5a, 0x5c, 0x90, 0x9f, 0x57, 0x9c,
0x2a, 0xa4, 0xcd, 0xc5, 0x56, 0x00, 0x16, 0x91, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x36, 0x12, 0xd6,
0x43, 0x72, 0x83, 0x1e, 0x54, 0x31, 0x54, 0x89, 0x51, 0x21, 0x17, 0x2b, 0xd8, 0x0c, 0xa1, 0x0c,
0x2e, 0x36, 0x88, 0x94, 0x90, 0x3c, 0x8a, 0x7a, 0x4c, 0x7b, 0xa5, 0x14, 0x70, 0x2b, 0x80, 0x38,
0x41, 0x49, 0xba, 0xe9, 0xf2, 0x93, 0xc9, 0x4c, 0xa2, 0x42, 0xc2, 0xfa, 0xc8, 0x7e, 0x82, 0x58,
0xe9, 0xe4, 0x78, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, 0x31, 0x4e,
0x78, 0x2c, 0xc7, 0x70, 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72, 0x0c, 0x51, 0xea, 0xe9, 0x99,
0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0xf9, 0x79, 0xc5, 0xf9, 0x79, 0x45, 0xfa,
0x60, 0xa2, 0x02, 0x61, 0x4c, 0x49, 0x65, 0x41, 0x6a, 0x71, 0x12, 0x1b, 0x38, 0x58, 0x8c, 0x01,
0x01, 0x00, 0x00, 0xff, 0xff, 0x1f, 0x6e, 0xa8, 0x57, 0x77, 0x01, 0x00, 0x00,
// 379 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0xc1, 0x4e, 0xc2, 0x30,
0x1c, 0xc6, 0x19, 0x09, 0x44, 0x8b, 0x5e, 0x0a, 0x08, 0x4c, 0x9c, 0x64, 0x89, 0x62, 0x62, 0xb2,
0x09, 0x3e, 0x81, 0x3c, 0x81, 0x2e, 0xc6, 0x83, 0xb7, 0x82, 0x75, 0x2c, 0x42, 0x3b, 0xda, 0xb2,
0x48, 0x3c, 0x98, 0xf8, 0x04, 0x26, 0xbe, 0x94, 0x47, 0x12,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 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.
@@ -152,6 +352,10 @@ const _ = grpc.SupportPackageIsVersion4
type QueryClient interface {
// Params queries all parameters of the module.
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 {
@@ -171,10 +375,32 @@ func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts .
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.
type QueryServer interface {
// Params queries all parameters of the module.
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.
@@ -184,6 +410,12 @@ type UnimplementedQueryServer struct {
func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) {
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) {
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)
}
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{
ServiceName: "macaroon.v1.Query",
HandlerType: (*QueryServer)(nil),
@@ -215,6 +483,14 @@ var _Query_serviceDesc = grpc.ServiceDesc{
MethodName: "Params",
Handler: _Query_Params_Handler,
},
{
MethodName: "RefreshToken",
Handler: _Query_RefreshToken_Handler,
},
{
MethodName: "ValidateToken",
Handler: _Query_ValidateToken_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "macaroon/v1/query.proto",
@@ -278,6 +554,129 @@ func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
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 {
offset -= sovQuery(v)
base := offset
@@ -311,6 +710,57 @@ func (m *QueryParamsResponse) Size() (n int) {
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) {
return (math_bits.Len64(x|1) + 6) / 7
}
@@ -453,6 +903,322 @@ func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error {
}
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) {
l := len(dAtA)
iNdEx := 0
+166
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".
// UnaryRPC :call QueryServer directly.
// 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
}
@@ -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
}
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_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 (
forward_Query_Params_0 = runtime.ForwardResponseMessage
forward_Query_RefreshToken_0 = runtime.ForwardResponseMessage
forward_Query_ValidateToken_0 = runtime.ForwardResponseMessage
)
+206 -67
View File
@@ -23,23 +23,26 @@ var _ = math.Inf
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
type ExampleData struct {
Account []byte `protobuf:"bytes,1,opt,name=account,proto3" json:"account,omitempty"`
Amount uint64 `protobuf:"varint,2,opt,name=amount,proto3" json:"amount,omitempty"`
type Grant struct {
Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,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 *ExampleData) String() string { return proto.CompactTextString(m) }
func (*ExampleData) ProtoMessage() {}
func (*ExampleData) Descriptor() ([]byte, []int) {
func (m *Grant) Reset() { *m = Grant{} }
func (m *Grant) String() string { return proto.CompactTextString(m) }
func (*Grant) ProtoMessage() {}
func (*Grant) Descriptor() ([]byte, []int) {
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)
}
func (m *ExampleData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
func (m *Grant) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_ExampleData.Marshal(b, m, deterministic)
return xxx_messageInfo_Grant.Marshal(b, m, deterministic)
} else {
b = b[:cap(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
}
}
func (m *ExampleData) XXX_Merge(src proto.Message) {
xxx_messageInfo_ExampleData.Merge(m, src)
func (m *Grant) XXX_Merge(src proto.Message) {
xxx_messageInfo_Grant.Merge(m, src)
}
func (m *ExampleData) XXX_Size() int {
func (m *Grant) XXX_Size() int {
return m.Size()
}
func (m *ExampleData) XXX_DiscardUnknown() {
xxx_messageInfo_ExampleData.DiscardUnknown(m)
func (m *Grant) XXX_DiscardUnknown() {
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 {
return m.Account
return m.Id
}
return nil
return 0
}
func (m *ExampleData) GetAmount() uint64 {
func (m *Grant) GetController() string {
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
}
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) }
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,
0x2c, 0xca, 0xcf, 0xcf, 0xd3, 0x2f, 0x33, 0xd4, 0x2f, 0x2e, 0x49, 0x2c, 0x49, 0xd5, 0x2b, 0x28,
0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x86, 0x49, 0xe8, 0x95, 0x19, 0x4a, 0x89, 0x27, 0xe7, 0x17, 0xe7,
0xe6, 0x17, 0xeb, 0xe7, 0x17, 0xe5, 0x82, 0xd4, 0xe5, 0x17, 0xe5, 0x42, 0x54, 0x29,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0x11, 0x92, 0xe3, 0xe2, 0x4a, 0xce, 0xcf, 0x2b, 0x29,
0xca, 0xcf, 0xc9, 0x49, 0x2d, 0x92, 0x60, 0x52, 0x60, 0xd4, 0xe0, 0x0c, 0x42, 0x12, 0x11, 0x92,
0xe0, 0x62, 0x2f, 0x2e, 0x4d, 0xca, 0x4a, 0x4d, 0x2e, 0x91, 0x60, 0x06, 0x4b, 0xc2, 0xb8, 0x42,
0x62, 0x5c, 0x6c, 0xf9, 0x45, 0x99, 0xe9, 0x99, 0x79, 0x12, 0x2c, 0x60, 0x09, 0x28, 0x4f, 0x48,
0x99, 0x8b, 0x37, 0xb5, 0xa2, 0x20, 0xb3, 0xa8, 0x32, 0x3e, 0x23, 0x35, 0x33, 0x3d, 0xa3, 0x44,
0x82, 0x55, 0x81, 0x51, 0x83, 0x39, 0x88, 0x07, 0x22, 0xe8, 0x01, 0x16, 0xb3, 0x52, 0xfb, 0x34,
0xef, 0x72, 0x1f, 0xb3, 0x02, 0x17, 0x1b, 0xc8, 0x39, 0x02, 0x8c, 0x42, 0x22, 0x5c, 0x7c, 0x50,
0x73, 0x75, 0x20, 0xc6, 0x08, 0x30, 0x4a, 0x30, 0x4a, 0x30, 0x3a, 0x39, 0x9e, 0x78, 0x24, 0xc7,
0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 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()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
@@ -109,27 +137,46 @@ func (m *ExampleData) Marshal() (dAtA []byte, err error) {
return dAtA[:n], nil
}
func (m *ExampleData) MarshalTo(dAtA []byte) (int, error) {
func (m *Grant) MarshalTo(dAtA []byte) (int, error) {
size := m.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
var l int
_ = l
if m.Amount != 0 {
i = encodeVarintState(dAtA, i, uint64(m.Amount))
if m.ExpiryHeight != 0 {
i = encodeVarintState(dAtA, i, uint64(m.ExpiryHeight))
i--
dAtA[i] = 0x10
dAtA[i] = 0x28
}
if len(m.Account) > 0 {
i -= len(m.Account)
copy(dAtA[i:], m.Account)
i = encodeVarintState(dAtA, i, uint64(len(m.Account)))
if len(m.Origin) > 0 {
i -= len(m.Origin)
copy(dAtA[i:], m.Origin)
i = encodeVarintState(dAtA, i, uint64(len(m.Origin)))
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
}
@@ -145,18 +192,29 @@ func encodeVarintState(dAtA []byte, offset int, v uint64) int {
dAtA[offset] = uint8(v)
return base
}
func (m *ExampleData) Size() (n int) {
func (m *Grant) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Account)
if m.Id != 0 {
n += 1 + sovState(uint64(m.Id))
}
l = len(m.Controller)
if l > 0 {
n += 1 + l + sovState(uint64(l))
}
if m.Amount != 0 {
n += 1 + sovState(uint64(m.Amount))
l = len(m.Subject)
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
}
@@ -167,7 +225,7 @@ func sovState(x uint64) (n int) {
func sozState(x uint64) (n int) {
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)
iNdEx := 0
for iNdEx < l {
@@ -190,17 +248,17 @@ func (m *ExampleData) Unmarshal(dAtA []byte) error {
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
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 {
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 {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Account", wireType)
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType)
}
var byteLen int
m.Id = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowState
@@ -210,31 +268,48 @@ func (m *ExampleData) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
byteLen |= int(b&0x7F) << shift
m.Id |= uint64(b&0x7F) << shift
if b < 0x80 {
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
}
postIndex := iNdEx + byteLen
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthState
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Account = append(m.Account[:0], dAtA[iNdEx:postIndex]...)
if m.Account == nil {
m.Account = []byte{}
}
m.Controller = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType)
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Subject", wireType)
}
m.Amount = 0
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowState
@@ -244,7 +319,71 @@ func (m *ExampleData) Unmarshal(dAtA []byte) error {
}
b := dAtA[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 {
break
}
+726 -21
View File
@@ -129,35 +129,177 @@ func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() {
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() {
proto.RegisterType((*MsgUpdateParams)(nil), "macaroon.v1.MsgUpdateParams")
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) }
var fileDescriptor_68f908349d9da51a = []byte{
// 318 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0xc9, 0x4d, 0x4c, 0x4e,
0x2c, 0xca, 0xcf, 0xcf, 0xd3, 0x2f, 0x33, 0xd4, 0x2f, 0xa9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9,
0x17, 0xe2, 0x86, 0x89, 0xea, 0x95, 0x19, 0x4a, 0x89, 0x27, 0xe7, 0x17, 0xe7, 0xe6, 0x17, 0xeb,
0xe7, 0x16, 0xa7, 0x83, 0x14, 0xe5, 0x16, 0xa7, 0x43, 0x54, 0x49, 0x49, 0x22, 0xeb, 0x4d, 0x4f,
0xcd, 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 0x0f, 0x1e, 0xc9, 0x31, 0x4e,
0x78, 0x2c, 0xc7, 0x70, 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72, 0x0c, 0x51, 0xea, 0xe9, 0x99,
0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0xf9, 0x79, 0xc5, 0xf9, 0x79, 0x45, 0xfa,
0x60, 0xa2, 0x42, 0x1f, 0x1e, 0x15, 0x25, 0x95, 0x05, 0xa9, 0xc5, 0x49, 0x6c, 0xe0, 0x50, 0x35,
0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0x6f, 0xc5, 0x76, 0xac, 0xdf, 0x01, 0x00, 0x00,
// 507 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x53, 0x4f, 0x6b, 0x13, 0x4f,
0x18, 0xce, 0x24, 0x6d, 0x7e, 0xbf, 0x4c, 0xc4, 0x86, 0x31, 0xd8, 0xed, 0xa2, 0x6b, 0x08, 0x8a,
0xa1, 0xe0, 0x2e, 0x89, 0x20, 0x25, 0x07, 0x21, 0x01, 0x0f, 0x0a, 0x81, 0xb0, 0x45, 0x10, 0x2f,
0xb2, 0xdd, 0x0c, 0xd3, 0xa1, 0xd9, 0x99, 0x65, 0xde, 0xd9, 0xd0, 0x78, 0x12, 0xcf, 0x1e, 0xfc,
0x02, 0x7e, 0x87, 0x1e, 0x3c, 0xf9, 0x09, 0x7a, 0x2c, 0x9e, 0x3c, 0x89, 0x24, 0x87, 0x7e, 0x0d,
0xd9, 0x7f, 0xcd, 0x76, 0x0f, 0xf1, 0x12, 0xe6, 0x99, 0xf7, 0x7d, 0x9e, 0xf7, 0x79, 0x9f, 0xec,
0xe0, 0x76, 0xe0, 0xf9, 0x9e, 0x92, 0x52, 0x38, 0x8b, 0xbe, 0xa3, 0xcf, 0xed, 0x50, 0x49, 0x2d,
0x49, 0x33,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 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.
@@ -176,6 +318,9 @@ type MsgClient interface {
//
// Since: cosmos-sdk 0.47
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 {
@@ -195,12 +340,24 @@ func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts
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.
type MsgServer interface {
// UpdateParams defines a governance operation for updating the parameters.
//
// Since: cosmos-sdk 0.47
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.
@@ -210,6 +367,9 @@ type UnimplementedMsgServer struct {
func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) {
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) {
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)
}
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{
ServiceName: "macaroon.v1.Msg",
HandlerType: (*MsgServer)(nil),
@@ -241,6 +419,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{
MethodName: "UpdateParams",
Handler: _Msg_UpdateParams_Handler,
},
{
MethodName: "AuthorizeService",
Handler: _Msg_AuthorizeService_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "macaroon/v1/tx.proto",
@@ -309,6 +491,109 @@ func (m *MsgUpdateParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)
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 {
offset -= sovTx(v)
base := offset
@@ -344,6 +629,51 @@ func (m *MsgUpdateParamsResponse) Size() (n int) {
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) {
return (math_bits.Len64(x|1) + 6) / 7
}
@@ -515,6 +845,381 @@ func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error {
}
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) {
l := len(dAtA)
iNdEx := 0