Fix modvendor (#1690)
This commit is contained in:
parent
ed5a5c154d
commit
e1a8ba1ba5
|
@ -69,3 +69,6 @@ Session.vim
|
|||
|
||||
# created for running container
|
||||
_assets/compose/bootnode/keys
|
||||
|
||||
# do not vendor nested vendor dirs
|
||||
vendor/**/vendor
|
||||
|
|
3
Makefile
3
Makefile
|
@ -216,7 +216,8 @@ xtools-install:
|
|||
|
||||
modvendor-install:
|
||||
# a tool to vendor non-go files
|
||||
go get -u github.com/goware/modvendor
|
||||
# TODO: switch to original repo when https://github.com/goware/modvendor/pull/13 is merged
|
||||
GO111MODULE=off go get -u github.com/adambabik/modvendor
|
||||
|
||||
mock-install: ##@other Install mocking tools
|
||||
go get -u github.com/golang/mock/mockgen
|
||||
|
|
|
@ -2,7 +2,7 @@ package gethbridge
|
|||
|
||||
import (
|
||||
whispertypes "github.com/status-im/status-go/protocol/transport/whisper/types"
|
||||
statusproto "github.com/status-im/status-go/protocol/types"
|
||||
protocol "github.com/status-im/status-go/protocol/types"
|
||||
whisper "github.com/status-im/whisper/whisperv6"
|
||||
)
|
||||
|
||||
|
@ -22,8 +22,8 @@ func GetGethEnvelopeFrom(f whispertypes.Envelope) *whisper.Envelope {
|
|||
return f.(*gethEnvelopeWrapper).envelope
|
||||
}
|
||||
|
||||
func (w *gethEnvelopeWrapper) Hash() statusproto.Hash {
|
||||
return statusproto.Hash(w.envelope.Hash())
|
||||
func (w *gethEnvelopeWrapper) Hash() protocol.Hash {
|
||||
return protocol.Hash(w.envelope.Hash())
|
||||
}
|
||||
|
||||
func (w *gethEnvelopeWrapper) Bloom() []byte {
|
||||
|
|
|
@ -2,7 +2,7 @@ package gethbridge
|
|||
|
||||
import (
|
||||
whispertypes "github.com/status-im/status-go/protocol/transport/whisper/types"
|
||||
statusproto "github.com/status-im/status-go/protocol/types"
|
||||
protocol "github.com/status-im/status-go/protocol/types"
|
||||
whisper "github.com/status-im/whisper/whisperv6"
|
||||
)
|
||||
|
||||
|
@ -13,7 +13,7 @@ func NewGethEnvelopeErrorWrapper(envelopeError *whisper.EnvelopeError) *whispert
|
|||
}
|
||||
|
||||
return &whispertypes.EnvelopeError{
|
||||
Hash: statusproto.Hash(envelopeError.Hash),
|
||||
Hash: protocol.Hash(envelopeError.Hash),
|
||||
Code: mapGethErrorCode(envelopeError.Code),
|
||||
Description: envelopeError.Description,
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ package gethbridge
|
|||
|
||||
import (
|
||||
whispertypes "github.com/status-im/status-go/protocol/transport/whisper/types"
|
||||
statusproto "github.com/status-im/status-go/protocol/types"
|
||||
protocol "github.com/status-im/status-go/protocol/types"
|
||||
whisper "github.com/status-im/whisper/whisperv6"
|
||||
)
|
||||
|
||||
|
@ -26,8 +26,8 @@ func NewGethEnvelopeEventWrapper(envelopeEvent *whisper.EnvelopeEvent) *whispert
|
|||
}
|
||||
return &whispertypes.EnvelopeEvent{
|
||||
Event: whispertypes.EventType(envelopeEvent.Event),
|
||||
Hash: statusproto.Hash(envelopeEvent.Hash),
|
||||
Batch: statusproto.Hash(envelopeEvent.Batch),
|
||||
Hash: protocol.Hash(envelopeEvent.Hash),
|
||||
Batch: protocol.Hash(envelopeEvent.Batch),
|
||||
Peer: whispertypes.EnodeID(envelopeEvent.Peer),
|
||||
Data: wrappedData,
|
||||
}
|
||||
|
|
4
vendor/github.com/status-im/status-go/protocol/bridge/geth/mailserver_response.go
generated
vendored
4
vendor/github.com/status-im/status-go/protocol/bridge/geth/mailserver_response.go
generated
vendored
|
@ -2,7 +2,7 @@ package gethbridge
|
|||
|
||||
import (
|
||||
whispertypes "github.com/status-im/status-go/protocol/transport/whisper/types"
|
||||
statusproto "github.com/status-im/status-go/protocol/types"
|
||||
protocol "github.com/status-im/status-go/protocol/types"
|
||||
whisper "github.com/status-im/whisper/whisperv6"
|
||||
)
|
||||
|
||||
|
@ -13,7 +13,7 @@ func NewGethMailServerResponseWrapper(mailServerResponse *whisper.MailServerResp
|
|||
}
|
||||
|
||||
return &whispertypes.MailServerResponse{
|
||||
LastEnvelopeHash: statusproto.Hash(mailServerResponse.LastEnvelopeHash),
|
||||
LastEnvelopeHash: protocol.Hash(mailServerResponse.LastEnvelopeHash),
|
||||
Cursor: mailServerResponse.Cursor,
|
||||
Error: mailServerResponse.Error,
|
||||
}
|
||||
|
|
4
vendor/github.com/status-im/status-go/protocol/bridge/geth/public_whisper_api.go
generated
vendored
4
vendor/github.com/status-im/status-go/protocol/bridge/geth/public_whisper_api.go
generated
vendored
|
@ -5,7 +5,7 @@ import (
|
|||
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
whispertypes "github.com/status-im/status-go/protocol/transport/whisper/types"
|
||||
statusproto "github.com/status-im/status-go/protocol/types"
|
||||
protocol "github.com/status-im/status-go/protocol/types"
|
||||
whisper "github.com/status-im/whisper/whisperv6"
|
||||
)
|
||||
|
||||
|
@ -25,7 +25,7 @@ func NewGethPublicWhisperAPIWrapper(publicWhisperAPI *whisper.PublicWhisperAPI)
|
|||
}
|
||||
|
||||
// AddPrivateKey imports the given private key.
|
||||
func (w *gethPublicWhisperAPIWrapper) AddPrivateKey(ctx context.Context, privateKey statusproto.HexBytes) (string, error) {
|
||||
func (w *gethPublicWhisperAPIWrapper) AddPrivateKey(ctx context.Context, privateKey protocol.HexBytes) (string, error) {
|
||||
return w.publicWhisperAPI.AddPrivateKey(ctx, hexutil.Bytes(privateKey))
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ import (
|
|||
"encoding/hex"
|
||||
|
||||
"github.com/ethereum/go-ethereum/crypto"
|
||||
statusproto "github.com/status-im/status-go/protocol/types"
|
||||
protocol "github.com/status-im/status-go/protocol/types"
|
||||
v1protocol "github.com/status-im/status-go/protocol/v1"
|
||||
)
|
||||
|
||||
|
@ -140,7 +140,7 @@ type ChatMember struct {
|
|||
}
|
||||
|
||||
func (c ChatMember) PublicKey() (*ecdsa.PublicKey, error) {
|
||||
b, err := statusproto.DecodeHex(c.ID)
|
||||
b, err := protocol.DecodeHex(c.ID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -148,7 +148,7 @@ func (c ChatMember) PublicKey() (*ecdsa.PublicKey, error) {
|
|||
}
|
||||
|
||||
func oneToOneChatID(publicKey *ecdsa.PublicKey) string {
|
||||
return statusproto.EncodeHex(crypto.FromECDSAPub(publicKey))
|
||||
return protocol.EncodeHex(crypto.FromECDSAPub(publicKey))
|
||||
}
|
||||
|
||||
func CreateOneToOneChat(name string, publicKey *ecdsa.PublicKey) Chat {
|
||||
|
@ -194,7 +194,7 @@ func stringSliceToPublicKeys(slice []string, prefixed bool) ([]*ecdsa.PublicKey,
|
|||
err error
|
||||
)
|
||||
if prefixed {
|
||||
b, err = statusproto.DecodeHex(item)
|
||||
b, err = protocol.DecodeHex(item)
|
||||
} else {
|
||||
b, err = hex.DecodeString(item)
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
"github.com/ethereum/go-ethereum/crypto"
|
||||
"github.com/status-im/status-go/protocol/identity/alias"
|
||||
"github.com/status-im/status-go/protocol/identity/identicon"
|
||||
statusproto "github.com/status-im/status-go/protocol/types"
|
||||
protocol "github.com/status-im/status-go/protocol/types"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -58,7 +58,7 @@ type Contact struct {
|
|||
}
|
||||
|
||||
func (c Contact) PublicKey() (*ecdsa.PublicKey, error) {
|
||||
b, err := statusproto.DecodeHex(c.ID)
|
||||
b, err := protocol.DecodeHex(c.ID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
34
vendor/github.com/status-im/status-go/protocol/encryption/migrations/migrations.go
generated
vendored
34
vendor/github.com/status-im/status-go/protocol/encryption/migrations/migrations.go
generated
vendored
|
@ -592,23 +592,23 @@ type bintree struct {
|
|||
}
|
||||
|
||||
var _bintree = &bintree{nil, map[string]*bintree{
|
||||
"1536754952_initial_schema.down.sql": &bintree{_1536754952_initial_schemaDownSql, map[string]*bintree{}},
|
||||
"1536754952_initial_schema.up.sql": &bintree{_1536754952_initial_schemaUpSql, map[string]*bintree{}},
|
||||
"1539249977_update_ratchet_info.down.sql": &bintree{_1539249977_update_ratchet_infoDownSql, map[string]*bintree{}},
|
||||
"1539249977_update_ratchet_info.up.sql": &bintree{_1539249977_update_ratchet_infoUpSql, map[string]*bintree{}},
|
||||
"1540715431_add_version.down.sql": &bintree{_1540715431_add_versionDownSql, map[string]*bintree{}},
|
||||
"1540715431_add_version.up.sql": &bintree{_1540715431_add_versionUpSql, map[string]*bintree{}},
|
||||
"1541164797_add_installations.down.sql": &bintree{_1541164797_add_installationsDownSql, map[string]*bintree{}},
|
||||
"1541164797_add_installations.up.sql": &bintree{_1541164797_add_installationsUpSql, map[string]*bintree{}},
|
||||
"1558084410_add_secret.down.sql": &bintree{_1558084410_add_secretDownSql, map[string]*bintree{}},
|
||||
"1558084410_add_secret.up.sql": &bintree{_1558084410_add_secretUpSql, map[string]*bintree{}},
|
||||
"1558588866_add_version.down.sql": &bintree{_1558588866_add_versionDownSql, map[string]*bintree{}},
|
||||
"1558588866_add_version.up.sql": &bintree{_1558588866_add_versionUpSql, map[string]*bintree{}},
|
||||
"1559627659_add_contact_code.down.sql": &bintree{_1559627659_add_contact_codeDownSql, map[string]*bintree{}},
|
||||
"1559627659_add_contact_code.up.sql": &bintree{_1559627659_add_contact_codeUpSql, map[string]*bintree{}},
|
||||
"1561368210_add_installation_metadata.down.sql": &bintree{_1561368210_add_installation_metadataDownSql, map[string]*bintree{}},
|
||||
"1561368210_add_installation_metadata.up.sql": &bintree{_1561368210_add_installation_metadataUpSql, map[string]*bintree{}},
|
||||
"doc.go": &bintree{docGo, map[string]*bintree{}},
|
||||
"1536754952_initial_schema.down.sql": {_1536754952_initial_schemaDownSql, map[string]*bintree{}},
|
||||
"1536754952_initial_schema.up.sql": {_1536754952_initial_schemaUpSql, map[string]*bintree{}},
|
||||
"1539249977_update_ratchet_info.down.sql": {_1539249977_update_ratchet_infoDownSql, map[string]*bintree{}},
|
||||
"1539249977_update_ratchet_info.up.sql": {_1539249977_update_ratchet_infoUpSql, map[string]*bintree{}},
|
||||
"1540715431_add_version.down.sql": {_1540715431_add_versionDownSql, map[string]*bintree{}},
|
||||
"1540715431_add_version.up.sql": {_1540715431_add_versionUpSql, map[string]*bintree{}},
|
||||
"1541164797_add_installations.down.sql": {_1541164797_add_installationsDownSql, map[string]*bintree{}},
|
||||
"1541164797_add_installations.up.sql": {_1541164797_add_installationsUpSql, map[string]*bintree{}},
|
||||
"1558084410_add_secret.down.sql": {_1558084410_add_secretDownSql, map[string]*bintree{}},
|
||||
"1558084410_add_secret.up.sql": {_1558084410_add_secretUpSql, map[string]*bintree{}},
|
||||
"1558588866_add_version.down.sql": {_1558588866_add_versionDownSql, map[string]*bintree{}},
|
||||
"1558588866_add_version.up.sql": {_1558588866_add_versionUpSql, map[string]*bintree{}},
|
||||
"1559627659_add_contact_code.down.sql": {_1559627659_add_contact_codeDownSql, map[string]*bintree{}},
|
||||
"1559627659_add_contact_code.up.sql": {_1559627659_add_contact_codeUpSql, map[string]*bintree{}},
|
||||
"1561368210_add_installation_metadata.down.sql": {_1561368210_add_installation_metadataDownSql, map[string]*bintree{}},
|
||||
"1561368210_add_installation_metadata.up.sql": {_1561368210_add_installation_metadataUpSql, map[string]*bintree{}},
|
||||
"doc.go": {docGo, map[string]*bintree{}},
|
||||
}}
|
||||
|
||||
// RestoreAsset restores an asset under the given directory.
|
||||
|
|
|
@ -4,17 +4,17 @@ import (
|
|||
"database/sql/driver"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
statusproto "github.com/status-im/status-go/protocol/types"
|
||||
protocol "github.com/status-im/status-go/protocol/types"
|
||||
)
|
||||
|
||||
type hexutilSQL statusproto.HexBytes
|
||||
type hexutilSQL protocol.HexBytes
|
||||
|
||||
func (h hexutilSQL) Value() (driver.Value, error) {
|
||||
return []byte(h), nil
|
||||
}
|
||||
|
||||
func (h hexutilSQL) String() string {
|
||||
return statusproto.EncodeHex(h)
|
||||
return protocol.EncodeHex(h)
|
||||
}
|
||||
|
||||
func (h *hexutilSQL) Scan(value interface{}) error {
|
||||
|
|
|
@ -20,7 +20,7 @@ import (
|
|||
"github.com/status-im/status-go/protocol/sqlite"
|
||||
transport "github.com/status-im/status-go/protocol/transport/whisper"
|
||||
whispertypes "github.com/status-im/status-go/protocol/transport/whisper/types"
|
||||
statusproto "github.com/status-im/status-go/protocol/types"
|
||||
protocol "github.com/status-im/status-go/protocol/types"
|
||||
v1protocol "github.com/status-im/status-go/protocol/v1"
|
||||
)
|
||||
|
||||
|
@ -497,7 +497,7 @@ func (m *Messenger) AddMembersToChat(ctx context.Context, chat *Chat, members []
|
|||
}
|
||||
encodedMembers := make([]string, len(members))
|
||||
for idx, member := range members {
|
||||
encodedMembers[idx] = statusproto.EncodeHex(crypto.FromECDSAPub(member))
|
||||
encodedMembers[idx] = protocol.EncodeHex(crypto.FromECDSAPub(member))
|
||||
}
|
||||
event := v1protocol.NewMembersAddedEvent(encodedMembers, group.NextClockValue())
|
||||
err = group.ProcessEvent(&m.identity.PublicKey, event)
|
||||
|
@ -517,7 +517,7 @@ func (m *Messenger) ConfirmJoiningGroup(ctx context.Context, chat *Chat) error {
|
|||
return err
|
||||
}
|
||||
event := v1protocol.NewMemberJoinedEvent(
|
||||
statusproto.EncodeHex(crypto.FromECDSAPub(&m.identity.PublicKey)),
|
||||
protocol.EncodeHex(crypto.FromECDSAPub(&m.identity.PublicKey)),
|
||||
group.NextClockValue(),
|
||||
)
|
||||
err = group.ProcessEvent(&m.identity.PublicKey, event)
|
||||
|
@ -1045,7 +1045,7 @@ func (p *postProcessor) matchMessage(message *v1protocol.Message, chats []*Chat)
|
|||
case message.MessageT == v1protocol.MessageTypePrivate:
|
||||
// It's an incoming private message. ChatID is calculated from the signature.
|
||||
// If a chat does not exist, a new one is created and saved.
|
||||
chatID := statusproto.EncodeHex(crypto.FromECDSAPub(message.SigPubKey))
|
||||
chatID := protocol.EncodeHex(crypto.FromECDSAPub(message.SigPubKey))
|
||||
chat := findChatByID(chatID, chats)
|
||||
if chat == nil {
|
||||
// TODO: this should be a three-word name used in the mobile client
|
||||
|
@ -1065,7 +1065,7 @@ func (p *postProcessor) matchMessage(message *v1protocol.Message, chats []*Chat)
|
|||
return nil, errors.New("received group chat message for non-existing chat")
|
||||
}
|
||||
|
||||
sigPubKeyHex := statusproto.EncodeHex(crypto.FromECDSAPub(message.SigPubKey))
|
||||
sigPubKeyHex := protocol.EncodeHex(crypto.FromECDSAPub(message.SigPubKey))
|
||||
for _, member := range chat.Members {
|
||||
if member.ID == sigPubKeyHex {
|
||||
return chat, nil
|
||||
|
|
|
@ -454,17 +454,17 @@ type bintree struct {
|
|||
}
|
||||
|
||||
var _bintree = &bintree{nil, map[string]*bintree{
|
||||
"000001_init.down.db.sql": &bintree{_000001_initDownDbSql, map[string]*bintree{}},
|
||||
"000001_init.up.db.sql": &bintree{_000001_initUpDbSql, map[string]*bintree{}},
|
||||
"000002_add_chats.down.db.sql": &bintree{_000002_add_chatsDownDbSql, map[string]*bintree{}},
|
||||
"000002_add_chats.up.db.sql": &bintree{_000002_add_chatsUpDbSql, map[string]*bintree{}},
|
||||
"000003_add_contacts.down.db.sql": &bintree{_000003_add_contactsDownDbSql, map[string]*bintree{}},
|
||||
"000003_add_contacts.up.db.sql": &bintree{_000003_add_contactsUpDbSql, map[string]*bintree{}},
|
||||
"000004_user_messages_compatibility.down.sql": &bintree{_000004_user_messages_compatibilityDownSql, map[string]*bintree{}},
|
||||
"000004_user_messages_compatibility.up.sql": &bintree{_000004_user_messages_compatibilityUpSql, map[string]*bintree{}},
|
||||
"1567112142_user_messages.down.sql": &bintree{_1567112142_user_messagesDownSql, map[string]*bintree{}},
|
||||
"1567112142_user_messages.up.sql": &bintree{_1567112142_user_messagesUpSql, map[string]*bintree{}},
|
||||
"doc.go": &bintree{docGo, map[string]*bintree{}},
|
||||
"000001_init.down.db.sql": {_000001_initDownDbSql, map[string]*bintree{}},
|
||||
"000001_init.up.db.sql": {_000001_initUpDbSql, map[string]*bintree{}},
|
||||
"000002_add_chats.down.db.sql": {_000002_add_chatsDownDbSql, map[string]*bintree{}},
|
||||
"000002_add_chats.up.db.sql": {_000002_add_chatsUpDbSql, map[string]*bintree{}},
|
||||
"000003_add_contacts.down.db.sql": {_000003_add_contactsDownDbSql, map[string]*bintree{}},
|
||||
"000003_add_contacts.up.db.sql": {_000003_add_contactsUpDbSql, map[string]*bintree{}},
|
||||
"000004_user_messages_compatibility.down.sql": {_000004_user_messages_compatibilityDownSql, map[string]*bintree{}},
|
||||
"000004_user_messages_compatibility.up.sql": {_000004_user_messages_compatibilityUpSql, map[string]*bintree{}},
|
||||
"1567112142_user_messages.down.sql": {_1567112142_user_messagesDownSql, map[string]*bintree{}},
|
||||
"1567112142_user_messages.up.sql": {_1567112142_user_messagesUpSql, map[string]*bintree{}},
|
||||
"doc.go": {docGo, map[string]*bintree{}},
|
||||
}}
|
||||
|
||||
// RestoreAsset restores an asset under the given directory.
|
||||
|
|
|
@ -6,7 +6,7 @@ import (
|
|||
"sync"
|
||||
|
||||
whispertypes "github.com/status-im/status-go/protocol/transport/whisper/types"
|
||||
statusproto "github.com/status-im/status-go/protocol/types"
|
||||
protocol "github.com/status-im/status-go/protocol/types"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
|
@ -34,8 +34,8 @@ type EnvelopesMonitorConfig struct {
|
|||
type EnvelopeEventsHandler interface {
|
||||
EnvelopeSent([][]byte)
|
||||
EnvelopeExpired([][]byte, error)
|
||||
MailServerRequestCompleted(statusproto.Hash, statusproto.Hash, []byte, error)
|
||||
MailServerRequestExpired(statusproto.Hash)
|
||||
MailServerRequestCompleted(protocol.Hash, protocol.Hash, []byte, error)
|
||||
MailServerRequestExpired(protocol.Hash)
|
||||
}
|
||||
|
||||
// NewEnvelopesMonitor returns a pointer to an instance of the EnvelopesMonitor.
|
||||
|
@ -61,13 +61,13 @@ func NewEnvelopesMonitor(w whispertypes.Whisper, config EnvelopesMonitorConfig)
|
|||
logger: logger.With(zap.Namespace("EnvelopesMonitor")),
|
||||
|
||||
// key is envelope hash (event.Hash)
|
||||
envelopes: map[statusproto.Hash]EnvelopeState{},
|
||||
messages: map[statusproto.Hash]*whispertypes.NewMessage{},
|
||||
attempts: map[statusproto.Hash]int{},
|
||||
identifiers: make(map[statusproto.Hash][][]byte),
|
||||
envelopes: map[protocol.Hash]EnvelopeState{},
|
||||
messages: map[protocol.Hash]*whispertypes.NewMessage{},
|
||||
attempts: map[protocol.Hash]int{},
|
||||
identifiers: make(map[protocol.Hash][][]byte),
|
||||
|
||||
// key is hash of the batch (event.Batch)
|
||||
batches: map[statusproto.Hash]map[statusproto.Hash]struct{}{},
|
||||
batches: map[protocol.Hash]map[protocol.Hash]struct{}{},
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -80,12 +80,12 @@ type EnvelopesMonitor struct {
|
|||
maxAttempts int
|
||||
|
||||
mu sync.Mutex
|
||||
envelopes map[statusproto.Hash]EnvelopeState
|
||||
batches map[statusproto.Hash]map[statusproto.Hash]struct{}
|
||||
envelopes map[protocol.Hash]EnvelopeState
|
||||
batches map[protocol.Hash]map[protocol.Hash]struct{}
|
||||
|
||||
messages map[statusproto.Hash]*whispertypes.NewMessage
|
||||
attempts map[statusproto.Hash]int
|
||||
identifiers map[statusproto.Hash][][]byte
|
||||
messages map[protocol.Hash]*whispertypes.NewMessage
|
||||
attempts map[protocol.Hash]int
|
||||
identifiers map[protocol.Hash][][]byte
|
||||
|
||||
wg sync.WaitGroup
|
||||
quit chan struct{}
|
||||
|
@ -111,7 +111,7 @@ func (m *EnvelopesMonitor) Stop() {
|
|||
}
|
||||
|
||||
// Add hash to a tracker.
|
||||
func (m *EnvelopesMonitor) Add(identifiers [][]byte, envelopeHash statusproto.Hash, message whispertypes.NewMessage) {
|
||||
func (m *EnvelopesMonitor) Add(identifiers [][]byte, envelopeHash protocol.Hash, message whispertypes.NewMessage) {
|
||||
m.mu.Lock()
|
||||
defer m.mu.Unlock()
|
||||
m.envelopes[envelopeHash] = EnvelopePosted
|
||||
|
@ -120,7 +120,7 @@ func (m *EnvelopesMonitor) Add(identifiers [][]byte, envelopeHash statusproto.Ha
|
|||
m.attempts[envelopeHash] = 1
|
||||
}
|
||||
|
||||
func (m *EnvelopesMonitor) GetState(hash statusproto.Hash) EnvelopeState {
|
||||
func (m *EnvelopesMonitor) GetState(hash protocol.Hash) EnvelopeState {
|
||||
m.mu.Lock()
|
||||
defer m.mu.Unlock()
|
||||
state, exist := m.envelopes[hash]
|
||||
|
@ -179,9 +179,9 @@ func (m *EnvelopesMonitor) handleEventEnvelopeSent(event whispertypes.EnvelopeEv
|
|||
return
|
||||
}
|
||||
m.logger.Debug("envelope is sent", zap.String("hash", event.Hash.String()), zap.String("peer", event.Peer.String()))
|
||||
if event.Batch != (statusproto.Hash{}) {
|
||||
if event.Batch != (protocol.Hash{}) {
|
||||
if _, ok := m.batches[event.Batch]; !ok {
|
||||
m.batches[event.Batch] = map[statusproto.Hash]struct{}{}
|
||||
m.batches[event.Batch] = map[protocol.Hash]struct{}{}
|
||||
}
|
||||
m.batches[event.Batch][event.Hash] = struct{}{}
|
||||
m.logger.Debug("waiting for a confirmation", zap.String("batch", event.Batch.String()))
|
||||
|
@ -212,7 +212,7 @@ func (m *EnvelopesMonitor) handleAcknowledgedBatch(event whispertypes.EnvelopeEv
|
|||
if event.Data != nil && !ok {
|
||||
m.logger.Error("received unexpected data in the the confirmation event", zap.String("batch", event.Batch.String()))
|
||||
}
|
||||
failedEnvelopes := map[statusproto.Hash]struct{}{}
|
||||
failedEnvelopes := map[protocol.Hash]struct{}{}
|
||||
for i := range envelopeErrors {
|
||||
envelopeError := envelopeErrors[i]
|
||||
_, exist := m.envelopes[envelopeError.Hash]
|
||||
|
@ -252,7 +252,7 @@ func (m *EnvelopesMonitor) handleEventEnvelopeExpired(event whispertypes.Envelop
|
|||
|
||||
// handleEnvelopeFailure is a common code path for processing envelopes failures. not thread safe, lock
|
||||
// must be used on a higher level.
|
||||
func (m *EnvelopesMonitor) handleEnvelopeFailure(hash statusproto.Hash, err error) {
|
||||
func (m *EnvelopesMonitor) handleEnvelopeFailure(hash protocol.Hash, err error) {
|
||||
if state, ok := m.envelopes[hash]; ok {
|
||||
message, exist := m.messages[hash]
|
||||
if !exist {
|
||||
|
@ -274,7 +274,7 @@ func (m *EnvelopesMonitor) handleEnvelopeFailure(hash statusproto.Hash, err erro
|
|||
}
|
||||
|
||||
}
|
||||
envelopeID := statusproto.BytesToHash(hex)
|
||||
envelopeID := protocol.BytesToHash(hex)
|
||||
m.envelopes[envelopeID] = EnvelopePosted
|
||||
m.messages[envelopeID] = message
|
||||
m.attempts[envelopeID] = attempt + 1
|
||||
|
@ -309,7 +309,7 @@ func (m *EnvelopesMonitor) handleEventEnvelopeReceived(event whispertypes.Envelo
|
|||
|
||||
// clearMessageState removes all message and envelope state.
|
||||
// not thread-safe, should be protected on a higher level.
|
||||
func (m *EnvelopesMonitor) clearMessageState(envelopeID statusproto.Hash) {
|
||||
func (m *EnvelopesMonitor) clearMessageState(envelopeID protocol.Hash) {
|
||||
delete(m.envelopes, envelopeID)
|
||||
delete(m.messages, envelopeID)
|
||||
delete(m.attempts, envelopeID)
|
||||
|
|
|
@ -270,9 +270,9 @@ type bintree struct {
|
|||
}
|
||||
|
||||
var _bintree = &bintree{nil, map[string]*bintree{
|
||||
"1561059285_add_whisper_keys.down.sql": &bintree{_1561059285_add_whisper_keysDownSql, map[string]*bintree{}},
|
||||
"1561059285_add_whisper_keys.up.sql": &bintree{_1561059285_add_whisper_keysUpSql, map[string]*bintree{}},
|
||||
"doc.go": &bintree{docGo, map[string]*bintree{}},
|
||||
"1561059285_add_whisper_keys.down.sql": {_1561059285_add_whisper_keysDownSql, map[string]*bintree{}},
|
||||
"1561059285_add_whisper_keys.up.sql": {_1561059285_add_whisper_keysUpSql, map[string]*bintree{}},
|
||||
"doc.go": {docGo, map[string]*bintree{}},
|
||||
}}
|
||||
|
||||
// RestoreAsset restores an asset under the given directory.
|
||||
|
|
10
vendor/github.com/status-im/status-go/protocol/transport/whisper/types/envelopes.go
generated
vendored
10
vendor/github.com/status-im/status-go/protocol/transport/whisper/types/envelopes.go
generated
vendored
|
@ -1,11 +1,11 @@
|
|||
package whispertypes
|
||||
|
||||
import statusproto "github.com/status-im/status-go/protocol/types"
|
||||
import protocol "github.com/status-im/status-go/protocol/types"
|
||||
|
||||
// Envelope represents a clear-text data packet to transmit through the Whisper
|
||||
// network. Its contents may or may not be encrypted and signed.
|
||||
type Envelope interface {
|
||||
Hash() statusproto.Hash // Cached hash of the envelope to avoid rehashing every time.
|
||||
Hash() protocol.Hash // Cached hash of the envelope to avoid rehashing every time.
|
||||
Bloom() []byte
|
||||
}
|
||||
|
||||
|
@ -50,15 +50,15 @@ const (
|
|||
// EnvelopeEvent used for envelopes events.
|
||||
type EnvelopeEvent struct {
|
||||
Event EventType
|
||||
Hash statusproto.Hash
|
||||
Batch statusproto.Hash
|
||||
Hash protocol.Hash
|
||||
Batch protocol.Hash
|
||||
Peer EnodeID
|
||||
Data interface{}
|
||||
}
|
||||
|
||||
// EnvelopeError code and optional description of the error.
|
||||
type EnvelopeError struct {
|
||||
Hash statusproto.Hash
|
||||
Hash protocol.Hash
|
||||
Code uint
|
||||
Description string
|
||||
}
|
||||
|
|
|
@ -5,21 +5,21 @@ package whispertypes
|
|||
import (
|
||||
"encoding/json"
|
||||
|
||||
statusproto "github.com/status-im/status-go/protocol/types"
|
||||
protocol "github.com/status-im/status-go/protocol/types"
|
||||
)
|
||||
|
||||
// MarshalJSON marshals type Message to a json string
|
||||
func (m Message) MarshalJSON() ([]byte, error) {
|
||||
type Message struct {
|
||||
Sig statusproto.HexBytes `json:"sig,omitempty"`
|
||||
TTL uint32 `json:"ttl"`
|
||||
Timestamp uint32 `json:"timestamp"`
|
||||
Topic TopicType `json:"topic"`
|
||||
Payload statusproto.HexBytes `json:"payload"`
|
||||
Padding statusproto.HexBytes `json:"padding"`
|
||||
PoW float64 `json:"pow"`
|
||||
Hash statusproto.HexBytes `json:"hash"`
|
||||
Dst statusproto.HexBytes `json:"recipientPublicKey,omitempty"`
|
||||
Sig protocol.HexBytes `json:"sig,omitempty"`
|
||||
TTL uint32 `json:"ttl"`
|
||||
Timestamp uint32 `json:"timestamp"`
|
||||
Topic TopicType `json:"topic"`
|
||||
Payload protocol.HexBytes `json:"payload"`
|
||||
Padding protocol.HexBytes `json:"padding"`
|
||||
PoW float64 `json:"pow"`
|
||||
Hash protocol.HexBytes `json:"hash"`
|
||||
Dst protocol.HexBytes `json:"recipientPublicKey,omitempty"`
|
||||
}
|
||||
var enc Message
|
||||
enc.Sig = m.Sig
|
||||
|
@ -37,15 +37,15 @@ func (m Message) MarshalJSON() ([]byte, error) {
|
|||
// UnmarshalJSON unmarshals type Message to a json string
|
||||
func (m *Message) UnmarshalJSON(input []byte) error {
|
||||
type Message struct {
|
||||
Sig *statusproto.HexBytes `json:"sig,omitempty"`
|
||||
TTL *uint32 `json:"ttl"`
|
||||
Timestamp *uint32 `json:"timestamp"`
|
||||
Topic *TopicType `json:"topic"`
|
||||
Payload *statusproto.HexBytes `json:"payload"`
|
||||
Padding *statusproto.HexBytes `json:"padding"`
|
||||
PoW *float64 `json:"pow"`
|
||||
Hash *statusproto.HexBytes `json:"hash"`
|
||||
Dst *statusproto.HexBytes `json:"recipientPublicKey,omitempty"`
|
||||
Sig *protocol.HexBytes `json:"sig,omitempty"`
|
||||
TTL *uint32 `json:"ttl"`
|
||||
Timestamp *uint32 `json:"timestamp"`
|
||||
Topic *TopicType `json:"topic"`
|
||||
Payload *protocol.HexBytes `json:"payload"`
|
||||
Padding *protocol.HexBytes `json:"padding"`
|
||||
PoW *float64 `json:"pow"`
|
||||
Hash *protocol.HexBytes `json:"hash"`
|
||||
Dst *protocol.HexBytes `json:"recipientPublicKey,omitempty"`
|
||||
}
|
||||
var dec Message
|
||||
if err := json.Unmarshal(input, &dec); err != nil {
|
||||
|
|
4
vendor/github.com/status-im/status-go/protocol/transport/whisper/types/mailserver.go
generated
vendored
4
vendor/github.com/status-im/status-go/protocol/transport/whisper/types/mailserver.go
generated
vendored
|
@ -3,7 +3,7 @@ package whispertypes
|
|||
import (
|
||||
"time"
|
||||
|
||||
statusproto "github.com/status-im/status-go/protocol/types"
|
||||
protocol "github.com/status-im/status-go/protocol/types"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -49,7 +49,7 @@ func (r *MessagesRequest) SetDefaults(now time.Time) {
|
|||
|
||||
// MailServerResponse is the response payload sent by the mailserver.
|
||||
type MailServerResponse struct {
|
||||
LastEnvelopeHash statusproto.Hash
|
||||
LastEnvelopeHash protocol.Hash
|
||||
Cursor []byte
|
||||
Error error
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ package whispertypes
|
|||
import (
|
||||
"context"
|
||||
|
||||
statusproto "github.com/status-im/status-go/protocol/types"
|
||||
protocol "github.com/status-im/status-go/protocol/types"
|
||||
)
|
||||
|
||||
// NewMessage represents a new whisper message that is posted through the RPC.
|
||||
|
@ -48,7 +48,7 @@ type Criteria struct {
|
|||
// use publicly without security implications.
|
||||
type PublicWhisperAPI interface {
|
||||
// AddPrivateKey imports the given private key.
|
||||
AddPrivateKey(ctx context.Context, privateKey statusproto.HexBytes) (string, error)
|
||||
AddPrivateKey(ctx context.Context, privateKey protocol.HexBytes) (string, error)
|
||||
// GenerateSymKeyFromPassword derives a key from the given password, stores it, and returns its ID.
|
||||
GenerateSymKeyFromPassword(ctx context.Context, passwd string) (string, error)
|
||||
// DeleteKeyPair removes the key with the given key if it exists.
|
||||
|
|
6
vendor/github.com/status-im/status-go/protocol/transport/whisper/types/topic.go
generated
vendored
6
vendor/github.com/status-im/status-go/protocol/transport/whisper/types/topic.go
generated
vendored
|
@ -2,7 +2,7 @@ package whispertypes
|
|||
|
||||
import (
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
statusproto "github.com/status-im/status-go/protocol/types"
|
||||
protocol "github.com/status-im/status-go/protocol/types"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -32,12 +32,12 @@ func BytesToTopic(b []byte) (t TopicType) {
|
|||
|
||||
// String converts a topic byte array to a string representation.
|
||||
func (t *TopicType) String() string {
|
||||
return statusproto.EncodeHex(t[:])
|
||||
return protocol.EncodeHex(t[:])
|
||||
}
|
||||
|
||||
// MarshalText returns the hex representation of t.
|
||||
func (t TopicType) MarshalText() ([]byte, error) {
|
||||
return statusproto.HexBytes(t[:]).MarshalText()
|
||||
return protocol.HexBytes(t[:]).MarshalText()
|
||||
}
|
||||
|
||||
// UnmarshalText parses a hex representation to a topic.
|
||||
|
|
4
vendor/github.com/status-im/status-go/protocol/transport/whisper/whisper_service.go
generated
vendored
4
vendor/github.com/status-im/status-go/protocol/transport/whisper/whisper_service.go
generated
vendored
|
@ -12,7 +12,7 @@ import (
|
|||
"go.uber.org/zap"
|
||||
|
||||
whispertypes "github.com/status-im/status-go/protocol/transport/whisper/types"
|
||||
statusproto "github.com/status-im/status-go/protocol/types"
|
||||
protocol "github.com/status-im/status-go/protocol/types"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -372,7 +372,7 @@ func (a *WhisperServiceTransport) addSig(newMessage *whispertypes.NewMessage) er
|
|||
|
||||
func (a *WhisperServiceTransport) Track(identifiers [][]byte, hash []byte, newMessage *whispertypes.NewMessage) {
|
||||
if a.envelopesMonitor != nil {
|
||||
a.envelopesMonitor.Add(identifiers, statusproto.BytesToHash(hash), *newMessage)
|
||||
a.envelopesMonitor.Add(identifiers, protocol.BytesToHash(hash), *newMessage)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
# v1 statusproto package folder
|
||||
# v1 protocol package folder
|
||||
|
||||
This folder contains only data types mentioned in the specification and required for its implementation.
|
||||
|
|
10
vendor/github.com/status-im/status-go/protocol/v1/membership_update_message.go
generated
vendored
10
vendor/github.com/status-im/status-go/protocol/v1/membership_update_message.go
generated
vendored
|
@ -15,7 +15,7 @@ import (
|
|||
"github.com/google/uuid"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/status-im/status-go/protocol/crypto"
|
||||
statusproto "github.com/status-im/status-go/protocol/types"
|
||||
protocol "github.com/status-im/status-go/protocol/types"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -94,7 +94,7 @@ func (u *MembershipUpdate) extractFrom() error {
|
|||
if err != nil {
|
||||
return errors.Wrap(err, "failed to extract signature")
|
||||
}
|
||||
u.From = statusproto.EncodeHex(gethcrypto.FromECDSAPub(publicKey))
|
||||
u.From = protocol.EncodeHex(gethcrypto.FromECDSAPub(publicKey))
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -282,7 +282,7 @@ type Group struct {
|
|||
}
|
||||
|
||||
func groupChatID(creator *ecdsa.PublicKey) string {
|
||||
return uuid.New().String() + "-" + statusproto.EncodeHex(gethcrypto.FromECDSAPub(creator))
|
||||
return uuid.New().String() + "-" + protocol.EncodeHex(gethcrypto.FromECDSAPub(creator))
|
||||
}
|
||||
|
||||
func NewGroupWithMembershipUpdates(chatID string, updates []MembershipUpdate) (*Group, error) {
|
||||
|
@ -396,7 +396,7 @@ func (g *Group) ProcessEvents(from *ecdsa.PublicKey, events []MembershipUpdateEv
|
|||
}
|
||||
|
||||
func (g *Group) ProcessEvent(from *ecdsa.PublicKey, event MembershipUpdateEvent) error {
|
||||
fromHex := statusproto.EncodeHex(gethcrypto.FromECDSAPub(from))
|
||||
fromHex := protocol.EncodeHex(gethcrypto.FromECDSAPub(from))
|
||||
if !g.validateEvent(fromHex, event) {
|
||||
return fmt.Errorf("invalid event %#+v from %s", event, from)
|
||||
}
|
||||
|
@ -523,7 +523,7 @@ func stringSliceEquals(slice1, slice2 []string) bool {
|
|||
}
|
||||
|
||||
func publicKeyToString(publicKey *ecdsa.PublicKey) string {
|
||||
return statusproto.EncodeHex(gethcrypto.FromECDSAPub(publicKey))
|
||||
return protocol.EncodeHex(gethcrypto.FromECDSAPub(publicKey))
|
||||
}
|
||||
|
||||
type stringSet struct {
|
||||
|
|
|
@ -11,7 +11,7 @@ import (
|
|||
"github.com/ethereum/go-ethereum/crypto"
|
||||
"github.com/golang/protobuf/proto"
|
||||
"github.com/pkg/errors"
|
||||
statusproto "github.com/status-im/status-go/protocol/types"
|
||||
protocol "github.com/status-im/status-go/protocol/types"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -146,7 +146,7 @@ func EncodeMessage(value Message) ([]byte, error) {
|
|||
|
||||
// MessageID calculates the messageID from author's compressed public key
|
||||
// and not encrypted but encoded payload.
|
||||
func MessageID(author *ecdsa.PublicKey, data []byte) statusproto.HexBytes {
|
||||
func MessageID(author *ecdsa.PublicKey, data []byte) protocol.HexBytes {
|
||||
keyBytes := crypto.FromECDSAPub(author)
|
||||
return crypto.Keccak256(append(keyBytes, data...))
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ func (m *StatusProtocolMessage) GetPayload() []byte {
|
|||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*StatusProtocolMessage)(nil), "statusproto.StatusProtocolMessage")
|
||||
proto.RegisterType((*StatusProtocolMessage)(nil), "protocol.StatusProtocolMessage")
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("message.proto", fileDescriptor_33c57e4bae7b9afd) }
|
||||
|
|
|
@ -12,7 +12,7 @@ import (
|
|||
"github.com/status-im/status-go/protocol/datasync"
|
||||
"github.com/status-im/status-go/protocol/encryption"
|
||||
whispertypes "github.com/status-im/status-go/protocol/transport/whisper/types"
|
||||
statusproto "github.com/status-im/status-go/protocol/types"
|
||||
protocol "github.com/status-im/status-go/protocol/types"
|
||||
)
|
||||
|
||||
type StatusMessageT int
|
||||
|
@ -38,7 +38,7 @@ type StatusMessage struct {
|
|||
DecryptedPayload []byte
|
||||
|
||||
// ID is the canonical ID of the message
|
||||
ID statusproto.HexBytes
|
||||
ID protocol.HexBytes
|
||||
// Hash is the transport layer hash
|
||||
Hash []byte
|
||||
|
||||
|
|
Loading…
Reference in New Issue