2022-07-05 19:49:44 +00:00
|
|
|
package protocol
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"strings"
|
|
|
|
|
|
|
|
"github.com/pkg/errors"
|
|
|
|
"go.uber.org/zap"
|
|
|
|
|
|
|
|
"github.com/ethereum/go-ethereum/common/hexutil"
|
|
|
|
|
|
|
|
"github.com/golang/protobuf/proto"
|
|
|
|
|
|
|
|
"github.com/status-im/status-go/eth-node/crypto"
|
2022-08-31 14:41:58 +00:00
|
|
|
"github.com/status-im/status-go/eth-node/types"
|
|
|
|
|
2022-07-05 19:49:44 +00:00
|
|
|
"github.com/status-im/status-go/protocol/common"
|
|
|
|
"github.com/status-im/status-go/protocol/protobuf"
|
2022-10-28 11:37:46 +00:00
|
|
|
"github.com/status-im/status-go/protocol/requests"
|
2023-08-18 11:39:59 +00:00
|
|
|
v1protocol "github.com/status-im/status-go/protocol/v1"
|
2022-07-05 19:49:44 +00:00
|
|
|
"github.com/status-im/status-go/protocol/verification"
|
|
|
|
)
|
|
|
|
|
|
|
|
const minContactVerificationMessageLen = 1
|
|
|
|
const maxContactVerificationMessageLen = 280
|
|
|
|
|
test_: Code Migration from status-cli-tests
author shashankshampi <shashank.sanket1995@gmail.com> 1729780155 +0530
committer shashankshampi <shashank.sanket1995@gmail.com> 1730274350 +0530
test: Code Migration from status-cli-tests
fix_: functional tests (#5979)
* fix_: generate on test-functional
* chore(test)_: fix functional test assertion
---------
Co-authored-by: Siddarth Kumar <siddarthkay@gmail.com>
feat(accounts)_: cherry-pick Persist acceptance of Terms of Use & Privacy policy (#5766) (#5977)
* feat(accounts)_: Persist acceptance of Terms of Use & Privacy policy (#5766)
The original GH issue https://github.com/status-im/status-mobile/issues/21113
came from a request from the Legal team. We must show to Status v1 users the new
terms (Terms of Use & Privacy Policy) right after they upgrade to Status v2
from the stores.
The solution we use is to create a flag in the accounts table, named
hasAcceptedTerms. The flag will be set to true on the first account ever
created in v2 and we provide a native call in mobile/status.go#AcceptTerms,
which allows the client to persist the user's choice in case they are upgrading
(from v1 -> v2, or from a v2 older than this PR).
This solution is not the best because we should store the setting in a separate
table, not in the accounts table.
Related Mobile PR https://github.com/status-im/status-mobile/pull/21124
* fix(test)_: Compare addresses using uppercased strings
---------
Co-authored-by: Icaro Motta <icaro.ldm@gmail.com>
test_: restore account (#5960)
feat_: `LogOnPanic` linter (#5969)
* feat_: LogOnPanic linter
* fix_: add missing defer LogOnPanic
* chore_: make vendor
* fix_: tests, address pr comments
* fix_: address pr comments
fix(ci)_: remove workspace and tmp dir
This ensures we do not encounter weird errors like:
```
+ ln -s /home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907 /home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907@tmp/go/src/github.com/status-im/status-go
ln: failed to create symbolic link '/home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907@tmp/go/src/github.com/status-im/status-go': File exists
script returned exit code 1
```
Signed-off-by: Jakub Sokołowski <jakub@status.im>
chore_: enable windows and macos CI build (#5840)
- Added support for Windows and macOS in CI pipelines
- Added missing dependencies for Windows and x86-64-darwin
- Resolved macOS SDK version compatibility for darwin-x86_64
The `mkShell` override was necessary to ensure compatibility with the newer
macOS SDK (version 11.0) for x86_64. The default SDK (10.12) was causing build failures
because of the missing libs and frameworks. OverrideSDK creates a mapping from
the default SDK in all package categories to the requested SDK (11.0).
fix(contacts)_: fix trust status not being saved to cache when changed (#5965)
Fixes https://github.com/status-im/status-desktop/issues/16392
cleanup
added logger and cleanup
review comments changes
fix_: functional tests (#5979)
* fix_: generate on test-functional
* chore(test)_: fix functional test assertion
---------
Co-authored-by: Siddarth Kumar <siddarthkay@gmail.com>
feat(accounts)_: cherry-pick Persist acceptance of Terms of Use & Privacy policy (#5766) (#5977)
* feat(accounts)_: Persist acceptance of Terms of Use & Privacy policy (#5766)
The original GH issue https://github.com/status-im/status-mobile/issues/21113
came from a request from the Legal team. We must show to Status v1 users the new
terms (Terms of Use & Privacy Policy) right after they upgrade to Status v2
from the stores.
The solution we use is to create a flag in the accounts table, named
hasAcceptedTerms. The flag will be set to true on the first account ever
created in v2 and we provide a native call in mobile/status.go#AcceptTerms,
which allows the client to persist the user's choice in case they are upgrading
(from v1 -> v2, or from a v2 older than this PR).
This solution is not the best because we should store the setting in a separate
table, not in the accounts table.
Related Mobile PR https://github.com/status-im/status-mobile/pull/21124
* fix(test)_: Compare addresses using uppercased strings
---------
Co-authored-by: Icaro Motta <icaro.ldm@gmail.com>
test_: restore account (#5960)
feat_: `LogOnPanic` linter (#5969)
* feat_: LogOnPanic linter
* fix_: add missing defer LogOnPanic
* chore_: make vendor
* fix_: tests, address pr comments
* fix_: address pr comments
chore_: enable windows and macos CI build (#5840)
- Added support for Windows and macOS in CI pipelines
- Added missing dependencies for Windows and x86-64-darwin
- Resolved macOS SDK version compatibility for darwin-x86_64
The `mkShell` override was necessary to ensure compatibility with the newer
macOS SDK (version 11.0) for x86_64. The default SDK (10.12) was causing build failures
because of the missing libs and frameworks. OverrideSDK creates a mapping from
the default SDK in all package categories to the requested SDK (11.0).
fix(contacts)_: fix trust status not being saved to cache when changed (#5965)
Fixes https://github.com/status-im/status-desktop/issues/16392
test_: remove port bind
chore(wallet)_: move route execution code to separate module
chore_: replace geth logger with zap logger (#5962)
closes: #6002
feat(telemetry)_: add metrics for message reliability (#5899)
* feat(telemetry)_: track message reliability
Add metrics for dial errors, missed messages,
missed relevant messages, and confirmed delivery.
* fix_: handle error from json marshal
chore_: use zap logger as request logger
iterates: status-im/status-desktop#16536
test_: unique project per run
test_: use docker compose v2, more concrete project name
fix(codecov)_: ignore folders without tests
Otherwise Codecov reports incorrect numbers when making changes.
https://docs.codecov.com/docs/ignoring-paths
Signed-off-by: Jakub Sokołowski <jakub@status.im>
test_: verify schema of signals during init; fix schema verification warnings (#5947)
fix_: update defaultGorushURL (#6011)
fix(tests)_: use non-standard port to avoid conflicts
We have observed `nimbus-eth2` build failures reporting this port:
```json
{
"lvl": "NTC",
"ts": "2024-10-28 13:51:32.308+00:00",
"msg": "REST HTTP server could not be started",
"topics": "beacnde",
"address": "127.0.0.1:5432",
"reason": "(98) Address already in use"
}
```
https://ci.status.im/job/nimbus-eth2/job/platforms/job/linux/job/x86_64/job/main/job/PR-6683/3/
Signed-off-by: Jakub Sokołowski <jakub@status.im>
fix_: create request logger ad-hoc in tests
Fixes `TestCall` failing when run concurrently.
chore_: configure codecov (#6005)
* chore_: configure codecov
* fix_: after_n_builds
2024-10-24 14:29:15 +00:00
|
|
|
var (
|
|
|
|
ErrContactNotMutual = errors.New("must be a mutual contact")
|
|
|
|
)
|
|
|
|
|
2022-08-31 14:41:58 +00:00
|
|
|
func (m *Messenger) SendContactVerificationRequest(ctx context.Context, contactID string, challenge string) (*MessengerResponse, error) {
|
2022-07-05 19:49:44 +00:00
|
|
|
if len(challenge) < minContactVerificationMessageLen || len(challenge) > maxContactVerificationMessageLen {
|
2022-08-31 14:41:58 +00:00
|
|
|
return nil, errors.New("invalid verification request challenge length")
|
2022-07-05 19:49:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
contact, ok := m.allContacts.Load(contactID)
|
2023-01-20 14:28:30 +00:00
|
|
|
if !ok || !contact.mutual() {
|
test_: Code Migration from status-cli-tests
author shashankshampi <shashank.sanket1995@gmail.com> 1729780155 +0530
committer shashankshampi <shashank.sanket1995@gmail.com> 1730274350 +0530
test: Code Migration from status-cli-tests
fix_: functional tests (#5979)
* fix_: generate on test-functional
* chore(test)_: fix functional test assertion
---------
Co-authored-by: Siddarth Kumar <siddarthkay@gmail.com>
feat(accounts)_: cherry-pick Persist acceptance of Terms of Use & Privacy policy (#5766) (#5977)
* feat(accounts)_: Persist acceptance of Terms of Use & Privacy policy (#5766)
The original GH issue https://github.com/status-im/status-mobile/issues/21113
came from a request from the Legal team. We must show to Status v1 users the new
terms (Terms of Use & Privacy Policy) right after they upgrade to Status v2
from the stores.
The solution we use is to create a flag in the accounts table, named
hasAcceptedTerms. The flag will be set to true on the first account ever
created in v2 and we provide a native call in mobile/status.go#AcceptTerms,
which allows the client to persist the user's choice in case they are upgrading
(from v1 -> v2, or from a v2 older than this PR).
This solution is not the best because we should store the setting in a separate
table, not in the accounts table.
Related Mobile PR https://github.com/status-im/status-mobile/pull/21124
* fix(test)_: Compare addresses using uppercased strings
---------
Co-authored-by: Icaro Motta <icaro.ldm@gmail.com>
test_: restore account (#5960)
feat_: `LogOnPanic` linter (#5969)
* feat_: LogOnPanic linter
* fix_: add missing defer LogOnPanic
* chore_: make vendor
* fix_: tests, address pr comments
* fix_: address pr comments
fix(ci)_: remove workspace and tmp dir
This ensures we do not encounter weird errors like:
```
+ ln -s /home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907 /home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907@tmp/go/src/github.com/status-im/status-go
ln: failed to create symbolic link '/home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907@tmp/go/src/github.com/status-im/status-go': File exists
script returned exit code 1
```
Signed-off-by: Jakub Sokołowski <jakub@status.im>
chore_: enable windows and macos CI build (#5840)
- Added support for Windows and macOS in CI pipelines
- Added missing dependencies for Windows and x86-64-darwin
- Resolved macOS SDK version compatibility for darwin-x86_64
The `mkShell` override was necessary to ensure compatibility with the newer
macOS SDK (version 11.0) for x86_64. The default SDK (10.12) was causing build failures
because of the missing libs and frameworks. OverrideSDK creates a mapping from
the default SDK in all package categories to the requested SDK (11.0).
fix(contacts)_: fix trust status not being saved to cache when changed (#5965)
Fixes https://github.com/status-im/status-desktop/issues/16392
cleanup
added logger and cleanup
review comments changes
fix_: functional tests (#5979)
* fix_: generate on test-functional
* chore(test)_: fix functional test assertion
---------
Co-authored-by: Siddarth Kumar <siddarthkay@gmail.com>
feat(accounts)_: cherry-pick Persist acceptance of Terms of Use & Privacy policy (#5766) (#5977)
* feat(accounts)_: Persist acceptance of Terms of Use & Privacy policy (#5766)
The original GH issue https://github.com/status-im/status-mobile/issues/21113
came from a request from the Legal team. We must show to Status v1 users the new
terms (Terms of Use & Privacy Policy) right after they upgrade to Status v2
from the stores.
The solution we use is to create a flag in the accounts table, named
hasAcceptedTerms. The flag will be set to true on the first account ever
created in v2 and we provide a native call in mobile/status.go#AcceptTerms,
which allows the client to persist the user's choice in case they are upgrading
(from v1 -> v2, or from a v2 older than this PR).
This solution is not the best because we should store the setting in a separate
table, not in the accounts table.
Related Mobile PR https://github.com/status-im/status-mobile/pull/21124
* fix(test)_: Compare addresses using uppercased strings
---------
Co-authored-by: Icaro Motta <icaro.ldm@gmail.com>
test_: restore account (#5960)
feat_: `LogOnPanic` linter (#5969)
* feat_: LogOnPanic linter
* fix_: add missing defer LogOnPanic
* chore_: make vendor
* fix_: tests, address pr comments
* fix_: address pr comments
chore_: enable windows and macos CI build (#5840)
- Added support for Windows and macOS in CI pipelines
- Added missing dependencies for Windows and x86-64-darwin
- Resolved macOS SDK version compatibility for darwin-x86_64
The `mkShell` override was necessary to ensure compatibility with the newer
macOS SDK (version 11.0) for x86_64. The default SDK (10.12) was causing build failures
because of the missing libs and frameworks. OverrideSDK creates a mapping from
the default SDK in all package categories to the requested SDK (11.0).
fix(contacts)_: fix trust status not being saved to cache when changed (#5965)
Fixes https://github.com/status-im/status-desktop/issues/16392
test_: remove port bind
chore(wallet)_: move route execution code to separate module
chore_: replace geth logger with zap logger (#5962)
closes: #6002
feat(telemetry)_: add metrics for message reliability (#5899)
* feat(telemetry)_: track message reliability
Add metrics for dial errors, missed messages,
missed relevant messages, and confirmed delivery.
* fix_: handle error from json marshal
chore_: use zap logger as request logger
iterates: status-im/status-desktop#16536
test_: unique project per run
test_: use docker compose v2, more concrete project name
fix(codecov)_: ignore folders without tests
Otherwise Codecov reports incorrect numbers when making changes.
https://docs.codecov.com/docs/ignoring-paths
Signed-off-by: Jakub Sokołowski <jakub@status.im>
test_: verify schema of signals during init; fix schema verification warnings (#5947)
fix_: update defaultGorushURL (#6011)
fix(tests)_: use non-standard port to avoid conflicts
We have observed `nimbus-eth2` build failures reporting this port:
```json
{
"lvl": "NTC",
"ts": "2024-10-28 13:51:32.308+00:00",
"msg": "REST HTTP server could not be started",
"topics": "beacnde",
"address": "127.0.0.1:5432",
"reason": "(98) Address already in use"
}
```
https://ci.status.im/job/nimbus-eth2/job/platforms/job/linux/job/x86_64/job/main/job/PR-6683/3/
Signed-off-by: Jakub Sokołowski <jakub@status.im>
fix_: create request logger ad-hoc in tests
Fixes `TestCall` failing when run concurrently.
chore_: configure codecov (#6005)
* chore_: configure codecov
* fix_: after_n_builds
2024-10-24 14:29:15 +00:00
|
|
|
return nil, ErrContactNotMutual
|
2022-07-05 19:49:44 +00:00
|
|
|
}
|
|
|
|
|
2022-08-31 14:41:58 +00:00
|
|
|
verifRequest := &verification.Request{
|
|
|
|
From: common.PubkeyToHex(&m.identity.PublicKey),
|
|
|
|
To: contact.ID,
|
|
|
|
Challenge: challenge,
|
|
|
|
RequestStatus: verification.RequestStatusPENDING,
|
|
|
|
RepliedAt: 0,
|
2022-07-05 19:49:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
chat, ok := m.allChats.Load(contactID)
|
|
|
|
if !ok {
|
|
|
|
publicKey, err := contact.PublicKey()
|
|
|
|
if err != nil {
|
2022-08-31 14:41:58 +00:00
|
|
|
return nil, err
|
2022-07-05 19:49:44 +00:00
|
|
|
}
|
|
|
|
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())
|
|
|
|
|
|
|
|
request := &protobuf.RequestContactVerification{
|
|
|
|
Clock: clock,
|
|
|
|
Challenge: challenge,
|
|
|
|
}
|
|
|
|
|
|
|
|
encodedMessage, err := proto.Marshal(request)
|
|
|
|
if err != nil {
|
2022-08-31 14:41:58 +00:00
|
|
|
return nil, err
|
2022-07-05 19:49:44 +00:00
|
|
|
}
|
|
|
|
|
2022-08-31 14:41:58 +00:00
|
|
|
rawMessage, err := m.dispatchMessage(ctx, common.RawMessage{
|
2024-03-22 10:55:09 +00:00
|
|
|
LocalChatID: chat.ID,
|
|
|
|
Payload: encodedMessage,
|
|
|
|
MessageType: protobuf.ApplicationMetadataMessage_REQUEST_CONTACT_VERIFICATION,
|
|
|
|
ResendType: common.ResendTypeDataSync,
|
2022-07-05 19:49:44 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
if err != nil {
|
2022-08-31 14:41:58 +00:00
|
|
|
return nil, err
|
2022-07-05 19:49:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
contact.VerificationStatus = VerificationStatusVERIFYING
|
|
|
|
contact.LastUpdatedLocally = m.getTimesource().GetCurrentTime()
|
|
|
|
|
|
|
|
err = m.persistence.SaveContact(contact, nil)
|
|
|
|
if err != nil {
|
2022-08-31 14:41:58 +00:00
|
|
|
return nil, err
|
2022-07-05 19:49:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// We sync the contact with the other devices
|
2023-01-06 12:21:14 +00:00
|
|
|
err = m.syncContact(context.Background(), contact, m.dispatchMessage)
|
2022-07-05 19:49:44 +00:00
|
|
|
if err != nil {
|
2022-08-31 14:41:58 +00:00
|
|
|
return nil, err
|
2022-07-05 19:49:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
m.allContacts.Store(contact.ID, contact)
|
|
|
|
|
|
|
|
verifRequest.RequestedAt = clock
|
2022-08-31 14:41:58 +00:00
|
|
|
verifRequest.ID = rawMessage.ID
|
2022-07-05 19:49:44 +00:00
|
|
|
|
|
|
|
err = m.verificationDatabase.SaveVerificationRequest(verifRequest)
|
|
|
|
if err != nil {
|
2022-08-31 14:41:58 +00:00
|
|
|
return nil, err
|
2022-07-05 19:49:44 +00:00
|
|
|
}
|
|
|
|
|
2023-01-06 12:21:14 +00:00
|
|
|
err = m.SyncVerificationRequest(context.Background(), verifRequest, m.dispatchMessage)
|
2022-08-31 14:41:58 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
2022-07-05 19:49:44 +00:00
|
|
|
|
2022-08-31 14:41:58 +00:00
|
|
|
chatMessage, err := m.createLocalContactVerificationMessage(request.Challenge, chat, rawMessage.ID, common.ContactVerificationStatePending)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
2022-07-05 19:49:44 +00:00
|
|
|
}
|
|
|
|
|
2022-08-31 14:41:58 +00:00
|
|
|
err = m.persistence.SaveMessages([]*common.Message{chatMessage})
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
2023-02-13 20:09:20 +00:00
|
|
|
response := &MessengerResponse{}
|
|
|
|
|
|
|
|
response.AddVerificationRequest(verifRequest)
|
2022-08-31 14:41:58 +00:00
|
|
|
|
2022-12-26 04:35:46 +00:00
|
|
|
err = m.createOrUpdateOutgoingContactVerificationNotification(contact, response, verifRequest, chatMessage, nil)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
2022-08-31 14:41:58 +00:00
|
|
|
response.AddMessage(chatMessage)
|
|
|
|
|
2024-01-08 18:18:57 +00:00
|
|
|
err = m.prepareMessages(response.messages)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
2022-08-31 14:41:58 +00:00
|
|
|
|
|
|
|
return response, nil
|
2022-07-05 19:49:44 +00:00
|
|
|
}
|
|
|
|
|
2022-08-31 14:41:58 +00:00
|
|
|
func (m *Messenger) GetVerificationRequestSentTo(ctx context.Context, contactID string) (*verification.Request, error) {
|
2022-07-05 19:49:44 +00:00
|
|
|
_, ok := m.allContacts.Load(contactID)
|
|
|
|
if !ok {
|
test_: Code Migration from status-cli-tests
author shashankshampi <shashank.sanket1995@gmail.com> 1729780155 +0530
committer shashankshampi <shashank.sanket1995@gmail.com> 1730274350 +0530
test: Code Migration from status-cli-tests
fix_: functional tests (#5979)
* fix_: generate on test-functional
* chore(test)_: fix functional test assertion
---------
Co-authored-by: Siddarth Kumar <siddarthkay@gmail.com>
feat(accounts)_: cherry-pick Persist acceptance of Terms of Use & Privacy policy (#5766) (#5977)
* feat(accounts)_: Persist acceptance of Terms of Use & Privacy policy (#5766)
The original GH issue https://github.com/status-im/status-mobile/issues/21113
came from a request from the Legal team. We must show to Status v1 users the new
terms (Terms of Use & Privacy Policy) right after they upgrade to Status v2
from the stores.
The solution we use is to create a flag in the accounts table, named
hasAcceptedTerms. The flag will be set to true on the first account ever
created in v2 and we provide a native call in mobile/status.go#AcceptTerms,
which allows the client to persist the user's choice in case they are upgrading
(from v1 -> v2, or from a v2 older than this PR).
This solution is not the best because we should store the setting in a separate
table, not in the accounts table.
Related Mobile PR https://github.com/status-im/status-mobile/pull/21124
* fix(test)_: Compare addresses using uppercased strings
---------
Co-authored-by: Icaro Motta <icaro.ldm@gmail.com>
test_: restore account (#5960)
feat_: `LogOnPanic` linter (#5969)
* feat_: LogOnPanic linter
* fix_: add missing defer LogOnPanic
* chore_: make vendor
* fix_: tests, address pr comments
* fix_: address pr comments
fix(ci)_: remove workspace and tmp dir
This ensures we do not encounter weird errors like:
```
+ ln -s /home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907 /home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907@tmp/go/src/github.com/status-im/status-go
ln: failed to create symbolic link '/home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907@tmp/go/src/github.com/status-im/status-go': File exists
script returned exit code 1
```
Signed-off-by: Jakub Sokołowski <jakub@status.im>
chore_: enable windows and macos CI build (#5840)
- Added support for Windows and macOS in CI pipelines
- Added missing dependencies for Windows and x86-64-darwin
- Resolved macOS SDK version compatibility for darwin-x86_64
The `mkShell` override was necessary to ensure compatibility with the newer
macOS SDK (version 11.0) for x86_64. The default SDK (10.12) was causing build failures
because of the missing libs and frameworks. OverrideSDK creates a mapping from
the default SDK in all package categories to the requested SDK (11.0).
fix(contacts)_: fix trust status not being saved to cache when changed (#5965)
Fixes https://github.com/status-im/status-desktop/issues/16392
cleanup
added logger and cleanup
review comments changes
fix_: functional tests (#5979)
* fix_: generate on test-functional
* chore(test)_: fix functional test assertion
---------
Co-authored-by: Siddarth Kumar <siddarthkay@gmail.com>
feat(accounts)_: cherry-pick Persist acceptance of Terms of Use & Privacy policy (#5766) (#5977)
* feat(accounts)_: Persist acceptance of Terms of Use & Privacy policy (#5766)
The original GH issue https://github.com/status-im/status-mobile/issues/21113
came from a request from the Legal team. We must show to Status v1 users the new
terms (Terms of Use & Privacy Policy) right after they upgrade to Status v2
from the stores.
The solution we use is to create a flag in the accounts table, named
hasAcceptedTerms. The flag will be set to true on the first account ever
created in v2 and we provide a native call in mobile/status.go#AcceptTerms,
which allows the client to persist the user's choice in case they are upgrading
(from v1 -> v2, or from a v2 older than this PR).
This solution is not the best because we should store the setting in a separate
table, not in the accounts table.
Related Mobile PR https://github.com/status-im/status-mobile/pull/21124
* fix(test)_: Compare addresses using uppercased strings
---------
Co-authored-by: Icaro Motta <icaro.ldm@gmail.com>
test_: restore account (#5960)
feat_: `LogOnPanic` linter (#5969)
* feat_: LogOnPanic linter
* fix_: add missing defer LogOnPanic
* chore_: make vendor
* fix_: tests, address pr comments
* fix_: address pr comments
chore_: enable windows and macos CI build (#5840)
- Added support for Windows and macOS in CI pipelines
- Added missing dependencies for Windows and x86-64-darwin
- Resolved macOS SDK version compatibility for darwin-x86_64
The `mkShell` override was necessary to ensure compatibility with the newer
macOS SDK (version 11.0) for x86_64. The default SDK (10.12) was causing build failures
because of the missing libs and frameworks. OverrideSDK creates a mapping from
the default SDK in all package categories to the requested SDK (11.0).
fix(contacts)_: fix trust status not being saved to cache when changed (#5965)
Fixes https://github.com/status-im/status-desktop/issues/16392
test_: remove port bind
chore(wallet)_: move route execution code to separate module
chore_: replace geth logger with zap logger (#5962)
closes: #6002
feat(telemetry)_: add metrics for message reliability (#5899)
* feat(telemetry)_: track message reliability
Add metrics for dial errors, missed messages,
missed relevant messages, and confirmed delivery.
* fix_: handle error from json marshal
chore_: use zap logger as request logger
iterates: status-im/status-desktop#16536
test_: unique project per run
test_: use docker compose v2, more concrete project name
fix(codecov)_: ignore folders without tests
Otherwise Codecov reports incorrect numbers when making changes.
https://docs.codecov.com/docs/ignoring-paths
Signed-off-by: Jakub Sokołowski <jakub@status.im>
test_: verify schema of signals during init; fix schema verification warnings (#5947)
fix_: update defaultGorushURL (#6011)
fix(tests)_: use non-standard port to avoid conflicts
We have observed `nimbus-eth2` build failures reporting this port:
```json
{
"lvl": "NTC",
"ts": "2024-10-28 13:51:32.308+00:00",
"msg": "REST HTTP server could not be started",
"topics": "beacnde",
"address": "127.0.0.1:5432",
"reason": "(98) Address already in use"
}
```
https://ci.status.im/job/nimbus-eth2/job/platforms/job/linux/job/x86_64/job/main/job/PR-6683/3/
Signed-off-by: Jakub Sokołowski <jakub@status.im>
fix_: create request logger ad-hoc in tests
Fixes `TestCall` failing when run concurrently.
chore_: configure codecov (#6005)
* chore_: configure codecov
* fix_: after_n_builds
2024-10-24 14:29:15 +00:00
|
|
|
return nil, ErrContactNotFound
|
2022-07-05 19:49:44 +00:00
|
|
|
}
|
|
|
|
|
2022-12-14 08:27:02 +00:00
|
|
|
return m.verificationDatabase.GetLatestVerificationRequestSentTo(contactID)
|
2022-07-05 19:49:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (m *Messenger) GetReceivedVerificationRequests(ctx context.Context) ([]*verification.Request, error) {
|
|
|
|
myPubKey := hexutil.Encode(crypto.FromECDSAPub(&m.identity.PublicKey))
|
|
|
|
return m.verificationDatabase.GetReceivedVerificationRequests(myPubKey)
|
|
|
|
}
|
|
|
|
|
2022-12-14 08:27:02 +00:00
|
|
|
func (m *Messenger) CancelVerificationRequest(ctx context.Context, id string) (*MessengerResponse, error) {
|
|
|
|
verifRequest, err := m.verificationDatabase.GetVerificationRequest(id)
|
2022-07-05 19:49:44 +00:00
|
|
|
if err != nil {
|
2022-12-14 08:27:02 +00:00
|
|
|
return nil, err
|
2022-07-05 19:49:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if verifRequest == nil {
|
2022-12-14 08:27:02 +00:00
|
|
|
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)
|
2023-01-20 14:28:30 +00:00
|
|
|
if !ok || !contact.mutual() {
|
2022-12-14 08:27:02 +00:00
|
|
|
return nil, errors.New("Can't find contact for canceling verification request")
|
2022-07-05 19:49:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if verifRequest.RequestStatus != verification.RequestStatusPENDING {
|
2022-12-14 08:27:02 +00:00
|
|
|
return nil, errors.New("can cancel only pending verification request")
|
2022-07-05 19:49:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
verifRequest.RequestStatus = verification.RequestStatusCANCELED
|
|
|
|
err = m.verificationDatabase.SaveVerificationRequest(verifRequest)
|
|
|
|
if err != nil {
|
2022-12-14 08:27:02 +00:00
|
|
|
return nil, err
|
2022-07-05 19:49:44 +00:00
|
|
|
}
|
|
|
|
contact.VerificationStatus = VerificationStatusUNVERIFIED
|
|
|
|
contact.LastUpdatedLocally = m.getTimesource().GetCurrentTime()
|
|
|
|
|
|
|
|
err = m.persistence.SaveContact(contact, nil)
|
|
|
|
if err != nil {
|
2022-12-14 08:27:02 +00:00
|
|
|
return nil, err
|
2022-07-05 19:49:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// We sync the contact with the other devices
|
2023-01-06 12:21:14 +00:00
|
|
|
err = m.syncContact(context.Background(), contact, m.dispatchMessage)
|
2022-07-05 19:49:44 +00:00
|
|
|
if err != nil {
|
2022-12-14 08:27:02 +00:00
|
|
|
return nil, err
|
2022-07-05 19:49:44 +00:00
|
|
|
}
|
|
|
|
|
2022-12-14 08:27:02 +00:00
|
|
|
m.allContacts.Store(contact.ID, contact)
|
|
|
|
|
|
|
|
// 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)
|
|
|
|
|
2024-02-13 19:34:56 +00:00
|
|
|
response.AddContact(contact)
|
|
|
|
|
2023-01-06 12:21:14 +00:00
|
|
|
err = m.SyncVerificationRequest(context.Background(), verifRequest, m.dispatchMessage)
|
2022-07-05 19:49:44 +00:00
|
|
|
if err != nil {
|
2022-12-14 08:27:02 +00:00
|
|
|
return nil, err
|
2022-07-05 19:49:44 +00:00
|
|
|
}
|
|
|
|
|
2022-12-14 08:27:02 +00:00
|
|
|
request := &protobuf.CancelContactVerification{
|
|
|
|
Id: id,
|
|
|
|
Clock: clock,
|
|
|
|
}
|
2022-07-05 19:49:44 +00:00
|
|
|
|
2022-12-14 08:27:02 +00:00
|
|
|
encodedMessage, err := proto.Marshal(request)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
_, err = m.dispatchMessage(ctx, common.RawMessage{
|
2024-03-22 10:55:09 +00:00
|
|
|
LocalChatID: chat.ID,
|
|
|
|
Payload: encodedMessage,
|
|
|
|
MessageType: protobuf.ApplicationMetadataMessage_CANCEL_CONTACT_VERIFICATION,
|
|
|
|
ResendType: common.ResendTypeDataSync,
|
2022-12-14 08:27:02 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
2022-12-26 04:35:46 +00:00
|
|
|
notification, err := m.persistence.GetActivityCenterNotificationByID(types.FromHex(id))
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
if notification != nil {
|
|
|
|
notification.ContactVerificationStatus = verification.RequestStatusCANCELED
|
|
|
|
message := notification.Message
|
|
|
|
message.ContactVerificationState = common.ContactVerificationStateCanceled
|
2023-01-28 09:52:53 +00:00
|
|
|
notification.Read = true
|
2023-10-22 09:41:20 +00:00
|
|
|
notification.UpdatedAt = m.GetCurrentTimeInMillis()
|
2023-01-28 09:52:53 +00:00
|
|
|
|
2023-10-22 09:41:20 +00:00
|
|
|
err = m.addActivityCenterNotification(response, notification, m.syncActivityCenterReadByIDs)
|
2022-12-26 04:35:46 +00:00
|
|
|
if err != nil {
|
2023-01-28 09:52:53 +00:00
|
|
|
m.logger.Error("failed to save notification", zap.Error(err))
|
2022-12-26 04:35:46 +00:00
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-12-14 08:27:02 +00:00
|
|
|
return response, nil
|
2022-07-05 19:49:44 +00:00
|
|
|
}
|
|
|
|
|
2022-08-31 14:41:58 +00:00
|
|
|
func (m *Messenger) AcceptContactVerificationRequest(ctx context.Context, id string, response string) (*MessengerResponse, error) {
|
|
|
|
verifRequest, err := m.verificationDatabase.GetVerificationRequest(id)
|
2022-07-05 19:49:44 +00:00
|
|
|
if err != nil {
|
2022-08-31 14:41:58 +00:00
|
|
|
return nil, err
|
2022-07-05 19:49:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if verifRequest == nil {
|
2022-08-31 14:41:58 +00:00
|
|
|
m.logger.Error("could not find verification request with id", zap.String("id", id))
|
|
|
|
return nil, verification.ErrVerificationRequestNotFound
|
|
|
|
}
|
|
|
|
|
|
|
|
contactID := verifRequest.From
|
|
|
|
|
|
|
|
contact, ok := m.allContacts.Load(contactID)
|
2023-01-20 14:28:30 +00:00
|
|
|
if !ok || !contact.mutual() {
|
test_: Code Migration from status-cli-tests
author shashankshampi <shashank.sanket1995@gmail.com> 1729780155 +0530
committer shashankshampi <shashank.sanket1995@gmail.com> 1730274350 +0530
test: Code Migration from status-cli-tests
fix_: functional tests (#5979)
* fix_: generate on test-functional
* chore(test)_: fix functional test assertion
---------
Co-authored-by: Siddarth Kumar <siddarthkay@gmail.com>
feat(accounts)_: cherry-pick Persist acceptance of Terms of Use & Privacy policy (#5766) (#5977)
* feat(accounts)_: Persist acceptance of Terms of Use & Privacy policy (#5766)
The original GH issue https://github.com/status-im/status-mobile/issues/21113
came from a request from the Legal team. We must show to Status v1 users the new
terms (Terms of Use & Privacy Policy) right after they upgrade to Status v2
from the stores.
The solution we use is to create a flag in the accounts table, named
hasAcceptedTerms. The flag will be set to true on the first account ever
created in v2 and we provide a native call in mobile/status.go#AcceptTerms,
which allows the client to persist the user's choice in case they are upgrading
(from v1 -> v2, or from a v2 older than this PR).
This solution is not the best because we should store the setting in a separate
table, not in the accounts table.
Related Mobile PR https://github.com/status-im/status-mobile/pull/21124
* fix(test)_: Compare addresses using uppercased strings
---------
Co-authored-by: Icaro Motta <icaro.ldm@gmail.com>
test_: restore account (#5960)
feat_: `LogOnPanic` linter (#5969)
* feat_: LogOnPanic linter
* fix_: add missing defer LogOnPanic
* chore_: make vendor
* fix_: tests, address pr comments
* fix_: address pr comments
fix(ci)_: remove workspace and tmp dir
This ensures we do not encounter weird errors like:
```
+ ln -s /home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907 /home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907@tmp/go/src/github.com/status-im/status-go
ln: failed to create symbolic link '/home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907@tmp/go/src/github.com/status-im/status-go': File exists
script returned exit code 1
```
Signed-off-by: Jakub Sokołowski <jakub@status.im>
chore_: enable windows and macos CI build (#5840)
- Added support for Windows and macOS in CI pipelines
- Added missing dependencies for Windows and x86-64-darwin
- Resolved macOS SDK version compatibility for darwin-x86_64
The `mkShell` override was necessary to ensure compatibility with the newer
macOS SDK (version 11.0) for x86_64. The default SDK (10.12) was causing build failures
because of the missing libs and frameworks. OverrideSDK creates a mapping from
the default SDK in all package categories to the requested SDK (11.0).
fix(contacts)_: fix trust status not being saved to cache when changed (#5965)
Fixes https://github.com/status-im/status-desktop/issues/16392
cleanup
added logger and cleanup
review comments changes
fix_: functional tests (#5979)
* fix_: generate on test-functional
* chore(test)_: fix functional test assertion
---------
Co-authored-by: Siddarth Kumar <siddarthkay@gmail.com>
feat(accounts)_: cherry-pick Persist acceptance of Terms of Use & Privacy policy (#5766) (#5977)
* feat(accounts)_: Persist acceptance of Terms of Use & Privacy policy (#5766)
The original GH issue https://github.com/status-im/status-mobile/issues/21113
came from a request from the Legal team. We must show to Status v1 users the new
terms (Terms of Use & Privacy Policy) right after they upgrade to Status v2
from the stores.
The solution we use is to create a flag in the accounts table, named
hasAcceptedTerms. The flag will be set to true on the first account ever
created in v2 and we provide a native call in mobile/status.go#AcceptTerms,
which allows the client to persist the user's choice in case they are upgrading
(from v1 -> v2, or from a v2 older than this PR).
This solution is not the best because we should store the setting in a separate
table, not in the accounts table.
Related Mobile PR https://github.com/status-im/status-mobile/pull/21124
* fix(test)_: Compare addresses using uppercased strings
---------
Co-authored-by: Icaro Motta <icaro.ldm@gmail.com>
test_: restore account (#5960)
feat_: `LogOnPanic` linter (#5969)
* feat_: LogOnPanic linter
* fix_: add missing defer LogOnPanic
* chore_: make vendor
* fix_: tests, address pr comments
* fix_: address pr comments
chore_: enable windows and macos CI build (#5840)
- Added support for Windows and macOS in CI pipelines
- Added missing dependencies for Windows and x86-64-darwin
- Resolved macOS SDK version compatibility for darwin-x86_64
The `mkShell` override was necessary to ensure compatibility with the newer
macOS SDK (version 11.0) for x86_64. The default SDK (10.12) was causing build failures
because of the missing libs and frameworks. OverrideSDK creates a mapping from
the default SDK in all package categories to the requested SDK (11.0).
fix(contacts)_: fix trust status not being saved to cache when changed (#5965)
Fixes https://github.com/status-im/status-desktop/issues/16392
test_: remove port bind
chore(wallet)_: move route execution code to separate module
chore_: replace geth logger with zap logger (#5962)
closes: #6002
feat(telemetry)_: add metrics for message reliability (#5899)
* feat(telemetry)_: track message reliability
Add metrics for dial errors, missed messages,
missed relevant messages, and confirmed delivery.
* fix_: handle error from json marshal
chore_: use zap logger as request logger
iterates: status-im/status-desktop#16536
test_: unique project per run
test_: use docker compose v2, more concrete project name
fix(codecov)_: ignore folders without tests
Otherwise Codecov reports incorrect numbers when making changes.
https://docs.codecov.com/docs/ignoring-paths
Signed-off-by: Jakub Sokołowski <jakub@status.im>
test_: verify schema of signals during init; fix schema verification warnings (#5947)
fix_: update defaultGorushURL (#6011)
fix(tests)_: use non-standard port to avoid conflicts
We have observed `nimbus-eth2` build failures reporting this port:
```json
{
"lvl": "NTC",
"ts": "2024-10-28 13:51:32.308+00:00",
"msg": "REST HTTP server could not be started",
"topics": "beacnde",
"address": "127.0.0.1:5432",
"reason": "(98) Address already in use"
}
```
https://ci.status.im/job/nimbus-eth2/job/platforms/job/linux/job/x86_64/job/main/job/PR-6683/3/
Signed-off-by: Jakub Sokołowski <jakub@status.im>
fix_: create request logger ad-hoc in tests
Fixes `TestCall` failing when run concurrently.
chore_: configure codecov (#6005)
* chore_: configure codecov
* fix_: after_n_builds
2024-10-24 14:29:15 +00:00
|
|
|
return nil, ErrContactNotMutual
|
2022-07-05 19:49:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
chat, ok := m.allChats.Load(contactID)
|
|
|
|
if !ok {
|
|
|
|
publicKey, err := contact.PublicKey()
|
|
|
|
if err != nil {
|
2022-08-31 14:41:58 +00:00
|
|
|
return nil, err
|
2022-07-05 19:49:44 +00:00
|
|
|
}
|
|
|
|
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())
|
|
|
|
|
2022-08-31 14:41:58 +00:00
|
|
|
err = m.verificationDatabase.AcceptContactVerificationRequest(id, response)
|
2022-07-05 19:49:44 +00:00
|
|
|
if err != nil {
|
2022-08-31 14:41:58 +00:00
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
verifRequest, err = m.verificationDatabase.GetVerificationRequest(id)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
2022-07-05 19:49:44 +00:00
|
|
|
}
|
|
|
|
|
2023-01-06 12:21:14 +00:00
|
|
|
err = m.SyncVerificationRequest(context.Background(), verifRequest, m.dispatchMessage)
|
2022-07-05 19:49:44 +00:00
|
|
|
if err != nil {
|
2022-08-31 14:41:58 +00:00
|
|
|
return nil, err
|
2022-07-05 19:49:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
request := &protobuf.AcceptContactVerification{
|
|
|
|
Clock: clock,
|
2022-08-31 14:41:58 +00:00
|
|
|
Id: verifRequest.ID,
|
2022-07-05 19:49:44 +00:00
|
|
|
Response: response,
|
|
|
|
}
|
|
|
|
|
|
|
|
encodedMessage, err := proto.Marshal(request)
|
|
|
|
if err != nil {
|
2022-08-31 14:41:58 +00:00
|
|
|
return nil, err
|
2022-07-05 19:49:44 +00:00
|
|
|
}
|
|
|
|
|
2022-08-31 14:41:58 +00:00
|
|
|
rawMessage, err := m.dispatchMessage(ctx, common.RawMessage{
|
2024-03-22 10:55:09 +00:00
|
|
|
LocalChatID: chat.ID,
|
|
|
|
Payload: encodedMessage,
|
|
|
|
MessageType: protobuf.ApplicationMetadataMessage_ACCEPT_CONTACT_VERIFICATION,
|
|
|
|
ResendType: common.ResendTypeDataSync,
|
2022-07-05 19:49:44 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
if err != nil {
|
2022-08-31 14:41:58 +00:00
|
|
|
return nil, err
|
2022-07-05 19:49:44 +00:00
|
|
|
}
|
|
|
|
|
2022-08-31 14:41:58 +00:00
|
|
|
// Pull one from the db if there
|
|
|
|
notification, err := m.persistence.GetActivityCenterNotificationByID(types.FromHex(id))
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
2023-02-13 20:09:20 +00:00
|
|
|
resp := &MessengerResponse{}
|
|
|
|
|
|
|
|
resp.AddVerificationRequest(verifRequest)
|
2022-08-31 14:41:58 +00:00
|
|
|
|
2022-10-28 09:51:54 +00:00
|
|
|
replyMessage, err := m.createLocalContactVerificationMessage(response, chat, rawMessage.ID, common.ContactVerificationStateAccepted)
|
2022-08-31 14:41:58 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
2022-10-28 09:51:54 +00:00
|
|
|
err = m.persistence.SaveMessages([]*common.Message{replyMessage})
|
2022-08-31 14:41:58 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
2022-10-28 09:51:54 +00:00
|
|
|
resp.AddMessage(replyMessage)
|
2022-08-31 14:41:58 +00:00
|
|
|
|
|
|
|
if notification != nil {
|
2022-10-24 11:33:47 +00:00
|
|
|
// TODO: Should we update only the message or only the notification or both?
|
2022-08-31 14:41:58 +00:00
|
|
|
|
2022-10-24 11:33:47 +00:00
|
|
|
notification.ContactVerificationStatus = verification.RequestStatusACCEPTED
|
2022-08-31 14:41:58 +00:00
|
|
|
message := notification.Message
|
|
|
|
message.ContactVerificationState = common.ContactVerificationStateAccepted
|
2022-10-28 11:37:46 +00:00
|
|
|
notification.ReplyMessage = replyMessage
|
2023-01-28 09:52:53 +00:00
|
|
|
notification.Read = true
|
|
|
|
notification.Accepted = true
|
2023-10-22 09:41:20 +00:00
|
|
|
notification.UpdatedAt = m.GetCurrentTimeInMillis()
|
|
|
|
err = m.addActivityCenterNotification(resp, notification, m.syncActivityCenterAcceptedByIDs)
|
2022-08-31 14:41:58 +00:00
|
|
|
if err != nil {
|
2023-01-28 09:52:53 +00:00
|
|
|
m.logger.Error("failed to save notification", zap.Error(err))
|
2022-08-31 14:41:58 +00:00
|
|
|
return nil, err
|
|
|
|
}
|
2023-02-17 10:08:08 +00:00
|
|
|
resp.AddMessage(message) // <=== wasn't typo?
|
2022-08-31 14:41:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return resp, nil
|
2022-07-05 19:49:44 +00:00
|
|
|
}
|
|
|
|
|
2022-10-28 11:37:46 +00:00
|
|
|
func (m *Messenger) VerifiedTrusted(ctx context.Context, request *requests.VerifiedTrusted) (*MessengerResponse, error) {
|
|
|
|
err := request.Validate()
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
// Pull one from the db if there
|
|
|
|
notification, err := m.persistence.GetActivityCenterNotificationByID(request.ID)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
if notification == nil || notification.ReplyMessage == nil {
|
|
|
|
return nil, errors.New("could not find notification")
|
|
|
|
}
|
|
|
|
|
|
|
|
contactID := notification.ReplyMessage.From
|
|
|
|
|
2022-07-05 19:49:44 +00:00
|
|
|
contact, ok := m.allContacts.Load(contactID)
|
2023-01-20 14:28:30 +00:00
|
|
|
if !ok || !contact.mutual() {
|
test_: Code Migration from status-cli-tests
author shashankshampi <shashank.sanket1995@gmail.com> 1729780155 +0530
committer shashankshampi <shashank.sanket1995@gmail.com> 1730274350 +0530
test: Code Migration from status-cli-tests
fix_: functional tests (#5979)
* fix_: generate on test-functional
* chore(test)_: fix functional test assertion
---------
Co-authored-by: Siddarth Kumar <siddarthkay@gmail.com>
feat(accounts)_: cherry-pick Persist acceptance of Terms of Use & Privacy policy (#5766) (#5977)
* feat(accounts)_: Persist acceptance of Terms of Use & Privacy policy (#5766)
The original GH issue https://github.com/status-im/status-mobile/issues/21113
came from a request from the Legal team. We must show to Status v1 users the new
terms (Terms of Use & Privacy Policy) right after they upgrade to Status v2
from the stores.
The solution we use is to create a flag in the accounts table, named
hasAcceptedTerms. The flag will be set to true on the first account ever
created in v2 and we provide a native call in mobile/status.go#AcceptTerms,
which allows the client to persist the user's choice in case they are upgrading
(from v1 -> v2, or from a v2 older than this PR).
This solution is not the best because we should store the setting in a separate
table, not in the accounts table.
Related Mobile PR https://github.com/status-im/status-mobile/pull/21124
* fix(test)_: Compare addresses using uppercased strings
---------
Co-authored-by: Icaro Motta <icaro.ldm@gmail.com>
test_: restore account (#5960)
feat_: `LogOnPanic` linter (#5969)
* feat_: LogOnPanic linter
* fix_: add missing defer LogOnPanic
* chore_: make vendor
* fix_: tests, address pr comments
* fix_: address pr comments
fix(ci)_: remove workspace and tmp dir
This ensures we do not encounter weird errors like:
```
+ ln -s /home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907 /home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907@tmp/go/src/github.com/status-im/status-go
ln: failed to create symbolic link '/home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907@tmp/go/src/github.com/status-im/status-go': File exists
script returned exit code 1
```
Signed-off-by: Jakub Sokołowski <jakub@status.im>
chore_: enable windows and macos CI build (#5840)
- Added support for Windows and macOS in CI pipelines
- Added missing dependencies for Windows and x86-64-darwin
- Resolved macOS SDK version compatibility for darwin-x86_64
The `mkShell` override was necessary to ensure compatibility with the newer
macOS SDK (version 11.0) for x86_64. The default SDK (10.12) was causing build failures
because of the missing libs and frameworks. OverrideSDK creates a mapping from
the default SDK in all package categories to the requested SDK (11.0).
fix(contacts)_: fix trust status not being saved to cache when changed (#5965)
Fixes https://github.com/status-im/status-desktop/issues/16392
cleanup
added logger and cleanup
review comments changes
fix_: functional tests (#5979)
* fix_: generate on test-functional
* chore(test)_: fix functional test assertion
---------
Co-authored-by: Siddarth Kumar <siddarthkay@gmail.com>
feat(accounts)_: cherry-pick Persist acceptance of Terms of Use & Privacy policy (#5766) (#5977)
* feat(accounts)_: Persist acceptance of Terms of Use & Privacy policy (#5766)
The original GH issue https://github.com/status-im/status-mobile/issues/21113
came from a request from the Legal team. We must show to Status v1 users the new
terms (Terms of Use & Privacy Policy) right after they upgrade to Status v2
from the stores.
The solution we use is to create a flag in the accounts table, named
hasAcceptedTerms. The flag will be set to true on the first account ever
created in v2 and we provide a native call in mobile/status.go#AcceptTerms,
which allows the client to persist the user's choice in case they are upgrading
(from v1 -> v2, or from a v2 older than this PR).
This solution is not the best because we should store the setting in a separate
table, not in the accounts table.
Related Mobile PR https://github.com/status-im/status-mobile/pull/21124
* fix(test)_: Compare addresses using uppercased strings
---------
Co-authored-by: Icaro Motta <icaro.ldm@gmail.com>
test_: restore account (#5960)
feat_: `LogOnPanic` linter (#5969)
* feat_: LogOnPanic linter
* fix_: add missing defer LogOnPanic
* chore_: make vendor
* fix_: tests, address pr comments
* fix_: address pr comments
chore_: enable windows and macos CI build (#5840)
- Added support for Windows and macOS in CI pipelines
- Added missing dependencies for Windows and x86-64-darwin
- Resolved macOS SDK version compatibility for darwin-x86_64
The `mkShell` override was necessary to ensure compatibility with the newer
macOS SDK (version 11.0) for x86_64. The default SDK (10.12) was causing build failures
because of the missing libs and frameworks. OverrideSDK creates a mapping from
the default SDK in all package categories to the requested SDK (11.0).
fix(contacts)_: fix trust status not being saved to cache when changed (#5965)
Fixes https://github.com/status-im/status-desktop/issues/16392
test_: remove port bind
chore(wallet)_: move route execution code to separate module
chore_: replace geth logger with zap logger (#5962)
closes: #6002
feat(telemetry)_: add metrics for message reliability (#5899)
* feat(telemetry)_: track message reliability
Add metrics for dial errors, missed messages,
missed relevant messages, and confirmed delivery.
* fix_: handle error from json marshal
chore_: use zap logger as request logger
iterates: status-im/status-desktop#16536
test_: unique project per run
test_: use docker compose v2, more concrete project name
fix(codecov)_: ignore folders without tests
Otherwise Codecov reports incorrect numbers when making changes.
https://docs.codecov.com/docs/ignoring-paths
Signed-off-by: Jakub Sokołowski <jakub@status.im>
test_: verify schema of signals during init; fix schema verification warnings (#5947)
fix_: update defaultGorushURL (#6011)
fix(tests)_: use non-standard port to avoid conflicts
We have observed `nimbus-eth2` build failures reporting this port:
```json
{
"lvl": "NTC",
"ts": "2024-10-28 13:51:32.308+00:00",
"msg": "REST HTTP server could not be started",
"topics": "beacnde",
"address": "127.0.0.1:5432",
"reason": "(98) Address already in use"
}
```
https://ci.status.im/job/nimbus-eth2/job/platforms/job/linux/job/x86_64/job/main/job/PR-6683/3/
Signed-off-by: Jakub Sokołowski <jakub@status.im>
fix_: create request logger ad-hoc in tests
Fixes `TestCall` failing when run concurrently.
chore_: configure codecov (#6005)
* chore_: configure codecov
* fix_: after_n_builds
2024-10-24 14:29:15 +00:00
|
|
|
return nil, ErrContactNotMutual
|
2022-07-05 19:49:44 +00:00
|
|
|
}
|
|
|
|
|
2024-04-18 15:28:44 +00:00
|
|
|
err = m.setTrustStatusForContact(context.Background(), contactID, verification.TrustStatusTRUSTED)
|
2022-07-05 19:49:44 +00:00
|
|
|
|
|
|
|
if err != nil {
|
2022-10-28 11:37:46 +00:00
|
|
|
return nil, err
|
2022-07-05 19:49:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
contact.VerificationStatus = VerificationStatusVERIFIED
|
|
|
|
contact.LastUpdatedLocally = m.getTimesource().GetCurrentTime()
|
|
|
|
err = m.persistence.SaveContact(contact, nil)
|
|
|
|
if err != nil {
|
2022-10-28 11:37:46 +00:00
|
|
|
return nil, err
|
2022-07-05 19:49:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
chat, ok := m.allChats.Load(contactID)
|
|
|
|
clock, _ := chat.NextClockAndTimestamp(m.getTimesource())
|
|
|
|
if !ok {
|
|
|
|
publicKey, err := contact.PublicKey()
|
|
|
|
if err != nil {
|
2022-10-28 11:37:46 +00:00
|
|
|
return nil, err
|
2022-07-05 19:49:44 +00:00
|
|
|
}
|
|
|
|
chat = OneToOneFromPublicKey(publicKey, m.getTimesource())
|
|
|
|
// We don't want to show the chat to the user
|
|
|
|
chat.Active = false
|
|
|
|
}
|
|
|
|
|
2022-12-14 08:27:02 +00:00
|
|
|
verifRequest, err := m.verificationDatabase.GetLatestVerificationRequestSentTo(contactID)
|
2022-07-05 19:49:44 +00:00
|
|
|
if err != nil {
|
2022-10-28 11:37:46 +00:00
|
|
|
return nil, err
|
2022-07-05 19:49:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if verifRequest == nil {
|
2022-10-28 11:37:46 +00:00
|
|
|
return nil, errors.New("no contact verification found")
|
2022-07-05 19:49:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
verifRequest.RequestStatus = verification.RequestStatusTRUSTED
|
|
|
|
verifRequest.RepliedAt = clock
|
|
|
|
err = m.verificationDatabase.SaveVerificationRequest(verifRequest)
|
|
|
|
if err != nil {
|
2022-10-28 11:37:46 +00:00
|
|
|
return nil, err
|
2022-07-05 19:49:44 +00:00
|
|
|
}
|
|
|
|
|
2023-01-06 12:21:14 +00:00
|
|
|
err = m.SyncVerificationRequest(context.Background(), verifRequest, m.dispatchMessage)
|
2022-07-05 19:49:44 +00:00
|
|
|
if err != nil {
|
2022-10-28 11:37:46 +00:00
|
|
|
return nil, err
|
2022-07-05 19:49:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// We sync the contact with the other devices
|
2023-01-06 12:21:14 +00:00
|
|
|
err = m.syncContact(context.Background(), contact, m.dispatchMessage)
|
2022-07-05 19:49:44 +00:00
|
|
|
if err != nil {
|
2022-10-28 11:37:46 +00:00
|
|
|
return nil, err
|
2022-07-05 19:49:44 +00:00
|
|
|
}
|
|
|
|
|
2024-02-09 09:36:54 +00:00
|
|
|
// Dispatch profile message to save a contact to the encrypted profile part
|
|
|
|
err = m.DispatchProfileShowcase()
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
2022-10-28 11:37:46 +00:00
|
|
|
response := &MessengerResponse{}
|
|
|
|
|
|
|
|
notification.ContactVerificationStatus = verification.RequestStatusTRUSTED
|
|
|
|
notification.Message.ContactVerificationState = common.ContactVerificationStateTrusted
|
2023-01-28 09:52:53 +00:00
|
|
|
notification.Read = true
|
|
|
|
notification.Accepted = true
|
2023-10-22 09:41:20 +00:00
|
|
|
notification.UpdatedAt = m.GetCurrentTimeInMillis()
|
2022-10-28 11:37:46 +00:00
|
|
|
|
2023-10-22 09:41:20 +00:00
|
|
|
err = m.addActivityCenterNotification(response, notification, m.syncActivityCenterAcceptedByIDs)
|
2022-10-28 11:37:46 +00:00
|
|
|
if err != nil {
|
2023-01-28 09:52:53 +00:00
|
|
|
m.logger.Error("failed to save notification", zap.Error(err))
|
2022-10-28 11:37:46 +00:00
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
msg, err := m.persistence.MessageByID(notification.ReplyMessage.ID)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
msg.ContactVerificationState = common.ContactVerificationStateTrusted
|
|
|
|
|
|
|
|
err = m.persistence.SaveMessages([]*common.Message{msg})
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
response.AddMessage(msg)
|
|
|
|
|
2024-02-13 19:34:56 +00:00
|
|
|
response.AddContact(contact)
|
|
|
|
|
2022-10-28 11:37:46 +00:00
|
|
|
return response, nil
|
2022-07-05 19:49:44 +00:00
|
|
|
}
|
|
|
|
|
2022-10-28 11:37:46 +00:00
|
|
|
func (m *Messenger) VerifiedUntrustworthy(ctx context.Context, request *requests.VerifiedUntrustworthy) (*MessengerResponse, error) {
|
|
|
|
if err := request.Validate(); err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
// Pull one from the db if there
|
|
|
|
notification, err := m.persistence.GetActivityCenterNotificationByID(request.ID)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
if notification == nil || notification.ReplyMessage == nil {
|
|
|
|
return nil, errors.New("could not find notification")
|
|
|
|
}
|
|
|
|
|
|
|
|
contactID := notification.ReplyMessage.From
|
|
|
|
|
2024-04-18 15:28:44 +00:00
|
|
|
err = m.setTrustStatusForContact(context.Background(), contactID, verification.TrustStatusUNTRUSTWORTHY)
|
2022-07-05 19:49:44 +00:00
|
|
|
if err != nil {
|
2022-10-28 11:37:46 +00:00
|
|
|
return nil, err
|
2022-07-05 19:49:44 +00:00
|
|
|
}
|
|
|
|
|
2024-04-18 15:28:44 +00:00
|
|
|
contact, err := m.setContactVerificationStatus(contactID, VerificationStatusVERIFIED)
|
2022-07-05 19:49:44 +00:00
|
|
|
if err != nil {
|
2022-10-28 11:37:46 +00:00
|
|
|
return nil, err
|
2022-07-05 19:49:44 +00:00
|
|
|
}
|
|
|
|
|
2022-12-26 04:35:46 +00:00
|
|
|
chat, ok := m.allChats.Load(contactID)
|
|
|
|
clock, _ := chat.NextClockAndTimestamp(m.getTimesource())
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
|
|
|
verifRequest, err := m.verificationDatabase.GetLatestVerificationRequestSentTo(contactID)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
if verifRequest == nil {
|
|
|
|
return nil, errors.New("no contact verification found")
|
|
|
|
}
|
|
|
|
|
|
|
|
verifRequest.RequestStatus = verification.RequestStatusUNTRUSTWORTHY
|
|
|
|
verifRequest.RepliedAt = clock
|
|
|
|
err = m.verificationDatabase.SaveVerificationRequest(verifRequest)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
2023-01-06 12:21:14 +00:00
|
|
|
err = m.SyncVerificationRequest(context.Background(), verifRequest, m.dispatchMessage)
|
2022-12-26 04:35:46 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
2022-10-28 11:37:46 +00:00
|
|
|
response := &MessengerResponse{}
|
|
|
|
|
|
|
|
notification.ContactVerificationStatus = verification.RequestStatusUNTRUSTWORTHY
|
|
|
|
notification.Message.ContactVerificationState = common.ContactVerificationStateUntrustworthy
|
2023-01-28 09:52:53 +00:00
|
|
|
notification.Read = true
|
|
|
|
notification.Accepted = true
|
2023-10-22 09:41:20 +00:00
|
|
|
notification.UpdatedAt = m.GetCurrentTimeInMillis()
|
2022-10-28 11:37:46 +00:00
|
|
|
|
2023-10-22 09:41:20 +00:00
|
|
|
err = m.addActivityCenterNotification(response, notification, m.syncActivityCenterAcceptedByIDs)
|
2022-10-28 11:37:46 +00:00
|
|
|
if err != nil {
|
2023-01-28 09:52:53 +00:00
|
|
|
m.logger.Error("failed to save notification", zap.Error(err))
|
2022-10-28 11:37:46 +00:00
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
msg, err := m.persistence.MessageByID(notification.ReplyMessage.ID)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
msg.ContactVerificationState = common.ContactVerificationStateUntrustworthy
|
|
|
|
|
|
|
|
err = m.persistence.SaveMessages([]*common.Message{msg})
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
response.AddMessage(msg)
|
|
|
|
|
|
|
|
return response, nil
|
2022-07-05 19:49:44 +00:00
|
|
|
}
|
|
|
|
|
2022-10-24 11:33:47 +00:00
|
|
|
func (m *Messenger) DeclineContactVerificationRequest(ctx context.Context, id string) (*MessengerResponse, error) {
|
2022-08-31 14:41:58 +00:00
|
|
|
verifRequest, err := m.verificationDatabase.GetVerificationRequest(id)
|
2022-07-05 19:49:44 +00:00
|
|
|
if err != nil {
|
2022-10-24 11:33:47 +00:00
|
|
|
return nil, err
|
2022-07-05 19:49:44 +00:00
|
|
|
}
|
|
|
|
|
2022-08-31 14:41:58 +00:00
|
|
|
if verifRequest == nil {
|
|
|
|
m.logger.Error("could not find verification request with id", zap.String("id", id))
|
2022-10-24 11:33:47 +00:00
|
|
|
return nil, verification.ErrVerificationRequestNotFound
|
2022-08-31 14:41:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
contact, ok := m.allContacts.Load(verifRequest.From)
|
2023-01-20 14:28:30 +00:00
|
|
|
if !ok || !contact.mutual() {
|
test_: Code Migration from status-cli-tests
author shashankshampi <shashank.sanket1995@gmail.com> 1729780155 +0530
committer shashankshampi <shashank.sanket1995@gmail.com> 1730274350 +0530
test: Code Migration from status-cli-tests
fix_: functional tests (#5979)
* fix_: generate on test-functional
* chore(test)_: fix functional test assertion
---------
Co-authored-by: Siddarth Kumar <siddarthkay@gmail.com>
feat(accounts)_: cherry-pick Persist acceptance of Terms of Use & Privacy policy (#5766) (#5977)
* feat(accounts)_: Persist acceptance of Terms of Use & Privacy policy (#5766)
The original GH issue https://github.com/status-im/status-mobile/issues/21113
came from a request from the Legal team. We must show to Status v1 users the new
terms (Terms of Use & Privacy Policy) right after they upgrade to Status v2
from the stores.
The solution we use is to create a flag in the accounts table, named
hasAcceptedTerms. The flag will be set to true on the first account ever
created in v2 and we provide a native call in mobile/status.go#AcceptTerms,
which allows the client to persist the user's choice in case they are upgrading
(from v1 -> v2, or from a v2 older than this PR).
This solution is not the best because we should store the setting in a separate
table, not in the accounts table.
Related Mobile PR https://github.com/status-im/status-mobile/pull/21124
* fix(test)_: Compare addresses using uppercased strings
---------
Co-authored-by: Icaro Motta <icaro.ldm@gmail.com>
test_: restore account (#5960)
feat_: `LogOnPanic` linter (#5969)
* feat_: LogOnPanic linter
* fix_: add missing defer LogOnPanic
* chore_: make vendor
* fix_: tests, address pr comments
* fix_: address pr comments
fix(ci)_: remove workspace and tmp dir
This ensures we do not encounter weird errors like:
```
+ ln -s /home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907 /home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907@tmp/go/src/github.com/status-im/status-go
ln: failed to create symbolic link '/home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907@tmp/go/src/github.com/status-im/status-go': File exists
script returned exit code 1
```
Signed-off-by: Jakub Sokołowski <jakub@status.im>
chore_: enable windows and macos CI build (#5840)
- Added support for Windows and macOS in CI pipelines
- Added missing dependencies for Windows and x86-64-darwin
- Resolved macOS SDK version compatibility for darwin-x86_64
The `mkShell` override was necessary to ensure compatibility with the newer
macOS SDK (version 11.0) for x86_64. The default SDK (10.12) was causing build failures
because of the missing libs and frameworks. OverrideSDK creates a mapping from
the default SDK in all package categories to the requested SDK (11.0).
fix(contacts)_: fix trust status not being saved to cache when changed (#5965)
Fixes https://github.com/status-im/status-desktop/issues/16392
cleanup
added logger and cleanup
review comments changes
fix_: functional tests (#5979)
* fix_: generate on test-functional
* chore(test)_: fix functional test assertion
---------
Co-authored-by: Siddarth Kumar <siddarthkay@gmail.com>
feat(accounts)_: cherry-pick Persist acceptance of Terms of Use & Privacy policy (#5766) (#5977)
* feat(accounts)_: Persist acceptance of Terms of Use & Privacy policy (#5766)
The original GH issue https://github.com/status-im/status-mobile/issues/21113
came from a request from the Legal team. We must show to Status v1 users the new
terms (Terms of Use & Privacy Policy) right after they upgrade to Status v2
from the stores.
The solution we use is to create a flag in the accounts table, named
hasAcceptedTerms. The flag will be set to true on the first account ever
created in v2 and we provide a native call in mobile/status.go#AcceptTerms,
which allows the client to persist the user's choice in case they are upgrading
(from v1 -> v2, or from a v2 older than this PR).
This solution is not the best because we should store the setting in a separate
table, not in the accounts table.
Related Mobile PR https://github.com/status-im/status-mobile/pull/21124
* fix(test)_: Compare addresses using uppercased strings
---------
Co-authored-by: Icaro Motta <icaro.ldm@gmail.com>
test_: restore account (#5960)
feat_: `LogOnPanic` linter (#5969)
* feat_: LogOnPanic linter
* fix_: add missing defer LogOnPanic
* chore_: make vendor
* fix_: tests, address pr comments
* fix_: address pr comments
chore_: enable windows and macos CI build (#5840)
- Added support for Windows and macOS in CI pipelines
- Added missing dependencies for Windows and x86-64-darwin
- Resolved macOS SDK version compatibility for darwin-x86_64
The `mkShell` override was necessary to ensure compatibility with the newer
macOS SDK (version 11.0) for x86_64. The default SDK (10.12) was causing build failures
because of the missing libs and frameworks. OverrideSDK creates a mapping from
the default SDK in all package categories to the requested SDK (11.0).
fix(contacts)_: fix trust status not being saved to cache when changed (#5965)
Fixes https://github.com/status-im/status-desktop/issues/16392
test_: remove port bind
chore(wallet)_: move route execution code to separate module
chore_: replace geth logger with zap logger (#5962)
closes: #6002
feat(telemetry)_: add metrics for message reliability (#5899)
* feat(telemetry)_: track message reliability
Add metrics for dial errors, missed messages,
missed relevant messages, and confirmed delivery.
* fix_: handle error from json marshal
chore_: use zap logger as request logger
iterates: status-im/status-desktop#16536
test_: unique project per run
test_: use docker compose v2, more concrete project name
fix(codecov)_: ignore folders without tests
Otherwise Codecov reports incorrect numbers when making changes.
https://docs.codecov.com/docs/ignoring-paths
Signed-off-by: Jakub Sokołowski <jakub@status.im>
test_: verify schema of signals during init; fix schema verification warnings (#5947)
fix_: update defaultGorushURL (#6011)
fix(tests)_: use non-standard port to avoid conflicts
We have observed `nimbus-eth2` build failures reporting this port:
```json
{
"lvl": "NTC",
"ts": "2024-10-28 13:51:32.308+00:00",
"msg": "REST HTTP server could not be started",
"topics": "beacnde",
"address": "127.0.0.1:5432",
"reason": "(98) Address already in use"
}
```
https://ci.status.im/job/nimbus-eth2/job/platforms/job/linux/job/x86_64/job/main/job/PR-6683/3/
Signed-off-by: Jakub Sokołowski <jakub@status.im>
fix_: create request logger ad-hoc in tests
Fixes `TestCall` failing when run concurrently.
chore_: configure codecov (#6005)
* chore_: configure codecov
* fix_: after_n_builds
2024-10-24 14:29:15 +00:00
|
|
|
return nil, ErrContactNotMutual
|
2022-08-31 14:41:58 +00:00
|
|
|
}
|
2024-04-18 15:28:44 +00:00
|
|
|
contactID := verifRequest.From
|
|
|
|
contact, err = m.setContactVerificationStatus(contactID, VerificationStatusVERIFIED)
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
2022-08-31 14:41:58 +00:00
|
|
|
|
2022-07-05 19:49:44 +00:00
|
|
|
if verifRequest == nil {
|
2022-10-24 11:33:47 +00:00
|
|
|
return nil, errors.New("no contact verification found")
|
2022-07-05 19:49:44 +00:00
|
|
|
}
|
|
|
|
|
2022-08-31 14:41:58 +00:00
|
|
|
chat, ok := m.allChats.Load(verifRequest.From)
|
2022-07-05 19:49:44 +00:00
|
|
|
if !ok {
|
|
|
|
publicKey, err := contact.PublicKey()
|
|
|
|
if err != nil {
|
2022-10-24 11:33:47 +00:00
|
|
|
return nil, err
|
2022-07-05 19:49:44 +00:00
|
|
|
}
|
|
|
|
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())
|
|
|
|
|
|
|
|
verifRequest.RequestStatus = verification.RequestStatusDECLINED
|
|
|
|
verifRequest.RepliedAt = clock
|
|
|
|
err = m.verificationDatabase.SaveVerificationRequest(verifRequest)
|
|
|
|
if err != nil {
|
2022-10-24 11:33:47 +00:00
|
|
|
return nil, err
|
2022-07-05 19:49:44 +00:00
|
|
|
}
|
|
|
|
|
2022-10-24 11:33:47 +00:00
|
|
|
response := &MessengerResponse{}
|
|
|
|
|
|
|
|
response.AddVerificationRequest(verifRequest)
|
|
|
|
|
2023-01-06 12:21:14 +00:00
|
|
|
err = m.SyncVerificationRequest(context.Background(), verifRequest, m.dispatchMessage)
|
2022-07-05 19:49:44 +00:00
|
|
|
if err != nil {
|
2022-10-24 11:33:47 +00:00
|
|
|
return nil, err
|
2022-07-05 19:49:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
request := &protobuf.DeclineContactVerification{
|
2022-08-31 14:41:58 +00:00
|
|
|
Id: id,
|
2022-07-05 19:49:44 +00:00
|
|
|
Clock: clock,
|
|
|
|
}
|
|
|
|
|
|
|
|
encodedMessage, err := proto.Marshal(request)
|
|
|
|
if err != nil {
|
2022-10-24 11:33:47 +00:00
|
|
|
return nil, err
|
2022-07-05 19:49:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
_, err = m.dispatchMessage(ctx, common.RawMessage{
|
2024-03-22 10:55:09 +00:00
|
|
|
LocalChatID: chat.ID,
|
|
|
|
Payload: encodedMessage,
|
|
|
|
MessageType: protobuf.ApplicationMetadataMessage_DECLINE_CONTACT_VERIFICATION,
|
|
|
|
ResendType: common.ResendTypeDataSync,
|
2022-07-05 19:49:44 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
if err != nil {
|
2022-10-24 11:33:47 +00:00
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
err = m.verificationDatabase.DeclineContactVerificationRequest(id)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
2022-07-05 19:49:44 +00:00
|
|
|
}
|
|
|
|
|
2022-10-24 11:33:47 +00:00
|
|
|
notification, err := m.persistence.GetActivityCenterNotificationByID(types.FromHex(id))
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
if notification != nil {
|
|
|
|
notification.ContactVerificationStatus = verification.RequestStatusDECLINED
|
2023-01-28 09:52:53 +00:00
|
|
|
notification.Read = true
|
|
|
|
notification.Dismissed = true
|
2023-10-22 09:41:20 +00:00
|
|
|
notification.UpdatedAt = m.GetCurrentTimeInMillis()
|
2023-01-28 09:52:53 +00:00
|
|
|
|
2022-10-24 11:33:47 +00:00
|
|
|
message := notification.Message
|
|
|
|
message.ContactVerificationState = common.ContactVerificationStateDeclined
|
2023-01-28 09:52:53 +00:00
|
|
|
|
2023-10-22 09:41:20 +00:00
|
|
|
err = m.addActivityCenterNotification(response, notification, m.syncActivityCenterDismissedByIDs)
|
2022-10-24 11:33:47 +00:00
|
|
|
if err != nil {
|
2023-01-28 09:52:53 +00:00
|
|
|
m.logger.Error("failed to save notification", zap.Error(err))
|
2022-10-24 11:33:47 +00:00
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
response.AddMessage(message)
|
|
|
|
}
|
|
|
|
|
|
|
|
return response, nil
|
2022-07-05 19:49:44 +00:00
|
|
|
}
|
|
|
|
|
2024-04-18 15:28:44 +00:00
|
|
|
func (m *Messenger) setContactVerificationStatus(contactID string, verificationStatus VerificationStatus) (*Contact, error) {
|
|
|
|
contact, ok := m.allContacts.Load(contactID)
|
|
|
|
if !ok || !contact.mutual() {
|
test_: Code Migration from status-cli-tests
author shashankshampi <shashank.sanket1995@gmail.com> 1729780155 +0530
committer shashankshampi <shashank.sanket1995@gmail.com> 1730274350 +0530
test: Code Migration from status-cli-tests
fix_: functional tests (#5979)
* fix_: generate on test-functional
* chore(test)_: fix functional test assertion
---------
Co-authored-by: Siddarth Kumar <siddarthkay@gmail.com>
feat(accounts)_: cherry-pick Persist acceptance of Terms of Use & Privacy policy (#5766) (#5977)
* feat(accounts)_: Persist acceptance of Terms of Use & Privacy policy (#5766)
The original GH issue https://github.com/status-im/status-mobile/issues/21113
came from a request from the Legal team. We must show to Status v1 users the new
terms (Terms of Use & Privacy Policy) right after they upgrade to Status v2
from the stores.
The solution we use is to create a flag in the accounts table, named
hasAcceptedTerms. The flag will be set to true on the first account ever
created in v2 and we provide a native call in mobile/status.go#AcceptTerms,
which allows the client to persist the user's choice in case they are upgrading
(from v1 -> v2, or from a v2 older than this PR).
This solution is not the best because we should store the setting in a separate
table, not in the accounts table.
Related Mobile PR https://github.com/status-im/status-mobile/pull/21124
* fix(test)_: Compare addresses using uppercased strings
---------
Co-authored-by: Icaro Motta <icaro.ldm@gmail.com>
test_: restore account (#5960)
feat_: `LogOnPanic` linter (#5969)
* feat_: LogOnPanic linter
* fix_: add missing defer LogOnPanic
* chore_: make vendor
* fix_: tests, address pr comments
* fix_: address pr comments
fix(ci)_: remove workspace and tmp dir
This ensures we do not encounter weird errors like:
```
+ ln -s /home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907 /home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907@tmp/go/src/github.com/status-im/status-go
ln: failed to create symbolic link '/home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907@tmp/go/src/github.com/status-im/status-go': File exists
script returned exit code 1
```
Signed-off-by: Jakub Sokołowski <jakub@status.im>
chore_: enable windows and macos CI build (#5840)
- Added support for Windows and macOS in CI pipelines
- Added missing dependencies for Windows and x86-64-darwin
- Resolved macOS SDK version compatibility for darwin-x86_64
The `mkShell` override was necessary to ensure compatibility with the newer
macOS SDK (version 11.0) for x86_64. The default SDK (10.12) was causing build failures
because of the missing libs and frameworks. OverrideSDK creates a mapping from
the default SDK in all package categories to the requested SDK (11.0).
fix(contacts)_: fix trust status not being saved to cache when changed (#5965)
Fixes https://github.com/status-im/status-desktop/issues/16392
cleanup
added logger and cleanup
review comments changes
fix_: functional tests (#5979)
* fix_: generate on test-functional
* chore(test)_: fix functional test assertion
---------
Co-authored-by: Siddarth Kumar <siddarthkay@gmail.com>
feat(accounts)_: cherry-pick Persist acceptance of Terms of Use & Privacy policy (#5766) (#5977)
* feat(accounts)_: Persist acceptance of Terms of Use & Privacy policy (#5766)
The original GH issue https://github.com/status-im/status-mobile/issues/21113
came from a request from the Legal team. We must show to Status v1 users the new
terms (Terms of Use & Privacy Policy) right after they upgrade to Status v2
from the stores.
The solution we use is to create a flag in the accounts table, named
hasAcceptedTerms. The flag will be set to true on the first account ever
created in v2 and we provide a native call in mobile/status.go#AcceptTerms,
which allows the client to persist the user's choice in case they are upgrading
(from v1 -> v2, or from a v2 older than this PR).
This solution is not the best because we should store the setting in a separate
table, not in the accounts table.
Related Mobile PR https://github.com/status-im/status-mobile/pull/21124
* fix(test)_: Compare addresses using uppercased strings
---------
Co-authored-by: Icaro Motta <icaro.ldm@gmail.com>
test_: restore account (#5960)
feat_: `LogOnPanic` linter (#5969)
* feat_: LogOnPanic linter
* fix_: add missing defer LogOnPanic
* chore_: make vendor
* fix_: tests, address pr comments
* fix_: address pr comments
chore_: enable windows and macos CI build (#5840)
- Added support for Windows and macOS in CI pipelines
- Added missing dependencies for Windows and x86-64-darwin
- Resolved macOS SDK version compatibility for darwin-x86_64
The `mkShell` override was necessary to ensure compatibility with the newer
macOS SDK (version 11.0) for x86_64. The default SDK (10.12) was causing build failures
because of the missing libs and frameworks. OverrideSDK creates a mapping from
the default SDK in all package categories to the requested SDK (11.0).
fix(contacts)_: fix trust status not being saved to cache when changed (#5965)
Fixes https://github.com/status-im/status-desktop/issues/16392
test_: remove port bind
chore(wallet)_: move route execution code to separate module
chore_: replace geth logger with zap logger (#5962)
closes: #6002
feat(telemetry)_: add metrics for message reliability (#5899)
* feat(telemetry)_: track message reliability
Add metrics for dial errors, missed messages,
missed relevant messages, and confirmed delivery.
* fix_: handle error from json marshal
chore_: use zap logger as request logger
iterates: status-im/status-desktop#16536
test_: unique project per run
test_: use docker compose v2, more concrete project name
fix(codecov)_: ignore folders without tests
Otherwise Codecov reports incorrect numbers when making changes.
https://docs.codecov.com/docs/ignoring-paths
Signed-off-by: Jakub Sokołowski <jakub@status.im>
test_: verify schema of signals during init; fix schema verification warnings (#5947)
fix_: update defaultGorushURL (#6011)
fix(tests)_: use non-standard port to avoid conflicts
We have observed `nimbus-eth2` build failures reporting this port:
```json
{
"lvl": "NTC",
"ts": "2024-10-28 13:51:32.308+00:00",
"msg": "REST HTTP server could not be started",
"topics": "beacnde",
"address": "127.0.0.1:5432",
"reason": "(98) Address already in use"
}
```
https://ci.status.im/job/nimbus-eth2/job/platforms/job/linux/job/x86_64/job/main/job/PR-6683/3/
Signed-off-by: Jakub Sokołowski <jakub@status.im>
fix_: create request logger ad-hoc in tests
Fixes `TestCall` failing when run concurrently.
chore_: configure codecov (#6005)
* chore_: configure codecov
* fix_: after_n_builds
2024-10-24 14:29:15 +00:00
|
|
|
return nil, ErrContactNotMutual
|
2024-04-18 15:28:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
contact.VerificationStatus = verificationStatus
|
|
|
|
contact.LastUpdatedLocally = m.getTimesource().GetCurrentTime()
|
|
|
|
|
|
|
|
err := m.persistence.SaveContact(contact, nil)
|
2022-07-05 19:49:44 +00:00
|
|
|
if err != nil {
|
2024-04-18 15:28:44 +00:00
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
err = m.syncContact(context.Background(), contact, m.dispatchMessage)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
2022-07-05 19:49:44 +00:00
|
|
|
}
|
|
|
|
|
2024-04-18 15:28:44 +00:00
|
|
|
m.allContacts.Store(contact.ID, contact)
|
|
|
|
|
|
|
|
// Dispatch profile message to save a contact to the encrypted profile part
|
|
|
|
err = m.DispatchProfileShowcase()
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
return contact, nil
|
2022-07-05 19:49:44 +00:00
|
|
|
}
|
|
|
|
|
2024-04-18 15:28:44 +00:00
|
|
|
func (m *Messenger) setTrustStatusForContact(ctx context.Context, contactID string, trustStatus verification.TrustStatus) error {
|
test_: Code Migration from status-cli-tests
author shashankshampi <shashank.sanket1995@gmail.com> 1729780155 +0530
committer shashankshampi <shashank.sanket1995@gmail.com> 1730274350 +0530
test: Code Migration from status-cli-tests
fix_: functional tests (#5979)
* fix_: generate on test-functional
* chore(test)_: fix functional test assertion
---------
Co-authored-by: Siddarth Kumar <siddarthkay@gmail.com>
feat(accounts)_: cherry-pick Persist acceptance of Terms of Use & Privacy policy (#5766) (#5977)
* feat(accounts)_: Persist acceptance of Terms of Use & Privacy policy (#5766)
The original GH issue https://github.com/status-im/status-mobile/issues/21113
came from a request from the Legal team. We must show to Status v1 users the new
terms (Terms of Use & Privacy Policy) right after they upgrade to Status v2
from the stores.
The solution we use is to create a flag in the accounts table, named
hasAcceptedTerms. The flag will be set to true on the first account ever
created in v2 and we provide a native call in mobile/status.go#AcceptTerms,
which allows the client to persist the user's choice in case they are upgrading
(from v1 -> v2, or from a v2 older than this PR).
This solution is not the best because we should store the setting in a separate
table, not in the accounts table.
Related Mobile PR https://github.com/status-im/status-mobile/pull/21124
* fix(test)_: Compare addresses using uppercased strings
---------
Co-authored-by: Icaro Motta <icaro.ldm@gmail.com>
test_: restore account (#5960)
feat_: `LogOnPanic` linter (#5969)
* feat_: LogOnPanic linter
* fix_: add missing defer LogOnPanic
* chore_: make vendor
* fix_: tests, address pr comments
* fix_: address pr comments
fix(ci)_: remove workspace and tmp dir
This ensures we do not encounter weird errors like:
```
+ ln -s /home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907 /home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907@tmp/go/src/github.com/status-im/status-go
ln: failed to create symbolic link '/home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907@tmp/go/src/github.com/status-im/status-go': File exists
script returned exit code 1
```
Signed-off-by: Jakub Sokołowski <jakub@status.im>
chore_: enable windows and macos CI build (#5840)
- Added support for Windows and macOS in CI pipelines
- Added missing dependencies for Windows and x86-64-darwin
- Resolved macOS SDK version compatibility for darwin-x86_64
The `mkShell` override was necessary to ensure compatibility with the newer
macOS SDK (version 11.0) for x86_64. The default SDK (10.12) was causing build failures
because of the missing libs and frameworks. OverrideSDK creates a mapping from
the default SDK in all package categories to the requested SDK (11.0).
fix(contacts)_: fix trust status not being saved to cache when changed (#5965)
Fixes https://github.com/status-im/status-desktop/issues/16392
cleanup
added logger and cleanup
review comments changes
fix_: functional tests (#5979)
* fix_: generate on test-functional
* chore(test)_: fix functional test assertion
---------
Co-authored-by: Siddarth Kumar <siddarthkay@gmail.com>
feat(accounts)_: cherry-pick Persist acceptance of Terms of Use & Privacy policy (#5766) (#5977)
* feat(accounts)_: Persist acceptance of Terms of Use & Privacy policy (#5766)
The original GH issue https://github.com/status-im/status-mobile/issues/21113
came from a request from the Legal team. We must show to Status v1 users the new
terms (Terms of Use & Privacy Policy) right after they upgrade to Status v2
from the stores.
The solution we use is to create a flag in the accounts table, named
hasAcceptedTerms. The flag will be set to true on the first account ever
created in v2 and we provide a native call in mobile/status.go#AcceptTerms,
which allows the client to persist the user's choice in case they are upgrading
(from v1 -> v2, or from a v2 older than this PR).
This solution is not the best because we should store the setting in a separate
table, not in the accounts table.
Related Mobile PR https://github.com/status-im/status-mobile/pull/21124
* fix(test)_: Compare addresses using uppercased strings
---------
Co-authored-by: Icaro Motta <icaro.ldm@gmail.com>
test_: restore account (#5960)
feat_: `LogOnPanic` linter (#5969)
* feat_: LogOnPanic linter
* fix_: add missing defer LogOnPanic
* chore_: make vendor
* fix_: tests, address pr comments
* fix_: address pr comments
chore_: enable windows and macos CI build (#5840)
- Added support for Windows and macOS in CI pipelines
- Added missing dependencies for Windows and x86-64-darwin
- Resolved macOS SDK version compatibility for darwin-x86_64
The `mkShell` override was necessary to ensure compatibility with the newer
macOS SDK (version 11.0) for x86_64. The default SDK (10.12) was causing build failures
because of the missing libs and frameworks. OverrideSDK creates a mapping from
the default SDK in all package categories to the requested SDK (11.0).
fix(contacts)_: fix trust status not being saved to cache when changed (#5965)
Fixes https://github.com/status-im/status-desktop/issues/16392
test_: remove port bind
chore(wallet)_: move route execution code to separate module
chore_: replace geth logger with zap logger (#5962)
closes: #6002
feat(telemetry)_: add metrics for message reliability (#5899)
* feat(telemetry)_: track message reliability
Add metrics for dial errors, missed messages,
missed relevant messages, and confirmed delivery.
* fix_: handle error from json marshal
chore_: use zap logger as request logger
iterates: status-im/status-desktop#16536
test_: unique project per run
test_: use docker compose v2, more concrete project name
fix(codecov)_: ignore folders without tests
Otherwise Codecov reports incorrect numbers when making changes.
https://docs.codecov.com/docs/ignoring-paths
Signed-off-by: Jakub Sokołowski <jakub@status.im>
test_: verify schema of signals during init; fix schema verification warnings (#5947)
fix_: update defaultGorushURL (#6011)
fix(tests)_: use non-standard port to avoid conflicts
We have observed `nimbus-eth2` build failures reporting this port:
```json
{
"lvl": "NTC",
"ts": "2024-10-28 13:51:32.308+00:00",
"msg": "REST HTTP server could not be started",
"topics": "beacnde",
"address": "127.0.0.1:5432",
"reason": "(98) Address already in use"
}
```
https://ci.status.im/job/nimbus-eth2/job/platforms/job/linux/job/x86_64/job/main/job/PR-6683/3/
Signed-off-by: Jakub Sokołowski <jakub@status.im>
fix_: create request logger ad-hoc in tests
Fixes `TestCall` failing when run concurrently.
chore_: configure codecov (#6005)
* chore_: configure codecov
* fix_: after_n_builds
2024-10-24 14:29:15 +00:00
|
|
|
contact, ok := m.allContacts.Load(contactID)
|
|
|
|
if !ok {
|
|
|
|
return ErrContactNotFound
|
|
|
|
}
|
|
|
|
|
2024-04-18 15:28:44 +00:00
|
|
|
currentTime := m.getTimesource().GetCurrentTime()
|
|
|
|
|
|
|
|
err := m.verificationDatabase.SetTrustStatus(contactID, trustStatus, currentTime)
|
2022-07-05 19:49:44 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
test_: Code Migration from status-cli-tests
author shashankshampi <shashank.sanket1995@gmail.com> 1729780155 +0530
committer shashankshampi <shashank.sanket1995@gmail.com> 1730274350 +0530
test: Code Migration from status-cli-tests
fix_: functional tests (#5979)
* fix_: generate on test-functional
* chore(test)_: fix functional test assertion
---------
Co-authored-by: Siddarth Kumar <siddarthkay@gmail.com>
feat(accounts)_: cherry-pick Persist acceptance of Terms of Use & Privacy policy (#5766) (#5977)
* feat(accounts)_: Persist acceptance of Terms of Use & Privacy policy (#5766)
The original GH issue https://github.com/status-im/status-mobile/issues/21113
came from a request from the Legal team. We must show to Status v1 users the new
terms (Terms of Use & Privacy Policy) right after they upgrade to Status v2
from the stores.
The solution we use is to create a flag in the accounts table, named
hasAcceptedTerms. The flag will be set to true on the first account ever
created in v2 and we provide a native call in mobile/status.go#AcceptTerms,
which allows the client to persist the user's choice in case they are upgrading
(from v1 -> v2, or from a v2 older than this PR).
This solution is not the best because we should store the setting in a separate
table, not in the accounts table.
Related Mobile PR https://github.com/status-im/status-mobile/pull/21124
* fix(test)_: Compare addresses using uppercased strings
---------
Co-authored-by: Icaro Motta <icaro.ldm@gmail.com>
test_: restore account (#5960)
feat_: `LogOnPanic` linter (#5969)
* feat_: LogOnPanic linter
* fix_: add missing defer LogOnPanic
* chore_: make vendor
* fix_: tests, address pr comments
* fix_: address pr comments
fix(ci)_: remove workspace and tmp dir
This ensures we do not encounter weird errors like:
```
+ ln -s /home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907 /home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907@tmp/go/src/github.com/status-im/status-go
ln: failed to create symbolic link '/home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907@tmp/go/src/github.com/status-im/status-go': File exists
script returned exit code 1
```
Signed-off-by: Jakub Sokołowski <jakub@status.im>
chore_: enable windows and macos CI build (#5840)
- Added support for Windows and macOS in CI pipelines
- Added missing dependencies for Windows and x86-64-darwin
- Resolved macOS SDK version compatibility for darwin-x86_64
The `mkShell` override was necessary to ensure compatibility with the newer
macOS SDK (version 11.0) for x86_64. The default SDK (10.12) was causing build failures
because of the missing libs and frameworks. OverrideSDK creates a mapping from
the default SDK in all package categories to the requested SDK (11.0).
fix(contacts)_: fix trust status not being saved to cache when changed (#5965)
Fixes https://github.com/status-im/status-desktop/issues/16392
cleanup
added logger and cleanup
review comments changes
fix_: functional tests (#5979)
* fix_: generate on test-functional
* chore(test)_: fix functional test assertion
---------
Co-authored-by: Siddarth Kumar <siddarthkay@gmail.com>
feat(accounts)_: cherry-pick Persist acceptance of Terms of Use & Privacy policy (#5766) (#5977)
* feat(accounts)_: Persist acceptance of Terms of Use & Privacy policy (#5766)
The original GH issue https://github.com/status-im/status-mobile/issues/21113
came from a request from the Legal team. We must show to Status v1 users the new
terms (Terms of Use & Privacy Policy) right after they upgrade to Status v2
from the stores.
The solution we use is to create a flag in the accounts table, named
hasAcceptedTerms. The flag will be set to true on the first account ever
created in v2 and we provide a native call in mobile/status.go#AcceptTerms,
which allows the client to persist the user's choice in case they are upgrading
(from v1 -> v2, or from a v2 older than this PR).
This solution is not the best because we should store the setting in a separate
table, not in the accounts table.
Related Mobile PR https://github.com/status-im/status-mobile/pull/21124
* fix(test)_: Compare addresses using uppercased strings
---------
Co-authored-by: Icaro Motta <icaro.ldm@gmail.com>
test_: restore account (#5960)
feat_: `LogOnPanic` linter (#5969)
* feat_: LogOnPanic linter
* fix_: add missing defer LogOnPanic
* chore_: make vendor
* fix_: tests, address pr comments
* fix_: address pr comments
chore_: enable windows and macos CI build (#5840)
- Added support for Windows and macOS in CI pipelines
- Added missing dependencies for Windows and x86-64-darwin
- Resolved macOS SDK version compatibility for darwin-x86_64
The `mkShell` override was necessary to ensure compatibility with the newer
macOS SDK (version 11.0) for x86_64. The default SDK (10.12) was causing build failures
because of the missing libs and frameworks. OverrideSDK creates a mapping from
the default SDK in all package categories to the requested SDK (11.0).
fix(contacts)_: fix trust status not being saved to cache when changed (#5965)
Fixes https://github.com/status-im/status-desktop/issues/16392
test_: remove port bind
chore(wallet)_: move route execution code to separate module
chore_: replace geth logger with zap logger (#5962)
closes: #6002
feat(telemetry)_: add metrics for message reliability (#5899)
* feat(telemetry)_: track message reliability
Add metrics for dial errors, missed messages,
missed relevant messages, and confirmed delivery.
* fix_: handle error from json marshal
chore_: use zap logger as request logger
iterates: status-im/status-desktop#16536
test_: unique project per run
test_: use docker compose v2, more concrete project name
fix(codecov)_: ignore folders without tests
Otherwise Codecov reports incorrect numbers when making changes.
https://docs.codecov.com/docs/ignoring-paths
Signed-off-by: Jakub Sokołowski <jakub@status.im>
test_: verify schema of signals during init; fix schema verification warnings (#5947)
fix_: update defaultGorushURL (#6011)
fix(tests)_: use non-standard port to avoid conflicts
We have observed `nimbus-eth2` build failures reporting this port:
```json
{
"lvl": "NTC",
"ts": "2024-10-28 13:51:32.308+00:00",
"msg": "REST HTTP server could not be started",
"topics": "beacnde",
"address": "127.0.0.1:5432",
"reason": "(98) Address already in use"
}
```
https://ci.status.im/job/nimbus-eth2/job/platforms/job/linux/job/x86_64/job/main/job/PR-6683/3/
Signed-off-by: Jakub Sokołowski <jakub@status.im>
fix_: create request logger ad-hoc in tests
Fixes `TestCall` failing when run concurrently.
chore_: configure codecov (#6005)
* chore_: configure codecov
* fix_: after_n_builds
2024-10-24 14:29:15 +00:00
|
|
|
contact.TrustStatus = trustStatus
|
|
|
|
m.allContacts.Store(contactID, contact)
|
|
|
|
|
2024-04-18 15:28:44 +00:00
|
|
|
return m.SyncTrustedUser(ctx, contactID, trustStatus, m.dispatchMessage)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *Messenger) MarkAsTrusted(ctx context.Context, contactID string) error {
|
|
|
|
return m.setTrustStatusForContact(ctx, contactID, verification.TrustStatusTRUSTED)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *Messenger) MarkAsUntrustworthy(ctx context.Context, contactID string) error {
|
|
|
|
return m.setTrustStatusForContact(ctx, contactID, verification.TrustStatusUNTRUSTWORTHY)
|
2022-07-05 19:49:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (m *Messenger) RemoveTrustStatus(ctx context.Context, contactID string) error {
|
2024-04-18 15:28:44 +00:00
|
|
|
return m.setTrustStatusForContact(ctx, contactID, verification.TrustStatusUNKNOWN)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *Messenger) RemoveTrustVerificationStatus(ctx context.Context, contactID string) (*MessengerResponse, error) {
|
|
|
|
err := m.setTrustStatusForContact(ctx, contactID, verification.TrustStatusUNKNOWN)
|
2022-07-05 19:49:44 +00:00
|
|
|
if err != nil {
|
2024-04-18 15:28:44 +00:00
|
|
|
return nil, err
|
2022-07-05 19:49:44 +00:00
|
|
|
}
|
|
|
|
|
2024-04-18 15:28:44 +00:00
|
|
|
contact, err := m.setContactVerificationStatus(contactID, VerificationStatusUNVERIFIED)
|
2024-02-09 09:36:54 +00:00
|
|
|
if err != nil {
|
2024-04-18 15:28:44 +00:00
|
|
|
return nil, err
|
2024-02-09 09:36:54 +00:00
|
|
|
}
|
|
|
|
|
2024-04-18 15:28:44 +00:00
|
|
|
response := &MessengerResponse{}
|
|
|
|
response.AddContact(contact)
|
|
|
|
|
|
|
|
return response, nil
|
2022-07-05 19:49:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (m *Messenger) GetTrustStatus(contactID string) (verification.TrustStatus, error) {
|
|
|
|
return m.verificationDatabase.GetTrustStatus(contactID)
|
|
|
|
}
|
|
|
|
|
2023-08-18 11:39:59 +00:00
|
|
|
func ValidateContactVerificationRequest(request *protobuf.RequestContactVerification) error {
|
2022-07-05 19:49:44 +00:00
|
|
|
challengeLen := len(strings.TrimSpace(request.Challenge))
|
|
|
|
if challengeLen < minContactVerificationMessageLen || challengeLen > maxContactVerificationMessageLen {
|
|
|
|
return errors.New("invalid verification request challenge length")
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2023-08-18 11:39:59 +00:00
|
|
|
func (m *Messenger) HandleRequestContactVerification(state *ReceivedMessageState, request *protobuf.RequestContactVerification, statusMessage *v1protocol.StatusMessage) error {
|
2022-07-05 19:49:44 +00:00
|
|
|
if err := ValidateContactVerificationRequest(request); err != nil {
|
|
|
|
m.logger.Debug("Invalid verification request", zap.Error(err))
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2022-08-31 14:41:58 +00:00
|
|
|
id := state.CurrentMessageState.MessageID
|
|
|
|
|
2022-07-05 19:49:44 +00:00
|
|
|
if common.IsPubKeyEqual(state.CurrentMessageState.PublicKey, &m.identity.PublicKey) {
|
|
|
|
return nil // Is ours, do nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
myPubKey := hexutil.Encode(crypto.FromECDSAPub(&m.identity.PublicKey))
|
|
|
|
contactID := hexutil.Encode(crypto.FromECDSAPub(state.CurrentMessageState.PublicKey))
|
|
|
|
|
|
|
|
contact := state.CurrentMessageState.Contact
|
2023-01-20 14:28:30 +00:00
|
|
|
if !contact.mutual() {
|
2022-07-05 19:49:44 +00:00
|
|
|
m.logger.Debug("Received a verification request for a non added mutual contact", zap.String("contactID", contactID))
|
test_: Code Migration from status-cli-tests
author shashankshampi <shashank.sanket1995@gmail.com> 1729780155 +0530
committer shashankshampi <shashank.sanket1995@gmail.com> 1730274350 +0530
test: Code Migration from status-cli-tests
fix_: functional tests (#5979)
* fix_: generate on test-functional
* chore(test)_: fix functional test assertion
---------
Co-authored-by: Siddarth Kumar <siddarthkay@gmail.com>
feat(accounts)_: cherry-pick Persist acceptance of Terms of Use & Privacy policy (#5766) (#5977)
* feat(accounts)_: Persist acceptance of Terms of Use & Privacy policy (#5766)
The original GH issue https://github.com/status-im/status-mobile/issues/21113
came from a request from the Legal team. We must show to Status v1 users the new
terms (Terms of Use & Privacy Policy) right after they upgrade to Status v2
from the stores.
The solution we use is to create a flag in the accounts table, named
hasAcceptedTerms. The flag will be set to true on the first account ever
created in v2 and we provide a native call in mobile/status.go#AcceptTerms,
which allows the client to persist the user's choice in case they are upgrading
(from v1 -> v2, or from a v2 older than this PR).
This solution is not the best because we should store the setting in a separate
table, not in the accounts table.
Related Mobile PR https://github.com/status-im/status-mobile/pull/21124
* fix(test)_: Compare addresses using uppercased strings
---------
Co-authored-by: Icaro Motta <icaro.ldm@gmail.com>
test_: restore account (#5960)
feat_: `LogOnPanic` linter (#5969)
* feat_: LogOnPanic linter
* fix_: add missing defer LogOnPanic
* chore_: make vendor
* fix_: tests, address pr comments
* fix_: address pr comments
fix(ci)_: remove workspace and tmp dir
This ensures we do not encounter weird errors like:
```
+ ln -s /home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907 /home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907@tmp/go/src/github.com/status-im/status-go
ln: failed to create symbolic link '/home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907@tmp/go/src/github.com/status-im/status-go': File exists
script returned exit code 1
```
Signed-off-by: Jakub Sokołowski <jakub@status.im>
chore_: enable windows and macos CI build (#5840)
- Added support for Windows and macOS in CI pipelines
- Added missing dependencies for Windows and x86-64-darwin
- Resolved macOS SDK version compatibility for darwin-x86_64
The `mkShell` override was necessary to ensure compatibility with the newer
macOS SDK (version 11.0) for x86_64. The default SDK (10.12) was causing build failures
because of the missing libs and frameworks. OverrideSDK creates a mapping from
the default SDK in all package categories to the requested SDK (11.0).
fix(contacts)_: fix trust status not being saved to cache when changed (#5965)
Fixes https://github.com/status-im/status-desktop/issues/16392
cleanup
added logger and cleanup
review comments changes
fix_: functional tests (#5979)
* fix_: generate on test-functional
* chore(test)_: fix functional test assertion
---------
Co-authored-by: Siddarth Kumar <siddarthkay@gmail.com>
feat(accounts)_: cherry-pick Persist acceptance of Terms of Use & Privacy policy (#5766) (#5977)
* feat(accounts)_: Persist acceptance of Terms of Use & Privacy policy (#5766)
The original GH issue https://github.com/status-im/status-mobile/issues/21113
came from a request from the Legal team. We must show to Status v1 users the new
terms (Terms of Use & Privacy Policy) right after they upgrade to Status v2
from the stores.
The solution we use is to create a flag in the accounts table, named
hasAcceptedTerms. The flag will be set to true on the first account ever
created in v2 and we provide a native call in mobile/status.go#AcceptTerms,
which allows the client to persist the user's choice in case they are upgrading
(from v1 -> v2, or from a v2 older than this PR).
This solution is not the best because we should store the setting in a separate
table, not in the accounts table.
Related Mobile PR https://github.com/status-im/status-mobile/pull/21124
* fix(test)_: Compare addresses using uppercased strings
---------
Co-authored-by: Icaro Motta <icaro.ldm@gmail.com>
test_: restore account (#5960)
feat_: `LogOnPanic` linter (#5969)
* feat_: LogOnPanic linter
* fix_: add missing defer LogOnPanic
* chore_: make vendor
* fix_: tests, address pr comments
* fix_: address pr comments
chore_: enable windows and macos CI build (#5840)
- Added support for Windows and macOS in CI pipelines
- Added missing dependencies for Windows and x86-64-darwin
- Resolved macOS SDK version compatibility for darwin-x86_64
The `mkShell` override was necessary to ensure compatibility with the newer
macOS SDK (version 11.0) for x86_64. The default SDK (10.12) was causing build failures
because of the missing libs and frameworks. OverrideSDK creates a mapping from
the default SDK in all package categories to the requested SDK (11.0).
fix(contacts)_: fix trust status not being saved to cache when changed (#5965)
Fixes https://github.com/status-im/status-desktop/issues/16392
test_: remove port bind
chore(wallet)_: move route execution code to separate module
chore_: replace geth logger with zap logger (#5962)
closes: #6002
feat(telemetry)_: add metrics for message reliability (#5899)
* feat(telemetry)_: track message reliability
Add metrics for dial errors, missed messages,
missed relevant messages, and confirmed delivery.
* fix_: handle error from json marshal
chore_: use zap logger as request logger
iterates: status-im/status-desktop#16536
test_: unique project per run
test_: use docker compose v2, more concrete project name
fix(codecov)_: ignore folders without tests
Otherwise Codecov reports incorrect numbers when making changes.
https://docs.codecov.com/docs/ignoring-paths
Signed-off-by: Jakub Sokołowski <jakub@status.im>
test_: verify schema of signals during init; fix schema verification warnings (#5947)
fix_: update defaultGorushURL (#6011)
fix(tests)_: use non-standard port to avoid conflicts
We have observed `nimbus-eth2` build failures reporting this port:
```json
{
"lvl": "NTC",
"ts": "2024-10-28 13:51:32.308+00:00",
"msg": "REST HTTP server could not be started",
"topics": "beacnde",
"address": "127.0.0.1:5432",
"reason": "(98) Address already in use"
}
```
https://ci.status.im/job/nimbus-eth2/job/platforms/job/linux/job/x86_64/job/main/job/PR-6683/3/
Signed-off-by: Jakub Sokołowski <jakub@status.im>
fix_: create request logger ad-hoc in tests
Fixes `TestCall` failing when run concurrently.
chore_: configure codecov (#6005)
* chore_: configure codecov
* fix_: after_n_builds
2024-10-24 14:29:15 +00:00
|
|
|
return ErrContactNotMutual
|
2022-07-05 19:49:44 +00:00
|
|
|
}
|
|
|
|
|
2022-08-31 14:41:58 +00:00
|
|
|
persistedVR, err := m.verificationDatabase.GetVerificationRequest(id)
|
2022-07-05 19:49:44 +00:00
|
|
|
if err != nil {
|
|
|
|
m.logger.Debug("Error obtaining verification request", zap.Error(err))
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
if persistedVR != nil && persistedVR.RequestedAt > request.Clock {
|
|
|
|
return nil // older message, ignore it
|
|
|
|
}
|
|
|
|
|
|
|
|
if persistedVR == nil {
|
|
|
|
// This is a new verification request, and we have not received its acceptance/decline before
|
|
|
|
persistedVR = &verification.Request{}
|
2022-08-31 14:41:58 +00:00
|
|
|
persistedVR.ID = id
|
2022-07-05 19:49:44 +00:00
|
|
|
persistedVR.From = contactID
|
|
|
|
persistedVR.To = myPubKey
|
|
|
|
persistedVR.RequestStatus = verification.RequestStatusPENDING
|
|
|
|
}
|
|
|
|
|
2022-08-31 14:41:58 +00:00
|
|
|
if persistedVR.From != contactID {
|
|
|
|
return errors.New("mismatch contactID and ID")
|
|
|
|
}
|
|
|
|
|
2022-07-05 19:49:44 +00:00
|
|
|
persistedVR.Challenge = request.Challenge
|
|
|
|
persistedVR.RequestedAt = request.Clock
|
|
|
|
|
|
|
|
err = m.verificationDatabase.SaveVerificationRequest(persistedVR)
|
|
|
|
if err != nil {
|
|
|
|
m.logger.Debug("Error storing verification request", zap.Error(err))
|
|
|
|
return err
|
|
|
|
}
|
2022-08-31 14:41:58 +00:00
|
|
|
m.logger.Info("SAVED", zap.String("id", persistedVR.ID))
|
2022-07-05 19:49:44 +00:00
|
|
|
|
2023-01-06 12:21:14 +00:00
|
|
|
err = m.SyncVerificationRequest(context.Background(), persistedVR, m.dispatchMessage)
|
2022-07-05 19:49:44 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2022-08-31 14:41:58 +00:00
|
|
|
chat, ok := m.allChats.Load(contactID)
|
|
|
|
if !ok {
|
|
|
|
publicKey, err := contact.PublicKey()
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
chat = OneToOneFromPublicKey(publicKey, m.getTimesource())
|
|
|
|
// We don't want to show the chat to the user
|
|
|
|
chat.Active = false
|
|
|
|
}
|
2022-07-05 19:49:44 +00:00
|
|
|
|
2022-08-31 14:41:58 +00:00
|
|
|
m.allChats.Store(chat.ID, chat)
|
2022-07-05 19:49:44 +00:00
|
|
|
|
2022-08-31 14:41:58 +00:00
|
|
|
chatMessage, err := m.createContactVerificationMessage(request.Challenge, chat, state, common.ContactVerificationStatePending)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
state.Response.AddMessage(chatMessage)
|
|
|
|
|
|
|
|
state.AllVerificationRequests = append(state.AllVerificationRequests, persistedVR)
|
|
|
|
|
2022-12-26 04:35:46 +00:00
|
|
|
return m.createOrUpdateIncomingContactVerificationNotification(contact, state, persistedVR, chatMessage, nil)
|
2022-07-05 19:49:44 +00:00
|
|
|
}
|
|
|
|
|
2023-08-18 11:39:59 +00:00
|
|
|
func ValidateAcceptContactVerification(request *protobuf.AcceptContactVerification) error {
|
2022-07-05 19:49:44 +00:00
|
|
|
responseLen := len(strings.TrimSpace(request.Response))
|
|
|
|
if responseLen < minContactVerificationMessageLen || responseLen > maxContactVerificationMessageLen {
|
|
|
|
return errors.New("invalid verification request response length")
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2023-08-18 11:39:59 +00:00
|
|
|
func (m *Messenger) HandleAcceptContactVerification(state *ReceivedMessageState, request *protobuf.AcceptContactVerification, statusMessage *v1protocol.StatusMessage) error {
|
2022-07-05 19:49:44 +00:00
|
|
|
if err := ValidateAcceptContactVerification(request); err != nil {
|
|
|
|
m.logger.Debug("Invalid AcceptContactVerification", zap.Error(err))
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
if common.IsPubKeyEqual(state.CurrentMessageState.PublicKey, &m.identity.PublicKey) {
|
|
|
|
return nil // Is ours, do nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
myPubKey := hexutil.Encode(crypto.FromECDSAPub(&m.identity.PublicKey))
|
|
|
|
contactID := hexutil.Encode(crypto.FromECDSAPub(state.CurrentMessageState.PublicKey))
|
|
|
|
|
|
|
|
contact := state.CurrentMessageState.Contact
|
2023-01-20 14:28:30 +00:00
|
|
|
if !contact.mutual() {
|
2022-07-05 19:49:44 +00:00
|
|
|
m.logger.Debug("Received a verification response for a non mutual contact", zap.String("contactID", contactID))
|
test_: Code Migration from status-cli-tests
author shashankshampi <shashank.sanket1995@gmail.com> 1729780155 +0530
committer shashankshampi <shashank.sanket1995@gmail.com> 1730274350 +0530
test: Code Migration from status-cli-tests
fix_: functional tests (#5979)
* fix_: generate on test-functional
* chore(test)_: fix functional test assertion
---------
Co-authored-by: Siddarth Kumar <siddarthkay@gmail.com>
feat(accounts)_: cherry-pick Persist acceptance of Terms of Use & Privacy policy (#5766) (#5977)
* feat(accounts)_: Persist acceptance of Terms of Use & Privacy policy (#5766)
The original GH issue https://github.com/status-im/status-mobile/issues/21113
came from a request from the Legal team. We must show to Status v1 users the new
terms (Terms of Use & Privacy Policy) right after they upgrade to Status v2
from the stores.
The solution we use is to create a flag in the accounts table, named
hasAcceptedTerms. The flag will be set to true on the first account ever
created in v2 and we provide a native call in mobile/status.go#AcceptTerms,
which allows the client to persist the user's choice in case they are upgrading
(from v1 -> v2, or from a v2 older than this PR).
This solution is not the best because we should store the setting in a separate
table, not in the accounts table.
Related Mobile PR https://github.com/status-im/status-mobile/pull/21124
* fix(test)_: Compare addresses using uppercased strings
---------
Co-authored-by: Icaro Motta <icaro.ldm@gmail.com>
test_: restore account (#5960)
feat_: `LogOnPanic` linter (#5969)
* feat_: LogOnPanic linter
* fix_: add missing defer LogOnPanic
* chore_: make vendor
* fix_: tests, address pr comments
* fix_: address pr comments
fix(ci)_: remove workspace and tmp dir
This ensures we do not encounter weird errors like:
```
+ ln -s /home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907 /home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907@tmp/go/src/github.com/status-im/status-go
ln: failed to create symbolic link '/home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907@tmp/go/src/github.com/status-im/status-go': File exists
script returned exit code 1
```
Signed-off-by: Jakub Sokołowski <jakub@status.im>
chore_: enable windows and macos CI build (#5840)
- Added support for Windows and macOS in CI pipelines
- Added missing dependencies for Windows and x86-64-darwin
- Resolved macOS SDK version compatibility for darwin-x86_64
The `mkShell` override was necessary to ensure compatibility with the newer
macOS SDK (version 11.0) for x86_64. The default SDK (10.12) was causing build failures
because of the missing libs and frameworks. OverrideSDK creates a mapping from
the default SDK in all package categories to the requested SDK (11.0).
fix(contacts)_: fix trust status not being saved to cache when changed (#5965)
Fixes https://github.com/status-im/status-desktop/issues/16392
cleanup
added logger and cleanup
review comments changes
fix_: functional tests (#5979)
* fix_: generate on test-functional
* chore(test)_: fix functional test assertion
---------
Co-authored-by: Siddarth Kumar <siddarthkay@gmail.com>
feat(accounts)_: cherry-pick Persist acceptance of Terms of Use & Privacy policy (#5766) (#5977)
* feat(accounts)_: Persist acceptance of Terms of Use & Privacy policy (#5766)
The original GH issue https://github.com/status-im/status-mobile/issues/21113
came from a request from the Legal team. We must show to Status v1 users the new
terms (Terms of Use & Privacy Policy) right after they upgrade to Status v2
from the stores.
The solution we use is to create a flag in the accounts table, named
hasAcceptedTerms. The flag will be set to true on the first account ever
created in v2 and we provide a native call in mobile/status.go#AcceptTerms,
which allows the client to persist the user's choice in case they are upgrading
(from v1 -> v2, or from a v2 older than this PR).
This solution is not the best because we should store the setting in a separate
table, not in the accounts table.
Related Mobile PR https://github.com/status-im/status-mobile/pull/21124
* fix(test)_: Compare addresses using uppercased strings
---------
Co-authored-by: Icaro Motta <icaro.ldm@gmail.com>
test_: restore account (#5960)
feat_: `LogOnPanic` linter (#5969)
* feat_: LogOnPanic linter
* fix_: add missing defer LogOnPanic
* chore_: make vendor
* fix_: tests, address pr comments
* fix_: address pr comments
chore_: enable windows and macos CI build (#5840)
- Added support for Windows and macOS in CI pipelines
- Added missing dependencies for Windows and x86-64-darwin
- Resolved macOS SDK version compatibility for darwin-x86_64
The `mkShell` override was necessary to ensure compatibility with the newer
macOS SDK (version 11.0) for x86_64. The default SDK (10.12) was causing build failures
because of the missing libs and frameworks. OverrideSDK creates a mapping from
the default SDK in all package categories to the requested SDK (11.0).
fix(contacts)_: fix trust status not being saved to cache when changed (#5965)
Fixes https://github.com/status-im/status-desktop/issues/16392
test_: remove port bind
chore(wallet)_: move route execution code to separate module
chore_: replace geth logger with zap logger (#5962)
closes: #6002
feat(telemetry)_: add metrics for message reliability (#5899)
* feat(telemetry)_: track message reliability
Add metrics for dial errors, missed messages,
missed relevant messages, and confirmed delivery.
* fix_: handle error from json marshal
chore_: use zap logger as request logger
iterates: status-im/status-desktop#16536
test_: unique project per run
test_: use docker compose v2, more concrete project name
fix(codecov)_: ignore folders without tests
Otherwise Codecov reports incorrect numbers when making changes.
https://docs.codecov.com/docs/ignoring-paths
Signed-off-by: Jakub Sokołowski <jakub@status.im>
test_: verify schema of signals during init; fix schema verification warnings (#5947)
fix_: update defaultGorushURL (#6011)
fix(tests)_: use non-standard port to avoid conflicts
We have observed `nimbus-eth2` build failures reporting this port:
```json
{
"lvl": "NTC",
"ts": "2024-10-28 13:51:32.308+00:00",
"msg": "REST HTTP server could not be started",
"topics": "beacnde",
"address": "127.0.0.1:5432",
"reason": "(98) Address already in use"
}
```
https://ci.status.im/job/nimbus-eth2/job/platforms/job/linux/job/x86_64/job/main/job/PR-6683/3/
Signed-off-by: Jakub Sokołowski <jakub@status.im>
fix_: create request logger ad-hoc in tests
Fixes `TestCall` failing when run concurrently.
chore_: configure codecov (#6005)
* chore_: configure codecov
* fix_: after_n_builds
2024-10-24 14:29:15 +00:00
|
|
|
return ErrContactNotMutual
|
2022-07-05 19:49:44 +00:00
|
|
|
}
|
|
|
|
|
2022-08-31 14:41:58 +00:00
|
|
|
persistedVR, err := m.verificationDatabase.GetVerificationRequest(request.Id)
|
2022-07-05 19:49:44 +00:00
|
|
|
if err != nil {
|
|
|
|
m.logger.Debug("Error obtaining verification request", zap.Error(err))
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
if persistedVR == nil {
|
|
|
|
// This is a response for which we have not received its request before
|
|
|
|
persistedVR = &verification.Request{}
|
2022-08-31 14:41:58 +00:00
|
|
|
persistedVR.ID = request.Id
|
2022-07-05 19:49:44 +00:00
|
|
|
persistedVR.From = contactID
|
|
|
|
persistedVR.To = myPubKey
|
2024-03-14 19:56:26 +00:00
|
|
|
} else {
|
|
|
|
if persistedVR.RepliedAt > request.Clock {
|
|
|
|
return nil // older message, ignore it
|
|
|
|
}
|
|
|
|
|
|
|
|
if persistedVR.RequestStatus == verification.RequestStatusCANCELED {
|
|
|
|
return nil // Do nothing, We have already cancelled the verification request
|
|
|
|
}
|
2022-07-05 19:49:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
persistedVR.RequestStatus = verification.RequestStatusACCEPTED
|
|
|
|
persistedVR.Response = request.Response
|
|
|
|
persistedVR.RepliedAt = request.Clock
|
|
|
|
|
|
|
|
err = m.verificationDatabase.SaveVerificationRequest(persistedVR)
|
|
|
|
if err != nil {
|
|
|
|
m.logger.Debug("Error storing verification request", zap.Error(err))
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2023-01-06 12:21:14 +00:00
|
|
|
err = m.SyncVerificationRequest(context.Background(), persistedVR, m.dispatchMessage)
|
2022-07-05 19:49:44 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2022-08-31 14:41:58 +00:00
|
|
|
chat, ok := m.allChats.Load(contactID)
|
|
|
|
if !ok {
|
|
|
|
publicKey, err := contact.PublicKey()
|
|
|
|
if err != nil {
|
|
|
|
return 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)
|
|
|
|
|
|
|
|
chatMessage, err := m.createContactVerificationMessage(request.Response, chat, state, common.ContactVerificationStateAccepted)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
state.Response.AddMessage(chatMessage)
|
|
|
|
|
2022-10-28 09:51:54 +00:00
|
|
|
msg, err := m.persistence.MessageByID(request.Id)
|
2022-08-31 14:41:58 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2022-10-28 11:37:46 +00:00
|
|
|
msg.ContactVerificationState = common.ContactVerificationStateAccepted
|
2022-08-31 14:41:58 +00:00
|
|
|
|
2022-10-28 09:51:54 +00:00
|
|
|
state.Response.AddMessage(msg)
|
2022-07-05 19:49:44 +00:00
|
|
|
|
2022-12-26 04:35:46 +00:00
|
|
|
err = m.createOrUpdateOutgoingContactVerificationNotification(contact, state.Response, persistedVR, msg, chatMessage)
|
2022-10-28 09:51:54 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
state.AllVerificationRequests = append(state.AllVerificationRequests, persistedVR)
|
2022-07-05 19:49:44 +00:00
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2023-08-18 11:39:59 +00:00
|
|
|
func (m *Messenger) HandleDeclineContactVerification(state *ReceivedMessageState, request *protobuf.DeclineContactVerification, statusMessage *v1protocol.StatusMessage) error {
|
2022-07-05 19:49:44 +00:00
|
|
|
if common.IsPubKeyEqual(state.CurrentMessageState.PublicKey, &m.identity.PublicKey) {
|
|
|
|
return nil // Is ours, do nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
myPubKey := hexutil.Encode(crypto.FromECDSAPub(&m.identity.PublicKey))
|
|
|
|
contactID := hexutil.Encode(crypto.FromECDSAPub(state.CurrentMessageState.PublicKey))
|
|
|
|
|
|
|
|
contact := state.CurrentMessageState.Contact
|
2023-01-20 14:28:30 +00:00
|
|
|
if !contact.mutual() {
|
2022-07-05 19:49:44 +00:00
|
|
|
m.logger.Debug("Received a verification decline for a non mutual contact", zap.String("contactID", contactID))
|
test_: Code Migration from status-cli-tests
author shashankshampi <shashank.sanket1995@gmail.com> 1729780155 +0530
committer shashankshampi <shashank.sanket1995@gmail.com> 1730274350 +0530
test: Code Migration from status-cli-tests
fix_: functional tests (#5979)
* fix_: generate on test-functional
* chore(test)_: fix functional test assertion
---------
Co-authored-by: Siddarth Kumar <siddarthkay@gmail.com>
feat(accounts)_: cherry-pick Persist acceptance of Terms of Use & Privacy policy (#5766) (#5977)
* feat(accounts)_: Persist acceptance of Terms of Use & Privacy policy (#5766)
The original GH issue https://github.com/status-im/status-mobile/issues/21113
came from a request from the Legal team. We must show to Status v1 users the new
terms (Terms of Use & Privacy Policy) right after they upgrade to Status v2
from the stores.
The solution we use is to create a flag in the accounts table, named
hasAcceptedTerms. The flag will be set to true on the first account ever
created in v2 and we provide a native call in mobile/status.go#AcceptTerms,
which allows the client to persist the user's choice in case they are upgrading
(from v1 -> v2, or from a v2 older than this PR).
This solution is not the best because we should store the setting in a separate
table, not in the accounts table.
Related Mobile PR https://github.com/status-im/status-mobile/pull/21124
* fix(test)_: Compare addresses using uppercased strings
---------
Co-authored-by: Icaro Motta <icaro.ldm@gmail.com>
test_: restore account (#5960)
feat_: `LogOnPanic` linter (#5969)
* feat_: LogOnPanic linter
* fix_: add missing defer LogOnPanic
* chore_: make vendor
* fix_: tests, address pr comments
* fix_: address pr comments
fix(ci)_: remove workspace and tmp dir
This ensures we do not encounter weird errors like:
```
+ ln -s /home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907 /home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907@tmp/go/src/github.com/status-im/status-go
ln: failed to create symbolic link '/home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907@tmp/go/src/github.com/status-im/status-go': File exists
script returned exit code 1
```
Signed-off-by: Jakub Sokołowski <jakub@status.im>
chore_: enable windows and macos CI build (#5840)
- Added support for Windows and macOS in CI pipelines
- Added missing dependencies for Windows and x86-64-darwin
- Resolved macOS SDK version compatibility for darwin-x86_64
The `mkShell` override was necessary to ensure compatibility with the newer
macOS SDK (version 11.0) for x86_64. The default SDK (10.12) was causing build failures
because of the missing libs and frameworks. OverrideSDK creates a mapping from
the default SDK in all package categories to the requested SDK (11.0).
fix(contacts)_: fix trust status not being saved to cache when changed (#5965)
Fixes https://github.com/status-im/status-desktop/issues/16392
cleanup
added logger and cleanup
review comments changes
fix_: functional tests (#5979)
* fix_: generate on test-functional
* chore(test)_: fix functional test assertion
---------
Co-authored-by: Siddarth Kumar <siddarthkay@gmail.com>
feat(accounts)_: cherry-pick Persist acceptance of Terms of Use & Privacy policy (#5766) (#5977)
* feat(accounts)_: Persist acceptance of Terms of Use & Privacy policy (#5766)
The original GH issue https://github.com/status-im/status-mobile/issues/21113
came from a request from the Legal team. We must show to Status v1 users the new
terms (Terms of Use & Privacy Policy) right after they upgrade to Status v2
from the stores.
The solution we use is to create a flag in the accounts table, named
hasAcceptedTerms. The flag will be set to true on the first account ever
created in v2 and we provide a native call in mobile/status.go#AcceptTerms,
which allows the client to persist the user's choice in case they are upgrading
(from v1 -> v2, or from a v2 older than this PR).
This solution is not the best because we should store the setting in a separate
table, not in the accounts table.
Related Mobile PR https://github.com/status-im/status-mobile/pull/21124
* fix(test)_: Compare addresses using uppercased strings
---------
Co-authored-by: Icaro Motta <icaro.ldm@gmail.com>
test_: restore account (#5960)
feat_: `LogOnPanic` linter (#5969)
* feat_: LogOnPanic linter
* fix_: add missing defer LogOnPanic
* chore_: make vendor
* fix_: tests, address pr comments
* fix_: address pr comments
chore_: enable windows and macos CI build (#5840)
- Added support for Windows and macOS in CI pipelines
- Added missing dependencies for Windows and x86-64-darwin
- Resolved macOS SDK version compatibility for darwin-x86_64
The `mkShell` override was necessary to ensure compatibility with the newer
macOS SDK (version 11.0) for x86_64. The default SDK (10.12) was causing build failures
because of the missing libs and frameworks. OverrideSDK creates a mapping from
the default SDK in all package categories to the requested SDK (11.0).
fix(contacts)_: fix trust status not being saved to cache when changed (#5965)
Fixes https://github.com/status-im/status-desktop/issues/16392
test_: remove port bind
chore(wallet)_: move route execution code to separate module
chore_: replace geth logger with zap logger (#5962)
closes: #6002
feat(telemetry)_: add metrics for message reliability (#5899)
* feat(telemetry)_: track message reliability
Add metrics for dial errors, missed messages,
missed relevant messages, and confirmed delivery.
* fix_: handle error from json marshal
chore_: use zap logger as request logger
iterates: status-im/status-desktop#16536
test_: unique project per run
test_: use docker compose v2, more concrete project name
fix(codecov)_: ignore folders without tests
Otherwise Codecov reports incorrect numbers when making changes.
https://docs.codecov.com/docs/ignoring-paths
Signed-off-by: Jakub Sokołowski <jakub@status.im>
test_: verify schema of signals during init; fix schema verification warnings (#5947)
fix_: update defaultGorushURL (#6011)
fix(tests)_: use non-standard port to avoid conflicts
We have observed `nimbus-eth2` build failures reporting this port:
```json
{
"lvl": "NTC",
"ts": "2024-10-28 13:51:32.308+00:00",
"msg": "REST HTTP server could not be started",
"topics": "beacnde",
"address": "127.0.0.1:5432",
"reason": "(98) Address already in use"
}
```
https://ci.status.im/job/nimbus-eth2/job/platforms/job/linux/job/x86_64/job/main/job/PR-6683/3/
Signed-off-by: Jakub Sokołowski <jakub@status.im>
fix_: create request logger ad-hoc in tests
Fixes `TestCall` failing when run concurrently.
chore_: configure codecov (#6005)
* chore_: configure codecov
* fix_: after_n_builds
2024-10-24 14:29:15 +00:00
|
|
|
return ErrContactNotMutual
|
2022-07-05 19:49:44 +00:00
|
|
|
}
|
|
|
|
|
2022-10-24 11:33:47 +00:00
|
|
|
persistedVR, err := m.verificationDatabase.GetVerificationRequest(request.Id)
|
2022-07-05 19:49:44 +00:00
|
|
|
if err != nil {
|
|
|
|
m.logger.Debug("Error obtaining verification request", zap.Error(err))
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
if persistedVR != nil && persistedVR.RepliedAt > request.Clock {
|
|
|
|
return nil // older message, ignore it
|
|
|
|
}
|
|
|
|
|
|
|
|
if persistedVR.RequestStatus == verification.RequestStatusCANCELED {
|
|
|
|
return nil // Do nothing, We have already cancelled the verification request
|
|
|
|
}
|
|
|
|
|
2024-02-13 19:34:56 +00:00
|
|
|
contact.VerificationStatus = VerificationStatusUNVERIFIED
|
|
|
|
contact.LastUpdatedLocally = m.getTimesource().GetCurrentTime()
|
|
|
|
|
|
|
|
err = m.persistence.SaveContact(contact, nil)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
// We sync the contact with the other devices
|
|
|
|
err = m.syncContact(context.Background(), contact, m.dispatchMessage)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
m.allContacts.Store(contact.ID, contact)
|
|
|
|
|
|
|
|
state.Response.AddContact(contact)
|
|
|
|
|
2022-07-05 19:49:44 +00:00
|
|
|
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.RequestStatusDECLINED
|
|
|
|
persistedVR.RepliedAt = request.Clock
|
|
|
|
|
|
|
|
err = m.verificationDatabase.SaveVerificationRequest(persistedVR)
|
|
|
|
if err != nil {
|
|
|
|
m.logger.Debug("Error storing verification request", zap.Error(err))
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2023-01-06 12:21:14 +00:00
|
|
|
err = m.SyncVerificationRequest(context.Background(), persistedVR, m.dispatchMessage)
|
2022-07-05 19:49:44 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
state.AllVerificationRequests = append(state.AllVerificationRequests, persistedVR)
|
|
|
|
|
2022-10-24 11:33:47 +00:00
|
|
|
msg, err := m.persistence.MessageByID(request.Id)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2022-07-05 19:49:44 +00:00
|
|
|
|
2022-10-24 11:33:47 +00:00
|
|
|
if msg != nil {
|
|
|
|
msg.ContactVerificationState = common.ContactVerificationStateDeclined
|
|
|
|
state.Response.AddMessage(msg)
|
|
|
|
}
|
|
|
|
|
2022-12-26 04:35:46 +00:00
|
|
|
return m.createOrUpdateOutgoingContactVerificationNotification(contact, state.Response, persistedVR, msg, nil)
|
2022-07-05 19:49:44 +00:00
|
|
|
}
|
|
|
|
|
2023-08-18 11:39:59 +00:00
|
|
|
func (m *Messenger) HandleCancelContactVerification(state *ReceivedMessageState, request *protobuf.CancelContactVerification, statusMessage *v1protocol.StatusMessage) error {
|
2022-12-14 08:27:02 +00:00
|
|
|
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
|
|
|
|
}
|
|
|
|
|
2023-01-06 12:21:14 +00:00
|
|
|
err = m.SyncVerificationRequest(context.Background(), persistedVR, m.dispatchMessage)
|
2022-12-14 08:27:02 +00:00
|
|
|
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)
|
|
|
|
}
|
|
|
|
|
2022-12-26 04:35:46 +00:00
|
|
|
return m.createOrUpdateIncomingContactVerificationNotification(contact, state, persistedVR, msg, nil)
|
2022-12-14 08:27:02 +00:00
|
|
|
}
|
|
|
|
|
2022-12-26 04:35:46 +00:00
|
|
|
func (m *Messenger) GetLatestVerificationRequestFrom(contactID string) (*verification.Request, error) {
|
|
|
|
return m.verificationDatabase.GetLatestVerificationRequestFrom(contactID)
|
|
|
|
}
|
2022-07-05 19:49:44 +00:00
|
|
|
|
2022-12-26 04:35:46 +00:00
|
|
|
func (m *Messenger) createOrUpdateOutgoingContactVerificationNotification(contact *Contact, response *MessengerResponse, vr *verification.Request, chatMessage *common.Message, replyMessage *common.Message) error {
|
|
|
|
notification := &ActivityCenterNotification{
|
|
|
|
ID: types.FromHex(vr.ID),
|
2023-02-22 16:57:33 +00:00
|
|
|
Name: contact.PrimaryName(),
|
2022-12-26 04:35:46 +00:00
|
|
|
Type: ActivityCenterNotificationTypeContactVerification,
|
|
|
|
Author: chatMessage.From,
|
|
|
|
Message: chatMessage,
|
|
|
|
ReplyMessage: replyMessage,
|
|
|
|
Timestamp: chatMessage.WhisperTimestamp,
|
|
|
|
ChatID: contact.ID,
|
|
|
|
ContactVerificationStatus: vr.RequestStatus,
|
2023-01-28 09:52:53 +00:00
|
|
|
Read: vr.RequestStatus != verification.RequestStatusACCEPTED, // Mark as Unread Accepted notification because we are waiting for the asnwer
|
|
|
|
Accepted: vr.RequestStatus == verification.RequestStatusTRUSTED || vr.RequestStatus == verification.RequestStatusUNTRUSTWORTHY,
|
|
|
|
Dismissed: vr.RequestStatus == verification.RequestStatusDECLINED,
|
2023-10-22 09:41:20 +00:00
|
|
|
UpdatedAt: m.GetCurrentTimeInMillis(),
|
2022-07-05 19:49:44 +00:00
|
|
|
}
|
|
|
|
|
2023-10-22 09:41:20 +00:00
|
|
|
return m.addActivityCenterNotification(response, notification, nil)
|
2022-07-05 19:49:44 +00:00
|
|
|
}
|
2022-08-31 14:41:58 +00:00
|
|
|
|
2022-12-26 04:35:46 +00:00
|
|
|
func (m *Messenger) createOrUpdateIncomingContactVerificationNotification(contact *Contact, messageState *ReceivedMessageState, vr *verification.Request, chatMessage *common.Message, replyMessage *common.Message) error {
|
2022-08-31 14:41:58 +00:00
|
|
|
notification := &ActivityCenterNotification{
|
|
|
|
ID: types.FromHex(vr.ID),
|
2023-02-22 16:57:33 +00:00
|
|
|
Name: contact.PrimaryName(),
|
2022-08-31 14:41:58 +00:00
|
|
|
Type: ActivityCenterNotificationTypeContactVerification,
|
|
|
|
Author: messageState.CurrentMessageState.Contact.ID,
|
|
|
|
Message: chatMessage,
|
2022-10-28 11:37:46 +00:00
|
|
|
ReplyMessage: replyMessage,
|
2022-08-31 14:41:58 +00:00
|
|
|
Timestamp: messageState.CurrentMessageState.WhisperTimestamp,
|
|
|
|
ChatID: contact.ID,
|
|
|
|
ContactVerificationStatus: vr.RequestStatus,
|
2023-01-28 09:52:53 +00:00
|
|
|
Read: vr.RequestStatus != verification.RequestStatusPENDING, // Unread only for pending incomming
|
|
|
|
Accepted: vr.RequestStatus == verification.RequestStatusACCEPTED || vr.RequestStatus == verification.RequestStatusTRUSTED || vr.RequestStatus == verification.RequestStatusUNTRUSTWORTHY,
|
|
|
|
Dismissed: vr.RequestStatus == verification.RequestStatusDECLINED,
|
2023-10-22 09:41:20 +00:00
|
|
|
UpdatedAt: m.GetCurrentTimeInMillis(),
|
2022-08-31 14:41:58 +00:00
|
|
|
}
|
|
|
|
|
2023-10-22 09:41:20 +00:00
|
|
|
return m.addActivityCenterNotification(messageState.Response, notification, nil)
|
2022-08-31 14:41:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (m *Messenger) createContactVerificationMessage(challenge string, chat *Chat, state *ReceivedMessageState, verificationStatus common.ContactVerificationState) (*common.Message, error) {
|
2023-08-18 11:39:59 +00:00
|
|
|
chatMessage := common.NewMessage()
|
2022-08-31 14:41:58 +00:00
|
|
|
chatMessage.ID = state.CurrentMessageState.MessageID
|
|
|
|
chatMessage.From = state.CurrentMessageState.Contact.ID
|
|
|
|
chatMessage.Alias = state.CurrentMessageState.Contact.Alias
|
|
|
|
chatMessage.SigPubKey = state.CurrentMessageState.PublicKey
|
|
|
|
chatMessage.Identicon = state.CurrentMessageState.Contact.Identicon
|
|
|
|
chatMessage.WhisperTimestamp = state.CurrentMessageState.WhisperTimestamp
|
|
|
|
|
|
|
|
chatMessage.ChatId = chat.ID
|
|
|
|
chatMessage.Text = challenge
|
|
|
|
chatMessage.ContentType = protobuf.ChatMessage_IDENTITY_VERIFICATION
|
|
|
|
chatMessage.ContactVerificationState = verificationStatus
|
|
|
|
|
|
|
|
err := chatMessage.PrepareContent(common.PubkeyToHex(&m.identity.PublicKey))
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return chatMessage, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *Messenger) createLocalContactVerificationMessage(challenge string, chat *Chat, id string, status common.ContactVerificationState) (*common.Message, error) {
|
|
|
|
|
2023-08-18 11:39:59 +00:00
|
|
|
chatMessage := common.NewMessage()
|
2022-08-31 14:41:58 +00:00
|
|
|
chatMessage.ID = id
|
|
|
|
err := extendMessageFromChat(chatMessage, chat, &m.identity.PublicKey, m.getTimesource())
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
chatMessage.ChatId = chat.ID
|
|
|
|
chatMessage.Text = challenge
|
|
|
|
chatMessage.ContentType = protobuf.ChatMessage_IDENTITY_VERIFICATION
|
|
|
|
chatMessage.ContactVerificationState = status
|
|
|
|
err = extendMessageFromChat(chatMessage, chat, &m.identity.PublicKey, m.getTimesource())
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
err = chatMessage.PrepareContent(common.PubkeyToHex(&m.identity.PublicKey))
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return chatMessage, nil
|
|
|
|
}
|