diff --git a/modules/identity/export.go b/modules/identity/export.go index dee2b40..2f809fd 100644 --- a/modules/identity/export.go +++ b/modules/identity/export.go @@ -23,6 +23,7 @@ type CreateIdentityRequest struct { PubkeyInfo *PubkeyInfo `json:"pubkey_info"` Certificate string `json:"certificate"` Credentials *string `json:"credentials"` + Data string `json:"data"` } type UpdateIdentityRequest struct { @@ -30,6 +31,7 @@ type UpdateIdentityRequest struct { PubkeyInfo *PubkeyInfo `json:"pubkey_info"` Certificate string `json:"certificate"` Credentials *string `json:"credentials"` + Data string `json:"data"` } type QueryIdentityResp struct { @@ -38,4 +40,5 @@ type QueryIdentityResp struct { Certificates []string `json:"certificates"` Credentials string `json:"credentials"` Owner string `json:"owner"` + Data string `json:"data"` } diff --git a/modules/identity/identity.go b/modules/identity/identity.go index e4222db..7377fe3 100644 --- a/modules/identity/identity.go +++ b/modules/identity/identity.go @@ -63,6 +63,7 @@ func (i identityClient) CreateIdentity(request CreateIdentityRequest, baseTx sdk Certificate: request.Certificate, Credentials: credentials, Owner: sender.String(), + Data: request.Data, } return i.BuildAndSend([]sdk.Msg{msg}, baseTx) } @@ -101,6 +102,7 @@ func (i identityClient) UpdateIdentity(request UpdateIdentityRequest, baseTx sdk Certificate: request.Certificate, Credentials: credentials, Owner: sender.String(), + Data: request.Data, } return i.BuildAndSend([]sdk.Msg{msg}, baseTx) } diff --git a/modules/identity/identity.pb.go b/modules/identity/identity.pb.go index d5c474b..9eb860a 100644 --- a/modules/identity/identity.pb.go +++ b/modules/identity/identity.pb.go @@ -71,6 +71,7 @@ type Identity struct { Certificates []string `protobuf:"bytes,3,rep,name=certificates,proto3" json:"certificates,omitempty"` Credentials string `protobuf:"bytes,4,opt,name=credentials,proto3" json:"credentials,omitempty"` Owner string `protobuf:"bytes,5,opt,name=owner,proto3" json:"owner,omitempty"` + Data string `protobuf:"bytes,6,opt,name=data,proto3" json:"data,omitempty"` } func (m *Identity) Reset() { *m = Identity{} } @@ -154,38 +155,39 @@ func init() { func init() { proto.RegisterFile("identity/identity.proto", fileDescriptor_2433c1f46177a3e0) } var fileDescriptor_2433c1f46177a3e0 = []byte{ - // 490 bytes of a gzipped FileDescriptorProto + // 498 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x52, 0xcd, 0x6e, 0xd3, 0x4c, - 0x14, 0xf5, 0xc4, 0xf9, 0x69, 0x26, 0xfd, 0xf2, 0x99, 0x51, 0x05, 0x96, 0x11, 0x63, 0xe3, 0x55, - 0x84, 0x54, 0x5b, 0x18, 0x8a, 0x44, 0x57, 0x24, 0xa4, 0x8b, 0xaa, 0xaa, 0x54, 0xd9, 0x62, 0x03, - 0x0b, 0x64, 0xc7, 0x53, 0x77, 0x48, 0xec, 0x89, 0xfc, 0xa3, 0xca, 0x6f, 0x80, 0xbc, 0xe2, 0x05, - 0x22, 0x21, 0xd1, 0x05, 0x4b, 0x5e, 0x80, 0x7d, 0x96, 0x5d, 0xc2, 0xc6, 0x82, 0x64, 0x83, 0xba, - 0xec, 0x13, 0x20, 0xdb, 0x09, 0x2d, 0x45, 0xdd, 0xdd, 0x7b, 0xce, 0x99, 0x3b, 0xe7, 0x1e, 0x5d, - 0x78, 0x8f, 0xba, 0x24, 0x88, 0x69, 0x9c, 0xea, 0xeb, 0x42, 0x9b, 0x86, 0x2c, 0x66, 0xe8, 0x0e, - 0x0d, 0x69, 0x6c, 0xfb, 0xcc, 0xd5, 0xd6, 0x84, 0xb4, 0xe5, 0x31, 0x8f, 0x95, 0xac, 0x5e, 0x54, - 0x95, 0x50, 0xfd, 0x0e, 0xe0, 0xc6, 0xfe, 0x4a, 0x82, 0xba, 0xb0, 0x46, 0x5d, 0x11, 0x28, 0xa0, - 0xd7, 0x36, 0x6b, 0xd4, 0x45, 0x6f, 0xe0, 0xc6, 0x34, 0x71, 0xde, 0x8e, 0x49, 0x1a, 0x89, 0x35, - 0x85, 0xef, 0x75, 0x8c, 0x07, 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ca, 0x66, 0x4a, 0x51, 0x16, - 0xc8, 0xd0, 0xea, 0x0b, 0xb5, 0x0a, 0x19, 0x5a, 0xfd, 0x22, 0x98, 0xbd, 0x97, 0x05, 0xc6, 0x4b, - 0xed, 0x6c, 0xa6, 0x54, 0x0d, 0x12, 0x61, 0x6b, 0x6f, 0x68, 0xec, 0xec, 0x3c, 0x7e, 0x2e, 0xd4, - 0xa5, 0x4e, 0x36, 0x53, 0xd6, 0x6d, 0x31, 0xc1, 0x3a, 0x34, 0x84, 0x46, 0x35, 0xc1, 0x3a, 0x34, - 0xa4, 0xcd, 0xf7, 0x9f, 0x30, 0xf7, 0xf9, 0x0c, 0x73, 0x5f, 0xce, 0x30, 0x18, 0x1c, 0xcd, 0x7f, - 0x62, 0x6e, 0xbe, 0xc0, 0xe0, 0x7c, 0x81, 0xc1, 0x8f, 0x05, 0x06, 0x1f, 0x96, 0x98, 0x3b, 0x5f, - 0x62, 0xee, 0xdb, 0x12, 0x73, 0xaf, 0x0d, 0x8f, 0xc6, 0x27, 0x89, 0xa3, 0x8d, 0x98, 0xaf, 0x3b, - 0xd4, 0x0e, 0xde, 0x51, 0x62, 0x53, 0xbd, 0x8c, 0x69, 0x3b, 0x72, 0xc7, 0xdb, 0x1e, 0xd3, 0x7d, - 0xe6, 0x26, 0x13, 0x12, 0xfd, 0xb9, 0x54, 0xa7, 0x59, 0x5e, 0xe0, 0x93, 0xdf, 0x01, 0x00, 0x00, - 0xff, 0xff, 0xe7, 0x8a, 0xaf, 0x16, 0xc5, 0x02, 0x00, 0x00, + 0x14, 0xf5, 0xe4, 0xb7, 0x99, 0xf4, 0xcb, 0x67, 0x46, 0x15, 0x58, 0x46, 0x8c, 0x8d, 0x57, 0x11, + 0x0b, 0x5b, 0x98, 0x16, 0x89, 0xae, 0x48, 0x48, 0x17, 0x55, 0x55, 0x09, 0xd9, 0x62, 0x03, 0x0b, + 0x64, 0xc7, 0xd3, 0x74, 0x68, 0xec, 0x89, 0xec, 0xb1, 0x2a, 0xbf, 0x01, 0xf2, 0x8a, 0x17, 0x88, + 0x84, 0x44, 0x17, 0x2c, 0x79, 0x01, 0xf6, 0x59, 0x76, 0xc9, 0xca, 0x82, 0x64, 0x83, 0x2a, 0xb1, + 0xe9, 0x13, 0x20, 0xdb, 0x31, 0x2d, 0x45, 0xdd, 0x9d, 0x7b, 0xce, 0x99, 0x3b, 0xe7, 0x5e, 0x5d, + 0x78, 0x8f, 0x7a, 0x24, 0xe0, 0x94, 0x27, 0x46, 0x05, 0xf4, 0x59, 0xc8, 0x38, 0x43, 0x77, 0x68, + 0x48, 0xb9, 0xe3, 0x33, 0x4f, 0xaf, 0x04, 0x79, 0x6b, 0xc2, 0x26, 0xac, 0x50, 0x8d, 0x1c, 0x95, + 0x46, 0xed, 0x17, 0x80, 0x1b, 0xfb, 0x6b, 0x0b, 0xea, 0xc1, 0x1a, 0xf5, 0x24, 0xa0, 0x82, 0x7e, + 0xc7, 0xaa, 0x51, 0x0f, 0xbd, 0x81, 0x1b, 0xb3, 0xd8, 0x7d, 0x7b, 0x42, 0x92, 0x48, 0xaa, 0xa9, + 0xf5, 0x7e, 0xd7, 0x7c, 0xa0, 0xff, 0xd3, 0x58, 0x7f, 0x19, 0xbb, 0x07, 0x24, 0xd9, 0x0f, 0x8e, + 0xd8, 0xf0, 0xe1, 0x22, 0x53, 0x84, 0x8b, 0x4c, 0x69, 0xcf, 0x62, 0x37, 0x7f, 0x75, 0x99, 0x29, + 0xbd, 0xc4, 0xf1, 0xa7, 0xbb, 0xda, 0x9a, 0xd0, 0xac, 0x5c, 0x3a, 0x20, 0x49, 0x84, 0x34, 0xb8, + 0x39, 0x26, 0x21, 0xa7, 0x47, 0x74, 0xec, 0x70, 0x12, 0x49, 0x75, 0xb5, 0xde, 0xef, 0x58, 0x7f, + 0x71, 0x48, 0x85, 0xdd, 0x71, 0x48, 0x8a, 0x8f, 0x9c, 0x69, 0x24, 0x35, 0x8a, 0x64, 0xd7, 0x29, + 0xb4, 0x05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, 0xc5, 0x0f, 0x2c, 0x2c, 0x96, 0x18, 0x9c, 0x2f, + 0x31, 0xf8, 0xbe, 0xc4, 0xe0, 0xc3, 0x0a, 0x0b, 0xe7, 0x2b, 0x2c, 0x7c, 0x5b, 0x61, 0xe1, 0xf5, + 0xf6, 0x84, 0xf2, 0xe3, 0xd8, 0xd5, 0xc7, 0xcc, 0x37, 0x5c, 0xea, 0x04, 0xef, 0x28, 0x71, 0xa8, + 0x51, 0xad, 0xc9, 0xf0, 0x99, 0x17, 0x4f, 0x49, 0xf4, 0xe7, 0x72, 0x0d, 0x9e, 0xcc, 0x48, 0xe4, + 0xb6, 0x8a, 0xbb, 0x7c, 0xf2, 0x3b, 0x00, 0x00, 0xff, 0xff, 0xa4, 0x97, 0x48, 0xc8, 0xdb, 0x02, + 0x00, 0x00, } func (x PubKeyAlgorithm) String() string { @@ -239,6 +241,9 @@ func (this *Identity) Equal(that interface{}) bool { if this.Owner != that1.Owner { return false } + if this.Data != that1.Data { + return false + } return true } func (this *PubKeyInfo) Equal(that interface{}) bool { @@ -288,6 +293,13 @@ func (m *Identity) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.Data) > 0 { + i -= len(m.Data) + copy(dAtA[i:], m.Data) + i = encodeVarintIdentity(dAtA, i, uint64(len(m.Data))) + i-- + dAtA[i] = 0x32 + } if len(m.Owner) > 0 { i -= len(m.Owner) copy(dAtA[i:], m.Owner) @@ -411,6 +423,10 @@ func (m *Identity) Size() (n int) { if l > 0 { n += 1 + l + sovIdentity(uint64(l)) } + l = len(m.Data) + if l > 0 { + n += 1 + l + sovIdentity(uint64(l)) + } return n } @@ -627,13 +643,48 @@ func (m *Identity) Unmarshal(dAtA []byte) error { } m.Owner = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowIdentity + } + 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 ErrInvalidLengthIdentity + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthIdentity + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Data = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipIdentity(dAtA[iNdEx:]) if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthIdentity + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthIdentity } if (iNdEx + skippy) > l { @@ -734,7 +785,10 @@ func (m *PubKeyInfo) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthIdentity + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthIdentity } if (iNdEx + skippy) > l { diff --git a/modules/identity/tx.pb.go b/modules/identity/tx.pb.go index 1e743a0..e7e6f70 100644 --- a/modules/identity/tx.pb.go +++ b/modules/identity/tx.pb.go @@ -35,6 +35,7 @@ type MsgCreateIdentity struct { Certificate string `protobuf:"bytes,3,opt,name=certificate,proto3" json:"certificate,omitempty"` Credentials string `protobuf:"bytes,4,opt,name=credentials,proto3" json:"credentials,omitempty"` Owner string `protobuf:"bytes,5,opt,name=owner,proto3" json:"owner,omitempty"` + Data string `protobuf:"bytes,6,opt,name=data,proto3" json:"data,omitempty"` } func (m *MsgCreateIdentity) Reset() { *m = MsgCreateIdentity{} } @@ -114,6 +115,7 @@ type MsgUpdateIdentity struct { Certificate string `protobuf:"bytes,3,opt,name=certificate,proto3" json:"certificate,omitempty"` Credentials string `protobuf:"bytes,4,opt,name=credentials,proto3" json:"credentials,omitempty"` Owner string `protobuf:"bytes,5,opt,name=owner,proto3" json:"owner,omitempty"` + Data string `protobuf:"bytes,6,opt,name=data,proto3" json:"data,omitempty"` } func (m *MsgUpdateIdentity) Reset() { *m = MsgUpdateIdentity{} } @@ -196,31 +198,32 @@ func init() { func init() { proto.RegisterFile("identity/tx.proto", fileDescriptor_4a49ec0beed01e79) } var fileDescriptor_4a49ec0beed01e79 = []byte{ - // 378 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x93, 0xcb, 0x4e, 0xf2, 0x40, - 0x14, 0xc7, 0x3b, 0xdc, 0xbe, 0x7c, 0x43, 0x24, 0xa1, 0x21, 0xb1, 0x42, 0x2c, 0xa4, 0x71, 0xc1, - 0x42, 0xda, 0x04, 0x77, 0x2c, 0x71, 0x45, 0x08, 0x09, 0xc1, 0xb8, 0x71, 0x63, 0x5a, 0xe6, 0x50, - 0x47, 0x68, 0xa7, 0x69, 0xa7, 0xd1, 0xbe, 0x85, 0x8f, 0xe0, 0xe3, 0xb0, 0xc4, 0x1d, 0x2b, 0xa2, - 0xb0, 0x31, 0x2e, 0x7d, 0x02, 0x43, 0x4b, 0x51, 0x6e, 0x89, 0x6b, 0x77, 0xe7, 0xf2, 0x9f, 0xf3, - 0xcf, 0xef, 0x4c, 0x0e, 0xce, 0x53, 0x02, 0x36, 0xa7, 0x3c, 0xd0, 0xf8, 0xa3, 0xea, 0xb8, 0x8c, - 0x33, 0x31, 0x4f, 0x5d, 0xca, 0x75, 0x8b, 0x11, 0x35, 0xee, 0x15, 0x8f, 0xd7, 0xaa, 0x38, 0x88, - 0xb4, 0xc5, 0x82, 0xc9, 0x4c, 0x16, 0x86, 0xda, 0x32, 0x8a, 0xaa, 0xca, 0x14, 0xe1, 0x7c, 0xc7, - 0x33, 0x2f, 0x5d, 0xd0, 0x39, 0xb4, 0x56, 0x2f, 0xc4, 0x1c, 0x4e, 0x50, 0x22, 0xa1, 0x0a, 0xaa, - 0xfe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x0b, 0x37, 0x75, 0x93, 0xf2, 0x3b, 0xdf, 0x50, 0xfb, 0xcc, - 0xd2, 0x0c, 0xaa, 0xdb, 0xf7, 0x14, 0x74, 0xaa, 0x85, 0xf3, 0x6b, 0x1e, 0x19, 0xd6, 0x4c, 0xa6, - 0x59, 0x8c, 0xf8, 0x23, 0xf0, 0xd6, 0x17, 0x63, 0x64, 0xc2, 0xe3, 0xb8, 0xf8, 0x0a, 0x00, 0x00, - 0xff, 0xff, 0x69, 0x6b, 0xec, 0x77, 0x73, 0x03, 0x00, 0x00, + // 391 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x53, 0xcd, 0xaa, 0xda, 0x40, + 0x18, 0xcd, 0xf8, 0x57, 0x3a, 0x52, 0xc1, 0x41, 0x68, 0xaa, 0x34, 0x4a, 0xe8, 0xc2, 0x45, 0x49, + 0xc0, 0x76, 0xe5, 0xd2, 0xae, 0x44, 0x84, 0x92, 0xd2, 0x4d, 0x37, 0x65, 0xe2, 0x7c, 0xa6, 0x53, + 0x4d, 0x26, 0x24, 0x13, 0xda, 0xbc, 0x45, 0x1f, 0xa1, 0x8f, 0xe3, 0xd2, 0xee, 0xba, 0x92, 0x56, + 0x37, 0x97, 0xcb, 0x5d, 0xdd, 0x27, 0xb8, 0x38, 0x31, 0xd7, 0xeb, 0x1f, 0xdc, 0xfd, 0xdd, 0x9d, + 0x39, 0xdf, 0xc9, 0x77, 0x38, 0x87, 0x7c, 0xb8, 0xce, 0x19, 0x04, 0x92, 0xcb, 0xd4, 0x96, 0x3f, + 0xad, 0x30, 0x12, 0x52, 0x90, 0x3a, 0x8f, 0xb8, 0xa4, 0xbe, 0x60, 0x56, 0x3e, 0x6b, 0xbe, 0xbc, + 0x57, 0xe5, 0x20, 0xd3, 0x36, 0x1b, 0x9e, 0xf0, 0x84, 0x82, 0xf6, 0x16, 0x65, 0xac, 0x79, 0x83, + 0x70, 0x7d, 0x1c, 0x7b, 0x1f, 0x22, 0xa0, 0x12, 0x86, 0xbb, 0x2f, 0x48, 0x0d, 0x17, 0x38, 0xd3, + 0x51, 0x07, 0x75, 0x9f, 0x3b, 0x05, 0xce, 0xc8, 0x27, 0xfc, 0x2c, 0x4c, 0xdc, 0xaf, 0x33, 0x48, + 0xf5, 0x42, 0x07, 0x75, 0xab, 0xbd, 0xd7, 0xd6, 0x89, 0xb3, 0xf5, 0x31, 0x71, 0x47, 0x90, 0x0e, + 0x83, 0xa9, 0x18, 0xb4, 0xae, 0x57, 0xed, 0x4a, 0x98, 0xb8, 0x33, 0x48, 0x6f, 0x57, 0xed, 0x17, + 0x29, 0xf5, 0xe7, 0x7d, 0x33, 0x7b, 0x9b, 0xce, 0x76, 0x30, 0x82, 0x94, 0x74, 0x70, 0x75, 0x02, + 0x91, 0xe4, 0x53, 0x3e, 0xa1, 0x12, 0xf4, 0xa2, 0x72, 0x7b, 0x48, 0x29, 0x45, 0x04, 0x6a, 0x3f, + 0x9d, 0xc7, 0x7a, 0x69, 0xa7, 0xd8, 0x53, 0xa4, 0x81, 0xcb, 0xe2, 0x47, 0x00, 0x91, 0x5e, 0x56, + 0xb3, 0xec, 0x41, 0x08, 0x2e, 0x31, 0x2a, 0xa9, 0x5e, 0x51, 0xa4, 0xc2, 0xfd, 0xd2, 0xd5, 0xef, + 0x36, 0x32, 0x5b, 0xf8, 0xd5, 0x49, 0x5a, 0x07, 0xe2, 0x50, 0x04, 0x31, 0xe4, 0x5d, 0x7c, 0x0e, + 0xd9, 0x13, 0xea, 0xe2, 0x30, 0x6d, 0xde, 0x45, 0xef, 0x0f, 0xc2, 0xc5, 0x71, 0xec, 0x11, 0x86, + 0x6b, 0x47, 0xff, 0xc6, 0x9b, 0x33, 0x71, 0x4f, 0x3a, 0x6d, 0xbe, 0x7d, 0x8c, 0x2a, 0x77, 0xdb, + 0xba, 0x1c, 0xb5, 0x7e, 0xc1, 0xe5, 0x50, 0x75, 0xc9, 0xe5, 0x7c, 0xa6, 0x81, 0xb3, 0xf8, 0x6f, + 0x68, 0x8b, 0xb5, 0x81, 0x96, 0x6b, 0x03, 0xfd, 0x5b, 0x1b, 0xe8, 0xd7, 0xc6, 0xd0, 0x96, 0x1b, + 0x43, 0xfb, 0xbb, 0x31, 0xb4, 0x2f, 0xef, 0x3d, 0x2e, 0xbf, 0x25, 0xae, 0x35, 0x11, 0xbe, 0xed, + 0x72, 0x1a, 0x7c, 0xe7, 0x40, 0xb9, 0x9d, 0xef, 0xb7, 0x7d, 0xc1, 0x92, 0x39, 0xc4, 0xf6, 0xfe, + 0x08, 0xd3, 0x10, 0x62, 0xb7, 0xa2, 0xce, 0xe8, 0xdd, 0x5d, 0x00, 0x00, 0x00, 0xff, 0xff, 0x37, + 0x28, 0xae, 0x2a, 0x9d, 0x03, 0x00, 0x00, } func (this *MsgCreateIdentity) Equal(that interface{}) bool { @@ -257,6 +260,9 @@ func (this *MsgCreateIdentity) Equal(that interface{}) bool { if this.Owner != that1.Owner { return false } + if this.Data != that1.Data { + return false + } return true } func (this *MsgUpdateIdentity) Equal(that interface{}) bool { @@ -293,6 +299,9 @@ func (this *MsgUpdateIdentity) Equal(that interface{}) bool { if this.Owner != that1.Owner { return false } + if this.Data != that1.Data { + return false + } return true } @@ -436,6 +445,13 @@ func (m *MsgCreateIdentity) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.Data) > 0 { + i -= len(m.Data) + copy(dAtA[i:], m.Data) + i = encodeVarintTx(dAtA, i, uint64(len(m.Data))) + i-- + dAtA[i] = 0x32 + } if len(m.Owner) > 0 { i -= len(m.Owner) copy(dAtA[i:], m.Owner) @@ -522,6 +538,13 @@ func (m *MsgUpdateIdentity) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.Data) > 0 { + i -= len(m.Data) + copy(dAtA[i:], m.Data) + i = encodeVarintTx(dAtA, i, uint64(len(m.Data))) + i-- + dAtA[i] = 0x32 + } if len(m.Owner) > 0 { i -= len(m.Owner) copy(dAtA[i:], m.Owner) @@ -625,6 +648,10 @@ func (m *MsgCreateIdentity) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } + l = len(m.Data) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } return n } @@ -663,6 +690,10 @@ func (m *MsgUpdateIdentity) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } + l = len(m.Data) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } return n } @@ -874,13 +905,48 @@ func (m *MsgCreateIdentity) Unmarshal(dAtA []byte) error { } m.Owner = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Data", 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.Data = 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 { + if skippy < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTx } if (iNdEx + skippy) > l { @@ -930,7 +996,10 @@ func (m *MsgCreateIdentityResponse) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTx } if (iNdEx + skippy) > l { @@ -1138,13 +1207,48 @@ func (m *MsgUpdateIdentity) Unmarshal(dAtA []byte) error { } m.Owner = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Data", 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.Data = 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 { + if skippy < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTx } if (iNdEx + skippy) > l { @@ -1194,7 +1298,10 @@ func (m *MsgUpdateIdentityResponse) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTx } if (iNdEx + skippy) > l { diff --git a/proto/identity/identity.proto b/proto/identity/identity.proto index 488e1b6..f7d9e0c 100644 --- a/proto/identity/identity.proto +++ b/proto/identity/identity.proto @@ -8,46 +8,47 @@ option (gogoproto.goproto_getters_all) = false; // Identity defines a struct for an identity message Identity { - option (gogoproto.equal) = true; - - string id = 1 ; - repeated PubKeyInfo pub_keys = 2 [ - (gogoproto.nullable) = false, - (gogoproto.moretags) = "yaml:\"pubkeys\"", - (gogoproto.jsontag) = "pubkeys" - ]; - repeated string certificates = 3; - string credentials = 4; - string owner = 5; + option (gogoproto.equal) = true; + + string id = 1 ; + repeated PubKeyInfo pub_keys = 2 [ + (gogoproto.nullable) = false, + (gogoproto.moretags) = "yaml:\"pubkeys\"", + (gogoproto.jsontag) = "pubkeys" + ]; + repeated string certificates = 3; + string credentials = 4; + string owner = 5; + string data = 6; } // PubKey represents a public key along with the corresponding algorithm message PubKeyInfo { - option (gogoproto.equal) = true; + option (gogoproto.equal) = true; - string pub_key = 1 [ - (gogoproto.moretags) = "yaml:\"pubkey\"", - (gogoproto.jsontag) = "pubkey" - ]; - PubKeyAlgorithm algorithm = 2; + string pub_key = 1 [ + (gogoproto.moretags) = "yaml:\"pubkey\"", + (gogoproto.jsontag) = "pubkey" + ]; + PubKeyAlgorithm algorithm = 2; } // PubKeyAlgorithm defines the algorithm names for the public key enum PubKeyAlgorithm { - option (gogoproto.enum_stringer) = true; - option (gogoproto.goproto_enum_stringer) = false; - option (gogoproto.goproto_enum_prefix) = false; - - // UnknownPubKeyAlgorithm defines an unknown algorithm name - UnknownPubKeyAlgorithm = 0 [(gogoproto.enumvalue_customname) = "UnknownPubKeyAlgorithm"]; - // RSA defines a RSA algorithm name - RSA = 1 [(gogoproto.enumvalue_customname) = "RSA"]; - // DSA defines a DSA algorithm name. - DSA = 2 [(gogoproto.enumvalue_customname) = "DSA"]; - // ECDSA defines an ECDSA algorithm name. - ECDSA = 3 [(gogoproto.enumvalue_customname) = "ECDSA"]; - // ED25519 defines an ED25519 algorithm name. - ED25519 = 4 [(gogoproto.enumvalue_customname) = "ED25519"]; - // SM2 defines an SM2 algorithm name. - SM2 = 5 [(gogoproto.enumvalue_customname) = "SM2"]; + option (gogoproto.enum_stringer) = true; + option (gogoproto.goproto_enum_stringer) = false; + option (gogoproto.goproto_enum_prefix) = false; + + // UnknownPubKeyAlgorithm defines an unknown algorithm name + UnknownPubKeyAlgorithm = 0 [(gogoproto.enumvalue_customname) = "UnknownPubKeyAlgorithm"]; + // RSA defines a RSA algorithm name + RSA = 1 [(gogoproto.enumvalue_customname) = "RSA"]; + // DSA defines a DSA algorithm name. + DSA = 2 [(gogoproto.enumvalue_customname) = "DSA"]; + // ECDSA defines an ECDSA algorithm name. + ECDSA = 3 [(gogoproto.enumvalue_customname) = "ECDSA"]; + // ED25519 defines an ED25519 algorithm name. + ED25519 = 4 [(gogoproto.enumvalue_customname) = "ED25519"]; + // SM2 defines an SM2 algorithm name. + SM2 = 5 [(gogoproto.enumvalue_customname) = "SM2"]; } diff --git a/proto/identity/tx.proto b/proto/identity/tx.proto index 6dd9a72..83e4a6c 100644 --- a/proto/identity/tx.proto +++ b/proto/identity/tx.proto @@ -5,48 +5,50 @@ import "identity/identity.proto"; import "gogoproto/gogo.proto"; option go_package = "github.com/bianjieai/irita-sdk-go/modules/identity"; -option (gogoproto.goproto_getters_all) = false; +option (gogoproto.goproto_getters_all) = false; // Msg defines the bank Msg service. service Msg { - // CreateIdentity defines a method for creating a new identity. - rpc CreateIdentity(MsgCreateIdentity) returns (MsgCreateIdentityResponse); + // CreateIdentity defines a method for creating a new identity. + rpc CreateIdentity(MsgCreateIdentity) returns (MsgCreateIdentityResponse); - // UpdateIdentity defines a method for Updating a identity. - rpc UpdateIdentity(MsgUpdateIdentity) returns (MsgUpdateIdentityResponse); + // UpdateIdentity defines a method for Updating a identity. + rpc UpdateIdentity(MsgUpdateIdentity) returns (MsgUpdateIdentityResponse); } // MsgCreateIdentity defines a message to create an identity message MsgCreateIdentity { - option (gogoproto.equal) = true; - - string id = 1 ; - PubKeyInfo pub_key = 2 [ - (gogoproto.moretags) = "yaml:\"pubkey\"", - (gogoproto.jsontag) = "pubkey" - ]; - string certificate = 3; - string credentials = 4; - string owner = 5; + option (gogoproto.equal) = true; + + string id = 1 ; + PubKeyInfo pub_key = 2 [ + (gogoproto.moretags) = "yaml:\"pubkey\"", + (gogoproto.jsontag) = "pubkey" + ]; + string certificate = 3; + string credentials = 4; + string owner = 5; + string data = 6; } // MsgCreateIdentityResponse defines the Msg/Create response type. -message MsgCreateIdentityResponse { } +message MsgCreateIdentityResponse {} // MsgUpdateIdentity defines a message to update an identity message MsgUpdateIdentity { - option (gogoproto.equal) = true; - - string id = 1 ; - PubKeyInfo pub_key = 2 [ - (gogoproto.moretags) = "yaml:\"pubkey\"", - (gogoproto.jsontag) = "pubkey" - ]; - string certificate = 3; - string credentials = 4; - string owner = 5; + option (gogoproto.equal) = true; + + string id = 1 ; + PubKeyInfo pub_key = 2 [ + (gogoproto.moretags) = "yaml:\"pubkey\"", + (gogoproto.jsontag) = "pubkey" + ]; + string certificate = 3; + string credentials = 4; + string owner = 5; + string data = 6; } // MsgUpdateIdentityResponse defines the Msg/Update response type. -message MsgUpdateIdentityResponse { } \ No newline at end of file +message MsgUpdateIdentityResponse {} \ No newline at end of file