diff --git a/commonspace/object/acl/aclrecordproto/aclrecord.pb.go b/commonspace/object/acl/aclrecordproto/aclrecord.pb.go index 9bb5eab4..8ab2e12f 100644 --- a/commonspace/object/acl/aclrecordproto/aclrecord.pb.go +++ b/commonspace/object/acl/aclrecordproto/aclrecord.pb.go @@ -449,10 +449,10 @@ func (m *AclAccountRequestJoin) GetMetadata() []byte { // AclAccountRequestAccept contains the reference to join record and all read keys, encrypted with the identity of the requestor type AclAccountRequestAccept struct { - Identity []byte `protobuf:"bytes,1,opt,name=identity,proto3" json:"identity,omitempty"` - RequestRecordId string `protobuf:"bytes,2,opt,name=requestRecordId,proto3" json:"requestRecordId,omitempty"` - EncryptedReadKeys []byte `protobuf:"bytes,3,opt,name=encryptedReadKeys,proto3" json:"encryptedReadKeys,omitempty"` - Permissions AclUserPermissions `protobuf:"varint,4,opt,name=permissions,proto3,enum=aclrecord.AclUserPermissions" json:"permissions,omitempty"` + Identity []byte `protobuf:"bytes,1,opt,name=identity,proto3" json:"identity,omitempty"` + RequestRecordId string `protobuf:"bytes,2,opt,name=requestRecordId,proto3" json:"requestRecordId,omitempty"` + EncryptedReadKeys []*AclReadKeyWithRecord `protobuf:"bytes,3,rep,name=encryptedReadKeys,proto3" json:"encryptedReadKeys,omitempty"` + Permissions AclUserPermissions `protobuf:"varint,4,opt,name=permissions,proto3,enum=aclrecord.AclUserPermissions" json:"permissions,omitempty"` } func (m *AclAccountRequestAccept) Reset() { *m = AclAccountRequestAccept{} } @@ -502,7 +502,7 @@ func (m *AclAccountRequestAccept) GetRequestRecordId() string { return "" } -func (m *AclAccountRequestAccept) GetEncryptedReadKeys() []byte { +func (m *AclAccountRequestAccept) GetEncryptedReadKeys() []*AclReadKeyWithRecord { if m != nil { return m.EncryptedReadKeys } @@ -606,23 +606,24 @@ func (m *AclAccountInviteRevoke) GetInviteRecordId() string { return "" } -// AclReadKeys are all read keys in Acl -type AclReadKeys struct { - ReadKeys map[string][]byte `protobuf:"bytes,1,rep,name=readKeys,proto3" json:"readKeys,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` +// AclReadKeys are a read key with record id +type AclReadKeyWithRecord struct { + RecordId string `protobuf:"bytes,1,opt,name=recordId,proto3" json:"recordId,omitempty"` + EncryptedReadKey []byte `protobuf:"bytes,2,opt,name=encryptedReadKey,proto3" json:"encryptedReadKey,omitempty"` } -func (m *AclReadKeys) Reset() { *m = AclReadKeys{} } -func (m *AclReadKeys) String() string { return proto.CompactTextString(m) } -func (*AclReadKeys) ProtoMessage() {} -func (*AclReadKeys) Descriptor() ([]byte, []int) { +func (m *AclReadKeyWithRecord) Reset() { *m = AclReadKeyWithRecord{} } +func (m *AclReadKeyWithRecord) String() string { return proto.CompactTextString(m) } +func (*AclReadKeyWithRecord) ProtoMessage() {} +func (*AclReadKeyWithRecord) Descriptor() ([]byte, []int) { return fileDescriptor_c8e9f754f34e929b, []int{9} } -func (m *AclReadKeys) XXX_Unmarshal(b []byte) error { +func (m *AclReadKeyWithRecord) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *AclReadKeys) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *AclReadKeyWithRecord) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_AclReadKeys.Marshal(b, m, deterministic) + return xxx_messageInfo_AclReadKeyWithRecord.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -632,21 +633,28 @@ func (m *AclReadKeys) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return b[:n], nil } } -func (m *AclReadKeys) XXX_Merge(src proto.Message) { - xxx_messageInfo_AclReadKeys.Merge(m, src) +func (m *AclReadKeyWithRecord) XXX_Merge(src proto.Message) { + xxx_messageInfo_AclReadKeyWithRecord.Merge(m, src) } -func (m *AclReadKeys) XXX_Size() int { +func (m *AclReadKeyWithRecord) XXX_Size() int { return m.Size() } -func (m *AclReadKeys) XXX_DiscardUnknown() { - xxx_messageInfo_AclReadKeys.DiscardUnknown(m) +func (m *AclReadKeyWithRecord) XXX_DiscardUnknown() { + xxx_messageInfo_AclReadKeyWithRecord.DiscardUnknown(m) } -var xxx_messageInfo_AclReadKeys proto.InternalMessageInfo +var xxx_messageInfo_AclReadKeyWithRecord proto.InternalMessageInfo -func (m *AclReadKeys) GetReadKeys() map[string][]byte { +func (m *AclReadKeyWithRecord) GetRecordId() string { if m != nil { - return m.ReadKeys + return m.RecordId + } + return "" +} + +func (m *AclReadKeyWithRecord) GetEncryptedReadKey() []byte { + if m != nil { + return m.EncryptedReadKey } return nil } @@ -1238,8 +1246,7 @@ func init() { proto.RegisterType((*AclAccountRequestAccept)(nil), "aclrecord.AclAccountRequestAccept") proto.RegisterType((*AclAccountRequestDecline)(nil), "aclrecord.AclAccountRequestDecline") proto.RegisterType((*AclAccountInviteRevoke)(nil), "aclrecord.AclAccountInviteRevoke") - proto.RegisterType((*AclReadKeys)(nil), "aclrecord.AclReadKeys") - proto.RegisterMapType((map[string][]byte)(nil), "aclrecord.AclReadKeys.ReadKeysEntry") + proto.RegisterType((*AclReadKeyWithRecord)(nil), "aclrecord.AclReadKeyWithRecord") proto.RegisterType((*AclEncryptedReadKey)(nil), "aclrecord.AclEncryptedReadKey") proto.RegisterType((*AclAccountPermissionChange)(nil), "aclrecord.AclAccountPermissionChange") proto.RegisterType((*AclReadKeyChange)(nil), "aclrecord.AclReadKeyChange") @@ -1256,70 +1263,69 @@ func init() { } var fileDescriptor_c8e9f754f34e929b = []byte{ - // 1005 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x56, 0xdf, 0x6e, 0x1b, 0xc5, - 0x17, 0xde, 0xb5, 0x1d, 0x3b, 0x3e, 0x9b, 0xb8, 0xfe, 0xcd, 0x0f, 0x5a, 0x2b, 0x14, 0x2b, 0x2c, - 0x14, 0x45, 0x15, 0x4a, 0x90, 0x11, 0x22, 0x2a, 0x88, 0x66, 0x9b, 0x44, 0xd8, 0x81, 0x02, 0x9a, - 0x00, 0x95, 0x2a, 0x71, 0x31, 0x9d, 0x1d, 0xa5, 0x4b, 0xf7, 0x5f, 0x67, 0x27, 0xae, 0xfc, 0x0e, - 0x5c, 0xf0, 0x08, 0xbc, 0x08, 0xf7, 0x5c, 0xa1, 0xde, 0x20, 0x21, 0xae, 0x50, 0xf2, 0x22, 0x68, - 0x66, 0xf6, 0xff, 0x6e, 0x2d, 0x7a, 0xd1, 0x66, 0xe6, 0xcc, 0x39, 0xdf, 0x7c, 0xe7, 0x7c, 0x67, - 0xce, 0x1a, 0x3e, 0xa3, 0x51, 0x10, 0x44, 0x61, 0x12, 0x13, 0xca, 0x0e, 0xa2, 0x27, 0x3f, 0x31, - 0x2a, 0x0e, 0x08, 0xf5, 0xe5, 0x3f, 0xce, 0x68, 0xc4, 0xdd, 0x98, 0x47, 0x22, 0x3a, 0x50, 0xff, - 0x27, 0x85, 0x75, 0x5f, 0x19, 0xd0, 0x30, 0x37, 0xd8, 0xbf, 0x9a, 0xb0, 0x85, 0xc9, 0x0b, 0x87, - 0xfa, 0x58, 0x19, 0xd0, 0x04, 0x06, 0x31, 0x59, 0xf9, 0x11, 0x71, 0x27, 0xe6, 0xae, 0xb9, 0xb7, - 0x85, 0xb3, 0x2d, 0xba, 0x0d, 0xc3, 0xc4, 0xbb, 0x08, 0x89, 0xb8, 0xe4, 0x6c, 0xd2, 0x51, 0x67, - 0x85, 0x01, 0xdd, 0x85, 0x31, 0xa1, 0x94, 0xc5, 0x22, 0xe2, 0x0b, 0x97, 0x85, 0xc2, 0x13, 0xab, - 0x49, 0x57, 0x39, 0x35, 0xec, 0xe8, 0x03, 0xf8, 0x5f, 0x66, 0x3b, 0xcf, 0x11, 0x7b, 0xca, 0xb9, - 0x79, 0x60, 0x7f, 0x0e, 0xa8, 0xcc, 0xf0, 0x91, 0x27, 0x9e, 0x2e,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x3d, 0xc1, 0xf8, 0xb8, 0x2b, 0xd7, 0x52, 0x74, 0xc6, 0xc7, 0xbd, 0x07, 0xf7, 0x7f, 0xbf, 0x9a, - 0x9a, 0x2f, 0xaf, 0xa6, 0xe6, 0x3f, 0x57, 0x53, 0xf3, 0x97, 0xeb, 0xa9, 0xf1, 0xf2, 0x7a, 0x6a, - 0xfc, 0x75, 0x3d, 0x35, 0x1e, 0xdf, 0xf9, 0x4f, 0x3f, 0x78, 0x9f, 0xf4, 0xd5, 0x9f, 0x8f, 0xfe, - 0x0d, 0x00, 0x00, 0xff, 0xff, 0xf9, 0x8e, 0x57, 0x42, 0x20, 0x0b, 0x00, 0x00, + // 977 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x56, 0xdd, 0x6e, 0x1b, 0x45, + 0x14, 0xde, 0x75, 0x1c, 0x3b, 0x3e, 0x9b, 0xb8, 0xee, 0x00, 0xed, 0x2a, 0x14, 0x13, 0x16, 0x15, + 0x45, 0x15, 0x6a, 0x90, 0x11, 0xa2, 0x42, 0x88, 0xd6, 0x4d, 0x2a, 0xec, 0x40, 0x00, 0x4d, 0x80, + 0x4a, 0x95, 0x40, 0x9a, 0xce, 0x8e, 0xd2, 0x85, 0xfd, 0xeb, 0xec, 0xc4, 0x95, 0xdf, 0x82, 0x47, + 0xe0, 0x45, 0xb8, 0xe7, 0xb2, 0x37, 0x48, 0x88, 0x2b, 0x94, 0x3c, 0x00, 0xaf, 0x80, 0x66, 0xc6, + 0xfb, 0x37, 0xbb, 0xb5, 0x9a, 0x8b, 0xc4, 0x3b, 0x67, 0xce, 0xf9, 0xe6, 0x9c, 0xf3, 0x7d, 0x73, + 0x76, 0xe1, 0x73, 0x9a, 0x44, 0x51, 0x12, 0x67, 0x29, 0xa1, 0xec, 0x20, 0x79, 0xfa, 0x0b, 0xa3, + 0xe2, 0x80, 0xd0, 0x50, 0xfe, 0x71,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x7b, 0x6b, 0x82, 0xb5, 0xe3, 0xcc, 0xc2, + 0xb5, 0x40, 0x74, 0x04, 0x0e, 0x2f, 0x87, 0x98, 0x9a, 0x2c, 0xce, 0x64, 0xaf, 0x15, 0xa7, 0x32, + 0xec, 0x66, 0x16, 0xae, 0x86, 0xa1, 0x63, 0xd8, 0xe1, 0xd5, 0x51, 0xa2, 0xae, 0xa9, 0x33, 0xf1, + 0xd6, 0xe1, 0x68, 0xcf, 0x99, 0x85, 0xeb, 0xa1, 0xe8, 0x14, 0x46, 0xa9, 0x21, 0x2f, 0x35, 0xe6, + 0x9d, 0xc9, 0xed, 0x56, 0x38, 0x53, 0x8b, 0x33, 0x0b, 0x37, 0x00, 0xd0, 0x21, 0xec, 0x90, 0x2a, + 0xd3, 0xea, 0x95, 0xf0, 0xaa, 0x6e, 0x6b, 0x17, 0x99, 0x59, 0x2d, 0x46, 0x82, 0xf0, 0xaa, 0x08, + 0xdd, 0x7e, 0x1b, 0x48, 0x4d, 0xa7, 0xba, 0xbc, 0xaa, 0x70, 0x4f, 0x60, 0xc8, 0x6b, 0x43, 0xc8, + 0xdd, 0x52, 0x28, 0xef, 0xaf, 0xeb, 0xd5, 0xca, 0x75, 0x66, 0x61, 0x23, 0xf8, 0x61, 0x1f, 0x36, + 0x17, 0x52, 0x48, 0xde, 0x23, 0xf5, 0x86, 0x3e, 0x92, 0xef, 0xf2, 0xcf, 0x00, 0x48, 0x21, 0xb3, + 0xd5, 0xd5, 0xd8, 0xad, 0xc3, 0x57, 0x35, 0x88, 0x2b, 0xde, 0xde, 0x31, 0x0c, 0xa7, 0x34, 0x3c, + 0x5d, 0xc6, 0xf4, 0x84, 0x65, 0x19, 0x39, 0x63, 0xe8, 0x1e, 0xf4, 0x69, 0x01, 0x65, 0x37, 0x35, + 0x2f, 0x7d, 0x6b, 0x70, 0xb9, 0xbb, 0xf7, 0x44, 0x4d, 0x24, 0x73, 0x5f, 0xa5, 0xe7, 0xfb, 0x7a, + 0xfa, 0x65, 0x2b, 0x4c, 0xd7, 0xa8, 0xbe, 0xd8, 0x9f, 0x59, 0xb8, 0xe2, 0x5d, 0x96, 0x3b, 0x83, + 0x9d, 0x9a, 0x1f, 0xfa, 0x14, 0xfa, 0xbc, 0x80, 0x94, 0x15, 0x57, 0x27, 0x4c, 0xf3, 0x7b, 0x0b, + 0xe7, 0xde, 0x77, 0xbe, 0x06, 0xd4, 0x1c, 0x40, 0x68, 0x0b, 0xba, 0xdf, 0x24, 0x31, 0x1b, 0x59, + 0x68, 0x00, 0x9b, 0xdf, 0xbe, 0x88, 0x19, 0x1f, 0xd9, 0xf2, 0x71, 0xea, 0x47, 0x41, 0x3c, 0xea, + 0x20, 0x80, 0xde, 0x63, 0x1e, 0x08, 0xc6, 0x47, 0x1b, 0xf2, 0x59, 0x92, 0xce, 0xf8, 0xa8, 0xfb, + 0xf0, 0xfe, 0x9f, 0x17, 0x63, 0xfb, 0xe5, 0xc5, 0xd8, 0xfe, 0xf7, 0x62, 0x6c, 0xff, 0x76, 0x39, + 0xb6, 0x5e, 0x5e, 0x8e, 0xad, 0xbf, 0x2f, 0xc7, 0xd6, 0x93, 0xdb, 0xaf, 0xf5, 0x89, 0xfb, 0xb4, + 0xa7, 0x7e, 0x3e, 0xfe, 0x3f, 0x00, 0x00, 0xff, 0xff, 0x93, 0x1c, 0x33, 0x3f, 0x12, 0x0b, 0x00, + 0x00, } func (m *RawAclRecord) Marshal() (dAtA []byte, err error) { @@ -1629,11 +1635,18 @@ func (m *AclAccountRequestAccept) MarshalToSizedBuffer(dAtA []byte) (int, error) dAtA[i] = 0x20 } if len(m.EncryptedReadKeys) > 0 { - i -= len(m.EncryptedReadKeys) - copy(dAtA[i:], m.EncryptedReadKeys) - i = encodeVarintAclrecord(dAtA, i, uint64(len(m.EncryptedReadKeys))) - i-- - dAtA[i] = 0x1a + for iNdEx := len(m.EncryptedReadKeys) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.EncryptedReadKeys[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintAclrecord(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } } if len(m.RequestRecordId) > 0 { i -= len(m.RequestRecordId) @@ -1712,7 +1725,7 @@ func (m *AclAccountInviteRevoke) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } -func (m *AclReadKeys) Marshal() (dAtA []byte, err error) { +func (m *AclReadKeyWithRecord) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1722,36 +1735,29 @@ func (m *AclReadKeys) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *AclReadKeys) MarshalTo(dAtA []byte) (int, error) { +func (m *AclReadKeyWithRecord) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *AclReadKeys) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *AclReadKeyWithRecord) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.ReadKeys) > 0 { - for k := range m.ReadKeys { - v := m.ReadKeys[k] - baseI := i - if len(v) > 0 { - i -= len(v) - copy(dAtA[i:], v) - i = encodeVarintAclrecord(dAtA, i, uint64(len(v))) - i-- - dAtA[i] = 0x12 - } - i -= len(k) - copy(dAtA[i:], k) - i = encodeVarintAclrecord(dAtA, i, uint64(len(k))) - i-- - dAtA[i] = 0xa - i = encodeVarintAclrecord(dAtA, i, uint64(baseI-i)) - i-- - dAtA[i] = 0xa - } + if len(m.EncryptedReadKey) > 0 { + i -= len(m.EncryptedReadKey) + copy(dAtA[i:], m.EncryptedReadKey) + i = encodeVarintAclrecord(dAtA, i, uint64(len(m.EncryptedReadKey))) + i-- + dAtA[i] = 0x12 + } + if len(m.RecordId) > 0 { + i -= len(m.RecordId) + copy(dAtA[i:], m.RecordId) + i = encodeVarintAclrecord(dAtA, i, uint64(len(m.RecordId))) + i-- + dAtA[i] = 0xa } return len(dAtA) - i, nil } @@ -2432,9 +2438,11 @@ func (m *AclAccountRequestAccept) Size() (n int) { if l > 0 { n += 1 + l + sovAclrecord(uint64(l)) } - l = len(m.EncryptedReadKeys) - if l > 0 { - n += 1 + l + sovAclrecord(uint64(l)) + if len(m.EncryptedReadKeys) > 0 { + for _, e := range m.EncryptedReadKeys { + l = e.Size() + n += 1 + l + sovAclrecord(uint64(l)) + } } if m.Permissions != 0 { n += 1 + sovAclrecord(uint64(m.Permissions)) @@ -2468,23 +2476,19 @@ func (m *AclAccountInviteRevoke) Size() (n int) { return n } -func (m *AclReadKeys) Size() (n int) { +func (m *AclReadKeyWithRecord) Size() (n int) { if m == nil { return 0 } var l int _ = l - if len(m.ReadKeys) > 0 { - for k, v := range m.ReadKeys { - _ = k - _ = v - l = 0 - if len(v) > 0 { - l = 1 + len(v) + sovAclrecord(uint64(len(v))) - } - mapEntrySize := 1 + len(k) + sovAclrecord(uint64(len(k))) + l - n += mapEntrySize + 1 + sovAclrecord(uint64(mapEntrySize)) - } + l = len(m.RecordId) + if l > 0 { + n += 1 + l + sovAclrecord(uint64(l)) + } + l = len(m.EncryptedReadKey) + if l > 0 { + n += 1 + l + sovAclrecord(uint64(l)) } return n } @@ -3812,7 +3816,7 @@ func (m *AclAccountRequestAccept) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field EncryptedReadKeys", wireType) } - var byteLen int + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowAclrecord @@ -3822,24 +3826,24 @@ func (m *AclAccountRequestAccept) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + if msglen < 0 { return ErrInvalidLengthAclrecord } - postIndex := iNdEx + byteLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthAclrecord } if postIndex > l { return io.ErrUnexpectedEOF } - m.EncryptedReadKeys = append(m.EncryptedReadKeys[:0], dAtA[iNdEx:postIndex]...) - if m.EncryptedReadKeys == nil { - m.EncryptedReadKeys = []byte{} + m.EncryptedReadKeys = append(m.EncryptedReadKeys, &AclReadKeyWithRecord{}) + if err := m.EncryptedReadKeys[len(m.EncryptedReadKeys)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } iNdEx = postIndex case 4: @@ -4046,7 +4050,7 @@ func (m *AclAccountInviteRevoke) Unmarshal(dAtA []byte) error { } return nil } -func (m *AclReadKeys) Unmarshal(dAtA []byte) error { +func (m *AclReadKeyWithRecord) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4069,17 +4073,17 @@ func (m *AclReadKeys) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: AclReadKeys: wiretype end group for non-group") + return fmt.Errorf("proto: AclReadKeyWithRecord: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: AclReadKeys: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: AclReadKeyWithRecord: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ReadKeys", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field RecordId", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowAclrecord @@ -4089,119 +4093,57 @@ func (m *AclReadKeys) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthAclrecord } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthAclrecord } if postIndex > l { return io.ErrUnexpectedEOF } - if m.ReadKeys == nil { - m.ReadKeys = make(map[string][]byte) + m.RecordId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EncryptedReadKey", wireType) } - var mapkey string - mapvalue := []byte{} - for iNdEx < postIndex { - entryPreIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAclrecord - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAclrecord } - fieldNum := int32(wire >> 3) - if fieldNum == 1 { - var stringLenmapkey uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAclrecord - } - 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 ErrInvalidLengthAclrecord - } - postStringIndexmapkey := iNdEx + intStringLenmapkey - if postStringIndexmapkey < 0 { - return ErrInvalidLengthAclrecord - } - if postStringIndexmapkey > l { - return io.ErrUnexpectedEOF - } - mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) - iNdEx = postStringIndexmapkey - } else if fieldNum == 2 { - var mapbyteLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAclrecord - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - mapbyteLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intMapbyteLen := int(mapbyteLen) - if intMapbyteLen < 0 { - return ErrInvalidLengthAclrecord - } - postbytesIndex := iNdEx + intMapbyteLen - if postbytesIndex < 0 { - return ErrInvalidLengthAclrecord - } - if postbytesIndex > l { - return io.ErrUnexpectedEOF - } - mapvalue = make([]byte, mapbyteLen) - copy(mapvalue, dAtA[iNdEx:postbytesIndex]) - iNdEx = postbytesIndex - } else { - iNdEx = entryPreIndex - skippy, err := skipAclrecord(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthAclrecord - } - if (iNdEx + skippy) > postIndex { - return io.ErrUnexpectedEOF - } - iNdEx += skippy + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break } } - m.ReadKeys[mapkey] = mapvalue + if byteLen < 0 { + return ErrInvalidLengthAclrecord + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthAclrecord + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.EncryptedReadKey = append(m.EncryptedReadKey[:0], dAtA[iNdEx:postIndex]...) + if m.EncryptedReadKey == nil { + m.EncryptedReadKey = []byte{} + } iNdEx = postIndex default: iNdEx = preIndex diff --git a/commonspace/object/acl/aclrecordproto/protos/aclrecord.proto b/commonspace/object/acl/aclrecordproto/protos/aclrecord.proto index 1fa11e59..5215ae7a 100644 --- a/commonspace/object/acl/aclrecordproto/protos/aclrecord.proto +++ b/commonspace/object/acl/aclrecordproto/protos/aclrecord.proto @@ -51,7 +51,7 @@ message AclAccountRequestJoin { message AclAccountRequestAccept { bytes identity = 1; string requestRecordId = 2; - bytes encryptedReadKeys = 3; + repeated AclReadKeyWithRecord encryptedReadKeys = 3; AclUserPermissions permissions = 4; } @@ -65,9 +65,10 @@ message AclAccountInviteRevoke { string inviteRecordId = 1; } -// AclReadKeys are all read keys in Acl -message AclReadKeys { - map readKeys = 1; +// AclReadKeys are a read key with record id +message AclReadKeyWithRecord { + string recordId = 1; + bytes encryptedReadKey = 2; } // AclEncryptedReadKeys are new key for specific identity diff --git a/commonspace/object/acl/list/aclrecordbuilder.go b/commonspace/object/acl/list/aclrecordbuilder.go index 86b94c5c..b038a0c5 100644 --- a/commonspace/object/acl/list/aclrecordbuilder.go +++ b/commonspace/object/acl/list/aclrecordbuilder.go @@ -182,16 +182,21 @@ func (a *aclRecordBuilder) BuildRequestAccept(payload RequestAcceptPayload) (raw err = ErrNoSuchRequest return } - readKeys := map[string][]byte{} + var encryptedReadKeys []*aclrecordproto.AclReadKeyWithRecord for keyId, key := range a.state.userReadKeys { rawKey, err := key.Raw() if err != nil { return nil, err } - readKeys[keyId] = rawKey + enc, err := request.RequestIdentity.Encrypt(rawKey) + if err != nil { + return nil, err + } + encryptedReadKeys = append(encryptedReadKeys, &aclrecordproto.AclReadKeyWithRecord{ + RecordId: keyId, + EncryptedReadKey: enc, + }) } - aclKeys := &aclrecordproto.AclReadKeys{ReadKeys: readKeys} - marshalledKeys, err := aclKeys.Marshal() if err != nil { return } @@ -199,14 +204,10 @@ func (a *aclRecordBuilder) BuildRequestAccept(payload RequestAcceptPayload) (raw if err != nil { return } - encKeys, err := request.RequestIdentity.Encrypt(marshalledKeys) - if err != nil { - return - } acceptRec := &aclrecordproto.AclAccountRequestAccept{ Identity: requestIdentityProto, RequestRecordId: payload.RequestRecordId, - EncryptedReadKeys: encKeys, + EncryptedReadKeys: encryptedReadKeys, Permissions: aclrecordproto.AclUserPermissions(payload.Permissions), } content := &aclrecordproto.AclContentValue{Value: &aclrecordproto.AclContentValue_RequestAccept{RequestAccept: acceptRec}} diff --git a/commonspace/object/acl/list/aclstate.go b/commonspace/object/acl/list/aclstate.go index de484a13..7f4c64d9 100644 --- a/commonspace/object/acl/list/aclstate.go +++ b/commonspace/object/acl/list/aclstate.go @@ -312,21 +312,16 @@ func (st *AclState) applyRequestAccept(ch *aclrecordproto.AclAccountRequestAccep if !st.pubKey.Equals(acceptIdentity) { return nil } - res, err := st.key.Decrypt(ch.EncryptedReadKeys) - if err != nil { - return err - } - keys := &aclrecordproto.AclReadKeys{} - err = proto.Unmarshal(res, keys) - if err != nil { - return err - } - for keyId, key := range keys.ReadKeys { - sym, err := crypto.UnmarshallAESKey(key) + for _, key := range ch.EncryptedReadKeys { + decrypted, err := st.key.Decrypt(key.EncryptedReadKey) if err != nil { return err } - st.userReadKeys[keyId] = sym + sym, err := crypto.UnmarshallAESKey(decrypted) + if err != nil { + return err + } + st.userReadKeys[key.RecordId] = sym } return nil } diff --git a/net/peer/peer.go b/net/peer/peer.go index 6b6a7666..5bd81a8b 100644 --- a/net/peer/peer.go +++ b/net/peer/peer.go @@ -201,11 +201,6 @@ func (p *peer) TryClose(objectTTL time.Duration) (res bool, err error) { return false, nil } -// 70 stream -> 1 subconn -// 62 request -> 1 subconn -// 2600 subconn (2400 non active -> 5 min) - -// 2 5min connect func (p *peer) gc(ttl time.Duration) (aliveCount int) { p.mu.Lock() defer p.mu.Unlock()