diff --git a/coordinator/coordinatorproto/coordinator.pb.go b/coordinator/coordinatorproto/coordinator.pb.go index a08e0891..cef0151b 100644 --- a/coordinator/coordinatorproto/coordinator.pb.go +++ b/coordinator/coordinatorproto/coordinator.pb.go @@ -345,15 +345,15 @@ func (m *SpaceReceiptWithSignature) GetSignature() []byte { // SpaceReceipt contains permission to SpacePush operation type SpaceReceipt struct { - // spaceId + // SpaceId is the identifier of space SpaceId string `protobuf:"bytes,1,opt,name=spaceId,proto3" json:"spaceId,omitempty"` - // peerId of receipt requester + // PeerId of receipt requester PeerId string `protobuf:"bytes,2,opt,name=peerId,proto3" json:"peerId,omitempty"` - // identity of space owner + // AccountIdentity is an identity of a space owner AccountIdentity []byte `protobuf:"bytes,3,opt,name=accountIdentity,proto3" json:"accountIdentity,omitempty"` - // identity of control node - ControlNodeIdentity []byte `protobuf:"bytes,4,opt,name=controlNodeIdentity,proto3" json:"controlNodeIdentity,omitempty"` - // unix-timestamp with a deadline time of receipt validity + // NetworkId is the id of a network where the receipt is issued + NetworkId string `protobuf:"bytes,4,opt,name=networkId,proto3" json:"networkId,omitempty"` + // ValidUntil is a unix-timestamp with a deadline time of receipt validity ValidUntil uint64 `protobuf:"varint,5,opt,name=validUntil,proto3" json:"validUntil,omitempty"` } @@ -411,11 +411,11 @@ func (m *SpaceReceipt) GetAccountIdentity() []byte { return nil } -func (m *SpaceReceipt) GetControlNodeIdentity() []byte { +func (m *SpaceReceipt) GetNetworkId() string { if m != nil { - return m.ControlNodeIdentity + return m.NetworkId } - return nil + return "" } func (m *SpaceReceipt) GetValidUntil() uint64 { @@ -929,65 +929,65 @@ func init() { } var fileDescriptor_d94f6f99586adae2 = []byte{ - // 918 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x56, 0xcd, 0x6e, 0x23, 0x45, - 0x10, 0xf6, 0xd8, 0x4e, 0x82, 0xcb, 0x91, 0x77, 0xd2, 0x24, 0x61, 0x30, 0x66, 0xb0, 0x06, 0x58, - 0x4c, 0x40, 0xd9, 0x95, 0x17, 0x10, 0x88, 0x0b, 0x60, 0x16, 0x29, 0x08, 0x85, 0x68, 0x12, 0x83, - 0x80, 0x03, 0x9a, 0x9d, 0xa9, 0x24, 0xad, 0x38, 0xdd, 0x43, 0x77, 0x9b, 0x4d, 0x0e, 0x48, 0x3c, - 0x02, 0x27, 0x0e, 0x3c, 0x03, 0x6f, 0x00, 0x0f, 0xc0, 0x31, 0x47, 0x8e, 0x28, 0x91, 0x78, 0x0e, - 0xd4, 0xf3, 0xe7, 0x1e, 0x7b, 0x9c, 0x20, 0xed, 0xc5, 0x76, 0x7f, 0xf5, 0xfb, 0x55, 0x55, 0x57, - 0x1b, 0xde, 0x0d, 0x39, 0x17, 0x11, 0x65, 0x81, 0xe2, 0xe2, 0x81, 0xf1, 0x3b, 0x16, 0x5c, 0xf1, - 0x07, 0xc9, 0xa7, 0x34, 0xf1, 0xdd, 0x04, 0x22, 0x6d, 0x03, 0xf2, 0x7e, 0xb3, 0xc0, 0x3e, 0x8c, - 0x83, 0x10, 0x0f, 0xe9, 0x09, 0xf3, 0xf1, 0x87, 0x29, 0x4a, 0x45, 0x1c, 0x58, 0x93, 0x1a, 0xdb, - 0x8b, 0x1c, 0xab, 0x6f, 0x0d, 0x5a, 0x7e, 0x7e, 0x24, 0xdb, 0xb0, 0x7a, 0x8a, 0x41, 0x84, 0xc2, - 0xa9, 0xf7, 0xad, 0xc1, 0xba, 0x9f, 0x9d, 0x48, 0x1f, 0xda, 0x7c, 0x12, 0xed, 0x45, 0xc8, 0x14, - 0x55, 0x97, 0x4e, 0x23, 0x11, 0x9a, 0x10, 0x19, 0xc2, 0x26, 0xc3, 0xa7, 0xf9, 0x51, 0x47, 0x0b, - 0xd4, 0x54, 0xa0, 0xd3, 0x4c, 0x54, 0x2b, 0x65, 0x9e, 0x02, 0x92, 0xe6, 0xa6, 0x02, 0x35, 0x95, - 0x07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0x08, 0x05, 0x06, 0xf9, - 0xc2, 0x19, 0x33, 0x7a, 0x91, 0xdc, 0x93, 0xa6, 0xbf, 0x80, 0x7b, 0x14, 0x9a, 0xda, 0xd4, 0xb8, - 0xa0, 0x56, 0xe9, 0x82, 0xf6, 0xa0, 0x15, 0x44, 0x91, 0x40, 0x29, 0x51, 0x3a, 0xf5, 0x7e, 0x43, - 0xa7, 0x54, 0x00, 0xe4, 0x2d, 0x58, 0x51, 0x97, 0x71, 0x96, 0x52, 0x67, 0xb8, 0xb5, 0x90, 0xd2, - 0xd1, 0x65, 0x8c, 0x7e, 0xaa, 0xb3, 0xf3, 0xb3, 0x05, 0xf0, 0x58, 0x08, 0x2e, 0x46, 0x49, 0x96, - 0x1d, 0x80, 0x31, 0xc3, 0x8b, 0x18, 0x43, 0x85, 0x91, 0x5d, 0x23, 0x76, 0xb6, 0x4c, 0x3e, 0xd5, - 0xad, 0xc7, 0xc8, 0xb6, 0x88, 0x03, 0x9b, 0x33, 0x84, 0x72, 0x76, 0x80, 0x2c, 0xa2, 0xec, 0xc4, - 0xae, 0x17, 0xba, 0x23, 0x4d, 0x07, 0x23, 0xbb, 0x41, 0x08, 0x74, 0x12, 0x64, 0x9f, 0xab, 0xc7, - 0x17, 0x54, 0x2a, 0x69, 0x37, 0x89, 0x0d, 0xed, 0x24, 0xde, 0x97, 0xc7, 0xc7, 0x12, 0x95, 0xfd, - 0x7b, 0x7d, 0xe7, 0x27, 0x68, 0x1b, 0x73, 0x40, 0xb6, 0x4b, 0xab, 0x3f, 0x77, 0x56, 0x23, 0x2e, - 0x74, 0xcd, 0x71, 0x49, 0xc3, 0xe6, 0x59, 0xd8, 0xd6, 0x9c, 0x3c, 0x17, 0x1c, 0xaa, 0x40, 0x68, - 0xfb, 0xfa, 0x9c, 0xdf, 0x9c, 0x50, 0x63, 0xe7, 0x7d, 0x78, 0x2e, 0x2f, 0x0a, 0x69, 0xc3, 0xda, - 0x91, 0x40, 0xfc, 0xf8, 0x60, 0xcf, 0xae, 0xe9, 0x83, 0xde, 0x16, 0xfa, 0x60, 0x69, 0x2a, 0xa3, - 0x59, 0x19, 0x35, 0x56, 0x1f, 0xfe, 0xdb, 0x80, 0xb6, 0x01, 0x92, 0xcf, 0xa1, 0x55, 0x3c, 0x1f, - 0xe4, 0xe5, 0x8a, 0x41, 0x9f, 0x3d, 0xb4, 0x5d, 0x77, 0x99, 0x38, 0x9b, 0xcf, 0x6f, 0xa0, 0x53, - 0x5e, 0x55, 0xc4, 0x2b, 0x59, 0x54, 0x2e, 0xc9, 0xee, 0xab, 0xb7, 0xea, 0x64, 0xae, 0xbf, 0xcf, - 0xdf, 0xfd, 0xd9, 0x82, 0x22, 0xaf, 0x2d, 0xbb, 0x96, 0x25, 0xf7, 0xaf, 0xdf, 0xa1, 0x95, 0x05, - 0x78, 0x92, 0x3f, 0xa3, 0xc6, 0x46, 0x20, 0xb7, 0xd8, 0x1a, 0x9b, 0xac, 0x7b, 0xff, 0x2e, 0xb5, - 0x2c, 0xc6, 0x19, 0x6c, 0x56, 0xdd, 0x6f, 0x32, 0x28, 0x4f, 0xfb, 0xf2, 0x05, 0xd2, 0x7d, 0xf3, - 0x7f, 0x68, 0xa6, 0xc1, 0x3e, 0x79, 0xef, 0xaf, 0x6b, 0xd7, 0xba, 0xba, 0x76, 0xad, 0x7f, 0xae, - 0x5d, 0xeb, 0x97, 0x1b, 0xb7, 0x76, 0x75, 0xe3, 0xd6, 0xfe, 0xbe, 0x71, 0x6b, 0xdf, 0xf6, 0x6e, - 0xfb, 0x23, 0xf6, 0x64, 0x35, 0xf9, 0x7a, 0xf4, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x48, 0x5e, - 0x22, 0xba, 0xaf, 0x09, 0x00, 0x00, + // 914 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x56, 0xcf, 0x6e, 0xeb, 0x44, + 0x17, 0x8f, 0x93, 0xb4, 0xfd, 0x72, 0x5c, 0xe5, 0xba, 0xf3, 0xb5, 0xc5, 0x84, 0x60, 0x22, 0x03, + 0x97, 0x50, 0x50, 0xef, 0x55, 0x2e, 0x20, 0x10, 0x1b, 0x20, 0x5c, 0xa4, 0x20, 0x54, 0x2a, 0xb7, + 0x01, 0x01, 0x0b, 0xe4, 0xeb, 0x39, 0x6d, 0x47, 0x4d, 0x6d, 0x33, 0x33, 0xe1, 0xb6, 0x0b, 0x24, + 0x1e, 0x81, 0x15, 0x0b, 0x9e, 0x80, 0x05, 0x6f, 0xc0, 0x0b, 0xb0, 0xbc, 0x4b, 0x96, 0xa8, 0x95, + 0x78, 0x0e, 0x34, 0x63, 0x3b, 0x19, 0x27, 0x4e, 0x8b, 0xc4, 0x26, 0xc9, 0xf9, 0x9d, 0xff, 0x73, + 0x7e, 0x73, 0x26, 0xf0, 0x76, 0x94, 0x24, 0x9c, 0xb2, 0x38, 0x94, 0x09, 0x7f, 0x60, 0xfc, 0x4e, + 0x79, 0x22, 0x93, 0x07, 0xfa, 0x53, 0x98, 0xf8, 0xbe, 0x86, 0x88, 0x6d, 0x40, 0xfe, 0x2f, 0x16, + 0x38, 0x47, 0x69, 0x18, 0xe1, 0x11, 0x3b, 0x8d, 0x03, 0xfc, 0x6e, 0x8a, 0x42, 0x12, 0x17, 0x36, + 0x84, 0xc2, 0x46, 0xd4, 0xb5, 0x7a, 0x56, 0xbf, 0x15, 0x14, 0x22, 0xd9, 0x85, 0xf5, 0x33, 0x0c, + 0x29, 0x72, 0xb7, 0xde, 0xb3, 0xfa, 0x9b, 0x41, 0x2e, 0x91, 0x1e, 0xd8, 0xc9, 0x84, 0x8e, 0x28, + 0xc6, 0x92, 0xc9, 0x2b, 0xb7, 0xa1, 0x95, 0x26, 0x44, 0x06, 0xb0, 0x1d, 0xe3, 0xd3, 0x42, 0x54, + 0xd9, 0x42, 0x39, 0xe5, 0xe8, 0x36, 0xb5, 0x69, 0xa5, 0xce, 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88, 0x1f, + 0x1e, 0x8e, 0x9c, 0x9a, 0x12, 0xd4, 0xb6, 0x50, 0x82, 0xa5, 0x5a, 0x19, 0xce, 0x8f, 0x51, 0x61, + 0xf5, 0xc1, 0xdf, 0x0d, 0xb0, 0x0d, 0x90, 0x7c, 0x0a, 0xad, 0xd9, 0x53, 0x41, 0x5e, 0xac, 0x20, + 0xfa, 0xfc, 0x51, 0xed, 0x78, 0xab, 0xd4, 0x39, 0x3f, 0xbf, 0x82, 0x76, 0x79, 0x55, 0x11, 0xbf, + 0xe4, 0x51, 0xb9, 0x24, 0x3b, 0x2f, 0xdf, 0x6a, 0x93, 0x87, 0xfe, 0xb6, 0x78, 0xe3, 0xe7, 0x0b, + 0x8a, 0xbc, 0xb2, 0xea, 0x5a, 0x96, 0xc2, 0xbf, 0x7a, 0x87, 0x55, 0x9e, 0xe0, 0x49, 0xf1, 0x64, + 0x1a, 0x1b, 0x81, 0xdc, 0xe2, 0x6b, 0x6c, 0xb2, 0xce, 0xfd, 0xbb, 0xcc, 0xf2, 0x1c, 0xe7, 0xb0, + 0x5d, 0x75, 0xbf, 0x49, 0xbf, 0xcc, 0xf6, 0xd5, 0x0b, 0xa4, 0xf3, 0xfa, 0xbf, 0xb0, 0xcc, 0x92, + 0x7d, 0xf4, 0xce, 0x1f, 0xd7, 0x9e, 0xf5, 0xec, 0xda, 0xb3, 0xfe, 0xba, 0xf6, 0xac, 0x9f, 0x6e, + 0xbc, 0xda, 0xb3, 0x1b, 0xaf, 0xf6, 0xe7, 0x8d, 0x57, 0xfb, 0xba, 0x7b, 0xdb, 0x9f, 0xae, 0x27, + 0xeb, 0xfa, 0xeb, 0xd1, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x0f, 0xcc, 0xe8, 0x2d, 0x9b, 0x09, + 0x00, 0x00, } func (m *SpaceSignRequest) Marshal() (dAtA []byte, err error) { @@ -1171,10 +1171,10 @@ func (m *SpaceReceipt) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x28 } - if len(m.ControlNodeIdentity) > 0 { - i -= len(m.ControlNodeIdentity) - copy(dAtA[i:], m.ControlNodeIdentity) - i = encodeVarintCoordinator(dAtA, i, uint64(len(m.ControlNodeIdentity))) + if len(m.NetworkId) > 0 { + i -= len(m.NetworkId) + copy(dAtA[i:], m.NetworkId) + i = encodeVarintCoordinator(dAtA, i, uint64(len(m.NetworkId))) i-- dAtA[i] = 0x22 } @@ -1653,7 +1653,7 @@ func (m *SpaceReceipt) Size() (n int) { if l > 0 { n += 1 + l + sovCoordinator(uint64(l)) } - l = len(m.ControlNodeIdentity) + l = len(m.NetworkId) if l > 0 { n += 1 + l + sovCoordinator(uint64(l)) } @@ -2428,9 +2428,9 @@ func (m *SpaceReceipt) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ControlNodeIdentity", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field NetworkId", wireType) } - var byteLen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowCoordinator @@ -2440,25 +2440,23 @@ func (m *SpaceReceipt) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthCoordinator } - postIndex := iNdEx + byteLen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthCoordinator } if postIndex > l { return io.ErrUnexpectedEOF } - m.ControlNodeIdentity = append(m.ControlNodeIdentity[:0], dAtA[iNdEx:postIndex]...) - if m.ControlNodeIdentity == nil { - m.ControlNodeIdentity = []byte{} - } + m.NetworkId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 5: if wireType != 0 { diff --git a/coordinator/coordinatorproto/protos/coordinator.proto b/coordinator/coordinatorproto/protos/coordinator.proto index 804957a1..c6767eab 100644 --- a/coordinator/coordinatorproto/protos/coordinator.proto +++ b/coordinator/coordinatorproto/protos/coordinator.proto @@ -67,15 +67,15 @@ message SpaceReceiptWithSignature { // SpaceReceipt contains permission to SpacePush operation message SpaceReceipt { - // spaceId + // SpaceId is the identifier of space string spaceId = 1; - // peerId of receipt requester + // PeerId of receipt requester string peerId = 2; - // identity of space owner + // AccountIdentity is an identity of a space owner bytes accountIdentity = 3; - // identity of control node - bytes controlNodeIdentity = 4; - // unix-timestamp with a deadline time of receipt validity + // NetworkId is the id of a network where the receipt is issued + string networkId = 4; + // ValidUntil is a unix-timestamp with a deadline time of receipt validity uint64 validUntil = 5; } diff --git a/coordinator/coordinatorproto/receipt.go b/coordinator/coordinatorproto/receipt.go index 67287d9d..d011038f 100644 --- a/coordinator/coordinatorproto/receipt.go +++ b/coordinator/coordinatorproto/receipt.go @@ -3,43 +3,38 @@ package coordinatorproto import ( "bytes" "errors" - "fmt" "github.com/anytypeio/any-sync/util/crypto" + "github.com/anytypeio/any-sync/util/strkey" "github.com/gogo/protobuf/proto" - "golang.org/x/exp/slices" "time" ) var ( errReceiptSignatureIncorrect = errors.New("receipt signature is incorrect") - errNoSuchCoordinatorNode = errors.New("no such coordinator node") + errNetworkIsIncorrect = errors.New("network is incorrect") errReceiptSpaceIdIncorrect = errors.New("receipt space id is incorrect") errReceiptPeerIdIncorrect = errors.New("receipt peer id is incorrect") errReceiptAccountIncorrect = errors.New("receipt account is incorrect") errReceiptExpired = errors.New("receipt is expired") ) -func PrepareSpaceReceipt(spaceId, peerId string, validPeriod time.Duration, accountPubKey crypto.PubKey, nodeKey crypto.PrivKey) (signedReceipt *SpaceReceiptWithSignature, err error) { +func PrepareSpaceReceipt(spaceId, peerId string, validPeriod time.Duration, accountPubKey crypto.PubKey, networkKey crypto.PrivKey) (signedReceipt *SpaceReceiptWithSignature, err error) { marshalledAccount, err := accountPubKey.Marshall() if err != nil { return } - marshalledNode, err := nodeKey.GetPublic().Marshall() - if err != nil { - return - } receipt := &SpaceReceipt{ - SpaceId: spaceId, - PeerId: peerId, - AccountIdentity: marshalledAccount, - ControlNodeIdentity: marshalledNode, - ValidUntil: uint64(time.Now().Add(validPeriod).Unix()), + SpaceId: spaceId, + PeerId: peerId, + AccountIdentity: marshalledAccount, + NetworkId: networkKey.GetPublic().Network(), + ValidUntil: uint64(time.Now().Add(validPeriod).Unix()), } receiptData, err := receipt.Marshal() if err != nil { return } - sign, err := nodeKey.Sign(receiptData) + sign, err := networkKey.Sign(receiptData) if err != nil { return } @@ -49,7 +44,7 @@ func PrepareSpaceReceipt(spaceId, peerId string, validPeriod time.Duration, acco }, nil } -func CheckReceipt(peerId, spaceId string, accountIdentity []byte, coordinators []string, receipt *SpaceReceiptWithSignature) (err error) { +func CheckReceipt(peerId, spaceId string, accountIdentity []byte, networkId string, receipt *SpaceReceiptWithSignature) (err error) { payload := &SpaceReceipt{} err = proto.Unmarshal(receipt.GetSpaceReceiptPayload(), payload) if err != nil { @@ -72,9 +67,9 @@ func CheckReceipt(peerId, spaceId string, accountIdentity []byte, coordinators [ if !bytes.Equal(protoRaw.Storage(), accountRaw.Storage()) { return errReceiptAccountIncorrect } - err = checkCoordinator( - coordinators, - payload.ControlNodeIdentity, + err = checkNetwork( + networkId, + payload.NetworkId, receipt.GetSpaceReceiptPayload(), receipt.GetSignature()) if err != nil { @@ -86,16 +81,19 @@ func CheckReceipt(peerId, spaceId string, accountIdentity []byte, coordinators [ return } -func checkCoordinator(coordinators []string, identity []byte, payload, signature []byte) (err error) { - coordinatorKey, err := crypto.UnmarshalEd25519PublicKeyProto(identity) +func checkNetwork(networkId, payloadNetworkId string, payload, signature []byte) (err error) { + if networkId != payloadNetworkId { + return errNetworkIsIncorrect + } + networkIdentity, err := strkey.Decode(strkey.NetworkAddressVersionByte, networkId) if err != nil { return } - receiptCoordinator := coordinatorKey.PeerId() - if !slices.Contains(coordinators, coordinatorKey.PeerId()) { - return fmt.Errorf("got coordinator %s: %w", receiptCoordinator, errNoSuchCoordinatorNode) + networkKey, err := crypto.UnmarshalEd25519PublicKey(networkIdentity) + if err != nil { + return } - res, err := coordinatorKey.Verify(payload, signature) + res, err := networkKey.Verify(payload, signature) if err != nil { return } diff --git a/coordinator/coordinatorproto/receipt_test.go b/coordinator/coordinatorproto/receipt_test.go index fc2bc200..28bd9dc3 100644 --- a/coordinator/coordinatorproto/receipt_test.go +++ b/coordinator/coordinatorproto/receipt_test.go @@ -3,7 +3,6 @@ package coordinatorproto import ( "context" "crypto/rand" - "errors" "github.com/anytypeio/any-sync/util/crypto" "github.com/gogo/protobuf/proto" "github.com/stretchr/testify/require" @@ -12,7 +11,7 @@ import ( ) type fixture struct { - coordinatorKey crypto.PrivKey + networkKey crypto.PrivKey accountKey crypto.PubKey accountIdentity []byte ctx context.Context @@ -23,7 +22,7 @@ type fixture struct { } func newFixture(t *testing.T) *fixture { - coordinatorKey, _, err := crypto.GenerateEd25519Key(rand.Reader) + networkKey, _, err := crypto.GenerateEd25519Key(rand.Reader) require.NoError(t, err) accountKey, _, err := crypto.GenerateEd25519Key(rand.Reader) require.NoError(t, err) @@ -33,14 +32,14 @@ func newFixture(t *testing.T) *fixture { spaceId: "spaceId", peerId: "peerId", accountIdentity: accountKeyProto, - coordinatorKey: coordinatorKey, + networkKey: networkKey, accountKey: accountKey.GetPublic(), } } func (fx *fixture) prepareReceipt(t *testing.T, validPeriod time.Duration) { var err error - fx.signedReceipt, err = PrepareSpaceReceipt(fx.spaceId, fx.peerId, validPeriod, fx.accountKey, fx.coordinatorKey) + fx.signedReceipt, err = PrepareSpaceReceipt(fx.spaceId, fx.peerId, validPeriod, fx.accountKey, fx.networkKey) require.NoError(t, err) fx.originalReceipt = &SpaceReceipt{} err = proto.Unmarshal(fx.signedReceipt.SpaceReceiptPayload, fx.originalReceipt) @@ -52,7 +51,7 @@ func (fx *fixture) updateReceipt(t *testing.T, update func(t *testing.T, receipt update(t, fx.originalReceipt) marshalled, err := proto.Marshal(fx.originalReceipt) require.NoError(t, err) - signature, err := fx.coordinatorKey.Sign(marshalled) + signature, err := fx.networkKey.Sign(marshalled) require.NoError(t, err) fx.signedReceipt = &SpaceReceiptWithSignature{ SpaceReceiptPayload: marshalled, @@ -63,52 +62,50 @@ func (fx *fixture) updateReceipt(t *testing.T, update func(t *testing.T, receipt func TestReceiptValid(t *testing.T) { fx := newFixture(t) fx.prepareReceipt(t, time.Second) - err := CheckReceipt(fx.peerId, fx.spaceId, fx.accountIdentity, []string{fx.coordinatorKey.GetPublic().PeerId()}, fx.signedReceipt) + err := CheckReceipt(fx.peerId, fx.spaceId, fx.accountIdentity, fx.networkKey.GetPublic().Network(), fx.signedReceipt) require.NoError(t, err) } func TestReceiptIncorrectSpaceId(t *testing.T) { fx := newFixture(t) fx.prepareReceipt(t, time.Second) - err := CheckReceipt(fx.peerId, "otherId", fx.accountIdentity, []string{fx.coordinatorKey.GetPublic().PeerId()}, fx.signedReceipt) + err := CheckReceipt(fx.peerId, "otherId", fx.accountIdentity, fx.networkKey.GetPublic().Network(), fx.signedReceipt) require.Error(t, errReceiptSpaceIdIncorrect, err) } func TestReceiptIncorrectPeerId(t *testing.T) { fx := newFixture(t) fx.prepareReceipt(t, time.Second) - err := CheckReceipt("otherId", fx.spaceId, fx.accountIdentity, []string{fx.coordinatorKey.GetPublic().PeerId()}, fx.signedReceipt) + err := CheckReceipt("otherId", fx.spaceId, fx.accountIdentity, fx.networkKey.GetPublic().Network(), fx.signedReceipt) require.Error(t, errReceiptPeerIdIncorrect, err) } func TestReceiptIncorrectAccountIdentity(t *testing.T) { fx := newFixture(t) fx.prepareReceipt(t, time.Second) - err := CheckReceipt(fx.peerId, fx.spaceId, []byte("some identity"), []string{fx.coordinatorKey.GetPublic().PeerId()}, fx.signedReceipt) + err := CheckReceipt(fx.peerId, fx.spaceId, []byte("some identity"), fx.networkKey.GetPublic().Network(), fx.signedReceipt) require.Error(t, errReceiptAccountIncorrect, err) } -func TestReceiptIncorrectCoordinatorKey(t *testing.T) { +func TestReceiptIncorrectNetworkId(t *testing.T) { fx := newFixture(t) fx.prepareReceipt(t, time.Second) - t.Run("random key payload", func(t *testing.T) { + t.Run("random network id", func(t *testing.T) { fx.updateReceipt(t, func(t *testing.T, receipt *SpaceReceipt) { - receipt.ControlNodeIdentity = []byte("some random stuff") + receipt.NetworkId = "some random network id" }) - err := CheckReceipt(fx.peerId, fx.spaceId, fx.accountIdentity, []string{fx.coordinatorKey.GetPublic().PeerId()}, fx.signedReceipt) + err := CheckReceipt(fx.peerId, fx.spaceId, fx.accountIdentity, fx.networkKey.GetPublic().Network(), fx.signedReceipt) require.Error(t, err) }) t.Run("random incorrect key", func(t *testing.T) { fx.updateReceipt(t, func(t *testing.T, receipt *SpaceReceipt) { randomKey, _, err := crypto.GenerateEd25519Key(rand.Reader) require.NoError(t, err) - keyBytes, err := randomKey.GetPublic().Marshall() - require.NoError(t, err) - receipt.ControlNodeIdentity = keyBytes + receipt.NetworkId = randomKey.GetPublic().Network() }) - err := CheckReceipt(fx.peerId, fx.spaceId, fx.accountIdentity, []string{fx.coordinatorKey.GetPublic().PeerId()}, fx.signedReceipt) - require.True(t, errors.Is(err, errNoSuchCoordinatorNode)) + err := CheckReceipt(fx.peerId, fx.spaceId, fx.accountIdentity, fx.networkKey.GetPublic().Network(), fx.signedReceipt) + require.Error(t, errNetworkIsIncorrect, err) }) } @@ -116,7 +113,7 @@ func TestReceiptIncorrectSignature(t *testing.T) { fx := newFixture(t) fx.prepareReceipt(t, time.Second) fx.signedReceipt.Signature = []byte("random sig") - err := CheckReceipt(fx.peerId, fx.spaceId, fx.accountIdentity, []string{fx.coordinatorKey.GetPublic().PeerId()}, fx.signedReceipt) + err := CheckReceipt(fx.peerId, fx.spaceId, fx.accountIdentity, fx.networkKey.GetPublic().Network(), fx.signedReceipt) require.Error(t, errReceiptSignatureIncorrect, err) } @@ -126,6 +123,6 @@ func TestReceiptExpired(t *testing.T) { fx.updateReceipt(t, func(t *testing.T, receipt *SpaceReceipt) { receipt.ValidUntil = uint64(time.Now().Add(-time.Second).Unix()) }) - err := CheckReceipt(fx.peerId, fx.spaceId, fx.accountIdentity, []string{fx.coordinatorKey.GetPublic().PeerId()}, fx.signedReceipt) + err := CheckReceipt(fx.peerId, fx.spaceId, fx.accountIdentity, fx.networkKey.GetPublic().Network(), fx.signedReceipt) require.Error(t, errReceiptExpired, err) }