diff --git a/docs/proto.md b/docs/proto.md index a733e4a69..2f66f221f 100644 --- a/docs/proto.md +++ b/docs/proto.md @@ -28965,7 +28965,7 @@ Precondition: user A opened a block | ----- | ---- | ----- | ----------- | | spaceKeyId | [string](#string) | | | | encryptionKeyId | [string](#string) | | | -| encryptionKey | [bytes](#bytes) | | | +| encryptionKey | [string](#string) | | | diff --git a/pb/events.pb.go b/pb/events.pb.go index f12fdbdea..f2354a1fe 100644 --- a/pb/events.pb.go +++ b/pb/events.pb.go @@ -11995,7 +11995,7 @@ var xxx_messageInfo_EventKey proto.InternalMessageInfo type EventKeyUpdate struct { SpaceKeyId string `protobuf:"bytes,1,opt,name=spaceKeyId,proto3" json:"spaceKeyId,omitempty"` EncryptionKeyId string `protobuf:"bytes,2,opt,name=encryptionKeyId,proto3" json:"encryptionKeyId,omitempty"` - EncryptionKey []byte `protobuf:"bytes,3,opt,name=encryptionKey,proto3" json:"encryptionKey,omitempty"` + EncryptionKey string `protobuf:"bytes,3,opt,name=encryptionKey,proto3" json:"encryptionKey,omitempty"` } func (m *EventKeyUpdate) Reset() { *m = EventKeyUpdate{} } @@ -12045,11 +12045,11 @@ func (m *EventKeyUpdate) GetEncryptionKeyId() string { return "" } -func (m *EventKeyUpdate) GetEncryptionKey() []byte { +func (m *EventKeyUpdate) GetEncryptionKey() string { if m != nil { return m.EncryptionKey } - return nil + return "" } type ResponseEvent struct { @@ -12781,7 +12781,7 @@ func init() { func init() { proto.RegisterFile("pb/protos/events.proto", fileDescriptor_a966342d378ae5f5) } var fileDescriptor_a966342d378ae5f5 = []byte{ - // 6494 bytes of a gzipped FileDescriptorProto + // 6492 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x5d, 0x5b, 0x8c, 0x1d, 0xc9, 0x59, 0x3e, 0xf7, 0xcb, 0x3f, 0xe3, 0xf1, 0x71, 0xad, 0xd7, 0xee, 0xed, 0x9d, 0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, 0x9b, 0x0b, 0xff, 0x15, + 0x00, 0x00, 0xff, 0xff, 0x6e, 0x52, 0xf9, 0x70, 0x8d, 0x68, 0x00, 0x00, } func (m *Event) Marshal() (dAtA []byte, err error) { @@ -53418,7 +53418,7 @@ func (m *EventKeyUpdate) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field EncryptionKey", wireType) } - var byteLen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowEvents @@ -53428,25 +53428,23 @@ func (m *EventKeyUpdate) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthEvents } - postIndex := iNdEx + byteLen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthEvents } if postIndex > l { return io.ErrUnexpectedEOF } - m.EncryptionKey = append(m.EncryptionKey[:0], dAtA[iNdEx:postIndex]...) - if m.EncryptionKey == nil { - m.EncryptionKey = []byte{} - } + m.EncryptionKey = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex diff --git a/pb/protos/events.proto b/pb/protos/events.proto index 9aa08c483..8a92140bd 100644 --- a/pb/protos/events.proto +++ b/pb/protos/events.proto @@ -1195,7 +1195,7 @@ message Event { message Update { string spaceKeyId = 1; string encryptionKeyId = 2; - bytes encryptionKey = 3; + string encryptionKey = 3; } } } diff --git a/space/internal/components/aclobjectmanager/aclobjectmanager.go b/space/internal/components/aclobjectmanager/aclobjectmanager.go index 0e2600b68..42bf97cd6 100644 --- a/space/internal/components/aclobjectmanager/aclobjectmanager.go +++ b/space/internal/components/aclobjectmanager/aclobjectmanager.go @@ -2,6 +2,7 @@ package aclobjectmanager import ( "context" + "encoding/base64" "fmt" "slices" "sync" @@ -294,6 +295,7 @@ func (a *aclObjectManager) broadcastKeyUpdate(aclState *list.AclState, common co if err != nil { return err } + encodedKey := base64.StdEncoding.EncodeToString(raw) a.eventSender.Broadcast(&pb.Event{ Messages: []*pb.EventMessage{ { @@ -301,7 +303,7 @@ func (a *aclObjectManager) broadcastKeyUpdate(aclState *list.AclState, common co Value: &pb.EventMessageValueOfKeyUpdate{KeyUpdate: &pb.EventKeyUpdate{ SpaceKeyId: spaceKey, EncryptionKeyId: aclState.CurrentReadKeyId(), - EncryptionKey: raw, + EncryptionKey: encodedKey, }}, }, },