diff --git a/protocol/common/message.go b/protocol/common/message.go index a03e66707..60c3b63cc 100644 --- a/protocol/common/message.go +++ b/protocol/common/message.go @@ -67,6 +67,7 @@ const ( ContactVerificationStateDeclined ContactVerificationStateTrusted ContactVerificationStateUntrustworthy + ContactVerificationStateCanceled ) type CommandParameters struct { diff --git a/protocol/messenger.go b/protocol/messenger.go index d8a042783..80c65218e 100644 --- a/protocol/messenger.go +++ b/protocol/messenger.go @@ -3991,6 +3991,15 @@ func (m *Messenger) handleRetrievedMessages(chatWithMessages map[transport.Filte continue } + case protobuf.CancelContactVerification: + logger.Debug("Handling CancelContactVerification") + err = m.HandleCancelContactVerification(messageState, msg.ParsedMessage.Interface().(protobuf.CancelContactVerification)) + if err != nil { + logger.Warn("failed to handle CancelContactVerification", zap.Error(err)) + allMessagesProcessed = false + continue + } + case protobuf.ContactVerificationTrusted: logger.Debug("Handling ContactVerificationTrusted") err = m.HandleContactVerificationTrusted(messageState, msg.ParsedMessage.Interface().(protobuf.ContactVerificationTrusted)) diff --git a/protocol/messenger_contact_verification.go b/protocol/messenger_contact_verification.go index 271b2c67e..a5e7ee044 100644 --- a/protocol/messenger_contact_verification.go +++ b/protocol/messenger_contact_verification.go @@ -132,7 +132,7 @@ func (m *Messenger) GetVerificationRequestSentTo(ctx context.Context, contactID return nil, errors.New("contact not found") } - return m.verificationDatabase.GetVerificationRequestSentTo(contactID) + return m.verificationDatabase.GetLatestVerificationRequestSentTo(contactID) } func (m *Messenger) GetReceivedVerificationRequests(ctx context.Context) ([]*verification.Request, error) { @@ -140,56 +140,101 @@ func (m *Messenger) GetReceivedVerificationRequests(ctx context.Context) ([]*ver return m.verificationDatabase.GetReceivedVerificationRequests(myPubKey) } -func (m *Messenger) CancelVerificationRequest(ctx context.Context, contactID string) error { - contact, ok := m.allContacts.Load(contactID) - if !ok || !contact.Added || !contact.HasAddedUs { - return errors.New("must be a mutual contact") - } - - verifRequest, err := m.verificationDatabase.GetVerificationRequestSentTo(contactID) +func (m *Messenger) CancelVerificationRequest(ctx context.Context, id string) (*MessengerResponse, error) { + verifRequest, err := m.verificationDatabase.GetVerificationRequest(id) if err != nil { - return err + return nil, err } if verifRequest == nil { - return errors.New("no contact verification found") + m.logger.Error("could not find verification request with id", zap.String("id", id)) + return nil, verification.ErrVerificationRequestNotFound + } + + if verifRequest.From != common.PubkeyToHex(&m.identity.PublicKey) { + return nil, errors.New("Can cancel only outgoing contact request") + } + + contactID := verifRequest.To + contact, ok := m.allContacts.Load(contactID) + if !ok || !contact.Added || !contact.HasAddedUs { + return nil, errors.New("Can't find contact for canceling verification request") } if verifRequest.RequestStatus != verification.RequestStatusPENDING { - return errors.New("can't cancel a request already verified") + return nil, errors.New("can cancel only pending verification request") } verifRequest.RequestStatus = verification.RequestStatusCANCELED err = m.verificationDatabase.SaveVerificationRequest(verifRequest) if err != nil { - return err + return nil, err } contact.VerificationStatus = VerificationStatusUNVERIFIED contact.LastUpdatedLocally = m.getTimesource().GetCurrentTime() err = m.persistence.SaveContact(contact, nil) if err != nil { - return err + return nil, err } // We sync the contact with the other devices err = m.syncContact(context.Background(), contact) if err != nil { - return err - } - - err = m.SyncVerificationRequest(context.Background(), verifRequest) - if err != nil { - return err + return nil, err } m.allContacts.Store(contact.ID, contact) - return nil + // NOTE: does we need it? + chat, ok := m.allChats.Load(verifRequest.To) + if !ok { + publicKey, err := contact.PublicKey() + if err != nil { + return nil, err + } + chat = OneToOneFromPublicKey(publicKey, m.getTimesource()) + // We don't want to show the chat to the user + chat.Active = false + } + + m.allChats.Store(chat.ID, chat) + clock, _ := chat.NextClockAndTimestamp(m.getTimesource()) + + response := &MessengerResponse{} + + response.AddVerificationRequest(verifRequest) + + err = m.SyncVerificationRequest(context.Background(), verifRequest) + if err != nil { + return nil, err + } + + request := &protobuf.CancelContactVerification{ + Id: id, + Clock: clock, + } + + encodedMessage, err := proto.Marshal(request) + if err != nil { + return nil, err + } + + _, err = m.dispatchMessage(ctx, common.RawMessage{ + LocalChatID: chat.ID, + Payload: encodedMessage, + MessageType: protobuf.ApplicationMetadataMessage_CANCEL_CONTACT_VERIFICATION, + ResendAutomatically: true, + }) + + if err != nil { + return nil, err + } + + return response, nil } func (m *Messenger) AcceptContactVerificationRequest(ctx context.Context, id string, response string) (*MessengerResponse, error) { - verifRequest, err := m.verificationDatabase.GetVerificationRequest(id) if err != nil { return nil, err @@ -293,7 +338,6 @@ func (m *Messenger) AcceptContactVerificationRequest(ctx context.Context, id str } resp.AddActivityCenterNotification(notification) - } return resp, nil @@ -370,7 +414,7 @@ func (m *Messenger) VerifiedTrusted(ctx context.Context, request *requests.Verif return nil, err } - verifRequest, err := m.verificationDatabase.GetVerificationRequestSentTo(contactID) + verifRequest, err := m.verificationDatabase.GetLatestVerificationRequestSentTo(contactID) if err != nil { return nil, err } @@ -889,6 +933,59 @@ func (m *Messenger) HandleDeclineContactVerification(state *ReceivedMessageState return m.createContactVerificationNotification(contact, state, persistedVR, msg, nil) } +func (m *Messenger) HandleCancelContactVerification(state *ReceivedMessageState, request protobuf.CancelContactVerification) error { + myPubKey := hexutil.Encode(crypto.FromECDSAPub(&m.identity.PublicKey)) + contactID := hexutil.Encode(crypto.FromECDSAPub(state.CurrentMessageState.PublicKey)) + + contact := state.CurrentMessageState.Contact + + persistedVR, err := m.verificationDatabase.GetVerificationRequest(request.Id) + if err != nil { + m.logger.Debug("Error obtaining verification request", zap.Error(err)) + return err + } + + if persistedVR != nil && persistedVR.RequestStatus != verification.RequestStatusPENDING { + m.logger.Debug("Only pending verification request can be canceled", zap.String("contactID", contactID)) + return errors.New("must be a pending verification request") + } + + if persistedVR == nil { + // This is a response for which we have not received its request before + persistedVR = &verification.Request{} + persistedVR.From = contactID + persistedVR.To = myPubKey + } + + persistedVR.RequestStatus = verification.RequestStatusCANCELED + persistedVR.RepliedAt = request.Clock + + err = m.verificationDatabase.SaveVerificationRequest(persistedVR) + if err != nil { + m.logger.Debug("Error storing verification request", zap.Error(err)) + return err + } + + err = m.SyncVerificationRequest(context.Background(), persistedVR) + if err != nil { + return err + } + + state.AllVerificationRequests = append(state.AllVerificationRequests, persistedVR) + + msg, err := m.persistence.MessageByID(request.Id) + if err != nil { + return err + } + + if msg != nil { + msg.ContactVerificationState = common.ContactVerificationStateCanceled + state.Response.AddMessage(msg) + } + + return m.createContactVerificationNotification(contact, state, persistedVR, msg, nil) +} + func (m *Messenger) HandleContactVerificationTrusted(state *ReceivedMessageState, request protobuf.ContactVerificationTrusted) error { if common.IsPubKeyEqual(state.CurrentMessageState.PublicKey, &m.identity.PublicKey) { return nil // Is ours, do nothing diff --git a/protocol/messenger_contact_verification_test.go b/protocol/messenger_contact_verification_test.go index a63c7d9b0..505f6d933 100644 --- a/protocol/messenger_contact_verification_test.go +++ b/protocol/messenger_contact_verification_test.go @@ -428,17 +428,17 @@ func (s *MessengerVerificationRequests) TestDeclineVerificationRequests() { s.Require().NotNil(resp.ActivityCenterNotifications()[0].Message) s.Require().Equal(challenge, resp.ActivityCenterNotifications()[0].Message.Text) - s.Require().Equal(common.ContactVerificationStatePending, resp.ActivityCenterNotifications()[0].Message.ContactVerificationState) + s.Require().Equal(resp.ActivityCenterNotifications()[0].Message.ContactVerificationState, common.ContactVerificationStatePending) s.Require().Len(resp.Messages(), 1) s.Require().Equal(challenge, resp.Messages()[0].Text) - s.Require().Equal(common.ContactVerificationStatePending, resp.Messages()[0].ContactVerificationState) + s.Require().Equal(resp.Messages()[0].ContactVerificationState, common.ContactVerificationStatePending) // Make sure it's stored and retrieved correctly notifications, err := theirMessenger.UnreadActivityCenterNotifications("", 4, ActivityCenterNotificationTypeContactVerification) s.Require().NoError(err) s.Require().Len(notifications.Notifications, 1) s.Require().Equal(notifications.Notifications[0].ContactVerificationStatus, verification.RequestStatusPENDING) - s.Require().Equal(common.ContactVerificationStatePending, notifications.Notifications[0].Message.ContactVerificationState) + s.Require().Equal(notifications.Notifications[0].Message.ContactVerificationState, common.ContactVerificationStatePending) resp, err = theirMessenger.DeclineContactVerificationRequest(context.Background(), verificationRequestID) @@ -455,16 +455,16 @@ func (s *MessengerVerificationRequests) TestDeclineVerificationRequests() { s.Require().Equal(resp.ActivityCenterNotifications()[0].ID.String(), verificationRequestID) s.Require().Equal(resp.ActivityCenterNotifications()[0].ContactVerificationStatus, verification.RequestStatusDECLINED) - s.Require().Equal(common.ContactVerificationStateDeclined, resp.ActivityCenterNotifications()[0].Message.ContactVerificationState) + s.Require().Equal(resp.ActivityCenterNotifications()[0].Message.ContactVerificationState, common.ContactVerificationStateDeclined) s.Require().Len(resp.Messages(), 1) - s.Require().Equal(common.ContactVerificationStateDeclined, resp.Messages()[0].ContactVerificationState) + s.Require().Equal(resp.Messages()[0].ContactVerificationState, common.ContactVerificationStateDeclined) // Make sure it's stored and retrieved correctly notifications, err = theirMessenger.UnreadActivityCenterNotifications("", 4, ActivityCenterNotificationTypeContactVerification) s.Require().NoError(err) s.Require().Len(notifications.Notifications, 1) s.Require().Equal(notifications.Notifications[0].ContactVerificationStatus, verification.RequestStatusDECLINED) - s.Require().Equal(common.ContactVerificationStateDeclined, notifications.Notifications[0].Message.ContactVerificationState) + s.Require().Equal(notifications.Notifications[0].Message.ContactVerificationState, common.ContactVerificationStateDeclined) // Wait for the message to reach its destination resp, err = WaitOnMessengerResponse( @@ -479,12 +479,91 @@ func (s *MessengerVerificationRequests) TestDeclineVerificationRequests() { s.Require().Equal(resp.VerificationRequests[0].ID, verificationRequestID) s.Require().Len(resp.Messages(), 1) - s.Require().Equal(common.ContactVerificationStateDeclined, resp.Messages()[0].ContactVerificationState) + s.Require().Equal(resp.Messages()[0].ContactVerificationState, common.ContactVerificationStateDeclined) s.Require().Len(resp.ActivityCenterNotifications(), 1) s.Require().Equal(resp.ActivityCenterNotifications()[0].ID.String(), verificationRequestID) s.Require().Equal(resp.ActivityCenterNotifications()[0].ContactVerificationStatus, verification.RequestStatusDECLINED) - s.Require().Equal(common.ContactVerificationStateDeclined, resp.ActivityCenterNotifications()[0].Message.ContactVerificationState) + s.Require().Equal(resp.ActivityCenterNotifications()[0].Message.ContactVerificationState, common.ContactVerificationStateDeclined) +} + +func (s *MessengerVerificationRequests) TestCancelVerificationRequest() { + theirMessenger := s.newMessenger(s.shh) + _, err := theirMessenger.Start() + s.Require().NoError(err) + + s.mutualContact(theirMessenger) + + theirPk := types.EncodeHex(crypto.FromECDSAPub(&theirMessenger.identity.PublicKey)) + challenge := "challenge" + + resp, err := s.m.SendContactVerificationRequest(context.Background(), theirPk, challenge) + s.Require().NoError(err) + s.Require().Len(resp.VerificationRequests, 1) + verificationRequestID := resp.VerificationRequests[0].ID + + s.Require().Len(resp.Messages(), 1) + s.Require().Equal(challenge, resp.Messages()[0].Text) + s.Require().Equal(common.ContactVerificationStatePending, resp.Messages()[0].ContactVerificationState) + + // Wait for the message to reach its destination + resp, err = WaitOnMessengerResponse( + theirMessenger, + func(r *MessengerResponse) bool { + return len(r.VerificationRequests) > 0 && len(r.ActivityCenterNotifications()) > 0 + }, + "no messages", + ) + s.Require().NoError(err) + s.Require().Len(resp.VerificationRequests, 1) + s.Require().Equal(resp.VerificationRequests[0].ID, verificationRequestID) + s.Require().Equal(resp.ActivityCenterNotifications()[0].Type, ActivityCenterNotificationTypeContactVerification) + s.Require().Equal(resp.ActivityCenterNotifications()[0].ContactVerificationStatus, verification.RequestStatusPENDING) + + s.Require().NotNil(resp.ActivityCenterNotifications()[0].Message) + s.Require().Equal(challenge, resp.ActivityCenterNotifications()[0].Message.Text) + s.Require().Equal(common.ContactVerificationStatePending, resp.ActivityCenterNotifications()[0].Message.ContactVerificationState) + s.Require().Len(resp.Messages(), 1) + s.Require().Equal(challenge, resp.Messages()[0].Text) + s.Require().Equal(common.ContactVerificationStatePending, resp.Messages()[0].ContactVerificationState) + + // Make sure it's stored and retrieved correctly + notifications, err := theirMessenger.UnreadActivityCenterNotifications("", 4, ActivityCenterNotificationTypeContactVerification) + s.Require().NoError(err) + s.Require().Len(notifications.Notifications, 1) + s.Require().Equal(notifications.Notifications[0].ContactVerificationStatus, verification.RequestStatusPENDING) + s.Require().Equal(common.ContactVerificationStatePending, notifications.Notifications[0].Message.ContactVerificationState) + + resp, err = s.m.CancelVerificationRequest(context.Background(), verificationRequestID) + + s.Require().NoError(err) + + s.Require().NotNil(resp) + + s.Require().Len(resp.VerificationRequests, 1) + s.Require().Equal(resp.VerificationRequests[0].ID, verificationRequestID) + s.Require().Equal(resp.VerificationRequests[0].RequestStatus, verification.RequestStatusCANCELED) + + // Check canceled state on the receiver's side + resp, err = WaitOnMessengerResponse( + theirMessenger, + func(r *MessengerResponse) bool { + return len(r.VerificationRequests) > 0 && len(r.ActivityCenterNotifications()) > 0 + }, + "no messages", + ) + s.Require().NoError(err) + s.Require().Len(resp.VerificationRequests, 1) + s.Require().Equal(resp.VerificationRequests[0].ID, verificationRequestID) + s.Require().Equal(resp.ActivityCenterNotifications()[0].Type, ActivityCenterNotificationTypeContactVerification) + s.Require().Equal(resp.ActivityCenterNotifications()[0].ContactVerificationStatus, verification.RequestStatusCANCELED) + + s.Require().NotNil(resp.ActivityCenterNotifications()[0].Message) + s.Require().Equal(challenge, resp.ActivityCenterNotifications()[0].Message.Text) + s.Require().Equal(resp.ActivityCenterNotifications()[0].Message.ContactVerificationState, common.ContactVerificationStateCanceled) + s.Require().Len(resp.Messages(), 1) + s.Require().Equal(challenge, resp.Messages()[0].Text) + s.Require().Equal(resp.Messages()[0].ContactVerificationState, common.ContactVerificationStateCanceled) } func (s *MessengerVerificationRequests) TearDownTest() { diff --git a/protocol/protobuf/application_metadata_message.pb.go b/protocol/protobuf/application_metadata_message.pb.go index 2d5abf7e2..801bb1eca 100644 --- a/protocol/protobuf/application_metadata_message.pb.go +++ b/protocol/protobuf/application_metadata_message.pb.go @@ -84,6 +84,7 @@ const ( ApplicationMetadataMessage_SYNC_DELETE_FOR_ME_MESSAGE ApplicationMetadataMessage_Type = 58 ApplicationMetadataMessage_SYNC_SAVED_ADDRESS ApplicationMetadataMessage_Type = 59 ApplicationMetadataMessage_COMMUNITY_CANCEL_REQUEST_TO_JOIN ApplicationMetadataMessage_Type = 60 + ApplicationMetadataMessage_CANCEL_CONTACT_VERIFICATION ApplicationMetadataMessage_Type = 61 ) var ApplicationMetadataMessage_Type_name = map[int32]string{ @@ -148,6 +149,7 @@ var ApplicationMetadataMessage_Type_name = map[int32]string{ 58: "SYNC_DELETE_FOR_ME_MESSAGE", 59: "SYNC_SAVED_ADDRESS", 60: "COMMUNITY_CANCEL_REQUEST_TO_JOIN", + 61: "CANCEL_CONTACT_VERIFICATION", } var ApplicationMetadataMessage_Type_value = map[string]int32{ @@ -212,6 +214,7 @@ var ApplicationMetadataMessage_Type_value = map[string]int32{ "SYNC_DELETE_FOR_ME_MESSAGE": 58, "SYNC_SAVED_ADDRESS": 59, "COMMUNITY_CANCEL_REQUEST_TO_JOIN": 60, + "CANCEL_CONTACT_VERIFICATION": 61, } func (x ApplicationMetadataMessage_Type) String() string { @@ -290,62 +293,63 @@ func init() { } var fileDescriptor_ad09a6406fcf24c7 = []byte{ - // 908 bytes of a gzipped FileDescriptorProto + // 914 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x55, 0x5b, 0x77, 0x13, 0x37, - 0x10, 0x6e, 0x20, 0x4d, 0x40, 0xb9, 0xa0, 0x88, 0x5c, 0x9c, 0xbb, 0x31, 0x34, 0x04, 0x68, 0x4d, - 0x0b, 0xbd, 0xd3, 0x3e, 0xc8, 0xd2, 0xc4, 0x16, 0xde, 0x95, 0x16, 0x49, 0x6b, 0x8e, 0xfb, 0xa2, - 0xb3, 0x14, 0x97, 0x93, 0x73, 0x80, 0xf8, 0x10, 0xf3, 0x90, 0x9f, 0xda, 0x5f, 0xd1, 0xbf, 0xd0, - 0xa3, 0xbd, 0x3a, 0xb6, 0x43, 0x9e, 0x92, 0x9d, 0xf9, 0x34, 0xa3, 0xf9, 0xe6, 0xfb, 0x64, 0xd4, - 0x48, 0x86, 0xc3, 0xf7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a, 0x25, 0xf1, 0xbc, 0x0f, 0x9b, 0xbe, 0x64, - 0x97, 0xc3, 0x5f, 0x93, 0xfb, 0xe8, 0x50, 0xc3, 0xab, 0x18, 0x8c, 0x75, 0x94, 0x73, 0x0d, 0xc6, - 0xb8, 0x13, 0xa5, 0x9d, 0xd5, 0x54, 0x1a, 0xca, 0x52, 0xd0, 0x02, 0x79, 0x8c, 0x8e, 0x28, 0x63, - 0x10, 0x59, 0x77, 0x1d, 0x76, 0x91, 0x3c, 0x41, 0x0f, 0x39, 0xb0, 0x40, 0x48, 0xb8, 0x16, 0x7c, - 0x8b, 0x6c, 0xa1, 0xbb, 0x05, 0x68, 0x3c, 0x71, 0x9b, 0xac, 0x23, 0x6c, 0x40, 0xf2, 0x4b, 0x51, - 0x44, 0x0e, 0xd1, 0xee, 0x64, 0xed, 0x71, 0xc0, 0x92, 0xa7, 0x66, 0x6a, 0x48, 0x97, 0x13, 0x88, - 0x97, 0x67, 0xa7, 0x29, 0x63, 0x2a, 0x96, 0x16, 0xaf, 0x90, 0x7b, 0x68, 0x7f, 0x3a, 0x1d, 0xc5, - 0xad, 0x40, 0x30, 0xe7, 0xf7, 0x82, 0x57, 0xc9, 0x01, 0xda, 0x29, 0xf6, 0xc1, 0x14, 0x07, 0x47, - 0x79, 0x0f, 0xb4, 0x15, 0x06, 0x42, 0x90, 0x16, 0xdf, 0x21, 0x0d, 0x74, 0x10, 0xc5, 0xa6, 0xe3, - 0xa4, 0xb2, 0xe2, 0x44, 0xb0, 0xac, 0x84, 0x86, 0xb6, 0x30, 0x56, 0x67, 0x94, 0x63, 0xcf, 0xd0, - 0x97, 0x31, 0x4e, 0x83, 0x89, 0x94, 0x34, 0x80, 0xd7, 0xc8, 0x2e, 0xda, 0x9a, 0x06, 0xbf, 0x8a, - 0x41, 0xf7, 0x31, 0x21, 0x0f, 0x50, 0xfd, 0x8a, 0x64, 0x55, 0xe2, 0xae, 0x9f, 0x7a, 0x56, 0xbf, - 0x94, 0x3f, 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 0xa9, 0x19, 0x24, 0x05, 0x40, 0x7b, 0x80, 0x7f, 0xf3, 0xf9, 0xb4, 0x44, + 0xee, 0x05, 0xff, 0x2e, 0x87, 0x95, 0x25, 0x7e, 0x2f, 0xc5, 0x61, 0x68, 0x0f, 0x78, 0xf1, 0x7c, + 0xe3, 0xe7, 0xfe, 0xbd, 0xa9, 0xea, 0x32, 0x2a, 0x19, 0x04, 0x53, 0xd6, 0xfc, 0xc3, 0x73, 0x97, + 0xe7, 0x66, 0x32, 0xf3, 0xa2, 0xb5, 0xf2, 0xe7, 0x52, 0xf3, 0xc9, 0xf3, 0xe2, 0x17, 0xf3, 0xcd, + 0x42, 0xfa, 0xdf, 0xb3, 0xff, 0x02, 0x00, 0x00, 0xff, 0xff, 0xc3, 0x1d, 0x3f, 0x82, 0xd8, 0x07, + 0x00, 0x00, } diff --git a/protocol/protobuf/application_metadata_message.proto b/protocol/protobuf/application_metadata_message.proto index bd2f1d62d..39796d16f 100644 --- a/protocol/protobuf/application_metadata_message.proto +++ b/protocol/protobuf/application_metadata_message.proto @@ -74,5 +74,6 @@ message ApplicationMetadataMessage { SYNC_DELETE_FOR_ME_MESSAGE = 58; SYNC_SAVED_ADDRESS = 59; COMMUNITY_CANCEL_REQUEST_TO_JOIN = 60; + CANCEL_CONTACT_VERIFICATION = 61; } } diff --git a/protocol/protobuf/chat_message.pb.go b/protocol/protobuf/chat_message.pb.go index 2e7c0f2d0..c863ec959 100644 --- a/protocol/protobuf/chat_message.pb.go +++ b/protocol/protobuf/chat_message.pb.go @@ -825,6 +825,7 @@ type ChatMessage struct { // The type of the content of the message ContentType ChatMessage_ContentType `protobuf:"varint,8,opt,name=content_type,json=contentType,proto3,enum=protobuf.ChatMessage_ContentType" json:"content_type,omitempty"` // Types that are valid to be assigned to Payload: + // // *ChatMessage_Sticker // *ChatMessage_Image // *ChatMessage_Audio diff --git a/protocol/protobuf/contact_verification.pb.go b/protocol/protobuf/contact_verification.pb.go index daa5891ed..cf3c95350 100644 --- a/protocol/protobuf/contact_verification.pb.go +++ b/protocol/protobuf/contact_verification.pb.go @@ -216,11 +216,59 @@ func (m *DeclineContactVerification) GetId() string { return "" } +type CancelContactVerification struct { + Clock uint64 `protobuf:"varint,1,opt,name=clock,proto3" json:"clock,omitempty"` + Id string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CancelContactVerification) Reset() { *m = CancelContactVerification{} } +func (m *CancelContactVerification) String() string { return proto.CompactTextString(m) } +func (*CancelContactVerification) ProtoMessage() {} +func (*CancelContactVerification) Descriptor() ([]byte, []int) { + return fileDescriptor_d6997df64de39454, []int{4} +} + +func (m *CancelContactVerification) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_CancelContactVerification.Unmarshal(m, b) +} +func (m *CancelContactVerification) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_CancelContactVerification.Marshal(b, m, deterministic) +} +func (m *CancelContactVerification) XXX_Merge(src proto.Message) { + xxx_messageInfo_CancelContactVerification.Merge(m, src) +} +func (m *CancelContactVerification) XXX_Size() int { + return xxx_messageInfo_CancelContactVerification.Size(m) +} +func (m *CancelContactVerification) XXX_DiscardUnknown() { + xxx_messageInfo_CancelContactVerification.DiscardUnknown(m) +} + +var xxx_messageInfo_CancelContactVerification proto.InternalMessageInfo + +func (m *CancelContactVerification) GetClock() uint64 { + if m != nil { + return m.Clock + } + return 0 +} + +func (m *CancelContactVerification) GetId() string { + if m != nil { + return m.Id + } + return "" +} + func init() { proto.RegisterType((*RequestContactVerification)(nil), "protobuf.RequestContactVerification") proto.RegisterType((*AcceptContactVerification)(nil), "protobuf.AcceptContactVerification") proto.RegisterType((*ContactVerificationTrusted)(nil), "protobuf.ContactVerificationTrusted") proto.RegisterType((*DeclineContactVerification)(nil), "protobuf.DeclineContactVerification") + proto.RegisterType((*CancelContactVerification)(nil), "protobuf.CancelContactVerification") } func init() { @@ -228,7 +276,7 @@ func init() { } var fileDescriptor_d6997df64de39454 = []byte{ - // 196 bytes of a gzipped FileDescriptorProto + // 208 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4a, 0xce, 0xcf, 0x2b, 0x49, 0x4c, 0x2e, 0x89, 0x2f, 0x4b, 0x2d, 0xca, 0x4c, 0xcb, 0x4c, 0x4e, 0x2c, 0xc9, 0xcc, 0xcf, 0xd3, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x00, 0x53, 0x49, 0xa5, 0x69, 0x4a, 0x01, 0x5c, @@ -239,7 +287,7 @@ var fileDescriptor_d6997df64de39454 = []byte{ 0x06, 0xf2, 0x71, 0x31, 0x65, 0xa6, 0x48, 0x30, 0x81, 0x4d, 0x62, 0xca, 0x4c, 0x11, 0x92, 0xe2, 0xe2, 0x28, 0x4a, 0x2d, 0x2e, 0xc8, 0xcf, 0x2b, 0x86, 0x99, 0x0f, 0xe7, 0x2b, 0x39, 0x71, 0x49, 0x61, 0x31, 0x38, 0xa4, 0xa8, 0xb4, 0xb8, 0x24, 0x35, 0x85, 0x38, 0xf3, 0x41, 0x66, 0xb8, 0xa4, - 0x26, 0xe7, 0x64, 0xe6, 0xa5, 0x92, 0xed, 0x46, 0x27, 0xde, 0x28, 0x6e, 0x3d, 0x7d, 0x6b, 0x58, - 0x38, 0x26, 0xb1, 0x81, 0x59, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x70, 0x15, 0x72, 0xc2, - 0x76, 0x01, 0x00, 0x00, + 0x26, 0xe7, 0x64, 0xe6, 0xa5, 0x92, 0xed, 0x46, 0x25, 0x47, 0x2e, 0x49, 0xe7, 0xc4, 0xbc, 0xe4, + 0xd4, 0x1c, 0xb2, 0x8d, 0x70, 0xe2, 0x8d, 0xe2, 0xd6, 0xd3, 0xb7, 0x86, 0x45, 0x45, 0x12, 0x1b, + 0x98, 0x65, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0x9c, 0x91, 0x98, 0xa6, 0xb9, 0x01, 0x00, 0x00, } diff --git a/protocol/protobuf/contact_verification.proto b/protocol/protobuf/contact_verification.proto index 3b0095ff0..7d96ad72d 100644 --- a/protocol/protobuf/contact_verification.proto +++ b/protocol/protobuf/contact_verification.proto @@ -23,3 +23,8 @@ message DeclineContactVerification { uint64 clock = 1; string id = 2; } + +message CancelContactVerification { + uint64 clock = 1; + string id = 2; +} diff --git a/protocol/protobuf/membership_update_message.pb.go b/protocol/protobuf/membership_update_message.pb.go index 418cb7cfe..f49cfcd0e 100644 --- a/protocol/protobuf/membership_update_message.pb.go +++ b/protocol/protobuf/membership_update_message.pb.go @@ -166,6 +166,7 @@ type MembershipUpdateMessage struct { // An optional chat message // // Types that are valid to be assigned to ChatEntity: + // // *MembershipUpdateMessage_Message // *MembershipUpdateMessage_EmojiReaction ChatEntity isMembershipUpdateMessage_ChatEntity `protobuf_oneof:"chat_entity"` diff --git a/protocol/protobuf/status_update.pb.go b/protocol/protobuf/status_update.pb.go index 8a6358c5c..399b7d5a1 100644 --- a/protocol/protobuf/status_update.pb.go +++ b/protocol/protobuf/status_update.pb.go @@ -55,16 +55,16 @@ func (StatusUpdate_StatusType) EnumDescriptor() ([]byte, []int) { } // Specs: -//:AUTOMATIC -//To Send - "AUTOMATIC" status ping every 5 minutes -//Display - Online for up to 5 minutes from the last clock, after that Offline -//:ALWAYS_ONLINE -//To Send - "ALWAYS_ONLINE" status ping every 5 minutes -//Display - Online for up to 2 weeks from the last clock, after that Offline -//:INACTIVE -//To Send - A single "INACTIVE" status ping -//Display - Offline forever -//Note: Only send pings if the user interacted with the app in the last x minutes. +// :AUTOMATIC +// To Send - "AUTOMATIC" status ping every 5 minutes +// Display - Online for up to 5 minutes from the last clock, after that Offline +// :ALWAYS_ONLINE +// To Send - "ALWAYS_ONLINE" status ping every 5 minutes +// Display - Online for up to 2 weeks from the last clock, after that Offline +// :INACTIVE +// To Send - A single "INACTIVE" status ping +// Display - Offline forever +// Note: Only send pings if the user interacted with the app in the last x minutes. type StatusUpdate struct { Clock uint64 `protobuf:"varint,1,opt,name=clock,proto3" json:"clock,omitempty"` StatusType StatusUpdate_StatusType `protobuf:"varint,2,opt,name=status_type,json=statusType,proto3,enum=protobuf.StatusUpdate_StatusType" json:"status_type,omitempty"` diff --git a/protocol/protobuf/sync_settings.pb.go b/protocol/protobuf/sync_settings.pb.go index b05dd8835..16d909e18 100644 --- a/protocol/protobuf/sync_settings.pb.go +++ b/protocol/protobuf/sync_settings.pb.go @@ -82,6 +82,7 @@ type SyncSetting struct { Type SyncSetting_Type `protobuf:"varint,1,opt,name=type,proto3,enum=protobuf.SyncSetting_Type" json:"type,omitempty"` Clock uint64 `protobuf:"varint,2,opt,name=clock,proto3" json:"clock,omitempty"` // Types that are valid to be assigned to Value: + // // *SyncSetting_ValueString // *SyncSetting_ValueBytes // *SyncSetting_ValueBool diff --git a/protocol/v1/status_message.go b/protocol/v1/status_message.go index 3992eac73..49645e914 100644 --- a/protocol/v1/status_message.go +++ b/protocol/v1/status_message.go @@ -306,6 +306,8 @@ func (m *StatusMessage) HandleApplication() error { return m.unmarshalProtobufData(new(protobuf.RequestContactVerification)) case protobuf.ApplicationMetadataMessage_ACCEPT_CONTACT_VERIFICATION: return m.unmarshalProtobufData(new(protobuf.AcceptContactVerification)) + case protobuf.ApplicationMetadataMessage_CANCEL_CONTACT_VERIFICATION: + return m.unmarshalProtobufData(new(protobuf.CancelContactVerification)) case protobuf.ApplicationMetadataMessage_CONTACT_VERIFICATION_TRUSTED: return m.unmarshalProtobufData(new(protobuf.ContactVerificationTrusted)) case protobuf.ApplicationMetadataMessage_DECLINE_CONTACT_VERIFICATION: diff --git a/protocol/verification/persistence.go b/protocol/verification/persistence.go index bb4fcf8ea..68b74ca75 100644 --- a/protocol/verification/persistence.go +++ b/protocol/verification/persistence.go @@ -127,9 +127,9 @@ func (p *Persistence) GetReceivedVerificationRequests(myPublicKey string) ([]*Re return response, nil } -func (p *Persistence) GetVerificationRequestSentTo(contactID string) (*Request, error) { +func (p *Persistence) GetLatestVerificationRequestSentTo(contactID string) (*Request, error) { var vr Request - err := p.db.QueryRow(`SELECT id, from_user, to_user, challenge, response, requested_at, verification_status, replied_at FROM verification_requests_individual WHERE to_user = ?`, contactID).Scan( + err := p.db.QueryRow(`SELECT id, from_user, to_user, challenge, response, requested_at, verification_status, replied_at FROM verification_requests_individual WHERE to_user = ? ORDER BY requested_at DESC`, contactID).Scan( &vr.ID, &vr.From, &vr.To, diff --git a/services/ext/api.go b/services/ext/api.go index 22efc0545..acf06cb2c 100644 --- a/services/ext/api.go +++ b/services/ext/api.go @@ -820,16 +820,16 @@ func (api *PublicAPI) GetVerificationRequestSentTo(ctx context.Context, contactI return api.service.messenger.GetVerificationRequestSentTo(ctx, contactID) } -func (api *PublicAPI) CancelVerificationRequest(ctx context.Context, contactID string) error { - return api.service.messenger.CancelVerificationRequest(ctx, contactID) +func (api *PublicAPI) CancelVerificationRequest(ctx context.Context, id string) (*protocol.MessengerResponse, error) { + return api.service.messenger.CancelVerificationRequest(ctx, id) } -func (api *PublicAPI) AcceptContactVerificationRequest(ctx context.Context, contactID string, response string) (*protocol.MessengerResponse, error) { - return api.service.messenger.AcceptContactVerificationRequest(ctx, contactID, response) +func (api *PublicAPI) AcceptContactVerificationRequest(ctx context.Context, id string, response string) (*protocol.MessengerResponse, error) { + return api.service.messenger.AcceptContactVerificationRequest(ctx, id, response) } -func (api *PublicAPI) DeclineContactVerificationRequest(ctx context.Context, contactID string) (*protocol.MessengerResponse, error) { - return api.service.messenger.DeclineContactVerificationRequest(ctx, contactID) +func (api *PublicAPI) DeclineContactVerificationRequest(ctx context.Context, id string) (*protocol.MessengerResponse, error) { + return api.service.messenger.DeclineContactVerificationRequest(ctx, id) } func (api *PublicAPI) VerifiedTrusted(ctx context.Context, request *requests.VerifiedTrusted) (*protocol.MessengerResponse, error) {