change nodeconf.Configuration to nodeconf.NodeConf
This commit is contained in:
commit
86ac8e0d75
@ -3,18 +3,11 @@ package credentialprovider
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"github.com/anytypeio/any-sync/app"
|
|
||||||
"github.com/anytypeio/any-sync/commonspace/spacesyncproto"
|
"github.com/anytypeio/any-sync/commonspace/spacesyncproto"
|
||||||
"github.com/anytypeio/any-sync/coordinator/coordinatorclient"
|
|
||||||
"github.com/gogo/protobuf/proto"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const CName = "common.commonspace.credentialprovider"
|
const CName = "common.commonspace.credentialprovider"
|
||||||
|
|
||||||
func New() app.Component {
|
|
||||||
return &credentialProvider{}
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewNoOp() CredentialProvider {
|
func NewNoOp() CredentialProvider {
|
||||||
return &noOpProvider{}
|
return &noOpProvider{}
|
||||||
}
|
}
|
||||||
@ -29,24 +22,3 @@ type noOpProvider struct {
|
|||||||
func (n noOpProvider) GetCredential(ctx context.Context, spaceHeader *spacesyncproto.RawSpaceHeaderWithId) ([]byte, error) {
|
func (n noOpProvider) GetCredential(ctx context.Context, spaceHeader *spacesyncproto.RawSpaceHeaderWithId) ([]byte, error) {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
type credentialProvider struct {
|
|
||||||
client coordinatorclient.CoordinatorClient
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *credentialProvider) Init(a *app.App) (err error) {
|
|
||||||
c.client = a.MustComponent(coordinatorclient.CName).(coordinatorclient.CoordinatorClient)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *credentialProvider) Name() (name string) {
|
|
||||||
return CName
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *credentialProvider) GetCredential(ctx context.Context, spaceHeader *spacesyncproto.RawSpaceHeaderWithId) ([]byte, error) {
|
|
||||||
receipt, err := c.client.SpaceSign(ctx, spaceHeader.Id, spaceHeader.RawHeader)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return proto.Marshal(receipt)
|
|
||||||
}
|
|
||||||
|
|||||||
@ -46,7 +46,7 @@ type headSync struct {
|
|||||||
diff ldiff.Diff
|
diff ldiff.Diff
|
||||||
log logger.CtxLogger
|
log logger.CtxLogger
|
||||||
syncer DiffSyncer
|
syncer DiffSyncer
|
||||||
configuration nodeconf.Configuration
|
configuration nodeconf.NodeConf
|
||||||
spaceIsDeleted *atomic.Bool
|
spaceIsDeleted *atomic.Bool
|
||||||
|
|
||||||
syncPeriod int
|
syncPeriod int
|
||||||
@ -56,7 +56,7 @@ func NewHeadSync(
|
|||||||
spaceId string,
|
spaceId string,
|
||||||
spaceIsDeleted *atomic.Bool,
|
spaceIsDeleted *atomic.Bool,
|
||||||
syncPeriod int,
|
syncPeriod int,
|
||||||
configuration nodeconf.Configuration,
|
configuration nodeconf.NodeConf,
|
||||||
storage spacestorage.SpaceStorage,
|
storage spacestorage.SpaceStorage,
|
||||||
peerManager peermanager.PeerManager,
|
peerManager peermanager.PeerManager,
|
||||||
cache treegetter.TreeGetter,
|
cache treegetter.TreeGetter,
|
||||||
|
|||||||
@ -11,7 +11,7 @@ type AccountKeys struct {
|
|||||||
PeerId string
|
PeerId string
|
||||||
}
|
}
|
||||||
|
|
||||||
func New(peerKey crypto.PrivKey, signKey crypto.PrivKey) *AccountKeys {
|
func New(peerKey, signKey crypto.PrivKey) *AccountKeys {
|
||||||
return &AccountKeys{
|
return &AccountKeys{
|
||||||
PeerKey: peerKey,
|
PeerKey: peerKey,
|
||||||
SignKey: signKey,
|
SignKey: signKey,
|
||||||
|
|||||||
@ -247,11 +247,12 @@ func (m *AclRecord) GetTimestamp() int64 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type AclRoot struct {
|
type AclRoot struct {
|
||||||
Identity []byte `protobuf:"bytes,1,opt,name=identity,proto3" json:"identity,omitempty"`
|
Identity []byte `protobuf:"bytes,1,opt,name=identity,proto3" json:"identity,omitempty"`
|
||||||
SpaceId string `protobuf:"bytes,2,opt,name=spaceId,proto3" json:"spaceId,omitempty"`
|
MasterKey []byte `protobuf:"bytes,2,opt,name=masterKey,proto3" json:"masterKey,omitempty"`
|
||||||
EncryptedReadKey []byte `protobuf:"bytes,3,opt,name=encryptedReadKey,proto3" json:"encryptedReadKey,omitempty"`
|
SpaceId string `protobuf:"bytes,3,opt,name=spaceId,proto3" json:"spaceId,omitempty"`
|
||||||
DerivationParams []byte `protobuf:"bytes,4,opt,name=derivationParams,proto3" json:"derivationParams,omitempty"`
|
EncryptedReadKey []byte `protobuf:"bytes,4,opt,name=encryptedReadKey,proto3" json:"encryptedReadKey,omitempty"`
|
||||||
Timestamp int64 `protobuf:"varint,5,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
|
Timestamp int64 `protobuf:"varint,5,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
|
||||||
|
IdentitySignature []byte `protobuf:"bytes,6,opt,name=identitySignature,proto3" json:"identitySignature,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *AclRoot) Reset() { *m = AclRoot{} }
|
func (m *AclRoot) Reset() { *m = AclRoot{} }
|
||||||
@ -294,6 +295,13 @@ func (m *AclRoot) GetIdentity() []byte {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *AclRoot) GetMasterKey() []byte {
|
||||||
|
if m != nil {
|
||||||
|
return m.MasterKey
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func (m *AclRoot) GetSpaceId() string {
|
func (m *AclRoot) GetSpaceId() string {
|
||||||
if m != nil {
|
if m != nil {
|
||||||
return m.SpaceId
|
return m.SpaceId
|
||||||
@ -308,13 +316,6 @@ func (m *AclRoot) GetEncryptedReadKey() []byte {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *AclRoot) GetDerivationParams() []byte {
|
|
||||||
if m != nil {
|
|
||||||
return m.DerivationParams
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *AclRoot) GetTimestamp() int64 {
|
func (m *AclRoot) GetTimestamp() int64 {
|
||||||
if m != nil {
|
if m != nil {
|
||||||
return m.Timestamp
|
return m.Timestamp
|
||||||
@ -322,6 +323,13 @@ func (m *AclRoot) GetTimestamp() int64 {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *AclRoot) GetIdentitySignature() []byte {
|
||||||
|
if m != nil {
|
||||||
|
return m.IdentitySignature
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
type AclContentValue struct {
|
type AclContentValue struct {
|
||||||
// Types that are valid to be assigned to Value:
|
// Types that are valid to be assigned to Value:
|
||||||
//
|
//
|
||||||
@ -1136,64 +1144,65 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var fileDescriptor_c8e9f754f34e929b = []byte{
|
var fileDescriptor_c8e9f754f34e929b = []byte{
|
||||||
// 907 bytes of a gzipped FileDescriptorProto
|
// 914 bytes of a gzipped FileDescriptorProto
|
||||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x56, 0x4f, 0x6f, 0x1b, 0x45,
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x56, 0x4f, 0x6f, 0x1b, 0x45,
|
||||||
0x14, 0xf7, 0xd8, 0x49, 0x1c, 0x3f, 0x9b, 0xc4, 0x19, 0xa0, 0x5d, 0x45, 0xc5, 0x8a, 0x56, 0x42,
|
0x14, 0xf7, 0xd8, 0x49, 0x9c, 0x7d, 0x36, 0x89, 0x33, 0x40, 0xbb, 0x8a, 0x82, 0x15, 0xad, 0x84,
|
||||||
0x8a, 0xaa, 0x2a, 0x11, 0x06, 0x29, 0x55,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, 0x91, 0x1d, 0xa9, 0xb3, 0x59, 0x8c, 0xba, 0xfe, 0xdd,
|
||||||
0xa2, 0xe0, 0x0e, 0x6c, 0x8e, 0x82, 0xa9, 0x88, 0xfa, 0x0d, 0x0c, 0xb0, 0xf5, 0x42, 0x0a, 0xcd,
|
0x42, 0x52, 0xf4, 0x83, 0x53, 0xc0, 0x75, 0x51, 0xb0, 0x03, 0x9b, 0x63, 0x7f, 0x16, 0x44, 0x83,
|
||||||
0x65, 0x1f, 0x99, 0x67, 0x73, 0x43, 0x5c, 0xf6, 0x9b, 0x8f, 0x1f, 0xfd, 0x76, 0x3d, 0x40, 0x57,
|
0x16, 0x06, 0xd8, 0x7a, 0x29, 0x02, 0xc5, 0xc5, 0x00, 0xe9, 0x67, 0x9d, 0x21, 0x2e, 0x06, 0xed,
|
||||||
0xd7, 0x03, 0xf4, 0xe7, 0xf5, 0x00, 0xfd, 0x70, 0x33, 0x68, 0x5c, 0xdd, 0x0c, 0x1a, 0x7f, 0xdc,
|
0x27, 0x8f, 0x7f, 0xbf, 0x19, 0xa2, 0xb7, 0x37, 0x43, 0xf4, 0xe7, 0xcd, 0x10, 0xfd, 0x74, 0x3b,
|
||||||
0x0c, 0x1a, 0x2f, 0xdf, 0xff, 0x57, 0x5f, 0x7d, 0x17, 0x5b, 0xf6, 0xe7, 0xc3, 0xbf, 0x03, 0x00,
|
0x6c, 0xbd, 0xbd, 0x1d, 0xb6, 0xfe, 0xb8, 0x1d, 0xb6, 0x5e, 0x7d, 0xf8, 0x8f, 0xbe, 0x0a, 0x2f,
|
||||||
0x00, 0xff, 0xff, 0xd0, 0x3a, 0xc4, 0x88, 0x25, 0x0a, 0x00, 0x00,
|
0xb7, 0xcc, 0xcf, 0xc7, 0x7f, 0x07, 0x00, 0x00, 0xff, 0xff, 0x2e, 0x3b, 0x3f, 0x0a, 0x45, 0x0a,
|
||||||
|
0x00, 0x00,
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *RawAclRecord) Marshal() (dAtA []byte, err error) {
|
func (m *RawAclRecord) Marshal() (dAtA []byte, err error) {
|
||||||
@ -1360,30 +1369,37 @@ func (m *AclRoot) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
|||||||
_ = i
|
_ = i
|
||||||
var l int
|
var l int
|
||||||
_ = l
|
_ = l
|
||||||
|
if len(m.IdentitySignature) > 0 {
|
||||||
|
i -= len(m.IdentitySignature)
|
||||||
|
copy(dAtA[i:], m.IdentitySignature)
|
||||||
|
i = encodeVarintAclrecord(dAtA, i, uint64(len(m.IdentitySignature)))
|
||||||
|
i--
|
||||||
|
dAtA[i] = 0x32
|
||||||
|
}
|
||||||
if m.Timestamp != 0 {
|
if m.Timestamp != 0 {
|
||||||
i = encodeVarintAclrecord(dAtA, i, uint64(m.Timestamp))
|
i = encodeVarintAclrecord(dAtA, i, uint64(m.Timestamp))
|
||||||
i--
|
i--
|
||||||
dAtA[i] = 0x28
|
dAtA[i] = 0x28
|
||||||
}
|
}
|
||||||
if len(m.DerivationParams) > 0 {
|
|
||||||
i -= len(m.DerivationParams)
|
|
||||||
copy(dAtA[i:], m.DerivationParams)
|
|
||||||
i = encodeVarintAclrecord(dAtA, i, uint64(len(m.DerivationParams)))
|
|
||||||
i--
|
|
||||||
dAtA[i] = 0x22
|
|
||||||
}
|
|
||||||
if len(m.EncryptedReadKey) > 0 {
|
if len(m.EncryptedReadKey) > 0 {
|
||||||
i -= len(m.EncryptedReadKey)
|
i -= len(m.EncryptedReadKey)
|
||||||
copy(dAtA[i:], m.EncryptedReadKey)
|
copy(dAtA[i:], m.EncryptedReadKey)
|
||||||
i = encodeVarintAclrecord(dAtA, i, uint64(len(m.EncryptedReadKey)))
|
i = encodeVarintAclrecord(dAtA, i, uint64(len(m.EncryptedReadKey)))
|
||||||
i--
|
i--
|
||||||
dAtA[i] = 0x1a
|
dAtA[i] = 0x22
|
||||||
}
|
}
|
||||||
if len(m.SpaceId) > 0 {
|
if len(m.SpaceId) > 0 {
|
||||||
i -= len(m.SpaceId)
|
i -= len(m.SpaceId)
|
||||||
copy(dAtA[i:], m.SpaceId)
|
copy(dAtA[i:], m.SpaceId)
|
||||||
i = encodeVarintAclrecord(dAtA, i, uint64(len(m.SpaceId)))
|
i = encodeVarintAclrecord(dAtA, i, uint64(len(m.SpaceId)))
|
||||||
i--
|
i--
|
||||||
|
dAtA[i] = 0x1a
|
||||||
|
}
|
||||||
|
if len(m.MasterKey) > 0 {
|
||||||
|
i -= len(m.MasterKey)
|
||||||
|
copy(dAtA[i:], m.MasterKey)
|
||||||
|
i = encodeVarintAclrecord(dAtA, i, uint64(len(m.MasterKey)))
|
||||||
|
i--
|
||||||
dAtA[i] = 0x12
|
dAtA[i] = 0x12
|
||||||
}
|
}
|
||||||
if len(m.Identity) > 0 {
|
if len(m.Identity) > 0 {
|
||||||
@ -2150,6 +2166,10 @@ func (m *AclRoot) Size() (n int) {
|
|||||||
if l > 0 {
|
if l > 0 {
|
||||||
n += 1 + l + sovAclrecord(uint64(l))
|
n += 1 + l + sovAclrecord(uint64(l))
|
||||||
}
|
}
|
||||||
|
l = len(m.MasterKey)
|
||||||
|
if l > 0 {
|
||||||
|
n += 1 + l + sovAclrecord(uint64(l))
|
||||||
|
}
|
||||||
l = len(m.SpaceId)
|
l = len(m.SpaceId)
|
||||||
if l > 0 {
|
if l > 0 {
|
||||||
n += 1 + l + sovAclrecord(uint64(l))
|
n += 1 + l + sovAclrecord(uint64(l))
|
||||||
@ -2158,13 +2178,13 @@ func (m *AclRoot) Size() (n int) {
|
|||||||
if l > 0 {
|
if l > 0 {
|
||||||
n += 1 + l + sovAclrecord(uint64(l))
|
n += 1 + l + sovAclrecord(uint64(l))
|
||||||
}
|
}
|
||||||
l = len(m.DerivationParams)
|
|
||||||
if l > 0 {
|
|
||||||
n += 1 + l + sovAclrecord(uint64(l))
|
|
||||||
}
|
|
||||||
if m.Timestamp != 0 {
|
if m.Timestamp != 0 {
|
||||||
n += 1 + sovAclrecord(uint64(m.Timestamp))
|
n += 1 + sovAclrecord(uint64(m.Timestamp))
|
||||||
}
|
}
|
||||||
|
l = len(m.IdentitySignature)
|
||||||
|
if l > 0 {
|
||||||
|
n += 1 + l + sovAclrecord(uint64(l))
|
||||||
|
}
|
||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3053,6 +3073,40 @@ func (m *AclRoot) Unmarshal(dAtA []byte) error {
|
|||||||
}
|
}
|
||||||
iNdEx = postIndex
|
iNdEx = postIndex
|
||||||
case 2:
|
case 2:
|
||||||
|
if wireType != 2 {
|
||||||
|
return fmt.Errorf("proto: wrong wireType = %d for field MasterKey", 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.MasterKey = append(m.MasterKey[:0], dAtA[iNdEx:postIndex]...)
|
||||||
|
if m.MasterKey == nil {
|
||||||
|
m.MasterKey = []byte{}
|
||||||
|
}
|
||||||
|
iNdEx = postIndex
|
||||||
|
case 3:
|
||||||
if wireType != 2 {
|
if wireType != 2 {
|
||||||
return fmt.Errorf("proto: wrong wireType = %d for field SpaceId", wireType)
|
return fmt.Errorf("proto: wrong wireType = %d for field SpaceId", wireType)
|
||||||
}
|
}
|
||||||
@ -3084,7 +3138,7 @@ func (m *AclRoot) Unmarshal(dAtA []byte) error {
|
|||||||
}
|
}
|
||||||
m.SpaceId = string(dAtA[iNdEx:postIndex])
|
m.SpaceId = string(dAtA[iNdEx:postIndex])
|
||||||
iNdEx = postIndex
|
iNdEx = postIndex
|
||||||
case 3:
|
case 4:
|
||||||
if wireType != 2 {
|
if wireType != 2 {
|
||||||
return fmt.Errorf("proto: wrong wireType = %d for field EncryptedReadKey", wireType)
|
return fmt.Errorf("proto: wrong wireType = %d for field EncryptedReadKey", wireType)
|
||||||
}
|
}
|
||||||
@ -3118,9 +3172,28 @@ func (m *AclRoot) Unmarshal(dAtA []byte) error {
|
|||||||
m.EncryptedReadKey = []byte{}
|
m.EncryptedReadKey = []byte{}
|
||||||
}
|
}
|
||||||
iNdEx = postIndex
|
iNdEx = postIndex
|
||||||
case 4:
|
case 5:
|
||||||
|
if wireType != 0 {
|
||||||
|
return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType)
|
||||||
|
}
|
||||||
|
m.Timestamp = 0
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowAclrecord
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
m.Timestamp |= int64(b&0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case 6:
|
||||||
if wireType != 2 {
|
if wireType != 2 {
|
||||||
return fmt.Errorf("proto: wrong wireType = %d for field DerivationParams", wireType)
|
return fmt.Errorf("proto: wrong wireType = %d for field IdentitySignature", wireType)
|
||||||
}
|
}
|
||||||
var byteLen int
|
var byteLen int
|
||||||
for shift := uint(0); ; shift += 7 {
|
for shift := uint(0); ; shift += 7 {
|
||||||
@ -3147,30 +3220,11 @@ func (m *AclRoot) Unmarshal(dAtA []byte) error {
|
|||||||
if postIndex > l {
|
if postIndex > l {
|
||||||
return io.ErrUnexpectedEOF
|
return io.ErrUnexpectedEOF
|
||||||
}
|
}
|
||||||
m.DerivationParams = append(m.DerivationParams[:0], dAtA[iNdEx:postIndex]...)
|
m.IdentitySignature = append(m.IdentitySignature[:0], dAtA[iNdEx:postIndex]...)
|
||||||
if m.DerivationParams == nil {
|
if m.IdentitySignature == nil {
|
||||||
m.DerivationParams = []byte{}
|
m.IdentitySignature = []byte{}
|
||||||
}
|
}
|
||||||
iNdEx = postIndex
|
iNdEx = postIndex
|
||||||
case 5:
|
|
||||||
if wireType != 0 {
|
|
||||||
return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType)
|
|
||||||
}
|
|
||||||
m.Timestamp = 0
|
|
||||||
for shift := uint(0); ; shift += 7 {
|
|
||||||
if shift >= 64 {
|
|
||||||
return ErrIntOverflowAclrecord
|
|
||||||
}
|
|
||||||
if iNdEx >= l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
b := dAtA[iNdEx]
|
|
||||||
iNdEx++
|
|
||||||
m.Timestamp |= int64(b&0x7F) << shift
|
|
||||||
if b < 0x80 {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
default:
|
default:
|
||||||
iNdEx = preIndex
|
iNdEx = preIndex
|
||||||
skippy, err := skipAclrecord(dAtA[iNdEx:])
|
skippy, err := skipAclrecord(dAtA[iNdEx:])
|
||||||
|
|||||||
@ -24,10 +24,11 @@ message AclRecord {
|
|||||||
|
|
||||||
message AclRoot {
|
message AclRoot {
|
||||||
bytes identity = 1;
|
bytes identity = 1;
|
||||||
string spaceId = 2;
|
bytes masterKey = 2;
|
||||||
bytes encryptedReadKey = 3;
|
string spaceId = 3;
|
||||||
bytes derivationParams = 4;
|
bytes encryptedReadKey = 4;
|
||||||
int64 timestamp = 5;
|
int64 timestamp = 5;
|
||||||
|
bytes identitySignature = 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
message AclContentValue {
|
message AclContentValue {
|
||||||
|
|||||||
@ -4,14 +4,14 @@ import (
|
|||||||
"github.com/anytypeio/any-sync/commonspace/object/acl/aclrecordproto"
|
"github.com/anytypeio/any-sync/commonspace/object/acl/aclrecordproto"
|
||||||
"github.com/anytypeio/any-sync/util/cidutil"
|
"github.com/anytypeio/any-sync/util/cidutil"
|
||||||
"github.com/anytypeio/any-sync/util/crypto"
|
"github.com/anytypeio/any-sync/util/crypto"
|
||||||
"github.com/anytypeio/any-sync/util/crypto/cryptoproto"
|
|
||||||
"github.com/gogo/protobuf/proto"
|
"github.com/gogo/protobuf/proto"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
type RootContent struct {
|
type RootContent struct {
|
||||||
PrivKey crypto.PrivKey
|
PrivKey crypto.PrivKey
|
||||||
|
MasterKey crypto.PrivKey
|
||||||
SpaceId string
|
SpaceId string
|
||||||
DerivationPath string
|
|
||||||
EncryptedReadKey []byte
|
EncryptedReadKey []byte
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,26 +85,33 @@ func (a *aclRecordBuilder) Unmarshall(rawIdRecord *aclrecordproto.RawAclRecordWi
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a *aclRecordBuilder) BuildRoot(content RootContent) (rec *aclrecordproto.RawAclRecordWithId, err error) {
|
func (a *aclRecordBuilder) BuildRoot(content RootContent) (rec *aclrecordproto.RawAclRecordWithId, err error) {
|
||||||
|
rawIdentity, err := content.PrivKey.GetPublic().Raw()
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
identity, err := content.PrivKey.GetPublic().Marshall()
|
identity, err := content.PrivKey.GetPublic().Marshall()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
var derivationParams []byte
|
masterKey, err := content.MasterKey.GetPublic().Marshall()
|
||||||
if content.DerivationPath != "" {
|
if err != nil {
|
||||||
keyDerivation := &cryptoproto.KeyDerivation{
|
return
|
||||||
Method: cryptoproto.DerivationMethod_Slip21,
|
}
|
||||||
DerivationPath: content.DerivationPath,
|
identitySignature, err := content.MasterKey.Sign(rawIdentity)
|
||||||
}
|
if err != nil {
|
||||||
derivationParams, err = keyDerivation.Marshal()
|
return
|
||||||
if err != nil {
|
}
|
||||||
return
|
var timestamp int64
|
||||||
}
|
if content.EncryptedReadKey != nil {
|
||||||
|
timestamp = time.Now().Unix()
|
||||||
}
|
}
|
||||||
aclRoot := &aclrecordproto.AclRoot{
|
aclRoot := &aclrecordproto.AclRoot{
|
||||||
Identity: identity,
|
Identity: identity,
|
||||||
SpaceId: content.SpaceId,
|
SpaceId: content.SpaceId,
|
||||||
EncryptedReadKey: content.EncryptedReadKey,
|
EncryptedReadKey: content.EncryptedReadKey,
|
||||||
DerivationParams: derivationParams,
|
MasterKey: masterKey,
|
||||||
|
IdentitySignature: identitySignature,
|
||||||
|
Timestamp: timestamp,
|
||||||
}
|
}
|
||||||
return marshalAclRoot(aclRoot, content.PrivKey)
|
return marshalAclRoot(aclRoot, content.PrivKey)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,8 +3,6 @@ package list
|
|||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/anytypeio/any-sync/util/crypto/cryptoproto"
|
|
||||||
|
|
||||||
"github.com/anytypeio/any-sync/app/logger"
|
"github.com/anytypeio/any-sync/app/logger"
|
||||||
"github.com/anytypeio/any-sync/commonspace/object/acl/aclrecordproto"
|
"github.com/anytypeio/any-sync/commonspace/object/acl/aclrecordproto"
|
||||||
"github.com/anytypeio/any-sync/util/crypto"
|
"github.com/anytypeio/any-sync/util/crypto"
|
||||||
@ -172,8 +170,8 @@ func (st *AclState) saveReadKeyFromRoot(record *AclRecord) (err error) {
|
|||||||
if !ok {
|
if !ok {
|
||||||
return ErrIncorrectRoot
|
return ErrIncorrectRoot
|
||||||
}
|
}
|
||||||
if root.DerivationParams != nil {
|
if root.EncryptedReadKey == nil {
|
||||||
readKey, err = st.deriveKey(root.DerivationParams)
|
readKey, err = st.deriveKey()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -315,17 +313,12 @@ func (st *AclState) LastRecordId() string {
|
|||||||
return st.lastRecordId
|
return st.lastRecordId
|
||||||
}
|
}
|
||||||
|
|
||||||
func (st *AclState) deriveKey(params []byte) (crypto.SymKey, error) {
|
func (st *AclState) deriveKey() (crypto.SymKey, error) {
|
||||||
keyDerivation := &cryptoproto.KeyDerivation{}
|
|
||||||
err := proto.Unmarshal(params, keyDerivation)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
keyBytes, err := st.key.Raw()
|
keyBytes, err := st.key.Raw()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return crypto.DeriveSymmetricKey(keyBytes, keyDerivation.DerivationPath)
|
return crypto.DeriveSymmetricKey(keyBytes, crypto.AnysyncSpacePath)
|
||||||
}
|
}
|
||||||
|
|
||||||
func mapKeyFromPubKey(pubKey crypto.PubKey) string {
|
func mapKeyFromPubKey(pubKey crypto.PubKey) string {
|
||||||
|
|||||||
@ -9,10 +9,14 @@ import (
|
|||||||
|
|
||||||
func NewTestDerivedAcl(spaceId string, keys *accountdata.AccountKeys) (AclList, error) {
|
func NewTestDerivedAcl(spaceId string, keys *accountdata.AccountKeys) (AclList, error) {
|
||||||
builder := NewAclRecordBuilder("", crypto.NewKeyStorage())
|
builder := NewAclRecordBuilder("", crypto.NewKeyStorage())
|
||||||
|
masterKey, _, err := crypto.GenerateRandomEd25519KeyPair()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
root, err := builder.BuildRoot(RootContent{
|
root, err := builder.BuildRoot(RootContent{
|
||||||
PrivKey: keys.SignKey,
|
PrivKey: keys.SignKey,
|
||||||
SpaceId: spaceId,
|
SpaceId: spaceId,
|
||||||
DerivationPath: crypto.AnytypeAccountPath,
|
MasterKey: masterKey,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|||||||
@ -50,6 +50,10 @@ func (tb *treeBuilder) Build(theirHeads []string, newChanges []*Change) (*Tree,
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (tb *treeBuilder) build(heads []string, theirHeads []string, newChanges []*Change) (*Tree, error) {
|
func (tb *treeBuilder) build(heads []string, theirHeads []string, newChanges []*Change) (*Tree, error) {
|
||||||
|
defer func() {
|
||||||
|
tb.cache = make(map[string]*Change)
|
||||||
|
}()
|
||||||
|
|
||||||
var proposedHeads []string
|
var proposedHeads []string
|
||||||
tb.cache = make(map[string]*Change)
|
tb.cache = make(map[string]*Change)
|
||||||
|
|
||||||
|
|||||||
@ -19,14 +19,14 @@ type syncClient struct {
|
|||||||
objectsync.MessagePool
|
objectsync.MessagePool
|
||||||
RequestFactory
|
RequestFactory
|
||||||
spaceId string
|
spaceId string
|
||||||
configuration nodeconf.Configuration
|
configuration nodeconf.NodeConf
|
||||||
}
|
}
|
||||||
|
|
||||||
func newSyncClient(
|
func newSyncClient(
|
||||||
spaceId string,
|
spaceId string,
|
||||||
pool objectsync.MessagePool,
|
pool objectsync.MessagePool,
|
||||||
factory RequestFactory,
|
factory RequestFactory,
|
||||||
configuration nodeconf.Configuration) SyncClient {
|
configuration nodeconf.NodeConf) SyncClient {
|
||||||
return &syncClient{
|
return &syncClient{
|
||||||
MessagePool: pool,
|
MessagePool: pool,
|
||||||
RequestFactory: factory,
|
RequestFactory: factory,
|
||||||
|
|||||||
@ -64,7 +64,7 @@ type ResponsiblePeersGetter interface {
|
|||||||
type BuildDeps struct {
|
type BuildDeps struct {
|
||||||
SpaceId string
|
SpaceId string
|
||||||
ObjectSync objectsync.ObjectSync
|
ObjectSync objectsync.ObjectSync
|
||||||
Configuration nodeconf.Configuration
|
Configuration nodeconf.NodeConf
|
||||||
HeadNotifiable HeadNotifiable
|
HeadNotifiable HeadNotifiable
|
||||||
Listener updatelistener.UpdateListener
|
Listener updatelistener.UpdateListener
|
||||||
AclList list.AclList
|
AclList list.AclList
|
||||||
|
|||||||
@ -34,8 +34,8 @@ func (s syncTreeMatcher) String() string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
func syncClientFuncCreator(client SyncClient) func(spaceId string, factory RequestFactory, objectSync objectsync.ObjectSync, configuration nodeconf.Configuration) SyncClient {
|
func syncClientFuncCreator(client SyncClient) func(spaceId string, factory RequestFactory, objectSync objectsync.ObjectSync, configuration nodeconf.NodeConf) SyncClient {
|
||||||
return func(spaceId string, factory RequestFactory, objectSync objectsync.ObjectSync, configuration nodeconf.Configuration) SyncClient {
|
return func(spaceId string, factory RequestFactory, objectSync objectsync.ObjectSync, configuration nodeconf.NodeConf) SyncClient {
|
||||||
return client
|
return client
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -32,7 +32,7 @@ type objectSync struct {
|
|||||||
|
|
||||||
messagePool MessagePool
|
messagePool MessagePool
|
||||||
objectGetter syncobjectgetter.SyncObjectGetter
|
objectGetter syncobjectgetter.SyncObjectGetter
|
||||||
configuration nodeconf.Configuration
|
configuration nodeconf.NodeConf
|
||||||
spaceStorage spacestorage.SpaceStorage
|
spaceStorage spacestorage.SpaceStorage
|
||||||
|
|
||||||
syncCtx context.Context
|
syncCtx context.Context
|
||||||
@ -43,7 +43,7 @@ type objectSync struct {
|
|||||||
func NewObjectSync(
|
func NewObjectSync(
|
||||||
spaceId string,
|
spaceId string,
|
||||||
spaceIsDeleted *atomic.Bool,
|
spaceIsDeleted *atomic.Bool,
|
||||||
configuration nodeconf.Configuration,
|
configuration nodeconf.NodeConf,
|
||||||
peerManager peermanager.PeerManager,
|
peerManager peermanager.PeerManager,
|
||||||
objectGetter syncobjectgetter.SyncObjectGetter,
|
objectGetter syncobjectgetter.SyncObjectGetter,
|
||||||
storage spacestorage.SpaceStorage) ObjectSync {
|
storage spacestorage.SpaceStorage) ObjectSync {
|
||||||
@ -64,7 +64,7 @@ func NewObjectSync(
|
|||||||
func newObjectSync(
|
func newObjectSync(
|
||||||
spaceId string,
|
spaceId string,
|
||||||
spaceIsDeleted *atomic.Bool,
|
spaceIsDeleted *atomic.Bool,
|
||||||
configuration nodeconf.Configuration,
|
configuration nodeconf.NodeConf,
|
||||||
objectGetter syncobjectgetter.SyncObjectGetter,
|
objectGetter syncobjectgetter.SyncObjectGetter,
|
||||||
spaceStorage spacestorage.SpaceStorage,
|
spaceStorage spacestorage.SpaceStorage,
|
||||||
syncCtx context.Context,
|
syncCtx context.Context,
|
||||||
|
|||||||
@ -66,6 +66,7 @@ func storagePayloadForSpaceCreate(payload SpaceCreatePayload) (storagePayload sp
|
|||||||
aclBuilder := list.NewAclRecordBuilder("", keyStorage)
|
aclBuilder := list.NewAclRecordBuilder("", keyStorage)
|
||||||
aclRoot, err := aclBuilder.BuildRoot(list.RootContent{
|
aclRoot, err := aclBuilder.BuildRoot(list.RootContent{
|
||||||
PrivKey: payload.SigningKey,
|
PrivKey: payload.SigningKey,
|
||||||
|
MasterKey: payload.MasterKey,
|
||||||
SpaceId: spaceId,
|
SpaceId: spaceId,
|
||||||
EncryptedReadKey: readKey,
|
EncryptedReadKey: readKey,
|
||||||
})
|
})
|
||||||
@ -151,9 +152,9 @@ func storagePayloadForSpaceDerive(payload SpaceDerivePayload) (storagePayload sp
|
|||||||
keyStorage := crypto.NewKeyStorage()
|
keyStorage := crypto.NewKeyStorage()
|
||||||
aclBuilder := list.NewAclRecordBuilder("", keyStorage)
|
aclBuilder := list.NewAclRecordBuilder("", keyStorage)
|
||||||
aclRoot, err := aclBuilder.BuildRoot(list.RootContent{
|
aclRoot, err := aclBuilder.BuildRoot(list.RootContent{
|
||||||
PrivKey: payload.SigningKey,
|
PrivKey: payload.SigningKey,
|
||||||
SpaceId: spaceId,
|
MasterKey: payload.MasterKey,
|
||||||
DerivationPath: crypto.AnytypeAccountPath,
|
SpaceId: spaceId,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
|
|||||||
@ -49,7 +49,7 @@ type Deps struct {
|
|||||||
Account accountservice.Service
|
Account accountservice.Service
|
||||||
TreeGetter treegetter.TreeGetter
|
TreeGetter treegetter.TreeGetter
|
||||||
Store spacestorage.SpaceStorage
|
Store spacestorage.SpaceStorage
|
||||||
Configuration nodeconf.Configuration
|
Configuration nodeconf.NodeConf
|
||||||
DeletionState settingsstate.ObjectDeletionState
|
DeletionState settingsstate.ObjectDeletionState
|
||||||
Provider SpaceIdsProvider
|
Provider SpaceIdsProvider
|
||||||
OnSpaceDelete func()
|
OnSpaceDelete func()
|
||||||
|
|||||||
@ -50,6 +50,8 @@ type SpaceCreatePayload struct {
|
|||||||
ReplicationKey uint64
|
ReplicationKey uint64
|
||||||
// SpacePayload is an arbitrary payload related to space type
|
// SpacePayload is an arbitrary payload related to space type
|
||||||
SpacePayload []byte
|
SpacePayload []byte
|
||||||
|
// MasterKey is the master key of the owner
|
||||||
|
MasterKey crypto.PrivKey
|
||||||
}
|
}
|
||||||
|
|
||||||
type HandleMessage struct {
|
type HandleMessage struct {
|
||||||
@ -61,6 +63,7 @@ type HandleMessage struct {
|
|||||||
|
|
||||||
type SpaceDerivePayload struct {
|
type SpaceDerivePayload struct {
|
||||||
SigningKey crypto.PrivKey
|
SigningKey crypto.PrivKey
|
||||||
|
MasterKey crypto.PrivKey
|
||||||
SpaceType string
|
SpaceType string
|
||||||
SpacePayload []byte
|
SpacePayload []byte
|
||||||
}
|
}
|
||||||
@ -118,7 +121,7 @@ type space struct {
|
|||||||
cache *commonGetter
|
cache *commonGetter
|
||||||
account accountservice.Service
|
account accountservice.Service
|
||||||
aclList *syncacl.SyncAcl
|
aclList *syncacl.SyncAcl
|
||||||
configuration nodeconf.Configuration
|
configuration nodeconf.NodeConf
|
||||||
settingsObject settings.SettingsObject
|
settingsObject settings.SettingsObject
|
||||||
peerManager peermanager.PeerManager
|
peerManager peermanager.PeerManager
|
||||||
|
|
||||||
|
|||||||
@ -135,7 +135,7 @@ func (s *spaceService) NewSpace(ctx context.Context, id string) (Space, error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lastConfiguration := s.configurationService.GetLast()
|
lastConfiguration := s.configurationService
|
||||||
var (
|
var (
|
||||||
spaceIsClosed = &atomic.Bool{}
|
spaceIsClosed = &atomic.Bool{}
|
||||||
spaceIsDeleted = &atomic.Bool{}
|
spaceIsDeleted = &atomic.Bool{}
|
||||||
@ -202,7 +202,7 @@ func (s *spaceService) addSpaceStorage(ctx context.Context, spaceDescription Spa
|
|||||||
|
|
||||||
func (s *spaceService) getSpaceStorageFromRemote(ctx context.Context, id string) (st spacestorage.SpaceStorage, err error) {
|
func (s *spaceService) getSpaceStorageFromRemote(ctx context.Context, id string) (st spacestorage.SpaceStorage, err error) {
|
||||||
var p peer.Peer
|
var p peer.Peer
|
||||||
lastConfiguration := s.configurationService.GetLast()
|
lastConfiguration := s.configurationService
|
||||||
// we can't connect to client if it is a node
|
// we can't connect to client if it is a node
|
||||||
if lastConfiguration.IsResponsible(id) {
|
if lastConfiguration.IsResponsible(id) {
|
||||||
err = spacesyncproto.ErrSpaceMissing
|
err = spacesyncproto.ErrSpaceMissing
|
||||||
|
|||||||
@ -72,7 +72,7 @@ type treeStatus struct {
|
|||||||
|
|
||||||
type syncStatusProvider struct {
|
type syncStatusProvider struct {
|
||||||
sync.Mutex
|
sync.Mutex
|
||||||
configuration nodeconf.Configuration
|
configuration nodeconf.NodeConf
|
||||||
periodicSync periodicsync.PeriodicSync
|
periodicSync periodicsync.PeriodicSync
|
||||||
updateReceiver UpdateReceiver
|
updateReceiver UpdateReceiver
|
||||||
storage spacestorage.SpaceStorage
|
storage spacestorage.SpaceStorage
|
||||||
@ -92,11 +92,11 @@ type syncStatusProvider struct {
|
|||||||
type SyncStatusDeps struct {
|
type SyncStatusDeps struct {
|
||||||
UpdateIntervalSecs int
|
UpdateIntervalSecs int
|
||||||
UpdateTimeout time.Duration
|
UpdateTimeout time.Duration
|
||||||
Configuration nodeconf.Configuration
|
Configuration nodeconf.NodeConf
|
||||||
Storage spacestorage.SpaceStorage
|
Storage spacestorage.SpaceStorage
|
||||||
}
|
}
|
||||||
|
|
||||||
func DefaultDeps(configuration nodeconf.Configuration, store spacestorage.SpaceStorage) SyncStatusDeps {
|
func DefaultDeps(configuration nodeconf.NodeConf, store spacestorage.SpaceStorage) SyncStatusDeps {
|
||||||
return SyncStatusDeps{
|
return SyncStatusDeps{
|
||||||
UpdateIntervalSecs: syncUpdateInterval,
|
UpdateIntervalSecs: syncUpdateInterval,
|
||||||
UpdateTimeout: syncTimeout,
|
UpdateTimeout: syncTimeout,
|
||||||
|
|||||||
@ -9,6 +9,7 @@ import (
|
|||||||
"github.com/anytypeio/any-sync/net/pool"
|
"github.com/anytypeio/any-sync/net/pool"
|
||||||
"github.com/anytypeio/any-sync/net/rpc/rpcerr"
|
"github.com/anytypeio/any-sync/net/rpc/rpcerr"
|
||||||
"github.com/anytypeio/any-sync/nodeconf"
|
"github.com/anytypeio/any-sync/nodeconf"
|
||||||
|
"github.com/anytypeio/any-sync/util/crypto"
|
||||||
)
|
)
|
||||||
|
|
||||||
const CName = "common.coordinator.coordinatorclient"
|
const CName = "common.coordinator.coordinatorclient"
|
||||||
@ -20,11 +21,18 @@ func New() CoordinatorClient {
|
|||||||
type CoordinatorClient interface {
|
type CoordinatorClient interface {
|
||||||
ChangeStatus(ctx context.Context, spaceId string, deleteRaw *treechangeproto.RawTreeChangeWithId) (status *coordinatorproto.SpaceStatusPayload, err error)
|
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)
|
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)
|
FileLimitCheck(ctx context.Context, spaceId string, identity []byte) (limit uint64, err error)
|
||||||
app.Component
|
app.Component
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type SpaceSignPayload struct {
|
||||||
|
SpaceId string
|
||||||
|
SpaceHeader []byte
|
||||||
|
OldAccount crypto.PrivKey
|
||||||
|
Identity crypto.PrivKey
|
||||||
|
}
|
||||||
|
|
||||||
type coordinatorClient struct {
|
type coordinatorClient struct {
|
||||||
pool pool.Pool
|
pool pool.Pool
|
||||||
nodeConf nodeconf.Service
|
nodeConf nodeconf.Service
|
||||||
@ -74,14 +82,28 @@ func (c *coordinatorClient) Name() (name string) {
|
|||||||
return CName
|
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)
|
cl, err := c.client(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
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{
|
resp, err := cl.SpaceSign(ctx, &coordinatorproto.SpaceSignRequest{
|
||||||
SpaceId: spaceId,
|
SpaceId: payload.SpaceId,
|
||||||
Header: spaceHeader,
|
Header: payload.SpaceHeader,
|
||||||
|
OldIdentity: oldIdentity,
|
||||||
|
NewIdentitySignature: newSignature,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = rpcerr.Unwrap(err)
|
err = rpcerr.Unwrap(err)
|
||||||
@ -107,7 +129,7 @@ func (c *coordinatorClient) FileLimitCheck(ctx context.Context, spaceId string,
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *coordinatorClient) client(ctx context.Context) (coordinatorproto.DRPCCoordinatorClient, error) {
|
func (c *coordinatorClient) client(ctx context.Context) (coordinatorproto.DRPCCoordinatorClient, error) {
|
||||||
p, err := c.pool.GetOneOf(ctx, c.nodeConf.GetLast().CoordinatorPeers())
|
p, err := c.pool.GetOneOf(ctx, c.nodeConf.CoordinatorPeers())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,6 +10,7 @@ import (
|
|||||||
|
|
||||||
app "github.com/anytypeio/any-sync/app"
|
app "github.com/anytypeio/any-sync/app"
|
||||||
treechangeproto "github.com/anytypeio/any-sync/commonspace/object/tree/treechangeproto"
|
treechangeproto "github.com/anytypeio/any-sync/commonspace/object/tree/treechangeproto"
|
||||||
|
coordinatorclient "github.com/anytypeio/any-sync/coordinator/coordinatorclient"
|
||||||
coordinatorproto "github.com/anytypeio/any-sync/coordinator/coordinatorproto"
|
coordinatorproto "github.com/anytypeio/any-sync/coordinator/coordinatorproto"
|
||||||
gomock "github.com/golang/mock/gomock"
|
gomock "github.com/golang/mock/gomock"
|
||||||
)
|
)
|
||||||
@ -96,18 +97,18 @@ func (mr *MockCoordinatorClientMockRecorder) Name() *gomock.Call {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// SpaceSign mocks base method.
|
// SpaceSign mocks base method.
|
||||||
func (m *MockCoordinatorClient) SpaceSign(arg0 context.Context, arg1 string, arg2 []byte) (*coordinatorproto.SpaceReceiptWithSignature, error) {
|
func (m *MockCoordinatorClient) SpaceSign(arg0 context.Context, arg1 coordinatorclient.SpaceSignPayload) (*coordinatorproto.SpaceReceiptWithSignature, error) {
|
||||||
m.ctrl.T.Helper()
|
m.ctrl.T.Helper()
|
||||||
ret := m.ctrl.Call(m, "SpaceSign", arg0, arg1, arg2)
|
ret := m.ctrl.Call(m, "SpaceSign", arg0, arg1)
|
||||||
ret0, _ := ret[0].(*coordinatorproto.SpaceReceiptWithSignature)
|
ret0, _ := ret[0].(*coordinatorproto.SpaceReceiptWithSignature)
|
||||||
ret1, _ := ret[1].(error)
|
ret1, _ := ret[1].(error)
|
||||||
return ret0, ret1
|
return ret0, ret1
|
||||||
}
|
}
|
||||||
|
|
||||||
// SpaceSign indicates an expected call of SpaceSign.
|
// SpaceSign indicates an expected call of SpaceSign.
|
||||||
func (mr *MockCoordinatorClientMockRecorder) SpaceSign(arg0, arg1, arg2 interface{}) *gomock.Call {
|
func (mr *MockCoordinatorClientMockRecorder) SpaceSign(arg0, arg1 interface{}) *gomock.Call {
|
||||||
mr.mock.ctrl.T.Helper()
|
mr.mock.ctrl.T.Helper()
|
||||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SpaceSign", reflect.TypeOf((*MockCoordinatorClient)(nil).SpaceSign), arg0, arg1, arg2)
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SpaceSign", reflect.TypeOf((*MockCoordinatorClient)(nil).SpaceSign), arg0, arg1)
|
||||||
}
|
}
|
||||||
|
|
||||||
// StatusCheck mocks base method.
|
// StatusCheck mocks base method.
|
||||||
|
|||||||
@ -123,8 +123,14 @@ func (NodeType) EnumDescriptor() ([]byte, []int) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type SpaceSignRequest struct {
|
type SpaceSignRequest struct {
|
||||||
|
// SpaceId is the id of the signed space
|
||||||
SpaceId string `protobuf:"bytes,1,opt,name=spaceId,proto3" json:"spaceId,omitempty"`
|
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{} }
|
func (m *SpaceSignRequest) Reset() { *m = SpaceSignRequest{} }
|
||||||
@ -174,6 +180,20 @@ func (m *SpaceSignRequest) GetHeader() []byte {
|
|||||||
return nil
|
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 {
|
type SpaceStatusPayload struct {
|
||||||
Status SpaceStatus `protobuf:"varint,1,opt,name=status,proto3,enum=coordinator.SpaceStatus" json:"status,omitempty"`
|
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"`
|
DeletionTimestamp int64 `protobuf:"varint,2,opt,name=deletionTimestamp,proto3" json:"deletionTimestamp,omitempty"`
|
||||||
@ -700,9 +720,11 @@ func (m *SpaceStatusChangeResponse) GetPayload() *SpaceStatusPayload {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// NetworkConfigurationRequest contains the requested configurationId, it can be empty to request the latest version
|
// NetworkConfigurationRequest contains currenId of the client configuration, it can be empty
|
||||||
type NetworkConfigurationRequest struct {
|
type NetworkConfigurationRequest struct {
|
||||||
ConfigurationId string `protobuf:"bytes,1,opt,name=configurationId,proto3" json:"configurationId,omitempty"`
|
// currenId of the client configuration
|
||||||
|
// if the currentId is equal to the latest configuration id then the response will not contain a nodes list
|
||||||
|
CurrentId string `protobuf:"bytes,1,opt,name=currentId,proto3" json:"currentId,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *NetworkConfigurationRequest) Reset() { *m = NetworkConfigurationRequest{} }
|
func (m *NetworkConfigurationRequest) Reset() { *m = NetworkConfigurationRequest{} }
|
||||||
@ -738,17 +760,21 @@ func (m *NetworkConfigurationRequest) XXX_DiscardUnknown() {
|
|||||||
|
|
||||||
var xxx_messageInfo_NetworkConfigurationRequest proto.InternalMessageInfo
|
var xxx_messageInfo_NetworkConfigurationRequest proto.InternalMessageInfo
|
||||||
|
|
||||||
func (m *NetworkConfigurationRequest) GetConfigurationId() string {
|
func (m *NetworkConfigurationRequest) GetCurrentId() string {
|
||||||
if m != nil {
|
if m != nil {
|
||||||
return m.ConfigurationId
|
return m.CurrentId
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
// NetworkConfigurationResponse contains list of nodes
|
// NetworkConfigurationResponse contains list of nodes
|
||||||
type NetworkConfigurationResponse struct {
|
type NetworkConfigurationResponse struct {
|
||||||
ConfigurationId string `protobuf:"bytes,1,opt,name=configurationId,proto3" json:"configurationId,omitempty"`
|
// id of current configuration
|
||||||
Nodes []*Node `protobuf:"bytes,2,rep,name=nodes,proto3" json:"nodes,omitempty"`
|
ConfigurationId string `protobuf:"bytes,1,opt,name=configurationId,proto3" json:"configurationId,omitempty"`
|
||||||
|
// nodes list - it will be empty if the client's currentId is equal configurationId
|
||||||
|
Nodes []*Node `protobuf:"bytes,2,rep,name=nodes,proto3" json:"nodes,omitempty"`
|
||||||
|
// unix timestamp of the creation time of configuration
|
||||||
|
CreationTimeUnix uint64 `protobuf:"varint,3,opt,name=creationTimeUnix,proto3" json:"creationTimeUnix,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *NetworkConfigurationResponse) Reset() { *m = NetworkConfigurationResponse{} }
|
func (m *NetworkConfigurationResponse) Reset() { *m = NetworkConfigurationResponse{} }
|
||||||
@ -798,6 +824,13 @@ func (m *NetworkConfigurationResponse) GetNodes() []*Node {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *NetworkConfigurationResponse) GetCreationTimeUnix() uint64 {
|
||||||
|
if m != nil {
|
||||||
|
return m.CreationTimeUnix
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
// Node describes one node in the network
|
// Node describes one node in the network
|
||||||
type Node struct {
|
type Node struct {
|
||||||
// peerId - it's a peer identifier (libp2p format string) so it's an encoded publicKey
|
// peerId - it's a peer identifier (libp2p format string) so it's an encoded publicKey
|
||||||
@ -887,61 +920,64 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var fileDescriptor_d94f6f99586adae2 = []byte{
|
var fileDescriptor_d94f6f99586adae2 = []byte{
|
||||||
// 856 bytes of a gzipped FileDescriptorProto
|
// 911 bytes of a gzipped FileDescriptorProto
|
||||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x56, 0xdd, 0x6e, 0xe3, 0x44,
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x56, 0xcd, 0x6e, 0x23, 0x45,
|
||||||
0x14, 0x8e, 0xe3, 0xb4, 0x25, 0xc7, 0x55, 0x70, 0x87, 0xb6, 0x98, 0x50, 0x4c, 0x64, 0x60, 0x09,
|
0x10, 0xf6, 0xd8, 0x4e, 0x82, 0x6b, 0x22, 0xef, 0xa4, 0x49, 0xc2, 0x60, 0xcc, 0x60, 0x0d, 0xb0,
|
||||||
0x05, 0x75, 0x57, 0x59, 0x40, 0x70, 0x07, 0x64, 0x17, 0x54, 0x84, 0x4a, 0xe5, 0xb6, 0x20, 0xe0,
|
0x98, 0x80, 0xb2, 0x2b, 0x2f, 0x20, 0x10, 0x17, 0xc0, 0x2c, 0x52, 0x10, 0x0a, 0xd1, 0x24, 0x06,
|
||||||
0x02, 0x79, 0xed, 0xd3, 0x76, 0xd4, 0xd4, 0xe3, 0x9d, 0x99, 0xc0, 0xf6, 0x02, 0x89, 0x47, 0xe0,
|
0x01, 0x07, 0x34, 0x3b, 0x53, 0x49, 0x5a, 0x71, 0xba, 0x87, 0xee, 0x36, 0x9b, 0x1c, 0x90, 0x78,
|
||||||
0x8a, 0xa7, 0xe0, 0x11, 0x78, 0x00, 0x2e, 0xf7, 0x92, 0x4b, 0xd4, 0x4a, 0x3c, 0x07, 0x1a, 0x7b,
|
0x04, 0x4e, 0x1c, 0x90, 0x78, 0x03, 0x1e, 0x81, 0x07, 0xe0, 0x98, 0x23, 0x47, 0x94, 0x48, 0x3c,
|
||||||
0x9c, 0x8c, 0x13, 0x27, 0xad, 0xc4, 0x4d, 0xdb, 0xf3, 0x9d, 0x9f, 0xef, 0x9c, 0x39, 0x3f, 0x2e,
|
0x07, 0xea, 0xf9, 0xb1, 0x7b, 0xec, 0x71, 0x82, 0xb4, 0x17, 0xdb, 0xfd, 0xd5, 0xef, 0x57, 0x55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|
0x14, 0x55, 0x97, 0x6e, 0x23, 0x15, 0x9a, 0x10, 0x19, 0xc0, 0x26, 0xc3, 0xa7, 0xc5, 0x51, 0x47,
|
||||||
0x70, 0x08, 0xb5, 0x1d, 0x79, 0x0f, 0x36, 0x12, 0x1c, 0xa1, 0xa4, 0x2c, 0x3d, 0xa6, 0x97, 0x28,
|
0x0b, 0xd5, 0x44, 0xa0, 0xdb, 0x4c, 0x55, 0x2b, 0x65, 0xbe, 0x02, 0x92, 0xe5, 0xa6, 0x42, 0x35,
|
||||||
0x64, 0x74, 0x99, 0xe5, 0x54, 0x76, 0x38, 0xaf, 0x08, 0x4e, 0x60, 0xc3, 0xc8, 0x5d, 0x64, 0x2c,
|
0x91, 0x07, 0xe1, 0xe5, 0x98, 0x87, 0x31, 0x79, 0x08, 0xab, 0x32, 0x05, 0xd2, 0xe4, 0xda, 0x03,
|
||||||
0x15, 0x48, 0x3e, 0x81, 0x35, 0x8e, 0x31, 0xd2, 0x4c, 0xe6, 0xac, 0xce, 0xe0, 0xde, 0x3c, 0x6b,
|
0x77, 0xd7, 0xe4, 0x68, 0x18, 0x04, 0xb9, 0x1e, 0x79, 0x1b, 0x36, 0x62, 0x1c, 0xa3, 0xa2, 0x9c,
|
||||||
0x58, 0x18, 0x7c, 0x4b, 0xe5, 0xb9, 0xf2, 0x8d, 0xe4, 0x98, 0x63, 0x58, 0xba, 0x05, 0x17, 0xf0,
|
0x1d, 0xd1, 0x73, 0x94, 0x2a, 0x3c, 0x4f, 0x52, 0x02, 0x8d, 0x60, 0x51, 0xe0, 0x8f, 0x60, 0xc3,
|
||||||
0xca, 0x42, 0x2b, 0xf2, 0x00, 0x5e, 0x12, 0x86, 0x52, 0x97, 0x9a, 0x53, 0xad, 0x87, 0x75, 0x2a,
|
0xa8, 0x88, 0x4c, 0x38, 0x93, 0x48, 0x3e, 0x82, 0x35, 0x81, 0x11, 0xd2, 0x44, 0xa5, 0x51, 0xed,
|
||||||
0xb2, 0x03, 0x6d, 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c8, 0x3e, 0xfb, 0xf0, 0xaf, 0x6b, 0xdf, 0x7a, 0x7e, 0xed, 0x5b,
|
0x06, 0x3b, 0xaf, 0xde, 0xaa, 0x93, 0xbb, 0xfe, 0xbe, 0x78, 0xd9, 0x67, 0x2b, 0x88, 0xbc, 0xb6,
|
||||||
0xff, 0x5c, 0xfb, 0xd6, 0x6f, 0x37, 0x7e, 0xe3, 0xf9, 0x8d, 0xdf, 0xf8, 0xfb, 0xc6, 0x6f, 0x7c,
|
0xec, 0xe2, 0x95, 0xdc, 0xbf, 0x7e, 0x87, 0x56, 0x1e, 0xe0, 0x49, 0xf1, 0x50, 0x1a, 0x77, 0x9e,
|
||||||
0xbf, 0xb3, 0xec, 0x5f, 0x9e, 0x27, 0xab, 0xf9, 0xaf, 0x87, 0xff, 0x05, 0x00, 0x00, 0xff, 0xff,
|
0xdc, 0x62, 0x6b, 0xec, 0xaa, 0xce, 0xfd, 0xbb, 0xd4, 0xf2, 0x18, 0x67, 0xb0, 0x59, 0x75, 0x83,
|
||||||
0x69, 0x34, 0x32, 0xd9, 0x19, 0x09, 0x00, 0x00,
|
0x49, 0xbf, 0x3c, 0xed, 0xcb, 0x57, 0x44, 0xe7, 0xcd, 0xff, 0xa1, 0x99, 0x05, 0xfb, 0xe4, 0xbd,
|
||||||
|
0xbf, 0xae, 0x3d, 0xeb, 0xea, 0xda, 0xb3, 0xfe, 0xb9, 0xf6, 0xac, 0x5f, 0x6e, 0xbc, 0xda, 0xd5,
|
||||||
|
0x8d, 0x57, 0xfb, 0xfb, 0xc6, 0xab, 0x7d, 0xdb, 0xbd, 0xed, 0xaf, 0xd6, 0x93, 0xd5, 0xf4, 0xeb,
|
||||||
|
0xd1, 0x7f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xac, 0x4c, 0x78, 0x4a, 0x91, 0x09, 0x00, 0x00,
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *SpaceSignRequest) Marshal() (dAtA []byte, err error) {
|
func (m *SpaceSignRequest) Marshal() (dAtA []byte, err error) {
|
||||||
@ -964,6 +1000,20 @@ func (m *SpaceSignRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
|||||||
_ = i
|
_ = i
|
||||||
var l int
|
var l int
|
||||||
_ = l
|
_ = 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 {
|
if len(m.Header) > 0 {
|
||||||
i -= len(m.Header)
|
i -= len(m.Header)
|
||||||
copy(dAtA[i:], m.Header)
|
copy(dAtA[i:], m.Header)
|
||||||
@ -1371,10 +1421,10 @@ func (m *NetworkConfigurationRequest) MarshalToSizedBuffer(dAtA []byte) (int, er
|
|||||||
_ = i
|
_ = i
|
||||||
var l int
|
var l int
|
||||||
_ = l
|
_ = l
|
||||||
if len(m.ConfigurationId) > 0 {
|
if len(m.CurrentId) > 0 {
|
||||||
i -= len(m.ConfigurationId)
|
i -= len(m.CurrentId)
|
||||||
copy(dAtA[i:], m.ConfigurationId)
|
copy(dAtA[i:], m.CurrentId)
|
||||||
i = encodeVarintCoordinator(dAtA, i, uint64(len(m.ConfigurationId)))
|
i = encodeVarintCoordinator(dAtA, i, uint64(len(m.CurrentId)))
|
||||||
i--
|
i--
|
||||||
dAtA[i] = 0xa
|
dAtA[i] = 0xa
|
||||||
}
|
}
|
||||||
@ -1401,6 +1451,11 @@ func (m *NetworkConfigurationResponse) MarshalToSizedBuffer(dAtA []byte) (int, e
|
|||||||
_ = i
|
_ = i
|
||||||
var l int
|
var l int
|
||||||
_ = l
|
_ = l
|
||||||
|
if m.CreationTimeUnix != 0 {
|
||||||
|
i = encodeVarintCoordinator(dAtA, i, uint64(m.CreationTimeUnix))
|
||||||
|
i--
|
||||||
|
dAtA[i] = 0x18
|
||||||
|
}
|
||||||
if len(m.Nodes) > 0 {
|
if len(m.Nodes) > 0 {
|
||||||
for iNdEx := len(m.Nodes) - 1; iNdEx >= 0; iNdEx-- {
|
for iNdEx := len(m.Nodes) - 1; iNdEx >= 0; iNdEx-- {
|
||||||
{
|
{
|
||||||
@ -1507,6 +1562,14 @@ func (m *SpaceSignRequest) Size() (n int) {
|
|||||||
if l > 0 {
|
if l > 0 {
|
||||||
n += 1 + l + sovCoordinator(uint64(l))
|
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
|
return n
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1678,7 +1741,7 @@ func (m *NetworkConfigurationRequest) Size() (n int) {
|
|||||||
}
|
}
|
||||||
var l int
|
var l int
|
||||||
_ = l
|
_ = l
|
||||||
l = len(m.ConfigurationId)
|
l = len(m.CurrentId)
|
||||||
if l > 0 {
|
if l > 0 {
|
||||||
n += 1 + l + sovCoordinator(uint64(l))
|
n += 1 + l + sovCoordinator(uint64(l))
|
||||||
}
|
}
|
||||||
@ -1701,6 +1764,9 @@ func (m *NetworkConfigurationResponse) Size() (n int) {
|
|||||||
n += 1 + l + sovCoordinator(uint64(l))
|
n += 1 + l + sovCoordinator(uint64(l))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if m.CreationTimeUnix != 0 {
|
||||||
|
n += 1 + sovCoordinator(uint64(m.CreationTimeUnix))
|
||||||
|
}
|
||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1831,6 +1897,74 @@ func (m *SpaceSignRequest) Unmarshal(dAtA []byte) error {
|
|||||||
m.Header = []byte{}
|
m.Header = []byte{}
|
||||||
}
|
}
|
||||||
iNdEx = postIndex
|
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:
|
default:
|
||||||
iNdEx = preIndex
|
iNdEx = preIndex
|
||||||
skippy, err := skipCoordinator(dAtA[iNdEx:])
|
skippy, err := skipCoordinator(dAtA[iNdEx:])
|
||||||
@ -2963,7 +3097,7 @@ func (m *NetworkConfigurationRequest) Unmarshal(dAtA []byte) error {
|
|||||||
switch fieldNum {
|
switch fieldNum {
|
||||||
case 1:
|
case 1:
|
||||||
if wireType != 2 {
|
if wireType != 2 {
|
||||||
return fmt.Errorf("proto: wrong wireType = %d for field ConfigurationId", wireType)
|
return fmt.Errorf("proto: wrong wireType = %d for field CurrentId", wireType)
|
||||||
}
|
}
|
||||||
var stringLen uint64
|
var stringLen uint64
|
||||||
for shift := uint(0); ; shift += 7 {
|
for shift := uint(0); ; shift += 7 {
|
||||||
@ -2991,7 +3125,7 @@ func (m *NetworkConfigurationRequest) Unmarshal(dAtA []byte) error {
|
|||||||
if postIndex > l {
|
if postIndex > l {
|
||||||
return io.ErrUnexpectedEOF
|
return io.ErrUnexpectedEOF
|
||||||
}
|
}
|
||||||
m.ConfigurationId = string(dAtA[iNdEx:postIndex])
|
m.CurrentId = string(dAtA[iNdEx:postIndex])
|
||||||
iNdEx = postIndex
|
iNdEx = postIndex
|
||||||
default:
|
default:
|
||||||
iNdEx = preIndex
|
iNdEx = preIndex
|
||||||
@ -3109,6 +3243,25 @@ func (m *NetworkConfigurationResponse) Unmarshal(dAtA []byte) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
iNdEx = postIndex
|
iNdEx = postIndex
|
||||||
|
case 3:
|
||||||
|
if wireType != 0 {
|
||||||
|
return fmt.Errorf("proto: wrong wireType = %d for field CreationTimeUnix", wireType)
|
||||||
|
}
|
||||||
|
m.CreationTimeUnix = 0
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowCoordinator
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
m.CreationTimeUnix |= uint64(b&0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
iNdEx = preIndex
|
iNdEx = preIndex
|
||||||
skippy, err := skipCoordinator(dAtA[iNdEx:])
|
skippy, err := skipCoordinator(dAtA[iNdEx:])
|
||||||
|
|||||||
@ -24,8 +24,14 @@ service Coordinator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
message SpaceSignRequest {
|
message SpaceSignRequest {
|
||||||
|
// SpaceId is the id of the signed space
|
||||||
string spaceId = 1;
|
string spaceId = 1;
|
||||||
|
// Header is the header of the signed space
|
||||||
bytes header = 2;
|
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 {
|
enum ErrorCodes {
|
||||||
|
|||||||
4
go.mod
4
go.mod
@ -37,7 +37,6 @@ require (
|
|||||||
golang.org/x/exp v0.0.0-20230206171751-46f607a40771
|
golang.org/x/exp v0.0.0-20230206171751-46f607a40771
|
||||||
golang.org/x/net v0.8.0
|
golang.org/x/net v0.8.0
|
||||||
gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22
|
gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22
|
||||||
gopkg.in/yaml.v2 v2.4.0
|
|
||||||
storj.io/drpc v0.0.32
|
storj.io/drpc v0.0.32
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -76,9 +75,7 @@ require (
|
|||||||
github.com/jbenet/goprocess v0.1.4 // indirect
|
github.com/jbenet/goprocess v0.1.4 // indirect
|
||||||
github.com/klauspost/cpuid/v2 v2.2.3 // indirect
|
github.com/klauspost/cpuid/v2 v2.2.3 // indirect
|
||||||
github.com/libp2p/go-buffer-pool v0.1.0 // indirect
|
github.com/libp2p/go-buffer-pool v0.1.0 // indirect
|
||||||
github.com/libp2p/go-openssl v0.1.0 // indirect
|
|
||||||
github.com/mattn/go-isatty v0.0.17 // indirect
|
github.com/mattn/go-isatty v0.0.17 // indirect
|
||||||
github.com/mattn/go-pointer v0.0.1 // indirect
|
|
||||||
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
|
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
|
||||||
github.com/minio/sha256-simd v1.0.0 // indirect
|
github.com/minio/sha256-simd v1.0.0 // indirect
|
||||||
github.com/multiformats/go-base32 v0.1.0 // indirect
|
github.com/multiformats/go-base32 v0.1.0 // indirect
|
||||||
@ -94,7 +91,6 @@ require (
|
|||||||
github.com/prometheus/client_model v0.3.0 // indirect
|
github.com/prometheus/client_model v0.3.0 // indirect
|
||||||
github.com/prometheus/common v0.39.0 // indirect
|
github.com/prometheus/common v0.39.0 // indirect
|
||||||
github.com/prometheus/procfs v0.9.0 // indirect
|
github.com/prometheus/procfs v0.9.0 // indirect
|
||||||
github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 // indirect
|
|
||||||
github.com/spaolacci/murmur3 v1.1.0 // indirect
|
github.com/spaolacci/murmur3 v1.1.0 // indirect
|
||||||
github.com/whyrusleeping/cbor-gen v0.0.0-20230126041949-52956bd4c9aa // indirect
|
github.com/whyrusleeping/cbor-gen v0.0.0-20230126041949-52956bd4c9aa // indirect
|
||||||
github.com/whyrusleeping/chunker v0.0.0-20181014151217-fe64bd25879f // indirect
|
github.com/whyrusleeping/chunker v0.0.0-20181014151217-fe64bd25879f // indirect
|
||||||
|
|||||||
27
go.sum
27
go.sum
@ -117,13 +117,11 @@ github.com/ipfs/go-ipfs-ds-help v1.1.0/go.mod h1:YR5+6EaebOhfcqVCyqemItCLthrpVNo
|
|||||||
github.com/ipfs/go-ipfs-exchange-interface v0.2.0 h1:8lMSJmKogZYNo2jjhUs0izT+dck05pqUw4mWNW9Pw6Y=
|
github.com/ipfs/go-ipfs-exchange-interface v0.2.0 h1:8lMSJmKogZYNo2jjhUs0izT+dck05pqUw4mWNW9Pw6Y=
|
||||||
github.com/ipfs/go-ipfs-exchange-interface v0.2.0/go.mod h1:z6+RhJuDQbqKguVyslSOuVDhqF9JtTrO3eptSAiW2/Y=
|
github.com/ipfs/go-ipfs-exchange-interface v0.2.0/go.mod h1:z6+RhJuDQbqKguVyslSOuVDhqF9JtTrO3eptSAiW2/Y=
|
||||||
github.com/ipfs/go-ipfs-exchange-offline v0.3.0 h1:c/Dg8GDPzixGd0MC8Jh6mjOwU57uYokgWRFidfvEkuA=
|
github.com/ipfs/go-ipfs-exchange-offline v0.3.0 h1:c/Dg8GDPzixGd0MC8Jh6mjOwU57uYokgWRFidfvEkuA=
|
||||||
github.com/ipfs/go-ipfs-files v0.2.0 h1:z6MCYHQSZpDWpUSK59Kf0ajP1fi4gLCf6fIulVsp8A8=
|
|
||||||
github.com/ipfs/go-ipfs-files v0.2.0/go.mod h1:vT7uaQfIsprKktzbTPLnIsd+NGw9ZbYwSq0g3N74u0M=
|
|
||||||
github.com/ipfs/go-ipfs-files v0.3.0 h1:fallckyc5PYjuMEitPNrjRfpwl7YFt69heCOUhsbGxQ=
|
github.com/ipfs/go-ipfs-files v0.3.0 h1:fallckyc5PYjuMEitPNrjRfpwl7YFt69heCOUhsbGxQ=
|
||||||
github.com/ipfs/go-ipfs-files v0.3.0/go.mod h1:xAUtYMwB+iu/dtf6+muHNSFQCJG2dSiStR2P6sn9tIM=
|
github.com/ipfs/go-ipfs-files v0.3.0/go.mod h1:xAUtYMwB+iu/dtf6+muHNSFQCJG2dSiStR2P6sn9tIM=
|
||||||
github.com/ipfs/go-ipfs-posinfo v0.0.1 h1:Esoxj+1JgSjX0+ylc0hUmJCOv6V2vFoZiETLR6OtpRs=
|
github.com/ipfs/go-ipfs-posinfo v0.0.1 h1:Esoxj+1JgSjX0+ylc0hUmJCOv6V2vFoZiETLR6OtpRs=
|
||||||
github.com/ipfs/go-ipfs-posinfo v0.0.1/go.mod h1:SwyeVP+jCwiDu0C313l/8jg6ZxM0qqtlt2a0vILTc1A=
|
github.com/ipfs/go-ipfs-posinfo v0.0.1/go.mod h1:SwyeVP+jCwiDu0C313l/8jg6ZxM0qqtlt2a0vILTc1A=
|
||||||
github.com/ipfs/go-ipfs-pq v0.0.2 h1:e1vOOW6MuOwG2lqxcLA+wEn93i/9laCY8sXAw76jFOY=
|
github.com/ipfs/go-ipfs-pq v0.0.3 h1:YpoHVJB+jzK15mr/xsWC574tyDLkezVrDNeaalQBsTE=
|
||||||
github.com/ipfs/go-ipfs-routing v0.3.0 h1:9W/W3N+g+y4ZDeffSgqhgo7BsBSJwPMcyssET9OWevc=
|
github.com/ipfs/go-ipfs-routing v0.3.0 h1:9W/W3N+g+y4ZDeffSgqhgo7BsBSJwPMcyssET9OWevc=
|
||||||
github.com/ipfs/go-ipfs-util v0.0.1/go.mod h1:spsl5z8KUnrve+73pOhSVZND1SIxPW5RyBCNzQxlJBc=
|
github.com/ipfs/go-ipfs-util v0.0.1/go.mod h1:spsl5z8KUnrve+73pOhSVZND1SIxPW5RyBCNzQxlJBc=
|
||||||
github.com/ipfs/go-ipfs-util v0.0.2 h1:59Sswnk1MFaiq+VcaknX7aYEyGyGDAA73ilhEK2POp8=
|
github.com/ipfs/go-ipfs-util v0.0.2 h1:59Sswnk1MFaiq+VcaknX7aYEyGyGDAA73ilhEK2POp8=
|
||||||
@ -148,7 +146,7 @@ github.com/ipfs/go-merkledag v0.10.0 h1:IUQhj/kzTZfam4e+LnaEpoiZ9vZF6ldimVlby+6O
|
|||||||
github.com/ipfs/go-merkledag v0.10.0/go.mod h1:zkVav8KiYlmbzUzNM6kENzkdP5+qR7+2mCwxkQ6GIj8=
|
github.com/ipfs/go-merkledag v0.10.0/go.mod h1:zkVav8KiYlmbzUzNM6kENzkdP5+qR7+2mCwxkQ6GIj8=
|
||||||
github.com/ipfs/go-metrics-interface v0.0.1 h1:j+cpbjYvu4R8zbleSs36gvB7jR+wsL2fGD6n0jO4kdg=
|
github.com/ipfs/go-metrics-interface v0.0.1 h1:j+cpbjYvu4R8zbleSs36gvB7jR+wsL2fGD6n0jO4kdg=
|
||||||
github.com/ipfs/go-metrics-interface v0.0.1/go.mod h1:6s6euYU4zowdslK0GKHmqaIZ3j/b/tL7HTWtJ4VPgWY=
|
github.com/ipfs/go-metrics-interface v0.0.1/go.mod h1:6s6euYU4zowdslK0GKHmqaIZ3j/b/tL7HTWtJ4VPgWY=
|
||||||
github.com/ipfs/go-peertaskqueue v0.8.0 h1:JyNO144tfu9bx6Hpo119zvbEL9iQ760FHOiJYsUjqaU=
|
github.com/ipfs/go-peertaskqueue v0.8.1 h1:YhxAs1+wxb5jk7RvS0LHdyiILpNmRIRnZVztekOF0pg=
|
||||||
github.com/ipfs/go-unixfs v0.4.5 h1:wj8JhxvV1G6CD7swACwSKYa+NgtdWC1RUit+gFnymDU=
|
github.com/ipfs/go-unixfs v0.4.5 h1:wj8JhxvV1G6CD7swACwSKYa+NgtdWC1RUit+gFnymDU=
|
||||||
github.com/ipfs/go-unixfs v0.4.5/go.mod h1:BIznJNvt/gEx/ooRMI4Us9K8+qeGO7vx1ohnbk8gjFg=
|
github.com/ipfs/go-unixfs v0.4.5/go.mod h1:BIznJNvt/gEx/ooRMI4Us9K8+qeGO7vx1ohnbk8gjFg=
|
||||||
github.com/ipfs/go-verifcid v0.0.2 h1:XPnUv0XmdH+ZIhLGKg6U2vaPaRDXb9urMyNVCE7uvTs=
|
github.com/ipfs/go-verifcid v0.0.2 h1:XPnUv0XmdH+ZIhLGKg6U2vaPaRDXb9urMyNVCE7uvTs=
|
||||||
@ -173,8 +171,7 @@ github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+o
|
|||||||
github.com/klauspost/cpuid/v2 v2.0.4/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
|
github.com/klauspost/cpuid/v2 v2.0.4/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
|
||||||
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
|
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
|
||||||
github.com/klauspost/cpuid/v2 v2.0.12/go.mod h1:g2LTdtYhdyuGPqyWyv7qRAmj1WBqxuObKfj5c0PQa7c=
|
github.com/klauspost/cpuid/v2 v2.0.12/go.mod h1:g2LTdtYhdyuGPqyWyv7qRAmj1WBqxuObKfj5c0PQa7c=
|
||||||
github.com/klauspost/cpuid/v2 v2.2.2 h1:xPMwiykqNK9VK0NYC3+jTMYv9I6Vl3YdjZgPZKG3zO0=
|
github.com/klauspost/cpuid/v2 v2.2.3 h1:sxCkb+qR91z4vsqw4vGGZlDgPz3G7gjaLyK3V8y70BU=
|
||||||
github.com/klauspost/cpuid/v2 v2.2.2/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY=
|
|
||||||
github.com/klauspost/cpuid/v2 v2.2.3/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY=
|
github.com/klauspost/cpuid/v2 v2.2.3/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY=
|
||||||
github.com/koron/go-ssdp v0.0.3 h1:JivLMY45N76b4p/vsWGOKewBQu6uf39y8l+AQ7sDKx8=
|
github.com/koron/go-ssdp v0.0.3 h1:JivLMY45N76b4p/vsWGOKewBQu6uf39y8l+AQ7sDKx8=
|
||||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||||
@ -188,25 +185,20 @@ github.com/libp2p/go-buffer-pool v0.0.2/go.mod h1:MvaB6xw5vOrDl8rYZGLFdKAuk/hRoR
|
|||||||
github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6cdF0Y8=
|
github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6cdF0Y8=
|
||||||
github.com/libp2p/go-buffer-pool v0.1.0/go.mod h1:N+vh8gMqimBzdKkSMVuydVDq+UV5QTWy5HSiZacSbPg=
|
github.com/libp2p/go-buffer-pool v0.1.0/go.mod h1:N+vh8gMqimBzdKkSMVuydVDq+UV5QTWy5HSiZacSbPg=
|
||||||
github.com/libp2p/go-cidranger v1.1.0 h1:ewPN8EZ0dd1LSnrtuwd4709PXVcITVeuwbag38yPW7c=
|
github.com/libp2p/go-cidranger v1.1.0 h1:ewPN8EZ0dd1LSnrtuwd4709PXVcITVeuwbag38yPW7c=
|
||||||
github.com/libp2p/go-libp2p v0.24.1 h1:+lS4fqj7RF9egcPq9Yo3iqdRTcDMApzoBbQMhxtwOVw=
|
github.com/libp2p/go-libp2p v0.25.1 h1:YK+YDCHpYyTvitKWVxa5PfElgIpOONU01X5UcLEwJGA=
|
||||||
github.com/libp2p/go-libp2p v0.24.1/go.mod h1:5LJqbrqFsUzWrq70JHCYqjATlX4ey8Klpct3OEe8hSI=
|
|
||||||
github.com/libp2p/go-libp2p v0.25.1/go.mod h1:xnK9/1d9+jeQCVvi/f1g12KqtVi/jP/SijtKV1hML3g=
|
github.com/libp2p/go-libp2p v0.25.1/go.mod h1:xnK9/1d9+jeQCVvi/f1g12KqtVi/jP/SijtKV1hML3g=
|
||||||
github.com/libp2p/go-libp2p-asn-util v0.2.0 h1:rg3+Os8jbnO5DxkC7K/Utdi+DkY3q/d1/1q+8WeNAsw=
|
github.com/libp2p/go-libp2p-asn-util v0.2.0 h1:rg3+Os8jbnO5DxkC7K/Utdi+DkY3q/d1/1q+8WeNAsw=
|
||||||
github.com/libp2p/go-libp2p-record v0.2.0 h1:oiNUOCWno2BFuxt3my4i1frNrt7PerzB3queqa1NkQ0=
|
github.com/libp2p/go-libp2p-record v0.2.0 h1:oiNUOCWno2BFuxt3my4i1frNrt7PerzB3queqa1NkQ0=
|
||||||
github.com/libp2p/go-libp2p-testing v0.12.0 h1:EPvBb4kKMWO29qP4mZGyhVzUyR25dvfUIK5WDu6iPUA=
|
github.com/libp2p/go-libp2p-testing v0.12.0 h1:EPvBb4kKMWO29qP4mZGyhVzUyR25dvfUIK5WDu6iPUA=
|
||||||
github.com/libp2p/go-msgio v0.2.0 h1:W6shmB+FeynDrUVl2dgFQvzfBZcXiyqY4VmpQLu9FqU=
|
github.com/libp2p/go-msgio v0.3.0 h1:mf3Z8B1xcFN314sWX+2vOTShIE0Mmn2TXn3YCUQGNj0=
|
||||||
github.com/libp2p/go-nat v0.1.0 h1:MfVsH6DLcpa04Xr+p8hmVRG4juse0s3J8HyNWYHffXg=
|
github.com/libp2p/go-nat v0.1.0 h1:MfVsH6DLcpa04Xr+p8hmVRG4juse0s3J8HyNWYHffXg=
|
||||||
github.com/libp2p/go-netroute v0.2.1 h1:V8kVrpD8GK0Riv15/7VN6RbUQ3URNZVosw7H2v9tksU=
|
github.com/libp2p/go-netroute v0.2.1 h1:V8kVrpD8GK0Riv15/7VN6RbUQ3URNZVosw7H2v9tksU=
|
||||||
github.com/libp2p/go-openssl v0.1.0 h1:LBkKEcUv6vtZIQLVTegAil8jbNpJErQ9AnT+bWV+Ooo=
|
|
||||||
github.com/libp2p/go-openssl v0.1.0/go.mod h1:OiOxwPpL3n4xlenjx2h7AwSGaFSC/KZvf6gNdOBQMtc=
|
|
||||||
github.com/libp2p/go-yamux/v4 v4.0.0 h1:+Y80dV2Yx/kv7Y7JKu0LECyVdMXm1VUoko+VQ9rBfZQ=
|
github.com/libp2p/go-yamux/v4 v4.0.0 h1:+Y80dV2Yx/kv7Y7JKu0LECyVdMXm1VUoko+VQ9rBfZQ=
|
||||||
github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ=
|
github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ=
|
||||||
github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
|
github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
|
||||||
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
|
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
|
||||||
github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng=
|
github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng=
|
||||||
github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
|
github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
|
||||||
github.com/mattn/go-pointer v0.0.1 h1:n+XhsuGeVO6MEAp7xyEukFINEa+Quek5psIR/ylA6o0=
|
|
||||||
github.com/mattn/go-pointer v0.0.1/go.mod h1:2zXcozF6qYGgmsG+SeTZz3oAbFLdD3OWqnUbNvJZAlc=
|
|
||||||
github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo=
|
github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo=
|
||||||
github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4=
|
github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4=
|
||||||
github.com/miekg/dns v1.1.50 h1:DQUfb9uc6smULcREF09Uc+/Gd46YWqJd5DbpPE9xkcA=
|
github.com/miekg/dns v1.1.50 h1:DQUfb9uc6smULcREF09Uc+/Gd46YWqJd5DbpPE9xkcA=
|
||||||
@ -243,8 +235,7 @@ github.com/multiformats/go-multihash v0.0.14/go.mod h1:VdAWLKTwram9oKAatUcLxBNUj
|
|||||||
github.com/multiformats/go-multihash v0.0.15/go.mod h1:D6aZrWNLFTV/ynMpKsNtB40mJzmCl4jb1alC0OvHiHg=
|
github.com/multiformats/go-multihash v0.0.15/go.mod h1:D6aZrWNLFTV/ynMpKsNtB40mJzmCl4jb1alC0OvHiHg=
|
||||||
github.com/multiformats/go-multihash v0.2.1 h1:aem8ZT0VA2nCHHk7bPJ1BjUbHNciqZC/d16Vve9l108=
|
github.com/multiformats/go-multihash v0.2.1 h1:aem8ZT0VA2nCHHk7bPJ1BjUbHNciqZC/d16Vve9l108=
|
||||||
github.com/multiformats/go-multihash v0.2.1/go.mod h1:WxoMcYG85AZVQUyRyo9s4wULvW5qrI9vb2Lt6evduFc=
|
github.com/multiformats/go-multihash v0.2.1/go.mod h1:WxoMcYG85AZVQUyRyo9s4wULvW5qrI9vb2Lt6evduFc=
|
||||||
github.com/multiformats/go-multistream v0.3.3 h1:d5PZpjwRgVlbwfdTDjife7XszfZd8KYWfROYFlGcR8o=
|
github.com/multiformats/go-multistream v0.4.1 h1:rFy0Iiyn3YT0asivDUIR05leAdwZq3de4741sbiSdfo=
|
||||||
github.com/multiformats/go-multistream v0.3.3/go.mod h1:ODRoqamLUsETKS9BNcII4gcRsJBU5VAwRIv7O39cEXg=
|
|
||||||
github.com/multiformats/go-multistream v0.4.1/go.mod h1:Mz5eykRVAjJWckE2U78c6xqdtyNUEhKSM0Lwar2p77Q=
|
github.com/multiformats/go-multistream v0.4.1/go.mod h1:Mz5eykRVAjJWckE2U78c6xqdtyNUEhKSM0Lwar2p77Q=
|
||||||
github.com/multiformats/go-varint v0.0.5/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE=
|
github.com/multiformats/go-varint v0.0.5/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE=
|
||||||
github.com/multiformats/go-varint v0.0.6/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE=
|
github.com/multiformats/go-varint v0.0.6/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE=
|
||||||
@ -282,8 +273,6 @@ github.com/smartystreets/goconvey v0.0.0-20190222223459-a17d461953aa/go.mod h1:2
|
|||||||
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
|
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
|
||||||
github.com/smartystreets/goconvey v1.7.2 h1:9RBaZCeXEQ3UselpuwUQHltGVXvdwm6cv1hgR6gDIPg=
|
github.com/smartystreets/goconvey v1.7.2 h1:9RBaZCeXEQ3UselpuwUQHltGVXvdwm6cv1hgR6gDIPg=
|
||||||
github.com/smartystreets/goconvey v1.7.2/go.mod h1:Vw0tHAZW6lzCRk3xgdin6fKYcG+G3Pg9vgXWeJpQFMM=
|
github.com/smartystreets/goconvey v1.7.2/go.mod h1:Vw0tHAZW6lzCRk3xgdin6fKYcG+G3Pg9vgXWeJpQFMM=
|
||||||
github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 h1:RC6RW7j+1+HkWaX/Yh71Ee5ZHaHYt7ZP4sQgUrm6cDU=
|
|
||||||
github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572/go.mod h1:w0SWMsp6j9O/dk4/ZpIhL+3CkG8ofA2vuv7k+ltqUMc=
|
|
||||||
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
|
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
|
||||||
github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI=
|
github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI=
|
||||||
github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
|
github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
|
||||||
@ -306,8 +295,7 @@ github.com/warpfork/go-wish v0.0.0-20200122115046-b9ea61034e4a/go.mod h1:x6AKhvS
|
|||||||
github.com/warpfork/go-wish v0.0.0-20220906213052-39a1cc7a02d0 h1:GDDkbFiaK8jsSDJfjId/PEGEShv6ugrt4kYsC5UIDaQ=
|
github.com/warpfork/go-wish v0.0.0-20220906213052-39a1cc7a02d0 h1:GDDkbFiaK8jsSDJfjId/PEGEShv6ugrt4kYsC5UIDaQ=
|
||||||
github.com/warpfork/go-wish v0.0.0-20220906213052-39a1cc7a02d0/go.mod h1:x6AKhvSSexNrVSrViXSHUEbICjmGXhtgABaHIySUSGw=
|
github.com/warpfork/go-wish v0.0.0-20220906213052-39a1cc7a02d0/go.mod h1:x6AKhvSSexNrVSrViXSHUEbICjmGXhtgABaHIySUSGw=
|
||||||
github.com/whyrusleeping/cbor-gen v0.0.0-20200123233031-1cdf64d27158/go.mod h1:Xj/M2wWU+QdTdRbu/L/1dIZY8/Wb2K9pAhtroQuxJJI=
|
github.com/whyrusleeping/cbor-gen v0.0.0-20200123233031-1cdf64d27158/go.mod h1:Xj/M2wWU+QdTdRbu/L/1dIZY8/Wb2K9pAhtroQuxJJI=
|
||||||
github.com/whyrusleeping/cbor-gen v0.0.0-20221220214510-0333c149dec0 h1:obKzQ1ey5AJg5NKjgtTo/CKwLImVP4ETLRcsmzFJ4Qw=
|
github.com/whyrusleeping/cbor-gen v0.0.0-20230126041949-52956bd4c9aa h1:EyA027ZAkuaCLoxVX4r1TZMPy1d31fM6hbfQ4OU4I5o=
|
||||||
github.com/whyrusleeping/cbor-gen v0.0.0-20221220214510-0333c149dec0/go.mod h1:fgkXqYy7bV2cFeIEOkVTZS/WjXARfBqSH6Q2qHL33hQ=
|
|
||||||
github.com/whyrusleeping/cbor-gen v0.0.0-20230126041949-52956bd4c9aa/go.mod h1:fgkXqYy7bV2cFeIEOkVTZS/WjXARfBqSH6Q2qHL33hQ=
|
github.com/whyrusleeping/cbor-gen v0.0.0-20230126041949-52956bd4c9aa/go.mod h1:fgkXqYy7bV2cFeIEOkVTZS/WjXARfBqSH6Q2qHL33hQ=
|
||||||
github.com/whyrusleeping/chunker v0.0.0-20181014151217-fe64bd25879f h1:jQa4QT2UP9WYv2nzyawpKMOCl+Z/jW7djv2/J50lj9E=
|
github.com/whyrusleeping/chunker v0.0.0-20181014151217-fe64bd25879f h1:jQa4QT2UP9WYv2nzyawpKMOCl+Z/jW7djv2/J50lj9E=
|
||||||
github.com/whyrusleeping/chunker v0.0.0-20181014151217-fe64bd25879f/go.mod h1:p9UJB6dDgdPgMJZs7UjUOdulKyRr9fqkS+6JKAInPy8=
|
github.com/whyrusleeping/chunker v0.0.0-20181014151217-fe64bd25879f/go.mod h1:p9UJB6dDgdPgMJZs7UjUOdulKyRr9fqkS+6JKAInPy8=
|
||||||
@ -450,7 +438,6 @@ gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22/go.mod h1:yeKp02qBN3iKW1OzL3M
|
|||||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
|
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
|
||||||
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
|
||||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||||
|
|||||||
@ -42,6 +42,7 @@ type Dialer interface {
|
|||||||
type dialer struct {
|
type dialer struct {
|
||||||
transport secureservice.SecureService
|
transport secureservice.SecureService
|
||||||
config net2.Config
|
config net2.Config
|
||||||
|
nodeConf nodeconf.NodeConf
|
||||||
peerAddrs map[string][]string
|
peerAddrs map[string][]string
|
||||||
|
|
||||||
mu sync.RWMutex
|
mu sync.RWMutex
|
||||||
@ -49,7 +50,7 @@ type dialer struct {
|
|||||||
|
|
||||||
func (d *dialer) Init(a *app.App) (err error) {
|
func (d *dialer) Init(a *app.App) (err error) {
|
||||||
d.transport = a.MustComponent(secureservice.CName).(secureservice.SecureService)
|
d.transport = a.MustComponent(secureservice.CName).(secureservice.SecureService)
|
||||||
d.peerAddrs = a.MustComponent(nodeconf.CName).(nodeconf.Service).GetLast().Addresses()
|
d.nodeConf = a.MustComponent(nodeconf.CName).(nodeconf.NodeConf)
|
||||||
d.config = a.MustComponent("config").(net2.ConfigGetter).GetNet()
|
d.config = a.MustComponent("config").(net2.ConfigGetter).GetNet()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -73,6 +74,17 @@ func (d *dialer) SetPeerAddrs(peerId string, addrs []string) {
|
|||||||
d.peerAddrs[peerId] = addrs
|
d.peerAddrs[peerId] = addrs
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (d *dialer) getPeerAddrs(peerId string) ([]string, error) {
|
||||||
|
if addrs, ok := d.nodeConf.PeerAddresses(peerId); ok {
|
||||||
|
return addrs, nil
|
||||||
|
}
|
||||||
|
addrs, ok := d.peerAddrs[peerId]
|
||||||
|
if !ok || len(addrs) == 0 {
|
||||||
|
return nil, ErrArrdsNotFound
|
||||||
|
}
|
||||||
|
return addrs, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (d *dialer) Dial(ctx context.Context, peerId string) (p peer.Peer, err error) {
|
func (d *dialer) Dial(ctx context.Context, peerId string) (p peer.Peer, err error) {
|
||||||
var ctxCancel context.CancelFunc
|
var ctxCancel context.CancelFunc
|
||||||
ctx, ctxCancel = context.WithTimeout(ctx, time.Second*10)
|
ctx, ctxCancel = context.WithTimeout(ctx, time.Second*10)
|
||||||
@ -80,10 +92,11 @@ func (d *dialer) Dial(ctx context.Context, peerId string) (p peer.Peer, err erro
|
|||||||
d.mu.RLock()
|
d.mu.RLock()
|
||||||
defer d.mu.RUnlock()
|
defer d.mu.RUnlock()
|
||||||
|
|
||||||
addrs, ok := d.peerAddrs[peerId]
|
addrs, err := d.getPeerAddrs(peerId)
|
||||||
if !ok || len(addrs) == 0 {
|
if err != nil {
|
||||||
return nil, ErrArrdsNotFound
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
conn drpc.Conn
|
conn drpc.Conn
|
||||||
sc sec.SecureConn
|
sc sec.SecureConn
|
||||||
|
|||||||
@ -70,7 +70,7 @@ func (s *secureService) Init(a *app.App) (err error) {
|
|||||||
s.nodeconf = a.MustComponent(nodeconf.CName).(nodeconf.Service)
|
s.nodeconf = a.MustComponent(nodeconf.CName).(nodeconf.Service)
|
||||||
|
|
||||||
s.inboundChecker = s.noVerifyChecker
|
s.inboundChecker = s.noVerifyChecker
|
||||||
confTypes := s.nodeconf.GetLast().NodeTypes(account.Account().PeerId)
|
confTypes := s.nodeconf.NodeTypes(account.Account().PeerId)
|
||||||
if len(confTypes) > 0 {
|
if len(confTypes) > 0 {
|
||||||
// require identity verification if we are node
|
// require identity verification if we are node
|
||||||
s.inboundChecker = s.peerSignVerifier
|
s.inboundChecker = s.peerSignVerifier
|
||||||
@ -116,7 +116,7 @@ func (s *secureService) SecureOutbound(ctx context.Context, conn net.Conn) (sec.
|
|||||||
return nil, HandshakeError{err: err, remoteAddr: conn.RemoteAddr().String()}
|
return nil, HandshakeError{err: err, remoteAddr: conn.RemoteAddr().String()}
|
||||||
}
|
}
|
||||||
peerId := sc.RemotePeer().String()
|
peerId := sc.RemotePeer().String()
|
||||||
confTypes := s.nodeconf.GetLast().NodeTypes(peerId)
|
confTypes := s.nodeconf.NodeTypes(peerId)
|
||||||
var checker handshake.CredentialChecker
|
var checker handshake.CredentialChecker
|
||||||
if len(confTypes) > 0 {
|
if len(confTypes) > 0 {
|
||||||
checker = s.peerSignVerifier
|
checker = s.peerSignVerifier
|
||||||
|
|||||||
@ -22,7 +22,7 @@ type NodeConf interface {
|
|||||||
// CoordinatorPeers returns list of coordinator nodes
|
// CoordinatorPeers returns list of coordinator nodes
|
||||||
CoordinatorPeers() []string
|
CoordinatorPeers() []string
|
||||||
// Addresses returns map[peerId][]addr with connection addresses for all known nodes
|
// Addresses returns map[peerId][]addr with connection addresses for all known nodes
|
||||||
Addresses() map[string][]string
|
PeerAddresses(peerId string) (addrs []string, ok bool)
|
||||||
// CHash returns nodes consistent table
|
// CHash returns nodes consistent table
|
||||||
CHash() chash.CHash
|
CHash() chash.CHash
|
||||||
// Partition returns partition number by spaceId
|
// Partition returns partition number by spaceId
|
||||||
@ -40,6 +40,7 @@ type nodeConf struct {
|
|||||||
chash chash.CHash
|
chash chash.CHash
|
||||||
allMembers []Node
|
allMembers []Node
|
||||||
c Configuration
|
c Configuration
|
||||||
|
addrs map[string][]string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *nodeConf) Id() string {
|
func (c *nodeConf) Id() string {
|
||||||
@ -82,12 +83,9 @@ func (c *nodeConf) CoordinatorPeers() []string {
|
|||||||
return c.coordinatorPeers
|
return c.coordinatorPeers
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *nodeConf) Addresses() map[string][]string {
|
func (c *nodeConf) PeerAddresses(peerId string) (addrs []string, ok bool) {
|
||||||
res := make(map[string][]string)
|
addrs, ok = c.addrs[peerId]
|
||||||
for _, m := range c.allMembers {
|
return
|
||||||
res[m.PeerId] = m.Addresses
|
|
||||||
}
|
|
||||||
return res
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *nodeConf) CHash() chash.CHash {
|
func (c *nodeConf) CHash() chash.CHash {
|
||||||
|
|||||||
@ -54,6 +54,7 @@ func (s *service) setLastConfiguration(c Configuration) (err error) {
|
|||||||
id: c.Id,
|
id: c.Id,
|
||||||
c: c,
|
c: c,
|
||||||
accountId: s.accountId,
|
accountId: s.accountId,
|
||||||
|
addrs: map[string][]string{},
|
||||||
}
|
}
|
||||||
if nc.chash, err = chash.New(chash.Config{
|
if nc.chash, err = chash.New(chash.Config{
|
||||||
PartitionCount: PartitionCount,
|
PartitionCount: PartitionCount,
|
||||||
@ -77,6 +78,7 @@ func (s *service) setLastConfiguration(c Configuration) (err error) {
|
|||||||
nc.coordinatorPeers = append(nc.coordinatorPeers, n.PeerId)
|
nc.coordinatorPeers = append(nc.coordinatorPeers, n.PeerId)
|
||||||
}
|
}
|
||||||
nc.allMembers = append(nc.allMembers, n)
|
nc.allMembers = append(nc.allMembers, n)
|
||||||
|
nc.addrs[n.PeerId] = n.Addresses
|
||||||
}
|
}
|
||||||
if err = nc.chash.AddMembers(members...); err != nil {
|
if err = nc.chash.AddMembers(members...); err != nil {
|
||||||
return
|
return
|
||||||
@ -132,10 +134,10 @@ func (s *service) CoordinatorPeers() []string {
|
|||||||
return s.last.CoordinatorPeers()
|
return s.last.CoordinatorPeers()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *service) Addresses() map[string][]string {
|
func (s *service) PeerAddresses(peerId string) ([]string, bool) {
|
||||||
s.mu.RLock()
|
s.mu.RLock()
|
||||||
defer s.mu.RUnlock()
|
defer s.mu.RUnlock()
|
||||||
return s.last.Addresses()
|
return s.last.PeerAddresses(peerId)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *service) CHash() chash.CHash {
|
func (s *service) CHash() chash.CHash {
|
||||||
|
|||||||
@ -5,7 +5,6 @@ import (
|
|||||||
"github.com/anytypeio/any-sync/app"
|
"github.com/anytypeio/any-sync/app"
|
||||||
"github.com/anytypeio/any-sync/commonspace/object/accountdata"
|
"github.com/anytypeio/any-sync/commonspace/object/accountdata"
|
||||||
"github.com/anytypeio/any-sync/nodeconf"
|
"github.com/anytypeio/any-sync/nodeconf"
|
||||||
"github.com/anytypeio/any-sync/nodeconf/nodeconfstore"
|
|
||||||
"github.com/anytypeio/any-sync/util/crypto"
|
"github.com/anytypeio/any-sync/util/crypto"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -48,8 +47,8 @@ func (s *AccountTestService) Account() *accountdata.AccountKeys {
|
|||||||
return s.acc
|
return s.acc
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *AccountTestService) NodeConf(addrs []string) nodeconfstore.NodeConfig {
|
func (s *AccountTestService) NodeConf(addrs []string) nodeconf.Node {
|
||||||
return nodeconfstore.NodeConfig{
|
return nodeconf.Node{
|
||||||
PeerId: s.acc.PeerId,
|
PeerId: s.acc.PeerId,
|
||||||
Addresses: addrs,
|
Addresses: addrs,
|
||||||
Types: []nodeconf.NodeType{nodeconf.NodeTypeTree},
|
Types: []nodeconf.NodeType{nodeconf.NodeTypeTree},
|
||||||
|
|||||||
@ -3,7 +3,7 @@ package testnodeconf
|
|||||||
import (
|
import (
|
||||||
"github.com/anytypeio/any-sync/accountservice"
|
"github.com/anytypeio/any-sync/accountservice"
|
||||||
"github.com/anytypeio/any-sync/app"
|
"github.com/anytypeio/any-sync/app"
|
||||||
"github.com/anytypeio/any-sync/nodeconf/nodeconfstore"
|
"github.com/anytypeio/any-sync/nodeconf"
|
||||||
"github.com/anytypeio/any-sync/testutil/accounttest"
|
"github.com/anytypeio/any-sync/testutil/accounttest"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -17,14 +17,14 @@ func GenNodeConfig(num int) (conf *Config) {
|
|||||||
if err := ac.Init(nil); err != nil {
|
if err := ac.Init(nil); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
conf.nodes = append(conf.nodes, ac.NodeConf(nil))
|
conf.nodes.Nodes = append(conf.nodes.Nodes, ac.NodeConf(nil))
|
||||||
conf.configs = append(conf.configs, ac)
|
conf.configs = append(conf.configs, ac)
|
||||||
}
|
}
|
||||||
return conf
|
return conf
|
||||||
}
|
}
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
nodes []nodeconfstore.NodeConfig
|
nodes nodeconf.Configuration
|
||||||
configs []*accounttest.AccountTestService
|
configs []*accounttest.AccountTestService
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ func (c *Config) GetNodesConfId() string {
|
|||||||
return "test"
|
return "test"
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Config) GetNodes() []nodeconfstore.NodeConfig {
|
func (c *Config) GetNodeConf() nodeconf.Configuration {
|
||||||
return c.nodes
|
return c.nodes
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -50,28 +50,6 @@ func (KeyType) EnumDescriptor() ([]byte, []int) {
|
|||||||
return fileDescriptor_ddfeb19e486561de, []int{0}
|
return fileDescriptor_ddfeb19e486561de, []int{0}
|
||||||
}
|
}
|
||||||
|
|
||||||
type DerivationMethod int32
|
|
||||||
|
|
||||||
const (
|
|
||||||
DerivationMethod_Slip21 DerivationMethod = 0
|
|
||||||
)
|
|
||||||
|
|
||||||
var DerivationMethod_name = map[int32]string{
|
|
||||||
0: "Slip21",
|
|
||||||
}
|
|
||||||
|
|
||||||
var DerivationMethod_value = map[string]int32{
|
|
||||||
"Slip21": 0,
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x DerivationMethod) String() string {
|
|
||||||
return proto.EnumName(DerivationMethod_name, int32(x))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (DerivationMethod) EnumDescriptor() ([]byte, []int) {
|
|
||||||
return fileDescriptor_ddfeb19e486561de, []int{1}
|
|
||||||
}
|
|
||||||
|
|
||||||
type Key struct {
|
type Key struct {
|
||||||
Type KeyType `protobuf:"varint,1,opt,name=Type,proto3,enum=crypto.KeyType" json:"Type,omitempty"`
|
Type KeyType `protobuf:"varint,1,opt,name=Type,proto3,enum=crypto.KeyType" json:"Type,omitempty"`
|
||||||
Data []byte `protobuf:"bytes,2,opt,name=Data,proto3" json:"Data,omitempty"`
|
Data []byte `protobuf:"bytes,2,opt,name=Data,proto3" json:"Data,omitempty"`
|
||||||
@ -124,63 +102,9 @@ func (m *Key) GetData() []byte {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
type KeyDerivation struct {
|
|
||||||
Method DerivationMethod `protobuf:"varint,1,opt,name=method,proto3,enum=crypto.DerivationMethod" json:"method,omitempty"`
|
|
||||||
DerivationPath string `protobuf:"bytes,2,opt,name=derivationPath,proto3" json:"derivationPath,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *KeyDerivation) Reset() { *m = KeyDerivation{} }
|
|
||||||
func (m *KeyDerivation) String() string { return proto.CompactTextString(m) }
|
|
||||||
func (*KeyDerivation) ProtoMessage() {}
|
|
||||||
func (*KeyDerivation) Descriptor() ([]byte, []int) {
|
|
||||||
return fileDescriptor_ddfeb19e486561de, []int{1}
|
|
||||||
}
|
|
||||||
func (m *KeyDerivation) XXX_Unmarshal(b []byte) error {
|
|
||||||
return m.Unmarshal(b)
|
|
||||||
}
|
|
||||||
func (m *KeyDerivation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
|
||||||
if deterministic {
|
|
||||||
return xxx_messageInfo_KeyDerivation.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 *KeyDerivation) XXX_Merge(src proto.Message) {
|
|
||||||
xxx_messageInfo_KeyDerivation.Merge(m, src)
|
|
||||||
}
|
|
||||||
func (m *KeyDerivation) XXX_Size() int {
|
|
||||||
return m.Size()
|
|
||||||
}
|
|
||||||
func (m *KeyDerivation) XXX_DiscardUnknown() {
|
|
||||||
xxx_messageInfo_KeyDerivation.DiscardUnknown(m)
|
|
||||||
}
|
|
||||||
|
|
||||||
var xxx_messageInfo_KeyDerivation proto.InternalMessageInfo
|
|
||||||
|
|
||||||
func (m *KeyDerivation) GetMethod() DerivationMethod {
|
|
||||||
if m != nil {
|
|
||||||
return m.Method
|
|
||||||
}
|
|
||||||
return DerivationMethod_Slip21
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *KeyDerivation) GetDerivationPath() string {
|
|
||||||
if m != nil {
|
|
||||||
return m.DerivationPath
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
proto.RegisterEnum("crypto.KeyType", KeyType_name, KeyType_value)
|
proto.RegisterEnum("crypto.KeyType", KeyType_name, KeyType_value)
|
||||||
proto.RegisterEnum("crypto.DerivationMethod", DerivationMethod_name, DerivationMethod_value)
|
|
||||||
proto.RegisterType((*Key)(nil), "crypto.Key")
|
proto.RegisterType((*Key)(nil), "crypto.Key")
|
||||||
proto.RegisterType((*KeyDerivation)(nil), "crypto.KeyDerivation")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@ -188,24 +112,19 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var fileDescriptor_ddfeb19e486561de = []byte{
|
var fileDescriptor_ddfeb19e486561de = []byte{
|
||||||
// 263 bytes of a gzipped FileDescriptorProto
|
// 191 bytes of a gzipped FileDescriptorProto
|
||||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xd2, 0x2e, 0x2d, 0xc9, 0xcc,
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xd2, 0x2e, 0x2d, 0xc9, 0xcc,
|
||||||
0xd1, 0x4f, 0x2e, 0xaa, 0x2c, 0x28, 0xc9, 0x87, 0x52, 0x05, 0x45, 0xf9, 0x25, 0xf9, 0xfa, 0x60,
|
0xd1, 0x4f, 0x2e, 0xaa, 0x2c, 0x28, 0xc9, 0x87, 0x52, 0x05, 0x45, 0xf9, 0x25, 0xf9, 0xfa, 0x60,
|
||||||
0xb2, 0x18, 0x2a, 0xa4, 0x07, 0xe6, 0x09, 0xb1, 0x41, 0x78, 0x4a, 0x76, 0x5c, 0xcc, 0xde, 0xa9,
|
0xb2, 0x18, 0x2a, 0xa4, 0x07, 0xe6, 0x09, 0xb1, 0x41, 0x78, 0x4a, 0x76, 0x5c, 0xcc, 0xde, 0xa9,
|
||||||
0x95, 0x42, 0xca, 0x5c, 0x2c, 0x21, 0x95, 0x05, 0xa9, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0x7c, 0x46,
|
0x95, 0x42, 0xca, 0x5c, 0x2c, 0x21, 0x95, 0x05, 0xa9, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0x7c, 0x46,
|
||||||
0xfc, 0x7a, 0x50, 0xb5, 0xde, 0xa9, 0x95, 0x20, 0xe1, 0x20, 0xb0, 0xa4, 0x90, 0x10, 0x17, 0x8b,
|
0xfc, 0x7a, 0x50, 0xb5, 0xde, 0xa9, 0x95, 0x20, 0xe1, 0x20, 0xb0, 0xa4, 0x90, 0x10, 0x17, 0x8b,
|
||||||
0x4b, 0x62, 0x49, 0xa2, 0x04, 0x93, 0x02, 0xa3, 0x06, 0x4f, 0x10, 0x98, 0xad, 0x94, 0xc9, 0xc5,
|
0x4b, 0x62, 0x49, 0xa2, 0x04, 0x93, 0x02, 0xa3, 0x06, 0x4f, 0x10, 0x98, 0xad, 0x65, 0xc9, 0xc5,
|
||||||
0xeb, 0x9d, 0x5a, 0xe9, 0x92, 0x5a, 0x94, 0x59, 0x96, 0x58, 0x92, 0x99, 0x9f, 0x27, 0x64, 0xc0,
|
0x0e, 0x55, 0x24, 0x24, 0xc8, 0xc5, 0xeb, 0x9a, 0x62, 0x64, 0x6a, 0x6a, 0x68, 0x19, 0x50, 0x9a,
|
||||||
0xc5, 0x96, 0x9b, 0x5a, 0x92, 0x91, 0x9f, 0x02, 0x35, 0x4b, 0x02, 0x66, 0x16, 0x42, 0x8d, 0x2f,
|
0x94, 0x93, 0x99, 0x2c, 0xc0, 0x20, 0x24, 0xc4, 0xc5, 0x07, 0x13, 0x2a, 0xca, 0x2c, 0x4b, 0x2c,
|
||||||
0x58, 0x3e, 0x08, 0xaa, 0x4e, 0x48, 0x8d, 0x8b, 0x2f, 0x05, 0x2e, 0x17, 0x90, 0x58, 0x92, 0x01,
|
0x49, 0x15, 0x60, 0x14, 0x62, 0xe7, 0x62, 0x76, 0x74, 0x0d, 0x16, 0x60, 0x72, 0x32, 0x3c, 0xf1,
|
||||||
0xb6, 0x80, 0x33, 0x08, 0x4d, 0x54, 0xcb, 0x92, 0x8b, 0x1d, 0xea, 0x1e, 0x21, 0x41, 0x2e, 0x5e,
|
0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x07, 0x8f, 0xe4, 0x18, 0x27, 0x3c, 0x96, 0x63, 0xb8,
|
||||||
0xd7, 0x14, 0x23, 0x53, 0x53, 0x43, 0xcb, 0x80, 0xd2, 0xa4, 0x9c, 0xcc, 0x64, 0x01, 0x06, 0x21,
|
0xf0, 0x58, 0x8e, 0xe1, 0xc6, 0x63, 0x39, 0x86, 0x28, 0x71, 0x1c, 0x3e, 0x49, 0x62, 0x03, 0x53,
|
||||||
0x21, 0x2e, 0x3e, 0x98, 0x10, 0x58, 0x57, 0xaa, 0x00, 0xa3, 0x10, 0x3b, 0x17, 0xb3, 0xa3, 0x6b,
|
0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x27, 0xb9, 0xba, 0xd8, 0xeb, 0x00, 0x00, 0x00,
|
||||||
0xb0, 0x00, 0x93, 0x96, 0x1c, 0x97, 0x00, 0xba, 0xf5, 0x42, 0x5c, 0x5c, 0x6c, 0xc1, 0x39, 0x99,
|
|
||||||
0x05, 0x46, 0x86, 0x02, 0x0c, 0x4e, 0x86, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0xf8,
|
|
||||||
0xe0, 0x91, 0x1c, 0xe3, 0x84, 0xc7, 0x72, 0x0c, 0x17, 0x1e, 0xcb, 0x31, 0xdc, 0x78, 0x2c, 0xc7,
|
|
||||||
0x10, 0x25, 0x8e, 0x23, 0x50, 0x93, 0xd8, 0xc0, 0x94, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0x65,
|
|
||||||
0xdf, 0xa5, 0x11, 0x76, 0x01, 0x00, 0x00,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Key) Marshal() (dAtA []byte, err error) {
|
func (m *Key) Marshal() (dAtA []byte, err error) {
|
||||||
@ -243,41 +162,6 @@ func (m *Key) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
|||||||
return len(dAtA) - i, nil
|
return len(dAtA) - i, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *KeyDerivation) 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 *KeyDerivation) MarshalTo(dAtA []byte) (int, error) {
|
|
||||||
size := m.Size()
|
|
||||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *KeyDerivation) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
|
||||||
i := len(dAtA)
|
|
||||||
_ = i
|
|
||||||
var l int
|
|
||||||
_ = l
|
|
||||||
if len(m.DerivationPath) > 0 {
|
|
||||||
i -= len(m.DerivationPath)
|
|
||||||
copy(dAtA[i:], m.DerivationPath)
|
|
||||||
i = encodeVarintCrypto(dAtA, i, uint64(len(m.DerivationPath)))
|
|
||||||
i--
|
|
||||||
dAtA[i] = 0x12
|
|
||||||
}
|
|
||||||
if m.Method != 0 {
|
|
||||||
i = encodeVarintCrypto(dAtA, i, uint64(m.Method))
|
|
||||||
i--
|
|
||||||
dAtA[i] = 0x8
|
|
||||||
}
|
|
||||||
return len(dAtA) - i, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func encodeVarintCrypto(dAtA []byte, offset int, v uint64) int {
|
func encodeVarintCrypto(dAtA []byte, offset int, v uint64) int {
|
||||||
offset -= sovCrypto(v)
|
offset -= sovCrypto(v)
|
||||||
base := offset
|
base := offset
|
||||||
@ -305,22 +189,6 @@ func (m *Key) Size() (n int) {
|
|||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *KeyDerivation) Size() (n int) {
|
|
||||||
if m == nil {
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
var l int
|
|
||||||
_ = l
|
|
||||||
if m.Method != 0 {
|
|
||||||
n += 1 + sovCrypto(uint64(m.Method))
|
|
||||||
}
|
|
||||||
l = len(m.DerivationPath)
|
|
||||||
if l > 0 {
|
|
||||||
n += 1 + l + sovCrypto(uint64(l))
|
|
||||||
}
|
|
||||||
return n
|
|
||||||
}
|
|
||||||
|
|
||||||
func sovCrypto(x uint64) (n int) {
|
func sovCrypto(x uint64) (n int) {
|
||||||
return (math_bits.Len64(x|1) + 6) / 7
|
return (math_bits.Len64(x|1) + 6) / 7
|
||||||
}
|
}
|
||||||
@ -430,107 +298,6 @@ func (m *Key) Unmarshal(dAtA []byte) error {
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
func (m *KeyDerivation) 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 ErrIntOverflowCrypto
|
|
||||||
}
|
|
||||||
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: KeyDerivation: wiretype end group for non-group")
|
|
||||||
}
|
|
||||||
if fieldNum <= 0 {
|
|
||||||
return fmt.Errorf("proto: KeyDerivation: illegal tag %d (wire type %d)", fieldNum, wire)
|
|
||||||
}
|
|
||||||
switch fieldNum {
|
|
||||||
case 1:
|
|
||||||
if wireType != 0 {
|
|
||||||
return fmt.Errorf("proto: wrong wireType = %d for field Method", wireType)
|
|
||||||
}
|
|
||||||
m.Method = 0
|
|
||||||
for shift := uint(0); ; shift += 7 {
|
|
||||||
if shift >= 64 {
|
|
||||||
return ErrIntOverflowCrypto
|
|
||||||
}
|
|
||||||
if iNdEx >= l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
b := dAtA[iNdEx]
|
|
||||||
iNdEx++
|
|
||||||
m.Method |= DerivationMethod(b&0x7F) << shift
|
|
||||||
if b < 0x80 {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
case 2:
|
|
||||||
if wireType != 2 {
|
|
||||||
return fmt.Errorf("proto: wrong wireType = %d for field DerivationPath", wireType)
|
|
||||||
}
|
|
||||||
var stringLen uint64
|
|
||||||
for shift := uint(0); ; shift += 7 {
|
|
||||||
if shift >= 64 {
|
|
||||||
return ErrIntOverflowCrypto
|
|
||||||
}
|
|
||||||
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 ErrInvalidLengthCrypto
|
|
||||||
}
|
|
||||||
postIndex := iNdEx + intStringLen
|
|
||||||
if postIndex < 0 {
|
|
||||||
return ErrInvalidLengthCrypto
|
|
||||||
}
|
|
||||||
if postIndex > l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
m.DerivationPath = string(dAtA[iNdEx:postIndex])
|
|
||||||
iNdEx = postIndex
|
|
||||||
default:
|
|
||||||
iNdEx = preIndex
|
|
||||||
skippy, err := skipCrypto(dAtA[iNdEx:])
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
|
||||||
return ErrInvalidLengthCrypto
|
|
||||||
}
|
|
||||||
if (iNdEx + skippy) > l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
iNdEx += skippy
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if iNdEx > l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
func skipCrypto(dAtA []byte) (n int, err error) {
|
func skipCrypto(dAtA []byte) (n int, err error) {
|
||||||
l := len(dAtA)
|
l := len(dAtA)
|
||||||
iNdEx := 0
|
iNdEx := 0
|
||||||
|
|||||||
@ -8,16 +8,7 @@ enum KeyType {
|
|||||||
AES = 2;
|
AES = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum DerivationMethod {
|
|
||||||
Slip21 = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
message Key {
|
message Key {
|
||||||
KeyType Type = 1;
|
KeyType Type = 1;
|
||||||
bytes Data = 2;
|
bytes Data = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
message KeyDerivation {
|
|
||||||
DerivationMethod method = 1;
|
|
||||||
string derivationPath = 2;
|
|
||||||
}
|
|
||||||
@ -5,9 +5,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
AnytypeAccountPath = "m/SLIP-0021/anytype/account"
|
AnysyncSpacePath = "m/SLIP-0021/anysync/space"
|
||||||
AnysyncTreePath = "m/SLIP-0021/anysync/tree/%s"
|
AnysyncTreePath = "m/SLIP-0021/anysync/tree/%s"
|
||||||
AnytypeAccountPrefix = "m/44'/607'"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// DeriveSymmetricKey derives a symmetric key from seed and path using slip-21
|
// DeriveSymmetricKey derives a symmetric key from seed and path using slip-21
|
||||||
|
|||||||
@ -10,7 +10,7 @@ func TestDerivedKey(t *testing.T) {
|
|||||||
seed := make([]byte, 32)
|
seed := make([]byte, 32)
|
||||||
_, err := rand.Read(seed)
|
_, err := rand.Read(seed)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
key, err := DeriveSymmetricKey(seed, AnytypeAccountPath)
|
key, err := DeriveSymmetricKey(seed, AnysyncSpacePath)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
_, err = rand.Read(seed)
|
_, err = rand.Read(seed)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|||||||
@ -12,6 +12,19 @@ var (
|
|||||||
ErrInvalidMnemonic = errors.New("error invalid mnemonic")
|
ErrInvalidMnemonic = errors.New("error invalid mnemonic")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
anytypeAccountOldPrefix = "m/44'/607'"
|
||||||
|
// https://github.com/satoshilabs/slips/blob/master/slip-0044.md
|
||||||
|
anytypeAccountNewPrefix = "m/44'/2046'"
|
||||||
|
)
|
||||||
|
|
||||||
|
type DerivationResult struct {
|
||||||
|
MasterKey PrivKey
|
||||||
|
Identity PrivKey
|
||||||
|
OldAccountKey PrivKey
|
||||||
|
MasterNode slip10.Node
|
||||||
|
}
|
||||||
|
|
||||||
type MnemonicGenerator struct {
|
type MnemonicGenerator struct {
|
||||||
mnemonic string
|
mnemonic string
|
||||||
}
|
}
|
||||||
@ -61,7 +74,47 @@ func (g MnemonicGenerator) WithEntropy(b []byte) (Mnemonic, error) {
|
|||||||
return Mnemonic(mnemonic), nil
|
return Mnemonic(mnemonic), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m Mnemonic) DeriveEd25519Key(index int) (PrivKey, error) {
|
func (m Mnemonic) deriveForPath(onlyMaster bool, index uint32, path string) (res DerivationResult, err error) {
|
||||||
|
seed, err := m.Seed()
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
prefixNode, err := slip10.DeriveForPath(path, seed)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// m/44'/code'/index'
|
||||||
|
res.MasterNode, err = prefixNode.Derive(slip10.FirstHardenedIndex + index)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
res.MasterKey, err = genKey(res.MasterNode)
|
||||||
|
if err != nil || onlyMaster {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// m/44'/code'/index'/0'
|
||||||
|
identityNode, err := res.MasterNode.Derive(slip10.FirstHardenedIndex)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
res.Identity, err = genKey(identityNode)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m Mnemonic) DeriveKeys(index uint32) (res DerivationResult, err error) {
|
||||||
|
oldRes, err := m.deriveForPath(true, index, anytypeAccountOldPrefix)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
res, err = m.deriveForPath(false, index, anytypeAccountNewPrefix)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
res.OldAccountKey = oldRes.MasterKey
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m Mnemonic) Seed() ([]byte, error) {
|
||||||
seed, err := bip39.NewSeedWithErrorChecking(string(m), "")
|
seed, err := bip39.NewSeedWithErrorChecking(string(m), "")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err == bip39.ErrInvalidMnemonic {
|
if err == bip39.ErrInvalidMnemonic {
|
||||||
@ -69,22 +122,15 @@ func (m Mnemonic) DeriveEd25519Key(index int) (PrivKey, error) {
|
|||||||
}
|
}
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
masterKey, err := slip10.DeriveForPath(AnytypeAccountPrefix, seed)
|
return seed, nil
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
key, err := masterKey.Derive(slip10.FirstHardenedIndex + uint32(index))
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
reader := bytes.NewReader(key.RawSeed())
|
|
||||||
privKey, _, err := GenerateEd25519Key(reader)
|
|
||||||
|
|
||||||
return privKey, err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m Mnemonic) Bytes() ([]byte, error) {
|
func (m Mnemonic) Bytes() ([]byte, error) {
|
||||||
return bip39.MnemonicToByteArray(string(m), true)
|
return bip39.MnemonicToByteArray(string(m), true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func genKey(node slip10.Node) (key PrivKey, err error) {
|
||||||
|
reader := bytes.NewReader(node.RawSeed())
|
||||||
|
key, _, err = GenerateEd25519Key(reader)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|||||||
@ -2,6 +2,7 @@ package crypto
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
|
"github.com/anytypeio/go-slip10"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
@ -12,14 +13,31 @@ func TestMnemonic(t *testing.T) {
|
|||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
parts := strings.Split(string(phrase), " ")
|
parts := strings.Split(string(phrase), " ")
|
||||||
require.Equal(t, 12, len(parts))
|
require.Equal(t, 12, len(parts))
|
||||||
key, err := phrase.DeriveEd25519Key(0)
|
res, err := phrase.DeriveKeys(0)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
bytes := make([]byte, 64)
|
bytes := make([]byte, 64)
|
||||||
_, err = rand.Read(bytes)
|
_, err = rand.Read(bytes)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
sign, err := key.Sign(bytes)
|
|
||||||
|
// testing signing with keys
|
||||||
|
for _, k := range []PrivKey{res.MasterKey, res.Identity, res.OldAccountKey} {
|
||||||
|
sign, err := k.Sign(bytes)
|
||||||
|
require.NoError(t, err)
|
||||||
|
res, err := k.GetPublic().Verify(bytes, sign)
|
||||||
|
require.NoError(t, err)
|
||||||
|
require.True(t, res)
|
||||||
|
}
|
||||||
|
|
||||||
|
// testing derivation
|
||||||
|
masterKey, err := genKey(res.MasterNode)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
res, err := key.GetPublic().Verify(bytes, sign)
|
require.True(t, res.MasterKey.Equals(masterKey))
|
||||||
|
identityNode, err := res.MasterNode.Derive(slip10.FirstHardenedIndex)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.True(t, res)
|
identityKey, err := genKey(identityNode)
|
||||||
|
require.NoError(t, err)
|
||||||
|
require.True(t, res.Identity.Equals(identityKey))
|
||||||
|
oldAccountRes, err := phrase.deriveForPath(true, 0, anytypeAccountOldPrefix)
|
||||||
|
require.NoError(t, err)
|
||||||
|
require.True(t, res.OldAccountKey.Equals(oldAccountRes.MasterKey))
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user