Add old account to coordinator proto

This commit is contained in:
mcrakhman authored and Mikhail Iudin committed 2023-04-02 18:53:02 +02:00
1 parent f21a259ddc
commit 7013c79d09
5 files changed
+195 -79

No files matched your search

@@ -9,6 +9,7 @@ import (
"github.com/anytypeio/any-sync/net/pool"
"github.com/anytypeio/any-sync/net/rpc/rpcerr"
"github.com/anytypeio/any-sync/nodeconf"
"github.com/anytypeio/any-sync/util/crypto"
)
const CName = "common.coordinator.coordinatorclient"
@@ -20,11 +21,18 @@ func New() CoordinatorClient {
type CoordinatorClient interface {
ChangeStatus(ctx context.Context, spaceId string, deleteRaw *treechangeproto.RawTreeChangeWithId) (status *coordinatorproto.SpaceStatusPayload, err error)
StatusCheck(ctx context.Context, spaceId string) (status *coordinatorproto.SpaceStatusPayload, err error)
SpaceSign(ctx context.Context, spaceId string, spaceHeader []byte) (receipt *coordinatorproto.SpaceReceiptWithSignature, err error)
SpaceSign(ctx context.Context, payload SpaceSignPayload) (receipt *coordinatorproto.SpaceReceiptWithSignature, err error)
FileLimitCheck(ctx context.Context, spaceId string, identity []byte) (limit uint64, err error)
app.Component
}
type SpaceSignPayload struct {
SpaceId string
SpaceHeader []byte
OldAccount crypto.PrivKey
Identity crypto.PrivKey
}
type coordinatorClient struct {
pool pool.Pool
nodeConf nodeconf.Service
@@ -74,14 +82,28 @@ func (c *coordinatorClient) Name() (name string) {
return CName
}
func (c *coordinatorClient) SpaceSign(ctx context.Context, spaceId string, spaceHeader []byte) (receipt *coordinatorproto.SpaceReceiptWithSignature, err error) {
func (c *coordinatorClient) SpaceSign(ctx context.Context, payload SpaceSignPayload) (receipt *coordinatorproto.SpaceReceiptWithSignature, err error) {
cl, err := c.client(ctx)
if err != nil {
return
}
newRaw, err := payload.Identity.GetPublic().Raw()
if err != nil {
return
}
newSignature, err := payload.OldAccount.Sign(newRaw)
if err != nil {
return
}
oldIdentity, err := payload.OldAccount.GetPublic().Marshall()
if err != nil {
return
}
resp, err := cl.SpaceSign(ctx, &coordinatorproto.SpaceSignRequest{
SpaceId: spaceId,
Header: spaceHeader,
SpaceId: payload.SpaceId,
Header: payload.SpaceHeader,
OldIdentity: oldIdentity,
NewIdentitySignature: newSignature,
})
if err != nil {
err = rpcerr.Unwrap(err)
+158 -46
View File
@@ -91,8 +91,14 @@ func (SpaceStatus) EnumDescriptor() ([]byte, []int) {
}
type SpaceSignRequest struct {
// SpaceId is the id of the signed space
SpaceId string `protobuf:"bytes,1,opt,name=spaceId,proto3" json:"spaceId,omitempty"`
Header []byte `protobuf:"bytes,2,opt,name=header,proto3" json:"header,omitempty"`
// Header is the header of the signed space
Header []byte `protobuf:"bytes,2,opt,name=header,proto3" json:"header,omitempty"`
// OldIdentity is the old identity of the space owner
OldIdentity []byte `protobuf:"bytes,3,opt,name=oldIdentity,proto3" json:"oldIdentity,omitempty"`
// NewIdentitySignature is the new identity signed by the old one
NewIdentitySignature []byte `protobuf:"bytes,4,opt,name=newIdentitySignature,proto3" json:"newIdentitySignature,omitempty"`
}
func (m *SpaceSignRequest) Reset() { *m = SpaceSignRequest{} }
@@ -142,6 +148,20 @@ func (m *SpaceSignRequest) GetHeader() []byte {
return nil
}
func (m *SpaceSignRequest) GetOldIdentity() []byte {
if m != nil {
return m.OldIdentity
}
return nil
}
func (m *SpaceSignRequest) GetNewIdentitySignature() []byte {
if m != nil {
return m.NewIdentitySignature
}
return nil
}
type SpaceStatusPayload struct {
Status SpaceStatus `protobuf:"varint,1,opt,name=status,proto3,enum=coordinator.SpaceStatus" json:"status,omitempty"`
DeletionTimestamp int64 `protobuf:"varint,2,opt,name=deletionTimestamp,proto3" json:"deletionTimestamp,omitempty"`
@@ -689,51 +709,53 @@ func init() {
}
var fileDescriptor_d94f6f99586adae2 = []byte{
// 704 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x55, 0x4d, 0x4f, 0x13, 0x4f,
0x18, 0xef, 0xb6, 0x05, 0xd2, 0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28,
0xaf, 0x2c, 0xa8, 0xd2, 0xfe, 0x53, 0x86, 0x7a, 0x67, 0xd0, 0x2d, 0xf2, 0x1c, 0x6a, 0xfd, 0xe7,
0x89, 0xdc, 0x2a, 0x68, 0xe4, 0xe0, 0xc9, 0x6d, 0x9a, 0xe3, 0xcc, 0xd9, 0x60, 0xde, 0x42, 0x23,
0x7f, 0x15, 0x88, 0x95, 0x8b, 0x28, 0xbc, 0x84, 0xcd, 0x3b, 0x13, 0x7d, 0xb2, 0xd4, 0x1f, 0xe4,
0x17, 0x60, 0x70, 0x01, 0xc8, 0xdd, 0x71, 0x63, 0xcf, 0xa5, 0xbf, 0x77, 0x8d, 0x57, 0x46, 0x70,
0x20, 0x9f, 0x69, 0x65, 0xe3, 0xc8, 0x84, 0x58, 0xe5, 0xa6, 0x34, 0x57, 0xae, 0x73, 0x4b, 0x39,
0x9e, 0x3e, 0xfa, 0x79, 0x69, 0x6a, 0x17, 0x97, 0xa6, 0xf6, 0xfb, 0xd2, 0xd4, 0xbe, 0x5e, 0x99,
0xa5, 0x8b, 0x2b, 0xb3, 0xf4, 0xeb, 0xca, 0x2c, 0xbd, 0x5b, 0x9a, 0xf4, 0x91, 0x3c, 0x98, 0x4e,
0xfe, 0x6d, 0xfe, 0x0d, 0x00, 0x00, 0xff, 0xff, 0xe4, 0x76, 0x96, 0x0f, 0x4b, 0x07, 0x00, 0x00,
// 728 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x55, 0xcf, 0x4e, 0x13, 0x41,
0x18, 0xef, 0xb6, 0x05, 0xd2, 0xaf, 0xa4, 0x2e, 0x23, 0xe0, 0xda, 0xe0, 0xda, 0xac, 0x4a, 0x1a,
0x62, 0x80, 0x14, 0x35, 0xf1, 0x66, 0xac, 0x98, 0x60, 0x0c, 0x92, 0xc5, 0x6a, 0xd4, 0x83, 0x59,
0x76, 0x3f, 0x60, 0xc2, 0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0xdf, 0x22, 0x54,
0xdb, 0x83, 0x69, 0x91, 0x67, 0x50, 0xe9, 0x3f, 0x4f, 0xe4, 0x46, 0xce, 0x20, 0x07, 0x0f, 0x79,
0xdd, 0x1c, 0x67, 0x4e, 0x84, 0x79, 0x03, 0xb5, 0xec, 0x55, 0x20, 0x56, 0xc6, 0x23, 0xf7, 0x12,
0xd6, 0x6f, 0x4d, 0xe4, 0x24, 0xa1, 0xdf, 0xa7, 0xdf, 0x95, 0xc1, 0x05, 0x20, 0xb7, 0xc7, 0xc9,
0x9e, 0x09, 0x7f, 0xe7, 0x12, 0x56, 0x92, 0x60, 0x2f, 0x7d, 0xa6, 0x95, 0x8d, 0x23, 0x13, 0x7c,
0x95, 0x9b, 0x52, 0x5f, 0xbe, 0x8c, 0x16, 0xe7, 0x78, 0xfc, 0xe0, 0xd7, 0xb9, 0xa9, 0x9d, 0x9d,
0x9b, 0xda, 0x9f, 0x73, 0x53, 0xfb, 0x7a, 0x61, 0x16, 0xce, 0x2e, 0xcc, 0xc2, 0xef, 0x0b, 0xb3,
0xf0, 0x76, 0x69, 0xd2, 0xb7, 0x77, 0x6f, 0x5a, 0xfe, 0xdb, 0xf8, 0x17, 0x00, 0x00, 0xff, 0xff,
0x86, 0x2f, 0x30, 0xee, 0xa2, 0x07, 0x00, 0x00,
}
func (m *SpaceSignRequest) Marshal() (dAtA []byte, err error) {
@@ -756,6 +778,20 @@ func (m *SpaceSignRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
_ = i
var l int
_ = l
if len(m.NewIdentitySignature) > 0 {
i -= len(m.NewIdentitySignature)
copy(dAtA[i:], m.NewIdentitySignature)
i = encodeVarintCoordinator(dAtA, i, uint64(len(m.NewIdentitySignature)))
i--
dAtA[i] = 0x22
}
if len(m.OldIdentity) > 0 {
i -= len(m.OldIdentity)
copy(dAtA[i:], m.OldIdentity)
i = encodeVarintCoordinator(dAtA, i, uint64(len(m.OldIdentity)))
i--
dAtA[i] = 0x1a
}
if len(m.Header) > 0 {
i -= len(m.Header)
copy(dAtA[i:], m.Header)
@@ -1168,6 +1204,14 @@ func (m *SpaceSignRequest) Size() (n int) {
if l > 0 {
n += 1 + l + sovCoordinator(uint64(l))
}
l = len(m.OldIdentity)
if l > 0 {
n += 1 + l + sovCoordinator(uint64(l))
}
l = len(m.NewIdentitySignature)
if l > 0 {
n += 1 + l + sovCoordinator(uint64(l))
}
return n
}
@@ -1434,6 +1478,74 @@ func (m *SpaceSignRequest) Unmarshal(dAtA []byte) error {
m.Header = []byte{}
}
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field OldIdentity", wireType)
}
var byteLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCoordinator
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
byteLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if byteLen < 0 {
return ErrInvalidLengthCoordinator
}
postIndex := iNdEx + byteLen
if postIndex < 0 {
return ErrInvalidLengthCoordinator
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.OldIdentity = append(m.OldIdentity[:0], dAtA[iNdEx:postIndex]...)
if m.OldIdentity == nil {
m.OldIdentity = []byte{}
}
iNdEx = postIndex
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field NewIdentitySignature", wireType)
}
var byteLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCoordinator
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
byteLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if byteLen < 0 {
return ErrInvalidLengthCoordinator
}
postIndex := iNdEx + byteLen
if postIndex < 0 {
return ErrInvalidLengthCoordinator
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.NewIdentitySignature = append(m.NewIdentitySignature[:0], dAtA[iNdEx:postIndex]...)
if m.NewIdentitySignature == nil {
m.NewIdentitySignature = []byte{}
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipCoordinator(dAtA[iNdEx:])
@@ -21,8 +21,14 @@ service Coordinator {
}
message SpaceSignRequest {
// SpaceId is the id of the signed space
string spaceId = 1;
// Header is the header of the signed space
bytes header = 2;
// OldIdentity is the old identity of the space owner
bytes oldIdentity = 3;
// NewIdentitySignature is the new identity signed by the old one
bytes newIdentitySignature = 4;
}
enum ErrorCodes {