1
0
Fork 0
mirror of https://github.com/anyproto/any-sync.git synced 2025-06-07 21:47:02 +09:00

Decrypt Invite

This commit is contained in:
Mikhail Rakhmanov 2025-05-09 11:38:55 +02:00
parent 4e9f1a3356
commit bc9193b33a
No known key found for this signature in database
GPG key ID: DED12CFEF5B8396B
3 changed files with 668 additions and 85 deletions

View file

@ -204,7 +204,8 @@ func (m *AclRoot) GetEncryptedOwnerMetadata() []byte {
// AclAccountInvite contains the public invite key, the private part of which is sent to the user directly
type AclAccountInvite struct {
InviteKey []byte `protobuf:"bytes,1,opt,name=inviteKey,proto3" json:"inviteKey,omitempty"`
InviteKey []byte `protobuf:"bytes,1,opt,name=inviteKey,proto3" json:"inviteKey,omitempty"`
InviteType AclInviteType `protobuf:"varint,2,opt,name=inviteType,proto3,enum=aclrecord.AclInviteType" json:"inviteType,omitempty"`
}
func (m *AclAccountInvite) Reset() { *m = AclAccountInvite{} }
@ -255,6 +256,13 @@ func (m *AclAccountInvite) GetInviteKey() []byte {
return nil
}
func (m *AclAccountInvite) GetInviteType() AclInviteType {
if m != nil {
return m.InviteType
}
return AclInviteType_RequestToJoin
}
// AclAccountRequestJoin contains the reference to the invite record and the data of the person who wants to join, confirmed by the private invite key
type AclAccountRequestJoin struct {
InviteIdentity []byte `protobuf:"bytes,1,opt,name=inviteIdentity,proto3" json:"inviteIdentity,omitempty"`
@ -333,6 +341,93 @@ func (m *AclAccountRequestJoin) GetMetadata() []byte {
return nil
}
// AclInviteJoin contains the reference to the invite record and the data of the person who wants to join, confirmed by the private invite key
// The person must encrypt the key with its own public key
type AclInviteJoin struct {
InviteIdentity []byte `protobuf:"bytes,1,opt,name=inviteIdentity,proto3" json:"inviteIdentity,omitempty"`
InviteRecordId string `protobuf:"bytes,2,opt,name=inviteRecordId,proto3" json:"inviteRecordId,omitempty"`
InviteIdentitySignature []byte `protobuf:"bytes,3,opt,name=inviteIdentitySignature,proto3" json:"inviteIdentitySignature,omitempty"`
// Metadata is encrypted with metadata key of the space
Metadata []byte `protobuf:"bytes,4,opt,name=metadata,proto3" json:"metadata,omitempty"`
EncryptedReadKey []byte `protobuf:"bytes,5,opt,name=encryptedReadKey,proto3" json:"encryptedReadKey,omitempty"`
}
func (m *AclInviteJoin) Reset() { *m = AclInviteJoin{} }
func (m *AclInviteJoin) String() string { return proto.CompactTextString(m) }
func (*AclInviteJoin) ProtoMessage() {}
func (*AclInviteJoin) Descriptor() ([]byte, []int) {
return fileDescriptor_c8e9f754f34e929b, []int{3}
}
func (m *AclInviteJoin) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *AclInviteJoin) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_AclInviteJoin.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 *AclInviteJoin) XXX_MarshalAppend(b []byte, newLen int) ([]byte, error) {
b = b[:newLen]
_, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b, nil
}
func (m *AclInviteJoin) XXX_Merge(src proto.Message) {
xxx_messageInfo_AclInviteJoin.Merge(m, src)
}
func (m *AclInviteJoin) XXX_Size() int {
return m.Size()
}
func (m *AclInviteJoin) XXX_DiscardUnknown() {
xxx_messageInfo_AclInviteJoin.DiscardUnknown(m)
}
var xxx_messageInfo_AclInviteJoin proto.InternalMessageInfo
func (m *AclInviteJoin) GetInviteIdentity() []byte {
if m != nil {
return m.InviteIdentity
}
return nil
}
func (m *AclInviteJoin) GetInviteRecordId() string {
if m != nil {
return m.InviteRecordId
}
return ""
}
func (m *AclInviteJoin) GetInviteIdentitySignature() []byte {
if m != nil {
return m.InviteIdentitySignature
}
return nil
}
func (m *AclInviteJoin) GetMetadata() []byte {
if m != nil {
return m.Metadata
}
return nil
}
func (m *AclInviteJoin) GetEncryptedReadKey() []byte {
if m != nil {
return m.EncryptedReadKey
}
return nil
}
// 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"`
@ -345,7 +440,7 @@ func (m *AclAccountRequestAccept) Reset() { *m = AclAccountRequestAccept
func (m *AclAccountRequestAccept) String() string { return proto.CompactTextString(m) }
func (*AclAccountRequestAccept) ProtoMessage() {}
func (*AclAccountRequestAccept) Descriptor() ([]byte, []int) {
return fileDescriptor_c8e9f754f34e929b, []int{3}
return fileDescriptor_c8e9f754f34e929b, []int{4}
}
func (m *AclAccountRequestAccept) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@ -419,7 +514,7 @@ func (m *AclAccountRequestDecline) Reset() { *m = AclAccountRequestDecli
func (m *AclAccountRequestDecline) String() string { return proto.CompactTextString(m) }
func (*AclAccountRequestDecline) ProtoMessage() {}
func (*AclAccountRequestDecline) Descriptor() ([]byte, []int) {
return fileDescriptor_c8e9f754f34e929b, []int{4}
return fileDescriptor_c8e9f754f34e929b, []int{5}
}
func (m *AclAccountRequestDecline) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@ -472,7 +567,7 @@ func (m *AclAccountInviteRevoke) Reset() { *m = AclAccountInviteRevoke{}
func (m *AclAccountInviteRevoke) String() string { return proto.CompactTextString(m) }
func (*AclAccountInviteRevoke) ProtoMessage() {}
func (*AclAccountInviteRevoke) Descriptor() ([]byte, []int) {
return fileDescriptor_c8e9f754f34e929b, []int{5}
return fileDescriptor_c8e9f754f34e929b, []int{6}
}
func (m *AclAccountInviteRevoke) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@ -526,7 +621,7 @@ func (m *AclEncryptedReadKey) Reset() { *m = AclEncryptedReadKey{} }
func (m *AclEncryptedReadKey) String() string { return proto.CompactTextString(m) }
func (*AclEncryptedReadKey) ProtoMessage() {}
func (*AclEncryptedReadKey) Descriptor() ([]byte, []int) {
return fileDescriptor_c8e9f754f34e929b, []int{6}
return fileDescriptor_c8e9f754f34e929b, []int{7}
}
func (m *AclEncryptedReadKey) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@ -586,7 +681,7 @@ func (m *AclAccountPermissionChanges) Reset() { *m = AclAccountPermissio
func (m *AclAccountPermissionChanges) String() string { return proto.CompactTextString(m) }
func (*AclAccountPermissionChanges) ProtoMessage() {}
func (*AclAccountPermissionChanges) Descriptor() ([]byte, []int) {
return fileDescriptor_c8e9f754f34e929b, []int{7}
return fileDescriptor_c8e9f754f34e929b, []int{8}
}
func (m *AclAccountPermissionChanges) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@ -639,7 +734,7 @@ func (m *AclAccountsAdd) Reset() { *m = AclAccountsAdd{} }
func (m *AclAccountsAdd) String() string { return proto.CompactTextString(m) }
func (*AclAccountsAdd) ProtoMessage() {}
func (*AclAccountsAdd) Descriptor() ([]byte, []int) {
return fileDescriptor_c8e9f754f34e929b, []int{8}
return fileDescriptor_c8e9f754f34e929b, []int{9}
}
func (m *AclAccountsAdd) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@ -695,7 +790,7 @@ func (m *AclAccountAdd) Reset() { *m = AclAccountAdd{} }
func (m *AclAccountAdd) String() string { return proto.CompactTextString(m) }
func (*AclAccountAdd) ProtoMessage() {}
func (*AclAccountAdd) Descriptor() ([]byte, []int) {
return fileDescriptor_c8e9f754f34e929b, []int{9}
return fileDescriptor_c8e9f754f34e929b, []int{10}
}
func (m *AclAccountAdd) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@ -769,7 +864,7 @@ func (m *AclAccountRequestCancel) Reset() { *m = AclAccountRequestCancel
func (m *AclAccountRequestCancel) String() string { return proto.CompactTextString(m) }
func (*AclAccountRequestCancel) ProtoMessage() {}
func (*AclAccountRequestCancel) Descriptor() ([]byte, []int) {
return fileDescriptor_c8e9f754f34e929b, []int{10}
return fileDescriptor_c8e9f754f34e929b, []int{11}
}
func (m *AclAccountRequestCancel) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@ -823,7 +918,7 @@ func (m *AclAccountPermissionChange) Reset() { *m = AclAccountPermission
func (m *AclAccountPermissionChange) String() string { return proto.CompactTextString(m) }
func (*AclAccountPermissionChange) ProtoMessage() {}
func (*AclAccountPermissionChange) Descriptor() ([]byte, []int) {
return fileDescriptor_c8e9f754f34e929b, []int{11}
return fileDescriptor_c8e9f754f34e929b, []int{12}
}
func (m *AclAccountPermissionChange) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@ -881,14 +976,15 @@ type AclReadKeyChange struct {
// EncryptedMetadataPrivKey is encrypted with new read key
EncryptedMetadataPrivKey []byte `protobuf:"bytes,3,opt,name=encryptedMetadataPrivKey,proto3" json:"encryptedMetadataPrivKey,omitempty"`
// EncryptedOldReadKey is encrypted with new read key
EncryptedOldReadKey []byte `protobuf:"bytes,4,opt,name=encryptedOldReadKey,proto3" json:"encryptedOldReadKey,omitempty"`
EncryptedOldReadKey []byte `protobuf:"bytes,4,opt,name=encryptedOldReadKey,proto3" json:"encryptedOldReadKey,omitempty"`
InviteKeys []*AclEncryptedReadKey `protobuf:"bytes,5,rep,name=inviteKeys,proto3" json:"inviteKeys,omitempty"`
}
func (m *AclReadKeyChange) Reset() { *m = AclReadKeyChange{} }
func (m *AclReadKeyChange) String() string { return proto.CompactTextString(m) }
func (*AclReadKeyChange) ProtoMessage() {}
func (*AclReadKeyChange) Descriptor() ([]byte, []int) {
return fileDescriptor_c8e9f754f34e929b, []int{12}
return fileDescriptor_c8e9f754f34e929b, []int{13}
}
func (m *AclReadKeyChange) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@ -953,6 +1049,13 @@ func (m *AclReadKeyChange) GetEncryptedOldReadKey() []byte {
return nil
}
func (m *AclReadKeyChange) GetInviteKeys() []*AclEncryptedReadKey {
if m != nil {
return m.InviteKeys
}
return nil
}
// AclAccountRemove removes an account and changes read key for space
type AclAccountRemove struct {
Identities [][]byte `protobuf:"bytes,1,rep,name=identities,proto3" json:"identities,omitempty"`
@ -963,7 +1066,7 @@ func (m *AclAccountRemove) Reset() { *m = AclAccountRemove{} }
func (m *AclAccountRemove) String() string { return proto.CompactTextString(m) }
func (*AclAccountRemove) ProtoMessage() {}
func (*AclAccountRemove) Descriptor() ([]byte, []int) {
return fileDescriptor_c8e9f754f34e929b, []int{13}
return fileDescriptor_c8e9f754f34e929b, []int{14}
}
func (m *AclAccountRemove) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@ -1022,7 +1125,7 @@ func (m *AclAccountRequestRemove) Reset() { *m = AclAccountRequestRemove
func (m *AclAccountRequestRemove) String() string { return proto.CompactTextString(m) }
func (*AclAccountRequestRemove) ProtoMessage() {}
func (*AclAccountRequestRemove) Descriptor() ([]byte, []int) {
return fileDescriptor_c8e9f754f34e929b, []int{14}
return fileDescriptor_c8e9f754f34e929b, []int{15}
}
func (m *AclAccountRequestRemove) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@ -1082,7 +1185,7 @@ func (m *AclContentValue) Reset() { *m = AclContentValue{} }
func (m *AclContentValue) String() string { return proto.CompactTextString(m) }
func (*AclContentValue) ProtoMessage() {}
func (*AclContentValue) Descriptor() ([]byte, []int) {
return fileDescriptor_c8e9f754f34e929b, []int{15}
return fileDescriptor_c8e9f754f34e929b, []int{16}
}
func (m *AclContentValue) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@ -1293,7 +1396,7 @@ func (m *AclData) Reset() { *m = AclData{} }
func (m *AclData) String() string { return proto.CompactTextString(m) }
func (*AclData) ProtoMessage() {}
func (*AclData) Descriptor() ([]byte, []int) {
return fileDescriptor_c8e9f754f34e929b, []int{16}
return fileDescriptor_c8e9f754f34e929b, []int{17}
}
func (m *AclData) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@ -1343,6 +1446,7 @@ func init() {
proto.RegisterType((*AclRoot)(nil), "aclrecord.AclRoot")
proto.RegisterType((*AclAccountInvite)(nil), "aclrecord.AclAccountInvite")
proto.RegisterType((*AclAccountRequestJoin)(nil), "aclrecord.AclAccountRequestJoin")
proto.RegisterType((*AclInviteJoin)(nil), "aclrecord.AclInviteJoin")
proto.RegisterType((*AclAccountRequestAccept)(nil), "aclrecord.AclAccountRequestAccept")
proto.RegisterType((*AclAccountRequestDecline)(nil), "aclrecord.AclAccountRequestDecline")
proto.RegisterType((*AclAccountInviteRevoke)(nil), "aclrecord.AclAccountInviteRevoke")
@ -1364,73 +1468,76 @@ func init() {
}
var fileDescriptor_c8e9f754f34e929b = []byte{
// 1054 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x57, 0x41, 0x6f, 0x1b, 0x45,
0x14, 0xde, 0xb5, 0x93, 0x38, 0x7e, 0x4e, 0xd2, 0xcd, 0x14, 0xda, 0x6d, 0x0a, 0x56, 0x58, 0xd4,
0xca, 0x8a, 0x50, 0x53, 0x19, 0xa5, 0x42, 0x15, 0x28, 0xdd, 0x3a, 0x55, 0x9d, 0x56, 0x85, 0x6a,
0x5a, 0x5a, 0x84, 0x04, 0xd2, 0x64, 0x76, 0x54, 0x16, 0xd6, 0xb3, 0x66, 0x76, 0x6c, 0xe4, 0x7f,
0xc1, 0x8d, 0x3f, 0xc2, 0x95, 0x3b, 0x07, 0x0e, 0x3d, 0x72, 0x44, 0xc9, 0x8d, 0x1b, 0xff, 0x00,
0xcd, 0xec, 0xda, 0xbb, 0xb3, 0x5e, 0x3b, 0xc9, 0xa1, 0x87, 0x24, 0x3b, 0x6f, 0xde, 0x7b, 0xf3,
0xde, 0xf7, 0xbe, 0xf7, 0x66, 0x02, 0x9f, 0xd3, 0x78, 0x30, 0x88, 0x79, 0x32, 0x24, 0x94, 0xed,
0xc7, 0x27, 0x3f, 0x32, 0x2a, 0xf7, 0x09, 0x8d, 0xd4, 0x8f, 0x60, 0x34, 0x16, 0xc1, 0x50, 0xc4,
0x32, 0xde, 0xd7, 0xbf, 0x93, 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ytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x57, 0x4f, 0x8f, 0xdb, 0x44,
0x14, 0xb7, 0x93, 0xcd, 0x66, 0xf3, 0xb2, 0x9b, 0x7a, 0xa7, 0xd0, 0xba, 0x5b, 0x88, 0x82, 0x51,
0xab, 0x68, 0x85, 0xba, 0x28, 0x68, 0xab, 0xaa, 0x02, 0xb6, 0x6e, 0xb6, 0x6a, 0xd2, 0xaa, 0x50,
0x4d, 0x4b, 0x8b, 0x90, 0x40, 0xf2, 0xda, 0xa3, 0xe2, 0xe2, 0x8c, 0xc3, 0x78, 0x12, 0x94, 0x6f,
0xc1, 0x8d, 0xef, 0xc0, 0x99, 0x2b, 0x77, 0x0e, 0x1c, 0x7a, 0xe4, 0x08, 0xbb, 0x9f, 0x80, 0x6f,
0x80, 0x66, 0xec, 0xd8, 0x63, 0xc7, 0xc9, 0x66, 0x0f, 0x1c, 0x7a, 0x68, 0xd7, 0xf3, 0xfe, 0xbf,
0xf7, 0x7b, 0x6f, 0xde, 0x04, 0x3e, 0x75, 0xc3, 0xd1, 0x28, 0xa4, 0xd1, 0xd8, 0x71, 0xc9, 0x41,
0x78, 0xf2, 0x9a, 0xb8, 0xfc, 0xc0, 0x71, 0x03, 0xf1, 0x8f, 0x11, 0x37, 0x64, 0xde, 0x98, 0x85,
0x3c, 0x3c, 0x90, 0xff, 0x47, 0x19, 0xf5, 0x96, 0x24, 0xa0, 0x46, 0x4a, 0xb0, 0xfe, 0xad, 0x40,
0xdd, 0x76, 0x03, 0x1c, 0x86, 0x1c, 0xed, 0xc1, 0x96, 0xef, 0x11, 0xca, 0x7d, 0x3e, 0x33, 0xf5,
0x8e, 0xde, 0xdd, 0xc6, 0xe9, 0x19, 0xbd, 0x07, 0x8d, 0x91, 0x13, 0x71, 0xc2, 0x1e, 0x93, 0x99,
0x59, 0x91, 0xcc, 0x8c, 0x80, 0x4c, 0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 -1537,6 +1644,11 @@ func (m *AclAccountInvite) MarshalToSizedBuffer(dAtA []byte) (int, error) {
_ = i
var l int
_ = l
if m.InviteType != 0 {
i = encodeVarintAclrecord(dAtA, i, uint64(m.InviteType))
i--
dAtA[i] = 0x10
}
if len(m.InviteKey) > 0 {
i -= len(m.InviteKey)
copy(dAtA[i:], m.InviteKey)
@ -1598,6 +1710,64 @@ func (m *AclAccountRequestJoin) MarshalToSizedBuffer(dAtA []byte) (int, error) {
return len(dAtA) - i, nil
}
func (m *AclInviteJoin) 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 *AclInviteJoin) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *AclInviteJoin) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
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] = 0x2a
}
if len(m.Metadata) > 0 {
i -= len(m.Metadata)
copy(dAtA[i:], m.Metadata)
i = encodeVarintAclrecord(dAtA, i, uint64(len(m.Metadata)))
i--
dAtA[i] = 0x22
}
if len(m.InviteIdentitySignature) > 0 {
i -= len(m.InviteIdentitySignature)
copy(dAtA[i:], m.InviteIdentitySignature)
i = encodeVarintAclrecord(dAtA, i, uint64(len(m.InviteIdentitySignature)))
i--
dAtA[i] = 0x1a
}
if len(m.InviteRecordId) > 0 {
i -= len(m.InviteRecordId)
copy(dAtA[i:], m.InviteRecordId)
i = encodeVarintAclrecord(dAtA, i, uint64(len(m.InviteRecordId)))
i--
dAtA[i] = 0x12
}
if len(m.InviteIdentity) > 0 {
i -= len(m.InviteIdentity)
copy(dAtA[i:], m.InviteIdentity)
i = encodeVarintAclrecord(dAtA, i, uint64(len(m.InviteIdentity)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *AclAccountRequestAccept) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
@ -1952,6 +2122,20 @@ func (m *AclReadKeyChange) MarshalToSizedBuffer(dAtA []byte) (int, error) {
_ = i
var l int
_ = l
if len(m.InviteKeys) > 0 {
for iNdEx := len(m.InviteKeys) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.InviteKeys[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintAclrecord(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x2a
}
}
if len(m.EncryptedOldReadKey) > 0 {
i -= len(m.EncryptedOldReadKey)
copy(dAtA[i:], m.EncryptedOldReadKey)
@ -2443,6 +2627,9 @@ func (m *AclAccountInvite) Size() (n int) {
if l > 0 {
n += 1 + l + sovAclrecord(uint64(l))
}
if m.InviteType != 0 {
n += 1 + sovAclrecord(uint64(m.InviteType))
}
return n
}
@ -2471,6 +2658,35 @@ func (m *AclAccountRequestJoin) Size() (n int) {
return n
}
func (m *AclInviteJoin) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.InviteIdentity)
if l > 0 {
n += 1 + l + sovAclrecord(uint64(l))
}
l = len(m.InviteRecordId)
if l > 0 {
n += 1 + l + sovAclrecord(uint64(l))
}
l = len(m.InviteIdentitySignature)
if l > 0 {
n += 1 + l + sovAclrecord(uint64(l))
}
l = len(m.Metadata)
if l > 0 {
n += 1 + l + sovAclrecord(uint64(l))
}
l = len(m.EncryptedReadKey)
if l > 0 {
n += 1 + l + sovAclrecord(uint64(l))
}
return n
}
func (m *AclAccountRequestAccept) Size() (n int) {
if m == nil {
return 0
@ -2645,6 +2861,12 @@ func (m *AclReadKeyChange) Size() (n int) {
if l > 0 {
n += 1 + l + sovAclrecord(uint64(l))
}
if len(m.InviteKeys) > 0 {
for _, e := range m.InviteKeys {
l = e.Size()
n += 1 + l + sovAclrecord(uint64(l))
}
}
return n
}
@ -3255,6 +3477,25 @@ func (m *AclAccountInvite) Unmarshal(dAtA []byte) error {
m.InviteKey = []byte{}
}
iNdEx = postIndex
case 2:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field InviteType", wireType)
}
m.InviteType = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowAclrecord
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.InviteType |= AclInviteType(b&0x7F) << shift
if b < 0x80 {
break
}
}
default:
iNdEx = preIndex
skippy, err := skipAclrecord(dAtA[iNdEx:])
@ -3460,6 +3701,224 @@ func (m *AclAccountRequestJoin) Unmarshal(dAtA []byte) error {
}
return nil
}
func (m *AclInviteJoin) 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 ErrIntOverflowAclrecord
}
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: AclInviteJoin: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: AclInviteJoin: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field InviteIdentity", wireType)
}
var byteLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowAclrecord
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
byteLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if byteLen < 0 {
return ErrInvalidLengthAclrecord
}
postIndex := iNdEx + byteLen
if postIndex < 0 {
return ErrInvalidLengthAclrecord
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.InviteIdentity = append(m.InviteIdentity[:0], dAtA[iNdEx:postIndex]...)
if m.InviteIdentity == nil {
m.InviteIdentity = []byte{}
}
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field InviteRecordId", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowAclrecord
}
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 ErrInvalidLengthAclrecord
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthAclrecord
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.InviteRecordId = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field InviteIdentitySignature", wireType)
}
var byteLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowAclrecord
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
byteLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if byteLen < 0 {
return ErrInvalidLengthAclrecord
}
postIndex := iNdEx + byteLen
if postIndex < 0 {
return ErrInvalidLengthAclrecord
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.InviteIdentitySignature = append(m.InviteIdentitySignature[:0], dAtA[iNdEx:postIndex]...)
if m.InviteIdentitySignature == nil {
m.InviteIdentitySignature = []byte{}
}
iNdEx = postIndex
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Metadata", wireType)
}
var byteLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowAclrecord
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
byteLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if byteLen < 0 {
return ErrInvalidLengthAclrecord
}
postIndex := iNdEx + byteLen
if postIndex < 0 {
return ErrInvalidLengthAclrecord
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Metadata = append(m.Metadata[:0], dAtA[iNdEx:postIndex]...)
if m.Metadata == nil {
m.Metadata = []byte{}
}
iNdEx = postIndex
case 5:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field EncryptedReadKey", wireType)
}
var byteLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowAclrecord
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
byteLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
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
skippy, err := skipAclrecord(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthAclrecord
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *AclAccountRequestAccept) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
@ -4600,6 +5059,40 @@ func (m *AclReadKeyChange) Unmarshal(dAtA []byte) error {
m.EncryptedOldReadKey = []byte{}
}
iNdEx = postIndex
case 5:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field InviteKeys", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowAclrecord
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthAclrecord
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthAclrecord
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.InviteKeys = append(m.InviteKeys, &AclEncryptedReadKey{})
if err := m.InviteKeys[len(m.InviteKeys)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipAclrecord(dAtA[iNdEx:])

View file

@ -18,6 +18,7 @@ message AclRoot {
// AclAccountInvite contains the public invite key, the private part of which is sent to the user directly
message AclAccountInvite {
bytes inviteKey = 1;
AclInviteType inviteType = 2;
}
enum AclInviteType {
@ -34,6 +35,17 @@ message AclAccountRequestJoin {
bytes metadata = 4;
}
// AclInviteJoin contains the reference to the invite record and the data of the person who wants to join, confirmed by the private invite key
// The person must encrypt the key with its own public key
message AclInviteJoin {
bytes inviteIdentity = 1;
string inviteRecordId = 2;
bytes inviteIdentitySignature = 3;
// Metadata is encrypted with metadata key of the space
bytes metadata = 4;
bytes encryptedReadKey = 5;
}
// AclAccountRequestAccept contains the reference to join record and all read keys, encrypted with the identity of the requestor
message AclAccountRequestAccept {
bytes identity = 1;
@ -95,6 +107,7 @@ message AclReadKeyChange {
bytes encryptedMetadataPrivKey = 3;
// EncryptedOldReadKey is encrypted with new read key
bytes encryptedOldReadKey = 4;
repeated AclEncryptedReadKey inviteKeys = 5;
}
// AclAccountRemove removes an account and changes read key for space

View file

@ -5,6 +5,7 @@ import (
"github.com/anyproto/protobuf/proto"
"go.uber.org/zap"
"golang.org/x/exp/slices"
"github.com/anyproto/any-sync/app/logger"
"github.com/anyproto/any-sync/commonspace/object/acl/aclrecordproto"
@ -214,9 +215,12 @@ func (st *AclState) HadReadPermissions(identity crypto.PubKey) (had bool) {
return false
}
func (st *AclState) Invites() []Invite {
func (st *AclState) Invites(inviteType ...aclrecordproto.AclInviteType) []Invite {
var invites []Invite
for _, inv := range st.invites {
if len(inviteType) > 0 && !slices.Contains(inviteType, inv.Type) {
continue
}
invites = append(invites, inv)
}
return invites
@ -234,6 +238,79 @@ func (st *AclState) InviteIds() []string {
return invites
}
func (st *AclState) RequestIds() []string {
var requests []string
for reqId := range st.requestRecords {
requests = append(requests, reqId)
}
return requests
}
func (st *AclState) DecryptInvite(invitePk crypto.PrivKey) (keys AclKeys, err error) {
if invitePk == nil {
return AclKeys{}, ErrNoReadKey
}
var recId string
for id, invite := range st.invites {
if invite.Key.Equals(invitePk.GetPublic()) {
recId = id
}
}
if recId == "" {
return AclKeys{}, ErrNoSuchInvite
}
currentKey := st.CurrentReadKeyId()
currentRec, err := st.list.Get(currentKey)
if err != nil {
return AclKeys{}, err
}
model, ok := currentRec.Model.(*aclrecordproto.AclData)
if !ok {
return AclKeys{}, ErrNoReadKey
}
var value *aclrecordproto.AclReadKeyChange
for _, ch := range model.GetAclContent() {
if ch.GetAccountRemove() != nil {
value = ch.GetReadKeyChange()
break
} else if ch.GetReadKeyChange() != nil {
value = ch.GetReadKeyChange()
break
}
}
if value == nil {
return AclKeys{}, ErrNoReadKey
}
mkPubKey, err := st.keyStore.PubKeyFromProto(value.MetadataPubKey)
if err != nil {
return AclKeys{}, err
}
keys = AclKeys{
MetadataPubKey: mkPubKey,
}
for _, key := range value.InviteKeys {
invKey, err := st.keyStore.PubKeyFromProto(key.Identity)
if err != nil {
return AclKeys{}, err
}
if invitePk.Equals(invKey) {
keys.ReadKey, err = st.unmarshallDecryptReadKey(key.EncryptedReadKey, invitePk.Decrypt)
if err != nil {
return AclKeys{}, err
}
break
}
}
if keys.ReadKey == nil {
return AclKeys{}, ErrNoReadKey
}
keys.MetadataPrivKey, err = st.unmarshallDecryptPrivKey(value.EncryptedMetadataPrivKey, keys.ReadKey.Decrypt)
if err != nil {
return AclKeys{}, err
}
return keys, nil
}
func (st *AclState) ApplyRecord(record *AclRecord) (err error) {
if st.lastRecordId != record.PrevId {
err = ErrIncorrectRecordSequence
@ -459,7 +536,7 @@ func (st *AclState) applyInvite(ch *aclrecordproto.AclAccountInvite, record *Acl
}
st.invites[record.Id] = Invite{
Key: inviteKey,
Type: aclrecordproto.AclInviteType_RequestToJoin, // Default value
Type: ch.InviteType,
}
return nil
}