github.com/cosmos/cosmos-sdk@v0.50.1/crypto/keys/ed25519/keys.pb.go (about)

     1  // Code generated by protoc-gen-gogo. DO NOT EDIT.
     2  // source: cosmos/crypto/ed25519/keys.proto
     3  
     4  package ed25519
     5  
     6  import (
     7  	crypto_ed25519 "crypto/ed25519"
     8  	fmt "fmt"
     9  	_ "github.com/cosmos/cosmos-sdk/types/tx/amino"
    10  	_ "github.com/cosmos/gogoproto/gogoproto"
    11  	proto "github.com/cosmos/gogoproto/proto"
    12  	io "io"
    13  	math "math"
    14  	math_bits "math/bits"
    15  )
    16  
    17  // Reference imports to suppress errors if they are not otherwise used.
    18  var _ = proto.Marshal
    19  var _ = fmt.Errorf
    20  var _ = math.Inf
    21  
    22  // This is a compile-time assertion to ensure that this generated file
    23  // is compatible with the proto package it is being compiled against.
    24  // A compilation error at this line likely means your copy of the
    25  // proto package needs to be updated.
    26  const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
    27  
    28  // PubKey is an ed25519 public key for handling Tendermint keys in SDK.
    29  // It's needed for Any serialization and SDK compatibility.
    30  // It must not be used in a non Tendermint key context because it doesn't implement
    31  // ADR-28. Nevertheless, you will like to use ed25519 in app user level
    32  // then you must create a new proto message and follow ADR-28 for Address construction.
    33  type PubKey struct {
    34  	Key crypto_ed25519.PublicKey `protobuf:"bytes,1,opt,name=key,proto3,casttype=crypto/ed25519.PublicKey" json:"key,omitempty"`
    35  }
    36  
    37  func (m *PubKey) Reset()      { *m = PubKey{} }
    38  func (*PubKey) ProtoMessage() {}
    39  func (*PubKey) Descriptor() ([]byte, []int) {
    40  	return fileDescriptor_48fe3336771e732d, []int{0}
    41  }
    42  func (m *PubKey) XXX_Unmarshal(b []byte) error {
    43  	return m.Unmarshal(b)
    44  }
    45  func (m *PubKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
    46  	if deterministic {
    47  		return xxx_messageInfo_PubKey.Marshal(b, m, deterministic)
    48  	} else {
    49  		b = b[:cap(b)]
    50  		n, err := m.MarshalToSizedBuffer(b)
    51  		if err != nil {
    52  			return nil, err
    53  		}
    54  		return b[:n], nil
    55  	}
    56  }
    57  func (m *PubKey) XXX_Merge(src proto.Message) {
    58  	xxx_messageInfo_PubKey.Merge(m, src)
    59  }
    60  func (m *PubKey) XXX_Size() int {
    61  	return m.Size()
    62  }
    63  func (m *PubKey) XXX_DiscardUnknown() {
    64  	xxx_messageInfo_PubKey.DiscardUnknown(m)
    65  }
    66  
    67  var xxx_messageInfo_PubKey proto.InternalMessageInfo
    68  
    69  func (m *PubKey) GetKey() crypto_ed25519.PublicKey {
    70  	if m != nil {
    71  		return m.Key
    72  	}
    73  	return nil
    74  }
    75  
    76  // PrivKey defines a ed25519 private key.
    77  // NOTE: ed25519 keys must not be used in SDK apps except in a tendermint validator context.
    78  type PrivKey struct {
    79  	Key crypto_ed25519.PrivateKey `protobuf:"bytes,1,opt,name=key,proto3,casttype=crypto/ed25519.PrivateKey" json:"key,omitempty"`
    80  }
    81  
    82  func (m *PrivKey) Reset()         { *m = PrivKey{} }
    83  func (m *PrivKey) String() string { return proto.CompactTextString(m) }
    84  func (*PrivKey) ProtoMessage()    {}
    85  func (*PrivKey) Descriptor() ([]byte, []int) {
    86  	return fileDescriptor_48fe3336771e732d, []int{1}
    87  }
    88  func (m *PrivKey) XXX_Unmarshal(b []byte) error {
    89  	return m.Unmarshal(b)
    90  }
    91  func (m *PrivKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
    92  	if deterministic {
    93  		return xxx_messageInfo_PrivKey.Marshal(b, m, deterministic)
    94  	} else {
    95  		b = b[:cap(b)]
    96  		n, err := m.MarshalToSizedBuffer(b)
    97  		if err != nil {
    98  			return nil, err
    99  		}
   100  		return b[:n], nil
   101  	}
   102  }
   103  func (m *PrivKey) XXX_Merge(src proto.Message) {
   104  	xxx_messageInfo_PrivKey.Merge(m, src)
   105  }
   106  func (m *PrivKey) XXX_Size() int {
   107  	return m.Size()
   108  }
   109  func (m *PrivKey) XXX_DiscardUnknown() {
   110  	xxx_messageInfo_PrivKey.DiscardUnknown(m)
   111  }
   112  
   113  var xxx_messageInfo_PrivKey proto.InternalMessageInfo
   114  
   115  func (m *PrivKey) GetKey() crypto_ed25519.PrivateKey {
   116  	if m != nil {
   117  		return m.Key
   118  	}
   119  	return nil
   120  }
   121  
   122  func init() {
   123  	proto.RegisterType((*PubKey)(nil), "cosmos.crypto.ed25519.PubKey")
   124  	proto.RegisterType((*PrivKey)(nil), "cosmos.crypto.ed25519.PrivKey")
   125  }
   126  
   127  func init() { proto.RegisterFile("cosmos/crypto/ed25519/keys.proto", fileDescriptor_48fe3336771e732d) }
   128  
   129  var fileDescriptor_48fe3336771e732d = []byte{
   130  	// 279 bytes of a gzipped FileDescriptorProto
   131  	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x48, 0xce, 0x2f, 0xce,
   132  	0xcd, 0x2f, 0xd6, 0x4f, 0x2e, 0xaa, 0x2c, 0x28, 0xc9, 0xd7, 0x4f, 0x4d, 0x31, 0x32, 0x35, 0x35,
   133  	0xb4, 0xd4, 0xcf, 0x4e, 0xad, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x85, 0xa8,
   134  	0xd0, 0x83, 0xa8, 0xd0, 0x83, 0xaa, 0x90, 0x12, 0x4c, 0xcc, 0xcd, 0xcc, 0xcb, 0xd7, 0x07, 0x93,
   135  	0x10, 0x95, 0x52, 0x22, 0xe9, 0xf9, 0xe9, 0xf9, 0x60, 0xa6, 0x3e, 0x88, 0x05, 0x11, 0x55, 0xca,
   136  	0xe4, 0x62, 0x0b, 0x28, 0x4d, 0xf2, 0x4e, 0xad, 0x14, 0xd2, 0xe3, 0x62, 0xce, 0x4e, 0xad, 0x94,
   137  	0x60, 0x54, 0x60, 0xd4, 0xe0, 0x71, 0x92, 0xf9, 0x75, 0x4f, 0x5e, 0x02, 0xd5, 0x56, 0xbd, 0x80,
   138  	0xd2, 0xa4, 0x9c, 0xcc, 0x64, 0xef, 0xd4, 0xca, 0x20, 0x90, 0x42, 0x2b, 0xfd, 0x19, 0x0b, 0xe4,
   139  	0x19, 0xba, 0x9e, 0x6f, 0xd0, 0x92, 0x28, 0x49, 0xcd, 0x4b, 0x49, 0x2d, 0xca, 0xcd, 0xcc, 0x2b,
   140  	0xd1, 0x87, 0x98, 0xe5, 0x0a, 0xd1, 0x31, 0xe9, 0xf9, 0x06, 0x2d, 0xce, 0xec, 0xd4, 0xca, 0xf8,
   141  	0xb4, 0xcc, 0xd4, 0x9c, 0x14, 0xa5, 0x0c, 0x2e, 0xf6, 0x80, 0xa2, 0xcc, 0x32, 0x90, 0x5d, 0xfa,
   142  	0xc8, 0x76, 0xc9, 0xfe, 0xba, 0x27, 0x2f, 0x89, 0x6e, 0x57, 0x51, 0x66, 0x59, 0x62, 0x49, 0x2a,
   143  	0xdc, 0x32, 0x1d, 0x90, 0x45, 0x92, 0xc8, 0x16, 0x41, 0x4c, 0xc2, 0x6a, 0x93, 0x93, 0xd7, 0x89,
   144  	0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7, 0x38, 0xe1, 0xb1, 0x1c, 0xc3,
   145  	0x85, 0xc7, 0x72, 0x0c, 0x37, 0x1e, 0xcb, 0x31, 0x44, 0x19, 0xa4, 0x67, 0x96, 0x64, 0x94, 0x26,
   146  	0xe9, 0x25, 0xe7, 0xe7, 0xea, 0xc3, 0xc2, 0x16, 0x4c, 0xe9, 0x16, 0xa7, 0x64, 0xc3, 0x82, 0x19,
   147  	0x14, 0xbc, 0x30, 0x97, 0x24, 0xb1, 0x81, 0xc3, 0xc9, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0x8e,
   148  	0xcd, 0xa4, 0x67, 0x8b, 0x01, 0x00, 0x00,
   149  }
   150  
   151  func (m *PubKey) Marshal() (dAtA []byte, err error) {
   152  	size := m.Size()
   153  	dAtA = make([]byte, size)
   154  	n, err := m.MarshalToSizedBuffer(dAtA[:size])
   155  	if err != nil {
   156  		return nil, err
   157  	}
   158  	return dAtA[:n], nil
   159  }
   160  
   161  func (m *PubKey) MarshalTo(dAtA []byte) (int, error) {
   162  	size := m.Size()
   163  	return m.MarshalToSizedBuffer(dAtA[:size])
   164  }
   165  
   166  func (m *PubKey) MarshalToSizedBuffer(dAtA []byte) (int, error) {
   167  	i := len(dAtA)
   168  	_ = i
   169  	var l int
   170  	_ = l
   171  	if len(m.Key) > 0 {
   172  		i -= len(m.Key)
   173  		copy(dAtA[i:], m.Key)
   174  		i = encodeVarintKeys(dAtA, i, uint64(len(m.Key)))
   175  		i--
   176  		dAtA[i] = 0xa
   177  	}
   178  	return len(dAtA) - i, nil
   179  }
   180  
   181  func (m *PrivKey) Marshal() (dAtA []byte, err error) {
   182  	size := m.Size()
   183  	dAtA = make([]byte, size)
   184  	n, err := m.MarshalToSizedBuffer(dAtA[:size])
   185  	if err != nil {
   186  		return nil, err
   187  	}
   188  	return dAtA[:n], nil
   189  }
   190  
   191  func (m *PrivKey) MarshalTo(dAtA []byte) (int, error) {
   192  	size := m.Size()
   193  	return m.MarshalToSizedBuffer(dAtA[:size])
   194  }
   195  
   196  func (m *PrivKey) MarshalToSizedBuffer(dAtA []byte) (int, error) {
   197  	i := len(dAtA)
   198  	_ = i
   199  	var l int
   200  	_ = l
   201  	if len(m.Key) > 0 {
   202  		i -= len(m.Key)
   203  		copy(dAtA[i:], m.Key)
   204  		i = encodeVarintKeys(dAtA, i, uint64(len(m.Key)))
   205  		i--
   206  		dAtA[i] = 0xa
   207  	}
   208  	return len(dAtA) - i, nil
   209  }
   210  
   211  func encodeVarintKeys(dAtA []byte, offset int, v uint64) int {
   212  	offset -= sovKeys(v)
   213  	base := offset
   214  	for v >= 1<<7 {
   215  		dAtA[offset] = uint8(v&0x7f | 0x80)
   216  		v >>= 7
   217  		offset++
   218  	}
   219  	dAtA[offset] = uint8(v)
   220  	return base
   221  }
   222  func (m *PubKey) Size() (n int) {
   223  	if m == nil {
   224  		return 0
   225  	}
   226  	var l int
   227  	_ = l
   228  	l = len(m.Key)
   229  	if l > 0 {
   230  		n += 1 + l + sovKeys(uint64(l))
   231  	}
   232  	return n
   233  }
   234  
   235  func (m *PrivKey) Size() (n int) {
   236  	if m == nil {
   237  		return 0
   238  	}
   239  	var l int
   240  	_ = l
   241  	l = len(m.Key)
   242  	if l > 0 {
   243  		n += 1 + l + sovKeys(uint64(l))
   244  	}
   245  	return n
   246  }
   247  
   248  func sovKeys(x uint64) (n int) {
   249  	return (math_bits.Len64(x|1) + 6) / 7
   250  }
   251  func sozKeys(x uint64) (n int) {
   252  	return sovKeys(uint64((x << 1) ^ uint64((int64(x) >> 63))))
   253  }
   254  func (m *PubKey) Unmarshal(dAtA []byte) error {
   255  	l := len(dAtA)
   256  	iNdEx := 0
   257  	for iNdEx < l {
   258  		preIndex := iNdEx
   259  		var wire uint64
   260  		for shift := uint(0); ; shift += 7 {
   261  			if shift >= 64 {
   262  				return ErrIntOverflowKeys
   263  			}
   264  			if iNdEx >= l {
   265  				return io.ErrUnexpectedEOF
   266  			}
   267  			b := dAtA[iNdEx]
   268  			iNdEx++
   269  			wire |= uint64(b&0x7F) << shift
   270  			if b < 0x80 {
   271  				break
   272  			}
   273  		}
   274  		fieldNum := int32(wire >> 3)
   275  		wireType := int(wire & 0x7)
   276  		if wireType == 4 {
   277  			return fmt.Errorf("proto: PubKey: wiretype end group for non-group")
   278  		}
   279  		if fieldNum <= 0 {
   280  			return fmt.Errorf("proto: PubKey: illegal tag %d (wire type %d)", fieldNum, wire)
   281  		}
   282  		switch fieldNum {
   283  		case 1:
   284  			if wireType != 2 {
   285  				return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType)
   286  			}
   287  			var byteLen int
   288  			for shift := uint(0); ; shift += 7 {
   289  				if shift >= 64 {
   290  					return ErrIntOverflowKeys
   291  				}
   292  				if iNdEx >= l {
   293  					return io.ErrUnexpectedEOF
   294  				}
   295  				b := dAtA[iNdEx]
   296  				iNdEx++
   297  				byteLen |= int(b&0x7F) << shift
   298  				if b < 0x80 {
   299  					break
   300  				}
   301  			}
   302  			if byteLen < 0 {
   303  				return ErrInvalidLengthKeys
   304  			}
   305  			postIndex := iNdEx + byteLen
   306  			if postIndex < 0 {
   307  				return ErrInvalidLengthKeys
   308  			}
   309  			if postIndex > l {
   310  				return io.ErrUnexpectedEOF
   311  			}
   312  			m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...)
   313  			if m.Key == nil {
   314  				m.Key = []byte{}
   315  			}
   316  			iNdEx = postIndex
   317  		default:
   318  			iNdEx = preIndex
   319  			skippy, err := skipKeys(dAtA[iNdEx:])
   320  			if err != nil {
   321  				return err
   322  			}
   323  			if (skippy < 0) || (iNdEx+skippy) < 0 {
   324  				return ErrInvalidLengthKeys
   325  			}
   326  			if (iNdEx + skippy) > l {
   327  				return io.ErrUnexpectedEOF
   328  			}
   329  			iNdEx += skippy
   330  		}
   331  	}
   332  
   333  	if iNdEx > l {
   334  		return io.ErrUnexpectedEOF
   335  	}
   336  	return nil
   337  }
   338  func (m *PrivKey) Unmarshal(dAtA []byte) error {
   339  	l := len(dAtA)
   340  	iNdEx := 0
   341  	for iNdEx < l {
   342  		preIndex := iNdEx
   343  		var wire uint64
   344  		for shift := uint(0); ; shift += 7 {
   345  			if shift >= 64 {
   346  				return ErrIntOverflowKeys
   347  			}
   348  			if iNdEx >= l {
   349  				return io.ErrUnexpectedEOF
   350  			}
   351  			b := dAtA[iNdEx]
   352  			iNdEx++
   353  			wire |= uint64(b&0x7F) << shift
   354  			if b < 0x80 {
   355  				break
   356  			}
   357  		}
   358  		fieldNum := int32(wire >> 3)
   359  		wireType := int(wire & 0x7)
   360  		if wireType == 4 {
   361  			return fmt.Errorf("proto: PrivKey: wiretype end group for non-group")
   362  		}
   363  		if fieldNum <= 0 {
   364  			return fmt.Errorf("proto: PrivKey: illegal tag %d (wire type %d)", fieldNum, wire)
   365  		}
   366  		switch fieldNum {
   367  		case 1:
   368  			if wireType != 2 {
   369  				return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType)
   370  			}
   371  			var byteLen int
   372  			for shift := uint(0); ; shift += 7 {
   373  				if shift >= 64 {
   374  					return ErrIntOverflowKeys
   375  				}
   376  				if iNdEx >= l {
   377  					return io.ErrUnexpectedEOF
   378  				}
   379  				b := dAtA[iNdEx]
   380  				iNdEx++
   381  				byteLen |= int(b&0x7F) << shift
   382  				if b < 0x80 {
   383  					break
   384  				}
   385  			}
   386  			if byteLen < 0 {
   387  				return ErrInvalidLengthKeys
   388  			}
   389  			postIndex := iNdEx + byteLen
   390  			if postIndex < 0 {
   391  				return ErrInvalidLengthKeys
   392  			}
   393  			if postIndex > l {
   394  				return io.ErrUnexpectedEOF
   395  			}
   396  			m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...)
   397  			if m.Key == nil {
   398  				m.Key = []byte{}
   399  			}
   400  			iNdEx = postIndex
   401  		default:
   402  			iNdEx = preIndex
   403  			skippy, err := skipKeys(dAtA[iNdEx:])
   404  			if err != nil {
   405  				return err
   406  			}
   407  			if (skippy < 0) || (iNdEx+skippy) < 0 {
   408  				return ErrInvalidLengthKeys
   409  			}
   410  			if (iNdEx + skippy) > l {
   411  				return io.ErrUnexpectedEOF
   412  			}
   413  			iNdEx += skippy
   414  		}
   415  	}
   416  
   417  	if iNdEx > l {
   418  		return io.ErrUnexpectedEOF
   419  	}
   420  	return nil
   421  }
   422  func skipKeys(dAtA []byte) (n int, err error) {
   423  	l := len(dAtA)
   424  	iNdEx := 0
   425  	depth := 0
   426  	for iNdEx < l {
   427  		var wire uint64
   428  		for shift := uint(0); ; shift += 7 {
   429  			if shift >= 64 {
   430  				return 0, ErrIntOverflowKeys
   431  			}
   432  			if iNdEx >= l {
   433  				return 0, io.ErrUnexpectedEOF
   434  			}
   435  			b := dAtA[iNdEx]
   436  			iNdEx++
   437  			wire |= (uint64(b) & 0x7F) << shift
   438  			if b < 0x80 {
   439  				break
   440  			}
   441  		}
   442  		wireType := int(wire & 0x7)
   443  		switch wireType {
   444  		case 0:
   445  			for shift := uint(0); ; shift += 7 {
   446  				if shift >= 64 {
   447  					return 0, ErrIntOverflowKeys
   448  				}
   449  				if iNdEx >= l {
   450  					return 0, io.ErrUnexpectedEOF
   451  				}
   452  				iNdEx++
   453  				if dAtA[iNdEx-1] < 0x80 {
   454  					break
   455  				}
   456  			}
   457  		case 1:
   458  			iNdEx += 8
   459  		case 2:
   460  			var length int
   461  			for shift := uint(0); ; shift += 7 {
   462  				if shift >= 64 {
   463  					return 0, ErrIntOverflowKeys
   464  				}
   465  				if iNdEx >= l {
   466  					return 0, io.ErrUnexpectedEOF
   467  				}
   468  				b := dAtA[iNdEx]
   469  				iNdEx++
   470  				length |= (int(b) & 0x7F) << shift
   471  				if b < 0x80 {
   472  					break
   473  				}
   474  			}
   475  			if length < 0 {
   476  				return 0, ErrInvalidLengthKeys
   477  			}
   478  			iNdEx += length
   479  		case 3:
   480  			depth++
   481  		case 4:
   482  			if depth == 0 {
   483  				return 0, ErrUnexpectedEndOfGroupKeys
   484  			}
   485  			depth--
   486  		case 5:
   487  			iNdEx += 4
   488  		default:
   489  			return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
   490  		}
   491  		if iNdEx < 0 {
   492  			return 0, ErrInvalidLengthKeys
   493  		}
   494  		if depth == 0 {
   495  			return iNdEx, nil
   496  		}
   497  	}
   498  	return 0, io.ErrUnexpectedEOF
   499  }
   500  
   501  var (
   502  	ErrInvalidLengthKeys        = fmt.Errorf("proto: negative length found during unmarshaling")
   503  	ErrIntOverflowKeys          = fmt.Errorf("proto: integer overflow")
   504  	ErrUnexpectedEndOfGroupKeys = fmt.Errorf("proto: unexpected end of group")
   505  )