diff --git a/.golangci.yml b/.golangci.yml index 48628e03f..1707bdbfb 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -11,6 +11,8 @@ run: - bindata.go - .*_mock.go - contracts/ + - eth-node/crypto/ecies/ # copied + - eth-node/keystore/ # copied output: format: colored-line-number @@ -29,8 +31,6 @@ linters-settings: simplify: true goimports: local-prefixes: github.com/ethereum/go-ethereum,github.com/status-im/status-go - gocyclo: - min-complexity: 16 maligned: suggest-new: true dupl: @@ -46,7 +46,6 @@ linters: - errcheck - gosec - goconst - - gocyclo - goimports - golint - govet @@ -65,3 +64,16 @@ issues: - "G304: Potential file inclusion via variable" # gosec - "G104: Errors unhandled." #gosec - "lib._Ctype_char, which can be annoying to use" # golint + exclude-rules: + - path: eth-node/keystore/passphrase\.go + text: "make it a constant" + linters: + - goconst + - path: protocol/message_handler\.go + text: "make it a constant" + linters: + - goconst + - path: protocol/.*_test\.go + text: "make it a constant" + linters: + - goconst diff --git a/account/accounts.go b/account/accounts.go index 8e11315f4..4109fc301 100644 --- a/account/accounts.go +++ b/account/accounts.go @@ -205,7 +205,7 @@ func (m *Manager) SetChatAccount(privKey *ecdsa.PrivateKey) { address := crypto.PubkeyToAddress(privKey.PublicKey) id := uuid.NewRandom() key := &types.Key{ - Id: id, + ID: id, Address: address, PrivateKey: privKey, } diff --git a/cmd/bootnode/main.go b/cmd/bootnode/main.go index d113c6996..9065c1298 100644 --- a/cmd/bootnode/main.go +++ b/cmd/bootnode/main.go @@ -43,7 +43,7 @@ func (f *bootnodes) Set(value string) error { return nil } -func main() { // nolint: gocyclo +func main() { flag.Var(&nursery, "n", "These nodes are used to connect to the network if the table is empty and there are no known nodes in the database.") flag.Parse() diff --git a/cmd/statusd/main.go b/cmd/statusd/main.go index 752b83ef2..855a01885 100644 --- a/cmd/statusd/main.go +++ b/cmd/statusd/main.go @@ -283,7 +283,7 @@ func printVersion(config *params.NodeConfig, buildStamp string) { fmt.Println("Build Stamp:", buildStamp) } - fmt.Println("Network Id:", config.NetworkID) + fmt.Println("Network ID:", config.NetworkID) fmt.Println("Go Version:", runtime.Version()) fmt.Println("OS:", runtime.GOOS) fmt.Printf("GOPATH=%s\n", os.Getenv("GOPATH")) diff --git a/eth-node/bridge/geth/ens/ens.go b/eth-node/bridge/geth/ens/ens.go index ef6196c48..69461d29a 100644 --- a/eth-node/bridge/geth/ens/ens.go +++ b/eth-node/bridge/geth/ens/ens.go @@ -21,16 +21,16 @@ const ( contractQueryTimeout = 5000 * time.Millisecond ) -type ENSVerifier struct { +type Verifier struct { logger *zap.Logger } -// NewVerifier returns a ENSVerifier attached to the specified logger -func NewVerifier(logger *zap.Logger) *ENSVerifier { - return &ENSVerifier{logger: logger} +// NewVerifier returns a Verifier attached to the specified logger +func NewVerifier(logger *zap.Logger) *Verifier { + return &Verifier{logger: logger} } -func (m *ENSVerifier) verifyENSName(ensInfo enstypes.ENSDetails, ethclient *ethclient.Client) enstypes.ENSResponse { +func (m *Verifier) verifyENSName(ensInfo enstypes.ENSDetails, ethclient *ethclient.Client) enstypes.ENSResponse { publicKeyStr := ensInfo.PublicKeyString ensName := ensInfo.Name m.logger.Info("Resolving ENS name", zap.String("name", ensName), zap.String("publicKey", publicKeyStr)) @@ -75,7 +75,7 @@ func (m *ENSVerifier) verifyENSName(ensInfo enstypes.ENSDetails, ethclient *ethc } // CheckBatch verifies that a registered ENS name matches the expected public key -func (m *ENSVerifier) CheckBatch(ensDetails []enstypes.ENSDetails, rpcEndpoint, contractAddress string) (map[string]enstypes.ENSResponse, error) { +func (m *Verifier) CheckBatch(ensDetails []enstypes.ENSDetails, rpcEndpoint, contractAddress string) (map[string]enstypes.ENSResponse, error) { ctx, cancel := context.WithTimeout(context.Background(), contractQueryTimeout) defer cancel() diff --git a/eth-node/bridge/geth/keystore.go b/eth-node/bridge/geth/keystore.go index 85cd4e92f..a71a5541b 100644 --- a/eth-node/bridge/geth/keystore.go +++ b/eth-node/bridge/geth/keystore.go @@ -94,7 +94,7 @@ func keyFrom(k *keystore.Key) *types.Key { } return &types.Key{ - Id: k.Id, + ID: k.Id, Address: types.Address(k.Address), PrivateKey: k.PrivateKey, ExtendedKey: k.ExtendedKey, diff --git a/eth-node/bridge/nimbus/keystore.go b/eth-node/bridge/nimbus/keystore.go index 43ac4d3b0..e03028535 100644 --- a/eth-node/bridge/nimbus/keystore.go +++ b/eth-node/bridge/nimbus/keystore.go @@ -192,7 +192,7 @@ func keyFrom(k *C.key) (*types.Key, error) { var err error key := types.Key{ - Id: uuid.Parse(C.GoString(&k.id[0])), + ID: uuid.Parse(C.GoString(&k.id[0])), } key.Address = types.BytesToAddress(C.GoBytes(unsafe.Pointer(&k.address[0]), C.ADDRESS_LEN)) key.PrivateKey, err = crypto.ToECDSA(C.GoBytes(unsafe.Pointer(&k.privateKeyID[0]), C.PRIVKEY_LEN)) diff --git a/eth-node/crypto/crypto.go b/eth-node/crypto/crypto.go index 3027be25c..33cc6036b 100644 --- a/eth-node/crypto/crypto.go +++ b/eth-node/crypto/crypto.go @@ -220,7 +220,7 @@ func TextHash(data []byte) []byte { func TextAndHash(data []byte) ([]byte, string) { msg := fmt.Sprintf("\x19Ethereum Signed Message:\n%d%s", len(data), string(data)) hasher := sha3.NewLegacyKeccak256() - hasher.Write([]byte(msg)) + _, _ = hasher.Write([]byte(msg)) return hasher.Sum(nil), msg } diff --git a/eth-node/crypto/gethcrypto.go b/eth-node/crypto/gethcrypto.go index f87982965..d453a5b4a 100644 --- a/eth-node/crypto/gethcrypto.go +++ b/eth-node/crypto/gethcrypto.go @@ -47,8 +47,7 @@ const RecoveryIDOffset = 64 const DigestLength = 32 var ( - secp256k1N, _ = new(big.Int).SetString("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141", 16) - secp256k1halfN = new(big.Int).Div(secp256k1N, big.NewInt(2)) + secp256k1N, _ = new(big.Int).SetString("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141", 16) ) var errInvalidPubkey = errors.New("invalid secp256k1 public key") @@ -57,7 +56,7 @@ var errInvalidPubkey = errors.New("invalid secp256k1 public key") func Keccak256(data ...[]byte) []byte { d := sha3.NewLegacyKeccak256() for _, b := range data { - d.Write(b) + _, _ = d.Write(b) } return d.Sum(nil) } @@ -67,7 +66,7 @@ func Keccak256(data ...[]byte) []byte { func Keccak256Hash(data ...[]byte) (h types.Hash) { d := sha3.NewLegacyKeccak256() for _, b := range data { - d.Write(b) + _, _ = d.Write(b) } d.Sum(h[:0]) return h @@ -77,7 +76,7 @@ func Keccak256Hash(data ...[]byte) (h types.Hash) { func Keccak512(data ...[]byte) []byte { d := sha3.NewLegacyKeccak512() for _, b := range data { - d.Write(b) + _, _ = d.Write(b) } return d.Sum(nil) } @@ -202,12 +201,6 @@ func PubkeyToAddress(p ecdsa.PublicKey) types.Address { return types.BytesToAddress(Keccak256(pubBytes[1:])[12:]) } -func zeroBytes(bytes []byte) { - for i := range bytes { - bytes[i] = 0 - } -} - // Ecrecover returns the uncompressed public key that created the given signature. func Ecrecover(hash, sig []byte) ([]byte, error) { return secp256k1.RecoverPubkey(hash, sig) diff --git a/eth-node/go.mod b/eth-node/go.mod deleted file mode 100644 index 770aa0f4f..000000000 --- a/eth-node/go.mod +++ /dev/null @@ -1,26 +0,0 @@ -module github.com/status-im/status-go/eth-node - -go 1.13 - -replace github.com/ethereum/go-ethereum v1.9.5 => github.com/status-im/go-ethereum v1.9.5-status.7 - -replace github.com/status-im/status-go/extkeys => ../extkeys - -replace github.com/status-im/status-go/whisper/v6 => ../whisper - -replace github.com/status-im/status-go/waku => ../waku - -require ( - github.com/btcsuite/btcd v0.20.1-beta - github.com/ethereum/go-ethereum v1.9.5 - github.com/mattn/go-pointer v0.0.0-20190911064623-a0a44394634f - github.com/pborman/uuid v1.2.0 - github.com/status-im/doubleratchet v3.0.0+incompatible - github.com/status-im/status-go/extkeys v1.0.0 - github.com/status-im/status-go/waku v1.0.0 - github.com/status-im/status-go/whisper/v6 v6.0.1 - github.com/stretchr/testify v1.4.0 - github.com/wealdtech/go-ens/v3 v3.0.9 - go.uber.org/zap v1.13.0 - golang.org/x/crypto v0.0.0-20191122220453-ac88ee75c92c -) diff --git a/eth-node/go.sum b/eth-node/go.sum deleted file mode 100644 index c5823f8b7..000000000 --- a/eth-node/go.sum +++ /dev/null @@ -1,430 +0,0 @@ -bazil.org/fuse v0.0.0-20160811212531-371fbbdaa898/go.mod h1:Xbm+BRKSBEpa4q4hTSxohYNQpsxXPbPry4JJWOB3LB8= -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -github.com/Azure/azure-pipeline-go v0.0.0-20180607212504-7571e8eb0876/go.mod h1:XA1kFWRVhSK+KNFiOhfv83Fv8L9achrP7OxIzeTn1Yg= -github.com/Azure/azure-storage-blob-go v0.0.0-20180712005634-eaae161d9d5e/go.mod h1:x2mtS6O3mnMEZOJp7d7oldh8IvatBrMfReiyQ+cKgKY= -github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/DataDog/zstd v1.3.6-0.20190409195224-796139022798/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= -github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= -github.com/Shopify/sarama v1.23.1/go.mod h1:XLH1GYJnLVE0XCr6KdJGVJRTwY30moWNJ4sERjXX6fs= -github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= -github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= -github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/allegro/bigcache v0.0.0-20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= -github.com/allegro/bigcache v1.1.0 h1:MLuIKTjdxDc+qsG2rhjsYjsHQC5LUGjIWzutg7M+W68= -github.com/allegro/bigcache v1.1.0/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= -github.com/allegro/bigcache v1.2.0 h1:qDaE0QoF29wKBb3+pXFrJFy1ihe5OT9OiXhg1t85SxM= -github.com/allegro/bigcache v1.2.0/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= -github.com/apilayer/freegeoip v3.5.0+incompatible/go.mod h1:CUfFqErhFhXneJendyQ/rRcuA8kH8JxHvYnbOozmlCU= -github.com/aristanetworks/fsnotify v1.4.2/go.mod h1:D/rtu7LpjYM8tRJphJ0hUBYpjai8SfX+aSNsWDTq/Ks= -github.com/aristanetworks/glog v0.0.0-20180419172825-c15b03b3054f/go.mod h1:KASm+qXFKs/xjSoWn30NrWBBvdTTQq+UjkhjEJHfSFA= -github.com/aristanetworks/goarista v0.0.0-20170210015632-ea17b1a17847/go.mod h1:D/tb0zPVXnP7fmsLZjtdUhSsumbK/ij54UXjjVgMGxQ= -github.com/aristanetworks/goarista v0.0.0-20181002214814-33151c4543a7 h1:6TQIK3K21/HnYLp+TAI6fjQ1YeH+KgLZbrFJwUjVrnQ= -github.com/aristanetworks/goarista v0.0.0-20181002214814-33151c4543a7/go.mod h1:D/tb0zPVXnP7fmsLZjtdUhSsumbK/ij54UXjjVgMGxQ= -github.com/aristanetworks/goarista v0.0.0-20190219163901-728bce664cf5 h1:L0TwgZQo7Mga9im6FvKEZGIvyLE/VG/HI5loz5LpvC0= -github.com/aristanetworks/goarista v0.0.0-20190219163901-728bce664cf5/go.mod h1:D/tb0zPVXnP7fmsLZjtdUhSsumbK/ij54UXjjVgMGxQ= -github.com/aristanetworks/goarista v0.0.0-20191106175434-873d404c7f40 h1:ZdRuixFqR3mfx4FHzclG3COrRgWrYq0VhNgIoYoObcM= -github.com/aristanetworks/goarista v0.0.0-20191106175434-873d404c7f40/go.mod h1:Z4RTxGAuYhPzcq8+EdRM+R8M48Ssle2TsWtwRKa+vns= -github.com/aristanetworks/splunk-hec-go v0.3.3/go.mod h1:1VHO9r17b0K7WmOlLb9nTk/2YanvOEnLMUgsFrxBROc= -github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= -github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= -github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= -github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= -github.com/btcsuite/btcd v0.0.0-20181013004428-67e573d211ac/go.mod h1:Dmm/EzmjnCiweXmzRIAiUWCInVmPgjkzgv5k4tVyXiQ= -github.com/btcsuite/btcd v0.0.0-20190418232430-6867ff32788a/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8= -github.com/btcsuite/btcd v0.20.0-beta h1:DnZGUjFbRkpytojHWwy6nfUSA7vFrzWXDLpFNzt74ZA= -github.com/btcsuite/btcd v0.20.0-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= -github.com/btcsuite/btcd v0.20.1-beta h1:Ik4hyJqN8Jfyv3S4AGBOmyouMsYE3EdYODkMbQjwPGw= -github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= -github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= -github.com/btcsuite/btcutil v0.0.0-20190207003914-4c204d697803/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= -github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d h1:yJzD/yFppdVCf6ApMkVy8cUxV0XrxdP9rVf6D87/Mng= -github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= -github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= -github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= -github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= -github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= -github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= -github.com/cespare/cp v0.1.0/go.mod h1:SOGHArjBr4JWaSDEVpWpo/hNg6RoKrls6Oh40hiwW+s= -github.com/cespare/cp v1.1.1 h1:nCb6ZLdB7NRaqsm91JtQTAme2SKJzXVsdPIPkyJr1MU= -github.com/cespare/cp v1.1.1/go.mod h1:SOGHArjBr4JWaSDEVpWpo/hNg6RoKrls6Oh40hiwW+s= -github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= -github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= -github.com/cespare/xxhash/v2 v2.1.0 h1:yTUvW7Vhb89inJ+8irsUqiWjh8iT6sQPZiQzI6ReGkA= -github.com/cespare/xxhash/v2 v2.1.0/go.mod h1:dgIUBU3pDso/gPgZ1osOZ0iQf77oPR28Tjxl5dIMyVM= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= -github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/deckarep/golang-set v0.0.0-20180603214616-504e848d77ea/go.mod h1:93vsz/8Wt4joVM7c2AVqh+YRMiUSc14yDtF28KmMOgQ= -github.com/deckarep/golang-set v1.7.1 h1:SCQV0S6gTtp6itiFrTqI+pfmJ4LN85S1YzhDf9rTHJQ= -github.com/deckarep/golang-set v1.7.1/go.mod h1:93vsz/8Wt4joVM7c2AVqh+YRMiUSc14yDtF28KmMOgQ= -github.com/dgrijalva/jwt-go v0.0.0-20170201225849-2268707a8f08/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= -github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= -github.com/docker/docker v0.0.0-20180625184442-8e610b2b55bf/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= -github.com/docker/docker v1.13.1/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= -github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= -github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= -github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= -github.com/edsrzf/mmap-go v0.0.0-20160512033002-935e0e8a636c/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= -github.com/edsrzf/mmap-go v1.0.0 h1:CEBF7HpRnUCSJgGUb5h1Gm7e3VkmVDrR8lvWVLtrOFw= -github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= -github.com/elastic/gosigar v0.0.0-20180330100440-37f05ff46ffa/go.mod h1:cdorVVzy1fhmEqmtgqkoE3bYtCfSCkVyjTyCIo22xvs= -github.com/elastic/gosigar v0.10.4 h1:6jfw75dsoflhBMRdO6QPzQUgLqUYTsQQQRkkcsHsuPo= -github.com/elastic/gosigar v0.10.4/go.mod h1:cdorVVzy1fhmEqmtgqkoE3bYtCfSCkVyjTyCIo22xvs= -github.com/elastic/gosigar v0.10.5 h1:GzPQ+78RaAb4J63unidA/JavQRKrB6s8IOzN6Ib59jo= -github.com/elastic/gosigar v0.10.5/go.mod h1:cdorVVzy1fhmEqmtgqkoE3bYtCfSCkVyjTyCIo22xvs= -github.com/ethereum/go-ethereum v1.9.2/go.mod h1:PwpWDrCLZrV+tfrhqqF6kPknbISMHaJv9Ln3kPCZLwY= -github.com/fatih/color v1.3.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= -github.com/fjl/memsize v0.0.0-20180418122429-ca190fb6ffbc/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0= -github.com/fjl/memsize v0.0.0-20180929194037-2a09253e352a h1:1znxn4+q2MrEdTk1eCk6KIV3muTYVclBIB6CTVR/zBc= -github.com/fjl/memsize v0.0.0-20180929194037-2a09253e352a/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0= -github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/garyburd/redigo v1.6.0/go.mod h1:NR3MbYisc3/PwhQ00EMzDiPmrwpPxAn5GI05/YaO1SY= -github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff h1:tY80oXqGNY4FhTFhk+o9oFHGINQ/+vhlm8HFzi6znCI= -github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= -github.com/gizak/termui v0.0.0-20170117222342-991cd3d38091/go.mod h1:PkJoWUt/zacQKysNfQtcw1RW+eK2SxkieVBtl+4ovLA= -github.com/go-kit/kit v0.8.0 h1:Wz+5lgoB0kkuqLEc6NVmwRknTKP6dTGbSqvhZtBI/j0= -github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-logfmt/logfmt v0.3.0 h1:8HUsc87TaSWLKwrnumgC8/YconD2fJQsRJAsWaPg2ic= -github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= -github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= -github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8= -github.com/go-stack/stack v1.5.4/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= -github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.1 h1:YF8+flBXS5eO826T4nzqPrxfhQThhXl0YzfuUPu4SBg= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/snappy v0.0.0-20170215233205-553a64147049/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db h1:woRePGFeVFfLKN/pOkfl+p/TAqKOfFu+7KPlMVpok/w= -github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4= -github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/uuid v1.0.0 h1:b4Gk+7WdP/d3HZH8EJsZpvV7EtDOgaZLtnaNGIu1adA= -github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/gorilla/websocket v1.4.1 h1:q7AeDBpnBk8AogcD4DSag/Ukw/KV+YhzLj2bP5HvKCM= -github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/graph-gophers/graphql-go v0.0.0-20190724201507-010347b5f9e6/go.mod h1:Au3iQ8DvDis8hZ4q2OzRcaKYlAsPt+fYvib5q4nIqu4= -github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/golang-lru v0.0.0-20160813221303-0a025b7e63ad/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.5.1 h1:0hERBMJE1eitiLkihrMvRVBYAkpHzc/J3QdDN+dAcgU= -github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/howeyc/fsnotify v0.9.0/go.mod h1:41HzSPxBGeFRQKEEwgh49TRw/nKBsYZ2cF1OzPjSJsA= -github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/huin/goupnp v0.0.0-20161224104101-679507af18f3/go.mod h1:MZ2ZmwcBpvOoJ22IJsc7va19ZwoheaBk43rKg12SKag= -github.com/huin/goupnp v1.0.0 h1:wg75sLpL6DZqwHQN6E1Cfk6mtfzS45z8OV+ic+DtHRo= -github.com/huin/goupnp v1.0.0/go.mod h1:n9v9KO1tAxYH82qOn+UTIFQDmx5n1Zxd/ClZDMX7Bnc= -github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150/go.mod h1:PpLOETDnJ0o3iZrZfqZzyLl6l7F3c6L1oWn7OICBi6o= -github.com/influxdata/influxdb v0.0.0-20180221223340-01288bdb0883/go.mod h1:qZna6X/4elxqT3yI9iZYdZrWWdeFOOprn86kgg4+IzY= -github.com/influxdata/influxdb v1.7.7/go.mod h1:qZna6X/4elxqT3yI9iZYdZrWWdeFOOprn86kgg4+IzY= -github.com/influxdata/influxdb1-client v0.0.0-20190809212627-fc22c7df067e/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= -github.com/jackpal/go-nat-pmp v0.0.0-20160603034137-1fa385a6f458/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= -github.com/jackpal/go-nat-pmp v1.0.1 h1:i0LektDkO1QlrTm/cSuP+PyBCDnYvjPLGl4LdWEMiaA= -github.com/jackpal/go-nat-pmp v1.0.1/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= -github.com/jackpal/go-nat-pmp v1.0.2 h1:KzKSgb7qkJvOUTqYl9/Hg/me3pWgBmERKrTGD7BdWus= -github.com/jackpal/go-nat-pmp v1.0.2/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= -github.com/jcmturner/gofork v0.0.0-20190328161633-dc7c13fece03/go.mod h1:MK8+TM0La+2rjBD4jE12Kj1pCCxK7d2LK/UM3ncEo0o= -github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= -github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= -github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/julienschmidt/httprouter v0.0.0-20170430222011-975b5c4c7c21/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/karalabe/hid v0.0.0-20181128192157-d815e0c1a2e2/go.mod h1:YvbcH+3Wo6XPs9nkgTY3u19KXLauXW+J5nB7hEHuX0A= -github.com/karalabe/usb v0.0.0-20190819132248-550797b1cad8 h1:VhnqxaTIudc9IWKx8uXRLnpdSb9noCEj+vHacjmhp68= -github.com/karalabe/usb v0.0.0-20190819132248-550797b1cad8/go.mod h1:Od972xHfMJowv7NGVDiWVxk2zxnWgjLlJzE+F4F7AGU= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= -github.com/klauspost/cpuid v1.2.1/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= -github.com/klauspost/reedsolomon v1.9.2/go.mod h1:CwCi+NUr9pqSVktrkN+Ondf06rkhYZ/pcNv7fu+8Un4= -github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515 h1:T+h1c/A9Gawja4Y9mFVWj2vyii2bbUNDw3kt9VxK2EY= -github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/maruel/panicparse v0.0.0-20160720141634-ad661195ed0e/go.mod h1:nty42YY5QByNC5MM7q/nj938VbgPU7avs45z6NClpxI= -github.com/mattn/go-colorable v0.1.0/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= -github.com/mattn/go-colorable v0.1.1 h1:G1f5SKeVxmagw/IyvzvtZE4Gybcc4Tr1tf7I8z0XgOg= -github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= -github.com/mattn/go-isatty v0.0.0-20180830101745-3fb116b82035/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/mattn/go-isatty v0.0.7 h1:UvyT9uN+3r7yLEYSlJsbQGdsaB/a0DlgWP3pql6iwOc= -github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/mattn/go-pointer v0.0.0-20190911064623-a0a44394634f h1:QTRRO+ozoYgT3CQRIzNVYJRU3DB8HRnkZv6mr4ISmMA= -github.com/mattn/go-pointer v0.0.0-20190911064623-a0a44394634f/go.mod h1:2zXcozF6qYGgmsG+SeTZz3oAbFLdD3OWqnUbNvJZAlc= -github.com/mattn/go-runewidth v0.0.3/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= -github.com/mattn/go-runewidth v0.0.4 h1:2BvfKmzob6Bmd4YsL0zygOqfdFnK7GR4QL06Do4/p7Y= -github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= -github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= -github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= -github.com/minio/sha256-simd v0.0.0-20190328051042-05b4dd3047e5 h1:l16XLUUJ34wIz+RIvLhSwGvLvKyy+W598b135bJN6mg= -github.com/minio/sha256-simd v0.0.0-20190328051042-05b4dd3047e5/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= -github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8= -github.com/mr-tron/base58 v1.1.2 h1:ZEw4I2EgPKDJ2iEw0cNmLB3ROrEmkOtXIkaG7wZg+78= -github.com/mr-tron/base58 v1.1.2/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= -github.com/multiformats/go-multihash v0.0.5 h1:1wxmCvTXAifAepIMyF39vZinRw5sbqjPs/UIi93+uik= -github.com/multiformats/go-multihash v0.0.5/go.mod h1:lt/HCbqlQwlPBz7lv0sQCdtfcMtlJvakRUn/0Ual8po= -github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/naoina/toml v0.0.0-20170918210437-9fafd6967416/go.mod h1:NBIhNtsFMo3G2szEBne+bO4gS192HuIYRqfvOWb4i1E= -github.com/nsf/termbox-go v0.0.0-20170211012700-3540b76b9c77/go.mod h1:IuKpRQcYE1Tfu+oAQqaLisqDeXgjyyltCfsaoYN18NQ= -github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= -github.com/olekukonko/tablewriter v0.0.0-20170128050532-febf2d34b54a/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= -github.com/olekukonko/tablewriter v0.0.1 h1:b3iUnf1v+ppJiOfNX4yxxqfWKMQPZR5yoh8urCTFX88= -github.com/olekukonko/tablewriter v0.0.1/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.10.1 h1:q/mM8GF/n0shIN8SaAZ0V+jnLPzen6WIVZdiwrRlMlo= -github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/onsi/gomega v1.7.0 h1:XPnZz8VVBHjVsy1vzJmRwIcSwiUO+JFfrv/xGiigmME= -github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/openconfig/gnmi v0.0.0-20190823184014-89b2bf29312c/go.mod h1:t+O9It+LKzfOAhKTT5O0ehDix+MTqbtT0T9t+7zzOvc= -github.com/openconfig/reference v0.0.0-20190727015836-8dfd928c9696/go.mod h1:ym2A+zigScwkSEb/cVQB0/ZMpU3rqiH6X7WRRsxgOGw= -github.com/opentracing/opentracing-go v0.0.0-20180606204148-bd9c31933947/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/oschwald/maxminddb-golang v1.3.1/go.mod h1:3jhIUymTJ5VREKyIhWm66LJiQt04F0UCDdodShpjWsY= -github.com/pborman/uuid v0.0.0-20170112150404-1b00554d8222/go.mod h1:VyrYX9gd7irzKovcSS6BIIEwPRkP2Wm2m9ufcdFSJ34= -github.com/pborman/uuid v1.2.0 h1:J7Q5mO4ysT1dv8hyrUGHb9+ooztCXu1D8MY8DZYsu3g= -github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= -github.com/peterh/liner v0.0.0-20170902204657-a37ad3984311/go.mod h1:xIteQHvHuaLYG9IFj6mSxM0fCKrs34IrEQUhOYuGPHc= -github.com/pierrec/lz4 v0.0.0-20190327172049-315a67e90e41/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc= -github.com/pkg/errors v0.0.0-20171216070316-e881fd58d78e h1:+RHxT/gm0O3UF7nLJbdNzAmULvCFt4XfXHWzh3XI/zs= -github.com/pkg/errors v0.0.0-20171216070316-e881fd58d78e/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= -github.com/prometheus/client_golang v1.1.0/go.mod h1:I1FGZT9+L76gKKOs5djB6ezCbFQP1xR9D75/vuwEF3g= -github.com/prometheus/client_golang v1.2.1 h1:JnMpQc6ppsNgw9QPAGF6Dod479itz7lvlsMzzNayLOI= -github.com/prometheus/client_golang v1.2.1/go.mod h1:XMU6Z2MjaRKVu/dC1qupJI9SiNkDYzz3xecMgSW/F+U= -github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4 h1:gQz4mCbXsO+nc9n1hCxHcGA3Zx3Eo+UHZoInFGUIXNM= -github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.6.0/go.mod h1:eBmuwkDJBwy6iBfxCBob6t6dR6ENT/y+J+Zk0j9GMYc= -github.com/prometheus/common v0.7.0 h1:L+1lyG48J1zAQXA3RBX/nG/B3gjlHq0zTt2tlbJLyCY= -github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA= -github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= -github.com/prometheus/procfs v0.0.3/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ= -github.com/prometheus/procfs v0.0.5 h1:3+auTFlqw+ZaQYJARz6ArODtkaIwtvBTx3N2NehQlL8= -github.com/prometheus/procfs v0.0.5/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ= -github.com/prometheus/prometheus v0.0.0-20170814170113-3101606756c5/go.mod h1:oAIUtOny2rjMX0OWN5vPR5/q/twIROJvdqnQKDdil/s= -github.com/prometheus/tsdb v0.10.0 h1:If5rVCMTp6W2SiRAQFlbpJNgVlgMEd+U2GZckwK38ic= -github.com/prometheus/tsdb v0.10.0/go.mod h1:oi49uRhEe9dPUTlS3JRZOwJuVi6tmh10QSgwXEyGCt4= -github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= -github.com/rjeczalik/notify v0.9.1/go.mod h1:rKwnCoCGeuQnwBtTSPL9Dad03Vh2n40ePRrjvIXnJho= -github.com/rjeczalik/notify v0.9.2 h1:MiTWrPj55mNDHEiIX5YUSKefw/+lCQVoAFmD6oQm5w8= -github.com/rjeczalik/notify v0.9.2/go.mod h1:aErll2f0sUX9PXZnVNyeiObbmTlk5jnMoCa4QEjJeqM= -github.com/robertkrimen/otto v0.0.0-20170205013659-6a77b7cbc37d/go.mod h1:xvqspoSXJTIpemEonrMDFq6XzwHYYgToXWj5eRX1OtY= -github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rs/cors v0.0.0-20160617231935-a62a804a8a00/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= -github.com/rs/cors v1.6.0 h1:G9tHG9lebljV9mfp9SNPDL36nCDxmo3zTlAf1YgvzmI= -github.com/rs/cors v1.6.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= -github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik= -github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= -github.com/rs/xhandler v0.0.0-20160618193221-ed27b6fd6521/go.mod h1:RvLn4FgxWubrpZHtQLnOf6EwhN2hEMusxZOhcW9H3UQ= -github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= -github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= -github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= -github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= -github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/status-im/doubleratchet v3.0.0+incompatible h1:aJ1ejcSERpSzmWZBgtfYtiU2nF0Q8ZkGyuEPYETXkCY= -github.com/status-im/doubleratchet v3.0.0+incompatible/go.mod h1:1sqR0+yhiM/bd+wrdX79AOt2csZuJOni0nUDzKNuqOU= -github.com/status-im/go-ethereum v1.9.5-status.6 h1:ytuTO1yBIAuTVRtRQoc2mrdyngtP+XOQ9IHIibbz7/I= -github.com/status-im/go-ethereum v1.9.5-status.6/go.mod h1:08JvQWE+IOnAFSe4UD4ACLNe2fDd9XmWMCq5Yzy9mk0= -github.com/status-im/go-ethereum v1.9.5-status.7 h1:DKH1GiF52LwaZaw6YDBliFEgm/JDsbIT+hn7ph6X94Q= -github.com/status-im/go-ethereum v1.9.5-status.7/go.mod h1:YyH5DKB6+z+Vaya7eIm67pnuPZ1oiUMbbsZW41ktN0g= -github.com/status-im/keycard-go v0.0.0-20190424133014-d95853db0f48 h1:ju5UTwk5Odtm4trrY+4Ca4RMj5OyXbmVeDAVad2T0Jw= -github.com/status-im/keycard-go v0.0.0-20190424133014-d95853db0f48/go.mod h1:RZLeN1LMWmRsyYjvAu+I6Dm9QmlDaIIt+Y+4Kd7Tp+Q= -github.com/status-im/status-go v0.36.1 h1:nb9eTq0UQJ57YyTZSl5U05emFT+R4AW8/Bga6ocgOks= -github.com/status-im/whisper v1.5.2 h1:26NgiKusmPic38eQdtXnaY+iaQ/LuQ3Dh0kCGYT/Uxs= -github.com/status-im/whisper v1.5.2/go.mod h1:emrOxzJme0k66QtbbQ2bdd3P8RCdLZ8sTD7SkwH1s2s= -github.com/steakknife/bloomfilter v0.0.0-20180922174646-6819c0d2a570 h1:gIlAHnH1vJb5vwEjIp5kBj/eu99p/bl0Ay2goiPe5xE= -github.com/steakknife/bloomfilter v0.0.0-20180922174646-6819c0d2a570/go.mod h1:8OR4w3TdeIHIh1g6EMY5p0gVNOovcWC+1vpc7naMuAw= -github.com/steakknife/hamming v0.0.0-20180906055917-c99c65617cd3 h1:njlZPzLwU639dk2kqnCPPv+wNjq7Xb6EfUxe/oX0/NM= -github.com/steakknife/hamming v0.0.0-20180906055917-c99c65617cd3/go.mod h1:hpGUWaI9xL8pRQCTXQgocU38Qw1g0Us7n5PxxTwTCYU= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1 h1:2vfRuCMp5sSVIDSqO8oNnWJq7mPa6KVP3iPIwFBuy8A= -github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= -github.com/stretchr/testify v0.0.0-20170809224252-890a5c3458b4/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/syndtr/goleveldb v0.0.0-20181128100959-b001fa50d6b2 h1:GnOzE5fEFN3b2zDhJJABEofdb51uMRNb8eqIVtdducs= -github.com/syndtr/goleveldb v0.0.0-20181128100959-b001fa50d6b2/go.mod h1:Z4AUp2Km+PwemOoO/VB5AOx9XSsIItzFjoJlOSiYmn0= -github.com/syndtr/goleveldb v1.0.0 h1:fBdIW9lB4Iz0n9khmH8w27SJ3QEJ7+IgjPEwGSZiFdE= -github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ= -github.com/templexxx/cpufeat v0.0.0-20180724012125-cef66df7f161/go.mod h1:wM7WEvslTq+iOEAMDLSzhVuOt5BRZ05WirO+b09GHQU= -github.com/templexxx/xor v0.0.0-20181023030647-4e92f724b73b/go.mod h1:5XA7W9S6mni3h5uvOC75dA3m9CCCaS83lltmc0ukdi4= -github.com/tjfoc/gmsm v1.0.1/go.mod h1:XxO4hdhhrzAd+G4CjDqaOkd0hUzmtPR/d3EiBBMn/wc= -github.com/tsenart/tb v0.0.0-20181025101425-0d2499c8b6e9 h1:kjbwitOGH46vD01f2s3leBfrMnePQa3NSAIlW35MvY8= -github.com/tsenart/tb v0.0.0-20181025101425-0d2499c8b6e9/go.mod h1:EcGP24b8DY+bWHnpfJDP7fM+o8Nmz4fYH0l2xTtNr3I= -github.com/tyler-smith/go-bip39 v1.0.2 h1:+t3w+KwLXO6154GNJY+qUtIxLTmFjfUmpguQT1OlOT8= -github.com/tyler-smith/go-bip39 v1.0.2/go.mod h1:sJ5fKU0s6JVwZjjcUEX2zFOnvq0ASQ2K9Zr6cf67kNs= -github.com/uber/jaeger-client-go v0.0.0-20180607151842-f7e0d4744fa6/go.mod h1:WVhlPFC8FDjOFMMWRy2pZqQJSXxYSwNYOkTr/Z6d3Kk= -github.com/uber/jaeger-lib v0.0.0-20180615202729-a51202d6f4a7/go.mod h1:ComeNDZlWwrWnDv8aPp0Ba6+uUTzImX/AauajbLI56U= -github.com/wealdtech/go-ens/v3 v3.0.9 h1:gXMBNXikJ/XV9k6ybPOZMXIMPjBGSCC9N10dxe8Y2Xk= -github.com/wealdtech/go-ens/v3 v3.0.9/go.mod h1:P2OEBvgkhXLrPzPN+eR5z2/wFIGwHyijTDvpuC1xLlo= -github.com/wealdtech/go-multicodec v1.2.0 h1:9AHSxcSE9F9r6ZvQLAO0EXCdM08QfYohaXmW3k6sSh4= -github.com/wealdtech/go-multicodec v1.2.0/go.mod h1:aedGMaTeYkIqi/KCPre1ho5rTb3hGpu/snBOS3GQLw4= -github.com/wealdtech/go-string2eth v1.0.0 h1:jY6b1MVqU6k2Uw/kvcU1Y9/3dDyXfPzZrOFspt82UJs= -github.com/wealdtech/go-string2eth v1.0.0/go.mod h1:UZA/snEybGcD6n+Pl+yoDjmexlEJ6dtoS9myfM83Ol4= -github.com/wsddn/go-ecdh v0.0.0-20161211032359-48726bab9208 h1:1cngl9mPEoITZG8s8cVcUy5CeIBYhEESkOB7m6Gmkrk= -github.com/wsddn/go-ecdh v0.0.0-20161211032359-48726bab9208/go.mod h1:IotVbo4F+mw0EzQ08zFqg7pK3FebNXpaMsRy2RT+Ees= -github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c/go.mod h1:lB8K/P019DLNhemzwFU4jHLhdvlE6uDZjXFejJXr49I= -github.com/xdg/stringprep v1.0.0/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y= -github.com/xtaci/kcp-go v5.4.5+incompatible/go.mod h1:bN6vIwHQbfHaHtFpEssmWsN45a+AZwO7eyRCmEIbtvE= -github.com/xtaci/lossyconn v0.0.0-20190602105132-8df528c0c9ae/go.mod h1:gXtu8J62kEgmN++bm9BVICuT/e8yiLI2KFobd/TRFsE= -go.uber.org/atomic v1.5.0 h1:OI5t8sDa1Or+q8AeE+yKeB/SDYioSHAgcVljj9JIETY= -go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= -go.uber.org/multierr v1.3.0 h1:sFPn2GLc3poCkfrpIXGhBD2X0CMIo4Q/zSULXrj/+uc= -go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= -go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee h1:0mgffUl7nfd+FpvXMVz4IDEaUSmT1ysygQC7qYo7sG4= -go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= -go.uber.org/zap v1.13.0 h1:nR6NoDBgAf67s68NhaXbsojM+2gxp3S1hWkHDl27pVU= -go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= -golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190103213133-ff983b9c42bc h1:F5tKCVGp+MUAHhKp5MZtGqAlGX3+oCsiL1Q629FL90M= -golang.org/x/crypto v0.0.0-20190103213133-ff983b9c42bc/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190404164418-38d8ce5564a5/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE= -golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20191029031824-8986dd9e96cf h1:fnPsqIDRbCSgumaMCRpoIoF2s4qxv0xSSS0BVZUE/ss= -golang.org/x/crypto v0.0.0-20191029031824-8986dd9e96cf/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20191119213627-4f8c1d86b1ba h1:9bFeDpN3gTqNanMVqNcoR/pJQuP5uroC3t1D7eXozTE= -golang.org/x/crypto v0.0.0-20191119213627-4f8c1d86b1ba/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20191122220453-ac88ee75c92c h1:/nJuwDLoL/zrqY6gf57vxC+Pi+pZ8bfhpPkicO5H7W4= -golang.org/x/crypto v0.0.0-20191122220453-ac88ee75c92c/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190930215403-16217165b5de h1:5hukYrvBGR8/eNkX5mdUezrA6JiaEZDtJb9Ei+1LlBs= -golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181011144130-49bb7cea24b1 h1:Y/KGZSOdz/2r0WJ9Mkmz6NJBusp0kiNx1Cn82lzJQ6w= -golang.org/x/net v0.0.0-20181011144130-49bb7cea24b1/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3 h1:0GoQqolDA55aaLxZyTzK/Y2ePZzZTUrRacwib7cNsYQ= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859 h1:R/3boaszxrf1GEUWTVDzSKVwLmSJpwZ1yqXm8j0v2QI= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190912160710-24e19bdeb0f2 h1:4dVFTC832rPn4pomLSz1vA+are2+dU19w1H8OngV7nc= -golang.org/x/net v0.0.0-20190912160710-24e19bdeb0f2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f h1:wMNYb4v58l5UBM7MYRLPG6ZhfOqbKu7X5eyFl8ZhKvA= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e h1:vcxGaoTs7kV8m5Np9uUNQin4BrLOthgV7252N8V+FwY= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e h1:o3PsSEY8E4eXWkXrIP9YJALUkVZqzHJT5DOasTyn8Vs= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180926160741-c2ed4eda69e7/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190412213103-97732733099d h1:+R4KGOnez64A81RvjARKc4UT5/tI9ujCIVX+P5KiHuI= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190801041406-cbf593c0f2f3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190912141932-bc967efca4b8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191010194322-b09406accb47 h1:/XfQ9z7ib8eEJX2hdgFTZJ/ntt0swNk5oYBziWeTCvY= -golang.org/x/sys v0.0.0-20191010194322-b09406accb47/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190912185636-87d9f09c5d89/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5 h1:hKsoRgsbwY1NafxrwTs+k64bikrLBkAgPir1TNCj3Zs= -golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= -gopkg.in/bsm/ratelimit.v1 v1.0.0-20160220154919-db14e161995a/go.mod h1:KF9sEfUPAXdG8Oev9e99iLGnl2uJMjc5B+4y3O7x610= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20161208181325-20d25e280405 h1:829vOVxxusYHC+IqBtkX5mbKtsY9fheQiQn0MZRVLfQ= -gopkg.in/check.v1 v1.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= -gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/jcmturner/aescts.v1 v1.0.1/go.mod h1:nsR8qBOg+OucoIW+WMhB3GspUQXq9XorLnQb9XtvcOo= -gopkg.in/jcmturner/dnsutils.v1 v1.0.1/go.mod h1:m3v+5svpVOhtFAP/wSz+yzh4Mc0Fg7eRhxkJMWSIz9Q= -gopkg.in/jcmturner/goidentity.v3 v3.0.0/go.mod h1:oG2kH0IvSYNIu80dVAyu/yoefjq1mNfM5bm88whjWx4= -gopkg.in/jcmturner/gokrb5.v7 v7.2.3/go.mod h1:l8VISx+WGYp+Fp7KRbsiUuXTTOnxIc3Tuvyavf11/WM= -gopkg.in/jcmturner/rpc.v1 v1.1.0/go.mod h1:YIdkC4XfD6GXbzje11McwsDuOlZQSb9W4vfLvuNnlv8= -gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce h1:+JknDZhAj8YMt7GC73Ei8pv4MzjDUNPHgQWJdtMAaDU= -gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce/go.mod h1:5AcXVHNjg+BDxry382+8OKon8SEWiKktQR07RKPsv1c= -gopkg.in/olebedev/go-duktape.v3 v3.0.0-20180302121509-abf0ba0be5d5/go.mod h1:uAJfkITjFhyEEuUfm7bsmCZRbW5WRq8s9EY8HZ6hCns= -gopkg.in/olebedev/go-duktape.v3 v3.0.0-20190709231704-1e4459ed25ff h1:uuol9OUzSvZntY1v963NAbVd7A+PHLMz1FlCe3Lorcs= -gopkg.in/olebedev/go-duktape.v3 v3.0.0-20190709231704-1e4459ed25ff/go.mod h1:uAJfkITjFhyEEuUfm7bsmCZRbW5WRq8s9EY8HZ6hCns= -gopkg.in/redis.v4 v4.2.4/go.mod h1:8KREHdypkCEojGKQcjMqAODMICIVwZAONWq8RowTITA= -gopkg.in/sourcemap.v1 v1.0.5/go.mod h1:2RlvNNSMglmRrcvhfuzp4hQHwOtjxlbjX7UPY/GXb78= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/urfave/cli.v1 v1.20.0 h1:NdAVW6RYxDif9DhDHaAortIu956m2c0v+09AZBPTbE0= -gopkg.in/urfave/cli.v1 v1.20.0/go.mod h1:vuBzUtMdQeixQj8LVd+/98pzhxNGQoyuPBlsXHOQNO0= -gopkg.in/yaml.v2 v2.2.1 h1:mUhvW9EsL+naU5Q3cakzfE91YhliOondGd6ZrsDBHQE= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.1-2019.2.3 h1:3JgtbtFHMiCmsznwGVTUWbgGov+pVqnlf1dEJTNAXeM= -honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= diff --git a/eth-node/keystore/passphrase.go b/eth-node/keystore/passphrase.go index b13f546aa..0eec754d3 100644 --- a/eth-node/keystore/passphrase.go +++ b/eth-node/keystore/passphrase.go @@ -108,7 +108,7 @@ func DecryptKey(keyjson []byte, auth string) (*types.Key, error) { key := crypto.ToECDSAUnsafe(keyBytes) return &types.Key{ - Id: uuid.UUID(keyId), + ID: uuid.UUID(keyId), Address: crypto.PubkeyToAddress(key.PublicKey), PrivateKey: key, ExtendedKey: extKey, diff --git a/eth-node/types/address.go b/eth-node/types/address.go index aa5b20c80..1ed798e50 100644 --- a/eth-node/types/address.go +++ b/eth-node/types/address.go @@ -59,7 +59,7 @@ func (a Address) Hash() Hash { return BytesToHash(a[:]) } func (a Address) Hex() string { unchecksummed := hex.EncodeToString(a[:]) sha := sha3.NewLegacyKeccak256() - sha.Write([]byte(unchecksummed)) + _, _ = sha.Write([]byte(unchecksummed)) hash := sha.Sum(nil) result := []byte(unchecksummed) diff --git a/eth-node/types/envelopes.go b/eth-node/types/envelopes.go index c9b8ead3c..62c22ba95 100644 --- a/eth-node/types/envelopes.go +++ b/eth-node/types/envelopes.go @@ -27,7 +27,7 @@ const ( // EventEnvelopeReceived must be sent to the feed even if envelope was previously in the cache. // And event, ideally, should contain information about peer that sent envelope to us. EventEnvelopeReceived EventType = "envelope.received" - // EventBatchAcknowledged is sent when batch of envelopes was acknowleged by a peer. + // EventBatchAcknowledged is sent when batch of envelopes was acknowledged by a peer. EventBatchAcknowledged EventType = "batch.acknowleged" // EventEnvelopeAvailable fires when envelop is available for filters EventEnvelopeAvailable EventType = "envelope.available" diff --git a/eth-node/types/hex.go b/eth-node/types/hex.go index fb8116be2..3eaaf6b2e 100644 --- a/eth-node/types/hex.go +++ b/eth-node/types/hex.go @@ -49,6 +49,6 @@ func UnmarshalFixedUnprefixedText(typname string, input, out []byte) error { return ErrSyntax } } - hex.Decode(out, raw) - return nil + _, err = hex.Decode(out, raw) + return err } diff --git a/eth-node/types/key.go b/eth-node/types/key.go index c0fded848..1b2804677 100644 --- a/eth-node/types/key.go +++ b/eth-node/types/key.go @@ -9,7 +9,7 @@ import ( ) type Key struct { - Id uuid.UUID // Version 4 "random" for unique id not derived from key data + ID uuid.UUID // Version 4 "random" for unique id not derived from key data // to simplify lookups we also store the address Address Address // we only store privkey as pubkey/address can be derived from it diff --git a/go.mod b/go.mod index 25879432b..ea419303e 100644 --- a/go.mod +++ b/go.mod @@ -10,25 +10,26 @@ replace github.com/docker/docker => github.com/docker/engine v1.4.2-0.2019071716 replace github.com/gomarkdown/markdown v0.0.0-20191209105822-e3ba6c6109ba => github.com/status-im/markdown v0.0.0-20191209105822-e3ba6c6109ba -replace github.com/status-im/status-go/protocol => ./protocol - -replace github.com/status-im/status-go/extkeys => ./extkeys - -replace github.com/status-im/status-go/eth-node => ./eth-node - -replace github.com/status-im/status-go/whisper/v6 => ./whisper - -replace github.com/status-im/status-go/waku => ./waku - require ( github.com/beevik/ntp v0.2.0 + github.com/btcsuite/btcd v0.20.1-beta + github.com/cenkalti/backoff/v3 v3.2.2 github.com/ethereum/go-ethereum v1.9.5 + github.com/gballet/go-libpcsclite v0.0.0-20191108122812-4678299bea08 // indirect github.com/go-playground/universal-translator v0.17.0 // indirect + github.com/golang-migrate/migrate/v4 v4.8.0 // indirect github.com/golang/mock v1.3.1 + github.com/golang/protobuf v1.3.2 + github.com/gomarkdown/markdown v0.0.0-20191209105822-e3ba6c6109ba + github.com/google/uuid v1.1.1 + github.com/jinzhu/copier v0.0.0-20190924061706-b57f9002281a + github.com/karalabe/usb v0.0.0-20191104083709-911d15fe12a9 // indirect github.com/leodido/go-urn v1.2.0 // indirect github.com/lib/pq v1.2.0 github.com/libp2p/go-libp2p v0.4.2 // indirect github.com/libp2p/go-libp2p-core v0.2.4 + github.com/lucasb-eyer/go-colorful v1.0.3 + github.com/mattn/go-pointer v0.0.0-20190911064623-a0a44394634f github.com/multiformats/go-multiaddr v0.1.1 github.com/mutecomm/go-sqlcipher v0.0.0-20190227152316-55dbde17881f github.com/okzk/sdnotify v0.0.0-20180710141335-d9becc38acbd @@ -38,16 +39,18 @@ require ( github.com/russolsen/ohyeah v0.0.0-20160324131710-f4938c005315 // indirect github.com/russolsen/same v0.0.0-20160222130632-f089df61f51d // indirect github.com/russolsen/transit v0.0.0-20180705123435-0794b4c4505a + github.com/status-im/doubleratchet v3.0.0+incompatible + github.com/status-im/keycard-go v0.0.0-20200107115650-f38e9a19958e // indirect github.com/status-im/migrate/v4 v4.6.2-status.2 github.com/status-im/rendezvous v1.3.0 - github.com/status-im/status-go/eth-node v1.1.0 github.com/status-im/status-go/extkeys v1.1.0 - github.com/status-im/status-go/protocol v1.1.0 - github.com/status-im/status-go/waku v1.1.0 + github.com/status-im/status-go/waku v1.2.0 github.com/status-im/status-go/whisper/v6 v6.1.0 github.com/status-im/tcp-shaker v0.0.0-20191114194237-215893130501 github.com/stretchr/testify v1.4.0 github.com/syndtr/goleveldb v1.0.0 + github.com/vacp2p/mvds v0.0.23 + github.com/wealdtech/go-ens/v3 v3.3.0 go.uber.org/zap v1.13.0 golang.org/x/crypto v0.0.0-20191122220453-ac88ee75c92c golang.org/x/tools v0.0.0-20200116062425-473961ec044c // indirect diff --git a/go.sum b/go.sum index 3c3c1d397..aaeb0cee8 100644 --- a/go.sum +++ b/go.sum @@ -10,8 +10,7 @@ github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 h1:w+iIsaOQNcT7O github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8= github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/DATA-DOG/go-sqlmock v1.3.3 h1:CWUqKXe0s8A2z6qCgkP4Kru7wC11YoAnoupUKFDnH08= -github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= +github.com/ClickHouse/clickhouse-go v1.3.12/go.mod h1:EaI/sW7Azgz9UATzd5ZdZHRUhHgv5+JMS9NSr2smCJI= github.com/DataDog/zstd v1.3.6-0.20190409195224-796139022798/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= github.com/Julusian/godocdown v0.0.0-20170816220326-6d19f8ff2df8/go.mod h1:INZr5t32rG59/5xeltqoCJoNY7e5x/3xoY9WSWVWg74= github.com/Kubuxu/go-os-helper v0.0.1/go.mod h1:N8B+I7vPCT80IcP58r50u4+gEEcsZETFUpAzWW2ep1Y= @@ -28,6 +27,7 @@ github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuy github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/allegro/bigcache v0.0.0-20190218064605-e24eb225f156 h1:hh7BAWFHv41r0gce0KRYtDJpL4erKfmB1/mpgoSADeI= github.com/allegro/bigcache v0.0.0-20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= github.com/allegro/bigcache v1.2.0 h1:qDaE0QoF29wKBb3+pXFrJFy1ihe5OT9OiXhg1t85SxM= github.com/allegro/bigcache v1.2.0/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= @@ -50,6 +50,7 @@ github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+Ce github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/bitly/go-hostpool v0.0.0-20171023180738-a3a6125de932/go.mod h1:NOuUCSz6Q9T7+igc/hlvDOUdtWKryOrtFyIVABv/p7k= +github.com/bkaradzic/go-lz4 v1.0.0/go.mod h1:0YdlkowM3VswSROI7qDxhRvJ3sLhlFrRRwjwegp5jy4= github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4= github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8= github.com/btcsuite/btcd v0.0.0-20190418232430-6867ff32788a/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8= @@ -66,8 +67,9 @@ github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVa github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= -github.com/cenkalti/backoff/v3 v3.0.0 h1:ske+9nBpD9qZsTBoF41nW5L+AIuFBKMeze18XQ3eG1c= -github.com/cenkalti/backoff/v3 v3.0.0/go.mod h1:cIeZDE3IrqwwJl6VUwCN6trj1oXrTS4rc0ij+ULvLYs= +github.com/cenkalti/backoff/v3 v3.2.2 h1:cfUAAO3yvKMYKPrvhDuHSwQnhZNk/RMHKdZqKTxfm6M= +github.com/cenkalti/backoff/v3 v3.2.2/go.mod h1:cIeZDE3IrqwwJl6VUwCN6trj1oXrTS4rc0ij+ULvLYs= +github.com/cespare/cp v0.1.0 h1:SE+dxFebS7Iik5LK0tsi1k9ZCxEaFX4AjQmoyA+1dJk= github.com/cespare/cp v0.1.0/go.mod h1:SOGHArjBr4JWaSDEVpWpo/hNg6RoKrls6Oh40hiwW+s= github.com/cespare/cp v1.1.1 h1:nCb6ZLdB7NRaqsm91JtQTAme2SKJzXVsdPIPkyJr1MU= github.com/cespare/cp v1.1.1/go.mod h1:SOGHArjBr4JWaSDEVpWpo/hNg6RoKrls6Oh40hiwW+s= @@ -76,6 +78,7 @@ github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghf github.com/cespare/xxhash/v2 v2.1.0 h1:yTUvW7Vhb89inJ+8irsUqiWjh8iT6sQPZiQzI6ReGkA= github.com/cespare/xxhash/v2 v2.1.0/go.mod h1:dgIUBU3pDso/gPgZ1osOZ0iQf77oPR28Tjxl5dIMyVM= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cloudflare/golz4 v0.0.0-20150217214814-ef862a3cdc58/go.mod h1:EOBUe0h4xcZ5GoxqC5SDxFQ8gwyZPKQoEzownBlhI80= github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ= github.com/cockroachdb/cockroach-go v0.0.0-20181001143604-e0a95dfd547c/go.mod h1:XGLbWH/ujMcbPbhZq52Nv6UrCghb1yGn//133kEsvDk= github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= @@ -113,6 +116,8 @@ github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUn github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= github.com/dhui/dktest v0.3.0 h1:kwX5a7EkLcjo7VpsPQSYJcKGbXBXdjI9FGjuUj1jn6I= github.com/dhui/dktest v0.3.0/go.mod h1:cyzIUfGsBEbZ6BT7tnXqAShHSXCZhSNmFl70sZ7c1yc= +github.com/dhui/dktest v0.3.1 h1:NVUdB50k8tml431Ho1hcQBNeC52Qe8oSDPAjseA67Y8= +github.com/dhui/dktest v0.3.1/go.mod h1:cyzIUfGsBEbZ6BT7tnXqAShHSXCZhSNmFl70sZ7c1yc= github.com/docker/distribution v2.7.0+incompatible h1:neUDAlf3wX6Ml4HdqTrbcOHXtfRN0TFIwt6YFL7N9RU= github.com/docker/distribution v2.7.0+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/engine v1.4.2-0.20190717161051-705d9623b7c1 h1:HjO0YFIGk26fADKDJYuAoGneX9nrVVotZJ1Ctn15Vv4= @@ -127,6 +132,7 @@ github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5m github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= github.com/edsrzf/mmap-go v0.0.0-20160512033002-935e0e8a636c/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= +github.com/edsrzf/mmap-go v0.0.0-20170320065105-0bce6a688712 h1:aaQcKT9WumO6JEJcRyTqFVq4XUZiUcKR2/GI31TOcz8= github.com/edsrzf/mmap-go v0.0.0-20170320065105-0bce6a688712/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= github.com/edsrzf/mmap-go v1.0.0 h1:CEBF7HpRnUCSJgGUb5h1Gm7e3VkmVDrR8lvWVLtrOFw= github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= @@ -138,6 +144,7 @@ github.com/elazarl/go-bindata-assetfs v1.0.0/go.mod h1:v+YaWX3bdea5J/mo8dSETolEo github.com/ethereum/go-ethereum v1.8.20/go.mod h1:PwpWDrCLZrV+tfrhqqF6kPknbISMHaJv9Ln3kPCZLwY= github.com/ethereum/go-ethereum v1.9.2/go.mod h1:PwpWDrCLZrV+tfrhqqF6kPknbISMHaJv9Ln3kPCZLwY= github.com/fatih/color v1.3.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/fjl/memsize v0.0.0-20180418122429-ca190fb6ffbc h1:jtW8jbpkO4YirRSyepBOH8E+2HEw6/hKkBvFPwhUN8c= github.com/fjl/memsize v0.0.0-20180418122429-ca190fb6ffbc/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0= github.com/fjl/memsize v0.0.0-20180929194037-2a09253e352a h1:1znxn4+q2MrEdTk1eCk6KIV3muTYVclBIB6CTVR/zBc= github.com/fjl/memsize v0.0.0-20180929194037-2a09253e352a/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0= @@ -147,6 +154,8 @@ github.com/fsouza/fake-gcs-server v1.7.0/go.mod h1:5XIRs4YvwNbNoz+1JF8j6KLAyDh7R github.com/garyburd/redigo v1.6.0/go.mod h1:NR3MbYisc3/PwhQ00EMzDiPmrwpPxAn5GI05/YaO1SY= github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff h1:tY80oXqGNY4FhTFhk+o9oFHGINQ/+vhlm8HFzi6znCI= github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= +github.com/gballet/go-libpcsclite v0.0.0-20191108122812-4678299bea08 h1:f6D9Hr8xV8uYKlyuj8XIruxlh9WjVjdh1gIicAS7ays= +github.com/gballet/go-libpcsclite v0.0.0-20191108122812-4678299bea08/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= github.com/gizak/termui v0.0.0-20170117222342-991cd3d38091/go.mod h1:PkJoWUt/zacQKysNfQtcw1RW+eK2SxkieVBtl+4ovLA= github.com/go-check/check v0.0.0-20180628173108-788fd7840127/go.mod h1:9ES+weclKsC9YodN5RgxqK/VD9HM9JsCSh7rNhMZE98= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= @@ -160,6 +169,7 @@ github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8c github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD876Lmtgy7VtROAbHHXk8no= github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= +github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-stack/stack v1.5.4/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= @@ -173,6 +183,8 @@ github.com/gogo/protobuf v1.3.1 h1:DqDEcV5aeaTmdFBePNpYsp3FlcVH/2ISVVM9Qf8PSls= github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/golang-migrate/migrate/v4 v4.6.2 h1:LDDOHo/q1W5UDj6PbkxdCv7lv9yunyZHXvxuwDkGo3k= github.com/golang-migrate/migrate/v4 v4.6.2/go.mod h1:JYi6reN3+Z734VZ0akNuyOJNcrg45ZL7LDBMW3WGJL0= +github.com/golang-migrate/migrate/v4 v4.8.0 h1:zcamXqBH0W8hHwpaikOGnaFTRrQWU+X8ukBeY1dYucU= +github.com/golang-migrate/migrate/v4 v4.8.0/go.mod h1:F6bGIGAA7xSb2k17sF1+eHl2gRHa+DWNZpoIKbThPLE= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6 h1:ZgQEtGgCBiWRM39fZuwSd1LwSqqSW0hOdXCYYDX0R3I= @@ -276,9 +288,10 @@ github.com/jbenet/goprocess v0.1.3/go.mod h1:5yspPrukOVuOLORacaBi858NqyClJPQxYZl github.com/jcmturner/gofork v0.0.0-20190328161633-dc7c13fece03/go.mod h1:MK8+TM0La+2rjBD4jE12Kj1pCCxK7d2LK/UM3ncEo0o= github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/jinzhu/copier v0.0.0-20190625015134-976e0346caa8 h1:mGIXW/lubQ4B+3bXTLxcTMTjUNDqoF6T/HUW9LbFx9s= -github.com/jinzhu/copier v0.0.0-20190625015134-976e0346caa8/go.mod h1:yL958EeXv8Ylng6IfnvG4oflryUi3vgA3xPs9hmII1s= +github.com/jinzhu/copier v0.0.0-20190924061706-b57f9002281a h1:zPPuIq2jAWWPTrGt70eK/BSch+gFAGrNzecsoENgu2o= +github.com/jinzhu/copier v0.0.0-20190924061706-b57f9002281a/go.mod h1:yL958EeXv8Ylng6IfnvG4oflryUi3vgA3xPs9hmII1s= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= +github.com/jmoiron/sqlx v1.2.0/go.mod h1:1FEQNm3xlJgrMD+FBdI9+xvCksHtbpVBBw5dYhBSsks= github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= @@ -290,6 +303,8 @@ github.com/kami-zh/go-capturer v0.0.0-20171211120116-e492ea43421d/go.mod h1:P2vi github.com/karalabe/hid v0.0.0-20181128192157-d815e0c1a2e2/go.mod h1:YvbcH+3Wo6XPs9nkgTY3u19KXLauXW+J5nB7hEHuX0A= github.com/karalabe/usb v0.0.0-20190819132248-550797b1cad8 h1:VhnqxaTIudc9IWKx8uXRLnpdSb9noCEj+vHacjmhp68= github.com/karalabe/usb v0.0.0-20190819132248-550797b1cad8/go.mod h1:Od972xHfMJowv7NGVDiWVxk2zxnWgjLlJzE+F4F7AGU= +github.com/karalabe/usb v0.0.0-20191104083709-911d15fe12a9 h1:ZHuwnjpP8LsVsUYqTqeVAI+GfDfJ6UNPrExZF+vX/DQ= +github.com/karalabe/usb v0.0.0-20191104083709-911d15fe12a9/go.mod h1:Od972xHfMJowv7NGVDiWVxk2zxnWgjLlJzE+F4F7AGU= github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0/go.mod h1:1NbS8ALrpOvjt0rHPNLyCIeMtbizbir8U//inJ+zuB8= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= @@ -412,8 +427,8 @@ github.com/libp2p/go-ws-transport v0.1.2/go.mod h1:dsh2Ld8F+XNmzpkaAijmg5Is+e9l6 github.com/libp2p/go-yamux v1.2.2/go.mod h1:FGTiPvoV/3DVdgWpX+tM0OW3tsM+W5bSE3gZwqQTcow= github.com/libp2p/go-yamux v1.2.3 h1:xX8A36vpXb59frIzWFdEgptLMsOANMFq2K7fPRlunYI= github.com/libp2p/go-yamux v1.2.3/go.mod h1:FGTiPvoV/3DVdgWpX+tM0OW3tsM+W5bSE3gZwqQTcow= -github.com/lucasb-eyer/go-colorful v1.0.2 h1:mCMFu6PgSozg9tDNMMK3g18oJBX7oYGrC09mS6CXfO4= -github.com/lucasb-eyer/go-colorful v1.0.2/go.mod h1:0MS4r+7BZKSJ5mw4/S5MPN+qHFF1fYclkSPilDOKW0s= +github.com/lucasb-eyer/go-colorful v1.0.3 h1:QIbQXiugsb+q10B+MI+7DI1oQLdmnep86tWFlaaUAac= +github.com/lucasb-eyer/go-colorful v1.0.3/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/maruel/panicparse v0.0.0-20160720141634-ad661195ed0e/go.mod h1:nty42YY5QByNC5MM7q/nj938VbgPU7avs45z6NClpxI= @@ -423,14 +438,17 @@ github.com/mattn/go-colorable v0.1.1 h1:G1f5SKeVxmagw/IyvzvtZE4Gybcc4Tr1tf7I8z0X github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= github.com/mattn/go-isatty v0.0.0-20180830101745-3fb116b82035/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-isatty v0.0.5 h1:tHXDdz1cpzGaovsTB+TVB8q90WEokoVmfMqoVcrLUgw= github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.7 h1:UvyT9uN+3r7yLEYSlJsbQGdsaB/a0DlgWP3pql6iwOc= github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-pointer v0.0.0-20190911064623-a0a44394634f h1:QTRRO+ozoYgT3CQRIzNVYJRU3DB8HRnkZv6mr4ISmMA= github.com/mattn/go-pointer v0.0.0-20190911064623-a0a44394634f/go.mod h1:2zXcozF6qYGgmsG+SeTZz3oAbFLdD3OWqnUbNvJZAlc= +github.com/mattn/go-runewidth v0.0.3 h1:a+kO+98RDGEfo6asOGMmpodZq4FNtnGP54yps8BzLR4= github.com/mattn/go-runewidth v0.0.3/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.4 h1:2BvfKmzob6Bmd4YsL0zygOqfdFnK7GR4QL06Do4/p7Y= github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= +github.com/mattn/go-sqlite3 v1.9.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= github.com/mattn/go-sqlite3 v1.10.0 h1:jbhqpg7tQe4SupckyijYiy0mJJ/pRyHvXf7JdWK860o= github.com/mattn/go-sqlite3 v1.10.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= @@ -495,6 +513,7 @@ github.com/nsf/termbox-go v0.0.0-20170211012700-3540b76b9c77/go.mod h1:IuKpRQcYE github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/okzk/sdnotify v0.0.0-20180710141335-d9becc38acbd h1:+iAPaTbi1gZpcpDwe/BW1fx7Xoesv69hLNGPheoyhBs= github.com/okzk/sdnotify v0.0.0-20180710141335-d9becc38acbd/go.mod h1:4soZNh0zW0LtYGdQ416i0jO0EIqMGcbtaspRS4BDvRQ= +github.com/olekukonko/tablewriter v0.0.0-20170128050532-febf2d34b54a h1:m6hB6GkmZ/suOSKZM7yx3Yt+7iZ9HNfzacCykJqgXA8= github.com/olekukonko/tablewriter v0.0.0-20170128050532-febf2d34b54a/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= github.com/olekukonko/tablewriter v0.0.1 h1:b3iUnf1v+ppJiOfNX4yxxqfWKMQPZR5yoh8urCTFX88= github.com/olekukonko/tablewriter v0.0.1/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= @@ -514,6 +533,7 @@ github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQ github.com/opencontainers/image-spec v1.0.1 h1:JMemWkRwHx4Zj+fVxWoMCFm/8sYGGrUVojFA6h/TRcI= github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= github.com/opentracing/opentracing-go v0.0.0-20180606204148-bd9c31933947/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= +github.com/opentracing/opentracing-go v1.0.2 h1:3jA2P6O1F9UOrWVpwrIo17pu01KWvNWg4X946/Y5Zwg= github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/opentracing/opentracing-go v1.1.0 h1:pWlfV3Bxv7k65HYwkikxat0+s3pV4bsqf19k25Ur8rU= github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= @@ -562,6 +582,8 @@ github.com/prometheus/prometheus v0.0.0-20170814170113-3101606756c5/go.mod h1:oA github.com/prometheus/tsdb v0.10.0 h1:If5rVCMTp6W2SiRAQFlbpJNgVlgMEd+U2GZckwK38ic= github.com/prometheus/tsdb v0.10.0/go.mod h1:oi49uRhEe9dPUTlS3JRZOwJuVi6tmh10QSgwXEyGCt4= github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= +github.com/remyoudompheng/bigfft v0.0.0-20190728182440-6a916e37a237/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= +github.com/rjeczalik/notify v0.9.1 h1:CLCKso/QK1snAlnhNR/CNvNiFU2saUtjV0bx3EwNeCE= github.com/rjeczalik/notify v0.9.1/go.mod h1:rKwnCoCGeuQnwBtTSPL9Dad03Vh2n40ePRrjvIXnJho= github.com/rjeczalik/notify v0.9.2 h1:MiTWrPj55mNDHEiIX5YUSKefw/+lCQVoAFmD6oQm5w8= github.com/rjeczalik/notify v0.9.2/go.mod h1:aErll2f0sUX9PXZnVNyeiObbmTlk5jnMoCa4QEjJeqM= @@ -609,12 +631,21 @@ github.com/status-im/go-multiaddr-ethv4 v1.2.0 h1:OT84UsUzTCwguqCpJqkrCMiL4VZ1Sv github.com/status-im/go-multiaddr-ethv4 v1.2.0/go.mod h1:2VQ3C+9zEurcceasz12gPAtmEzCeyLUGPeKLSXYQKHo= github.com/status-im/keycard-go v0.0.0-20190424133014-d95853db0f48 h1:ju5UTwk5Odtm4trrY+4Ca4RMj5OyXbmVeDAVad2T0Jw= github.com/status-im/keycard-go v0.0.0-20190424133014-d95853db0f48/go.mod h1:RZLeN1LMWmRsyYjvAu+I6Dm9QmlDaIIt+Y+4Kd7Tp+Q= +github.com/status-im/keycard-go v0.0.0-20200107115650-f38e9a19958e h1:iT/UJdf+SzbgkIPDe/RmlCfLEQ+ab4UMl6toBl9CGZA= +github.com/status-im/keycard-go v0.0.0-20200107115650-f38e9a19958e/go.mod h1:RZLeN1LMWmRsyYjvAu+I6Dm9QmlDaIIt+Y+4Kd7Tp+Q= github.com/status-im/markdown v0.0.0-20191209105822-e3ba6c6109ba h1:Ut2CKuG+L9eWFL7dTEPuLE+RKecUYBkDNhqXSIgY92U= github.com/status-im/markdown v0.0.0-20191209105822-e3ba6c6109ba/go.mod h1:tmG2bxyvZ2EItDO5JewbdFvV45j13IYQgvnMJ3+qAaE= github.com/status-im/migrate/v4 v4.6.2-status.2 h1:SdC+sMDl/aI7vUlwD2qj2p7KsK4T60IS9z4/rYCCbI8= github.com/status-im/migrate/v4 v4.6.2-status.2/go.mod h1:c/kc90n47GZu/58nnz1OMLTf7uE4Da4gZP5qmU+A/v8= github.com/status-im/rendezvous v1.3.0 h1:7RK/MXXW+tlm0asKm1u7Qp7Yni6AO29a7j8+E4Lbjg4= github.com/status-im/rendezvous v1.3.0/go.mod h1:+hzjuP+j/XzLPeF6E50b88pWOTLdTcwjvNYt+Gh1W1s= +github.com/status-im/status-go/extkeys v1.0.0/go.mod h1:GdqJbrcpkNm5ZsSCpp+PdMxnXx+OcRBdm3PI0rs1FpU= +github.com/status-im/status-go/extkeys v1.1.0 h1:QgnXlMvhlFyRu+GdpPn1Ve22IidnDdslFB/Py6HWj78= +github.com/status-im/status-go/extkeys v1.1.0/go.mod h1:nT/T2+G4L/6qPVIIfI3oT8dQSVyn7fQYY8G3yL3PIGY= +github.com/status-im/status-go/waku v1.2.0 h1:bhAm5XpvIT+oPHE8Yq6OWoAprTiERfGu1WrO/OR9crk= +github.com/status-im/status-go/waku v1.2.0/go.mod h1:1bjvQAL4cJYtxCsm6DnKdJbxcZwnvvZmxb6pmoUDtuY= +github.com/status-im/status-go/whisper/v6 v6.1.0 h1:jFGK8zr5bXaFTcyS/xIKh/5TlyqUks+5kyivDUii/1c= +github.com/status-im/status-go/whisper/v6 v6.1.0/go.mod h1:csqMoPMkCPW1NJO56HJzNTWAl9UMdetnQzkPbPjsAC4= github.com/status-im/tcp-shaker v0.0.0-20191114194237-215893130501 h1:oa0KU5jJRNtXaM/P465MhvSFo/HM2O8qi2DDuPcd7ro= github.com/status-im/tcp-shaker v0.0.0-20191114194237-215893130501/go.mod h1:RYo/itke1oU5k/6sj9DNM3QAwtE5rZSgg5JnkOv83hk= github.com/steakknife/bloomfilter v0.0.0-20180922174646-6819c0d2a570 h1:gIlAHnH1vJb5vwEjIp5kBj/eu99p/bl0Ay2goiPe5xE= @@ -648,8 +679,8 @@ github.com/uber/jaeger-lib v0.0.0-20180615202729-a51202d6f4a7/go.mod h1:ComeNDZl github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= github.com/vacp2p/mvds v0.0.23 h1:BKdn7tyGvl/J/Pwv6FlcW6Xbzm+17jv141GB1mFXyOU= github.com/vacp2p/mvds v0.0.23/go.mod h1:uUmtiahU7efOVl/5w5yk9jOze5xYpDZDrSrT8TvHXjQ= -github.com/wealdtech/go-ens/v3 v3.0.9 h1:gXMBNXikJ/XV9k6ybPOZMXIMPjBGSCC9N10dxe8Y2Xk= -github.com/wealdtech/go-ens/v3 v3.0.9/go.mod h1:P2OEBvgkhXLrPzPN+eR5z2/wFIGwHyijTDvpuC1xLlo= +github.com/wealdtech/go-ens/v3 v3.3.0 h1:xJJlFLEbdnzU7dLFwyg5fXlZVprwoLPlAPVZdpYCCrY= +github.com/wealdtech/go-ens/v3 v3.3.0/go.mod h1:P2OEBvgkhXLrPzPN+eR5z2/wFIGwHyijTDvpuC1xLlo= github.com/wealdtech/go-multicodec v1.2.0 h1:9AHSxcSE9F9r6ZvQLAO0EXCdM08QfYohaXmW3k6sSh4= github.com/wealdtech/go-multicodec v1.2.0/go.mod h1:aedGMaTeYkIqi/KCPre1ho5rTb3hGpu/snBOS3GQLw4= github.com/wealdtech/go-string2eth v1.0.0 h1:jY6b1MVqU6k2Uw/kvcU1Y9/3dDyXfPzZrOFspt82UJs= @@ -843,6 +874,7 @@ gopkg.in/natefinch/lumberjack.v2 v2.0.0 h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXL gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k= gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce h1:+JknDZhAj8YMt7GC73Ei8pv4MzjDUNPHgQWJdtMAaDU= gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce/go.mod h1:5AcXVHNjg+BDxry382+8OKon8SEWiKktQR07RKPsv1c= +gopkg.in/olebedev/go-duktape.v3 v3.0.0-20180302121509-abf0ba0be5d5 h1:VWXVtmkY4YFVuF1FokZ0PUsuvtx3Di6z/m47daSP5f0= gopkg.in/olebedev/go-duktape.v3 v3.0.0-20180302121509-abf0ba0be5d5/go.mod h1:uAJfkITjFhyEEuUfm7bsmCZRbW5WRq8s9EY8HZ6hCns= gopkg.in/olebedev/go-duktape.v3 v3.0.0-20190709231704-1e4459ed25ff h1:uuol9OUzSvZntY1v963NAbVd7A+PHLMz1FlCe3Lorcs= gopkg.in/olebedev/go-duktape.v3 v3.0.0-20190709231704-1e4459ed25ff/go.mod h1:uAJfkITjFhyEEuUfm7bsmCZRbW5WRq8s9EY8HZ6hCns= @@ -865,3 +897,15 @@ honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.1-2019.2.3 h1:3JgtbtFHMiCmsznwGVTUWbgGov+pVqnlf1dEJTNAXeM= honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +modernc.org/b v1.0.0/go.mod h1:uZWcZfRj1BpYzfN9JTerzlNUnnPsV9O2ZA8JsRcubNg= +modernc.org/db v1.0.0/go.mod h1:kYD/cO29L/29RM0hXYl4i3+Q5VojL31kTUVpVJDw0s8= +modernc.org/file v1.0.0/go.mod h1:uqEokAEn1u6e+J45e54dsEA/pw4o7zLrA2GwyntZzjw= +modernc.org/fileutil v1.0.0/go.mod h1:JHsWpkrk/CnVV1H/eGlFf85BEpfkrp56ro8nojIq9Q8= +modernc.org/golex v1.0.0/go.mod h1:b/QX9oBD/LhixY6NDh+IdGv17hgB+51fET1i2kPSmvk= +modernc.org/internal v1.0.0/go.mod h1:VUD/+JAkhCpvkUitlEOnhpVxCgsBI90oTzSCRcqQVSM= +modernc.org/lldb v1.0.0/go.mod h1:jcRvJGWfCGodDZz8BPwiKMJxGJngQ/5DrRapkQnLob8= +modernc.org/mathutil v1.0.0/go.mod h1:wU0vUrJsVWBZ4P6e7xtFJEhFSNsfRLJ8H458uRjg03k= +modernc.org/ql v1.0.0/go.mod h1:xGVyrLIatPcO2C1JvI/Co8c0sr6y91HKFNy4pt9JXEY= +modernc.org/sortutil v1.1.0/go.mod h1:ZyL98OQHJgH9IEfN71VsamvJgrtRX9Dj2gX+vH86L1k= +modernc.org/strutil v1.1.0/go.mod h1:lstksw84oURvj9y3tn8lGvRxyRC1S2+g5uuIzNfIOBs= +modernc.org/zappy v1.0.0/go.mod h1:hHe+oGahLVII/aTTyWK/b53VDHMAGCBYYeZ9sn83HC4= diff --git a/lib/library.go b/lib/library.go index 1d23a68db..331c8a791 100644 --- a/lib/library.go +++ b/lib/library.go @@ -379,9 +379,7 @@ func SaveAccountAndLogin(accountData, password, settingsJSON, configJSON, subacc if err != nil { return makeJSONResponse(err) } - err = <-api.RunAsync(func() error { - return statusBackend.StartNodeWithAccountAndConfig(account, C.GoString(password), settings, &conf, subaccs) - }) + err = statusBackend.StartNodeWithAccountAndConfig(account, C.GoString(password), settings, &conf, subaccs) return makeJSONResponse(err) } diff --git a/lib/library_test_utils.go b/lib/library_test_utils.go index f8e4f2b10..0ce59b7f9 100644 --- a/lib/library_test_utils.go +++ b/lib/library_test_utils.go @@ -105,15 +105,16 @@ func createAccountAndLogin(t *testing.T, feed *event.Feed) account.Info { require.NoError(t, err) t.Logf("account created: {address: %s, key: %s}", account1.WalletAddress, account1.WalletPubKey) - signalErrC := make(chan error, 1) - go func() { - signalErrC <- waitSignal(feed, signal.EventLoggedIn, 5*time.Second) - }() - nodeConfig, _ := params.NewConfigFromJSON(nodeConfigJSON) nodeConfig.KeyStoreDir = "keystore" nodeConfig.DataDir = "/" - cnf, _ := json.Marshal(nodeConfig) + cnf, err := json.Marshal(nodeConfig) + require.NoError(t, err) + + signalErrC := make(chan error, 1) + go func() { + signalErrC <- waitSignal(feed, signal.EventLoggedIn, 10*time.Second) + }() // SaveAccountAndLogin must be called only once when an account is created. // If the account already exists, Login should be used. diff --git a/logutils/zap_adapter.go b/logutils/zap_adapter.go index 518e90225..96babcb3b 100644 --- a/logutils/zap_adapter.go +++ b/logutils/zap_adapter.go @@ -32,7 +32,7 @@ func (c gethLoggerCore) Check(ent zapcore.Entry, ce *zapcore.CheckedEntry) *zapc } return ce } -func (c gethLoggerCore) Write(ent zapcore.Entry, fields []zapcore.Field) error { // nolint: gocyclo +func (c gethLoggerCore) Write(ent zapcore.Entry, fields []zapcore.Field) error { fields = append(c.fields[:], fields...) var args []interface{} diff --git a/multiaccounts/accounts/database.go b/multiaccounts/accounts/database.go index 8933e3392..5721200a1 100644 --- a/multiaccounts/accounts/database.go +++ b/multiaccounts/accounts/database.go @@ -142,7 +142,6 @@ INSERT INTO settings ( return err } -// nolint: gocyclo func (db *Database) SaveSetting(setting string, value interface{}) error { var ( update *sql.Stmt diff --git a/params/config.go b/params/config.go index 1f8c78053..25f53a435 100644 --- a/params/config.go +++ b/params/config.go @@ -757,7 +757,6 @@ func loadConfigFromAsset(name string, config *NodeConfig) error { // // Key: 'TestStruct.TestField' Error:Field validation for 'TestField' failed on the 'required' tag // -// nolint: gocyclo func (c *NodeConfig) Validate() error { validate := NewValidator() diff --git a/protocol/chat.go b/protocol/chat.go index c49e27a8c..f364c6ff3 100644 --- a/protocol/chat.go +++ b/protocol/chat.go @@ -2,7 +2,6 @@ package protocol import ( "crypto/ecdsa" - "crypto/sha1" "encoding/hex" "encoding/json" "errors" @@ -224,11 +223,6 @@ type ChatMembershipUpdate struct { Members []string `json:"members,omitempty"` } -func (u *ChatMembershipUpdate) setID() { - sum := sha1.Sum([]byte(u.Signature)) - u.ID = hex.EncodeToString(sum[:]) -} - // ChatMember represents a member who participates in a group chat type ChatMember struct { // ID is the hex encoded public key of the member @@ -288,15 +282,6 @@ func CreateGroupChat(timesource TimeSource) Chat { } } -func findChatByID(chatID string, chats []*Chat) *Chat { - for _, c := range chats { - if c.ID == chatID { - return c - } - } - return nil -} - func stringSliceToPublicKeys(slice []string, prefixed bool) ([]*ecdsa.PublicKey, error) { result := make([]*ecdsa.PublicKey, len(slice)) for idx, item := range slice { diff --git a/protocol/contact.go b/protocol/contact.go index f36cc62a8..29a9738dc 100644 --- a/protocol/contact.go +++ b/protocol/contact.go @@ -58,7 +58,7 @@ type Contact struct { SystemTags []string `json:"systemTags"` DeviceInfo []ContactDeviceInfo `json:"deviceInfo"` - TributeToTalk string `json:"tributeToTalk,omitEmpty"` + TributeToTalk string `json:"tributeToTalk,omitempty"` } func (c Contact) PublicKey() (*ecdsa.PublicKey, error) { diff --git a/protocol/datasync/datasync.go b/protocol/datasync/datasync.go index a620860ae..27181a702 100644 --- a/protocol/datasync/datasync.go +++ b/protocol/datasync/datasync.go @@ -14,14 +14,14 @@ import ( type DataSync struct { *datasyncnode.Node - // DataSyncNodeTransport is the implementation of the datasync transport interface. - *DataSyncNodeTransport + // NodeTransport is the implementation of the datasync transport interface. + *NodeTransport logger *zap.Logger sendingEnabled bool } -func New(node *datasyncnode.Node, transport *DataSyncNodeTransport, sendingEnabled bool, logger *zap.Logger) *DataSync { - return &DataSync{Node: node, DataSyncNodeTransport: transport, sendingEnabled: sendingEnabled, logger: logger} +func New(node *datasyncnode.Node, transport *NodeTransport, sendingEnabled bool, logger *zap.Logger) *DataSync { + return &DataSync{Node: node, NodeTransport: transport, sendingEnabled: sendingEnabled, logger: logger} } func (d *DataSync) Handle(sender *ecdsa.PublicKey, payload []byte) [][]byte { @@ -57,7 +57,7 @@ func (d *DataSync) add(publicKey *ecdsa.PublicKey, datasyncMessage datasyncproto Sender: datasyncpeer.PublicKeyToPeerID(*publicKey), Payload: datasyncMessage, } - d.DataSyncNodeTransport.AddPacket(packet) + d.NodeTransport.AddPacket(packet) } func unwrap(payload []byte) (datasyncPayload datasyncproto.Payload, err error) { diff --git a/protocol/datasync/peer/utils.go b/protocol/datasync/peer/utils.go index 31042bee0..6ab53469e 100644 --- a/protocol/datasync/peer/utils.go +++ b/protocol/datasync/peer/utils.go @@ -3,9 +3,9 @@ package peer import ( "crypto/ecdsa" - "github.com/status-im/status-go/eth-node/crypto" - "github.com/vacp2p/mvds/state" + + "github.com/status-im/status-go/eth-node/crypto" ) func PublicKeyToPeerID(k ecdsa.PublicKey) state.PeerID { @@ -14,6 +14,6 @@ func PublicKeyToPeerID(k ecdsa.PublicKey) state.PeerID { return p } -func PeerIDToPublicKey(p state.PeerID) (*ecdsa.PublicKey, error) { +func IDToPublicKey(p state.PeerID) (*ecdsa.PublicKey, error) { return crypto.UnmarshalPubkey(p[:]) } diff --git a/protocol/datasync/transport.go b/protocol/datasync/transport.go index f193870df..6daa7a38d 100644 --- a/protocol/datasync/transport.go +++ b/protocol/datasync/transport.go @@ -15,30 +15,30 @@ import ( var errNotInitialized = errors.New("Datasync transport not initialized") -type DataSyncNodeTransport struct { +type NodeTransport struct { packets chan transport.Packet dispatch func(context.Context, *ecdsa.PublicKey, []byte, *protobuf.Payload) error } -func NewDataSyncNodeTransport() *DataSyncNodeTransport { - return &DataSyncNodeTransport{ +func NewNodeTransport() *NodeTransport { + return &NodeTransport{ packets: make(chan transport.Packet), } } -func (t *DataSyncNodeTransport) Init(dispatch func(context.Context, *ecdsa.PublicKey, []byte, *protobuf.Payload) error) { +func (t *NodeTransport) Init(dispatch func(context.Context, *ecdsa.PublicKey, []byte, *protobuf.Payload) error) { t.dispatch = dispatch } -func (t *DataSyncNodeTransport) AddPacket(p transport.Packet) { +func (t *NodeTransport) AddPacket(p transport.Packet) { t.packets <- p } -func (t *DataSyncNodeTransport) Watch() transport.Packet { +func (t *NodeTransport) Watch() transport.Packet { return <-t.packets } -func (t *DataSyncNodeTransport) Send(_ state.PeerID, peer state.PeerID, payload protobuf.Payload) error { +func (t *NodeTransport) Send(_ state.PeerID, peer state.PeerID, payload protobuf.Payload) error { if t.dispatch == nil { return errNotInitialized } @@ -48,7 +48,7 @@ func (t *DataSyncNodeTransport) Send(_ state.PeerID, peer state.PeerID, payload return err } - publicKey, err := datasyncpeer.PeerIDToPublicKey(peer) + publicKey, err := datasyncpeer.IDToPublicKey(peer) if err != nil { return err } diff --git a/protocol/ens.go b/protocol/ens.go index 2166be49e..984e4939d 100644 --- a/protocol/ens.go +++ b/protocol/ens.go @@ -5,11 +5,11 @@ import ( "strings" ) -// maxRetries is the maximum number of attemps we do before giving up +// maxRetries is the maximum number of attempts we do before giving up const maxRetries uint64 = 11 // ENSBackoffTimeMs is the step of the exponential backoff -// we retry roughtly for 17 hours after receiving the message 2^11 * 30000 +// we retry roughly for 17 hours after receiving the message 2^11 * 30000 const ENSBackoffTimeMs uint64 = 30000 // We calculate if it's too early to retry, by exponentially backing off diff --git a/protocol/go.mod b/protocol/go.mod deleted file mode 100644 index a9010509b..000000000 --- a/protocol/go.mod +++ /dev/null @@ -1,31 +0,0 @@ -module github.com/status-im/status-go/protocol - -go 1.13 - -replace github.com/ethereum/go-ethereum v1.9.5 => github.com/status-im/go-ethereum v1.9.5-status.7 - -replace github.com/gomarkdown/markdown v0.0.0-20191209105822-e3ba6c6109ba => github.com/status-im/markdown v0.0.0-20191209105822-e3ba6c6109ba - -replace github.com/status-im/status-go/eth-node => ../eth-node - -replace github.com/status-im/status-go/whisper/v6 => ../whisper - -require ( - github.com/cenkalti/backoff/v3 v3.0.0 - github.com/ethereum/go-ethereum v1.9.5 - github.com/golang/protobuf v1.3.2 - github.com/gomarkdown/markdown v0.0.0-20191209105822-e3ba6c6109ba - github.com/google/uuid v1.1.1 - github.com/jinzhu/copier v0.0.0-20190625015134-976e0346caa8 - github.com/lucasb-eyer/go-colorful v1.0.2 - github.com/mutecomm/go-sqlcipher v0.0.0-20190227152316-55dbde17881f - github.com/pkg/errors v0.8.1 - github.com/russolsen/transit v0.0.0-20180705123435-0794b4c4505a - github.com/status-im/doubleratchet v3.0.0+incompatible - github.com/status-im/migrate/v4 v4.6.2-status.2 - github.com/status-im/status-go/eth-node v1.1.0 - github.com/status-im/status-go/whisper/v6 v6.1.0 - github.com/stretchr/testify v1.4.0 - github.com/vacp2p/mvds v0.0.23 - go.uber.org/zap v1.13.0 -) diff --git a/protocol/go.sum b/protocol/go.sum deleted file mode 100644 index 7620481b2..000000000 --- a/protocol/go.sum +++ /dev/null @@ -1,832 +0,0 @@ -bazil.org/fuse v0.0.0-20160811212531-371fbbdaa898/go.mod h1:Xbm+BRKSBEpa4q4hTSxohYNQpsxXPbPry4JJWOB3LB8= -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.37.4/go.mod h1:NHPJ89PdicEuT9hdPXMROBD91xc5uRDxsMtSB16k7hw= -github.com/AndreasBriese/bbloom v0.0.0-20180913140656-343706a395b7/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8= -github.com/AndreasBriese/bbloom v0.0.0-20190306092124-e2d15f34fcf9/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8= -github.com/Azure/azure-pipeline-go v0.0.0-20180607212504-7571e8eb0876/go.mod h1:XA1kFWRVhSK+KNFiOhfv83Fv8L9achrP7OxIzeTn1Yg= -github.com/Azure/azure-storage-blob-go v0.0.0-20180712005634-eaae161d9d5e/go.mod h1:x2mtS6O3mnMEZOJp7d7oldh8IvatBrMfReiyQ+cKgKY= -github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8= -github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/DATA-DOG/go-sqlmock v1.3.3 h1:CWUqKXe0s8A2z6qCgkP4Kru7wC11YoAnoupUKFDnH08= -github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= -github.com/DataDog/zstd v1.3.6-0.20190409195224-796139022798/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= -github.com/Julusian/godocdown v0.0.0-20170816220326-6d19f8ff2df8/go.mod h1:INZr5t32rG59/5xeltqoCJoNY7e5x/3xoY9WSWVWg74= -github.com/Kubuxu/go-os-helper v0.0.1/go.mod h1:N8B+I7vPCT80IcP58r50u4+gEEcsZETFUpAzWW2ep1Y= -github.com/Microsoft/go-winio v0.4.11/go.mod h1:VhR8bwka0BXejwEJY73c50VrPtXAaKcyvVC4A4RozmA= -github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5/go.mod h1:lmUJ/7eu/Q8D7ML55dXQrVaamCz2vxCfdQBasLZfHKk= -github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= -github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= -github.com/Shopify/sarama v1.23.1/go.mod h1:XLH1GYJnLVE0XCr6KdJGVJRTwY30moWNJ4sERjXX6fs= -github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= -github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= -github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 h1:JYp7IbQjafoB+tBA3gMyHYHrpOtNuDiK/uB5uXxq5wM= -github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4 h1:Hs82Z41s6SdL1CELW+XaDYmOH4hkBN4/N9og/AsOv7E= -github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/allegro/bigcache v0.0.0-20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= -github.com/allegro/bigcache v1.1.0/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= -github.com/allegro/bigcache v1.2.0 h1:qDaE0QoF29wKBb3+pXFrJFy1ihe5OT9OiXhg1t85SxM= -github.com/allegro/bigcache v1.2.0/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= -github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= -github.com/apilayer/freegeoip v3.5.0+incompatible/go.mod h1:CUfFqErhFhXneJendyQ/rRcuA8kH8JxHvYnbOozmlCU= -github.com/aristanetworks/fsnotify v1.4.2/go.mod h1:D/rtu7LpjYM8tRJphJ0hUBYpjai8SfX+aSNsWDTq/Ks= -github.com/aristanetworks/glog v0.0.0-20180419172825-c15b03b3054f/go.mod h1:KASm+qXFKs/xjSoWn30NrWBBvdTTQq+UjkhjEJHfSFA= -github.com/aristanetworks/goarista v0.0.0-20170210015632-ea17b1a17847/go.mod h1:D/tb0zPVXnP7fmsLZjtdUhSsumbK/ij54UXjjVgMGxQ= -github.com/aristanetworks/goarista v0.0.0-20181002214814-33151c4543a7/go.mod h1:D/tb0zPVXnP7fmsLZjtdUhSsumbK/ij54UXjjVgMGxQ= -github.com/aristanetworks/goarista v0.0.0-20190219163901-728bce664cf5 h1:L0TwgZQo7Mga9im6FvKEZGIvyLE/VG/HI5loz5LpvC0= -github.com/aristanetworks/goarista v0.0.0-20190219163901-728bce664cf5/go.mod h1:D/tb0zPVXnP7fmsLZjtdUhSsumbK/ij54UXjjVgMGxQ= -github.com/aristanetworks/goarista v0.0.0-20190502180301-283422fc1708 h1:tS7jSmwRqSxTnonTRlDD1oHo6Q9YOK4xHS9/v4L56eg= -github.com/aristanetworks/goarista v0.0.0-20190502180301-283422fc1708/go.mod h1:D/tb0zPVXnP7fmsLZjtdUhSsumbK/ij54UXjjVgMGxQ= -github.com/aristanetworks/goarista v0.0.0-20191106175434-873d404c7f40 h1:ZdRuixFqR3mfx4FHzclG3COrRgWrYq0VhNgIoYoObcM= -github.com/aristanetworks/goarista v0.0.0-20191106175434-873d404c7f40/go.mod h1:Z4RTxGAuYhPzcq8+EdRM+R8M48Ssle2TsWtwRKa+vns= -github.com/aristanetworks/splunk-hec-go v0.3.3/go.mod h1:1VHO9r17b0K7WmOlLb9nTk/2YanvOEnLMUgsFrxBROc= -github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= -github.com/aws/aws-sdk-go v1.17.7/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= -github.com/beevik/ntp v0.2.0/go.mod h1:hIHWr+l3+/clUnF44zdK+CWW7fO8dR5cIylAQ76NRpg= -github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= -github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= -github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= -github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= -github.com/bitly/go-hostpool v0.0.0-20171023180738-a3a6125de932/go.mod h1:NOuUCSz6Q9T7+igc/hlvDOUdtWKryOrtFyIVABv/p7k= -github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4= -github.com/btcsuite/btcd v0.0.0-20181013004428-67e573d211ac/go.mod h1:Dmm/EzmjnCiweXmzRIAiUWCInVmPgjkzgv5k4tVyXiQ= -github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8= -github.com/btcsuite/btcd v0.0.0-20190418232430-6867ff32788a/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8= -github.com/btcsuite/btcd v0.0.0-20190523000118-16327141da8c/go.mod h1:3J08xEfcugPacsc34/LKRU2yO7YmuT8yt28J8k2+rrI= -github.com/btcsuite/btcd v0.0.0-20190824003749-130ea5bddde3/go.mod h1:3J08xEfcugPacsc34/LKRU2yO7YmuT8yt28J8k2+rrI= -github.com/btcsuite/btcd v0.20.0-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= -github.com/btcsuite/btcd v0.20.1-beta h1:Ik4hyJqN8Jfyv3S4AGBOmyouMsYE3EdYODkMbQjwPGw= -github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= -github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= -github.com/btcsuite/btcutil v0.0.0-20190207003914-4c204d697803/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= -github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d h1:yJzD/yFppdVCf6ApMkVy8cUxV0XrxdP9rVf6D87/Mng= -github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= -github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= -github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= -github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= -github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= -github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= -github.com/cenkalti/backoff/v3 v3.0.0 h1:ske+9nBpD9qZsTBoF41nW5L+AIuFBKMeze18XQ3eG1c= -github.com/cenkalti/backoff/v3 v3.0.0/go.mod h1:cIeZDE3IrqwwJl6VUwCN6trj1oXrTS4rc0ij+ULvLYs= -github.com/cespare/cp v0.1.0/go.mod h1:SOGHArjBr4JWaSDEVpWpo/hNg6RoKrls6Oh40hiwW+s= -github.com/cespare/cp v1.1.1 h1:nCb6ZLdB7NRaqsm91JtQTAme2SKJzXVsdPIPkyJr1MU= -github.com/cespare/cp v1.1.1/go.mod h1:SOGHArjBr4JWaSDEVpWpo/hNg6RoKrls6Oh40hiwW+s= -github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= -github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= -github.com/cespare/xxhash/v2 v2.1.0 h1:yTUvW7Vhb89inJ+8irsUqiWjh8iT6sQPZiQzI6ReGkA= -github.com/cespare/xxhash/v2 v2.1.0/go.mod h1:dgIUBU3pDso/gPgZ1osOZ0iQf77oPR28Tjxl5dIMyVM= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ= -github.com/cockroachdb/cockroach-go v0.0.0-20181001143604-e0a95dfd547c/go.mod h1:XGLbWH/ujMcbPbhZq52Nv6UrCghb1yGn//133kEsvDk= -github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= -github.com/containerd/containerd v1.2.7/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= -github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= -github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= -github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= -github.com/cznic/b v0.0.0-20180115125044-35e9bbe41f07/go.mod h1:URriBxXwVq5ijiJ12C7iIZqlA69nTlI+LgI6/pwftG8= -github.com/cznic/fileutil v0.0.0-20180108211300-6a051e75936f/go.mod h1:8S58EK26zhXSxzv7NQFpnliaOQsmDUxvoQO3rt154Vg= -github.com/cznic/golex v0.0.0-20170803123110-4ab7c5e190e4/go.mod h1:+bmmJDNmKlhWNG+gwWCkaBoTy39Fs+bzRxVBzoTQbIc= -github.com/cznic/internal v0.0.0-20180608152220-f44710a21d00/go.mod h1:olo7eAdKwJdXxb55TKGLiJ6xt1H0/tiiRCWKVLmtjY4= -github.com/cznic/lldb v1.1.0/go.mod h1:FIZVUmYUVhPwRiPzL8nD/mpFcJ/G7SSXjjXYG4uRI3A= -github.com/cznic/mathutil v0.0.0-20180504122225-ca4c9f2c1369/go.mod h1:e6NPNENfs9mPDVNRekM7lKScauxd5kXTr1Mfyig6TDM= -github.com/cznic/ql v1.2.0/go.mod h1:FbpzhyZrqr0PVlK6ury+PoW3T0ODUV22OeWIxcaOrSE= -github.com/cznic/sortutil v0.0.0-20150617083342-4c7342852e65/go.mod h1:q2w6Bg5jeox1B+QkJ6Wp/+Vn0G/bo3f1uY7Fn3vivIQ= -github.com/cznic/strutil v0.0.0-20171016134553-529a34b1c186/go.mod h1:AHHPPPXTw0h6pVabbcbyGRK1DckRn7r/STdZEeIDzZc= -github.com/cznic/zappy v0.0.0-20160723133515-2533cb5b45cc/go.mod h1:Y1SNZ4dRUOKXshKUbwUapqNncRrho4mkjQebgEHZLj8= -github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/deckarep/golang-set v0.0.0-20180603214616-504e848d77ea/go.mod h1:93vsz/8Wt4joVM7c2AVqh+YRMiUSc14yDtF28KmMOgQ= -github.com/deckarep/golang-set v1.7.1 h1:SCQV0S6gTtp6itiFrTqI+pfmJ4LN85S1YzhDf9rTHJQ= -github.com/deckarep/golang-set v1.7.1/go.mod h1:93vsz/8Wt4joVM7c2AVqh+YRMiUSc14yDtF28KmMOgQ= -github.com/denisenkom/go-mssqldb v0.0.0-20190515213511-eb9f6a1743f3/go.mod h1:zAg7JM8CkOJ43xKXIj7eRO9kmWm/TW578qo+oDO6tuM= -github.com/dgraph-io/badger v1.5.5-0.20190226225317-8115aed38f8f/go.mod h1:VZxzAIRPHRVNRKRo6AXrX9BJegn6il06VMTZVJYCIjQ= -github.com/dgraph-io/badger v1.6.0-rc1/go.mod h1:zwt7syl517jmP8s94KqSxTlM6IMsdhYy6psNgSztDR4= -github.com/dgrijalva/jwt-go v0.0.0-20170201225849-2268707a8f08/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= -github.com/dgryski/go-farm v0.0.0-20190104051053-3adb47b1fb0f/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= -github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= -github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= -github.com/dhui/dktest v0.3.0/go.mod h1:cyzIUfGsBEbZ6BT7tnXqAShHSXCZhSNmFl70sZ7c1yc= -github.com/docker/distribution v2.7.0+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= -github.com/docker/docker v0.0.0-20180625184442-8e610b2b55bf/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= -github.com/docker/docker v0.7.3-0.20190103212154-2b7e084dc98b/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= -github.com/docker/docker v0.7.3-0.20190817195342-4760db040282/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= -github.com/docker/docker v1.13.1/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= -github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= -github.com/docker/go-units v0.3.3/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= -github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -github.com/dvyukov/go-fuzz v0.0.0-20191022152526-8cb203812681/go.mod h1:11Gm+ccJnvAhCNLlf5+cS9KjtbaD5I5zaZpFMsTHWTw= -github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= -github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= -github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= -github.com/edsrzf/mmap-go v0.0.0-20160512033002-935e0e8a636c/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= -github.com/edsrzf/mmap-go v0.0.0-20170320065105-0bce6a688712/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= -github.com/edsrzf/mmap-go v1.0.0 h1:CEBF7HpRnUCSJgGUb5h1Gm7e3VkmVDrR8lvWVLtrOFw= -github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= -github.com/elastic/gosigar v0.0.0-20180330100440-37f05ff46ffa/go.mod h1:cdorVVzy1fhmEqmtgqkoE3bYtCfSCkVyjTyCIo22xvs= -github.com/elastic/gosigar v0.10.4 h1:6jfw75dsoflhBMRdO6QPzQUgLqUYTsQQQRkkcsHsuPo= -github.com/elastic/gosigar v0.10.4/go.mod h1:cdorVVzy1fhmEqmtgqkoE3bYtCfSCkVyjTyCIo22xvs= -github.com/elastic/gosigar v0.10.5 h1:GzPQ+78RaAb4J63unidA/JavQRKrB6s8IOzN6Ib59jo= -github.com/elastic/gosigar v0.10.5/go.mod h1:cdorVVzy1fhmEqmtgqkoE3bYtCfSCkVyjTyCIo22xvs= -github.com/elazarl/go-bindata-assetfs v1.0.0/go.mod h1:v+YaWX3bdea5J/mo8dSETolEo7R71Vk1u8bnjau5yw4= -github.com/ethereum/go-ethereum v1.8.20/go.mod h1:PwpWDrCLZrV+tfrhqqF6kPknbISMHaJv9Ln3kPCZLwY= -github.com/ethereum/go-ethereum v1.9.2/go.mod h1:PwpWDrCLZrV+tfrhqqF6kPknbISMHaJv9Ln3kPCZLwY= -github.com/ethereum/go-ethereum v1.9.9 h1:jnoBvjH8aMH++iH14XmiJdAsnRcmZUM+B5fsnEZBVE0= -github.com/fatih/color v1.3.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= -github.com/fjl/memsize v0.0.0-20180418122429-ca190fb6ffbc/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0= -github.com/fjl/memsize v0.0.0-20180929194037-2a09253e352a h1:1znxn4+q2MrEdTk1eCk6KIV3muTYVclBIB6CTVR/zBc= -github.com/fjl/memsize v0.0.0-20180929194037-2a09253e352a/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0= -github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/fsouza/fake-gcs-server v1.7.0/go.mod h1:5XIRs4YvwNbNoz+1JF8j6KLAyDh7RHGAyAK3EP2EsNk= -github.com/garyburd/redigo v1.6.0/go.mod h1:NR3MbYisc3/PwhQ00EMzDiPmrwpPxAn5GI05/YaO1SY= -github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff h1:tY80oXqGNY4FhTFhk+o9oFHGINQ/+vhlm8HFzi6znCI= -github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= -github.com/gballet/go-libpcsclite v0.0.0-20191108122812-4678299bea08 h1:f6D9Hr8xV8uYKlyuj8XIruxlh9WjVjdh1gIicAS7ays= -github.com/gballet/go-libpcsclite v0.0.0-20191108122812-4678299bea08/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= -github.com/gizak/termui v0.0.0-20170117222342-991cd3d38091/go.mod h1:PkJoWUt/zacQKysNfQtcw1RW+eK2SxkieVBtl+4ovLA= -github.com/go-check/check v0.0.0-20180628173108-788fd7840127/go.mod h1:9ES+weclKsC9YodN5RgxqK/VD9HM9JsCSh7rNhMZE98= -github.com/go-kit/kit v0.8.0 h1:Wz+5lgoB0kkuqLEc6NVmwRknTKP6dTGbSqvhZtBI/j0= -github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-kit/kit v0.9.0 h1:wDJmvq38kDhkVxi50ni9ykkdUr1PKgqKOoi01fa0Mdk= -github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-logfmt/logfmt v0.3.0 h1:8HUsc87TaSWLKwrnumgC8/YconD2fJQsRJAsWaPg2ic= -github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= -github.com/go-logfmt/logfmt v0.4.0 h1:MP4Eh7ZCb31lleYCFuwm0oe4/YGak+5l1vA2NOE80nA= -github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= -github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8= -github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q= -github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= -github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD876Lmtgy7VtROAbHHXk8no= -github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= -github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= -github.com/go-stack/stack v1.5.4/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= -github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/gocql/gocql v0.0.0-20190301043612-f6df8288f9b4/go.mod h1:4Fw1eo5iaEhDUs8XyuhSVCVy52Jq3L+/3GJgYkwc+/0= -github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/gogo/protobuf v1.3.0/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= -github.com/golang-migrate/migrate/v4 v4.6.2 h1:LDDOHo/q1W5UDj6PbkxdCv7lv9yunyZHXvxuwDkGo3k= -github.com/golang-migrate/migrate/v4 v4.6.2/go.mod h1:JYi6reN3+Z734VZ0akNuyOJNcrg45ZL7LDBMW3WGJL0= -github.com/golang-migrate/migrate/v4 v4.7.0 h1:gONcHxHApDTKXDyLH/H97gEHmpu1zcnnbAaq2zgrPrs= -github.com/golang-migrate/migrate/v4 v4.7.0/go.mod h1:Qvut3N4xKWjoH3sokBccML6WyHSnggXm/DvMMnTsQIc= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/snappy v0.0.0-20170215233205-553a64147049/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4= -github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/gomarkdown/markdown v0.0.0-20191104174740-4d42851d4d5a h1:DsPLKbIJTzHsGplH4h3cqgd0OMoHLyICj9ZkoqQnUE0= -github.com/gomarkdown/markdown v0.0.0-20191104174740-4d42851d4d5a/go.mod h1:aii0r/K0ZnHv7G0KF7xy1v0A7s2Ljrb5byB7MO5p6TU= -github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ= -github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= -github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= -github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= -github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= -github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= -github.com/gorilla/mux v1.7.1/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= -github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= -github.com/gorilla/websocket v1.4.1 h1:q7AeDBpnBk8AogcD4DSag/Ukw/KV+YhzLj2bP5HvKCM= -github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/graph-gophers/graphql-go v0.0.0-20190724201507-010347b5f9e6/go.mod h1:Au3iQ8DvDis8hZ4q2OzRcaKYlAsPt+fYvib5q4nIqu4= -github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= -github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= -github.com/gyuho/goraph v0.0.0-20171001060514-a7a4454fd3eb/go.mod h1:NtSxZCD+s3sZFwbW6WceOcUD83HM9XD5OE2r4c0P8eg= -github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed/go.mod h1:tMWxXQ9wFIaZeTI9F+hmhFiGpFmhOHzyShyFUhRm0H4= -github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA= -github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= -github.com/hashicorp/go-multierror v1.0.0 h1:iVjPR7a6H0tWELX5NxNe7bYopibicUzc7uPribsnS6o= -github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= -github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/golang-lru v0.0.0-20160813221303-0a025b7e63ad/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.5.1 h1:0hERBMJE1eitiLkihrMvRVBYAkpHzc/J3QdDN+dAcgU= -github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= -github.com/howeyc/fsnotify v0.9.0/go.mod h1:41HzSPxBGeFRQKEEwgh49TRw/nKBsYZ2cF1OzPjSJsA= -github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/huin/goupnp v0.0.0-20161224104101-679507af18f3/go.mod h1:MZ2ZmwcBpvOoJ22IJsc7va19ZwoheaBk43rKg12SKag= -github.com/huin/goupnp v1.0.0 h1:wg75sLpL6DZqwHQN6E1Cfk6mtfzS45z8OV+ic+DtHRo= -github.com/huin/goupnp v1.0.0/go.mod h1:n9v9KO1tAxYH82qOn+UTIFQDmx5n1Zxd/ClZDMX7Bnc= -github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150/go.mod h1:PpLOETDnJ0o3iZrZfqZzyLl6l7F3c6L1oWn7OICBi6o= -github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= -github.com/influxdata/influxdb v0.0.0-20180221223340-01288bdb0883/go.mod h1:qZna6X/4elxqT3yI9iZYdZrWWdeFOOprn86kgg4+IzY= -github.com/influxdata/influxdb v1.7.7/go.mod h1:qZna6X/4elxqT3yI9iZYdZrWWdeFOOprn86kgg4+IzY= -github.com/influxdata/influxdb1-client v0.0.0-20190809212627-fc22c7df067e/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= -github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/ipfs/go-cid v0.0.2/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/ipfs/go-cid v0.0.3/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/ipfs/go-datastore v0.0.1/go.mod h1:d4KVXhMt913cLBEI/PXAy6ko+W7e9AhyAKBGh803qeE= -github.com/ipfs/go-detect-race v0.0.1/go.mod h1:8BNT7shDZPo99Q74BpGMK+4D8Mn4j46UU0LZ723meps= -github.com/ipfs/go-ds-badger v0.0.2/go.mod h1:Y3QpeSFWQf6MopLTiZD+VT6IC1yZqaGmjvRcKeSGij8= -github.com/ipfs/go-ds-badger v0.0.5/go.mod h1:g5AuuCGmr7efyzQhLL8MzwqcauPojGPUaHzfGTzuE3s= -github.com/ipfs/go-ds-leveldb v0.0.1/go.mod h1:feO8V3kubwsEF22n0YRQCffeb79OOYIykR4L04tMOYc= -github.com/ipfs/go-ipfs-delay v0.0.0-20181109222059-70721b86a9a8/go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw= -github.com/ipfs/go-ipfs-util v0.0.1/go.mod h1:spsl5z8KUnrve+73pOhSVZND1SIxPW5RyBCNzQxlJBc= -github.com/ipfs/go-log v0.0.1/go.mod h1:kL1d2/hzSpI0thNYjiKfjanbVNU+IIGA/WnNESY9leM= -github.com/jackc/fake v0.0.0-20150926172116-812a484cc733/go.mod h1:WrMFNQdiFJ80sQsxDoMokWK1W5TQtxBFNpzWTD84ibQ= -github.com/jackc/pgx v3.2.0+incompatible/go.mod h1:0ZGrqGqkRlliWnWB4zKnWtjbSWbGkVEFm4TeybAXq+I= -github.com/jackpal/gateway v1.0.5/go.mod h1:lTpwd4ACLXmpyiCTRtfiNyVnUmqT9RivzCDQetPfnjA= -github.com/jackpal/go-nat-pmp v0.0.0-20160603034137-1fa385a6f458/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= -github.com/jackpal/go-nat-pmp v1.0.1 h1:i0LektDkO1QlrTm/cSuP+PyBCDnYvjPLGl4LdWEMiaA= -github.com/jackpal/go-nat-pmp v1.0.1/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= -github.com/jackpal/go-nat-pmp v1.0.2 h1:KzKSgb7qkJvOUTqYl9/Hg/me3pWgBmERKrTGD7BdWus= -github.com/jackpal/go-nat-pmp v1.0.2/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= -github.com/jbenet/go-cienv v0.0.0-20150120210510-1bb1476777ec/go.mod h1:rGaEvXB4uRSZMmzKNLoXvTu1sfx+1kv/DojUlPrSZGs= -github.com/jbenet/go-cienv v0.1.0/go.mod h1:TqNnHUmJgXau0nCzC7kXWeotg3J9W34CUv5Djy1+FlA= -github.com/jbenet/go-temp-err-catcher v0.0.0-20150120210811-aac704a3f4f2/go.mod h1:8GXXJV31xl8whumTzdZsTt3RnUIiPqzkyf7mxToRCMs= -github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8/go.mod h1:Ly/wlsjFq/qrU3Rar62tu1gASgGw6chQbSh/XgIIXCY= -github.com/jbenet/goprocess v0.1.3/go.mod h1:5yspPrukOVuOLORacaBi858NqyClJPQxYZlqdZVfqY4= -github.com/jcmturner/gofork v0.0.0-20190328161633-dc7c13fece03/go.mod h1:MK8+TM0La+2rjBD4jE12Kj1pCCxK7d2LK/UM3ncEo0o= -github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/jinzhu/copier v0.0.0-20190625015134-976e0346caa8 h1:mGIXW/lubQ4B+3bXTLxcTMTjUNDqoF6T/HUW9LbFx9s= -github.com/jinzhu/copier v0.0.0-20190625015134-976e0346caa8/go.mod h1:yL958EeXv8Ylng6IfnvG4oflryUi3vgA3xPs9hmII1s= -github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= -github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= -github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= -github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= -github.com/julienschmidt/httprouter v0.0.0-20170430222011-975b5c4c7c21/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/kami-zh/go-capturer v0.0.0-20171211120116-e492ea43421d/go.mod h1:P2viExyCEfeWGU259JnaQ34Inuec4R38JCyBx2edgD0= -github.com/karalabe/hid v0.0.0-20181128192157-d815e0c1a2e2/go.mod h1:YvbcH+3Wo6XPs9nkgTY3u19KXLauXW+J5nB7hEHuX0A= -github.com/karalabe/usb v0.0.0-20190819132248-550797b1cad8 h1:VhnqxaTIudc9IWKx8uXRLnpdSb9noCEj+vHacjmhp68= -github.com/karalabe/usb v0.0.0-20190819132248-550797b1cad8/go.mod h1:Od972xHfMJowv7NGVDiWVxk2zxnWgjLlJzE+F4F7AGU= -github.com/karalabe/usb v0.0.0-20191104083709-911d15fe12a9 h1:ZHuwnjpP8LsVsUYqTqeVAI+GfDfJ6UNPrExZF+vX/DQ= -github.com/karalabe/usb v0.0.0-20191104083709-911d15fe12a9/go.mod h1:Od972xHfMJowv7NGVDiWVxk2zxnWgjLlJzE+F4F7AGU= -github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0/go.mod h1:1NbS8ALrpOvjt0rHPNLyCIeMtbizbir8U//inJ+zuB8= -github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= -github.com/klauspost/cpuid v1.2.1/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= -github.com/klauspost/reedsolomon v1.9.2/go.mod h1:CwCi+NUr9pqSVktrkN+Ondf06rkhYZ/pcNv7fu+8Un4= -github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/konsorten/go-windows-terminal-sequences v1.0.2 h1:DB17ag19krx9CFsz4o3enTrPXyIXCl+2iCXH/aMAp9s= -github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/koron/go-ssdp v0.0.0-20180514024734-4a0ed625a78b/go.mod h1:5Ky9EC2xfoUKUor0Hjgi2BJhCSXJfMOFlmyYrVKGQMk= -github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515 h1:T+h1c/A9Gawja4Y9mFVWj2vyii2bbUNDw3kt9VxK2EY= -github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kshvakov/clickhouse v1.3.5/go.mod h1:DMzX7FxRymoNkVgizH0DWAL8Cur7wHLgx3MUnGwJqpE= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y= -github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= -github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= -github.com/lib/pq v1.2.0 h1:LXpIM/LZ5xGFhOpXAQUIMM1HdyqzVYM13zNdjCEEcA0= -github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= -github.com/libp2p/go-addr-util v0.0.1/go.mod h1:4ac6O7n9rIAKB1dnd+s8IbbMXkt+oBpzX4/+RACcnlQ= -github.com/libp2p/go-buffer-pool v0.0.1/go.mod h1:xtyIz9PMobb13WaxR6Zo1Pd1zXJKYg0a8KiIvDp3TzQ= -github.com/libp2p/go-buffer-pool v0.0.2/go.mod h1:MvaB6xw5vOrDl8rYZGLFdKAuk/hRoRZd1Vi32+RXyFM= -github.com/libp2p/go-conn-security-multistream v0.1.0/go.mod h1:aw6eD7LOsHEX7+2hJkDxw1MteijaVcI+/eP2/x3J1xc= -github.com/libp2p/go-eventbus v0.1.0/go.mod h1:vROgu5cs5T7cv7POWlWxBaVLxfSegC5UGQf8A2eEmx4= -github.com/libp2p/go-flow-metrics v0.0.1/go.mod h1:Iv1GH0sG8DtYN3SVJ2eG221wMiNpZxBdp967ls1g+k8= -github.com/libp2p/go-libp2p v0.1.1/go.mod h1:I00BRo1UuUSdpuc8Q2mN7yDF/oTUTRAX6JWpTiK9Rp8= -github.com/libp2p/go-libp2p v0.4.0/go.mod h1:9EsEIf9p2UDuwtPd0DwJsAl0qXVxgAnuDGRvHbfATfI= -github.com/libp2p/go-libp2p-autonat v0.1.0/go.mod h1:1tLf2yXxiE/oKGtDwPYWTSYG3PtvYlJmg7NeVtPRqH8= -github.com/libp2p/go-libp2p-blankhost v0.1.1/go.mod h1:pf2fvdLJPsC1FsVrNP3DUUvMzUts2dsLLBEpo1vW1ro= -github.com/libp2p/go-libp2p-blankhost v0.1.4/go.mod h1:oJF0saYsAXQCSfDq254GMNmLNz6ZTHTOvtF4ZydUvwU= -github.com/libp2p/go-libp2p-circuit v0.1.0/go.mod h1:Ahq4cY3V9VJcHcn1SBXjr78AbFkZeIRmfunbA7pmFh8= -github.com/libp2p/go-libp2p-circuit v0.1.3/go.mod h1:Xqh2TjSy8DD5iV2cCOMzdynd6h8OTBGoV1AWbWor3qM= -github.com/libp2p/go-libp2p-core v0.0.1/go.mod h1:g/VxnTZ/1ygHxH3dKok7Vno1VfpvGcGip57wjTU4fco= -github.com/libp2p/go-libp2p-core v0.0.3/go.mod h1:j+YQMNz9WNSkNezXOsahp9kwZBKBvxLpKD316QWSJXE= -github.com/libp2p/go-libp2p-core v0.0.4/go.mod h1:jyuCQP356gzfCFtRKyvAbNkyeuxb7OlyhWZ3nls5d2I= -github.com/libp2p/go-libp2p-core v0.2.0/go.mod h1:X0eyB0Gy93v0DZtSYbEM7RnMChm9Uv3j7yRXjO77xSI= -github.com/libp2p/go-libp2p-core v0.2.2/go.mod h1:8fcwTbsG2B+lTgRJ1ICZtiM5GWCWZVoVrLaDRvIRng0= -github.com/libp2p/go-libp2p-core v0.2.3/go.mod h1:GqhyQqyIAPsxFYXHMjfXgMv03lxsvM0mFzuYA9Ib42A= -github.com/libp2p/go-libp2p-crypto v0.1.0/go.mod h1:sPUokVISZiy+nNuTTH/TY+leRSxnFj/2GLjtOTW90hI= -github.com/libp2p/go-libp2p-discovery v0.1.0/go.mod h1:4F/x+aldVHjHDHuX85x1zWoFTGElt8HnoDzwkFZm29g= -github.com/libp2p/go-libp2p-loggables v0.1.0/go.mod h1:EyumB2Y6PrYjr55Q3/tiJ/o3xoDasoRYM7nOzEpoa90= -github.com/libp2p/go-libp2p-mplex v0.2.0/go.mod h1:Ejl9IyjvXJ0T9iqUTE1jpYATQ9NM3g+OtR+EMMODbKo= -github.com/libp2p/go-libp2p-mplex v0.2.1/go.mod h1:SC99Rxs8Vuzrf/6WhmH41kNn13TiYdAWNYHrwImKLnE= -github.com/libp2p/go-libp2p-nat v0.0.4/go.mod h1:N9Js/zVtAXqaeT99cXgTV9e75KpnWCvVOiGzlcHmBbY= -github.com/libp2p/go-libp2p-netutil v0.1.0/go.mod h1:3Qv/aDqtMLTUyQeundkKsA+YCThNdbQD54k3TqjpbFU= -github.com/libp2p/go-libp2p-peer v0.2.0/go.mod h1:RCffaCvUyW2CJmG2gAWVqwePwW7JMgxjsHm7+J5kjWY= -github.com/libp2p/go-libp2p-peerstore v0.1.0/go.mod h1:2CeHkQsr8svp4fZ+Oi9ykN1HBb6u0MOvdJ7YIsmcwtY= -github.com/libp2p/go-libp2p-peerstore v0.1.3/go.mod h1:BJ9sHlm59/80oSkpWgr1MyY1ciXAXV397W6h1GH/uKI= -github.com/libp2p/go-libp2p-secio v0.1.0/go.mod h1:tMJo2w7h3+wN4pgU2LSYeiKPrfqBgkOsdiKK77hE7c8= -github.com/libp2p/go-libp2p-secio v0.2.0/go.mod h1:2JdZepB8J5V9mBp79BmwsaPQhRPNN2NrnB2lKQcdy6g= -github.com/libp2p/go-libp2p-swarm v0.1.0/go.mod h1:wQVsCdjsuZoc730CgOvh5ox6K8evllckjebkdiY5ta4= -github.com/libp2p/go-libp2p-swarm v0.2.2/go.mod h1:fvmtQ0T1nErXym1/aa1uJEyN7JzaTNyBcHImCxRpPKU= -github.com/libp2p/go-libp2p-testing v0.0.2/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= -github.com/libp2p/go-libp2p-testing v0.0.3/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= -github.com/libp2p/go-libp2p-testing v0.0.4/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= -github.com/libp2p/go-libp2p-testing v0.1.0/go.mod h1:xaZWMJrPUM5GlDBxCeGUi7kI4eqnjVyavGroI2nxEM0= -github.com/libp2p/go-libp2p-transport-upgrader v0.1.1/go.mod h1:IEtA6or8JUbsV07qPW4r01GnTenLW4oi3lOPbUMGJJA= -github.com/libp2p/go-libp2p-yamux v0.2.0/go.mod h1:Db2gU+XfLpm6E4rG5uGCFX6uXA8MEXOxFcRoXUODaK8= -github.com/libp2p/go-libp2p-yamux v0.2.1/go.mod h1:1FBXiHDk1VyRM1C0aez2bCfHQ4vMZKkAQzZbkSQt5fI= -github.com/libp2p/go-maddr-filter v0.0.4/go.mod h1:6eT12kSQMA9x2pvFQa+xesMKUBlj9VImZbj3B9FBH/Q= -github.com/libp2p/go-maddr-filter v0.0.5/go.mod h1:Jk+36PMfIqCJhAnaASRH83bdAvfDRp/w6ENFaC9bG+M= -github.com/libp2p/go-mplex v0.0.3/go.mod h1:pK5yMLmOoBR1pNCqDlA2GQrdAVTMkqFalaTWe7l4Yd0= -github.com/libp2p/go-mplex v0.1.0/go.mod h1:SXgmdki2kwCUlCCbfGLEgHjC4pFqhTp0ZoV6aiKgxDU= -github.com/libp2p/go-msgio v0.0.2/go.mod h1:63lBBgOTDKQL6EWazRMCwXsEeEeK9O2Cd+0+6OOuipQ= -github.com/libp2p/go-msgio v0.0.4/go.mod h1:63lBBgOTDKQL6EWazRMCwXsEeEeK9O2Cd+0+6OOuipQ= -github.com/libp2p/go-nat v0.0.3/go.mod h1:88nUEt0k0JD45Bk93NIwDqjlhiOwOoV36GchpcVc1yI= -github.com/libp2p/go-openssl v0.0.2/go.mod h1:v8Zw2ijCSWBQi8Pq5GAixw6DbFfa9u6VIYDXnvOXkc0= -github.com/libp2p/go-reuseport v0.0.1/go.mod h1:jn6RmB1ufnQwl0Q1f+YxAj8isJgDCQzaaxIFYDhcYEA= -github.com/libp2p/go-reuseport-transport v0.0.2/go.mod h1:YkbSDrvjUVDL6b8XqriyA20obEtsW9BLkuOUyQAOCbs= -github.com/libp2p/go-stream-muxer v0.0.1/go.mod h1:bAo8x7YkSpadMTbtTaxGVHWUQsR/l5MEaHbKaliuT14= -github.com/libp2p/go-stream-muxer-multistream v0.2.0/go.mod h1:j9eyPol/LLRqT+GPLSxvimPhNph4sfYfMoDPd7HkzIc= -github.com/libp2p/go-tcp-transport v0.1.0/go.mod h1:oJ8I5VXryj493DEJ7OsBieu8fcg2nHGctwtInJVpipc= -github.com/libp2p/go-tcp-transport v0.1.1/go.mod h1:3HzGvLbx6etZjnFlERyakbaYPdfjg2pWP97dFZworkY= -github.com/libp2p/go-ws-transport v0.1.0/go.mod h1:rjw1MG1LU9YDC6gzmwObkPd/Sqwhw7yT74kj3raBFuo= -github.com/libp2p/go-ws-transport v0.1.2/go.mod h1:dsh2Ld8F+XNmzpkaAijmg5Is+e9l6/1tK/6VFOdN69Y= -github.com/libp2p/go-yamux v1.2.2/go.mod h1:FGTiPvoV/3DVdgWpX+tM0OW3tsM+W5bSE3gZwqQTcow= -github.com/libp2p/go-yamux v1.2.3/go.mod h1:FGTiPvoV/3DVdgWpX+tM0OW3tsM+W5bSE3gZwqQTcow= -github.com/lucasb-eyer/go-colorful v1.0.2 h1:mCMFu6PgSozg9tDNMMK3g18oJBX7oYGrC09mS6CXfO4= -github.com/lucasb-eyer/go-colorful v1.0.2/go.mod h1:0MS4r+7BZKSJ5mw4/S5MPN+qHFF1fYclkSPilDOKW0s= -github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= -github.com/maruel/panicparse v0.0.0-20160720141634-ad661195ed0e/go.mod h1:nty42YY5QByNC5MM7q/nj938VbgPU7avs45z6NClpxI= -github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= -github.com/mattn/go-colorable v0.1.0/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= -github.com/mattn/go-colorable v0.1.1 h1:G1f5SKeVxmagw/IyvzvtZE4Gybcc4Tr1tf7I8z0XgOg= -github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= -github.com/mattn/go-isatty v0.0.0-20180830101745-3fb116b82035/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/mattn/go-isatty v0.0.7 h1:UvyT9uN+3r7yLEYSlJsbQGdsaB/a0DlgWP3pql6iwOc= -github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/mattn/go-pointer v0.0.0-20190911064623-a0a44394634f/go.mod h1:2zXcozF6qYGgmsG+SeTZz3oAbFLdD3OWqnUbNvJZAlc= -github.com/mattn/go-runewidth v0.0.3/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= -github.com/mattn/go-runewidth v0.0.4 h1:2BvfKmzob6Bmd4YsL0zygOqfdFnK7GR4QL06Do4/p7Y= -github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= -github.com/mattn/go-sqlite3 v1.10.0 h1:jbhqpg7tQe4SupckyijYiy0mJJ/pRyHvXf7JdWK860o= -github.com/mattn/go-sqlite3 v1.10.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= -github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= -github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE= -github.com/miekg/dns v1.1.12/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/minio/sha256-simd v0.0.0-20190328051042-05b4dd3047e5 h1:l16XLUUJ34wIz+RIvLhSwGvLvKyy+W598b135bJN6mg= -github.com/minio/sha256-simd v0.0.0-20190328051042-05b4dd3047e5/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/minio/sha256-simd v0.1.0/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/minio/sha256-simd v0.1.1-0.20190913151208-6de447530771/go.mod h1:B5e1o+1/KgNmWrSQK08Y6Z1Vb5pwIktudl0J58iy0KM= -github.com/minio/sha256-simd v0.1.1 h1:5QHSlgo3nt5yKOJrC7W8w7X+NFl8cMPZm96iu8kKUJU= -github.com/minio/sha256-simd v0.1.1/go.mod h1:B5e1o+1/KgNmWrSQK08Y6Z1Vb5pwIktudl0J58iy0KM= -github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= -github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8= -github.com/morikuni/aec v0.0.0-20170113033406-39771216ff4c/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= -github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/mr-tron/base58 v1.1.1/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/mr-tron/base58 v1.1.2 h1:ZEw4I2EgPKDJ2iEw0cNmLB3ROrEmkOtXIkaG7wZg+78= -github.com/mr-tron/base58 v1.1.2/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= -github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA= -github.com/multiformats/go-multiaddr v0.0.1/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr v0.0.2/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr v0.0.4/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr v0.1.0/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr v0.1.1/go.mod h1:aMKBKNEYmzmDmxfX88/vz+J5IU55txyt0p4aiWVohjo= -github.com/multiformats/go-multiaddr-dns v0.0.1/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q= -github.com/multiformats/go-multiaddr-dns v0.0.2/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q= -github.com/multiformats/go-multiaddr-dns v0.1.0/go.mod h1:01k2RAqtoXIuPa3DCavAE9/6jc6nM0H3EgZyfUhN2oY= -github.com/multiformats/go-multiaddr-fmt v0.0.1/go.mod h1:aBYjqL4T/7j4Qx+R73XSv/8JsgnRFlf0w2KGLCmXl3Q= -github.com/multiformats/go-multiaddr-fmt v0.1.0/go.mod h1:hGtDIW4PU4BqJ50gW2quDuPVjyWNZxToGUh/HwTZYJo= -github.com/multiformats/go-multiaddr-net v0.0.1/go.mod h1:nw6HSxNmCIQH27XPGBuX+d1tnvM7ihcFwHMSstNAVUU= -github.com/multiformats/go-multiaddr-net v0.1.0/go.mod h1:5JNbcfBOP4dnhoZOv10JJVkJO0pCCEf8mTnipAo2UZQ= -github.com/multiformats/go-multibase v0.0.1/go.mod h1:bja2MqRZ3ggyXtZSEDKpl0uO/gviWFaSteVbWT51qgs= -github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= -github.com/multiformats/go-multihash v0.0.5 h1:1wxmCvTXAifAepIMyF39vZinRw5sbqjPs/UIi93+uik= -github.com/multiformats/go-multihash v0.0.5/go.mod h1:lt/HCbqlQwlPBz7lv0sQCdtfcMtlJvakRUn/0Ual8po= -github.com/multiformats/go-multihash v0.0.8 h1:wrYcW5yxSi3dU07n5jnuS5PrNwyHy0zRHGVoUugWvXg= -github.com/multiformats/go-multihash v0.0.8/go.mod h1:YSLudS+Pi8NHE7o6tb3D8vrpKa63epEDmG8nTduyAew= -github.com/multiformats/go-multistream v0.1.0/go.mod h1:fJTiDfXJVmItycydCnNx4+wSzZ5NwG2FEVAI30fiovg= -github.com/mutecomm/go-sqlcipher v0.0.0-20190227152316-55dbde17881f h1:hd3r+uv9DNLScbOrnlj82rBldHQf3XWmCeXAWbw8euQ= -github.com/mutecomm/go-sqlcipher v0.0.0-20190227152316-55dbde17881f/go.mod h1:MyUWrZlB1aI5bs7j9/pJ8ckLLZ4QcCYcNiSbsAW32D4= -github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/nakagami/firebirdsql v0.0.0-20190310045651-3c02a58cfed8/go.mod h1:86wM1zFnC6/uDBfZGNwB65O+pR2OFi5q/YQaEUid1qA= -github.com/naoina/toml v0.0.0-20170918210437-9fafd6967416/go.mod h1:NBIhNtsFMo3G2szEBne+bO4gS192HuIYRqfvOWb4i1E= -github.com/nsf/termbox-go v0.0.0-20170211012700-3540b76b9c77/go.mod h1:IuKpRQcYE1Tfu+oAQqaLisqDeXgjyyltCfsaoYN18NQ= -github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= -github.com/okzk/sdnotify v0.0.0-20180710141335-d9becc38acbd/go.mod h1:4soZNh0zW0LtYGdQ416i0jO0EIqMGcbtaspRS4BDvRQ= -github.com/olekukonko/tablewriter v0.0.0-20170128050532-febf2d34b54a/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= -github.com/olekukonko/tablewriter v0.0.1 h1:b3iUnf1v+ppJiOfNX4yxxqfWKMQPZR5yoh8urCTFX88= -github.com/olekukonko/tablewriter v0.0.1/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.7.0 h1:WSHQ+IS43OoUrWtD1/bbclrwK8TTH5hzp+umCiuxHgs= -github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.8.0 h1:VkHVNpR4iVnU8XQR6DBm8BqYjN7CRzw+xKUbVVbbW9w= -github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.10.1 h1:q/mM8GF/n0shIN8SaAZ0V+jnLPzen6WIVZdiwrRlMlo= -github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/gomega v1.4.3 h1:RE1xgDvH7imwFD45h+u2SgIfERHlS2yNG4DObb5BSKU= -github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/onsi/gomega v1.5.0 h1:izbySO9zDPmjJ8rDjLvkA2zJHIo+HkYXHnf7eN7SSyo= -github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/onsi/gomega v1.7.0 h1:XPnZz8VVBHjVsy1vzJmRwIcSwiUO+JFfrv/xGiigmME= -github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/openconfig/gnmi v0.0.0-20190823184014-89b2bf29312c/go.mod h1:t+O9It+LKzfOAhKTT5O0ehDix+MTqbtT0T9t+7zzOvc= -github.com/openconfig/reference v0.0.0-20190727015836-8dfd928c9696/go.mod h1:ym2A+zigScwkSEb/cVQB0/ZMpU3rqiH6X7WRRsxgOGw= -github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= -github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= -github.com/opentracing/opentracing-go v0.0.0-20180606204148-bd9c31933947/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw= -github.com/oschwald/maxminddb-golang v1.3.1/go.mod h1:3jhIUymTJ5VREKyIhWm66LJiQt04F0UCDdodShpjWsY= -github.com/pborman/uuid v0.0.0-20170112150404-1b00554d8222/go.mod h1:VyrYX9gd7irzKovcSS6BIIEwPRkP2Wm2m9ufcdFSJ34= -github.com/pborman/uuid v1.2.0 h1:J7Q5mO4ysT1dv8hyrUGHb9+ooztCXu1D8MY8DZYsu3g= -github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= -github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= -github.com/peterh/liner v0.0.0-20170902204657-a37ad3984311/go.mod h1:xIteQHvHuaLYG9IFj6mSxM0fCKrs34IrEQUhOYuGPHc= -github.com/pierrec/lz4 v0.0.0-20190327172049-315a67e90e41/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc= -github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= -github.com/pkg/errors v0.0.0-20171216070316-e881fd58d78e/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_golang v0.9.2/go.mod h1:OsXs2jCmiKlQ1lTBmv21f2mNfw4xf/QclQDMrYNZzcM= -github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs= -github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= -github.com/prometheus/client_golang v1.1.0/go.mod h1:I1FGZT9+L76gKKOs5djB6ezCbFQP1xR9D75/vuwEF3g= -github.com/prometheus/client_golang v1.2.1 h1:JnMpQc6ppsNgw9QPAGF6Dod479itz7lvlsMzzNayLOI= -github.com/prometheus/client_golang v1.2.1/go.mod h1:XMU6Z2MjaRKVu/dC1qupJI9SiNkDYzz3xecMgSW/F+U= -github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4 h1:gQz4mCbXsO+nc9n1hCxHcGA3Zx3Eo+UHZoInFGUIXNM= -github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/common v0.0.0-20181126121408-4724e9255275/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= -github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.6.0/go.mod h1:eBmuwkDJBwy6iBfxCBob6t6dR6ENT/y+J+Zk0j9GMYc= -github.com/prometheus/common v0.7.0 h1:L+1lyG48J1zAQXA3RBX/nG/B3gjlHq0zTt2tlbJLyCY= -github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA= -github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= -github.com/prometheus/procfs v0.0.3/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ= -github.com/prometheus/procfs v0.0.5 h1:3+auTFlqw+ZaQYJARz6ArODtkaIwtvBTx3N2NehQlL8= -github.com/prometheus/procfs v0.0.5/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ= -github.com/prometheus/prometheus v0.0.0-20170814170113-3101606756c5/go.mod h1:oAIUtOny2rjMX0OWN5vPR5/q/twIROJvdqnQKDdil/s= -github.com/prometheus/tsdb v0.10.0 h1:If5rVCMTp6W2SiRAQFlbpJNgVlgMEd+U2GZckwK38ic= -github.com/prometheus/tsdb v0.10.0/go.mod h1:oi49uRhEe9dPUTlS3JRZOwJuVi6tmh10QSgwXEyGCt4= -github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= -github.com/rjeczalik/notify v0.9.1/go.mod h1:rKwnCoCGeuQnwBtTSPL9Dad03Vh2n40ePRrjvIXnJho= -github.com/rjeczalik/notify v0.9.2 h1:MiTWrPj55mNDHEiIX5YUSKefw/+lCQVoAFmD6oQm5w8= -github.com/rjeczalik/notify v0.9.2/go.mod h1:aErll2f0sUX9PXZnVNyeiObbmTlk5jnMoCa4QEjJeqM= -github.com/robertkrimen/godocdown v0.0.0-20130622164427-0bfa04905481/go.mod h1:C9WhFzY47SzYBIvzFqSvHIR6ROgDo4TtdTuRaOMjF/s= -github.com/robertkrimen/otto v0.0.0-20170205013659-6a77b7cbc37d/go.mod h1:xvqspoSXJTIpemEonrMDFq6XzwHYYgToXWj5eRX1OtY= -github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rs/cors v0.0.0-20160617231935-a62a804a8a00/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= -github.com/rs/cors v1.6.0 h1:G9tHG9lebljV9mfp9SNPDL36nCDxmo3zTlAf1YgvzmI= -github.com/rs/cors v1.6.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= -github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik= -github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= -github.com/rs/xhandler v0.0.0-20160618193221-ed27b6fd6521/go.mod h1:RvLn4FgxWubrpZHtQLnOf6EwhN2hEMusxZOhcW9H3UQ= -github.com/russolsen/ohyeah v0.0.0-20160324131710-f4938c005315 h1:H3hCXwP92pH/hSgNrCLtjxvsKJ50sq26nICbZuoR1tQ= -github.com/russolsen/ohyeah v0.0.0-20160324131710-f4938c005315/go.mod h1:ZbKa3zlLnhGF1dAeJtMSoNtM5LgFQnqzq8eYH3uYYkU= -github.com/russolsen/same v0.0.0-20160222130632-f089df61f51d h1:A926QrjwToaPS7giC4UOBjHhdukq9l1Y15r3qkXYwCY= -github.com/russolsen/same v0.0.0-20160222130632-f089df61f51d/go.mod h1:Cpq811GTlHevuU6BZxk3ObOdK8AY5gHu9QGmDak0DT4= -github.com/russolsen/transit v0.0.0-20180705123435-0794b4c4505a h1:yVNJFSzkEG8smsvd9udiQcMJA0MIsFvlG7ba314cu+s= -github.com/russolsen/transit v0.0.0-20180705123435-0794b4c4505a/go.mod h1:TPq+fcJOdGrkpZpXF4UVmFjYxH0gGqnxdgZ+OzAmvJk= -github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= -github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= -github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24 h1:pntxY8Ary0t43dCZ5dqY4YTJCObLY1kIXl0uzMv+7DE= -github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4= -github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= -github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= -github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4= -github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= -github.com/smola/gocompat v0.2.0/go.mod h1:1B0MlxbmoZNo3h8guHp8HztB3BSYR5itql9qtVc0ypY= -github.com/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a/go.mod h1:7AyxJNCJ7SBZ1MfVQCWD6Uqo2oubI2Eq2y2eqf+A5r0= -github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572/go.mod h1:w0SWMsp6j9O/dk4/ZpIhL+3CkG8ofA2vuv7k+ltqUMc= -github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= -github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= -github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= -github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= -github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= -github.com/src-d/envconfig v1.0.0/go.mod h1:Q9YQZ7BKITldTBnoxsE5gOeB5y66RyPXeue/R4aaNBc= -github.com/status-im/doubleratchet v3.0.0+incompatible h1:aJ1ejcSERpSzmWZBgtfYtiU2nF0Q8ZkGyuEPYETXkCY= -github.com/status-im/doubleratchet v3.0.0+incompatible/go.mod h1:1sqR0+yhiM/bd+wrdX79AOt2csZuJOni0nUDzKNuqOU= -github.com/status-im/go-ethereum v1.9.5-status.6 h1:ytuTO1yBIAuTVRtRQoc2mrdyngtP+XOQ9IHIibbz7/I= -github.com/status-im/go-ethereum v1.9.5-status.6/go.mod h1:08JvQWE+IOnAFSe4UD4ACLNe2fDd9XmWMCq5Yzy9mk0= -github.com/status-im/go-ethereum v1.9.5-status.7 h1:DKH1GiF52LwaZaw6YDBliFEgm/JDsbIT+hn7ph6X94Q= -github.com/status-im/go-ethereum v1.9.5-status.7/go.mod h1:YyH5DKB6+z+Vaya7eIm67pnuPZ1oiUMbbsZW41ktN0g= -github.com/status-im/go-multiaddr-ethv4 v1.2.0/go.mod h1:2VQ3C+9zEurcceasz12gPAtmEzCeyLUGPeKLSXYQKHo= -github.com/status-im/keycard-go v0.0.0-20190424133014-d95853db0f48 h1:ju5UTwk5Odtm4trrY+4Ca4RMj5OyXbmVeDAVad2T0Jw= -github.com/status-im/keycard-go v0.0.0-20190424133014-d95853db0f48/go.mod h1:RZLeN1LMWmRsyYjvAu+I6Dm9QmlDaIIt+Y+4Kd7Tp+Q= -github.com/status-im/keycard-go v0.0.0-20191119114148-6dd40a46baa0 h1:5UdlDkkBoPrJfh7zkfoR3X5utJhNs/MCQysK3x0ycgg= -github.com/status-im/keycard-go v0.0.0-20191119114148-6dd40a46baa0/go.mod h1:RZLeN1LMWmRsyYjvAu+I6Dm9QmlDaIIt+Y+4Kd7Tp+Q= -github.com/status-im/markdown v0.0.0-20191209105822-e3ba6c6109ba h1:Ut2CKuG+L9eWFL7dTEPuLE+RKecUYBkDNhqXSIgY92U= -github.com/status-im/markdown v0.0.0-20191209105822-e3ba6c6109ba/go.mod h1:tmG2bxyvZ2EItDO5JewbdFvV45j13IYQgvnMJ3+qAaE= -github.com/status-im/migrate/v4 v4.6.2-status.2 h1:SdC+sMDl/aI7vUlwD2qj2p7KsK4T60IS9z4/rYCCbI8= -github.com/status-im/migrate/v4 v4.6.2-status.2/go.mod h1:c/kc90n47GZu/58nnz1OMLTf7uE4Da4gZP5qmU+A/v8= -github.com/status-im/rendezvous v1.3.0/go.mod h1:+hzjuP+j/XzLPeF6E50b88pWOTLdTcwjvNYt+Gh1W1s= -github.com/status-im/status-go v0.36.0 h1:91qDMJjHv+T3Li9FwxsWQ2JBVcYtvVDT0nGFSMnmM+8= -github.com/status-im/status-go v0.36.1 h1:nb9eTq0UQJ57YyTZSl5U05emFT+R4AW8/Bga6ocgOks= -github.com/status-im/status-go v0.37.3 h1:94/bOA8qrEIgWd23mSLN39SwUJwCu2TPQFV2HzSI2ZE= -github.com/status-im/status-go v0.37.3/go.mod h1:9qHQ2+8NS6ivPJS5YbsI3gWkr0t6DWmJzKnr4M7vudw= -github.com/status-im/status-go v0.38.0 h1:3toC1ToY48wbRBVt7CMWSSG5FZAcPPMlnt0+G6iCbcE= -github.com/status-im/status-go v0.38.0/go.mod h1:u3tlXqVkxAW35dui3LjHajIkbOaF4d4CnriJ8zhntOw= -github.com/status-im/status-go v0.38.5 h1:vnbGgk5+X5ZUmn3/gJ88GlaNaAO9kGVgm8E5mR0umiQ= -github.com/status-im/status-go v0.38.5/go.mod h1:UKxySGdqFuVPvCyPSYD0+zKeV2OzDijZqICvR+tZ3uM= -github.com/status-im/status-go/extkeys v1.0.0 h1:Qyirsoi5Ye5UFfisgPtCjPb/RkBxyK+UsSiEcr2PVlM= -github.com/status-im/status-go/extkeys v1.0.0/go.mod h1:GdqJbrcpkNm5ZsSCpp+PdMxnXx+OcRBdm3PI0rs1FpU= -github.com/status-im/status-go/protocol v1.0.1/go.mod h1:LpA7BsaNmj6EOdq7BwuqncewjPqIRHCletZOb2wlWrY= -github.com/status-im/status-go/waku v1.0.0 h1:XFcJ9Am1cK657dpUP/ysyCp+A99MWSvb1DVTtjo1fE8= -github.com/status-im/status-go/waku v1.0.0/go.mod h1:1bjvQAL4cJYtxCsm6DnKdJbxcZwnvvZmxb6pmoUDtuY= -github.com/status-im/tcp-shaker v0.0.0-20191114194237-215893130501/go.mod h1:RYo/itke1oU5k/6sj9DNM3QAwtE5rZSgg5JnkOv83hk= -github.com/status-im/whisper v1.5.2 h1:26NgiKusmPic38eQdtXnaY+iaQ/LuQ3Dh0kCGYT/Uxs= -github.com/status-im/whisper v1.5.2/go.mod h1:emrOxzJme0k66QtbbQ2bdd3P8RCdLZ8sTD7SkwH1s2s= -github.com/steakknife/bloomfilter v0.0.0-20180922174646-6819c0d2a570 h1:gIlAHnH1vJb5vwEjIp5kBj/eu99p/bl0Ay2goiPe5xE= -github.com/steakknife/bloomfilter v0.0.0-20180922174646-6819c0d2a570/go.mod h1:8OR4w3TdeIHIh1g6EMY5p0gVNOovcWC+1vpc7naMuAw= -github.com/steakknife/hamming v0.0.0-20180906055917-c99c65617cd3 h1:njlZPzLwU639dk2kqnCPPv+wNjq7Xb6EfUxe/oX0/NM= -github.com/steakknife/hamming v0.0.0-20180906055917-c99c65617cd3/go.mod h1:hpGUWaI9xL8pRQCTXQgocU38Qw1g0Us7n5PxxTwTCYU= -github.com/stephens2424/writerset v1.0.2/go.mod h1:aS2JhsMn6eA7e82oNmW4rfsgAOp9COBTTl8mzkwADnc= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1 h1:2vfRuCMp5sSVIDSqO8oNnWJq7mPa6KVP3iPIwFBuy8A= -github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.2.0 h1:Hbg2NidpLE8veEBkEZTL3CvlkUIVzuU9jDplZO54c48= -github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= -github.com/stretchr/testify v0.0.0-20170809224252-890a5c3458b4/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.3.1-0.20190712000136-221dbe5ed467/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/syndtr/goleveldb v0.0.0-20181128100959-b001fa50d6b2/go.mod h1:Z4AUp2Km+PwemOoO/VB5AOx9XSsIItzFjoJlOSiYmn0= -github.com/syndtr/goleveldb v1.0.0 h1:fBdIW9lB4Iz0n9khmH8w27SJ3QEJ7+IgjPEwGSZiFdE= -github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ= -github.com/templexxx/cpufeat v0.0.0-20180724012125-cef66df7f161/go.mod h1:wM7WEvslTq+iOEAMDLSzhVuOt5BRZ05WirO+b09GHQU= -github.com/templexxx/xor v0.0.0-20181023030647-4e92f724b73b/go.mod h1:5XA7W9S6mni3h5uvOC75dA3m9CCCaS83lltmc0ukdi4= -github.com/tidwall/pretty v0.0.0-20180105212114-65a9db5fad51/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= -github.com/tjfoc/gmsm v1.0.1/go.mod h1:XxO4hdhhrzAd+G4CjDqaOkd0hUzmtPR/d3EiBBMn/wc= -github.com/tsenart/tb v0.0.0-20181025101425-0d2499c8b6e9 h1:kjbwitOGH46vD01f2s3leBfrMnePQa3NSAIlW35MvY8= -github.com/tsenart/tb v0.0.0-20181025101425-0d2499c8b6e9/go.mod h1:EcGP24b8DY+bWHnpfJDP7fM+o8Nmz4fYH0l2xTtNr3I= -github.com/tyler-smith/go-bip39 v1.0.2 h1:+t3w+KwLXO6154GNJY+qUtIxLTmFjfUmpguQT1OlOT8= -github.com/tyler-smith/go-bip39 v1.0.2/go.mod h1:sJ5fKU0s6JVwZjjcUEX2zFOnvq0ASQ2K9Zr6cf67kNs= -github.com/uber/jaeger-client-go v0.0.0-20180607151842-f7e0d4744fa6/go.mod h1:WVhlPFC8FDjOFMMWRy2pZqQJSXxYSwNYOkTr/Z6d3Kk= -github.com/uber/jaeger-lib v0.0.0-20180615202729-a51202d6f4a7/go.mod h1:ComeNDZlWwrWnDv8aPp0Ba6+uUTzImX/AauajbLI56U= -github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= -github.com/vacp2p/mvds v0.0.23 h1:BKdn7tyGvl/J/Pwv6FlcW6Xbzm+17jv141GB1mFXyOU= -github.com/vacp2p/mvds v0.0.23/go.mod h1:uUmtiahU7efOVl/5w5yk9jOze5xYpDZDrSrT8TvHXjQ= -github.com/wealdtech/go-ens/v3 v3.0.9 h1:gXMBNXikJ/XV9k6ybPOZMXIMPjBGSCC9N10dxe8Y2Xk= -github.com/wealdtech/go-ens/v3 v3.0.9/go.mod h1:P2OEBvgkhXLrPzPN+eR5z2/wFIGwHyijTDvpuC1xLlo= -github.com/wealdtech/go-multicodec v1.2.0 h1:9AHSxcSE9F9r6ZvQLAO0EXCdM08QfYohaXmW3k6sSh4= -github.com/wealdtech/go-multicodec v1.2.0/go.mod h1:aedGMaTeYkIqi/KCPre1ho5rTb3hGpu/snBOS3GQLw4= -github.com/wealdtech/go-string2eth v1.0.0 h1:jY6b1MVqU6k2Uw/kvcU1Y9/3dDyXfPzZrOFspt82UJs= -github.com/wealdtech/go-string2eth v1.0.0/go.mod h1:UZA/snEybGcD6n+Pl+yoDjmexlEJ6dtoS9myfM83Ol4= -github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1/go.mod h1:8UvriyWtv5Q5EOgjHaSseUEdkQfvwFv1I/In/O2M9gc= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc/go.mod h1:bopw91TMyo8J3tvftk8xmU2kPmlrt4nScJQZU2hE5EM= -github.com/whyrusleeping/go-notifier v0.0.0-20170827234753-097c5d47330f/go.mod h1:cZNvX9cFybI01GriPRMXDtczuvUhgbcYr9iCGaNlRv8= -github.com/whyrusleeping/mafmt v1.2.8/go.mod h1:faQJFPbLSxzD9xpA02ttW/tS9vZykNvXwGvqIpk20FA= -github.com/whyrusleeping/mdns v0.0.0-20180901202407-ef14215e6b30/go.mod h1:j4l84WPFclQPj320J9gp0XwNKBb3U0zt5CBqjPp22G4= -github.com/whyrusleeping/mdns v0.0.0-20190826153040-b9b60ed33aa9/go.mod h1:j4l84WPFclQPj320J9gp0XwNKBb3U0zt5CBqjPp22G4= -github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7/go.mod h1:X2c0RVCI1eSUFI8eLcY3c0423ykwiUdxLJtkDvruhjI= -github.com/wsddn/go-ecdh v0.0.0-20161211032359-48726bab9208 h1:1cngl9mPEoITZG8s8cVcUy5CeIBYhEESkOB7m6Gmkrk= -github.com/wsddn/go-ecdh v0.0.0-20161211032359-48726bab9208/go.mod h1:IotVbo4F+mw0EzQ08zFqg7pK3FebNXpaMsRy2RT+Ees= -github.com/x-cray/logrus-prefixed-formatter v0.5.2/go.mod h1:2duySbKsL6M18s5GU7VPsoEPHyzalCE06qoARUCeBBE= -github.com/xanzy/go-gitlab v0.15.0/go.mod h1:8zdQa/ri1dfn8eS3Ir1SyfvOKlw7WBJ8DVThkpGiXrs= -github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c/go.mod h1:lB8K/P019DLNhemzwFU4jHLhdvlE6uDZjXFejJXr49I= -github.com/xdg/stringprep v1.0.0/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y= -github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= -github.com/xtaci/kcp-go v5.4.5+incompatible/go.mod h1:bN6vIwHQbfHaHtFpEssmWsN45a+AZwO7eyRCmEIbtvE= -github.com/xtaci/lossyconn v0.0.0-20190602105132-8df528c0c9ae/go.mod h1:gXtu8J62kEgmN++bm9BVICuT/e8yiLI2KFobd/TRFsE= -gitlab.com/nyarla/go-crypt v0.0.0-20160106005555-d9a5dc2b789b/go.mod h1:T3BPAOm2cqquPa0MKWeNkmOM5RQsRhkrwMWonFMN7fE= -go.mongodb.org/mongo-driver v1.1.0/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM= -go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= -go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= -go.opencensus.io v0.22.1/go.mod h1:Ap50jQcDJrx6rB6VgeeFPtuPIf3wMRvRfrfYDO6+BmA= -go.uber.org/atomic v1.4.0 h1:cxzIVoETapQEqDhQu3QfnvXAV4AlzcvUCxkVUFw3+EU= -go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= -go.uber.org/atomic v1.5.0 h1:OI5t8sDa1Or+q8AeE+yKeB/SDYioSHAgcVljj9JIETY= -go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= -go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= -go.uber.org/multierr v1.3.0 h1:sFPn2GLc3poCkfrpIXGhBD2X0CMIo4Q/zSULXrj/+uc= -go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= -go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee h1:0mgffUl7nfd+FpvXMVz4IDEaUSmT1ysygQC7qYo7sG4= -go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= -go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= -go.uber.org/zap v1.13.0 h1:nR6NoDBgAf67s68NhaXbsojM+2gxp3S1hWkHDl27pVU= -go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= -golang.org/dl v0.0.0-20190829154251-82a15e2f2ead/go.mod h1:IUMfjQLJQd4UTqG1Z90tenwKoCX93Gn3MAQJMOSBsDQ= -golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190103213133-ff983b9c42bc/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190225124518-7f87c0fbb88b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190404164418-38d8ce5564a5/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE= -golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190530122614-20be4c3c3ed5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190618222545-ea8f1a30c443/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3H3cr1v9wB50oz8l4C4h62xy7jSTY= -golang.org/x/crypto v0.0.0-20191029031824-8986dd9e96cf h1:fnPsqIDRbCSgumaMCRpoIoF2s4qxv0xSSS0BVZUE/ss= -golang.org/x/crypto v0.0.0-20191029031824-8986dd9e96cf/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20191119213627-4f8c1d86b1ba h1:9bFeDpN3gTqNanMVqNcoR/pJQuP5uroC3t1D7eXozTE= -golang.org/x/crypto v0.0.0-20191119213627-4f8c1d86b1ba/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20191122220453-ac88ee75c92c h1:/nJuwDLoL/zrqY6gf57vxC+Pi+pZ8bfhpPkicO5H7W4= -golang.org/x/crypto v0.0.0-20191122220453-ac88ee75c92c/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190930215403-16217165b5de h1:5hukYrvBGR8/eNkX5mdUezrA6JiaEZDtJb9Ei+1LlBs= -golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= -golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181011144130-49bb7cea24b1/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181108082009-03003ca0c849/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190225153610-fe579d43d832/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190227160552-c95aed5357e7/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190424112056-4829fb13d2c6/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859 h1:R/3boaszxrf1GEUWTVDzSKVwLmSJpwZ1yqXm8j0v2QI= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190912160710-24e19bdeb0f2 h1:4dVFTC832rPn4pomLSz1vA+are2+dU19w1H8OngV7nc= -golang.org/x/net v0.0.0-20190912160710-24e19bdeb0f2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190930134127-c5a3c61f89f3 h1:6KET3Sqa7fkVfD63QnAM81ZeYg5n4HwApOJkufONnHA= -golang.org/x/net v0.0.0-20190930134127-c5a3c61f89f3/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20181106182150-f42d05182288/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20190402181905-9f3314589c9a/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e h1:vcxGaoTs7kV8m5Np9uUNQin4BrLOthgV7252N8V+FwY= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180926160741-c2ed4eda69e7/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190102155601-82a175fd1598/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190228124157-a34e9553db1e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190426135247-a129542de9ae h1:mQLHiymj/JXKnnjc62tb7nD5pZLs940/sXJu+Xp3DBA= -golang.org/x/sys v0.0.0-20190426135247-a129542de9ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190801041406-cbf593c0f2f3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190912141932-bc967efca4b8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190922100055-0a153f010e69/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191010194322-b09406accb47 h1:/XfQ9z7ib8eEJX2hdgFTZJ/ntt0swNk5oYBziWeTCvY= -golang.org/x/sys v0.0.0-20191010194322-b09406accb47/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191113165036-4c7a9d0fe056 h1:dHtDnRWQtSx0Hjq9kvKFpBh9uPPKfQN70NZZmvssGwk= -golang.org/x/sys v0.0.0-20191113165036-4c7a9d0fe056/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20181130052023-1c3d964395ce/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190425222832-ad9eeb80039a/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190912185636-87d9f09c5d89/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191109212701-97ad0ed33101 h1:LCmXVkvpQCDj724eX6irUTPCJP5GelFHxqGSWL2D1R0= -golang.org/x/tools v0.0.0-20191109212701-97ad0ed33101/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191213032237-7093a17b0467 h1:Jybbe55FT+YYZIJGWmJIA4ZGcglFuZOduakIW3+gHXY= -golang.org/x/tools v0.0.0-20191213032237-7093a17b0467/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk= -google.golang.org/api v0.3.2/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk= -google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.3.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190404172233-64821d5d2107/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= -google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -gopkg.in/alecthomas/kingpin.v2 v2.2.6 h1:jMFz6MfLP0/4fUyZle81rXUoxOBFi19VUFKVDOQfozc= -gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= -gopkg.in/bsm/ratelimit.v1 v1.0.0-20160220154919-db14e161995a/go.mod h1:KF9sEfUPAXdG8Oev9e99iLGnl2uJMjc5B+4y3O7x610= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= -gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE= -gopkg.in/go-playground/validator.v9 v9.29.1 h1:SvGtYmN60a5CVKTOzMSyfzWDeZRxRuGvRQyEAKbw1xc= -gopkg.in/go-playground/validator.v9 v9.29.1/go.mod h1:+c9/zcJMFNgbLvly1L1V+PpxWdVbfP1avr/N00E2vyQ= -gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= -gopkg.in/jcmturner/aescts.v1 v1.0.1/go.mod h1:nsR8qBOg+OucoIW+WMhB3GspUQXq9XorLnQb9XtvcOo= -gopkg.in/jcmturner/dnsutils.v1 v1.0.1/go.mod h1:m3v+5svpVOhtFAP/wSz+yzh4Mc0Fg7eRhxkJMWSIz9Q= -gopkg.in/jcmturner/goidentity.v3 v3.0.0/go.mod h1:oG2kH0IvSYNIu80dVAyu/yoefjq1mNfM5bm88whjWx4= -gopkg.in/jcmturner/gokrb5.v7 v7.2.3/go.mod h1:l8VISx+WGYp+Fp7KRbsiUuXTTOnxIc3Tuvyavf11/WM= -gopkg.in/jcmturner/rpc.v1 v1.1.0/go.mod h1:YIdkC4XfD6GXbzje11McwsDuOlZQSb9W4vfLvuNnlv8= -gopkg.in/natefinch/lumberjack.v2 v2.0.0 h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXLknAOE8= -gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k= -gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce h1:+JknDZhAj8YMt7GC73Ei8pv4MzjDUNPHgQWJdtMAaDU= -gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce/go.mod h1:5AcXVHNjg+BDxry382+8OKon8SEWiKktQR07RKPsv1c= -gopkg.in/olebedev/go-duktape.v3 v3.0.0-20180302121509-abf0ba0be5d5/go.mod h1:uAJfkITjFhyEEuUfm7bsmCZRbW5WRq8s9EY8HZ6hCns= -gopkg.in/olebedev/go-duktape.v3 v3.0.0-20190709231704-1e4459ed25ff h1:uuol9OUzSvZntY1v963NAbVd7A+PHLMz1FlCe3Lorcs= -gopkg.in/olebedev/go-duktape.v3 v3.0.0-20190709231704-1e4459ed25ff/go.mod h1:uAJfkITjFhyEEuUfm7bsmCZRbW5WRq8s9EY8HZ6hCns= -gopkg.in/redis.v4 v4.2.4/go.mod h1:8KREHdypkCEojGKQcjMqAODMICIVwZAONWq8RowTITA= -gopkg.in/sourcemap.v1 v1.0.5/go.mod h1:2RlvNNSMglmRrcvhfuzp4hQHwOtjxlbjX7UPY/GXb78= -gopkg.in/src-d/go-cli.v0 v0.0.0-20181105080154-d492247bbc0d/go.mod h1:z+K8VcOYVYcSwSjGebuDL6176A1XskgbtNl64NSg+n8= -gopkg.in/src-d/go-log.v1 v1.0.1/go.mod h1:GN34hKP0g305ysm2/hctJ0Y8nWP3zxXXJ8GFabTyABE= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/urfave/cli.v1 v1.20.0 h1:NdAVW6RYxDif9DhDHaAortIu956m2c0v+09AZBPTbE0= -gopkg.in/urfave/cli.v1 v1.20.0/go.mod h1:vuBzUtMdQeixQj8LVd+/98pzhxNGQoyuPBlsXHOQNO0= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= -honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.1-2019.2.3 h1:3JgtbtFHMiCmsznwGVTUWbgGov+pVqnlf1dEJTNAXeM= -honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= diff --git a/protocol/group_chat_system_messages.go b/protocol/group_chat_system_messages.go index cbbd7260d..e63b15d0b 100644 --- a/protocol/group_chat_system_messages.go +++ b/protocol/group_chat_system_messages.go @@ -1,7 +1,6 @@ package protocol import ( - "fmt" "strings" "time" @@ -23,9 +22,9 @@ var defaultSystemMessagesTranslations = map[protobuf.MembershipUpdateEvent_Event func tsprintf(format string, params map[string]string) string { for key, val := range params { - format = strings.Replace(format, "{{"+key+"}}", fmt.Sprintf("%s", val), -1) + format = strings.Replace(format, "{{"+key+"}}", val, -1) } - return fmt.Sprintf(format) + return format } func eventToSystemMessage(e v1protocol.MembershipUpdateEvent, translations map[protobuf.MembershipUpdateEvent_EventType]string) *Message { @@ -72,7 +71,7 @@ func eventToSystemMessage(e v1protocol.MembershipUpdateEvent, translations map[p Seen: true, ID: types.EncodeHex(crypto.Keccak256(e.Signature)), } - message.PrepareContent() + _ = message.PrepareContent() return message } diff --git a/protocol/identity/identicon/identicon.go b/protocol/identity/identicon/identicon.go index 80d8b0462..55f5c8901 100644 --- a/protocol/identity/identicon/identicon.go +++ b/protocol/identity/identicon/identicon.go @@ -1,10 +1,10 @@ package identicon import ( - "crypto/md5" + "crypto/md5" // nolint: gosec "image/color" - colorful "github.com/lucasb-eyer/go-colorful" + "github.com/lucasb-eyer/go-colorful" ) const ( @@ -18,7 +18,7 @@ type Identicon struct { } func generate(key string) Identicon { - hash := md5.Sum([]byte(key)) + hash := md5.Sum([]byte(key)) // nolint: gosec return Identicon{ convertPatternToBinarySwitch(generatePatternFromHash(hash)), getColorFromHash(hash), @@ -27,7 +27,7 @@ func generate(key string) Identicon { func getColorFromHash(h [16]byte) color.Color { // Take the last 3 relevant bytes, and convert to a float between [0..360] - var sum float64 = float64(h[13]) + float64(h[14]) + float64(h[15]) + sum := float64(h[13]) + float64(h[14]) + float64(h[15]) t := (sum / 765) * 360 return colorful.Hsl(t, defaultSaturation, defaultLightness) } diff --git a/protocol/identity/identicon/identicon_test.go b/protocol/identity/identicon/identicon_test.go index 98bd1bda3..85ff247fc 100644 --- a/protocol/identity/identicon/identicon_test.go +++ b/protocol/identity/identicon/identicon_test.go @@ -1,7 +1,7 @@ package identicon import ( - "crypto/md5" + "crypto/md5" // nolint: gosec "reflect" "testing" ) @@ -22,7 +22,7 @@ var GeneratedBitmap = []byte{ 0, 1, 0, 1, 0, } -var GeneratedHash = md5.Sum([]byte("Culona")) +var GeneratedHash = md5.Sum([]byte("Culona")) // nolint: gosec func TestItGeneratesAPatternFromAListOfBytes(t *testing.T) { pattern := generatePatternFromHash(GeneratedHash) diff --git a/protocol/message.go b/protocol/message.go index a58610a6a..447ddc88e 100644 --- a/protocol/message.go +++ b/protocol/message.go @@ -93,7 +93,7 @@ type Message struct { // Replace indicates that this is a replacement of a message // that has been updated - Replace string `json:"replace,omitEmpty"` + Replace string `json:"replace,omitempty"` SigPubKey *ecdsa.PublicKey `json:"-"` } @@ -112,7 +112,6 @@ type RawMessage struct { } func (m *Message) MarshalJSON() ([]byte, error) { - type MessageAlias Message type StickerAlias struct { Hash string `json:"hash"` Pack int32 `json:"pack"` @@ -130,10 +129,10 @@ func (m *Message) MarshalJSON() ([]byte, error) { ParsedText json.RawMessage `json:"parsedText"` LineCount int `json:"lineCount"` Text string `json:"text"` - ChatId string `json:"chatId"` + ChatID string `json:"chatId"` LocalChatID string `json:"localChatId"` Clock uint64 `json:"clock"` - Replace string `json:"replace,omitEmpty"` + Replace string `json:"replace"` ResponseTo string `json:"responseTo"` EnsName string `json:"ensName"` Sticker *StickerAlias `json:"sticker"` @@ -155,7 +154,7 @@ func (m *Message) MarshalJSON() ([]byte, error) { LineCount: m.LineCount, Text: m.Text, Replace: m.Replace, - ChatId: m.ChatId, + ChatID: m.ChatId, LocalChatID: m.LocalChatID, Clock: m.Clock, ResponseTo: m.ResponseTo, diff --git a/protocol/message_handler.go b/protocol/message_handler.go index 108ba9725..361772e07 100644 --- a/protocol/message_handler.go +++ b/protocol/message_handler.go @@ -3,6 +3,7 @@ package protocol import ( "crypto/ecdsa" "encoding/hex" + "fmt" "github.com/pkg/errors" "go.uber.org/zap" @@ -114,7 +115,9 @@ func (m *MessageHandler) handleCommandMessage(state *ReceivedMessageState, messa message.Identicon = state.CurrentMessageState.Contact.Identicon message.WhisperTimestamp = state.CurrentMessageState.WhisperTimestamp - message.PrepareContent() + if err := message.PrepareContent(); err != nil { + return fmt.Errorf("failed to prepare content: %v", err) + } chat, err := m.matchMessage(message, state.AllChats, state.Timesource) if err != nil { return err @@ -297,10 +300,13 @@ func (m *MessageHandler) HandleChatMessage(state *ReceivedMessageState) error { WhisperTimestamp: state.CurrentMessageState.WhisperTimestamp, } - receivedMessage.PrepareContent() + err := receivedMessage.PrepareContent() + if err != nil { + return fmt.Errorf("failed to prepare message content: %v", err) + } chat, err := m.matchMessage(receivedMessage, state.AllChats, state.Timesource) if err != nil { - return err + return err // matchMessage returns a descriptive error message } // If deleted-at is greater, ignore message @@ -567,7 +573,7 @@ func (m *MessageHandler) matchMessage(message *Message, chats map[string]*Chat, } return chat, nil case message.MessageType == protobuf.ChatMessage_ONE_TO_ONE && isPubKeyEqual(message.SigPubKey, &m.identity.PublicKey): - // It's a private message coming from us so we rely on Message.ChatId + // It's a private message coming from us so we rely on Message.ChatID // If chat does not exist, it should be created to support multidevice synchronization. chatID := message.ChatId chat := chats[chatID] diff --git a/protocol/message_processor.go b/protocol/message_processor.go index 1b05403f1..92462f2c3 100644 --- a/protocol/message_processor.go +++ b/protocol/message_processor.go @@ -17,7 +17,6 @@ import ( "github.com/status-im/status-go/protocol/datasync" datasyncpeer "github.com/status-im/status-go/protocol/datasync/peer" "github.com/status-im/status-go/protocol/encryption" - "github.com/status-im/status-go/protocol/encryption/multidevice" "github.com/status-im/status-go/protocol/protobuf" "github.com/status-im/status-go/protocol/transport" v1protocol "github.com/status-im/status-go/protocol/v1" @@ -48,7 +47,7 @@ func newMessageProcessor( logger *zap.Logger, features featureFlags, ) (*messageProcessor, error) { - dataSyncTransport := datasync.NewDataSyncNodeTransport() + dataSyncTransport := datasync.NewNodeTransport() dataSyncNode, err := datasyncnode.NewPersistentNode( database, dataSyncTransport, @@ -252,15 +251,6 @@ func (p *messageProcessor) SendPublicRaw( return messageID, nil } -func (p *messageProcessor) processPairMessage(m v1protocol.PairMessage) error { - metadata := &multidevice.InstallationMetadata{ - Name: m.Name, - FCMToken: m.FCMToken, - DeviceType: m.DeviceType, - } - return p.protocol.SetInstallationMetadata(&p.identity.PublicKey, m.InstallationID, metadata) -} - // handleMessages expects a whisper message as input, and it will go through // a series of transformations until the message is parsed into an application // layer message, or in case of Raw methods, the processing stops at the layer diff --git a/protocol/message_processor_test.go b/protocol/message_processor_test.go index efb19e23b..c56411954 100644 --- a/protocol/message_processor_test.go +++ b/protocol/message_processor_test.go @@ -84,7 +84,7 @@ func (s *MessageProcessorSuite) SetupTest() { config := &config{} s.Require().NoError(WithDatasync()(config)) - whisperTransport, err := transport.NewWhisperServiceTransport( + whisperTransport, err := transport.NewTransport( gethbridge.NewGethWhisperWrapper(shh), identity, database, diff --git a/protocol/message_validator_test.go b/protocol/message_validator_test.go index a0843dafb..15ff36351 100644 --- a/protocol/message_validator_test.go +++ b/protocol/message_validator_test.go @@ -273,7 +273,7 @@ func (s *MessageValidatorSuite) TestValidatePlainTextMessage() { Name: "Invalid emoji only emssage", Valid: false, Message: protobuf.ChatMessage{ - ChatId: "a", + ChatID: "a", Text: ":+1: not valid", Clock: 2, Timestamp: 3, diff --git a/protocol/messenger.go b/protocol/messenger.go index 074e96d2b..ce16d2bc8 100644 --- a/protocol/messenger.go +++ b/protocol/messenger.go @@ -31,11 +31,11 @@ import ( const PubKeyStringLength = 132 +const transactionSentTxt = "Transaction sent" + var ( ErrChatIDEmpty = errors.New("chat ID is empty") ErrNotImplemented = errors.New("not implemented") - - errChatNotFound = errors.New("chat not found") ) // Messenger is a entity managing chats and messages. @@ -74,12 +74,12 @@ type RawResponse struct { } type MessengerResponse struct { - Chats []*Chat `json:"chats,omitEmpty"` - Messages []*Message `json:"messages,omitEmpty"` - Contacts []*Contact `json:"contacts,omitEmpty"` - Installations []*multidevice.Installation `json:"installations,omitEmpty"` + Chats []*Chat `json:"chats,omitempty"` + Messages []*Message `json:"messages,omitempty"` + Contacts []*Contact `json:"contacts,omitempty"` + Installations []*multidevice.Installation `json:"installations,omitempty"` // Raw unprocessed messages - RawMessages []*RawResponse `json:"rawMessages,omitEmpty"` + RawMessages []*RawResponse `json:"rawMessages,omitempty"` } func (m *MessengerResponse) IsEmpty() bool { @@ -286,7 +286,7 @@ func NewMessenger( // Initialize transport layer. var transp transport.Transport if shh, err := node.GetWhisper(nil); err == nil && shh != nil { - transp, err = shhtransp.NewWhisperServiceTransport( + transp, err = shhtransp.NewTransport( shh, identity, database, @@ -295,7 +295,7 @@ func NewMessenger( logger, ) if err != nil { - return nil, errors.Wrap(err, "failed to create WhisperServiceTransport") + return nil, errors.Wrap(err, "failed to create Transport") } } else { logger.Info("failed to find Whisper service; trying Waku", zap.Error(err)) @@ -303,7 +303,7 @@ func NewMessenger( if err != nil || waku == nil { return nil, errors.Wrap(err, "failed to find Whisper and Waku services") } - transp, err = wakutransp.NewWakuServiceTransport( + transp, err = wakutransp.NewTransport( waku, identity, database, @@ -312,7 +312,7 @@ func NewMessenger( logger, ) if err != nil { - return nil, errors.Wrap(err, "failed to create WakuServiceTransport") + return nil, errors.Wrap(err, "failed to create Transport") } } @@ -1179,7 +1179,7 @@ func (m *Messenger) hasPairedDevices() bool { var count int for _, i := range m.allInstallations { if i.Enabled { - count += 1 + count++ } } return count > 1 @@ -1208,7 +1208,7 @@ func (m *Messenger) dispatchPairInstallationMessage(ctx context.Context, spec *R return nil, err } spec.ID = types.EncodeHex(id) - spec.SendCount += 1 + spec.SendCount++ err = m.persistence.SaveRawMessage(spec) if err != nil { return nil, err @@ -1285,7 +1285,7 @@ func (m *Messenger) dispatchMessage(ctx context.Context, spec *RawMessage) ([]by return nil, errors.New("chat type not supported") } spec.ID = types.EncodeHex(id) - spec.SendCount += 1 + spec.SendCount++ err = m.persistence.SaveRawMessage(spec) if err != nil { return nil, err @@ -1696,7 +1696,7 @@ type ReceivedMessageState struct { ModifiedChats map[string]bool // All contacts in memory AllContacts map[string]*Contact - // List of contacs modified + // List of contacts modified ModifiedContacts map[string]bool // All installations in memory AllInstallations map[string]*multidevice.Installation @@ -1919,7 +1919,7 @@ func (m *Messenger) handleRetrievedMessages(chatWithMessages map[transport.Filte messageState.Response.Contacts = append(messageState.Response.Contacts, messageState.AllContacts[id]) } - for id, _ := range messageState.ModifiedInstallations { + for id := range messageState.ModifiedInstallations { installation := messageState.AllInstallations[id] messageState.Response.Installations = append(messageState.Response.Installations, installation) if installation.InstallationMetadata != nil { @@ -2554,7 +2554,7 @@ func (m *Messenger) AcceptRequestTransaction(ctx context.Context, transactionHas message.Clock = clock message.WhisperTimestamp = timestamp message.Timestamp = timestamp - message.Text = "Transaction sent" + message.Text = transactionSentTxt message.OutgoingStatus = OutgoingStatusSending // Hide previous message @@ -2652,7 +2652,7 @@ func (m *Messenger) SendTransaction(ctx context.Context, chatID, value, contract message.Clock = clock message.WhisperTimestamp = timestamp message.Timestamp = timestamp - message.Text = "Transaction sent" + message.Text = transactionSentTxt request := &protobuf.SendTransaction{ Clock: message.Clock, @@ -2800,7 +2800,7 @@ func (m *Messenger) ValidateTransactions(ctx context.Context, addresses []types. modifiedChats[chat.ID] = true } - for id, _ := range modifiedChats { + for id := range modifiedChats { response.Chats = append(response.Chats, m.allChats[id]) } diff --git a/protocol/messenger_installations_test.go b/protocol/messenger_installations_test.go index 29e89a381..56aebbd54 100644 --- a/protocol/messenger_installations_test.go +++ b/protocol/messenger_installations_test.go @@ -28,12 +28,13 @@ type MessengerInstallationSuite struct { suite.Suite m *Messenger // main instance of Messenger privateKey *ecdsa.PrivateKey // private key for the main instance of Messenger + // If one wants to send messages between different instances of Messenger, // a single Whisper service should be shared. - shh types.Whisper - tmpFiles []*os.File // files to clean up - logger *zap.Logger - installationID string + shh types.Whisper + + tmpFiles []*os.File // files to clean up + logger *zap.Logger } func (s *MessengerInstallationSuite) SetupTest() { diff --git a/protocol/messenger_test.go b/protocol/messenger_test.go index 510e7d5e5..a79aac621 100644 --- a/protocol/messenger_test.go +++ b/protocol/messenger_test.go @@ -124,8 +124,7 @@ func (s *MessengerSuite) newMessengerWithKey(shh types.Whisper, privateKey *ecds func (s *MessengerSuite) newMessenger(shh types.Whisper) *Messenger { privateKey, err := crypto.GenerateKey() s.Require().NoError(err) - - return s.newMessengerWithKey(s.shh, privateKey) + return s.newMessengerWithKey(shh, privateKey) } func (s *MessengerSuite) TearDownTest() { @@ -884,13 +883,12 @@ func (s *MessengerSuite) TestRetrieveTheirPrivateGroupWrappedMessageChat() { err = tt.RetryWithBackOff(func() error { var err error response, err = s.m.RetrieveAll() - if err == nil && len(response.Messages) == 0 { - err = errors.New("no messages") + if err == nil && len(response.Chats) == 0 { + err = errors.New("no chats") } return err }) s.Require().NoError(err) - s.Require().Len(response.Chats, 1) actualChat := response.Chats[0] // It updates the unviewed messages count @@ -1457,6 +1455,7 @@ func (s *MessengerSuite) TestDeclineRequestAddressForTransaction() { // We decline the request response, err = theirMessenger.DeclineRequestAddressForTransaction(context.Background(), receiverMessage.ID) + s.Require().NoError(err) s.Require().Len(response.Chats, 1) s.Require().Len(response.Messages, 1) @@ -1752,6 +1751,7 @@ func (s *MessengerSuite) TestAcceptRequestAddressForTransaction() { // We accept the request response, err = theirMessenger.AcceptRequestAddressForTransaction(context.Background(), receiverMessage.ID, "some-address") + s.Require().NoError(err) s.Require().Len(response.Chats, 1) s.Require().Len(response.Messages, 1) @@ -2050,9 +2050,8 @@ func (m MockEthClient) TransactionByHash(ctx context.Context, hash types.Hash) ( mockTransaction, ok := m.messages[hash.Hex()] if !ok { return coretypes.Message{}, coretypes.TransactionStatusFailed, nil - } else { - return mockTransaction.Message, mockTransaction.Status, nil } + return mockTransaction.Message, mockTransaction.Status, nil } func (m *mockSendMessagesRequest) SendMessagesRequest(peerID []byte, request types.MessagesRequest) error { @@ -2086,8 +2085,7 @@ func (s *MessengerSuite) TestMessageJSON() { s.Require().Equal(message, decodedMessage) } -// TODO: For some reason is not mocking the method anymore, help? -func (s *MessengerSuite) testRequestHistoricMessagesRequest() { +func (s *MessengerSuite) TestRequestHistoricMessagesRequest() { shh := &mockSendMessagesRequest{ Whisper: s.shh, } diff --git a/protocol/persistence_legacy.go b/protocol/persistence_legacy.go index 95cb7a31c..be382e937 100644 --- a/protocol/persistence_legacy.go +++ b/protocol/persistence_legacy.go @@ -294,7 +294,7 @@ func (db sqlitePersistence) MessagesExist(ids []string) (map[string]bool, error) } inVector := strings.Repeat("?, ", len(ids)-1) + "?" - query := fmt.Sprintf(`SELECT id FROM user_messages WHERE id IN (%s)`, inVector) + query := "SELECT id FROM user_messages WHERE id IN (" + inVector + ")" // nolint: gosec rows, err := db.db.Query(query, idsArgs...) if err != nil { return nil, err @@ -398,7 +398,7 @@ func (db sqlitePersistence) SaveMessagesLegacy(messages []*Message) (err error) allFields := db.tableUserMessagesLegacyAllFields() valuesVector := strings.Repeat("?, ", db.tableUserMessagesLegacyAllFieldsCount()-1) + "?" - query := fmt.Sprintf(`INSERT INTO user_messages(%s) VALUES (%s)`, allFields, valuesVector) + query := "INSERT INTO user_messages(" + allFields + ") VALUES (" + valuesVector + ")" // nolint: gosec stmt, err := tx.Prepare(query) if err != nil { return @@ -454,13 +454,8 @@ func (db sqlitePersistence) MarkMessagesSeen(chatID string, ids []string) error } inVector := strings.Repeat("?, ", len(ids)-1) + "?" - _, err = tx.Exec( - fmt.Sprintf(` - UPDATE user_messages - SET seen = 1 - WHERE id IN (%s) - `, inVector), - idsArgs...) + q := "UPDATE user_messages SET seen = 1 WHERE id IN (" + inVector + ")" // nolint: gosec + _, err = tx.Exec(q, idsArgs...) if err != nil { return err } diff --git a/protocol/protobuf/chat_message.pb.go b/protocol/protobuf/chat_message.pb.go index 49247f30c..eae837183 100644 --- a/protocol/protobuf/chat_message.pb.go +++ b/protocol/protobuf/chat_message.pb.go @@ -5,8 +5,9 @@ package protobuf import ( fmt "fmt" - proto "github.com/golang/protobuf/proto" math "math" + + proto "github.com/golang/protobuf/proto" ) // Reference imports to suppress errors if they are not otherwise used. @@ -147,7 +148,7 @@ type ChatMessage struct { Timestamp uint64 `protobuf:"varint,2,opt,name=timestamp,proto3" json:"timestamp,omitempty"` // Text of the message Text string `protobuf:"bytes,3,opt,name=text,proto3" json:"text,omitempty"` - // Id of the message that we are replying to + // ID of the message that we are replying to ResponseTo string `protobuf:"bytes,4,opt,name=response_to,json=responseTo,proto3" json:"response_to,omitempty"` // Ens name of the sender EnsName string `protobuf:"bytes,5,opt,name=ens_name,json=ensName,proto3" json:"ens_name,omitempty"` diff --git a/protocol/transaction_validator.go b/protocol/transaction_validator.go index e19d72caa..e56a76554 100644 --- a/protocol/transaction_validator.go +++ b/protocol/transaction_validator.go @@ -69,7 +69,7 @@ func (t *TransactionValidator) verifyTransactionSignature(ctx context.Context, f publicKeyBytes := crypto.FromECDSAPub(from) if len(transactionHash) != transactionHashLength { - return errors.New("wrong transaction hash lenght") + return errors.New("wrong transaction hash length") } hashBytes, err := hex.DecodeString(transactionHash[2:]) @@ -146,7 +146,7 @@ func (t *TransactionValidator) validateTokenTransfer(parameters *CommandParamete } func (t *TransactionValidator) validateToAddress(specifiedTo, actualTo string) bool { - if len(specifiedTo) != 0 && (strings.ToLower(specifiedTo) != strings.ToLower(actualTo) || !t.addresses[strings.ToLower(actualTo)]) { + if len(specifiedTo) != 0 && (!strings.EqualFold(specifiedTo, actualTo) || !t.addresses[strings.ToLower(actualTo)]) { return false } @@ -159,6 +159,7 @@ func (t *TransactionValidator) validateEthereumTransfer(parameters *CommandParam if !t.validateToAddress(parameters.Address, toAddress) { return invalidResponse, nil } + amount := transaction.Value() if parameters.Value != "" { advertisedAmount, ok := new(big.Int).SetString(parameters.Value, 10) @@ -171,17 +172,14 @@ func (t *TransactionValidator) validateEthereumTransfer(parameters *CommandParam Value: amount.String(), Address: toAddress, }, nil - - } else { - return &VerifyTransactionResponse{ - AccordingToSpec: false, - Valid: true, - Value: amount.String(), - Address: toAddress, - }, nil - } + return &VerifyTransactionResponse{ + AccordingToSpec: false, + Valid: true, + Value: amount.String(), + Address: toAddress, + }, nil } type VerifyTransactionResponse struct { @@ -208,7 +206,6 @@ type VerifyTransactionResponse struct { // not be retried. // If an error is returned, validation can be retried. func (t *TransactionValidator) validateTransaction(ctx context.Context, message coretypes.Message, parameters *CommandParameters, from *ecdsa.PublicKey) (*VerifyTransactionResponse, error) { - fromAddress := types.BytesToAddress(message.From().Bytes()) err := t.verifyTransactionSignature(ctx, from, fromAddress, parameters.TransactionHash, parameters.Signature) @@ -220,10 +217,10 @@ func (t *TransactionValidator) validateTransaction(ctx context.Context, message if len(message.Data()) != 0 { t.logger.Debug("Validating token") return t.validateTokenTransfer(parameters, message) - } else { - t.logger.Debug("Validating eth") - return t.validateEthereumTransfer(parameters, message) } + + t.logger.Debug("Validating eth") + return t.validateEthereumTransfer(parameters, message) } func (t *TransactionValidator) ValidateTransactions(ctx context.Context) ([]*VerifyTransactionResponse, error) { @@ -246,7 +243,6 @@ func (t *TransactionValidator) ValidateTransactions(ctx context.Context) ([]*Ver chatID := contactIDFromPublicKey(transaction.From) message, err := t.persistence.MessageByCommandID(chatID, transaction.CommandID) if err != nil { - t.logger.Error("error pulling message", zap.Error(err)) return nil, err } @@ -254,7 +250,7 @@ func (t *TransactionValidator) ValidateTransactions(ctx context.Context) ([]*Ver t.logger.Info("No message found, ignoring transaction") // This is not a valid case, ignore transaction transaction.Validate = false - transaction.RetryCount += 1 + transaction.RetryCount++ err = t.persistence.UpdateTransactionToValidate(transaction) if err != nil { return nil, err @@ -291,7 +287,7 @@ func (t *TransactionValidator) ValidateTransactions(ctx context.Context) ([]*Ver // Mark transaction as valid transaction.Validate = false - transaction.RetryCount += 1 + transaction.RetryCount++ err = t.persistence.UpdateTransactionToValidate(transaction) if err != nil { return nil, err diff --git a/protocol/transport/filters_manager.go b/protocol/transport/filters_manager.go index ad914e9d7..7f49a8175 100644 --- a/protocol/transport/filters_manager.go +++ b/protocol/transport/filters_manager.go @@ -45,11 +45,8 @@ type FiltersManager struct { privateKey *ecdsa.PrivateKey keys map[string][]byte // a cache of symmetric manager derived from passwords logger *zap.Logger - - genericDiscoveryTopicEnabled bool - - mutex sync.Mutex - filters map[string]*Filter + mutex sync.Mutex + filters map[string]*Filter } // NewFiltersManager returns a new filtersManager. diff --git a/protocol/transport/waku/waku_service.go b/protocol/transport/waku/waku_service.go index 92adec1af..ec4041e7a 100644 --- a/protocol/transport/waku/waku_service.go +++ b/protocol/transport/waku/waku_service.go @@ -58,10 +58,10 @@ func (m *wakuServiceKeysManager) RawSymKey(id string) ([]byte, error) { return m.waku.GetSymKey(id) } -type Option func(*WakuServiceTransport) error +type Option func(*Transport) error -// WakuServiceTransport is a transport based on Whisper service. -type WakuServiceTransport struct { +// Transport is a transport based on Whisper service. +type Transport struct { waku types.Waku api types.PublicWakuAPI // only PublicWakuAPI implements logic to send messages keysManager *wakuServiceKeysManager @@ -72,11 +72,11 @@ type WakuServiceTransport struct { envelopesMonitor *EnvelopesMonitor } -// NewWakuServiceTransport returns a new WakuServiceTransport. +// NewTransport returns a new Transport. // TODO: leaving a chat should verify that for a given public key // there are no other chats. It may happen that we leave a private chat // but still have a public chat for a given public key. -func NewWakuServiceTransport( +func NewTransport( waku types.Waku, privateKey *ecdsa.PrivateKey, db *sql.DB, @@ -84,7 +84,7 @@ func NewWakuServiceTransport( envelopesMonitorConfig *transport.EnvelopesMonitorConfig, logger *zap.Logger, opts ...Option, -) (*WakuServiceTransport, error) { +) (*Transport, error) { filtersManager, err := transport.NewFiltersManager(newSQLitePersistence(db), waku, privateKey, logger) if err != nil { return nil, err @@ -100,7 +100,7 @@ func NewWakuServiceTransport( if waku != nil { api = waku.PublicWakuAPI() } - t := &WakuServiceTransport{ + t := &Transport{ waku: waku, api: api, envelopesMonitor: envelopesMonitor, @@ -111,7 +111,7 @@ func NewWakuServiceTransport( }, filters: filtersManager, mailservers: mailservers, - logger: logger.With(zap.Namespace("WakuServiceTransport")), + logger: logger.With(zap.Namespace("Transport")), } for _, opt := range opts { @@ -123,29 +123,29 @@ func NewWakuServiceTransport( return t, nil } -func (a *WakuServiceTransport) InitFilters(chatIDs []string, publicKeys []*ecdsa.PublicKey) ([]*transport.Filter, error) { +func (a *Transport) InitFilters(chatIDs []string, publicKeys []*ecdsa.PublicKey) ([]*transport.Filter, error) { return a.filters.Init(chatIDs, publicKeys) } -func (a *WakuServiceTransport) Filters() []*transport.Filter { +func (a *Transport) Filters() []*transport.Filter { return a.filters.Filters() } // DEPRECATED -func (a *WakuServiceTransport) LoadFilters(filters []*transport.Filter) ([]*transport.Filter, error) { +func (a *Transport) LoadFilters(filters []*transport.Filter) ([]*transport.Filter, error) { return a.filters.InitWithFilters(filters) } // DEPRECATED -func (a *WakuServiceTransport) RemoveFilters(filters []*transport.Filter) error { +func (a *Transport) RemoveFilters(filters []*transport.Filter) error { return a.filters.Remove(filters...) } -func (a *WakuServiceTransport) ResetFilters() error { +func (a *Transport) ResetFilters() error { return a.filters.Reset() } -func (a *WakuServiceTransport) ProcessNegotiatedSecret(secret types.NegotiatedSecret) (*transport.Filter, error) { +func (a *Transport) ProcessNegotiatedSecret(secret types.NegotiatedSecret) (*transport.Filter, error) { filter, err := a.filters.LoadNegotiated(secret) if err != nil { return nil, err @@ -153,12 +153,12 @@ func (a *WakuServiceTransport) ProcessNegotiatedSecret(secret types.NegotiatedSe return filter, nil } -func (a *WakuServiceTransport) JoinPublic(chatID string) error { +func (a *Transport) JoinPublic(chatID string) error { _, err := a.filters.LoadPublic(chatID) return err } -func (a *WakuServiceTransport) LeavePublic(chatID string) error { +func (a *Transport) LeavePublic(chatID string) error { chat := a.filters.Filter(chatID) if chat != nil { return nil @@ -166,7 +166,7 @@ func (a *WakuServiceTransport) LeavePublic(chatID string) error { return a.filters.Remove(chat) } -func (a *WakuServiceTransport) JoinPrivate(publicKey *ecdsa.PublicKey) error { +func (a *Transport) JoinPrivate(publicKey *ecdsa.PublicKey) error { _, err := a.filters.LoadDiscovery() if err != nil { return err @@ -175,12 +175,12 @@ func (a *WakuServiceTransport) JoinPrivate(publicKey *ecdsa.PublicKey) error { return err } -func (a *WakuServiceTransport) LeavePrivate(publicKey *ecdsa.PublicKey) error { +func (a *Transport) LeavePrivate(publicKey *ecdsa.PublicKey) error { filters := a.filters.FiltersByPublicKey(publicKey) return a.filters.Remove(filters...) } -func (a *WakuServiceTransport) JoinGroup(publicKeys []*ecdsa.PublicKey) error { +func (a *Transport) JoinGroup(publicKeys []*ecdsa.PublicKey) error { _, err := a.filters.LoadDiscovery() if err != nil { return err @@ -194,7 +194,7 @@ func (a *WakuServiceTransport) JoinGroup(publicKeys []*ecdsa.PublicKey) error { return nil } -func (a *WakuServiceTransport) LeaveGroup(publicKeys []*ecdsa.PublicKey) error { +func (a *Transport) LeaveGroup(publicKeys []*ecdsa.PublicKey) error { for _, publicKey := range publicKeys { filters := a.filters.FiltersByPublicKey(publicKey) if err := a.filters.Remove(filters...); err != nil { @@ -209,7 +209,7 @@ type Message struct { Public bool } -func (a *WakuServiceTransport) RetrieveAllMessages() ([]Message, error) { +func (a *Transport) RetrieveAllMessages() ([]Message, error) { var messages []Message for _, filter := range a.filters.Filters() { @@ -229,7 +229,7 @@ func (a *WakuServiceTransport) RetrieveAllMessages() ([]Message, error) { return messages, nil } -func (a *WakuServiceTransport) RetrievePublicMessages(chatID string) ([]*types.Message, error) { +func (a *Transport) RetrievePublicMessages(chatID string) ([]*types.Message, error) { filter, err := a.filters.LoadPublic(chatID) if err != nil { return nil, err @@ -238,7 +238,7 @@ func (a *WakuServiceTransport) RetrievePublicMessages(chatID string) ([]*types.M return a.api.GetFilterMessages(filter.FilterID) } -func (a *WakuServiceTransport) RetrievePrivateMessages(publicKey *ecdsa.PublicKey) ([]*types.Message, error) { +func (a *Transport) RetrievePrivateMessages(publicKey *ecdsa.PublicKey) ([]*types.Message, error) { chats := a.filters.FiltersByPublicKey(publicKey) discoveryChats, err := a.filters.Init(nil, nil) if err != nil { @@ -259,7 +259,7 @@ func (a *WakuServiceTransport) RetrievePrivateMessages(publicKey *ecdsa.PublicKe return result, nil } -func (a *WakuServiceTransport) RetrieveRawAll() (map[transport.Filter][]*types.Message, error) { +func (a *Transport) RetrieveRawAll() (map[transport.Filter][]*types.Message, error) { result := make(map[transport.Filter][]*types.Message) allFilters := a.filters.Filters() @@ -277,7 +277,7 @@ func (a *WakuServiceTransport) RetrieveRawAll() (map[transport.Filter][]*types.M // SendPublic sends a new message using the Whisper service. // For public filters, chat name is used as an ID as well as // a topic. -func (a *WakuServiceTransport) SendPublic(ctx context.Context, newMessage *types.NewMessage, chatName string) ([]byte, error) { +func (a *Transport) SendPublic(ctx context.Context, newMessage *types.NewMessage, chatName string) ([]byte, error) { if err := a.addSig(newMessage); err != nil { return nil, err } @@ -293,7 +293,7 @@ func (a *WakuServiceTransport) SendPublic(ctx context.Context, newMessage *types return a.api.Post(ctx, *newMessage) } -func (a *WakuServiceTransport) SendPrivateWithSharedSecret(ctx context.Context, newMessage *types.NewMessage, publicKey *ecdsa.PublicKey, secret []byte) ([]byte, error) { +func (a *Transport) SendPrivateWithSharedSecret(ctx context.Context, newMessage *types.NewMessage, publicKey *ecdsa.PublicKey, secret []byte) ([]byte, error) { if err := a.addSig(newMessage); err != nil { return nil, err } @@ -313,7 +313,7 @@ func (a *WakuServiceTransport) SendPrivateWithSharedSecret(ctx context.Context, return a.api.Post(ctx, *newMessage) } -func (a *WakuServiceTransport) SendPrivateWithPartitioned(ctx context.Context, newMessage *types.NewMessage, publicKey *ecdsa.PublicKey) ([]byte, error) { +func (a *Transport) SendPrivateWithPartitioned(ctx context.Context, newMessage *types.NewMessage, publicKey *ecdsa.PublicKey) ([]byte, error) { if err := a.addSig(newMessage); err != nil { return nil, err } @@ -329,7 +329,7 @@ func (a *WakuServiceTransport) SendPrivateWithPartitioned(ctx context.Context, n return a.api.Post(ctx, *newMessage) } -func (a *WakuServiceTransport) SendPrivateOnDiscovery(ctx context.Context, newMessage *types.NewMessage, publicKey *ecdsa.PublicKey) ([]byte, error) { +func (a *Transport) SendPrivateOnDiscovery(ctx context.Context, newMessage *types.NewMessage, publicKey *ecdsa.PublicKey) ([]byte, error) { if err := a.addSig(newMessage); err != nil { return nil, err } @@ -346,7 +346,7 @@ func (a *WakuServiceTransport) SendPrivateOnDiscovery(ctx context.Context, newMe return a.api.Post(ctx, *newMessage) } -func (a *WakuServiceTransport) addSig(newMessage *types.NewMessage) error { +func (a *Transport) addSig(newMessage *types.NewMessage) error { sigID, err := a.keysManager.AddOrGetKeyPair(a.keysManager.privateKey) if err != nil { return err @@ -355,18 +355,18 @@ func (a *WakuServiceTransport) addSig(newMessage *types.NewMessage) error { return nil } -func (a *WakuServiceTransport) Track(identifiers [][]byte, hash []byte, newMessage *types.NewMessage) { +func (a *Transport) Track(identifiers [][]byte, hash []byte, newMessage *types.NewMessage) { if a.envelopesMonitor != nil { a.envelopesMonitor.Add(identifiers, types.BytesToHash(hash), *newMessage) } } // GetCurrentTime returns the current unix timestamp in milliseconds -func (a *WakuServiceTransport) GetCurrentTime() uint64 { +func (a *Transport) GetCurrentTime() uint64 { return uint64(a.waku.GetCurrentTime().UnixNano() / int64(time.Millisecond)) } -func (a *WakuServiceTransport) Stop() error { +func (a *Transport) Stop() error { if a.envelopesMonitor != nil { a.envelopesMonitor.Stop() } @@ -374,7 +374,7 @@ func (a *WakuServiceTransport) Stop() error { } // RequestHistoricMessages requests historic messages for all registered filters. -func (a *WakuServiceTransport) SendMessagesRequest( +func (a *Transport) SendMessagesRequest( ctx context.Context, peerID []byte, from, to uint32, @@ -406,7 +406,7 @@ func (a *WakuServiceTransport) SendMessagesRequest( return } -func (a *WakuServiceTransport) waitForRequestCompleted(ctx context.Context, requestID []byte, events chan types.EnvelopeEvent) (*types.MailServerResponse, error) { +func (a *Transport) waitForRequestCompleted(ctx context.Context, requestID []byte, events chan types.EnvelopeEvent) (*types.MailServerResponse, error) { for { select { case ev := <-events: diff --git a/protocol/transport/waku/waku_service_test.go b/protocol/transport/waku/waku_service_test.go index 09f204189..d11121998 100644 --- a/protocol/transport/waku/waku_service_test.go +++ b/protocol/transport/waku/waku_service_test.go @@ -23,6 +23,6 @@ func TestNewWakuServiceTransport(t *testing.T) { require.NoError(t, err) defer func() { _ = logger.Sync() }() - _, err = NewWakuServiceTransport(nil, nil, db, nil, nil, logger) + _, err = NewTransport(nil, nil, db, nil, nil, logger) require.NoError(t, err) } diff --git a/protocol/transport/whisper/whisper_service.go b/protocol/transport/whisper/whisper_service.go index 2c54c367e..f5c1c2382 100644 --- a/protocol/transport/whisper/whisper_service.go +++ b/protocol/transport/whisper/whisper_service.go @@ -58,10 +58,10 @@ func (m *whisperServiceKeysManager) RawSymKey(id string) ([]byte, error) { return m.shh.GetSymKey(id) } -type Option func(*WhisperServiceTransport) error +type Option func(*Transport) error -// WhisperServiceTransport is a transport based on Whisper service. -type WhisperServiceTransport struct { +// Transport is a transport based on Whisper service. +type Transport struct { shh types.Whisper shhAPI types.PublicWhisperAPI // only PublicWhisperAPI implements logic to send messages keysManager *whisperServiceKeysManager @@ -72,11 +72,11 @@ type WhisperServiceTransport struct { envelopesMonitor *EnvelopesMonitor } -// NewWhisperServiceTransport returns a new WhisperServiceTransport. +// NewTransport returns a new Transport. // TODO: leaving a chat should verify that for a given public key // there are no other chats. It may happen that we leave a private chat // but still have a public chat for a given public key. -func NewWhisperServiceTransport( +func NewTransport( shh types.Whisper, privateKey *ecdsa.PrivateKey, db *sql.DB, @@ -84,7 +84,7 @@ func NewWhisperServiceTransport( envelopesMonitorConfig *transport.EnvelopesMonitorConfig, logger *zap.Logger, opts ...Option, -) (*WhisperServiceTransport, error) { +) (*Transport, error) { filtersManager, err := transport.NewFiltersManager(newSQLitePersistence(db), shh, privateKey, logger) if err != nil { return nil, err @@ -100,7 +100,7 @@ func NewWhisperServiceTransport( if shh != nil { shhAPI = shh.PublicWhisperAPI() } - t := &WhisperServiceTransport{ + t := &Transport{ shh: shh, shhAPI: shhAPI, envelopesMonitor: envelopesMonitor, @@ -111,7 +111,7 @@ func NewWhisperServiceTransport( }, filters: filtersManager, mailservers: mailservers, - logger: logger.With(zap.Namespace("WhisperServiceTransport")), + logger: logger.With(zap.Namespace("Transport")), } for _, opt := range opts { @@ -123,29 +123,29 @@ func NewWhisperServiceTransport( return t, nil } -func (a *WhisperServiceTransport) InitFilters(chatIDs []string, publicKeys []*ecdsa.PublicKey) ([]*transport.Filter, error) { +func (a *Transport) InitFilters(chatIDs []string, publicKeys []*ecdsa.PublicKey) ([]*transport.Filter, error) { return a.filters.Init(chatIDs, publicKeys) } -func (a *WhisperServiceTransport) Filters() []*transport.Filter { +func (a *Transport) Filters() []*transport.Filter { return a.filters.Filters() } // DEPRECATED -func (a *WhisperServiceTransport) LoadFilters(filters []*transport.Filter) ([]*transport.Filter, error) { +func (a *Transport) LoadFilters(filters []*transport.Filter) ([]*transport.Filter, error) { return a.filters.InitWithFilters(filters) } // DEPRECATED -func (a *WhisperServiceTransport) RemoveFilters(filters []*transport.Filter) error { +func (a *Transport) RemoveFilters(filters []*transport.Filter) error { return a.filters.Remove(filters...) } -func (a *WhisperServiceTransport) ResetFilters() error { +func (a *Transport) ResetFilters() error { return a.filters.Reset() } -func (a *WhisperServiceTransport) ProcessNegotiatedSecret(secret types.NegotiatedSecret) (*transport.Filter, error) { +func (a *Transport) ProcessNegotiatedSecret(secret types.NegotiatedSecret) (*transport.Filter, error) { filter, err := a.filters.LoadNegotiated(secret) if err != nil { return nil, err @@ -153,12 +153,12 @@ func (a *WhisperServiceTransport) ProcessNegotiatedSecret(secret types.Negotiate return filter, nil } -func (a *WhisperServiceTransport) JoinPublic(chatID string) error { +func (a *Transport) JoinPublic(chatID string) error { _, err := a.filters.LoadPublic(chatID) return err } -func (a *WhisperServiceTransport) LeavePublic(chatID string) error { +func (a *Transport) LeavePublic(chatID string) error { chat := a.filters.Filter(chatID) if chat != nil { return nil @@ -166,7 +166,7 @@ func (a *WhisperServiceTransport) LeavePublic(chatID string) error { return a.filters.Remove(chat) } -func (a *WhisperServiceTransport) JoinPrivate(publicKey *ecdsa.PublicKey) error { +func (a *Transport) JoinPrivate(publicKey *ecdsa.PublicKey) error { _, err := a.filters.LoadDiscovery() if err != nil { return err @@ -175,12 +175,12 @@ func (a *WhisperServiceTransport) JoinPrivate(publicKey *ecdsa.PublicKey) error return err } -func (a *WhisperServiceTransport) LeavePrivate(publicKey *ecdsa.PublicKey) error { +func (a *Transport) LeavePrivate(publicKey *ecdsa.PublicKey) error { filters := a.filters.FiltersByPublicKey(publicKey) return a.filters.Remove(filters...) } -func (a *WhisperServiceTransport) JoinGroup(publicKeys []*ecdsa.PublicKey) error { +func (a *Transport) JoinGroup(publicKeys []*ecdsa.PublicKey) error { _, err := a.filters.LoadDiscovery() if err != nil { return err @@ -194,7 +194,7 @@ func (a *WhisperServiceTransport) JoinGroup(publicKeys []*ecdsa.PublicKey) error return nil } -func (a *WhisperServiceTransport) LeaveGroup(publicKeys []*ecdsa.PublicKey) error { +func (a *Transport) LeaveGroup(publicKeys []*ecdsa.PublicKey) error { for _, publicKey := range publicKeys { filters := a.filters.FiltersByPublicKey(publicKey) if err := a.filters.Remove(filters...); err != nil { @@ -209,7 +209,7 @@ type Message struct { Public bool } -func (a *WhisperServiceTransport) RetrieveAllMessages() ([]Message, error) { +func (a *Transport) RetrieveAllMessages() ([]Message, error) { var messages []Message for _, filter := range a.filters.Filters() { @@ -229,7 +229,7 @@ func (a *WhisperServiceTransport) RetrieveAllMessages() ([]Message, error) { return messages, nil } -func (a *WhisperServiceTransport) RetrievePublicMessages(chatID string) ([]*types.Message, error) { +func (a *Transport) RetrievePublicMessages(chatID string) ([]*types.Message, error) { filter, err := a.filters.LoadPublic(chatID) if err != nil { return nil, err @@ -238,7 +238,7 @@ func (a *WhisperServiceTransport) RetrievePublicMessages(chatID string) ([]*type return a.shhAPI.GetFilterMessages(filter.FilterID) } -func (a *WhisperServiceTransport) RetrievePrivateMessages(publicKey *ecdsa.PublicKey) ([]*types.Message, error) { +func (a *Transport) RetrievePrivateMessages(publicKey *ecdsa.PublicKey) ([]*types.Message, error) { chats := a.filters.FiltersByPublicKey(publicKey) discoveryChats, err := a.filters.Init(nil, nil) if err != nil { @@ -259,7 +259,7 @@ func (a *WhisperServiceTransport) RetrievePrivateMessages(publicKey *ecdsa.Publi return result, nil } -func (a *WhisperServiceTransport) RetrieveRawAll() (map[transport.Filter][]*types.Message, error) { +func (a *Transport) RetrieveRawAll() (map[transport.Filter][]*types.Message, error) { result := make(map[transport.Filter][]*types.Message) allFilters := a.filters.Filters() @@ -277,7 +277,7 @@ func (a *WhisperServiceTransport) RetrieveRawAll() (map[transport.Filter][]*type // SendPublic sends a new message using the Whisper service. // For public filters, chat name is used as an ID as well as // a topic. -func (a *WhisperServiceTransport) SendPublic(ctx context.Context, newMessage *types.NewMessage, chatName string) ([]byte, error) { +func (a *Transport) SendPublic(ctx context.Context, newMessage *types.NewMessage, chatName string) ([]byte, error) { if err := a.addSig(newMessage); err != nil { return nil, err } @@ -293,7 +293,7 @@ func (a *WhisperServiceTransport) SendPublic(ctx context.Context, newMessage *ty return a.shhAPI.Post(ctx, *newMessage) } -func (a *WhisperServiceTransport) SendPrivateWithSharedSecret(ctx context.Context, newMessage *types.NewMessage, publicKey *ecdsa.PublicKey, secret []byte) ([]byte, error) { +func (a *Transport) SendPrivateWithSharedSecret(ctx context.Context, newMessage *types.NewMessage, publicKey *ecdsa.PublicKey, secret []byte) ([]byte, error) { if err := a.addSig(newMessage); err != nil { return nil, err } @@ -313,7 +313,7 @@ func (a *WhisperServiceTransport) SendPrivateWithSharedSecret(ctx context.Contex return a.shhAPI.Post(ctx, *newMessage) } -func (a *WhisperServiceTransport) SendPrivateWithPartitioned(ctx context.Context, newMessage *types.NewMessage, publicKey *ecdsa.PublicKey) ([]byte, error) { +func (a *Transport) SendPrivateWithPartitioned(ctx context.Context, newMessage *types.NewMessage, publicKey *ecdsa.PublicKey) ([]byte, error) { if err := a.addSig(newMessage); err != nil { return nil, err } @@ -329,7 +329,7 @@ func (a *WhisperServiceTransport) SendPrivateWithPartitioned(ctx context.Context return a.shhAPI.Post(ctx, *newMessage) } -func (a *WhisperServiceTransport) SendPrivateOnDiscovery(ctx context.Context, newMessage *types.NewMessage, publicKey *ecdsa.PublicKey) ([]byte, error) { +func (a *Transport) SendPrivateOnDiscovery(ctx context.Context, newMessage *types.NewMessage, publicKey *ecdsa.PublicKey) ([]byte, error) { if err := a.addSig(newMessage); err != nil { return nil, err } @@ -346,7 +346,7 @@ func (a *WhisperServiceTransport) SendPrivateOnDiscovery(ctx context.Context, ne return a.shhAPI.Post(ctx, *newMessage) } -func (a *WhisperServiceTransport) addSig(newMessage *types.NewMessage) error { +func (a *Transport) addSig(newMessage *types.NewMessage) error { sigID, err := a.keysManager.AddOrGetKeyPair(a.keysManager.privateKey) if err != nil { return err @@ -355,18 +355,18 @@ func (a *WhisperServiceTransport) addSig(newMessage *types.NewMessage) error { return nil } -func (a *WhisperServiceTransport) Track(identifiers [][]byte, hash []byte, newMessage *types.NewMessage) { +func (a *Transport) Track(identifiers [][]byte, hash []byte, newMessage *types.NewMessage) { if a.envelopesMonitor != nil { a.envelopesMonitor.Add(identifiers, types.BytesToHash(hash), *newMessage) } } // GetCurrentTime returns the current unix timestamp in milliseconds -func (a *WhisperServiceTransport) GetCurrentTime() uint64 { +func (a *Transport) GetCurrentTime() uint64 { return uint64(a.shh.GetCurrentTime().UnixNano() / int64(time.Millisecond)) } -func (a *WhisperServiceTransport) Stop() error { +func (a *Transport) Stop() error { if a.envelopesMonitor != nil { a.envelopesMonitor.Stop() } @@ -374,7 +374,7 @@ func (a *WhisperServiceTransport) Stop() error { } // RequestHistoricMessages requests historic messages for all registered filters. -func (a *WhisperServiceTransport) SendMessagesRequest( +func (a *Transport) SendMessagesRequest( ctx context.Context, peerID []byte, from, to uint32, @@ -406,7 +406,7 @@ func (a *WhisperServiceTransport) SendMessagesRequest( return } -func (a *WhisperServiceTransport) waitForRequestCompleted(ctx context.Context, requestID []byte, events chan types.EnvelopeEvent) (*types.MailServerResponse, error) { +func (a *Transport) waitForRequestCompleted(ctx context.Context, requestID []byte, events chan types.EnvelopeEvent) (*types.MailServerResponse, error) { for { select { case ev := <-events: diff --git a/protocol/transport/whisper/whisper_service_test.go b/protocol/transport/whisper/whisper_service_test.go index 897e1c2d3..4a9fc05c6 100644 --- a/protocol/transport/whisper/whisper_service_test.go +++ b/protocol/transport/whisper/whisper_service_test.go @@ -23,6 +23,6 @@ func TestNewWhisperServiceTransport(t *testing.T) { require.NoError(t, err) defer func() { _ = logger.Sync() }() - _, err = NewWhisperServiceTransport(nil, nil, db, nil, nil, logger) + _, err = NewTransport(nil, nil, db, nil, nil, logger) require.NoError(t, err) } diff --git a/protocol/v1/decoder.go b/protocol/v1/decoder.go index efe29681a..f3c12e44c 100644 --- a/protocol/v1/decoder.go +++ b/protocol/v1/decoder.go @@ -18,7 +18,6 @@ func NewMessageDecoder(r io.Reader) *transit.Decoder { } const ( - messageTag = "c4" pairMessageTag = "p2" ) @@ -56,15 +55,3 @@ func pairMessageHandler(d transit.Decoder, value interface{}) (interface{}, erro } return pm, nil } - -func setToString(set *transit.Set) ([]string, bool) { - result := make([]string, 0, len(set.Contents)) - for _, item := range set.Contents { - val, ok := item.(string) - if !ok { - return nil, false - } - result = append(result, val) - } - return result, true -} diff --git a/protocol/v1/membership_update_message.go b/protocol/v1/membership_update_message.go index a2d42430d..3c50ac162 100644 --- a/protocol/v1/membership_update_message.go +++ b/protocol/v1/membership_update_message.go @@ -110,7 +110,7 @@ type MembershipUpdateEvent struct { } func (u *MembershipUpdateEvent) Equal(update MembershipUpdateEvent) bool { - return bytes.Compare(u.Signature, update.Signature) == 0 + return bytes.Equal(u.Signature, update.Signature) } func (u *MembershipUpdateEvent) Sign(key *ecdsa.PrivateKey) error { @@ -439,20 +439,6 @@ func stringSliceSubset(subset []string, set []string) bool { return false } -func stringSliceEquals(slice1, slice2 []string) bool { - set := map[string]struct{}{} - for _, s := range slice1 { - set[s] = struct{}{} - } - for _, s := range slice2 { - _, ok := set[s] - if !ok { - return false - } - } - return true -} - func publicKeyToString(publicKey *ecdsa.PublicKey) string { return types.EncodeHex(crypto.FromECDSAPub(publicKey)) } diff --git a/protocol/v1/value_is_zero.go b/protocol/v1/value_is_zero.go deleted file mode 100644 index caf4cb77c..000000000 --- a/protocol/v1/value_is_zero.go +++ /dev/null @@ -1,11 +0,0 @@ -// +build go1.13 - -package protocol - -import "reflect" - -// isZeroValue reports whether v is the zero value for its type. -// It panics if the argument is invalid. -func isZeroValue(v reflect.Value) bool { - return v.IsZero() -} diff --git a/protocol/v1/value_is_zero_1_12.go b/protocol/v1/value_is_zero_1_12.go deleted file mode 100644 index 957855f94..000000000 --- a/protocol/v1/value_is_zero_1_12.go +++ /dev/null @@ -1,48 +0,0 @@ -// +build !go1.13 - -package protocol - -import ( - "math" - "reflect" -) - -// isZeroValue reports whether v is the zero value for its type. -// It panics if the argument is invalid. -func isZeroValue(v reflect.Value) bool { - switch v.Kind() { - case reflect.Bool: - return !v.Bool() - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - return v.Int() == 0 - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: - return v.Uint() == 0 - case reflect.Float32, reflect.Float64: - return math.Float64bits(v.Float()) == 0 - case reflect.Complex64, reflect.Complex128: - c := v.Complex() - return math.Float64bits(real(c)) == 0 && math.Float64bits(imag(c)) == 0 - case reflect.Array: - for i := 0; i < v.Len(); i++ { - if !isZeroValue(v.Index(i)) { - return false - } - } - return true - case reflect.Chan, reflect.Func, reflect.Interface, reflect.Map, reflect.Ptr, reflect.Slice, reflect.UnsafePointer: - return v.IsNil() - case reflect.String: - return v.Len() == 0 - case reflect.Struct: - for i := 0; i < v.NumField(); i++ { - if !isZeroValue(v.Field(i)) { - return false - } - } - return true - default: - // This should never happens, but will act as a safeguard for - // later, as a default value doesn't makes sense here. - panic(&reflect.ValueError{Method: "reflect.Value.IsZero", Kind: v.Kind()}) - } -} diff --git a/services/ext/service.go b/services/ext/service.go index 6998d3829..1344e1404 100644 --- a/services/ext/service.go +++ b/services/ext/service.go @@ -115,7 +115,7 @@ func (s *Service) GetPeer(rawURL string) (*enode.Node, error) { return enode.ParseV4(rawURL) } -func (s *Service) InitProtocol(identity *ecdsa.PrivateKey, db *sql.DB) error { // nolint: gocyclo +func (s *Service) InitProtocol(identity *ecdsa.PrivateKey, db *sql.DB) error { if !s.config.PFSEnabled { return nil } diff --git a/services/wakuext/api_test.go b/services/wakuext/api_test.go index 939529661..26fd4072d 100644 --- a/services/wakuext/api_test.go +++ b/services/wakuext/api_test.go @@ -359,10 +359,11 @@ func (s *RequestMessagesSyncSuite) TestExpired() { }() _, err := s.localAPI.RequestMessagesSync( ext.RetryConfig{ - BaseTimeout: time.Second, + BaseTimeout: time.Millisecond * 100, }, ext.MessagesRequest{ MailServerPeer: s.localNode.String(), + Topics: []types.TopicType{{0x01, 0x02, 0x03, 0x04}}, }, ) s.Require().EqualError(err, "failed to request messages after 1 retries") diff --git a/services/wallet/downloader_test.go b/services/wallet/downloader_test.go index badcdd3e7..ddd399cc4 100644 --- a/services/wallet/downloader_test.go +++ b/services/wallet/downloader_test.go @@ -190,7 +190,17 @@ func (s *ERC20TransferSuite) SetupTest() { s.ethclient = ethclient.NewClient(client) s.downloader = NewERC20TransfersDownloader(s.ethclient, []common.Address{crypto.PubkeyToAddress(s.identity.PublicKey)}, s.signer) - _, tx, contract, err := erc20.DeployERC20Transfer(bind.NewKeyedTransactor(s.faucet), s.ethclient) + var ( + tx *types.Transaction + contract *erc20.ERC20Transfer + ) + for i := 0; i <= 3; i++ { + opts := bind.NewKeyedTransactor(s.faucet) + _, tx, contract, err = erc20.DeployERC20Transfer(opts, s.ethclient) + if err != nil { + continue + } + } s.Require().NoError(err) timeout, cancel := context.WithTimeout(context.Background(), 5*time.Second) defer cancel() @@ -209,8 +219,8 @@ func (s *ERC20TransferSuite) TestNoEvents() { } func (s *ERC20TransferSuite) TestInboundEvent() { - tx, err := s.contract.Transfer(bind.NewKeyedTransactor(s.faucet), crypto.PubkeyToAddress(s.identity.PublicKey), - big.NewInt(100)) + opts := bind.NewKeyedTransactor(s.faucet) + tx, err := s.contract.Transfer(opts, crypto.PubkeyToAddress(s.identity.PublicKey), big.NewInt(100)) s.Require().NoError(err) timeout, cancel := context.WithTimeout(context.Background(), 5*time.Second) defer cancel() @@ -228,9 +238,7 @@ func (s *ERC20TransferSuite) TestInboundEvent() { func (s *ERC20TransferSuite) TestOutboundEvent() { // give some eth to pay for gas ctx := context.TODO() - // nonce is 1 - contact with nonce 0 was deployed in setup - // FIXME request nonce - tx := types.NewTransaction(1, crypto.PubkeyToAddress(s.identity.PublicKey), big.NewInt(1e18), 1e6, big.NewInt(10), nil) + tx := types.NewTransaction(4, crypto.PubkeyToAddress(s.identity.PublicKey), big.NewInt(1e18), 1e6, big.NewInt(10), nil) tx, err := types.SignTx(tx, s.signer, s.faucet) s.Require().NoError(err) s.Require().NoError(s.ethclient.SendTransaction(ctx, tx)) @@ -239,7 +247,8 @@ func (s *ERC20TransferSuite) TestOutboundEvent() { cancel() s.Require().NoError(err) - tx, err = s.contract.Transfer(bind.NewKeyedTransactor(s.identity), common.Address{1}, big.NewInt(100)) + opts := bind.NewKeyedTransactor(s.identity) + tx, err = s.contract.Transfer(opts, common.Address{1}, big.NewInt(100)) s.Require().NoError(err) timeout, cancel = context.WithTimeout(context.Background(), 5*time.Second) _, err = bind.WaitMined(timeout, s.ethclient, tx) diff --git a/vendor/github.com/cenkalti/backoff/v3/.gitignore b/vendor/github.com/cenkalti/backoff/v3/.gitignore new file mode 100644 index 000000000..00268614f --- /dev/null +++ b/vendor/github.com/cenkalti/backoff/v3/.gitignore @@ -0,0 +1,22 @@ +# Compiled Object files, Static and Dynamic libs (Shared Objects) +*.o +*.a +*.so + +# Folders +_obj +_test + +# Architecture specific extensions/prefixes +*.[568vq] +[568vq].out + +*.cgo1.go +*.cgo2.c +_cgo_defun.c +_cgo_gotypes.go +_cgo_export.* + +_testmain.go + +*.exe diff --git a/vendor/github.com/cenkalti/backoff/v3/.travis.yml b/vendor/github.com/cenkalti/backoff/v3/.travis.yml new file mode 100644 index 000000000..47a6a46ec --- /dev/null +++ b/vendor/github.com/cenkalti/backoff/v3/.travis.yml @@ -0,0 +1,10 @@ +language: go +go: + - 1.7 + - 1.x + - tip +before_install: + - go get github.com/mattn/goveralls + - go get golang.org/x/tools/cmd/cover +script: + - $HOME/gopath/bin/goveralls -service=travis-ci diff --git a/vendor/github.com/cenkalti/backoff/v3/LICENSE b/vendor/github.com/cenkalti/backoff/v3/LICENSE new file mode 100644 index 000000000..89b817996 --- /dev/null +++ b/vendor/github.com/cenkalti/backoff/v3/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) 2014 Cenk Altı + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/github.com/cenkalti/backoff/v3/README.md b/vendor/github.com/cenkalti/backoff/v3/README.md new file mode 100644 index 000000000..3673df487 --- /dev/null +++ b/vendor/github.com/cenkalti/backoff/v3/README.md @@ -0,0 +1,33 @@ +# Exponential Backoff [![GoDoc][godoc image]][godoc] [![Build Status][travis image]][travis] [![Coverage Status][coveralls image]][coveralls] + +This is a Go port of the exponential backoff algorithm from [Google's HTTP Client Library for Java][google-http-java-client]. + +[Exponential backoff][exponential backoff wiki] +is an algorithm that uses feedback to multiplicatively decrease the rate of some process, +in order to gradually find an acceptable rate. +The retries exponentially increase and stop increasing when a certain threshold is met. + +## Usage + +Import path is `github.com/cenkalti/backoff/v3`. Please note the version part at the end. + +godoc.org does not support modules yet, +so you can use https://godoc.org/gopkg.in/cenkalti/backoff.v3 to view the documentation. + +## Contributing + +* I would like to keep this library as small as possible. +* Please don't send a PR without opening an issue and discussing it first. +* If proposed change is not a common use case, I will probably not accept it. + +[godoc]: https://godoc.org/github.com/cenkalti/backoff +[godoc image]: https://godoc.org/github.com/cenkalti/backoff?status.png +[travis]: https://travis-ci.org/cenkalti/backoff +[travis image]: https://travis-ci.org/cenkalti/backoff.png?branch=master +[coveralls]: https://coveralls.io/github/cenkalti/backoff?branch=master +[coveralls image]: https://coveralls.io/repos/github/cenkalti/backoff/badge.svg?branch=master + +[google-http-java-client]: https://github.com/google/google-http-java-client/blob/da1aa993e90285ec18579f1553339b00e19b3ab5/google-http-client/src/main/java/com/google/api/client/util/ExponentialBackOff.java +[exponential backoff wiki]: http://en.wikipedia.org/wiki/Exponential_backoff + +[advanced example]: https://godoc.org/github.com/cenkalti/backoff#example_ diff --git a/vendor/github.com/cenkalti/backoff/v3/backoff.go b/vendor/github.com/cenkalti/backoff/v3/backoff.go new file mode 100644 index 000000000..3676ee405 --- /dev/null +++ b/vendor/github.com/cenkalti/backoff/v3/backoff.go @@ -0,0 +1,66 @@ +// Package backoff implements backoff algorithms for retrying operations. +// +// Use Retry function for retrying operations that may fail. +// If Retry does not meet your needs, +// copy/paste the function into your project and modify as you wish. +// +// There is also Ticker type similar to time.Ticker. +// You can use it if you need to work with channels. +// +// See Examples section below for usage examples. +package backoff + +import "time" + +// BackOff is a backoff policy for retrying an operation. +type BackOff interface { + // NextBackOff returns the duration to wait before retrying the operation, + // or backoff. Stop to indicate that no more retries should be made. + // + // Example usage: + // + // duration := backoff.NextBackOff(); + // if (duration == backoff.Stop) { + // // Do not retry operation. + // } else { + // // Sleep for duration and retry operation. + // } + // + NextBackOff() time.Duration + + // Reset to initial state. + Reset() +} + +// Stop indicates that no more retries should be made for use in NextBackOff(). +const Stop time.Duration = -1 + +// ZeroBackOff is a fixed backoff policy whose backoff time is always zero, +// meaning that the operation is retried immediately without waiting, indefinitely. +type ZeroBackOff struct{} + +func (b *ZeroBackOff) Reset() {} + +func (b *ZeroBackOff) NextBackOff() time.Duration { return 0 } + +// StopBackOff is a fixed backoff policy that always returns backoff.Stop for +// NextBackOff(), meaning that the operation should never be retried. +type StopBackOff struct{} + +func (b *StopBackOff) Reset() {} + +func (b *StopBackOff) NextBackOff() time.Duration { return Stop } + +// ConstantBackOff is a backoff policy that always returns the same backoff delay. +// This is in contrast to an exponential backoff policy, +// which returns a delay that grows longer as you call NextBackOff() over and over again. +type ConstantBackOff struct { + Interval time.Duration +} + +func (b *ConstantBackOff) Reset() {} +func (b *ConstantBackOff) NextBackOff() time.Duration { return b.Interval } + +func NewConstantBackOff(d time.Duration) *ConstantBackOff { + return &ConstantBackOff{Interval: d} +} diff --git a/vendor/github.com/cenkalti/backoff/v3/context.go b/vendor/github.com/cenkalti/backoff/v3/context.go new file mode 100644 index 000000000..fcff86c1b --- /dev/null +++ b/vendor/github.com/cenkalti/backoff/v3/context.go @@ -0,0 +1,66 @@ +package backoff + +import ( + "context" + "time" +) + +// BackOffContext is a backoff policy that stops retrying after the context +// is canceled. +type BackOffContext interface { // nolint: golint + BackOff + Context() context.Context +} + +type backOffContext struct { + BackOff + ctx context.Context +} + +// WithContext returns a BackOffContext with context ctx +// +// ctx must not be nil +func WithContext(b BackOff, ctx context.Context) BackOffContext { // nolint: golint + if ctx == nil { + panic("nil context") + } + + if b, ok := b.(*backOffContext); ok { + return &backOffContext{ + BackOff: b.BackOff, + ctx: ctx, + } + } + + return &backOffContext{ + BackOff: b, + ctx: ctx, + } +} + +func getContext(b BackOff) context.Context { + if cb, ok := b.(BackOffContext); ok { + return cb.Context() + } + if tb, ok := b.(*backOffTries); ok { + return getContext(tb.delegate) + } + return context.Background() +} + +func (b *backOffContext) Context() context.Context { + return b.ctx +} + +func (b *backOffContext) NextBackOff() time.Duration { + select { + case <-b.ctx.Done(): + return Stop + default: + } + next := b.BackOff.NextBackOff() + if deadline, ok := b.ctx.Deadline(); ok && deadline.Sub(time.Now()) < next { // nolint: gosimple + return Stop + } + return next +} diff --git a/vendor/github.com/cenkalti/backoff/v3/exponential.go b/vendor/github.com/cenkalti/backoff/v3/exponential.go new file mode 100644 index 000000000..cb11cc1d2 --- /dev/null +++ b/vendor/github.com/cenkalti/backoff/v3/exponential.go @@ -0,0 +1,154 @@ +package backoff + +import ( + "math/rand" + "time" +) + +/* +ExponentialBackOff is a backoff implementation that increases the backoff +period for each retry attempt using a randomization function that grows exponentially. + +NextBackOff() is calculated using the following formula: + + randomized interval = + RetryInterval * (random value in range [1 - RandomizationFactor, 1 + RandomizationFactor]) + +In other words NextBackOff() will range between the randomization factor +percentage below and above the retry interval. + +For example, given the following parameters: + + RetryInterval = 2 + RandomizationFactor = 0.5 + Multiplier = 2 + +the actual backoff period used in the next retry attempt will range between 1 and 3 seconds, +multiplied by the exponential, that is, between 2 and 6 seconds. + +Note: MaxInterval caps the RetryInterval and not the randomized interval. + +If the time elapsed since an ExponentialBackOff instance is created goes past the +MaxElapsedTime, then the method NextBackOff() starts returning backoff.Stop. + +The elapsed time can be reset by calling Reset(). + +Example: Given the following default arguments, for 10 tries the sequence will be, +and assuming we go over the MaxElapsedTime on the 10th try: + + Request # RetryInterval (seconds) Randomized Interval (seconds) + + 1 0.5 [0.25, 0.75] + 2 0.75 [0.375, 1.125] + 3 1.125 [0.562, 1.687] + 4 1.687 [0.8435, 2.53] + 5 2.53 [1.265, 3.795] + 6 3.795 [1.897, 5.692] + 7 5.692 [2.846, 8.538] + 8 8.538 [4.269, 12.807] + 9 12.807 [6.403, 19.210] + 10 19.210 backoff.Stop + +Note: Implementation is not thread-safe. +*/ +type ExponentialBackOff struct { + InitialInterval time.Duration + RandomizationFactor float64 + Multiplier float64 + MaxInterval time.Duration + // After MaxElapsedTime the ExponentialBackOff stops. + // It never stops if MaxElapsedTime == 0. + MaxElapsedTime time.Duration + Clock Clock + + currentInterval time.Duration + startTime time.Time +} + +// Clock is an interface that returns current time for BackOff. +type Clock interface { + Now() time.Time +} + +// Default values for ExponentialBackOff. +const ( + DefaultInitialInterval = 500 * time.Millisecond + DefaultRandomizationFactor = 0.5 + DefaultMultiplier = 1.5 + DefaultMaxInterval = 60 * time.Second + DefaultMaxElapsedTime = 15 * time.Minute +) + +// NewExponentialBackOff creates an instance of ExponentialBackOff using default values. +func NewExponentialBackOff() *ExponentialBackOff { + b := &ExponentialBackOff{ + InitialInterval: DefaultInitialInterval, + RandomizationFactor: DefaultRandomizationFactor, + Multiplier: DefaultMultiplier, + MaxInterval: DefaultMaxInterval, + MaxElapsedTime: DefaultMaxElapsedTime, + Clock: SystemClock, + } + b.Reset() + return b +} + +type systemClock struct{} + +func (t systemClock) Now() time.Time { + return time.Now() +} + +// SystemClock implements Clock interface that uses time.Now(). +var SystemClock = systemClock{} + +// Reset the interval back to the initial retry interval and restarts the timer. +// Reset must be called before using b. +func (b *ExponentialBackOff) Reset() { + b.currentInterval = b.InitialInterval + b.startTime = b.Clock.Now() +} + +// NextBackOff calculates the next backoff interval using the formula: +// Randomized interval = RetryInterval * (1 ± RandomizationFactor) +func (b *ExponentialBackOff) NextBackOff() time.Duration { + // Make sure we have not gone over the maximum elapsed time. + if b.MaxElapsedTime != 0 && b.GetElapsedTime() > b.MaxElapsedTime { + return Stop + } + defer b.incrementCurrentInterval() + return getRandomValueFromInterval(b.RandomizationFactor, rand.Float64(), b.currentInterval) +} + +// GetElapsedTime returns the elapsed time since an ExponentialBackOff instance +// is created and is reset when Reset() is called. +// +// The elapsed time is computed using time.Now().UnixNano(). It is +// safe to call even while the backoff policy is used by a running +// ticker. +func (b *ExponentialBackOff) GetElapsedTime() time.Duration { + return b.Clock.Now().Sub(b.startTime) +} + +// Increments the current interval by multiplying it with the multiplier. +func (b *ExponentialBackOff) incrementCurrentInterval() { + // Check for overflow, if overflow is detected set the current interval to the max interval. + if float64(b.currentInterval) >= float64(b.MaxInterval)/b.Multiplier { + b.currentInterval = b.MaxInterval + } else { + b.currentInterval = time.Duration(float64(b.currentInterval) * b.Multiplier) + } +} + +// Returns a random value from the following interval: +// [randomizationFactor * currentInterval, randomizationFactor * currentInterval]. +func getRandomValueFromInterval(randomizationFactor, random float64, currentInterval time.Duration) time.Duration { + var delta = randomizationFactor * float64(currentInterval) + var minInterval = float64(currentInterval) - delta + var maxInterval = float64(currentInterval) + delta + + // Get a random value from the range [minInterval, maxInterval]. + // The formula used below has a +1 because if the minInterval is 1 and the maxInterval is 3 then + // we want a 33% chance for selecting either 1, 2 or 3. + return time.Duration(minInterval + (random * (maxInterval - minInterval + 1))) +} diff --git a/vendor/github.com/cenkalti/backoff/v3/go.mod b/vendor/github.com/cenkalti/backoff/v3/go.mod new file mode 100644 index 000000000..479e62ada --- /dev/null +++ b/vendor/github.com/cenkalti/backoff/v3/go.mod @@ -0,0 +1,3 @@ +module github.com/cenkalti/backoff/v3 + +go 1.12 diff --git a/vendor/github.com/cenkalti/backoff/v3/retry.go b/vendor/github.com/cenkalti/backoff/v3/retry.go new file mode 100644 index 000000000..6c776ccf8 --- /dev/null +++ b/vendor/github.com/cenkalti/backoff/v3/retry.go @@ -0,0 +1,96 @@ +package backoff + +import "time" + +// An Operation is executing by Retry() or RetryNotify(). +// The operation will be retried using a backoff policy if it returns an error. +type Operation func() error + +// Notify is a notify-on-error function. It receives an operation error and +// backoff delay if the operation failed (with an error). +// +// NOTE that if the backoff policy stated to stop retrying, +// the notify function isn't called. +type Notify func(error, time.Duration) + +// Retry the operation o until it does not return error or BackOff stops. +// o is guaranteed to be run at least once. +// +// If o returns a *PermanentError, the operation is not retried, and the +// wrapped error is returned. +// +// Retry sleeps the goroutine for the duration returned by BackOff after a +// failed operation returns. +func Retry(o Operation, b BackOff) error { + return RetryNotify(o, b, nil) +} + +// RetryNotify calls notify function with the error and wait duration +// for each failed attempt before sleep. +func RetryNotify(operation Operation, b BackOff, notify Notify) error { + return RetryNotifyWithTimer(operation, b, notify, nil) +} + +// RetryNotifyWithTimer calls notify function with the error and wait duration using the given Timer +// for each failed attempt before sleep. +// A default timer that uses system timer is used when nil is passed. +func RetryNotifyWithTimer(operation Operation, b BackOff, notify Notify, t Timer) error { + var err error + var next time.Duration + if t == nil { + t = &defaultTimer{} + } + + defer func() { + t.Stop() + }() + + ctx := getContext(b) + + b.Reset() + for { + if err = operation(); err == nil { + return nil + } + + if permanent, ok := err.(*PermanentError); ok { + return permanent.Err + } + + if next = b.NextBackOff(); next == Stop { + return err + } + + if notify != nil { + notify(err, next) + } + + t.Start(next) + + select { + case <-ctx.Done(): + return ctx.Err() + case <-t.C(): + } + } +} + +// PermanentError signals that the operation should not be retried. +type PermanentError struct { + Err error +} + +func (e *PermanentError) Error() string { + return e.Err.Error() +} + +func (e *PermanentError) Unwrap() error { + return e.Err +} + +// Permanent wraps the given err in a *PermanentError. +func Permanent(err error) *PermanentError { + return &PermanentError{ + Err: err, + } +} diff --git a/vendor/github.com/cenkalti/backoff/v3/ticker.go b/vendor/github.com/cenkalti/backoff/v3/ticker.go new file mode 100644 index 000000000..ed699e0e3 --- /dev/null +++ b/vendor/github.com/cenkalti/backoff/v3/ticker.go @@ -0,0 +1,94 @@ +package backoff + +import ( + "context" + "sync" + "time" +) + +// Ticker holds a channel that delivers `ticks' of a clock at times reported by a BackOff. +// +// Ticks will continue to arrive when the previous operation is still running, +// so operations that take a while to fail could run in quick succession. +type Ticker struct { + C <-chan time.Time + c chan time.Time + b BackOff + ctx context.Context + timer Timer + stop chan struct{} + stopOnce sync.Once +} + +// NewTicker returns a new Ticker containing a channel that will send +// the time at times specified by the BackOff argument. Ticker is +// guaranteed to tick at least once. The channel is closed when Stop +// method is called or BackOff stops. It is not safe to manipulate the +// provided backoff policy (notably calling NextBackOff or Reset) +// while the ticker is running. +func NewTicker(b BackOff) *Ticker { + return NewTickerWithTimer(b, &defaultTimer{}) +} + +// NewTickerWithTimer returns a new Ticker with a custom timer. +// A default timer that uses system timer is used when nil is passed. +func NewTickerWithTimer(b BackOff, timer Timer) *Ticker { + c := make(chan time.Time) + t := &Ticker{ + C: c, + c: c, + b: b, + ctx: getContext(b), + timer: timer, + stop: make(chan struct{}), + } + t.b.Reset() + go t.run() + return t +} + +// Stop turns off a ticker. After Stop, no more ticks will be sent. +func (t *Ticker) Stop() { + t.stopOnce.Do(func() { close(t.stop) }) +} + +func (t *Ticker) run() { + c := t.c + defer close(c) + + // Ticker is guaranteed to tick at least once. + afterC := t.send(time.Now()) + + for { + if afterC == nil { + return + } + + select { + case tick := <-afterC: + afterC = t.send(tick) + case <-t.stop: + t.c = nil // Prevent future ticks from being sent to the channel. + return + case <-t.ctx.Done(): + return + } + } +} + +func (t *Ticker) send(tick time.Time) <-chan time.Time { + select { + case t.c <- tick: + case <-t.stop: + return nil + } + + next := t.b.NextBackOff() + if next == Stop { + t.Stop() + return nil + } + + t.timer.Start(next) + return t.timer.C() +} diff --git a/vendor/github.com/cenkalti/backoff/v3/timer.go b/vendor/github.com/cenkalti/backoff/v3/timer.go new file mode 100644 index 000000000..8120d0213 --- /dev/null +++ b/vendor/github.com/cenkalti/backoff/v3/timer.go @@ -0,0 +1,35 @@ +package backoff + +import "time" + +type Timer interface { + Start(duration time.Duration) + Stop() + C() <-chan time.Time +} + +// defaultTimer implements Timer interface using time.Timer +type defaultTimer struct { + timer *time.Timer +} + +// C returns the timers channel which receives the current time when the timer fires. +func (t *defaultTimer) C() <-chan time.Time { + return t.timer.C +} + +// Start starts the timer to fire after the given duration +func (t *defaultTimer) Start(duration time.Duration) { + if t.timer == nil { + t.timer = time.NewTimer(duration) + } else { + t.timer.Reset(duration) + } +} + +// Stop is called when the timer is not used anymore and resources may be freed. +func (t *defaultTimer) Stop() { + if t.timer != nil { + t.timer.Stop() + } +} diff --git a/vendor/github.com/cenkalti/backoff/v3/tries.go b/vendor/github.com/cenkalti/backoff/v3/tries.go new file mode 100644 index 000000000..cfeefd9b7 --- /dev/null +++ b/vendor/github.com/cenkalti/backoff/v3/tries.go @@ -0,0 +1,35 @@ +package backoff + +import "time" + +/* +WithMaxRetries creates a wrapper around another BackOff, which will +return Stop if NextBackOff() has been called too many times since +the last time Reset() was called + +Note: Implementation is not thread-safe. +*/ +func WithMaxRetries(b BackOff, max uint64) BackOff { + return &backOffTries{delegate: b, maxTries: max} +} + +type backOffTries struct { + delegate BackOff + maxTries uint64 + numTries uint64 +} + +func (b *backOffTries) NextBackOff() time.Duration { + if b.maxTries > 0 { + if b.maxTries <= b.numTries { + return Stop + } + b.numTries++ + } + return b.delegate.NextBackOff() +} + +func (b *backOffTries) Reset() { + b.numTries = 0 + b.delegate.Reset() +} diff --git a/vendor/github.com/gballet/go-libpcsclite/error.go b/vendor/github.com/gballet/go-libpcsclite/error.go index 4710de5e6..87cfee3d0 100644 --- a/vendor/github.com/gballet/go-libpcsclite/error.go +++ b/vendor/github.com/gballet/go-libpcsclite/error.go @@ -36,66 +36,66 @@ type ErrorCode uint32 const ( SCardSuccess ErrorCode = 0x00000000 /* No error was encountered. */ - ErrSCardInternal = 0x80100001 /* An internal consistency check failed. */ - ErrSCardCancelled = 0x80100002 /* The action was cancelled by an SCardCancel request. */ - ErrSCardInvalidHandle = 0x80100003 /* The supplied handle was invalid. */ - ErrSCardInvalidParameter = 0x80100004 /* One or more of the supplied parameters could not be properly interpreted. */ - ErrSCardInvalidTarget = 0x80100005 /* Registry startup information is missing or invalid. */ - ErrSCardNoMemory = 0x80100006 /* Not enough memory available to complete this command. */ - ErrSCardWaitedTooLong = 0x80100007 /* An internal consistency timer has expired. */ - ErrSCardInsufficientBuffer = 0x80100008 /* The data buffer to receive returned data is too small for the returned data. */ - ErrScardUnknownReader = 0x80100009 /* The specified reader name is not recognized. */ - ErrSCardTimeout = 0x8010000A /* The user-specified timeout value has expired. */ - ErrSCardSharingViolation = 0x8010000B /* The smart card cannot be accessed because of other connections outstanding. */ - ErrSCardNoSmartCard = 0x8010000C /* The operation requires a Smart Card, but no Smart Card is currently in the device. */ - ErrSCardUnknownCard = 0x8010000D /* The specified smart card name is not recognized. */ - ErrSCardCannotDispose = 0x8010000E /* The system could not dispose of the media in the requested manner. */ - ErrSCardProtoMismatch = 0x8010000F /* The requested protocols are incompatible with the protocol currently in use with the smart card. */ - ErrSCardNotReady = 0x80100010 /* The reader or smart card is not ready to accept commands. */ - ErrSCardInvalidValue = 0x80100011 /* One or more of the supplied parameters values could not be properly interpreted. */ - ErrSCardSystemCancelled = 0x80100012 /* The action was cancelled by the system, presumably to log off or shut down. */ - ErrSCardCommError = 0x80100013 /* An internal communications error has been detected. */ - ErrScardUnknownError = 0x80100014 /* An internal error has been detected, but the source is unknown. */ - ErrSCardInvalidATR = 0x80100015 /* An ATR obtained from the registry is not a valid ATR string. */ - ErrSCardNotTransacted = 0x80100016 /* An attempt was made to end a non-existent transaction. */ - ErrSCardReaderUnavailable = 0x80100017 /* The specified reader is not currently available for use. */ - ErrSCardShutdown = 0x80100018 /* The operation has been aborted to allow the server application to exit. */ - ErrSCardPCITooSmall = 0x80100019 /* The PCI Receive buffer was too small. */ - ErrSCardReaderUnsupported = 0x8010001A /* The reader driver does not meet minimal requirements for support. */ - ErrSCardDuplicateReader = 0x8010001B /* The reader driver did not produce a unique reader name. */ - ErrSCardCardUnsupported = 0x8010001C /* The smart card does not meet minimal requirements for support. */ - ErrScardNoService = 0x8010001D /* The Smart card resource manager is not running. */ - ErrSCardServiceStopped = 0x8010001E /* The Smart card resource manager has shut down. */ - ErrSCardUnexpected = 0x8010001F /* An unexpected card error has occurred. */ - ErrSCardUnsupportedFeature = 0x8010001F /* This smart card does not support the requested feature. */ - ErrSCardICCInstallation = 0x80100020 /* No primary provider can be found for the smart card. */ - ErrSCardICCCreateOrder = 0x80100021 /* The requested order of object creation is not supported. */ - ErrSCardDirNotFound = 0x80100023 /* The identified directory does not exist in the smart card. */ - ErrSCardFileNotFound = 0x80100024 /* The identified file does not exist in the smart card. */ - ErrSCardNoDir = 0x80100025 /* The supplied path does not represent a smart card directory. */ - ErrSCardNoFile = 0x80100026 /* The supplied path does not represent a smart card file. */ - ErrScardNoAccess = 0x80100027 /* Access is denied to this file. */ - ErrSCardWriteTooMany = 0x80100028 /* The smart card does not have enough memory to store the information. */ - ErrSCardBadSeek = 0x80100029 /* There was an error trying to set the smart card file object pointer. */ - ErrSCardInvalidCHV = 0x8010002A /* The supplied PIN is incorrect. */ - ErrSCardUnknownResMNG = 0x8010002B /* An unrecognized error code was returned from a layered component. */ - ErrSCardNoSuchCertificate = 0x8010002C /* The requested certificate does not exist. */ - ErrSCardCertificateUnavailable = 0x8010002D /* The requested certificate could not be obtained. */ - ErrSCardNoReadersAvailable = 0x8010002E /* Cannot find a smart card reader. */ - ErrSCardCommDataLost = 0x8010002F /* A communications error with the smart card has been detected. Retry the operation. */ - ErrScardNoKeyContainer = 0x80100030 /* The requested key container does not exist on the smart card. */ - ErrSCardServerTooBusy = 0x80100031 /* The Smart Card Resource Manager is too busy to complete this operation. */ - ErrSCardUnsupportedCard = 0x80100065 /* The reader cannot communicate with the card, due to ATR string configuration conflicts. */ - ErrSCardUnresponsiveCard = 0x80100066 /* The smart card is not responding to a reset. */ - ErrSCardUnpoweredCard = 0x80100067 /* Power has been removed from the smart card, so that further communication is not possible. */ - ErrSCardResetCard = 0x80100068 /* The smart card has been reset, so any shared state information is invalid. */ - ErrSCardRemovedCard = 0x80100069 /* The smart card has been removed, so further communication is not possible. */ - ErrSCardSecurityViolation = 0x8010006A /* Access was denied because of a security violation. */ - ErrSCardWrongCHV = 0x8010006B /* The card cannot be accessed because the wrong PIN was presented. */ - ErrSCardCHVBlocked = 0x8010006C /* The card cannot be accessed because the maximum number of PIN entry attempts has been reached. */ - ErrSCardEOF = 0x8010006D /* The end of the smart card file has been reached. */ - ErrSCardCancelledByUser = 0x8010006E /* The user pressed "Cancel" on a Smart Card Selection Dialog. */ - ErrSCardCardNotAuthenticated = 0x8010006F /* No PIN was presented to the smart card. */ + ErrSCardInternal ErrorCode = 0x80100001 /* An internal consistency check failed. */ + ErrSCardCancelled ErrorCode = 0x80100002 /* The action was cancelled by an SCardCancel request. */ + ErrSCardInvalidHandle ErrorCode = 0x80100003 /* The supplied handle was invalid. */ + ErrSCardInvalidParameter ErrorCode = 0x80100004 /* One or more of the supplied parameters could not be properly interpreted. */ + ErrSCardInvalidTarget ErrorCode = 0x80100005 /* Registry startup information is missing or invalid. */ + ErrSCardNoMemory ErrorCode = 0x80100006 /* Not enough memory available to complete this command. */ + ErrSCardWaitedTooLong ErrorCode = 0x80100007 /* An internal consistency timer has expired. */ + ErrSCardInsufficientBuffer ErrorCode = 0x80100008 /* The data buffer to receive returned data is too small for the returned data. */ + ErrScardUnknownReader ErrorCode = 0x80100009 /* The specified reader name is not recognized. */ + ErrSCardTimeout ErrorCode = 0x8010000A /* The user-specified timeout value has expired. */ + ErrSCardSharingViolation ErrorCode = 0x8010000B /* The smart card cannot be accessed because of other connections outstanding. */ + ErrSCardNoSmartCard ErrorCode = 0x8010000C /* The operation requires a Smart Card, but no Smart Card is currently in the device. */ + ErrSCardUnknownCard ErrorCode = 0x8010000D /* The specified smart card name is not recognized. */ + ErrSCardCannotDispose ErrorCode = 0x8010000E /* The system could not dispose of the media in the requested manner. */ + ErrSCardProtoMismatch ErrorCode = 0x8010000F /* The requested protocols are incompatible with the protocol currently in use with the smart card. */ + ErrSCardNotReady ErrorCode = 0x80100010 /* The reader or smart card is not ready to accept commands. */ + ErrSCardInvalidValue ErrorCode = 0x80100011 /* One or more of the supplied parameters values could not be properly interpreted. */ + ErrSCardSystemCancelled ErrorCode = 0x80100012 /* The action was cancelled by the system, presumably to log off or shut down. */ + ErrSCardCommError ErrorCode = 0x80100013 /* An internal communications error has been detected. */ + ErrScardUnknownError ErrorCode = 0x80100014 /* An internal error has been detected, but the source is unknown. */ + ErrSCardInvalidATR ErrorCode = 0x80100015 /* An ATR obtained from the registry is not a valid ATR string. */ + ErrSCardNotTransacted ErrorCode = 0x80100016 /* An attempt was made to end a non-existent transaction. */ + ErrSCardReaderUnavailable ErrorCode = 0x80100017 /* The specified reader is not currently available for use. */ + ErrSCardShutdown ErrorCode = 0x80100018 /* The operation has been aborted to allow the server application to exit. */ + ErrSCardPCITooSmall ErrorCode = 0x80100019 /* The PCI Receive buffer was too small. */ + ErrSCardReaderUnsupported ErrorCode = 0x8010001A /* The reader driver does not meet minimal requirements for support. */ + ErrSCardDuplicateReader ErrorCode = 0x8010001B /* The reader driver did not produce a unique reader name. */ + ErrSCardCardUnsupported ErrorCode = 0x8010001C /* The smart card does not meet minimal requirements for support. */ + ErrScardNoService ErrorCode = 0x8010001D /* The Smart card resource manager is not running. */ + ErrSCardServiceStopped ErrorCode = 0x8010001E /* The Smart card resource manager has shut down. */ + ErrSCardUnexpected ErrorCode = 0x8010001F /* An unexpected card error has occurred. */ + ErrSCardUnsupportedFeature ErrorCode = 0x8010001F /* This smart card does not support the requested feature. */ + ErrSCardICCInstallation ErrorCode = 0x80100020 /* No primary provider can be found for the smart card. */ + ErrSCardICCCreateOrder ErrorCode = 0x80100021 /* The requested order of object creation is not supported. */ + ErrSCardDirNotFound ErrorCode = 0x80100023 /* The identified directory does not exist in the smart card. */ + ErrSCardFileNotFound ErrorCode = 0x80100024 /* The identified file does not exist in the smart card. */ + ErrSCardNoDir ErrorCode = 0x80100025 /* The supplied path does not represent a smart card directory. */ + ErrSCardNoFile ErrorCode = 0x80100026 /* The supplied path does not represent a smart card file. */ + ErrScardNoAccess ErrorCode = 0x80100027 /* Access is denied to this file. */ + ErrSCardWriteTooMany ErrorCode = 0x80100028 /* The smart card does not have enough memory to store the information. */ + ErrSCardBadSeek ErrorCode = 0x80100029 /* There was an error trying to set the smart card file object pointer. */ + ErrSCardInvalidCHV ErrorCode = 0x8010002A /* The supplied PIN is incorrect. */ + ErrSCardUnknownResMNG ErrorCode = 0x8010002B /* An unrecognized error code was returned from a layered component. */ + ErrSCardNoSuchCertificate ErrorCode = 0x8010002C /* The requested certificate does not exist. */ + ErrSCardCertificateUnavailable ErrorCode = 0x8010002D /* The requested certificate could not be obtained. */ + ErrSCardNoReadersAvailable ErrorCode = 0x8010002E /* Cannot find a smart card reader. */ + ErrSCardCommDataLost ErrorCode = 0x8010002F /* A communications error with the smart card has been detected. Retry the operation. */ + ErrScardNoKeyContainer ErrorCode = 0x80100030 /* The requested key container does not exist on the smart card. */ + ErrSCardServerTooBusy ErrorCode = 0x80100031 /* The Smart Card Resource Manager is too busy to complete this operation. */ + ErrSCardUnsupportedCard ErrorCode = 0x80100065 /* The reader cannot communicate with the card, due to ATR string configuration conflicts. */ + ErrSCardUnresponsiveCard ErrorCode = 0x80100066 /* The smart card is not responding to a reset. */ + ErrSCardUnpoweredCard ErrorCode = 0x80100067 /* Power has been removed from the smart card, so that further communication is not possible. */ + ErrSCardResetCard ErrorCode = 0x80100068 /* The smart card has been reset, so any shared state information is invalid. */ + ErrSCardRemovedCard ErrorCode = 0x80100069 /* The smart card has been removed, so further communication is not possible. */ + ErrSCardSecurityViolation ErrorCode = 0x8010006A /* Access was denied because of a security violation. */ + ErrSCardWrongCHV ErrorCode = 0x8010006B /* The card cannot be accessed because the wrong PIN was presented. */ + ErrSCardCHVBlocked ErrorCode = 0x8010006C /* The card cannot be accessed because the maximum number of PIN entry attempts has been reached. */ + ErrSCardEOF ErrorCode = 0x8010006D /* The end of the smart card file has been reached. */ + ErrSCardCancelledByUser ErrorCode = 0x8010006E /* The user pressed "Cancel" on a Smart Card Selection Dialog. */ + ErrSCardCardNotAuthenticated ErrorCode = 0x8010006F /* No PIN was presented to the smart card. */ ) // Code returns the error code, with an uint32 type to be used in PutUInt32 @@ -106,95 +106,95 @@ func (code ErrorCode) Code() uint32 { func (code ErrorCode) Error() error { switch code { case SCardSuccess: - return fmt.Errorf("Command successful") + return fmt.Errorf("command successful") case ErrSCardInternal: - return fmt.Errorf("Internal error") + return fmt.Errorf("internal error") case ErrSCardCancelled: - return fmt.Errorf("Command cancelled") + return fmt.Errorf("command cancelled") case ErrSCardInvalidHandle: - return fmt.Errorf("Invalid handle") + return fmt.Errorf("invalid handle") case ErrSCardInvalidParameter: - return fmt.Errorf("Invalid parameter given") + return fmt.Errorf("invalid parameter given") case ErrSCardInvalidTarget: - return fmt.Errorf("Invalid target given") + return fmt.Errorf("invalid target given") case ErrSCardNoMemory: - return fmt.Errorf("Not enough memory") + return fmt.Errorf("not enough memory") case ErrSCardWaitedTooLong: - return fmt.Errorf("Waited too long") + return fmt.Errorf("waited too long") case ErrSCardInsufficientBuffer: - return fmt.Errorf("Insufficient buffer") + return fmt.Errorf("insufficient buffer") case ErrScardUnknownReader: - return fmt.Errorf("Unknown reader specified") + return fmt.Errorf("unknown reader specified") case ErrSCardTimeout: - return fmt.Errorf("Command timeout") + return fmt.Errorf("command timeout") case ErrSCardSharingViolation: - return fmt.Errorf("Sharing violation") + return fmt.Errorf("sharing violation") case ErrSCardNoSmartCard: - return fmt.Errorf("No smart card inserted") + return fmt.Errorf("no smart card inserted") case ErrSCardUnknownCard: - return fmt.Errorf("Unknown card") + return fmt.Errorf("unknown card") case ErrSCardCannotDispose: - return fmt.Errorf("Cannot dispose handle") + return fmt.Errorf("cannot dispose handle") case ErrSCardProtoMismatch: - return fmt.Errorf("Card protocol mismatch") + return fmt.Errorf("card protocol mismatch") case ErrSCardNotReady: - return fmt.Errorf("Subsystem not ready") + return fmt.Errorf("subsystem not ready") case ErrSCardInvalidValue: - return fmt.Errorf("Invalid value given") + return fmt.Errorf("invalid value given") case ErrSCardSystemCancelled: - return fmt.Errorf("System cancelled") + return fmt.Errorf("system cancelled") case ErrSCardCommError: - return fmt.Errorf("RPC transport error") + return fmt.Errorf("rpc transport error") case ErrScardUnknownError: - return fmt.Errorf("Unknown error") + return fmt.Errorf("unknown error") case ErrSCardInvalidATR: - return fmt.Errorf("Invalid ATR") + return fmt.Errorf("invalid ATR") case ErrSCardNotTransacted: - return fmt.Errorf("Transaction failed") + return fmt.Errorf("transaction failed") case ErrSCardReaderUnavailable: - return fmt.Errorf("Reader is unavailable") + return fmt.Errorf("reader is unavailable") /* case SCARD_P_SHUTDOWN: */ case ErrSCardPCITooSmall: return fmt.Errorf("PCI struct too small") case ErrSCardReaderUnsupported: - return fmt.Errorf("Reader is unsupported") + return fmt.Errorf("reader is unsupported") case ErrSCardDuplicateReader: - return fmt.Errorf("Reader already exists") + return fmt.Errorf("reader already exists") case ErrSCardCardUnsupported: - return fmt.Errorf("Card is unsupported") + return fmt.Errorf("card is unsupported") case ErrScardNoService: - return fmt.Errorf("Service not available") + return fmt.Errorf("service not available") case ErrSCardServiceStopped: - return fmt.Errorf("Service was stopped") + return fmt.Errorf("service was stopped") /* case SCARD_E_UNEXPECTED: */ /* case SCARD_E_ICC_CREATEORDER: */ @@ -210,7 +210,7 @@ func (code ErrorCode) Error() error { /* case SCARD_E_NO_SUCH_CERTIFICATE: */ /* case SCARD_E_CERTIFICATE_UNAVAILABLE: */ case ErrSCardNoReadersAvailable: - return fmt.Errorf("Cannot find a smart card reader") + return fmt.Errorf("cannot find a smart card reader") /* case SCARD_E_COMM_DATA_LOST: */ /* case SCARD_E_NO_KEY_CONTAINER: */ @@ -238,7 +238,7 @@ func (code ErrorCode) Error() error { /* case SCARD_W_CARD_NOT_AUTHENTICATED: */ case ErrSCardUnsupportedFeature: - return fmt.Errorf("Feature not supported") + return fmt.Errorf("feature not supported") default: return fmt.Errorf("unknown error: %08x", code) diff --git a/vendor/github.com/gballet/go-libpcsclite/winscard.go b/vendor/github.com/gballet/go-libpcsclite/winscard.go index b916db162..791c974f1 100644 --- a/vendor/github.com/gballet/go-libpcsclite/winscard.go +++ b/vendor/github.com/gballet/go-libpcsclite/winscard.go @@ -291,16 +291,16 @@ func (client *Client) Connect(name string, shareMode uint32, preferredProtocol u * * These data are passed throw the field \c sharedSegmentMsg.data. */ -type transmit struct { - hCard uint32 - ioSendPciProtocol uint32 - ioSendPciLength uint32 - cbSendLength uint32 - ioRecvPciProtocol uint32 - ioRecvPciLength uint32 - pcbRecvLength uint32 - rv uint32 -} +//type transmit struct { +//hCard uint32 +//ioSendPciProtocol uint32 +//ioSendPciLength uint32 +//cbSendLength uint32 +//ioRecvPciProtocol uint32 +//ioRecvPciLength uint32 +//pcbRecvLength uint32 +//rv uint32 +//} // SCardIoRequest contains the info needed for performing an IO request type SCardIoRequest struct { @@ -336,7 +336,7 @@ func (card *Card) Transmit(adpu []byte) ([]byte, *SCardIoRequest, error) { return nil, nil, err } if n != len(adpu) { - return nil, nil, fmt.Errorf("Invalid number of bytes written: expected %d, got %d", len(adpu), n) + return nil, nil, fmt.Errorf("invalid number of bytes written: expected %d, got %d", len(adpu), n) } response := [TransmitRequestLength]byte{} total := 0 diff --git a/vendor/github.com/golang-migrate/migrate/v4/.golangci.yml b/vendor/github.com/golang-migrate/migrate/v4/.golangci.yml index 2d4d89158..f447ee1ce 100644 --- a/vendor/github.com/golang-migrate/migrate/v4/.golangci.yml +++ b/vendor/github.com/golang-migrate/migrate/v4/.golangci.yml @@ -1,6 +1,6 @@ run: # timeout for analysis, e.g. 30s, 5m, default is 1m - deadline: 2m + timeout: 2m linters: enable: #- golint diff --git a/vendor/github.com/golang-migrate/migrate/v4/.travis.yml b/vendor/github.com/golang-migrate/migrate/v4/.travis.yml index 09183cc5b..c2367b3e1 100644 --- a/vendor/github.com/golang-migrate/migrate/v4/.travis.yml +++ b/vendor/github.com/golang-migrate/migrate/v4/.travis.yml @@ -6,8 +6,8 @@ matrix: - go: master include: # Supported versions of Go: https://golang.org/dl/ - - go: "1.11.x" - go: "1.12.x" + - go: "1.13.x" - go: master go_import_path: github.com/golang-migrate/migrate @@ -34,7 +34,7 @@ before_install: - sudo apt-get update - sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce # Install golangci-lint - - curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(go env GOPATH)/bin v1.17.1 + - curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(go env GOPATH)/bin v1.22.2 - echo "TRAVIS_GO_VERSION=${TRAVIS_GO_VERSION}" install: @@ -57,11 +57,13 @@ deploy: secure: hWH1HLPpzpfA8pXQ93T1qKQVFSpQp0as/JLQ7D91jHuJ8p+RxVeqblDrR6HQY/95R/nyiE9GJmvUolSuw5h449LSrGxPtVWhdh6EnkxlQHlen5XeMhVjRjFV0sE9qGe8v7uAkiTfRO61ktTWHrEAvw5qpyqnNISodmZS78XIasPODQbNlzwINhWhDTHIjXGb4FpizYaL3OGCanrxfR9fQyCaqKGGBjRq3Mfq8U6Yd4mApmsE+uJxgaZV8K5zBqpkSzQRWhcVGNL5DuLsU3gfSJOo7kZeA2G71SHffH577dBoqtCZ4VFv169CoUZehLWCb+7XKJZmHXVujCURATSySLGUOPc6EoLFAn3YtsCA04mS4bZVo5FZPWVwfhjmkhtDR4f6wscKp7r1HsFHSOgm59QfETQdrn4MnZ44H2Jd39axqndn5DvK9EcZVjPHynOPnueXP2u6mTuUgh2VyyWBCDO3CNo0fGlo7VJI69IkIWNSD87K9cHZWYMClyKZkUzS+PmRAhHRYbVd+9ZjKOmnU36kUHNDG/ft1D4ogsY+rhVtXB4lgWDM5adri+EIScYdYnB1/pQexLBigcJY9uE7nQTR0U6QgVNYvun7uRNs40E0c4voSfmPdFO0FlOD2y1oQhnaXfWLbu9nMcTcs4RFGrcC7NzkUN4/WjG8s285V6w= skip_cleanup: true on: - go: "1.12.x" + go: "1.13.x" repo: golang-migrate/migrate tags: true file: - cli/build/migrate.linux-amd64.tar.gz + - cli/build/migrate.linux-armv7.tar.gz + - cli/build/migrate.linux-arm64.tar.gz - cli/build/migrate.darwin-amd64.tar.gz - cli/build/migrate.windows-amd64.exe.tar.gz - cli/build/sha256sum.txt @@ -75,7 +77,7 @@ deploy: package_glob: '*.deb' skip_cleanup: true on: - go: "1.12.x" + go: "1.13.x" repo: golang-migrate/migrate tags: true - provider: packagecloud @@ -87,7 +89,7 @@ deploy: package_glob: '*.deb' skip_cleanup: true on: - go: "1.12.x" + go: "1.13.x" repo: golang-migrate/migrate tags: true - provider: packagecloud @@ -99,7 +101,7 @@ deploy: package_glob: '*.deb' skip_cleanup: true on: - go: "1.12.x" + go: "1.13.x" repo: golang-migrate/migrate tags: true - provider: packagecloud @@ -111,7 +113,7 @@ deploy: package_glob: '*.deb' skip_cleanup: true on: - go: "1.12.x" + go: "1.13.x" repo: golang-migrate/migrate tags: true - provider: packagecloud @@ -123,13 +125,13 @@ deploy: package_glob: '*.deb' skip_cleanup: true on: - go: "1.12.x" + go: "1.13.x" repo: golang-migrate/migrate tags: true - provider: script script: ./docker-deploy.sh skip_cleanup: true on: - go: "1.12.x" + go: "1.13.x" repo: golang-migrate/migrate tags: true diff --git a/vendor/github.com/golang-migrate/migrate/v4/Dockerfile b/vendor/github.com/golang-migrate/migrate/v4/Dockerfile index cb11b0b2e..bd37e5f14 100644 --- a/vendor/github.com/golang-migrate/migrate/v4/Dockerfile +++ b/vendor/github.com/golang-migrate/migrate/v4/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.12-alpine3.10 AS downloader +FROM golang:1.13-alpine3.11 AS downloader ARG VERSION RUN apk add --no-cache git gcc musl-dev @@ -8,12 +8,12 @@ WORKDIR /go/src/github.com/golang-migrate/migrate COPY . ./ ENV GO111MODULE=on -ENV DATABASES="postgres mysql redshift cassandra spanner cockroachdb clickhouse mongodb sqlserver" +ENV DATABASES="postgres mysql redshift cassandra spanner cockroachdb clickhouse mongodb sqlserver firebird" ENV SOURCES="file go_bindata github github_ee aws_s3 google_cloud_storage godoc_vfs gitlab" RUN go build -a -o build/migrate.linux-386 -ldflags="-s -w -X main.Version=${VERSION}" -tags "$DATABASES $SOURCES" ./cmd/migrate -FROM alpine:3.10 +FROM alpine:3.11 RUN apk add --no-cache ca-certificates diff --git a/vendor/github.com/golang-migrate/migrate/v4/Makefile b/vendor/github.com/golang-migrate/migrate/v4/Makefile index a0cd24afe..426f27a5a 100644 --- a/vendor/github.com/golang-migrate/migrate/v4/Makefile +++ b/vendor/github.com/golang-migrate/migrate/v4/Makefile @@ -1,5 +1,5 @@ SOURCE ?= file go_bindata github github_ee aws_s3 google_cloud_storage godoc_vfs gitlab -DATABASE ?= postgres mysql redshift cassandra spanner cockroachdb clickhouse mongodb sqlserver +DATABASE ?= postgres mysql redshift cassandra spanner cockroachdb clickhouse mongodb sqlserver firebird VERSION ?= $(shell git describe --tags 2>/dev/null | cut -c 2-) TEST_FLAGS ?= REPO_OWNER ?= $(shell cd .. && basename "$$(pwd)") @@ -9,6 +9,8 @@ COVERAGE_DIR ?= .coverage build-cli: clean -mkdir ./cli/build cd ./cmd/migrate && CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o ../../cli/build/migrate.linux-amd64 -ldflags='-X main.Version=$(VERSION) -extldflags "-static"' -tags '$(DATABASE) $(SOURCE)' . + cd ./cmd/migrate && CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=7 go build -a -o ../../cli/build/migrate.linux-armv7 -ldflags='-X main.Version=$(VERSION) -extldflags "-static"' -tags '$(DATABASE) $(SOURCE)' . + cd ./cmd/migrate && CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -a -o ../../cli/build/migrate.linux-arm64 -ldflags='-X main.Version=$(VERSION) -extldflags "-static"' -tags '$(DATABASE) $(SOURCE)' . cd ./cmd/migrate && CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -a -o ../../cli/build/migrate.darwin-amd64 -ldflags='-X main.Version=$(VERSION) -extldflags "-static"' -tags '$(DATABASE) $(SOURCE)' . cd ./cmd/migrate && CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -a -o ../../cli/build/migrate.windows-amd64.exe -ldflags='-X main.Version=$(VERSION) -extldflags "-static"' -tags '$(DATABASE) $(SOURCE)' . cd ./cli/build && find . -name 'migrate*' | xargs -I{} tar czf {}.tar.gz {} diff --git a/vendor/github.com/golang-migrate/migrate/v4/README.md b/vendor/github.com/golang-migrate/migrate/v4/README.md index facd3c39f..c9076cb3e 100644 --- a/vendor/github.com/golang-migrate/migrate/v4/README.md +++ b/vendor/github.com/golang-migrate/migrate/v4/README.md @@ -3,7 +3,7 @@ [![Coverage Status](https://img.shields.io/coveralls/github/golang-migrate/migrate/master.svg)](https://coveralls.io/github/golang-migrate/migrate?branch=master) [![packagecloud.io](https://img.shields.io/badge/deb-packagecloud.io-844fec.svg)](https://packagecloud.io/golang-migrate/migrate?filter=debs) [![Docker Pulls](https://img.shields.io/docker/pulls/migrate/migrate.svg)](https://hub.docker.com/r/migrate/migrate/) -![Supported Go Versions](https://img.shields.io/badge/Go-1.11%2C%201.12-lightgrey.svg) +![Supported Go Versions](https://img.shields.io/badge/Go-1.12%2C%201.13-lightgrey.svg) [![GitHub Release](https://img.shields.io/github/release/golang-migrate/migrate.svg)](https://github.com/golang-migrate/migrate/releases) [![Go Report Card](https://goreportcard.com/badge/github.com/golang-migrate/migrate)](https://goreportcard.com/report/github.com/golang-migrate/migrate) @@ -36,7 +36,7 @@ Database drivers run migrations. [Add a new database?](database/driver.go) * [Google Cloud Spanner](database/spanner) * [CockroachDB](database/cockroachdb) * [ClickHouse](database/clickhouse) -* [Firebird](database/firebird) ([todo #49](https://github.com/golang-migrate/migrate/issues/49)) +* [Firebird](database/firebird) * [MS SQL Server](database/sqlserver) ### Database URLs @@ -146,6 +146,7 @@ Go to [getting started](GETTING_STARTED.md) ## Tutorials +- [CockroachDB](database/cockroachdb/TUTORIAL.md) - [PostgreSQL](database/postgres/TUTORIAL.md) (more tutorials to come) diff --git a/vendor/github.com/golang-migrate/migrate/v4/go.mod b/vendor/github.com/golang-migrate/migrate/v4/go.mod index 7729edcc2..2cdf910c2 100644 --- a/vendor/github.com/golang-migrate/migrate/v4/go.mod +++ b/vendor/github.com/golang-migrate/migrate/v4/go.mod @@ -2,16 +2,18 @@ module github.com/golang-migrate/migrate/v4 require ( cloud.google.com/go v0.37.4 + github.com/ClickHouse/clickhouse-go v1.3.12 github.com/aws/aws-sdk-go v1.17.7 github.com/bitly/go-hostpool v0.0.0-20171023180738-a3a6125de932 // indirect github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 // indirect github.com/cockroachdb/apd v1.1.0 // indirect github.com/cockroachdb/cockroach-go v0.0.0-20181001143604-e0a95dfd547c github.com/containerd/containerd v1.2.7 // indirect - github.com/cznic/ql v1.2.0 + github.com/cznic/mathutil v0.0.0-20180504122225-ca4c9f2c1369 // indirect github.com/denisenkom/go-mssqldb v0.0.0-20190515213511-eb9f6a1743f3 - github.com/dhui/dktest v0.3.0 + github.com/dhui/dktest v0.3.1 github.com/docker/docker v0.7.3-0.20190817195342-4760db040282 + github.com/edsrzf/mmap-go v0.0.0-20170320065105-0bce6a688712 // indirect github.com/fsouza/fake-gcs-server v1.7.0 github.com/go-sql-driver/mysql v1.4.1 github.com/gocql/gocql v0.0.0-20190301043612-f6df8288f9b4 @@ -26,7 +28,6 @@ require ( github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0 // indirect github.com/konsorten/go-windows-terminal-sequences v1.0.2 // indirect github.com/kr/pretty v0.1.0 // indirect - github.com/kshvakov/clickhouse v1.3.5 github.com/lib/pq v1.0.0 github.com/mattn/go-sqlite3 v1.10.0 github.com/morikuni/aec v0.0.0-20170113033406-39771216ff4c // indirect @@ -53,4 +54,17 @@ require ( google.golang.org/appengine v1.5.0 // indirect google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb google.golang.org/grpc v1.20.1 // indirect + modernc.org/b v1.0.0 // indirect + modernc.org/db v1.0.0 // indirect + modernc.org/file v1.0.0 // indirect + modernc.org/fileutil v1.0.0 // indirect + modernc.org/golex v1.0.0 // indirect + modernc.org/internal v1.0.0 // indirect + modernc.org/lldb v1.0.0 // indirect + modernc.org/ql v1.0.0 + modernc.org/sortutil v1.1.0 // indirect + modernc.org/strutil v1.1.0 // indirect + modernc.org/zappy v1.0.0 // indirect ) + +go 1.12 diff --git a/vendor/github.com/golang-migrate/migrate/v4/go.sum b/vendor/github.com/golang-migrate/migrate/v4/go.sum index d7944eafe..1823019d1 100644 --- a/vendor/github.com/golang-migrate/migrate/v4/go.sum +++ b/vendor/github.com/golang-migrate/migrate/v4/go.sum @@ -5,6 +5,8 @@ cloud.google.com/go v0.37.4/go.mod h1:NHPJ89PdicEuT9hdPXMROBD91xc5uRDxsMtSB16k7h github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 h1:w+iIsaOQNcT7OZ575w+acHgRric5iCyQh+xv+KJ4HB8= github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/ClickHouse/clickhouse-go v1.3.12 h1:HvD2NhKPLSeO3Ots6YV0ePgs4l3wO0bLqa9Uk1yeMOs= +github.com/ClickHouse/clickhouse-go v1.3.12/go.mod h1:EaI/sW7Azgz9UATzd5ZdZHRUhHgv5+JMS9NSr2smCJI= github.com/Microsoft/go-winio v0.4.11 h1:zoIOcVf0xPN1tnMVbTtEdI+P8OofVk3NObnwOQ6nK2Q= github.com/Microsoft/go-winio v0.4.11/go.mod h1:VhR8bwka0BXejwEJY73c50VrPtXAaKcyvVC4A4RozmA= github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 h1:TngWCqHvy9oXAN6lEVMRuU21PR1EtLVZJmdB18Gu3Rw= @@ -19,42 +21,28 @@ github.com/aws/aws-sdk-go v1.17.7/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/bitly/go-hostpool v0.0.0-20171023180738-a3a6125de932 h1:mXoPYz/Ul5HYEDvkta6I8/rnYM5gSdSV2tJ6XbZuEtY= github.com/bitly/go-hostpool v0.0.0-20171023180738-a3a6125de932/go.mod h1:NOuUCSz6Q9T7+igc/hlvDOUdtWKryOrtFyIVABv/p7k= +github.com/bkaradzic/go-lz4 v1.0.0 h1:RXc4wYsyz985CkXXeX04y4VnZFGG8Rd43pRaHsOXAKk= +github.com/bkaradzic/go-lz4 v1.0.0/go.mod h1:0YdlkowM3VswSROI7qDxhRvJ3sLhlFrRRwjwegp5jy4= github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 h1:DDGfHa7BWjL4YnC6+E63dPcxHo2sUxDIu8g3QgEJdRY= github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cloudflare/golz4 v0.0.0-20150217214814-ef862a3cdc58 h1:F1EaeKL/ta07PY/k9Os/UFtwERei2/XzGemhpGnBKNg= +github.com/cloudflare/golz4 v0.0.0-20150217214814-ef862a3cdc58/go.mod h1:EOBUe0h4xcZ5GoxqC5SDxFQ8gwyZPKQoEzownBlhI80= github.com/cockroachdb/apd v1.1.0 h1:3LFP3629v+1aKXU5Q37mxmRxX/pIu1nijXydLShEq5I= github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ= github.com/cockroachdb/cockroach-go v0.0.0-20181001143604-e0a95dfd547c h1:2zRrJWIt/f9c9HhNHAgrRgq0San5gRRUJTBXLkchal0= github.com/cockroachdb/cockroach-go v0.0.0-20181001143604-e0a95dfd547c/go.mod h1:XGLbWH/ujMcbPbhZq52Nv6UrCghb1yGn//133kEsvDk= github.com/containerd/containerd v1.2.7 h1:8lqLbl7u1j3MmiL9cJ/O275crSq7bfwUayvvatEupQk= github.com/containerd/containerd v1.2.7/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= -github.com/cznic/b v0.0.0-20180115125044-35e9bbe41f07 h1:UHFGPvSxX4C4YBApSPvmUfL8tTvWLj2ryqvT9K4Jcuk= -github.com/cznic/b v0.0.0-20180115125044-35e9bbe41f07/go.mod h1:URriBxXwVq5ijiJ12C7iIZqlA69nTlI+LgI6/pwftG8= -github.com/cznic/fileutil v0.0.0-20180108211300-6a051e75936f h1:7uSNgsgcarNk4oiN/nNkO0J7KAjlsF5Yv5Gf/tFdHas= -github.com/cznic/fileutil v0.0.0-20180108211300-6a051e75936f/go.mod h1:8S58EK26zhXSxzv7NQFpnliaOQsmDUxvoQO3rt154Vg= -github.com/cznic/golex v0.0.0-20170803123110-4ab7c5e190e4 h1:CVAqftqbj+exlab+8KJQrE+kNIVlQfJt58j4GxCMF1s= -github.com/cznic/golex v0.0.0-20170803123110-4ab7c5e190e4/go.mod h1:+bmmJDNmKlhWNG+gwWCkaBoTy39Fs+bzRxVBzoTQbIc= -github.com/cznic/internal v0.0.0-20180608152220-f44710a21d00 h1:FHpbUtp2K8X53/b4aFNj4my5n+i3x+CQCZWNuHWH/+E= -github.com/cznic/internal v0.0.0-20180608152220-f44710a21d00/go.mod h1:olo7eAdKwJdXxb55TKGLiJ6xt1H0/tiiRCWKVLmtjY4= -github.com/cznic/lldb v1.1.0 h1:AIA+ham6TSJ+XkMe8imQ/g8KPzMUVWAwqUQQdtuMsHs= -github.com/cznic/lldb v1.1.0/go.mod h1:FIZVUmYUVhPwRiPzL8nD/mpFcJ/G7SSXjjXYG4uRI3A= github.com/cznic/mathutil v0.0.0-20180504122225-ca4c9f2c1369 h1:XNT/Zf5l++1Pyg08/HV04ppB0gKxAqtZQBRYiYrUuYk= github.com/cznic/mathutil v0.0.0-20180504122225-ca4c9f2c1369/go.mod h1:e6NPNENfs9mPDVNRekM7lKScauxd5kXTr1Mfyig6TDM= -github.com/cznic/ql v1.2.0 h1:lcKp95ZtdF0XkWhGnVIXGF8dVD2X+ClS08tglKtf+ak= -github.com/cznic/ql v1.2.0/go.mod h1:FbpzhyZrqr0PVlK6ury+PoW3T0ODUV22OeWIxcaOrSE= -github.com/cznic/sortutil v0.0.0-20150617083342-4c7342852e65 h1:hxuZop6tSoOi0sxFzoGGYdRqNrPubyaIf9KoBG9tPiE= -github.com/cznic/sortutil v0.0.0-20150617083342-4c7342852e65/go.mod h1:q2w6Bg5jeox1B+QkJ6Wp/+Vn0G/bo3f1uY7Fn3vivIQ= -github.com/cznic/strutil v0.0.0-20171016134553-529a34b1c186 h1:0rkFMAbn5KBKNpJyHQ6Prb95vIKanmAe62KxsrN+sqA= -github.com/cznic/strutil v0.0.0-20171016134553-529a34b1c186/go.mod h1:AHHPPPXTw0h6pVabbcbyGRK1DckRn7r/STdZEeIDzZc= -github.com/cznic/zappy v0.0.0-20160723133515-2533cb5b45cc h1:YKKpTb2BrXN2GYyGaygIdis1vXbE7SSAG9axGWIMClg= -github.com/cznic/zappy v0.0.0-20160723133515-2533cb5b45cc/go.mod h1:Y1SNZ4dRUOKXshKUbwUapqNncRrho4mkjQebgEHZLj8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/denisenkom/go-mssqldb v0.0.0-20190515213511-eb9f6a1743f3 h1:tkum0XDgfR0jcVVXuTsYv/erY2NnEDqwRojbxR1rBYA= github.com/denisenkom/go-mssqldb v0.0.0-20190515213511-eb9f6a1743f3/go.mod h1:zAg7JM8CkOJ43xKXIj7eRO9kmWm/TW578qo+oDO6tuM= -github.com/dhui/dktest v0.3.0 h1:kwX5a7EkLcjo7VpsPQSYJcKGbXBXdjI9FGjuUj1jn6I= -github.com/dhui/dktest v0.3.0/go.mod h1:cyzIUfGsBEbZ6BT7tnXqAShHSXCZhSNmFl70sZ7c1yc= +github.com/dhui/dktest v0.3.1 h1:NVUdB50k8tml431Ho1hcQBNeC52Qe8oSDPAjseA67Y8= +github.com/dhui/dktest v0.3.1/go.mod h1:cyzIUfGsBEbZ6BT7tnXqAShHSXCZhSNmFl70sZ7c1yc= github.com/docker/distribution v2.7.0+incompatible h1:neUDAlf3wX6Ml4HdqTrbcOHXtfRN0TFIwt6YFL7N9RU= github.com/docker/distribution v2.7.0+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/docker v0.7.3-0.20190103212154-2b7e084dc98b/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= @@ -74,6 +62,7 @@ github.com/fsouza/fake-gcs-server v1.7.0 h1:Un0BXUXrRWYSmYyC1Rqm2e2WJfTPyDy/HGMz github.com/fsouza/fake-gcs-server v1.7.0/go.mod h1:5XIRs4YvwNbNoz+1JF8j6KLAyDh7RHGAyAK3EP2EsNk= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= +github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-sql-driver/mysql v1.4.1 h1:g24URVg0OFbNUTx9qqY1IRZ9D9z3iPyi5zKhQZpNwpA= github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= @@ -127,6 +116,7 @@ github.com/jackc/pgx v3.2.0+incompatible h1:0Vihzu20St42/UDsvZGdNE6jak7oi/UOeMzw github.com/jackc/pgx v3.2.0+incompatible/go.mod h1:0ZGrqGqkRlliWnWB4zKnWtjbSWbGkVEFm4TeybAXq+I= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af h1:pmfjZENx5imkbgOkpRUYLnmbU7UEFbjtDA2hxJ1ichM= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= +github.com/jmoiron/sqlx v1.2.0/go.mod h1:1FEQNm3xlJgrMD+FBdI9+xvCksHtbpVBBw5dYhBSsks= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0 h1:iQTw/8FWTuc7uiaSepXwyf3o52HaUYcV+Tu66S3F5GA= @@ -142,10 +132,9 @@ github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORN github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kshvakov/clickhouse v1.3.5 h1:PDTYk9VYgbjPAWry3AoDREeMgOVUFij6bh6IjlloHL0= -github.com/kshvakov/clickhouse v1.3.5/go.mod h1:DMzX7FxRymoNkVgizH0DWAL8Cur7wHLgx3MUnGwJqpE= github.com/lib/pq v1.0.0 h1:X5PMW56eZitiTeO7tKzZxFCSpbFZJtkMMooicw2us9A= github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= +github.com/mattn/go-sqlite3 v1.9.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= github.com/mattn/go-sqlite3 v1.10.0 h1:jbhqpg7tQe4SupckyijYiy0mJJ/pRyHvXf7JdWK860o= github.com/mattn/go-sqlite3 v1.10.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= @@ -162,6 +151,7 @@ github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQ github.com/opencontainers/image-spec v1.0.1 h1:JMemWkRwHx4Zj+fVxWoMCFm/8sYGGrUVojFA6h/TRcI= github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw= +github.com/pierrec/lz4 v2.0.5+incompatible h1:2xWsjqPFWcplujydGg4WmhC/6fZqK42wMM8aXeqhl0I= github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= @@ -176,6 +166,8 @@ github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y8 github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= +github.com/remyoudompheng/bigfft v0.0.0-20190728182440-6a916e37a237 h1:HQagqIiBmr8YXawX/le3+O26N+vPPC1PtjaF3mwnook= +github.com/remyoudompheng/bigfft v0.0.0-20190728182440-6a916e37a237/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww= github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24 h1:pntxY8Ary0t43dCZ5dqY4YTJCObLY1kIXl0uzMv+7DE= @@ -306,3 +298,27 @@ gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81 honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +modernc.org/b v1.0.0 h1:vpvqeyp17ddcQWF29Czawql4lDdABCDRbXRAS4+aF2o= +modernc.org/b v1.0.0/go.mod h1:uZWcZfRj1BpYzfN9JTerzlNUnnPsV9O2ZA8JsRcubNg= +modernc.org/db v1.0.0 h1:2c6NdCfaLnshSvY7OU09cyAY0gYXUZj4lmg5ItHyucg= +modernc.org/db v1.0.0/go.mod h1:kYD/cO29L/29RM0hXYl4i3+Q5VojL31kTUVpVJDw0s8= +modernc.org/file v1.0.0 h1:9/PdvjVxd5+LcWUQIfapAWRGOkDLK90rloa8s/au06A= +modernc.org/file v1.0.0/go.mod h1:uqEokAEn1u6e+J45e54dsEA/pw4o7zLrA2GwyntZzjw= +modernc.org/fileutil v1.0.0 h1:Z1AFLZwl6BO8A5NldQg/xTSjGLetp+1Ubvl4alfGx8w= +modernc.org/fileutil v1.0.0/go.mod h1:JHsWpkrk/CnVV1H/eGlFf85BEpfkrp56ro8nojIq9Q8= +modernc.org/golex v1.0.0 h1:wWpDlbK8ejRfSyi0frMyhilD3JBvtcx2AdGDnU+JtsE= +modernc.org/golex v1.0.0/go.mod h1:b/QX9oBD/LhixY6NDh+IdGv17hgB+51fET1i2kPSmvk= +modernc.org/internal v1.0.0 h1:XMDsFDcBDsibbBnHB2xzljZ+B1yrOVLEFkKL2u15Glw= +modernc.org/internal v1.0.0/go.mod h1:VUD/+JAkhCpvkUitlEOnhpVxCgsBI90oTzSCRcqQVSM= +modernc.org/lldb v1.0.0 h1:6vjDJxQEfhlOLwl4bhpwIz00uyFK4EmSYcbwqwbynsc= +modernc.org/lldb v1.0.0/go.mod h1:jcRvJGWfCGodDZz8BPwiKMJxGJngQ/5DrRapkQnLob8= +modernc.org/mathutil v1.0.0 h1:93vKjrJopTPrtTNpZ8XIovER7iCIH1QU7wNbOQXC60I= +modernc.org/mathutil v1.0.0/go.mod h1:wU0vUrJsVWBZ4P6e7xtFJEhFSNsfRLJ8H458uRjg03k= +modernc.org/ql v1.0.0 h1:bIQ/trWNVjQPlinI6jdOQsi195SIturGo3mp5hsDqVU= +modernc.org/ql v1.0.0/go.mod h1:xGVyrLIatPcO2C1JvI/Co8c0sr6y91HKFNy4pt9JXEY= +modernc.org/sortutil v1.1.0 h1:oP3U4uM+NT/qBQcbg/K2iqAX0Nx7B1b6YZtq3Gk/PjM= +modernc.org/sortutil v1.1.0/go.mod h1:ZyL98OQHJgH9IEfN71VsamvJgrtRX9Dj2gX+vH86L1k= +modernc.org/strutil v1.1.0 h1:+1/yCzZxY2pZwwrsbH+4T7BQMoLQ9QiBshRC9eicYsc= +modernc.org/strutil v1.1.0/go.mod h1:lstksw84oURvj9y3tn8lGvRxyRC1S2+g5uuIzNfIOBs= +modernc.org/zappy v1.0.0 h1:dPVaP+3ueIUv4guk8PuZ2wiUGcJ1WUVvIheeSSTD0yk= +modernc.org/zappy v1.0.0/go.mod h1:hHe+oGahLVII/aTTyWK/b53VDHMAGCBYYeZ9sn83HC4= diff --git a/vendor/github.com/golang-migrate/migrate/v4/source/errors.go b/vendor/github.com/golang-migrate/migrate/v4/source/errors.go new file mode 100644 index 000000000..93d66e0d4 --- /dev/null +++ b/vendor/github.com/golang-migrate/migrate/v4/source/errors.go @@ -0,0 +1,15 @@ +package source + +import "os" + +// ErrDuplicateMigration is an error type for reporting duplicate migration +// files. +type ErrDuplicateMigration struct { + Migration + os.FileInfo +} + +// Error implements error interface. +func (e ErrDuplicateMigration) Error() string { + return "duplicate migration file: " + e.Name() +} diff --git a/vendor/github.com/karalabe/usb/.travis.yml b/vendor/github.com/karalabe/usb/.travis.yml index de0337b2b..7f925fbc0 100644 --- a/vendor/github.com/karalabe/usb/.travis.yml +++ b/vendor/github.com/karalabe/usb/.travis.yml @@ -32,8 +32,8 @@ matrix: - os: osx go: 1.12.x - os: linux - dist: xenial - go: 1.12.x + dist: bionic + go: 1.13.x services: - docker env: diff --git a/vendor/github.com/karalabe/usb/appveyor.yml b/vendor/github.com/karalabe/usb/appveyor.yml index 73a9664ae..595fd34ad 100644 --- a/vendor/github.com/karalabe/usb/appveyor.yml +++ b/vendor/github.com/karalabe/usb/appveyor.yml @@ -22,8 +22,8 @@ environment: install: - rmdir C:\go /s /q - - appveyor DownloadFile https://storage.googleapis.com/golang/go1.12.9.windows-%GOARCH%.zip - - 7z x go1.12.9.windows-%GOARCH%.zip -y -oC:\ > NUL + - appveyor DownloadFile https://storage.googleapis.com/golang/go1.13.4.windows-%GOARCH%.zip + - 7z x go1.13.4.windows-%GOARCH%.zip -y -oC:\ > NUL - go version - gcc --version diff --git a/vendor/github.com/karalabe/usb/hidapi/windows/hid.c b/vendor/github.com/karalabe/usb/hidapi/windows/hid.c index 4e92cc8bc..60da64608 100644 --- a/vendor/github.com/karalabe/usb/hidapi/windows/hid.c +++ b/vendor/github.com/karalabe/usb/hidapi/windows/hid.c @@ -74,6 +74,8 @@ extern "C" { #pragma warning(disable:4996) #endif +#pragma GCC diagnostic ignored "-Wstringop-overflow" + #ifdef __cplusplus extern "C" { #endif @@ -428,7 +430,7 @@ struct hid_device_info HID_API_EXPORT * HID_API_CALL hid_enumerate(unsigned shor if (str) { len = strlen(str); cur_dev->path = (char*) calloc(len+1, sizeof(char)); - strncpy(cur_dev->path, str, sizeof(cur_dev->path)); + strncpy(cur_dev->path, str, len+1); cur_dev->path[len] = '\0'; } else diff --git a/vendor/github.com/lucasb-eyer/go-colorful/.travis.yml b/vendor/github.com/lucasb-eyer/go-colorful/.travis.yml index 5439a3248..5bb2a827b 100644 --- a/vendor/github.com/lucasb-eyer/go-colorful/.travis.yml +++ b/vendor/github.com/lucasb-eyer/go-colorful/.travis.yml @@ -1,7 +1,6 @@ language: go install: - go get golang.org/x/tools/cmd/cover - - go get github.com/DATA-DOG/go-sqlmock - go get github.com/mattn/goveralls script: - go test -v -covermode=count -coverprofile=coverage.out diff --git a/vendor/github.com/lucasb-eyer/go-colorful/colors.go b/vendor/github.com/lucasb-eyer/go-colorful/colors.go index 441a4e20a..29870df04 100644 --- a/vendor/github.com/lucasb-eyer/go-colorful/colors.go +++ b/vendor/github.com/lucasb-eyer/go-colorful/colors.go @@ -245,7 +245,7 @@ func Hsl(h, s, l float64) Color { } t2 = 2*l - t1 - h = h / 360 + h /= 360 tr = h + 1.0/3.0 tg = h tb = h - 1.0/3.0 diff --git a/vendor/github.com/lucasb-eyer/go-colorful/go.mod b/vendor/github.com/lucasb-eyer/go-colorful/go.mod index 1fc40677f..35925f3d7 100644 --- a/vendor/github.com/lucasb-eyer/go-colorful/go.mod +++ b/vendor/github.com/lucasb-eyer/go-colorful/go.mod @@ -1,5 +1,3 @@ module github.com/lucasb-eyer/go-colorful go 1.12 - -require github.com/DATA-DOG/go-sqlmock v1.3.3 diff --git a/vendor/github.com/lucasb-eyer/go-colorful/go.sum b/vendor/github.com/lucasb-eyer/go-colorful/go.sum index e787bfc4a..e69de29bb 100644 --- a/vendor/github.com/lucasb-eyer/go-colorful/go.sum +++ b/vendor/github.com/lucasb-eyer/go-colorful/go.sum @@ -1,2 +0,0 @@ -github.com/DATA-DOG/go-sqlmock v1.3.3 h1:CWUqKXe0s8A2z6qCgkP4Kru7wC11YoAnoupUKFDnH08= -github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= diff --git a/vendor/github.com/status-im/status-go/eth-node/bridge/geth/ens/ens.go b/vendor/github.com/status-im/status-go/eth-node/bridge/geth/ens/ens.go deleted file mode 100644 index ef6196c48..000000000 --- a/vendor/github.com/status-im/status-go/eth-node/bridge/geth/ens/ens.go +++ /dev/null @@ -1,101 +0,0 @@ -package ens - -import ( - "bytes" - "context" - "crypto/elliptic" - "encoding/hex" - "math/big" - "time" - - ens "github.com/wealdtech/go-ens/v3" - "go.uber.org/zap" - - "github.com/ethereum/go-ethereum/ethclient" - - "github.com/status-im/status-go/eth-node/crypto" - enstypes "github.com/status-im/status-go/eth-node/types/ens" -) - -const ( - contractQueryTimeout = 5000 * time.Millisecond -) - -type ENSVerifier struct { - logger *zap.Logger -} - -// NewVerifier returns a ENSVerifier attached to the specified logger -func NewVerifier(logger *zap.Logger) *ENSVerifier { - return &ENSVerifier{logger: logger} -} - -func (m *ENSVerifier) verifyENSName(ensInfo enstypes.ENSDetails, ethclient *ethclient.Client) enstypes.ENSResponse { - publicKeyStr := ensInfo.PublicKeyString - ensName := ensInfo.Name - m.logger.Info("Resolving ENS name", zap.String("name", ensName), zap.String("publicKey", publicKeyStr)) - response := enstypes.ENSResponse{ - Name: ensName, - PublicKeyString: publicKeyStr, - VerifiedAt: time.Now().Unix(), - } - - expectedPubKeyBytes, err := hex.DecodeString(publicKeyStr) - if err != nil { - response.Error = err - return response - } - - publicKey, err := crypto.UnmarshalPubkey(expectedPubKeyBytes) - if err != nil { - response.Error = err - return response - } - - // Resolve ensName - resolver, err := ens.NewResolver(ethclient, ensName) - if err != nil { - m.logger.Error("error while creating ENS name resolver", zap.String("ensName", ensName), zap.Error(err)) - response.Error = err - return response - } - x, y, err := resolver.PubKey() - if err != nil { - m.logger.Error("error while resolving public key from ENS name", zap.String("ensName", ensName), zap.Error(err)) - response.Error = err - return response - } - - // Assemble the bytes returned for the pubkey - pubKeyBytes := elliptic.Marshal(crypto.S256(), new(big.Int).SetBytes(x[:]), new(big.Int).SetBytes(y[:])) - - response.PublicKey = publicKey - response.Verified = bytes.Equal(pubKeyBytes, expectedPubKeyBytes) - return response -} - -// CheckBatch verifies that a registered ENS name matches the expected public key -func (m *ENSVerifier) CheckBatch(ensDetails []enstypes.ENSDetails, rpcEndpoint, contractAddress string) (map[string]enstypes.ENSResponse, error) { - ctx, cancel := context.WithTimeout(context.Background(), contractQueryTimeout) - defer cancel() - - ch := make(chan enstypes.ENSResponse) - response := make(map[string]enstypes.ENSResponse) - - ethclient, err := ethclient.DialContext(ctx, rpcEndpoint) - if err != nil { - return nil, err - } - - for _, ensInfo := range ensDetails { - go func(info enstypes.ENSDetails) { ch <- m.verifyENSName(info, ethclient) }(ensInfo) - } - - for range ensDetails { - r := <-ch - response[r.PublicKeyString] = r - } - close(ch) - - return response, nil -} diff --git a/vendor/github.com/status-im/status-go/eth-node/bridge/geth/envelope.go b/vendor/github.com/status-im/status-go/eth-node/bridge/geth/envelope.go deleted file mode 100644 index 52814b70d..000000000 --- a/vendor/github.com/status-im/status-go/eth-node/bridge/geth/envelope.go +++ /dev/null @@ -1,108 +0,0 @@ -package gethbridge - -import ( - "io" - - "github.com/ethereum/go-ethereum/rlp" - "github.com/status-im/status-go/eth-node/types" - "github.com/status-im/status-go/waku" - "github.com/status-im/status-go/whisper/v6" -) - -type whisperEnvelope struct { - env *whisper.Envelope -} - -// NewWhisperEnvelope returns an object that wraps Geth's Whisper Envelope in a types interface. -func NewWhisperEnvelope(e *whisper.Envelope) types.Envelope { - return &whisperEnvelope{env: e} -} - -func (w *whisperEnvelope) Unwrap() interface{} { - return w.env -} - -func (w *whisperEnvelope) Hash() types.Hash { - return types.Hash(w.env.Hash()) -} - -func (w *whisperEnvelope) Bloom() []byte { - return w.env.Bloom() -} - -func (w *whisperEnvelope) PoW() float64 { - return w.env.PoW() -} - -func (w *whisperEnvelope) Expiry() uint32 { - return w.env.Expiry -} - -func (w *whisperEnvelope) TTL() uint32 { - return w.env.TTL -} - -func (w *whisperEnvelope) Topic() types.TopicType { - return types.TopicType(w.env.Topic) -} - -func (w *whisperEnvelope) Size() int { - return len(w.env.Data) -} - -func (w *whisperEnvelope) DecodeRLP(s *rlp.Stream) error { - return w.env.DecodeRLP(s) -} - -func (w *whisperEnvelope) EncodeRLP(writer io.Writer) error { - return rlp.Encode(writer, w.env) -} - -type wakuEnvelope struct { - env *waku.Envelope -} - -// NewWakuEnvelope returns an object that wraps Geth's Waku Envelope in a types interface. -func NewWakuEnvelope(e *waku.Envelope) types.Envelope { - return &wakuEnvelope{env: e} -} - -func (w *wakuEnvelope) Unwrap() interface{} { - return w.env -} - -func (w *wakuEnvelope) Hash() types.Hash { - return types.Hash(w.env.Hash()) -} - -func (w *wakuEnvelope) Bloom() []byte { - return w.env.Bloom() -} - -func (w *wakuEnvelope) PoW() float64 { - return w.env.PoW() -} - -func (w *wakuEnvelope) Expiry() uint32 { - return w.env.Expiry -} - -func (w *wakuEnvelope) TTL() uint32 { - return w.env.TTL -} - -func (w *wakuEnvelope) Topic() types.TopicType { - return types.TopicType(w.env.Topic) -} - -func (w *wakuEnvelope) Size() int { - return len(w.env.Data) -} - -func (w *wakuEnvelope) DecodeRLP(s *rlp.Stream) error { - return w.env.DecodeRLP(s) -} - -func (w *wakuEnvelope) EncodeRLP(writer io.Writer) error { - return rlp.Encode(writer, w.env) -} diff --git a/vendor/github.com/status-im/status-go/eth-node/bridge/geth/envelope_error.go b/vendor/github.com/status-im/status-go/eth-node/bridge/geth/envelope_error.go deleted file mode 100644 index 6d24b49fc..000000000 --- a/vendor/github.com/status-im/status-go/eth-node/bridge/geth/envelope_error.go +++ /dev/null @@ -1,45 +0,0 @@ -package gethbridge - -import ( - "github.com/status-im/status-go/eth-node/types" - "github.com/status-im/status-go/waku" - "github.com/status-im/status-go/whisper/v6" -) - -// NewWhisperEnvelopeErrorWrapper returns a types.EnvelopeError object that mimics Geth's EnvelopeError -func NewWhisperEnvelopeErrorWrapper(envelopeError *whisper.EnvelopeError) *types.EnvelopeError { - if envelopeError == nil { - panic("envelopeError should not be nil") - } - - return &types.EnvelopeError{ - Hash: types.Hash(envelopeError.Hash), - Code: mapGethErrorCode(envelopeError.Code), - Description: envelopeError.Description, - } -} - -// NewWakuEnvelopeErrorWrapper returns a types.EnvelopeError object that mimics Geth's EnvelopeError -func NewWakuEnvelopeErrorWrapper(envelopeError *waku.EnvelopeError) *types.EnvelopeError { - if envelopeError == nil { - panic("envelopeError should not be nil") - } - - return &types.EnvelopeError{ - Hash: types.Hash(envelopeError.Hash), - Code: mapGethErrorCode(envelopeError.Code), - Description: envelopeError.Description, - } -} - -func mapGethErrorCode(code uint) uint { - switch code { - case whisper.EnvelopeTimeNotSynced: - case waku.EnvelopeTimeNotSynced: - return types.EnvelopeTimeNotSynced - case whisper.EnvelopeOtherError: - case waku.EnvelopeOtherError: - return types.EnvelopeOtherError - } - return types.EnvelopeOtherError -} diff --git a/vendor/github.com/status-im/status-go/eth-node/bridge/geth/envelope_event.go b/vendor/github.com/status-im/status-go/eth-node/bridge/geth/envelope_event.go deleted file mode 100644 index c31c509c1..000000000 --- a/vendor/github.com/status-im/status-go/eth-node/bridge/geth/envelope_event.go +++ /dev/null @@ -1,59 +0,0 @@ -package gethbridge - -import ( - "github.com/status-im/status-go/eth-node/types" - "github.com/status-im/status-go/waku" - "github.com/status-im/status-go/whisper/v6" -) - -// NewWhisperEnvelopeEventWrapper returns a types.EnvelopeEvent object that mimics Geth's EnvelopeEvent -func NewWhisperEnvelopeEventWrapper(envelopeEvent *whisper.EnvelopeEvent) *types.EnvelopeEvent { - if envelopeEvent == nil { - panic("envelopeEvent should not be nil") - } - - wrappedData := envelopeEvent.Data - switch data := envelopeEvent.Data.(type) { - case []whisper.EnvelopeError: - wrappedData := make([]types.EnvelopeError, len(data)) - for index, envError := range data { - wrappedData[index] = *NewWhisperEnvelopeErrorWrapper(&envError) - } - case *whisper.MailServerResponse: - wrappedData = NewWhisperMailServerResponseWrapper(data) - case whisper.SyncEventResponse: - wrappedData = NewGethSyncEventResponseWrapper(data) - } - return &types.EnvelopeEvent{ - Event: types.EventType(envelopeEvent.Event), - Hash: types.Hash(envelopeEvent.Hash), - Batch: types.Hash(envelopeEvent.Batch), - Peer: types.EnodeID(envelopeEvent.Peer), - Data: wrappedData, - } -} - -// NewWakuEnvelopeEventWrapper returns a types.EnvelopeEvent object that mimics Geth's EnvelopeEvent -func NewWakuEnvelopeEventWrapper(envelopeEvent *waku.EnvelopeEvent) *types.EnvelopeEvent { - if envelopeEvent == nil { - panic("envelopeEvent should not be nil") - } - - wrappedData := envelopeEvent.Data - switch data := envelopeEvent.Data.(type) { - case []waku.EnvelopeError: - wrappedData := make([]types.EnvelopeError, len(data)) - for index, envError := range data { - wrappedData[index] = *NewWakuEnvelopeErrorWrapper(&envError) - } - case *waku.MailServerResponse: - wrappedData = NewWakuMailServerResponseWrapper(data) - } - return &types.EnvelopeEvent{ - Event: types.EventType(envelopeEvent.Event), - Hash: types.Hash(envelopeEvent.Hash), - Batch: types.Hash(envelopeEvent.Batch), - Peer: types.EnodeID(envelopeEvent.Peer), - Data: wrappedData, - } -} diff --git a/vendor/github.com/status-im/status-go/eth-node/bridge/geth/keystore.go b/vendor/github.com/status-im/status-go/eth-node/bridge/geth/keystore.go deleted file mode 100644 index 85cd4e92f..000000000 --- a/vendor/github.com/status-im/status-go/eth-node/bridge/geth/keystore.go +++ /dev/null @@ -1,103 +0,0 @@ -package gethbridge - -import ( - "crypto/ecdsa" - "errors" - "strings" - - "github.com/ethereum/go-ethereum/accounts" - "github.com/ethereum/go-ethereum/accounts/keystore" - "github.com/ethereum/go-ethereum/common" - - "github.com/status-im/status-go/eth-node/types" - "github.com/status-im/status-go/extkeys" -) - -type gethKeyStoreAdapter struct { - keystore *keystore.KeyStore -} - -// WrapKeyStore creates a types.KeyStore wrapper over a keystore.KeyStore object -func WrapKeyStore(keystore *keystore.KeyStore) types.KeyStore { - return &gethKeyStoreAdapter{keystore: keystore} -} - -func (k *gethKeyStoreAdapter) ImportECDSA(priv *ecdsa.PrivateKey, passphrase string) (types.Account, error) { - gethAccount, err := k.keystore.ImportECDSA(priv, passphrase) - return accountFrom(gethAccount), err -} - -func (k *gethKeyStoreAdapter) ImportSingleExtendedKey(extKey *extkeys.ExtendedKey, passphrase string) (types.Account, error) { - gethAccount, err := k.keystore.ImportSingleExtendedKey(extKey, passphrase) - return accountFrom(gethAccount), err -} - -func (k *gethKeyStoreAdapter) ImportExtendedKeyForPurpose(keyPurpose extkeys.KeyPurpose, extKey *extkeys.ExtendedKey, passphrase string) (types.Account, error) { - gethAccount, err := k.keystore.ImportExtendedKeyForPurpose(keyPurpose, extKey, passphrase) - return accountFrom(gethAccount), err -} - -func (k *gethKeyStoreAdapter) AccountDecryptedKey(a types.Account, auth string) (types.Account, *types.Key, error) { - gethAccount, err := gethAccountFrom(a) - if err != nil { - return types.Account{}, nil, err - } - - var gethKey *keystore.Key - gethAccount, gethKey, err = k.keystore.AccountDecryptedKey(gethAccount, auth) - return accountFrom(gethAccount), keyFrom(gethKey), err -} - -func (k *gethKeyStoreAdapter) Delete(a types.Account, auth string) error { - gethAccount, err := gethAccountFrom(a) - if err != nil { - return err - } - - return k.keystore.Delete(gethAccount, auth) -} - -// parseGethURL converts a user supplied URL into the accounts specific structure. -func parseGethURL(url string) (accounts.URL, error) { - parts := strings.Split(url, "://") - if len(parts) != 2 || parts[0] == "" { - return accounts.URL{}, errors.New("protocol scheme missing") - } - return accounts.URL{ - Scheme: parts[0], - Path: parts[1], - }, nil -} - -func gethAccountFrom(account types.Account) (accounts.Account, error) { - var ( - gethAccount accounts.Account - err error - ) - gethAccount.Address = common.Address(account.Address) - if account.URL != "" { - gethAccount.URL, err = parseGethURL(account.URL) - } - return gethAccount, err -} - -func accountFrom(gethAccount accounts.Account) types.Account { - return types.Account{ - Address: types.Address(gethAccount.Address), - URL: gethAccount.URL.String(), - } -} - -func keyFrom(k *keystore.Key) *types.Key { - if k == nil { - return nil - } - - return &types.Key{ - Id: k.Id, - Address: types.Address(k.Address), - PrivateKey: k.PrivateKey, - ExtendedKey: k.ExtendedKey, - SubAccountIndex: k.SubAccountIndex, - } -} diff --git a/vendor/github.com/status-im/status-go/eth-node/bridge/geth/mailserver_response.go b/vendor/github.com/status-im/status-go/eth-node/bridge/geth/mailserver_response.go deleted file mode 100644 index 10b796fb2..000000000 --- a/vendor/github.com/status-im/status-go/eth-node/bridge/geth/mailserver_response.go +++ /dev/null @@ -1,33 +0,0 @@ -package gethbridge - -import ( - "github.com/status-im/status-go/eth-node/types" - "github.com/status-im/status-go/waku" - "github.com/status-im/status-go/whisper/v6" -) - -// NewWhisperMailServerResponseWrapper returns a types.MailServerResponse object that mimics Geth's MailServerResponse -func NewWhisperMailServerResponseWrapper(mailServerResponse *whisper.MailServerResponse) *types.MailServerResponse { - if mailServerResponse == nil { - panic("mailServerResponse should not be nil") - } - - return &types.MailServerResponse{ - LastEnvelopeHash: types.Hash(mailServerResponse.LastEnvelopeHash), - Cursor: mailServerResponse.Cursor, - Error: mailServerResponse.Error, - } -} - -// NewWakuMailServerResponseWrapper returns a types.MailServerResponse object that mimics Geth's MailServerResponse -func NewWakuMailServerResponseWrapper(mailServerResponse *waku.MailServerResponse) *types.MailServerResponse { - if mailServerResponse == nil { - panic("mailServerResponse should not be nil") - } - - return &types.MailServerResponse{ - LastEnvelopeHash: types.Hash(mailServerResponse.LastEnvelopeHash), - Cursor: mailServerResponse.Cursor, - Error: mailServerResponse.Error, - } -} diff --git a/vendor/github.com/status-im/status-go/eth-node/bridge/geth/node.go b/vendor/github.com/status-im/status-go/eth-node/bridge/geth/node.go deleted file mode 100644 index a629ee835..000000000 --- a/vendor/github.com/status-im/status-go/eth-node/bridge/geth/node.go +++ /dev/null @@ -1,101 +0,0 @@ -package gethbridge - -import ( - "errors" - - "go.uber.org/zap" - - "github.com/status-im/status-go/waku" - - "github.com/ethereum/go-ethereum/node" - "github.com/ethereum/go-ethereum/p2p/enode" - - gethens "github.com/status-im/status-go/eth-node/bridge/geth/ens" - "github.com/status-im/status-go/eth-node/types" - enstypes "github.com/status-im/status-go/eth-node/types/ens" - "github.com/status-im/status-go/whisper/v6" -) - -type gethNodeWrapper struct { - stack *node.Node -} - -func NewNodeBridge(stack *node.Node) types.Node { - return &gethNodeWrapper{stack: stack} -} - -func (w *gethNodeWrapper) Poll() { - // noop -} - -func (w *gethNodeWrapper) NewENSVerifier(logger *zap.Logger) enstypes.ENSVerifier { - return gethens.NewVerifier(logger) -} - -func (w *gethNodeWrapper) GetWhisper(ctx interface{}) (types.Whisper, error) { - var nativeWhisper *whisper.Whisper - if ctx == nil || ctx == w { - err := w.stack.Service(&nativeWhisper) - if err != nil { - return nil, err - } - } else { - switch serviceProvider := ctx.(type) { - case *node.ServiceContext: - err := serviceProvider.Service(&nativeWhisper) - if err != nil { - return nil, err - } - } - } - if nativeWhisper == nil { - return nil, errors.New("whisper service is not available") - } - - return NewGethWhisperWrapper(nativeWhisper), nil -} - -func (w *gethNodeWrapper) GetWaku(ctx interface{}) (types.Waku, error) { - var nativeWaku *waku.Waku - if ctx == nil || ctx == w { - err := w.stack.Service(&nativeWaku) - if err != nil { - return nil, err - } - } else { - switch serviceProvider := ctx.(type) { - case *node.ServiceContext: - err := serviceProvider.Service(&nativeWaku) - if err != nil { - return nil, err - } - } - } - if nativeWaku == nil { - return nil, errors.New("waku service is not available") - } - - return NewGethWakuWrapper(nativeWaku), nil -} - -func (w *gethNodeWrapper) AddPeer(url string) error { - parsedNode, err := enode.ParseV4(url) - if err != nil { - return err - } - - w.stack.Server().AddPeer(parsedNode) - - return nil -} - -func (w *gethNodeWrapper) RemovePeer(url string) error { - parsedNode, err := enode.ParseV4(url) - if err != nil { - return err - } - - w.stack.Server().RemovePeer(parsedNode) - - return nil -} diff --git a/vendor/github.com/status-im/status-go/eth-node/bridge/geth/public_waku_api.go b/vendor/github.com/status-im/status-go/eth-node/bridge/geth/public_waku_api.go deleted file mode 100644 index bfd9b76f6..000000000 --- a/vendor/github.com/status-im/status-go/eth-node/bridge/geth/public_waku_api.go +++ /dev/null @@ -1,103 +0,0 @@ -package gethbridge - -import ( - "context" - - "github.com/ethereum/go-ethereum/common/hexutil" - - "github.com/status-im/status-go/eth-node/types" - "github.com/status-im/status-go/waku" -) - -type gethPublicWakuAPIWrapper struct { - api *waku.PublicWakuAPI -} - -// NewGethPublicWakuAPIWrapper returns an object that wraps Geth's PublicWakuAPI in a types interface -func NewGethPublicWakuAPIWrapper(api *waku.PublicWakuAPI) types.PublicWakuAPI { - if api == nil { - panic("PublicWakuAPI cannot be nil") - } - - return &gethPublicWakuAPIWrapper{ - api: api, - } -} - -// AddPrivateKey imports the given private key. -func (w *gethPublicWakuAPIWrapper) AddPrivateKey(ctx context.Context, privateKey types.HexBytes) (string, error) { - return w.api.AddPrivateKey(ctx, hexutil.Bytes(privateKey)) -} - -// GenerateSymKeyFromPassword derives a key from the given password, stores it, and returns its ID. -func (w *gethPublicWakuAPIWrapper) GenerateSymKeyFromPassword(ctx context.Context, passwd string) (string, error) { - return w.api.GenerateSymKeyFromPassword(ctx, passwd) -} - -// DeleteKeyPair removes the key with the given key if it exists. -func (w *gethPublicWakuAPIWrapper) DeleteKeyPair(ctx context.Context, key string) (bool, error) { - return w.api.DeleteKeyPair(ctx, key) -} - -// NewMessageFilter creates a new filter that can be used to poll for -// (new) messages that satisfy the given criteria. -func (w *gethPublicWakuAPIWrapper) NewMessageFilter(req types.Criteria) (string, error) { - topics := make([]waku.TopicType, len(req.Topics)) - for index, tt := range req.Topics { - topics[index] = waku.TopicType(tt) - } - - criteria := waku.Criteria{ - SymKeyID: req.SymKeyID, - PrivateKeyID: req.PrivateKeyID, - Sig: req.Sig, - MinPow: req.MinPow, - Topics: topics, - AllowP2P: req.AllowP2P, - } - return w.api.NewMessageFilter(criteria) -} - -// GetFilterMessages returns the messages that match the filter criteria and -// are received between the last poll and now. -func (w *gethPublicWakuAPIWrapper) GetFilterMessages(id string) ([]*types.Message, error) { - msgs, err := w.api.GetFilterMessages(id) - if err != nil { - return nil, err - } - - wrappedMsgs := make([]*types.Message, len(msgs)) - for index, msg := range msgs { - wrappedMsgs[index] = &types.Message{ - Sig: msg.Sig, - TTL: msg.TTL, - Timestamp: msg.Timestamp, - Topic: types.TopicType(msg.Topic), - Payload: msg.Payload, - Padding: msg.Padding, - PoW: msg.PoW, - Hash: msg.Hash, - Dst: msg.Dst, - P2P: msg.P2P, - } - } - return wrappedMsgs, nil -} - -// Post posts a message on the network. -// returns the hash of the message in case of success. -func (w *gethPublicWakuAPIWrapper) Post(ctx context.Context, req types.NewMessage) ([]byte, error) { - msg := waku.NewMessage{ - SymKeyID: req.SymKeyID, - PublicKey: req.PublicKey, - Sig: req.SigID, // Sig is really a SigID - TTL: req.TTL, - Topic: waku.TopicType(req.Topic), - Payload: req.Payload, - Padding: req.Padding, - PowTime: req.PowTime, - PowTarget: req.PowTarget, - TargetPeer: req.TargetPeer, - } - return w.api.Post(ctx, msg) -} diff --git a/vendor/github.com/status-im/status-go/eth-node/bridge/geth/public_whisper_api.go b/vendor/github.com/status-im/status-go/eth-node/bridge/geth/public_whisper_api.go deleted file mode 100644 index c99c8445d..000000000 --- a/vendor/github.com/status-im/status-go/eth-node/bridge/geth/public_whisper_api.go +++ /dev/null @@ -1,103 +0,0 @@ -package gethbridge - -import ( - "context" - - "github.com/ethereum/go-ethereum/common/hexutil" - - "github.com/status-im/status-go/eth-node/types" - "github.com/status-im/status-go/whisper/v6" -) - -type gethPublicWhisperAPIWrapper struct { - publicWhisperAPI *whisper.PublicWhisperAPI -} - -// NewGethPublicWhisperAPIWrapper returns an object that wraps Geth's PublicWhisperAPI in a types interface -func NewGethPublicWhisperAPIWrapper(publicWhisperAPI *whisper.PublicWhisperAPI) types.PublicWhisperAPI { - if publicWhisperAPI == nil { - panic("publicWhisperAPI cannot be nil") - } - - return &gethPublicWhisperAPIWrapper{ - publicWhisperAPI: publicWhisperAPI, - } -} - -// AddPrivateKey imports the given private key. -func (w *gethPublicWhisperAPIWrapper) AddPrivateKey(ctx context.Context, privateKey types.HexBytes) (string, error) { - return w.publicWhisperAPI.AddPrivateKey(ctx, hexutil.Bytes(privateKey)) -} - -// GenerateSymKeyFromPassword derives a key from the given password, stores it, and returns its ID. -func (w *gethPublicWhisperAPIWrapper) GenerateSymKeyFromPassword(ctx context.Context, passwd string) (string, error) { - return w.publicWhisperAPI.GenerateSymKeyFromPassword(ctx, passwd) -} - -// DeleteKeyPair removes the key with the given key if it exists. -func (w *gethPublicWhisperAPIWrapper) DeleteKeyPair(ctx context.Context, key string) (bool, error) { - return w.publicWhisperAPI.DeleteKeyPair(ctx, key) -} - -// NewMessageFilter creates a new filter that can be used to poll for -// (new) messages that satisfy the given criteria. -func (w *gethPublicWhisperAPIWrapper) NewMessageFilter(req types.Criteria) (string, error) { - topics := make([]whisper.TopicType, len(req.Topics)) - for index, tt := range req.Topics { - topics[index] = whisper.TopicType(tt) - } - - criteria := whisper.Criteria{ - SymKeyID: req.SymKeyID, - PrivateKeyID: req.PrivateKeyID, - Sig: req.Sig, - MinPow: req.MinPow, - Topics: topics, - AllowP2P: req.AllowP2P, - } - return w.publicWhisperAPI.NewMessageFilter(criteria) -} - -// GetFilterMessages returns the messages that match the filter criteria and -// are received between the last poll and now. -func (w *gethPublicWhisperAPIWrapper) GetFilterMessages(id string) ([]*types.Message, error) { - msgs, err := w.publicWhisperAPI.GetFilterMessages(id) - if err != nil { - return nil, err - } - - wrappedMsgs := make([]*types.Message, len(msgs)) - for index, msg := range msgs { - wrappedMsgs[index] = &types.Message{ - Sig: msg.Sig, - TTL: msg.TTL, - Timestamp: msg.Timestamp, - Topic: types.TopicType(msg.Topic), - Payload: msg.Payload, - Padding: msg.Padding, - PoW: msg.PoW, - Hash: msg.Hash, - Dst: msg.Dst, - P2P: msg.P2P, - } - } - return wrappedMsgs, nil -} - -// Post posts a message on the Whisper network. -// returns the hash of the message in case of success. -func (w *gethPublicWhisperAPIWrapper) Post(ctx context.Context, req types.NewMessage) ([]byte, error) { - msg := whisper.NewMessage{ - SymKeyID: req.SymKeyID, - PublicKey: req.PublicKey, - Sig: req.SigID, // Sig is really a SigID - TTL: req.TTL, - Topic: whisper.TopicType(req.Topic), - Payload: req.Payload, - Padding: req.Padding, - PowTime: req.PowTime, - PowTarget: req.PowTarget, - TargetPeer: req.TargetPeer, - } - return w.publicWhisperAPI.Post(ctx, msg) -} diff --git a/vendor/github.com/status-im/status-go/eth-node/bridge/geth/subscription.go b/vendor/github.com/status-im/status-go/eth-node/bridge/geth/subscription.go deleted file mode 100644 index f6cfb852e..000000000 --- a/vendor/github.com/status-im/status-go/eth-node/bridge/geth/subscription.go +++ /dev/null @@ -1,30 +0,0 @@ -package gethbridge - -import ( - "github.com/ethereum/go-ethereum/event" - - "github.com/status-im/status-go/eth-node/types" -) - -type gethSubscriptionWrapper struct { - subscription event.Subscription -} - -// NewGethSubscriptionWrapper returns an object that wraps Geth's Subscription in a types interface -func NewGethSubscriptionWrapper(subscription event.Subscription) types.Subscription { - if subscription == nil { - panic("subscription cannot be nil") - } - - return &gethSubscriptionWrapper{ - subscription: subscription, - } -} - -func (w *gethSubscriptionWrapper) Err() <-chan error { - return w.subscription.Err() -} - -func (w *gethSubscriptionWrapper) Unsubscribe() { - w.subscription.Unsubscribe() -} diff --git a/vendor/github.com/status-im/status-go/eth-node/bridge/geth/syncevent_response.go b/vendor/github.com/status-im/status-go/eth-node/bridge/geth/syncevent_response.go deleted file mode 100644 index e9969a0eb..000000000 --- a/vendor/github.com/status-im/status-go/eth-node/bridge/geth/syncevent_response.go +++ /dev/null @@ -1,14 +0,0 @@ -package gethbridge - -import ( - "github.com/status-im/status-go/eth-node/types" - "github.com/status-im/status-go/whisper/v6" -) - -// NewGethSyncEventResponseWrapper returns a types.SyncEventResponse object that mimics Geth's SyncEventResponse -func NewGethSyncEventResponseWrapper(syncEventResponse whisper.SyncEventResponse) types.SyncEventResponse { - return types.SyncEventResponse{ - Cursor: syncEventResponse.Cursor, - Error: syncEventResponse.Error, - } -} diff --git a/vendor/github.com/status-im/status-go/eth-node/bridge/geth/syncmailrequest.go b/vendor/github.com/status-im/status-go/eth-node/bridge/geth/syncmailrequest.go deleted file mode 100644 index 1cb4af454..000000000 --- a/vendor/github.com/status-im/status-go/eth-node/bridge/geth/syncmailrequest.go +++ /dev/null @@ -1,17 +0,0 @@ -package gethbridge - -import ( - "github.com/status-im/status-go/eth-node/types" - "github.com/status-im/status-go/whisper/v6" -) - -// GetGethSyncMailRequestFrom converts a whisper SyncMailRequest struct from a SyncMailRequest struct -func GetGethSyncMailRequestFrom(r *types.SyncMailRequest) *whisper.SyncMailRequest { - return &whisper.SyncMailRequest{ - Lower: r.Lower, - Upper: r.Upper, - Bloom: r.Bloom, - Limit: r.Limit, - Cursor: r.Cursor, - } -} diff --git a/vendor/github.com/status-im/status-go/eth-node/bridge/geth/waku.go b/vendor/github.com/status-im/status-go/eth-node/bridge/geth/waku.go deleted file mode 100644 index 981937cfb..000000000 --- a/vendor/github.com/status-im/status-go/eth-node/bridge/geth/waku.go +++ /dev/null @@ -1,197 +0,0 @@ -package gethbridge - -import ( - "crypto/ecdsa" - "time" - - "github.com/status-im/status-go/eth-node/types" - "github.com/status-im/status-go/waku" -) - -type gethWakuWrapper struct { - waku *waku.Waku -} - -// NewGethWakuWrapper returns an object that wraps Geth's Waku in a types interface -func NewGethWakuWrapper(w *waku.Waku) types.Waku { - if w == nil { - panic("waku cannot be nil") - } - - return &gethWakuWrapper{ - waku: w, - } -} - -// GetGethWhisperFrom retrieves the underlying whisper Whisper struct from a wrapped Whisper interface -func GetGethWakuFrom(m types.Waku) *waku.Waku { - return m.(*gethWakuWrapper).waku -} - -func (w *gethWakuWrapper) PublicWakuAPI() types.PublicWakuAPI { - return NewGethPublicWakuAPIWrapper(waku.NewPublicWakuAPI(w.waku)) -} - -// MinPow returns the PoW value required by this node. -func (w *gethWakuWrapper) MinPow() float64 { - return w.waku.MinPow() -} - -// BloomFilter returns the aggregated bloom filter for all the topics of interest. -// The nodes are required to send only messages that match the advertised bloom filter. -// If a message does not match the bloom, it will tantamount to spam, and the peer will -// be disconnected. -func (w *gethWakuWrapper) BloomFilter() []byte { - return w.waku.BloomFilter() -} - -// GetCurrentTime returns current time. -func (w *gethWakuWrapper) GetCurrentTime() time.Time { - return w.waku.CurrentTime() -} - -// SetTimeSource assigns a particular source of time to a whisper object. -func (w *gethWakuWrapper) SetTimeSource(timesource func() time.Time) { - w.waku.SetTimeSource(timesource) -} - -func (w *gethWakuWrapper) SubscribeEnvelopeEvents(eventsProxy chan<- types.EnvelopeEvent) types.Subscription { - events := make(chan waku.EnvelopeEvent, 100) // must be buffered to prevent blocking whisper - go func() { - for e := range events { - eventsProxy <- *NewWakuEnvelopeEventWrapper(&e) - } - }() - - return NewGethSubscriptionWrapper(w.waku.SubscribeEnvelopeEvents(events)) -} - -func (w *gethWakuWrapper) GetPrivateKey(id string) (*ecdsa.PrivateKey, error) { - return w.waku.GetPrivateKey(id) -} - -// AddKeyPair imports a asymmetric private key and returns a deterministic identifier. -func (w *gethWakuWrapper) AddKeyPair(key *ecdsa.PrivateKey) (string, error) { - return w.waku.AddKeyPair(key) -} - -// DeleteKeyPair deletes the key with the specified ID if it exists. -func (w *gethWakuWrapper) DeleteKeyPair(keyID string) bool { - return w.waku.DeleteKeyPair(keyID) -} - -func (w *gethWakuWrapper) AddSymKeyDirect(key []byte) (string, error) { - return w.waku.AddSymKeyDirect(key) -} - -func (w *gethWakuWrapper) AddSymKeyFromPassword(password string) (string, error) { - return w.waku.AddSymKeyFromPassword(password) -} - -func (w *gethWakuWrapper) DeleteSymKey(id string) bool { - return w.waku.DeleteSymKey(id) -} - -func (w *gethWakuWrapper) GetSymKey(id string) ([]byte, error) { - return w.waku.GetSymKey(id) -} - -func (w *gethWakuWrapper) Subscribe(opts *types.SubscriptionOptions) (string, error) { - var ( - err error - keyAsym *ecdsa.PrivateKey - keySym []byte - ) - - if opts.SymKeyID != "" { - keySym, err = w.GetSymKey(opts.SymKeyID) - if err != nil { - return "", err - } - } - if opts.PrivateKeyID != "" { - keyAsym, err = w.GetPrivateKey(opts.PrivateKeyID) - if err != nil { - return "", err - } - } - - f, err := w.createFilterWrapper("", keyAsym, keySym, opts.PoW, opts.Topics) - if err != nil { - return "", err - } - - id, err := w.waku.Subscribe(GetWakuFilterFrom(f)) - if err != nil { - return "", err - } - - f.(*wakuFilterWrapper).id = id - return id, nil -} - -func (w *gethWakuWrapper) GetFilter(id string) types.Filter { - return NewWakuFilterWrapper(w.waku.GetFilter(id), id) -} - -func (w *gethWakuWrapper) Unsubscribe(id string) error { - return w.waku.Unsubscribe(id) -} - -func (w *gethWakuWrapper) createFilterWrapper(id string, keyAsym *ecdsa.PrivateKey, keySym []byte, pow float64, topics [][]byte) (types.Filter, error) { - return NewWakuFilterWrapper(&waku.Filter{ - KeyAsym: keyAsym, - KeySym: keySym, - PoW: pow, - AllowP2P: true, - Topics: topics, - Messages: waku.NewMemoryMessageStore(), - }, id), nil -} - -func (w *gethWakuWrapper) SendMessagesRequest(peerID []byte, r types.MessagesRequest) error { - return w.waku.SendMessagesRequest(peerID, waku.MessagesRequest{ - ID: r.ID, - From: r.From, - To: r.To, - Limit: r.Limit, - Cursor: r.Cursor, - Bloom: r.Bloom, - }) -} - -// RequestHistoricMessages sends a message with p2pRequestCode to a specific peer, -// which is known to implement MailServer interface, and is supposed to process this -// request and respond with a number of peer-to-peer messages (possibly expired), -// which are not supposed to be forwarded any further. -// The whisper protocol is agnostic of the format and contents of envelope. -func (w *gethWakuWrapper) RequestHistoricMessagesWithTimeout(peerID []byte, envelope types.Envelope, timeout time.Duration) error { - return w.waku.RequestHistoricMessagesWithTimeout(peerID, envelope.Unwrap().(*waku.Envelope), timeout) -} - -type wakuFilterWrapper struct { - filter *waku.Filter - id string -} - -// NewWakuFilterWrapper returns an object that wraps Geth's Filter in a types interface -func NewWakuFilterWrapper(f *waku.Filter, id string) types.Filter { - if f.Messages == nil { - panic("Messages should not be nil") - } - - return &wakuFilterWrapper{ - filter: f, - id: id, - } -} - -// GetWakuFilterFrom retrieves the underlying whisper Filter struct from a wrapped Filter interface -func GetWakuFilterFrom(f types.Filter) *waku.Filter { - return f.(*wakuFilterWrapper).filter -} - -// ID returns the filter ID -func (w *wakuFilterWrapper) ID() string { - return w.id -} diff --git a/vendor/github.com/status-im/status-go/eth-node/bridge/geth/whisper.go b/vendor/github.com/status-im/status-go/eth-node/bridge/geth/whisper.go deleted file mode 100644 index 81c95c436..000000000 --- a/vendor/github.com/status-im/status-go/eth-node/bridge/geth/whisper.go +++ /dev/null @@ -1,207 +0,0 @@ -package gethbridge - -import ( - "crypto/ecdsa" - "time" - - "github.com/status-im/status-go/eth-node/types" - "github.com/status-im/status-go/whisper/v6" -) - -type gethWhisperWrapper struct { - whisper *whisper.Whisper -} - -// NewGethWhisperWrapper returns an object that wraps Geth's Whisper in a types interface -func NewGethWhisperWrapper(w *whisper.Whisper) types.Whisper { - if w == nil { - panic("w cannot be nil") - } - - return &gethWhisperWrapper{ - whisper: w, - } -} - -// GetGethWhisperFrom retrieves the underlying whisper Whisper struct from a wrapped Whisper interface -func GetGethWhisperFrom(m types.Whisper) *whisper.Whisper { - return m.(*gethWhisperWrapper).whisper -} - -func (w *gethWhisperWrapper) PublicWhisperAPI() types.PublicWhisperAPI { - return NewGethPublicWhisperAPIWrapper(whisper.NewPublicWhisperAPI(w.whisper)) -} - -// MinPow returns the PoW value required by this node. -func (w *gethWhisperWrapper) MinPow() float64 { - return w.whisper.MinPow() -} - -// BloomFilter returns the aggregated bloom filter for all the topics of interest. -// The nodes are required to send only messages that match the advertised bloom filter. -// If a message does not match the bloom, it will tantamount to spam, and the peer will -// be disconnected. -func (w *gethWhisperWrapper) BloomFilter() []byte { - return w.whisper.BloomFilter() -} - -// GetCurrentTime returns current time. -func (w *gethWhisperWrapper) GetCurrentTime() time.Time { - return w.whisper.GetCurrentTime() -} - -// SetTimeSource assigns a particular source of time to a whisper object. -func (w *gethWhisperWrapper) SetTimeSource(timesource func() time.Time) { - w.whisper.SetTimeSource(timesource) -} - -func (w *gethWhisperWrapper) SubscribeEnvelopeEvents(eventsProxy chan<- types.EnvelopeEvent) types.Subscription { - events := make(chan whisper.EnvelopeEvent, 100) // must be buffered to prevent blocking whisper - go func() { - for e := range events { - eventsProxy <- *NewWhisperEnvelopeEventWrapper(&e) - } - }() - - return NewGethSubscriptionWrapper(w.whisper.SubscribeEnvelopeEvents(events)) -} - -func (w *gethWhisperWrapper) GetPrivateKey(id string) (*ecdsa.PrivateKey, error) { - return w.whisper.GetPrivateKey(id) -} - -// AddKeyPair imports a asymmetric private key and returns a deterministic identifier. -func (w *gethWhisperWrapper) AddKeyPair(key *ecdsa.PrivateKey) (string, error) { - return w.whisper.AddKeyPair(key) -} - -// DeleteKeyPair deletes the key with the specified ID if it exists. -func (w *gethWhisperWrapper) DeleteKeyPair(keyID string) bool { - return w.whisper.DeleteKeyPair(keyID) -} - -// DeleteKeyPairs removes all cryptographic identities known to the node -func (w *gethWhisperWrapper) DeleteKeyPairs() error { - return w.whisper.DeleteKeyPairs() -} - -func (w *gethWhisperWrapper) AddSymKeyDirect(key []byte) (string, error) { - return w.whisper.AddSymKeyDirect(key) -} - -func (w *gethWhisperWrapper) AddSymKeyFromPassword(password string) (string, error) { - return w.whisper.AddSymKeyFromPassword(password) -} - -func (w *gethWhisperWrapper) DeleteSymKey(id string) bool { - return w.whisper.DeleteSymKey(id) -} - -func (w *gethWhisperWrapper) GetSymKey(id string) ([]byte, error) { - return w.whisper.GetSymKey(id) -} - -func (w *gethWhisperWrapper) Subscribe(opts *types.SubscriptionOptions) (string, error) { - var ( - err error - keyAsym *ecdsa.PrivateKey - keySym []byte - ) - - if opts.SymKeyID != "" { - keySym, err = w.GetSymKey(opts.SymKeyID) - if err != nil { - return "", err - } - } - if opts.PrivateKeyID != "" { - keyAsym, err = w.GetPrivateKey(opts.PrivateKeyID) - if err != nil { - return "", err - } - } - - f, err := w.createFilterWrapper("", keyAsym, keySym, opts.PoW, opts.Topics) - if err != nil { - return "", err - } - - id, err := w.whisper.Subscribe(GetWhisperFilterFrom(f)) - if err != nil { - return "", err - } - - f.(*whisperFilterWrapper).id = id - return id, nil -} - -func (w *gethWhisperWrapper) GetFilter(id string) types.Filter { - return NewWhisperFilterWrapper(w.whisper.GetFilter(id), id) -} - -func (w *gethWhisperWrapper) Unsubscribe(id string) error { - return w.whisper.Unsubscribe(id) -} - -func (w *gethWhisperWrapper) createFilterWrapper(id string, keyAsym *ecdsa.PrivateKey, keySym []byte, pow float64, topics [][]byte) (types.Filter, error) { - return NewWhisperFilterWrapper(&whisper.Filter{ - KeyAsym: keyAsym, - KeySym: keySym, - PoW: pow, - AllowP2P: true, - Topics: topics, - Messages: whisper.NewMemoryMessageStore(), - }, id), nil -} - -func (w *gethWhisperWrapper) SendMessagesRequest(peerID []byte, r types.MessagesRequest) error { - return w.whisper.SendMessagesRequest(peerID, whisper.MessagesRequest{ - ID: r.ID, - From: r.From, - To: r.To, - Limit: r.Limit, - Cursor: r.Cursor, - Bloom: r.Bloom, - }) -} - -// RequestHistoricMessages sends a message with p2pRequestCode to a specific peer, -// which is known to implement MailServer interface, and is supposed to process this -// request and respond with a number of peer-to-peer messages (possibly expired), -// which are not supposed to be forwarded any further. -// The whisper protocol is agnostic of the format and contents of envelope. -func (w *gethWhisperWrapper) RequestHistoricMessagesWithTimeout(peerID []byte, envelope types.Envelope, timeout time.Duration) error { - return w.whisper.RequestHistoricMessagesWithTimeout(peerID, envelope.Unwrap().(*whisper.Envelope), timeout) -} - -// SyncMessages can be sent between two Mail Servers and syncs envelopes between them. -func (w *gethWhisperWrapper) SyncMessages(peerID []byte, req types.SyncMailRequest) error { - return w.whisper.SyncMessages(peerID, *GetGethSyncMailRequestFrom(&req)) -} - -type whisperFilterWrapper struct { - filter *whisper.Filter - id string -} - -// NewWhisperFilterWrapper returns an object that wraps Geth's Filter in a types interface -func NewWhisperFilterWrapper(f *whisper.Filter, id string) types.Filter { - if f.Messages == nil { - panic("Messages should not be nil") - } - - return &whisperFilterWrapper{ - filter: f, - id: id, - } -} - -// GetWhisperFilterFrom retrieves the underlying whisper Filter struct from a wrapped Filter interface -func GetWhisperFilterFrom(f types.Filter) *whisper.Filter { - return f.(*whisperFilterWrapper).filter -} - -// ID returns the filter ID -func (w *whisperFilterWrapper) ID() string { - return w.id -} diff --git a/vendor/github.com/status-im/status-go/eth-node/bridge/nimbus/build-nimbus.sh b/vendor/github.com/status-im/status-go/eth-node/bridge/nimbus/build-nimbus.sh deleted file mode 100644 index 48751f54f..000000000 --- a/vendor/github.com/status-im/status-go/eth-node/bridge/nimbus/build-nimbus.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/env bash - -# Pre-requisites: Git, Nix - -set -e - -GIT_ROOT=$(cd "${BASH_SOURCE%/*}" && git rev-parse --show-toplevel) - -# NOTE: To use a local Nimbus repository, uncomment and edit the following line -#nimbus_dir=~/src/github.com/status-im/nimbus - -target_dir="${GIT_ROOT}/vendor/github.com/status-im/status-go/eth-node/bridge/nimbus" - -if [ -z "$nimbus_dir" ]; then - # The git ref of Nimbus to fetch and build. This should represent a commit SHA or a tag, for reproducible builds - nimbus_ref='feature/android-api' # TODO: Use a tag once - - nimbus_src='https://github.com/status-im/nimbus/' - nimbus_dir="${GIT_ROOT}/vendor/github.com/status-im/nimbus" - - trap "rm -rf $nimbus_dir" ERR INT QUIT - - # Clone nimbus repo into vendor directory, if necessary - if [ -d "$nimbus_dir" ]; then - cd $nimbus_dir && git reset --hard $nimbus_ref; cd - - else - # List fetched from vendorDeps array in https://github.com/status-im/nimbus/blob/master/nix/nimbus-wrappers.nix#L9-L12 - vendor_paths=( nim-chronicles nim-faststreams nim-json-serialization nim-chronos nim-eth nim-json nim-metrics nim-secp256k1 nim-serialization nim-stew nim-stint nimcrypto ) - vendor_path_opts="${vendor_paths[@]/#/--recurse-submodules=vendor/}" - git clone $nimbus_src --progress ${vendor_path_opts} --depth 1 -j8 -b $nimbus_ref $nimbus_dir - fi -fi - -# Build Nimbus wrappers and copy them into the Nimbus bridge in status-eth-node -build_dir=$(nix-build --pure --no-out-link -A wrappers-native $nimbus_dir/nix/default.nix) -rm -f ${target_dir}/libnimbus.* -mkdir -p ${target_dir} -cp -f ${build_dir}/include/* ${build_dir}/lib/libnimbus.so \ - ${target_dir}/ -chmod +w ${target_dir}/libnimbus.{so,h} diff --git a/vendor/github.com/status-im/status-go/eth-node/bridge/nimbus/cfuncs.go b/vendor/github.com/status-im/status-go/eth-node/bridge/nimbus/cfuncs.go deleted file mode 100644 index 5a1f952ad..000000000 --- a/vendor/github.com/status-im/status-go/eth-node/bridge/nimbus/cfuncs.go +++ /dev/null @@ -1,16 +0,0 @@ -// +build nimbus - -package nimbusbridge - -/* - -#include - -// onMessageHandler gateway function -void onMessageHandler_cgo(received_message * msg, void* udata) -{ - void onMessageHandler(received_message* msg, void* udata); - onMessageHandler(msg, udata); -} -*/ -import "C" diff --git a/vendor/github.com/status-im/status-go/eth-node/bridge/nimbus/filter.go b/vendor/github.com/status-im/status-go/eth-node/bridge/nimbus/filter.go deleted file mode 100644 index 69acb7635..000000000 --- a/vendor/github.com/status-im/status-go/eth-node/bridge/nimbus/filter.go +++ /dev/null @@ -1,61 +0,0 @@ -// +build nimbus - -package nimbusbridge - -// https://golang.org/cmd/cgo/ - -/* -#include -#include -#include -#include -*/ -import "C" - -import ( - "unsafe" - - "github.com/status-im/status-go/eth-node/types" -) - -type nimbusFilterWrapper struct { - filter *C.filter_options - id string - own bool -} - -// NewNimbusFilterWrapper returns an object that wraps Nimbus's Filter in a types interface -func NewNimbusFilterWrapper(f *C.filter_options, id string, own bool) types.Filter { - wrapper := &nimbusFilterWrapper{ - filter: f, - id: id, - own: own, - } - return wrapper -} - -// GetNimbusFilterFrom retrieves the underlying whisper Filter struct from a wrapped Filter interface -func GetNimbusFilterFrom(f types.Filter) *C.filter_options { - return f.(*nimbusFilterWrapper).filter -} - -// ID returns the filter ID -func (w *nimbusFilterWrapper) ID() string { - return w.id -} - -// Free frees the C memory associated with the filter -func (w *nimbusFilterWrapper) Free() { - if !w.own { - panic("native filter is not owned by Go") - } - - if w.filter.privateKeyID != nil { - C.free(unsafe.Pointer(w.filter.privateKeyID)) - w.filter.privateKeyID = nil - } - if w.filter.symKeyID != nil { - C.free(unsafe.Pointer(w.filter.symKeyID)) - w.filter.symKeyID = nil - } -} diff --git a/vendor/github.com/status-im/status-go/eth-node/bridge/nimbus/keystore.go b/vendor/github.com/status-im/status-go/eth-node/bridge/nimbus/keystore.go deleted file mode 100644 index 43ac4d3b0..000000000 --- a/vendor/github.com/status-im/status-go/eth-node/bridge/nimbus/keystore.go +++ /dev/null @@ -1,263 +0,0 @@ -// +build nimbus - -package nimbusbridge - -// https://golang.org/cmd/cgo/ - -/* -#include -#include -#include -#include -*/ -import "C" -import ( - "crypto/ecdsa" - "encoding/binary" - "errors" - "fmt" - "math/big" - "unsafe" - - "github.com/btcsuite/btcd/btcec" - "github.com/pborman/uuid" - - "github.com/status-im/status-go/eth-node/crypto" - "github.com/status-im/status-go/eth-node/types" - "github.com/status-im/status-go/extkeys" -) - -var ( - ErrInvalidSeed = errors.New("seed is invalid") - ErrInvalidKeyLen = errors.New("Nimbus serialized extended key length is invalid") -) - -type nimbusKeyStoreAdapter struct { -} - -// WrapKeyStore creates a types.KeyStore wrapper over the singleton Nimbus node -func WrapKeyStore() types.KeyStore { - return &nimbusKeyStoreAdapter{} -} - -func (k *nimbusKeyStoreAdapter) ImportECDSA(priv *ecdsa.PrivateKey, passphrase string) (types.Account, error) { - fmt.Println("ImportECDSA") - panic("ImportECDSA") - - var privateKeyC unsafe.Pointer - if priv != nil { - privateKeyC = C.CBytes(crypto.FromECDSA(priv)) - defer C.free(privateKeyC) - } - passphraseC := C.CString(passphrase) - defer C.free(unsafe.Pointer(passphraseC)) - - var nimbusAccount C.account - if !C.nimbus_keystore_import_ecdsa((*C.uchar)(privateKeyC), passphraseC, &nimbusAccount) { - return types.Account{}, errors.New("failed to import ECDSA private key") - } - return accountFrom(&nimbusAccount), nil -} - -func (k *nimbusKeyStoreAdapter) ImportSingleExtendedKey(extKey *extkeys.ExtendedKey, passphrase string) (types.Account, error) { - fmt.Println("ImportSingleExtendedKey") - panic("ImportSingleExtendedKey") - - extKeyJSONC := C.CString(extKey.String()) - defer C.free(unsafe.Pointer(extKeyJSONC)) - passphraseC := C.CString(passphrase) - defer C.free(unsafe.Pointer(passphraseC)) - - var nimbusAccount C.account - if !C.nimbus_keystore_import_single_extendedkey(extKeyJSONC, passphraseC, &nimbusAccount) { - return types.Account{}, errors.New("failed to import extended key") - } - return accountFrom(&nimbusAccount), nil -} - -func (k *nimbusKeyStoreAdapter) ImportExtendedKeyForPurpose(keyPurpose extkeys.KeyPurpose, extKey *extkeys.ExtendedKey, passphrase string) (types.Account, error) { - fmt.Println("ImportExtendedKeyForPurpose") - - passphraseC := C.CString(passphrase) - defer C.free(unsafe.Pointer(passphraseC)) - extKeyJSONC := C.CString(extKey.String()) - defer C.free(unsafe.Pointer(extKeyJSONC)) - - var nimbusAccount C.account - if !C.nimbus_keystore_import_extendedkeyforpurpose(C.int(keyPurpose), extKeyJSONC, passphraseC, &nimbusAccount) { - return types.Account{}, errors.New("failed to import extended key") - } - return accountFrom(&nimbusAccount), nil -} - -func (k *nimbusKeyStoreAdapter) AccountDecryptedKey(a types.Account, auth string) (types.Account, *types.Key, error) { - fmt.Println("AccountDecryptedKey") - panic("AccountDecryptedKey") - - authC := C.CString(auth) - defer C.free(unsafe.Pointer(authC)) - - var nimbusAccount C.account - err := nimbusAccountFrom(a, &nimbusAccount) - if err != nil { - return types.Account{}, nil, err - } - - var nimbusKey C.key - if !C.nimbus_keystore_account_decrypted_key(authC, &nimbusAccount, &nimbusKey) { - return types.Account{}, nil, errors.New("failed to decrypt account key") - } - key, err := keyFrom(&nimbusKey) - if err != nil { - return types.Account{}, nil, err - } - return accountFrom(&nimbusAccount), key, nil -} - -func (k *nimbusKeyStoreAdapter) Delete(a types.Account, auth string) error { - fmt.Println("Delete") - - var nimbusAccount C.account - err := nimbusAccountFrom(a, &nimbusAccount) - if err != nil { - return err - } - - authC := C.CString(auth) - defer C.free(unsafe.Pointer(authC)) - - if !C.nimbus_keystore_delete(&nimbusAccount, authC) { - return errors.New("failed to delete account") - } - - return nil -} - -func nimbusAccountFrom(account types.Account, nimbusAccount *C.account) error { - fmt.Println("nimbusAccountFrom") - err := copyAddressToCBuffer(&nimbusAccount.address[0], account.Address.Bytes()) - if err != nil { - return err - } - if account.URL == "" { - nimbusAccount.url[0] = C.char(0) - } else if len(account.URL) >= C.URL_LEN { - return errors.New("URL is too long to fit in Nimbus struct") - } else { - copyURLToCBuffer(&nimbusAccount.url[0], account.URL) - } - return err -} - -func accountFrom(nimbusAccount *C.account) types.Account { - return types.Account{ - Address: types.BytesToAddress(C.GoBytes(unsafe.Pointer(&nimbusAccount.address[0]), C.ADDRESS_LEN)), - URL: C.GoString(&nimbusAccount.url[0]), - } -} - -// copyAddressToCBuffer copies a Go buffer to a C buffer without allocating new memory -func copyAddressToCBuffer(dst *C.uchar, src []byte) error { - if len(src) != C.ADDRESS_LEN { - return errors.New("invalid buffer size") - } - - p := (*[C.ADDRESS_LEN]C.uchar)(unsafe.Pointer(dst)) - for index, b := range src { - p[index] = C.uchar(b) - } - - return nil -} - -// copyURLToCBuffer copies a Go buffer to a C buffer without allocating new memory -func copyURLToCBuffer(dst *C.char, src string) error { - if len(src)+1 > C.URL_LEN { - return errors.New("URL is too long to fit in Nimbus struct") - } - - p := (*[C.URL_LEN]C.uchar)(unsafe.Pointer(dst)) - for index := 0; index <= len(src); index++ { - p[index] = C.uchar(src[index]) - } - - return nil -} - -func keyFrom(k *C.key) (*types.Key, error) { - fmt.Println("keyFrom") - if k == nil { - return nil, nil - } - - var err error - key := types.Key{ - Id: uuid.Parse(C.GoString(&k.id[0])), - } - key.Address = types.BytesToAddress(C.GoBytes(unsafe.Pointer(&k.address[0]), C.ADDRESS_LEN)) - key.PrivateKey, err = crypto.ToECDSA(C.GoBytes(unsafe.Pointer(&k.privateKeyID[0]), C.PRIVKEY_LEN)) - if err != nil { - return nil, err - } - key.ExtendedKey, err = newExtKeyFromBuffer(C.GoBytes(unsafe.Pointer(&k.extKey[0]), C.EXTKEY_LEN)) - if err != nil { - return nil, err - } - return &key, err -} - -// newExtKeyFromBuffer returns a new extended key instance from a serialized -// extended key. -func newExtKeyFromBuffer(key []byte) (*extkeys.ExtendedKey, error) { - if len(key) == 0 { - return &extkeys.ExtendedKey{}, nil - } - - if len(key) != C.EXTKEY_LEN { - return nil, ErrInvalidKeyLen - } - - // The serialized format is: - // version (4) || depth (1) || parent fingerprint (4)) || - // child num (4) || chain code (32) || key data (33) - - payload := key - - // Deserialize each of the payload fields. - version := payload[:4] - depth := payload[4:5][0] - fingerPrint := payload[5:9] - childNumber := binary.BigEndian.Uint32(payload[9:13]) - chainCode := payload[13:45] - keyData := payload[45:78] - - // The key data is a private key if it starts with 0x00. Serialized - // compressed pubkeys either start with 0x02 or 0x03. - isPrivate := keyData[0] == 0x00 - if isPrivate { - // Ensure the private key is valid. It must be within the range - // of the order of the secp256k1 curve and not be 0. - keyData = keyData[1:] - keyNum := new(big.Int).SetBytes(keyData) - if keyNum.Cmp(btcec.S256().N) >= 0 || keyNum.Sign() == 0 { - return nil, ErrInvalidSeed - } - } else { - // Ensure the public key parses correctly and is actually on the - // secp256k1 curve. - _, err := btcec.ParsePubKey(keyData, btcec.S256()) - if err != nil { - return nil, err - } - } - - return &extkeys.ExtendedKey{ - Version: version, - KeyData: keyData, - ChainCode: chainCode, - FingerPrint: fingerPrint, - Depth: depth, - ChildNumber: childNumber, - IsPrivate: isPrivate, - }, nil -} diff --git a/vendor/github.com/status-im/status-go/eth-node/bridge/nimbus/node.go b/vendor/github.com/status-im/status-go/eth-node/bridge/nimbus/node.go deleted file mode 100644 index 1feff085d..000000000 --- a/vendor/github.com/status-im/status-go/eth-node/bridge/nimbus/node.go +++ /dev/null @@ -1,159 +0,0 @@ -// +build nimbus - -package nimbusbridge - -// https://golang.org/cmd/cgo/ - -/* -#cgo LDFLAGS: -Wl,-rpath,'$ORIGIN' -L${SRCDIR} -lnimbus -lm -#include -#include -#include -#include -*/ -import "C" -import ( - "crypto/ecdsa" - "errors" - "fmt" - "runtime" - "strconv" - "strings" - "sync" - "syscall" - "time" - "unsafe" - - "go.uber.org/zap" - - "github.com/status-im/status-go/eth-node/crypto" - "github.com/status-im/status-go/eth-node/types" - enstypes "github.com/status-im/status-go/eth-node/types/ens" -) - -type nimbusNodeWrapper struct { - mu sync.Mutex - - routineQueue *RoutineQueue - tid int - nodeStarted bool - cancelPollingChan chan struct{} - - w types.Whisper -} - -type Node interface { - types.Node - - StartNimbus(privateKey *ecdsa.PrivateKey, listenAddr string, staging bool) error - Stop() -} - -func NewNodeBridge() Node { - c := make(chan Node, 1) - go func(c chan<- Node, delay time.Duration) { - runtime.LockOSThread() - defer runtime.UnlockOSThread() - - n := &nimbusNodeWrapper{ - routineQueue: NewRoutineQueue(), - tid: syscall.Gettid(), - cancelPollingChan: make(chan struct{}, 1), - } - c <- n - - for { - select { - case <-time.After(delay): - n.poll() - case <-n.cancelPollingChan: - return - } - } - }(c, 50*time.Millisecond) - - return <-c -} - -func (n *nimbusNodeWrapper) StartNimbus(privateKey *ecdsa.PrivateKey, listenAddr string, staging bool) error { - return n.routineQueue.Send(func(c chan<- callReturn) { - c <- callReturn{err: startNimbus(privateKey, listenAddr, staging)} - n.nodeStarted = true - }).err -} - -func (n *nimbusNodeWrapper) Stop() { - if n.cancelPollingChan != nil { - close(n.cancelPollingChan) - n.nodeStarted = false - n.cancelPollingChan = nil - } -} - -func (n *nimbusNodeWrapper) NewENSVerifier(_ *zap.Logger) enstypes.ENSVerifier { - panic("not implemented") -} - -func (n *nimbusNodeWrapper) GetWhisper(ctx interface{}) (types.Whisper, error) { - n.mu.Lock() - defer n.mu.Unlock() - - if n.w == nil { - n.w = NewNimbusWhisperWrapper(n.routineQueue) - } - return n.w, nil -} - -func (w *nimbusNodeWrapper) GetWaku(ctx interface{}) (types.Waku, error) { - panic("not implemented") -} - -func (n *nimbusNodeWrapper) AddPeer(url string) error { - urlC := C.CString(url) - defer C.free(unsafe.Pointer(urlC)) - if !C.nimbus_add_peer(urlC) { - return fmt.Errorf("failed to add peer: %s", url) - } - - return nil -} - -func (n *nimbusNodeWrapper) RemovePeer(url string) error { - panic("TODO: RemovePeer") -} - -func (n *nimbusNodeWrapper) poll() { - if syscall.Gettid() != n.tid { - panic("poll called from wrong thread") - } - - if n.nodeStarted { - C.nimbus_poll() - } - - n.routineQueue.HandleEvent() -} - -func startNimbus(privateKey *ecdsa.PrivateKey, listenAddr string, staging bool) error { - C.NimMain() - - if listenAddr == "" { - listenAddr = ":30304" - } - addrParts := strings.Split(listenAddr, ":") - port, err := strconv.Atoi(addrParts[len(addrParts)-1]) - if err != nil { - return fmt.Errorf("failed to parse port number from %s", listenAddr) - } - - var privateKeyC unsafe.Pointer - if privateKey != nil { - privateKeyC = C.CBytes(crypto.FromECDSA(privateKey)) - defer C.free(privateKeyC) - } - if !C.nimbus_start(C.ushort(port), true, false, 0.002, (*C.uchar)(privateKeyC), C.bool(staging)) { - return errors.New("failed to start Nimbus node") - } - - return nil -} diff --git a/vendor/github.com/status-im/status-go/eth-node/bridge/nimbus/public_whisper_api.go b/vendor/github.com/status-im/status-go/eth-node/bridge/nimbus/public_whisper_api.go deleted file mode 100644 index 50b37480d..000000000 --- a/vendor/github.com/status-im/status-go/eth-node/bridge/nimbus/public_whisper_api.go +++ /dev/null @@ -1,212 +0,0 @@ -// +build nimbus - -package nimbusbridge - -// https://golang.org/cmd/cgo/ - -/* -#include -#include -#include -#include -*/ -import "C" - -import ( - "container/list" - "context" - "errors" - "fmt" - "sync" - "unsafe" - - "github.com/status-im/status-go/eth-node/types" -) - -type nimbusPublicWhisperAPIWrapper struct { - filterMessagesMu *sync.Mutex - filterMessages *map[string]*list.List - routineQueue *RoutineQueue -} - -// NewNimbusPublicWhisperAPIWrapper returns an object that wraps Nimbus's PublicWhisperAPI in a types interface -func NewNimbusPublicWhisperAPIWrapper(filterMessagesMu *sync.Mutex, filterMessages *map[string]*list.List, routineQueue *RoutineQueue) types.PublicWhisperAPI { - return &nimbusPublicWhisperAPIWrapper{ - filterMessagesMu: filterMessagesMu, - filterMessages: filterMessages, - routineQueue: routineQueue, - } -} - -// AddPrivateKey imports the given private key. -func (w *nimbusPublicWhisperAPIWrapper) AddPrivateKey(ctx context.Context, privateKey types.HexBytes) (string, error) { - retVal := w.routineQueue.Send(func(c chan<- callReturn) { - privKeyC := C.CBytes(privateKey) - defer C.free(unsafe.Pointer(privKeyC)) - - idC := C.malloc(C.size_t(C.ID_LEN)) - defer C.free(idC) - if C.nimbus_add_keypair((*C.uchar)(privKeyC), (*C.uchar)(idC)) { - c <- callReturn{value: types.EncodeHex(C.GoBytes(idC, C.ID_LEN))} - } else { - c <- callReturn{err: errors.New("failed to add private key to Nimbus")} - } - }) - if retVal.err != nil { - return "", retVal.err - } - - return retVal.value.(string), nil -} - -// GenerateSymKeyFromPassword derives a key from the given password, stores it, and returns its ID. -func (w *nimbusPublicWhisperAPIWrapper) GenerateSymKeyFromPassword(ctx context.Context, passwd string) (string, error) { - retVal := w.routineQueue.Send(func(c chan<- callReturn) { - passwordC := C.CString(passwd) - defer C.free(unsafe.Pointer(passwordC)) - - idC := C.malloc(C.size_t(C.ID_LEN)) - defer C.free(idC) - if C.nimbus_add_symkey_from_password(passwordC, (*C.uchar)(idC)) { - c <- callReturn{value: types.EncodeHex(C.GoBytes(idC, C.ID_LEN))} - } else { - c <- callReturn{err: errors.New("failed to add symkey to Nimbus")} - } - }) - if retVal.err != nil { - return "", retVal.err - } - - return retVal.value.(string), nil -} - -// DeleteKeyPair removes the key with the given key if it exists. -func (w *nimbusPublicWhisperAPIWrapper) DeleteKeyPair(ctx context.Context, key string) (bool, error) { - retVal := w.routineQueue.Send(func(c chan<- callReturn) { - keyC, err := decodeHexID(key) - if err != nil { - c <- callReturn{err: err} - return - } - defer C.free(unsafe.Pointer(keyC)) - - c <- callReturn{value: C.nimbus_delete_keypair(keyC)} - }) - if retVal.err != nil { - return false, retVal.err - } - - return retVal.value.(bool), nil -} - -// NewMessageFilter creates a new filter that can be used to poll for -// (new) messages that satisfy the given criteria. -func (w *nimbusPublicWhisperAPIWrapper) NewMessageFilter(req types.Criteria) (string, error) { - // topics := make([]whisper.TopicType, len(req.Topics)) - // for index, tt := range req.Topics { - // topics[index] = whisper.TopicType(tt) - // } - - // criteria := whisper.Criteria{ - // SymKeyID: req.SymKeyID, - // PrivateKeyID: req.PrivateKeyID, - // Sig: req.Sig, - // MinPow: req.MinPow, - // Topics: topics, - // AllowP2P: req.AllowP2P, - // } - // return w.publicWhisperAPI.NewMessageFilter(criteria) - // TODO - return "", errors.New("not implemented") -} - -// GetFilterMessages returns the messages that match the filter criteria and -// are received between the last poll and now. -func (w *nimbusPublicWhisperAPIWrapper) GetFilterMessages(id string) ([]*types.Message, error) { - idC := C.CString(id) - defer C.free(unsafe.Pointer(idC)) - - var ( - messageList *list.List - ok bool - ) - w.filterMessagesMu.Lock() - defer w.filterMessagesMu.Unlock() - if messageList, ok = (*w.filterMessages)[id]; !ok { - return nil, fmt.Errorf("no filter with ID %s", id) - } - - retVal := make([]*types.Message, messageList.Len()) - if messageList.Len() == 0 { - return retVal, nil - } - - elem := messageList.Front() - index := 0 - for elem != nil { - retVal[index] = (elem.Value).(*types.Message) - index++ - next := elem.Next() - messageList.Remove(elem) - elem = next - } - return retVal, nil -} - -// Post posts a message on the Whisper network. -// returns the hash of the message in case of success. -func (w *nimbusPublicWhisperAPIWrapper) Post(ctx context.Context, req types.NewMessage) ([]byte, error) { - retVal := w.routineQueue.Send(func(c chan<- callReturn) { - msg := C.post_message{ - ttl: C.uint32_t(req.TTL), - powTime: C.double(req.PowTime), - powTarget: C.double(req.PowTarget), - } - if req.SigID != "" { - sourceID, err := decodeHexID(req.SigID) - if err != nil { - c <- callReturn{err: err} - return - } - msg.sourceID = sourceID - defer C.free(unsafe.Pointer(sourceID)) - } - if req.SymKeyID != "" { - symKeyID, err := decodeHexID(req.SymKeyID) - if err != nil { - c <- callReturn{err: err} - return - } - msg.symKeyID = symKeyID - defer C.free(unsafe.Pointer(symKeyID)) - } - if req.PublicKey != nil && len(req.PublicKey) > 0 { - msg.pubKey = (*C.uchar)(C.CBytes(req.PublicKey[1:])) - defer C.free(unsafe.Pointer(msg.pubKey)) - } - msg.payloadLen = C.size_t(len(req.Payload)) - msg.payload = (*C.uchar)(C.CBytes(req.Payload)) - defer C.free(unsafe.Pointer(msg.payload)) - msg.paddingLen = C.size_t(len(req.Padding)) - msg.padding = (*C.uchar)(C.CBytes(req.Padding)) - defer C.free(unsafe.Pointer(msg.padding)) - copyTopicToCBuffer(&msg.topic[0], req.Topic[:]) - - // TODO: return envelope hash once nimbus_post is improved to return it - if C.nimbus_post(&msg) { - c <- callReturn{value: make([]byte, 0)} - return - } - c <- callReturn{err: fmt.Errorf("failed to post message symkeyid=%s pubkey=%#x topic=%#x", req.SymKeyID, req.PublicKey, req.Topic[:])} - // hashC := C.nimbus_post(&msg) - // if hashC == nil { - // return nil, errors.New("Nimbus failed to post message") - // } - // return hex.DecodeString(C.GoString(hashC)) - }) - if retVal.err != nil { - return nil, retVal.err - } - - return retVal.value.([]byte), nil -} diff --git a/vendor/github.com/status-im/status-go/eth-node/bridge/nimbus/routine_queue.go b/vendor/github.com/status-im/status-go/eth-node/bridge/nimbus/routine_queue.go deleted file mode 100644 index ccf0b71f4..000000000 --- a/vendor/github.com/status-im/status-go/eth-node/bridge/nimbus/routine_queue.go +++ /dev/null @@ -1,64 +0,0 @@ -// +build nimbus - -package nimbusbridge - -import ( - "syscall" -) - -// RoutineQueue provides a mechanism for marshalling function calls -// so that they are run in a specific thread (the thread where -// RoutineQueue is initialized). -type RoutineQueue struct { - tid int - events chan event -} - -type callReturn struct { - value interface{} - err error -} - -// NewRoutineQueue returns a new RoutineQueue object. -func NewRoutineQueue() *RoutineQueue { - q := &RoutineQueue{ - tid: syscall.Gettid(), - events: make(chan event, 20), - } - - return q -} - -// event represents an event triggered by the user. -type event struct { - f func(chan<- callReturn) - done chan callReturn -} - -func (q *RoutineQueue) HandleEvent() { - if syscall.Gettid() != q.tid { - panic("HandleEvent called from wrong thread") - } - - select { - case ev := <-q.events: - ev.f(ev.done) - default: - return - } -} - -// Send executes the passed function. This method can be called safely from a -// goroutine in order to execute a Nimbus function. It is important to note that the -// passed function won't be executed immediately, instead it will be added to -// the user events queue. -func (q *RoutineQueue) Send(f func(chan<- callReturn)) callReturn { - ev := event{f: f, done: make(chan callReturn, 1)} - defer close(ev.done) - if syscall.Gettid() == q.tid { - f(ev.done) - return <-ev.done - } - q.events <- ev - return <-ev.done -} diff --git a/vendor/github.com/status-im/status-go/eth-node/bridge/nimbus/whisper.go b/vendor/github.com/status-im/status-go/eth-node/bridge/nimbus/whisper.go deleted file mode 100644 index de241bf33..000000000 --- a/vendor/github.com/status-im/status-go/eth-node/bridge/nimbus/whisper.go +++ /dev/null @@ -1,431 +0,0 @@ -// +build nimbus - -package nimbusbridge - -// https://golang.org/cmd/cgo/ - -/* -#include -#include -#include -#include -void onMessageHandler_cgo(received_message* msg, void* udata); // Forward declaration. -*/ -import "C" - -import ( - "container/list" - "crypto/ecdsa" - "errors" - "fmt" - "sync" - "time" - "unsafe" - - gopointer "github.com/mattn/go-pointer" - - "github.com/status-im/status-go/eth-node/crypto" - "github.com/status-im/status-go/eth-node/types" -) - -type nimbusWhisperWrapper struct { - timesource func() time.Time - filters map[string]types.Filter - filterMessagesMu sync.Mutex - filterMessages map[string]*list.List - routineQueue *RoutineQueue -} - -// NewNimbusWhisperWrapper returns an object that wraps Nimbus' Whisper in a types interface -func NewNimbusWhisperWrapper(routineQueue *RoutineQueue) types.Whisper { - return &nimbusWhisperWrapper{ - timesource: func() time.Time { return time.Now() }, - filters: map[string]types.Filter{}, - filterMessages: map[string]*list.List{}, - routineQueue: routineQueue, - } -} - -func (w *nimbusWhisperWrapper) PublicWhisperAPI() types.PublicWhisperAPI { - return NewNimbusPublicWhisperAPIWrapper(&w.filterMessagesMu, &w.filterMessages, w.routineQueue) -} - -// MinPow returns the PoW value required by this node. -func (w *nimbusWhisperWrapper) MinPow() float64 { - return w.routineQueue.Send(func(c chan<- callReturn) { - c <- callReturn{value: float64(C.nimbus_get_min_pow())} - }).value.(float64) -} - -// BloomFilter returns the aggregated bloom filter for all the topics of interest. -// The nodes are required to send only messages that match the advertised bloom filter. -// If a message does not match the bloom, it will tantamount to spam, and the peer will -// be disconnected. -func (w *nimbusWhisperWrapper) BloomFilter() []byte { - return w.routineQueue.Send(func(c chan<- callReturn) { - // Allocate a buffer for Nimbus to return the bloom filter on - dataC := C.malloc(C.size_t(C.BLOOM_LEN)) - defer C.free(unsafe.Pointer(dataC)) - - C.nimbus_get_bloom_filter((*C.uchar)(dataC)) - - // Move the returned data into a Go array - data := make([]byte, C.BLOOM_LEN) - copy(data, C.GoBytes(dataC, C.BLOOM_LEN)) - c <- callReturn{value: data} - }).value.([]byte) -} - -// GetCurrentTime returns current time. -func (w *nimbusWhisperWrapper) GetCurrentTime() time.Time { - return w.timesource() -} - -// SetTimeSource assigns a particular source of time to a whisper object. -func (w *nimbusWhisperWrapper) SetTimeSource(timesource func() time.Time) { - w.timesource = timesource -} - -func (w *nimbusWhisperWrapper) SubscribeEnvelopeEvents(eventsProxy chan<- types.EnvelopeEvent) types.Subscription { - // TODO: when mailserver support is implemented - panic("not implemented") -} - -func (w *nimbusWhisperWrapper) GetPrivateKey(id string) (*ecdsa.PrivateKey, error) { - retVal := w.routineQueue.Send(func(c chan<- callReturn) { - idC, err := decodeHexID(id) - if err != nil { - c <- callReturn{err: err} - return - } - defer C.free(unsafe.Pointer(idC)) - privKeyC := C.malloc(types.AesKeyLength) - defer C.free(unsafe.Pointer(privKeyC)) - - if !C.nimbus_get_private_key(idC, (*C.uchar)(privKeyC)) { - c <- callReturn{err: errors.New("failed to get private key from Nimbus")} - return - } - - pk, err := crypto.ToECDSA(C.GoBytes(privKeyC, C.PRIVKEY_LEN)) - if err != nil { - c <- callReturn{err: err} - return - } - - c <- callReturn{value: pk} - }) - if retVal.err != nil { - return nil, retVal.err - } - - return retVal.value.(*ecdsa.PrivateKey), nil -} - -// AddKeyPair imports a asymmetric private key and returns a deterministic identifier. -func (w *nimbusWhisperWrapper) AddKeyPair(key *ecdsa.PrivateKey) (string, error) { - retVal := w.routineQueue.Send(func(c chan<- callReturn) { - privKey := crypto.FromECDSA(key) - privKeyC := C.CBytes(privKey) - defer C.free(unsafe.Pointer(privKeyC)) - - idC := C.malloc(C.size_t(C.ID_LEN)) - defer C.free(idC) - if !C.nimbus_add_keypair((*C.uchar)(privKeyC), (*C.uchar)(idC)) { - c <- callReturn{err: errors.New("failed to add keypair to Nimbus")} - return - } - - c <- callReturn{value: types.EncodeHex(C.GoBytes(idC, C.ID_LEN))} - }) - if retVal.err != nil { - return "", retVal.err - } - - return retVal.value.(string), nil -} - -// DeleteKeyPair deletes the key with the specified ID if it exists. -func (w *nimbusWhisperWrapper) DeleteKeyPair(keyID string) bool { - retVal := w.routineQueue.Send(func(c chan<- callReturn) { - keyC, err := decodeHexID(keyID) - if err != nil { - c <- callReturn{err: err} - return - } - defer C.free(unsafe.Pointer(keyC)) - - c <- callReturn{value: C.nimbus_delete_keypair(keyC)} - }) - if retVal.err != nil { - return false - } - - return retVal.value.(bool) -} - -// DeleteKeyPairs removes all cryptographic identities known to the node -func (w *nimbusWhisperWrapper) DeleteKeyPairs() error { - retVal := w.routineQueue.Send(func(c chan<- callReturn) { - C.nimbus_delete_keypairs() - c <- callReturn{} - }) - - return retVal.err -} - -func (w *nimbusWhisperWrapper) AddSymKeyDirect(key []byte) (string, error) { - retVal := w.routineQueue.Send(func(c chan<- callReturn) { - keyC := C.CBytes(key) - defer C.free(unsafe.Pointer(keyC)) - - idC := C.malloc(C.size_t(C.ID_LEN)) - defer C.free(idC) - if !C.nimbus_add_symkey((*C.uchar)(keyC), (*C.uchar)(idC)) { - c <- callReturn{err: errors.New("failed to add symkey to Nimbus")} - return - } - - c <- callReturn{value: types.EncodeHex(C.GoBytes(idC, C.ID_LEN))} - }) - if retVal.err != nil { - return "", retVal.err - } - - return retVal.value.(string), nil -} - -func (w *nimbusWhisperWrapper) AddSymKeyFromPassword(password string) (string, error) { - retVal := w.routineQueue.Send(func(c chan<- callReturn) { - passwordC := C.CString(password) - defer C.free(unsafe.Pointer(passwordC)) - - idC := C.malloc(C.size_t(C.ID_LEN)) - defer C.free(idC) - if C.nimbus_add_symkey_from_password(passwordC, (*C.uchar)(idC)) { - id := C.GoBytes(idC, C.ID_LEN) - c <- callReturn{value: types.EncodeHex(id)} - } else { - c <- callReturn{err: errors.New("failed to add symkey to Nimbus")} - } - }) - if retVal.err != nil { - return "", retVal.err - } - - return retVal.value.(string), nil -} - -func (w *nimbusWhisperWrapper) DeleteSymKey(id string) bool { - retVal := w.routineQueue.Send(func(c chan<- callReturn) { - idC, err := decodeHexID(id) - if err != nil { - c <- callReturn{err: err} - return - } - defer C.free(unsafe.Pointer(idC)) - - c <- callReturn{value: C.nimbus_delete_symkey(idC)} - }) - if retVal.err != nil { - return false - } - - return retVal.value.(bool) -} - -func (w *nimbusWhisperWrapper) GetSymKey(id string) ([]byte, error) { - retVal := w.routineQueue.Send(func(c chan<- callReturn) { - idC, err := decodeHexID(id) - if err != nil { - c <- callReturn{err: err} - return - } - defer C.free(unsafe.Pointer(idC)) - - // Allocate a buffer for Nimbus to return the symkey on - dataC := C.malloc(C.size_t(C.SYMKEY_LEN)) - defer C.free(unsafe.Pointer(dataC)) - if !C.nimbus_get_symkey(idC, (*C.uchar)(dataC)) { - c <- callReturn{err: errors.New("symkey not found")} - return - } - - c <- callReturn{value: C.GoBytes(dataC, C.SYMKEY_LEN)} - }) - if retVal.err != nil { - return nil, retVal.err - } - - return retVal.value.([]byte), nil -} - -//export onMessageHandler -func onMessageHandler(msg *C.received_message, udata unsafe.Pointer) { - messageList := (gopointer.Restore(udata)).(*list.List) - - topic := types.TopicType{} - copy(topic[:], C.GoBytes(unsafe.Pointer(&msg.topic[0]), types.TopicLength)[:types.TopicLength]) - wrappedMsg := &types.Message{ - TTL: uint32(msg.ttl), - Timestamp: uint32(msg.timestamp), - Topic: topic, - Payload: C.GoBytes(unsafe.Pointer(msg.decoded), C.int(msg.decodedLen)), - PoW: float64(msg.pow), - Hash: C.GoBytes(unsafe.Pointer(&msg.hash[0]), types.HashLength), - P2P: true, - } - if msg.source != nil { - wrappedMsg.Sig = append([]byte{0x04}, C.GoBytes(unsafe.Pointer(msg.source), types.PubKeyLength)...) - } - if msg.recipientPublicKey != nil { - wrappedMsg.Dst = append([]byte{0x04}, C.GoBytes(unsafe.Pointer(msg.recipientPublicKey), types.PubKeyLength)...) - } - - messageList.PushBack(wrappedMsg) -} - -func (w *nimbusWhisperWrapper) Subscribe(opts *types.SubscriptionOptions) (string, error) { - f, err := w.createFilterWrapper("", opts) - if err != nil { - return "", err - } - - retVal := w.routineQueue.Send(func(c chan<- callReturn) { - // Create a message store for this filter, so we can add new messages to it from the nimbus_subscribe_filter callback - messageList := list.New() - idC := C.malloc(C.size_t(C.ID_LEN)) - defer C.free(idC) - if !C.nimbus_subscribe_filter( - GetNimbusFilterFrom(f), - (C.received_msg_handler)(unsafe.Pointer(C.onMessageHandler_cgo)), gopointer.Save(messageList), - (*C.uchar)(idC)) { - c <- callReturn{err: errors.New("failed to subscribe to filter in Nimbus")} - return - } - filterID := C.GoString((*C.char)(idC)) - - w.filterMessagesMu.Lock() - w.filterMessages[filterID] = messageList // TODO: Check if this is done too late (race condition with onMessageHandler) - w.filterMessagesMu.Unlock() - - f.(*nimbusFilterWrapper).id = filterID - - c <- callReturn{value: filterID} - }) - if retVal.err != nil { - return "", retVal.err - } - - return retVal.value.(string), nil -} - -func (w *nimbusWhisperWrapper) GetFilter(id string) types.Filter { - idC := C.CString(id) - defer C.free(unsafe.Pointer(idC)) - - panic("GetFilter not implemented") - // pFilter := C.nimbus_get_filter(idC) - // return NewNimbusFilterWrapper(pFilter, id, false) -} - -func (w *nimbusWhisperWrapper) Unsubscribe(id string) error { - retVal := w.routineQueue.Send(func(c chan<- callReturn) { - idC, err := decodeHexID(id) - if err != nil { - c <- callReturn{err: err} - return - } - defer C.free(unsafe.Pointer(idC)) - - if ok := C.nimbus_unsubscribe_filter(idC); !ok { - c <- callReturn{err: errors.New("filter not found")} - return - } - - w.filterMessagesMu.Lock() - if messageList, ok := w.filterMessages[id]; ok { - gopointer.Unref(gopointer.Save(messageList)) - delete(w.filterMessages, id) - } - w.filterMessagesMu.Unlock() - - if f, ok := w.filters[id]; ok { - f.(*nimbusFilterWrapper).Free() - delete(w.filters, id) - } - - c <- callReturn{err: nil} - }) - return retVal.err -} - -func decodeHexID(id string) (*C.uint8_t, error) { - idBytes, err := types.DecodeHex(id) - if err == nil && len(idBytes) != C.ID_LEN { - err = fmt.Errorf("ID length must be %v bytes, actual length is %v", C.ID_LEN, len(idBytes)) - } - if err != nil { - return nil, err - } - - return (*C.uint8_t)(C.CBytes(idBytes)), nil -} - -// copyTopicToCBuffer copies a Go topic buffer to a C topic buffer without allocating new memory -func copyTopicToCBuffer(dst *C.uchar, topic []byte) { - if len(topic) != types.TopicLength { - panic("invalid Whisper topic buffer size") - } - - p := (*[types.TopicLength]C.uchar)(unsafe.Pointer(dst)) - for index, b := range topic { - p[index] = C.uchar(b) - } -} - -func (w *nimbusWhisperWrapper) createFilterWrapper(id string, opts *types.SubscriptionOptions) (types.Filter, error) { - if len(opts.Topics) != 1 { - return nil, errors.New("currently only 1 topic is supported by the Nimbus bridge") - } - - filter := C.filter_options{ - minPow: C.double(opts.PoW), - allowP2P: C.int(1), - } - copyTopicToCBuffer(&filter.topic[0], opts.Topics[0]) - if opts.PrivateKeyID != "" { - if idC, err := decodeHexID(opts.PrivateKeyID); err == nil { - filter.privateKeyID = idC - } else { - return nil, err - } - } - if opts.SymKeyID != "" { - if idC, err := decodeHexID(opts.SymKeyID); err == nil { - filter.symKeyID = idC - } else { - return nil, err - } - } - - return NewNimbusFilterWrapper(&filter, id, true), nil -} - -func (w *nimbusWhisperWrapper) SendMessagesRequest(peerID []byte, r types.MessagesRequest) error { - return errors.New("not implemented") -} - -// RequestHistoricMessages sends a message with p2pRequestCode to a specific peer, -// which is known to implement MailServer interface, and is supposed to process this -// request and respond with a number of peer-to-peer messages (possibly expired), -// which are not supposed to be forwarded any further. -// The whisper protocol is agnostic of the format and contents of envelope. -func (w *nimbusWhisperWrapper) RequestHistoricMessagesWithTimeout(peerID []byte, envelope types.Envelope, timeout time.Duration) error { - return errors.New("not implemented") -} - -// SyncMessages can be sent between two Mail Servers and syncs envelopes between them. -func (w *nimbusWhisperWrapper) SyncMessages(peerID []byte, req types.SyncMailRequest) error { - return errors.New("not implemented") -} diff --git a/vendor/github.com/status-im/status-go/eth-node/core/types/transaction.go b/vendor/github.com/status-im/status-go/eth-node/core/types/transaction.go deleted file mode 100644 index d6c3c5d83..000000000 --- a/vendor/github.com/status-im/status-go/eth-node/core/types/transaction.go +++ /dev/null @@ -1,48 +0,0 @@ -package types - -import ( - "math/big" - - "github.com/status-im/status-go/eth-node/types" -) - -type TransactionStatus uint64 - -const ( - TransactionStatusFailed = 0 - TransactionStatusSuccess = 1 - TransactionStatusPending = 2 -) - -type Message struct { - to *types.Address - from types.Address - nonce uint64 - amount *big.Int - gasLimit uint64 - gasPrice *big.Int - data []byte - checkNonce bool -} - -func NewMessage(from types.Address, to *types.Address, nonce uint64, amount *big.Int, gasLimit uint64, gasPrice *big.Int, data []byte, checkNonce bool) Message { - return Message{ - from: from, - to: to, - nonce: nonce, - amount: amount, - gasLimit: gasLimit, - gasPrice: gasPrice, - data: data, - checkNonce: checkNonce, - } -} - -func (m Message) From() types.Address { return m.from } -func (m Message) To() *types.Address { return m.to } -func (m Message) GasPrice() *big.Int { return m.gasPrice } -func (m Message) Value() *big.Int { return m.amount } -func (m Message) Gas() uint64 { return m.gasLimit } -func (m Message) Nonce() uint64 { return m.nonce } -func (m Message) Data() []byte { return m.data } -func (m Message) CheckNonce() bool { return m.checkNonce } diff --git a/vendor/github.com/status-im/status-go/eth-node/crypto/crypto.go b/vendor/github.com/status-im/status-go/eth-node/crypto/crypto.go deleted file mode 100644 index 3027be25c..000000000 --- a/vendor/github.com/status-im/status-go/eth-node/crypto/crypto.go +++ /dev/null @@ -1,252 +0,0 @@ -package crypto - -import ( - "context" - "crypto/aes" - "crypto/cipher" - "crypto/ecdsa" - "crypto/rand" - "encoding/hex" - "errors" - "fmt" - - "golang.org/x/crypto/sha3" - - types "github.com/status-im/status-go/eth-node/types" - - gethcrypto "github.com/ethereum/go-ethereum/crypto" -) - -const ( - aesNonceLength = 12 -) - -// Sign calculates an ECDSA signature. -// -// This function is susceptible to chosen plaintext attacks that can leak -// information about the private key that is used for signing. Callers must -// be aware that the given digest cannot be chosen by an adversery. Common -// solution is to hash any input before calculating the signature. -// -// The produced signature is in the [R || S || V] format where V is 0 or 1. -func Sign(digestHash []byte, prv *ecdsa.PrivateKey) (sig []byte, err error) { - return gethcrypto.Sign(digestHash, prv) -} - -// SignBytes signs the hash of arbitrary data. -func SignBytes(data []byte, prv *ecdsa.PrivateKey) (sig []byte, err error) { - return Sign(Keccak256(data), prv) -} - -// SignBytesAsHex signs the Keccak256 hash of arbitrary data and returns its hex representation. -func SignBytesAsHex(data []byte, identity *ecdsa.PrivateKey) (string, error) { - signature, err := SignBytes(data, identity) - if err != nil { - return "", err - } - return hex.EncodeToString(signature), nil -} - -// SignStringAsHex signs the Keccak256 hash of arbitrary string and returns its hex representation. -func SignStringAsHex(data string, identity *ecdsa.PrivateKey) (string, error) { - return SignBytesAsHex([]byte(data), identity) -} - -// VerifySignatures verifies tuples of signatures content/hash/public key -func VerifySignatures(signaturePairs [][3]string) error { - for _, signaturePair := range signaturePairs { - content := Keccak256([]byte(signaturePair[0])) - - signature, err := hex.DecodeString(signaturePair[1]) - if err != nil { - return err - } - - publicKeyBytes, err := hex.DecodeString(signaturePair[2]) - if err != nil { - return err - } - - publicKey, err := UnmarshalPubkey(publicKeyBytes) - if err != nil { - return err - } - - recoveredKey, err := SigToPub( - content, - signature, - ) - if err != nil { - return err - } - - if PubkeyToAddress(*recoveredKey) != PubkeyToAddress(*publicKey) { - return errors.New("identity key and signature mismatch") - } - } - - return nil -} - -// ExtractSignatures extract from tuples of signatures content a public key -// DEPRECATED: use ExtractSignature -func ExtractSignatures(signaturePairs [][2]string) ([]string, error) { - response := make([]string, len(signaturePairs)) - for i, signaturePair := range signaturePairs { - content := Keccak256([]byte(signaturePair[0])) - - signature, err := hex.DecodeString(signaturePair[1]) - if err != nil { - return nil, err - } - - recoveredKey, err := SigToPub( - content, - signature, - ) - if err != nil { - return nil, err - } - - response[i] = fmt.Sprintf("%x", FromECDSAPub(recoveredKey)) - } - - return response, nil -} - -// ExtractSignature returns a public key for a given data and signature. -func ExtractSignature(data, signature []byte) (*ecdsa.PublicKey, error) { - dataHash := Keccak256(data) - return SigToPub(dataHash, signature) -} - -func EncryptSymmetric(key, plaintext []byte) ([]byte, error) { - block, err := aes.NewCipher(key) - if err != nil { - return nil, err - } - - // Never use more than 2^32 random nonces with a given key because of the risk of a repeat. - salt, err := generateSecureRandomData(aesNonceLength) - if err != nil { - return nil, err - } - - aesgcm, err := cipher.NewGCM(block) - if err != nil { - return nil, err - } - - encrypted := aesgcm.Seal(nil, salt, plaintext, nil) - return append(encrypted, salt...), nil -} - -func DecryptSymmetric(key []byte, cyphertext []byte) ([]byte, error) { - // symmetric messages are expected to contain the 12-byte nonce at the end of the payload - if len(cyphertext) < aesNonceLength { - return nil, errors.New("missing salt or invalid payload in symmetric message") - } - salt := cyphertext[len(cyphertext)-aesNonceLength:] - - block, err := aes.NewCipher(key) - if err != nil { - return nil, err - } - aesgcm, err := cipher.NewGCM(block) - if err != nil { - return nil, err - } - decrypted, err := aesgcm.Open(nil, salt, cyphertext[:len(cyphertext)-aesNonceLength], nil) - if err != nil { - return nil, err - } - - return decrypted, nil -} - -func containsOnlyZeros(data []byte) bool { - for _, b := range data { - if b != 0 { - return false - } - } - return true -} - -func validateDataIntegrity(k []byte, expectedSize int) bool { - if len(k) != expectedSize { - return false - } - if containsOnlyZeros(k) { - return false - } - return true -} - -func generateSecureRandomData(length int) ([]byte, error) { - res := make([]byte, length) - - _, err := rand.Read(res) - if err != nil { - return nil, err - } - - if !validateDataIntegrity(res, length) { - return nil, errors.New("crypto/rand failed to generate secure random data") - } - - return res, nil -} - -// TextHash is a helper function that calculates a hash for the given message that can be -// safely used to calculate a signature from. -// -// The hash is calulcated as -// keccak256("\x19Ethereum Signed Message:\n"${message length}${message}). -// -// This gives context to the signed message and prevents signing of transactions. -func TextHash(data []byte) []byte { - hash, _ := TextAndHash(data) - return hash -} - -// TextAndHash is a helper function that calculates a hash for the given message that can be -// safely used to calculate a signature from. -// -// The hash is calulcated as -// keccak256("\x19Ethereum Signed Message:\n"${message length}${message}). -// -// This gives context to the signed message and prevents signing of transactions. -func TextAndHash(data []byte) ([]byte, string) { - msg := fmt.Sprintf("\x19Ethereum Signed Message:\n%d%s", len(data), string(data)) - hasher := sha3.NewLegacyKeccak256() - hasher.Write([]byte(msg)) - return hasher.Sum(nil), msg -} - -func EcRecover(ctx context.Context, data types.HexBytes, sig types.HexBytes) (types.Address, error) { - // Returns the address for the Account that was used to create the signature. - // - // Note, this function is compatible with eth_sign and personal_sign. As such it recovers - // the address of: - // hash = keccak256("\x19${byteVersion}Ethereum Signed Message:\n${message length}${message}") - // addr = ecrecover(hash, signature) - // - // Note, the signature must conform to the secp256k1 curve R, S and V values, where - // the V value must be be 27 or 28 for legacy reasons. - // - // https://github.com/ethereum/go-ethereum/wiki/Management-APIs#personal_ecRecover - if len(sig) != 65 { - return types.Address{}, fmt.Errorf("signature must be 65 bytes long") - } - if sig[64] != 27 && sig[64] != 28 { - return types.Address{}, fmt.Errorf("invalid Ethereum signature (V is not 27 or 28)") - } - sig[64] -= 27 // Transform yellow paper V from 27/28 to 0/1 - hash := TextHash(data) - rpk, err := SigToPub(hash, sig) - if err != nil { - return types.Address{}, err - } - return PubkeyToAddress(*rpk), nil -} diff --git a/vendor/github.com/status-im/status-go/eth-node/crypto/ecies/ecies.go b/vendor/github.com/status-im/status-go/eth-node/crypto/ecies/ecies.go deleted file mode 100644 index 147418148..000000000 --- a/vendor/github.com/status-im/status-go/eth-node/crypto/ecies/ecies.go +++ /dev/null @@ -1,366 +0,0 @@ -// Copyright (c) 2013 Kyle Isom -// Copyright (c) 2012 The Go Authors. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package ecies - -import ( - "crypto/cipher" - "crypto/ecdsa" - "crypto/elliptic" - "crypto/hmac" - "crypto/subtle" - "fmt" - "hash" - "io" - "math/big" -) - -var ( - ErrImport = fmt.Errorf("ecies: failed to import key") - ErrInvalidCurve = fmt.Errorf("ecies: invalid elliptic curve") - ErrInvalidParams = fmt.Errorf("ecies: invalid ECIES parameters") - ErrInvalidPublicKey = fmt.Errorf("ecies: invalid public key") - ErrSharedKeyIsPointAtInfinity = fmt.Errorf("ecies: shared key is point at infinity") - ErrSharedKeyTooBig = fmt.Errorf("ecies: shared key params are too big") -) - -// PublicKey is a representation of an elliptic curve public key. -type PublicKey struct { - X *big.Int - Y *big.Int - elliptic.Curve - Params *ECIESParams -} - -// Export an ECIES public key as an ECDSA public key. -func (pub *PublicKey) ExportECDSA() *ecdsa.PublicKey { - return &ecdsa.PublicKey{Curve: pub.Curve, X: pub.X, Y: pub.Y} -} - -// Import an ECDSA public key as an ECIES public key. -func ImportECDSAPublic(pub *ecdsa.PublicKey) *PublicKey { - return &PublicKey{ - X: pub.X, - Y: pub.Y, - Curve: pub.Curve, - Params: ParamsFromCurve(pub.Curve), - } -} - -// PrivateKey is a representation of an elliptic curve private key. -type PrivateKey struct { - PublicKey - D *big.Int -} - -// Export an ECIES private key as an ECDSA private key. -func (prv *PrivateKey) ExportECDSA() *ecdsa.PrivateKey { - pub := &prv.PublicKey - pubECDSA := pub.ExportECDSA() - return &ecdsa.PrivateKey{PublicKey: *pubECDSA, D: prv.D} -} - -// Import an ECDSA private key as an ECIES private key. -func ImportECDSA(prv *ecdsa.PrivateKey) *PrivateKey { - pub := ImportECDSAPublic(&prv.PublicKey) - return &PrivateKey{*pub, prv.D} -} - -// Generate an elliptic curve public / private keypair. If params is nil, -// the recommended default parameters for the key will be chosen. -func GenerateKey(rand io.Reader, curve elliptic.Curve, params *ECIESParams) (prv *PrivateKey, err error) { - pb, x, y, err := elliptic.GenerateKey(curve, rand) - if err != nil { - return - } - prv = new(PrivateKey) - prv.PublicKey.X = x - prv.PublicKey.Y = y - prv.PublicKey.Curve = curve - prv.D = new(big.Int).SetBytes(pb) - if params == nil { - params = ParamsFromCurve(curve) - } - prv.PublicKey.Params = params - return -} - -// MaxSharedKeyLength returns the maximum length of the shared key the -// public key can produce. -func MaxSharedKeyLength(pub *PublicKey) int { - return (pub.Curve.Params().BitSize + 7) / 8 -} - -// ECDH key agreement method used to establish secret keys for encryption. -func (prv *PrivateKey) GenerateShared(pub *PublicKey, skLen, macLen int) (sk []byte, err error) { - if prv.PublicKey.Curve != pub.Curve { - return nil, ErrInvalidCurve - } - if skLen+macLen > MaxSharedKeyLength(pub) { - return nil, ErrSharedKeyTooBig - } - - x, _ := pub.Curve.ScalarMult(pub.X, pub.Y, prv.D.Bytes()) - if x == nil { - return nil, ErrSharedKeyIsPointAtInfinity - } - - sk = make([]byte, skLen+macLen) - skBytes := x.Bytes() - copy(sk[len(sk)-len(skBytes):], skBytes) - return sk, nil -} - -var ( - ErrKeyDataTooLong = fmt.Errorf("ecies: can't supply requested key data") - ErrSharedTooLong = fmt.Errorf("ecies: shared secret is too long") - ErrInvalidMessage = fmt.Errorf("ecies: invalid message") -) - -var ( - big2To32 = new(big.Int).Exp(big.NewInt(2), big.NewInt(32), nil) - big2To32M1 = new(big.Int).Sub(big2To32, big.NewInt(1)) -) - -func incCounter(ctr []byte) { - if ctr[3]++; ctr[3] != 0 { - return - } - if ctr[2]++; ctr[2] != 0 { - return - } - if ctr[1]++; ctr[1] != 0 { - return - } - if ctr[0]++; ctr[0] != 0 { - return - } -} - -// NIST SP 800-56 Concatenation Key Derivation Function (see section 5.8.1). -func concatKDF(hash hash.Hash, z, s1 []byte, kdLen int) (k []byte, err error) { - if s1 == nil { - s1 = make([]byte, 0) - } - - reps := ((kdLen + 7) * 8) / (hash.BlockSize() * 8) - if big.NewInt(int64(reps)).Cmp(big2To32M1) > 0 { - fmt.Println(big2To32M1) - return nil, ErrKeyDataTooLong - } - - counter := []byte{0, 0, 0, 1} - k = make([]byte, 0) - - for i := 0; i <= reps; i++ { - hash.Write(counter) - hash.Write(z) - hash.Write(s1) - k = append(k, hash.Sum(nil)...) - hash.Reset() - incCounter(counter) - } - - k = k[:kdLen] - return -} - -// messageTag computes the MAC of a message (called the tag) as per -// SEC 1, 3.5. -func messageTag(hash func() hash.Hash, km, msg, shared []byte) []byte { - mac := hmac.New(hash, km) - mac.Write(msg) - mac.Write(shared) - tag := mac.Sum(nil) - return tag -} - -// Generate an initialisation vector for CTR mode. -func generateIV(params *ECIESParams, rand io.Reader) (iv []byte, err error) { - iv = make([]byte, params.BlockSize) - _, err = io.ReadFull(rand, iv) - return -} - -// symEncrypt carries out CTR encryption using the block cipher specified in the -// parameters. -func symEncrypt(rand io.Reader, params *ECIESParams, key, m []byte) (ct []byte, err error) { - c, err := params.Cipher(key) - if err != nil { - return - } - - iv, err := generateIV(params, rand) - if err != nil { - return - } - ctr := cipher.NewCTR(c, iv) - - ct = make([]byte, len(m)+params.BlockSize) - copy(ct, iv) - ctr.XORKeyStream(ct[params.BlockSize:], m) - return -} - -// symDecrypt carries out CTR decryption using the block cipher specified in -// the parameters -func symDecrypt(params *ECIESParams, key, ct []byte) (m []byte, err error) { - c, err := params.Cipher(key) - if err != nil { - return - } - - ctr := cipher.NewCTR(c, ct[:params.BlockSize]) - - m = make([]byte, len(ct)-params.BlockSize) - ctr.XORKeyStream(m, ct[params.BlockSize:]) - return -} - -// Encrypt encrypts a message using ECIES as specified in SEC 1, 5.1. -// -// s1 and s2 contain shared information that is not part of the resulting -// ciphertext. s1 is fed into key derivation, s2 is fed into the MAC. If the -// shared information parameters aren't being used, they should be nil. -func Encrypt(rand io.Reader, pub *PublicKey, m, s1, s2 []byte) (ct []byte, err error) { - params := pub.Params - if params == nil { - if params = ParamsFromCurve(pub.Curve); params == nil { - err = ErrUnsupportedECIESParameters - return - } - } - R, err := GenerateKey(rand, pub.Curve, params) - if err != nil { - return - } - - hash := params.Hash() - z, err := R.GenerateShared(pub, params.KeyLen, params.KeyLen) - if err != nil { - return - } - K, err := concatKDF(hash, z, s1, params.KeyLen+params.KeyLen) - if err != nil { - return - } - Ke := K[:params.KeyLen] - Km := K[params.KeyLen:] - hash.Write(Km) - Km = hash.Sum(nil) - hash.Reset() - - em, err := symEncrypt(rand, params, Ke, m) - if err != nil || len(em) <= params.BlockSize { - return - } - - d := messageTag(params.Hash, Km, em, s2) - - Rb := elliptic.Marshal(pub.Curve, R.PublicKey.X, R.PublicKey.Y) - ct = make([]byte, len(Rb)+len(em)+len(d)) - copy(ct, Rb) - copy(ct[len(Rb):], em) - copy(ct[len(Rb)+len(em):], d) - return -} - -// Decrypt decrypts an ECIES ciphertext. -func (prv *PrivateKey) Decrypt(c, s1, s2 []byte) (m []byte, err error) { - if len(c) == 0 { - return nil, ErrInvalidMessage - } - params := prv.PublicKey.Params - if params == nil { - if params = ParamsFromCurve(prv.PublicKey.Curve); params == nil { - err = ErrUnsupportedECIESParameters - return - } - } - hash := params.Hash() - - var ( - rLen int - hLen int = hash.Size() - mStart int - mEnd int - ) - - switch c[0] { - case 2, 3, 4: - rLen = (prv.PublicKey.Curve.Params().BitSize + 7) / 4 - if len(c) < (rLen + hLen + 1) { - err = ErrInvalidMessage - return - } - default: - err = ErrInvalidPublicKey - return - } - - mStart = rLen - mEnd = len(c) - hLen - - R := new(PublicKey) - R.Curve = prv.PublicKey.Curve - R.X, R.Y = elliptic.Unmarshal(R.Curve, c[:rLen]) - if R.X == nil { - err = ErrInvalidPublicKey - return - } - if !R.Curve.IsOnCurve(R.X, R.Y) { - err = ErrInvalidCurve - return - } - - z, err := prv.GenerateShared(R, params.KeyLen, params.KeyLen) - if err != nil { - return - } - - K, err := concatKDF(hash, z, s1, params.KeyLen+params.KeyLen) - if err != nil { - return - } - - Ke := K[:params.KeyLen] - Km := K[params.KeyLen:] - hash.Write(Km) - Km = hash.Sum(nil) - hash.Reset() - - d := messageTag(params.Hash, Km, c[mStart:mEnd], s2) - if subtle.ConstantTimeCompare(c[mEnd:], d) != 1 { - err = ErrInvalidMessage - return - } - - m, err = symDecrypt(params, Ke, c[mStart:mEnd]) - return -} diff --git a/vendor/github.com/status-im/status-go/eth-node/crypto/ecies/params.go b/vendor/github.com/status-im/status-go/eth-node/crypto/ecies/params.go deleted file mode 100644 index 23c409feb..000000000 --- a/vendor/github.com/status-im/status-go/eth-node/crypto/ecies/params.go +++ /dev/null @@ -1,117 +0,0 @@ -// Copyright (c) 2013 Kyle Isom -// Copyright (c) 2012 The Go Authors. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package ecies - -// This file contains parameters for ECIES encryption, specifying the -// symmetric encryption and HMAC parameters. - -import ( - "crypto" - "crypto/aes" - "crypto/cipher" - "crypto/elliptic" - "crypto/sha256" - "crypto/sha512" - "fmt" - "hash" - - gethcrypto "github.com/ethereum/go-ethereum/crypto" -) - -var ( - DefaultCurve = gethcrypto.S256() - ErrUnsupportedECDHAlgorithm = fmt.Errorf("ecies: unsupported ECDH algorithm") - ErrUnsupportedECIESParameters = fmt.Errorf("ecies: unsupported ECIES parameters") -) - -type ECIESParams struct { - Hash func() hash.Hash // hash function - hashAlgo crypto.Hash - Cipher func([]byte) (cipher.Block, error) // symmetric cipher - BlockSize int // block size of symmetric cipher - KeyLen int // length of symmetric key -} - -// Standard ECIES parameters: -// * ECIES using AES128 and HMAC-SHA-256-16 -// * ECIES using AES256 and HMAC-SHA-256-32 -// * ECIES using AES256 and HMAC-SHA-384-48 -// * ECIES using AES256 and HMAC-SHA-512-64 - -var ( - ECIES_AES128_SHA256 = &ECIESParams{ - Hash: sha256.New, - hashAlgo: crypto.SHA256, - Cipher: aes.NewCipher, - BlockSize: aes.BlockSize, - KeyLen: 16, - } - - ECIES_AES256_SHA256 = &ECIESParams{ - Hash: sha256.New, - hashAlgo: crypto.SHA256, - Cipher: aes.NewCipher, - BlockSize: aes.BlockSize, - KeyLen: 32, - } - - ECIES_AES256_SHA384 = &ECIESParams{ - Hash: sha512.New384, - hashAlgo: crypto.SHA384, - Cipher: aes.NewCipher, - BlockSize: aes.BlockSize, - KeyLen: 32, - } - - ECIES_AES256_SHA512 = &ECIESParams{ - Hash: sha512.New, - hashAlgo: crypto.SHA512, - Cipher: aes.NewCipher, - BlockSize: aes.BlockSize, - KeyLen: 32, - } -) - -var paramsFromCurve = map[elliptic.Curve]*ECIESParams{ - gethcrypto.S256(): ECIES_AES128_SHA256, - elliptic.P256(): ECIES_AES128_SHA256, - elliptic.P384(): ECIES_AES256_SHA384, - elliptic.P521(): ECIES_AES256_SHA512, -} - -func AddParamsForCurve(curve elliptic.Curve, params *ECIESParams) { - paramsFromCurve[curve] = params -} - -// ParamsFromCurve selects parameters optimal for the selected elliptic curve. -// Only the curves P256, P384, and P512 are supported. -func ParamsFromCurve(curve elliptic.Curve) (params *ECIESParams) { - return paramsFromCurve[curve] -} diff --git a/vendor/github.com/status-im/status-go/eth-node/crypto/ethereum_crypto.go b/vendor/github.com/status-im/status-go/eth-node/crypto/ethereum_crypto.go deleted file mode 100644 index f4007a4e4..000000000 --- a/vendor/github.com/status-im/status-go/eth-node/crypto/ethereum_crypto.go +++ /dev/null @@ -1,197 +0,0 @@ -package crypto - -import ( - "bytes" - "crypto/aes" - "crypto/cipher" - "crypto/hmac" - "crypto/sha256" - "fmt" - "io" - - dr "github.com/status-im/doubleratchet" - "golang.org/x/crypto/hkdf" - - "github.com/status-im/status-go/eth-node/crypto/ecies" -) - -// EthereumCrypto is an implementation of Crypto with cryptographic primitives recommended -// by the Double Ratchet Algorithm specification. However, some details are different, -// see function comments for details. -type EthereumCrypto struct{} - -// See the Crypto interface. -func (c EthereumCrypto) GenerateDH() (dr.DHPair, error) { - keys, err := GenerateKey() - if err != nil { - return nil, err - } - - return DHPair{ - PubKey: CompressPubkey(&keys.PublicKey), - PrvKey: FromECDSA(keys), - }, nil - -} - -// See the Crypto interface. -func (c EthereumCrypto) DH(dhPair dr.DHPair, dhPub dr.Key) (dr.Key, error) { - tmpKey := dhPair.PrivateKey() - privateKey, err := ToECDSA(tmpKey) - if err != nil { - return nil, err - } - - eciesPrivate := ecies.ImportECDSA(privateKey) - - publicKey, err := DecompressPubkey(dhPub) - if err != nil { - return nil, err - } - eciesPublic := ecies.ImportECDSAPublic(publicKey) - - key, err := eciesPrivate.GenerateShared( - eciesPublic, - 16, - 16, - ) - if err != nil { - return nil, err - } - - return key, nil -} - -// See the Crypto interface. -func (c EthereumCrypto) KdfRK(rk, dhOut dr.Key) (dr.Key, dr.Key, dr.Key) { - var ( - // We can use a non-secret constant as the last argument - r = hkdf.New(sha256.New, dhOut, rk, []byte("rsZUpEuXUqqwXBvSy3EcievAh4cMj6QL")) - buf = make([]byte, 96) - ) - - rootKey := make(dr.Key, 32) - chainKey := make(dr.Key, 32) - headerKey := make(dr.Key, 32) - - // The only error here is an entropy limit which won't be reached for such a short buffer. - _, _ = io.ReadFull(r, buf) - - copy(rootKey, buf[:32]) - copy(chainKey, buf[32:64]) - copy(headerKey, buf[64:96]) - return rootKey, chainKey, headerKey -} - -// See the Crypto interface. -func (c EthereumCrypto) KdfCK(ck dr.Key) (dr.Key, dr.Key) { - const ( - ckInput = 15 - mkInput = 16 - ) - - chainKey := make(dr.Key, 32) - msgKey := make(dr.Key, 32) - - h := hmac.New(sha256.New, ck) - - _, _ = h.Write([]byte{ckInput}) - copy(chainKey, h.Sum(nil)) - h.Reset() - - _, _ = h.Write([]byte{mkInput}) - copy(msgKey, h.Sum(nil)) - - return chainKey, msgKey -} - -// Encrypt uses a slightly different approach than in the algorithm specification: -// it uses AES-256-CTR instead of AES-256-CBC for security, ciphertext length and implementation -// complexity considerations. -func (c EthereumCrypto) Encrypt(mk dr.Key, plaintext, ad []byte) ([]byte, error) { - encKey, authKey, iv := c.deriveEncKeys(mk) - - ciphertext := make([]byte, aes.BlockSize+len(plaintext)) - copy(ciphertext, iv[:]) - - block, err := aes.NewCipher(encKey) - if err != nil { - return nil, err - } - - stream := cipher.NewCTR(block, iv[:]) - stream.XORKeyStream(ciphertext[aes.BlockSize:], plaintext) - - return append(ciphertext, c.computeSignature(authKey, ciphertext, ad)...), nil -} - -// See the Crypto interface. -func (c EthereumCrypto) Decrypt(mk dr.Key, authCiphertext, ad []byte) ([]byte, error) { - var ( - l = len(authCiphertext) - ciphertext = authCiphertext[:l-sha256.Size] - signature = authCiphertext[l-sha256.Size:] - ) - - // Check the signature. - encKey, authKey, _ := c.deriveEncKeys(mk) - - if s := c.computeSignature(authKey, ciphertext, ad); !bytes.Equal(s, signature) { - return nil, fmt.Errorf("invalid signature") - } - - // Decrypt. - block, err := aes.NewCipher(encKey) - if err != nil { - return nil, err - } - - stream := cipher.NewCTR(block, ciphertext[:aes.BlockSize]) - plaintext := make([]byte, len(ciphertext[aes.BlockSize:])) - - stream.XORKeyStream(plaintext, ciphertext[aes.BlockSize:]) - - return plaintext, nil -} - -// deriveEncKeys derive keys for message encryption and decryption. Returns (encKey, authKey, iv, err). -func (c EthereumCrypto) deriveEncKeys(mk dr.Key) (dr.Key, dr.Key, [16]byte) { - // First, derive encryption and authentication key out of mk. - salt := make([]byte, 32) - var ( - r = hkdf.New(sha256.New, mk, salt, []byte("pcwSByyx2CRdryCffXJwy7xgVZWtW5Sh")) - buf = make([]byte, 80) - ) - - encKey := make(dr.Key, 32) - authKey := make(dr.Key, 32) - var iv [16]byte - - // The only error here is an entropy limit which won't be reached for such a short buffer. - _, _ = io.ReadFull(r, buf) - - copy(encKey, buf[0:32]) - copy(authKey, buf[32:64]) - copy(iv[:], buf[64:80]) - return encKey, authKey, iv -} - -func (c EthereumCrypto) computeSignature(authKey, ciphertext, associatedData []byte) []byte { - h := hmac.New(sha256.New, authKey) - _, _ = h.Write(associatedData) - _, _ = h.Write(ciphertext) - return h.Sum(nil) -} - -type DHPair struct { - PrvKey dr.Key - PubKey dr.Key -} - -func (p DHPair) PrivateKey() dr.Key { - return p.PrvKey -} - -func (p DHPair) PublicKey() dr.Key { - return p.PubKey -} diff --git a/vendor/github.com/status-im/status-go/eth-node/crypto/gethcrypto.go b/vendor/github.com/status-im/status-go/eth-node/crypto/gethcrypto.go deleted file mode 100644 index f87982965..000000000 --- a/vendor/github.com/status-im/status-go/eth-node/crypto/gethcrypto.go +++ /dev/null @@ -1,244 +0,0 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. -// -// The go-ethereum library is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// The go-ethereum library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . - -package crypto - -import ( - "crypto/ecdsa" - "crypto/elliptic" - "crypto/rand" - "encoding/hex" - "errors" - "fmt" - "io" - "io/ioutil" - "math/big" - "os" - - "golang.org/x/crypto/sha3" - - "github.com/ethereum/go-ethereum/common/math" - "github.com/ethereum/go-ethereum/crypto/secp256k1" - "github.com/ethereum/go-ethereum/rlp" - - "github.com/status-im/status-go/eth-node/types" -) - -//SignatureLength indicates the byte length required to carry a signature with recovery id. -const SignatureLength = 64 + 1 // 64 bytes ECDSA signature + 1 byte recovery id - -// RecoveryIDOffset points to the byte offset within the signature that contains the recovery id. -const RecoveryIDOffset = 64 - -// DigestLength sets the signature digest exact length -const DigestLength = 32 - -var ( - secp256k1N, _ = new(big.Int).SetString("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141", 16) - secp256k1halfN = new(big.Int).Div(secp256k1N, big.NewInt(2)) -) - -var errInvalidPubkey = errors.New("invalid secp256k1 public key") - -// Keccak256 calculates and returns the Keccak256 hash of the input data. -func Keccak256(data ...[]byte) []byte { - d := sha3.NewLegacyKeccak256() - for _, b := range data { - d.Write(b) - } - return d.Sum(nil) -} - -// Keccak256Hash calculates and returns the Keccak256 hash of the input data, -// converting it to an internal Hash data structure. -func Keccak256Hash(data ...[]byte) (h types.Hash) { - d := sha3.NewLegacyKeccak256() - for _, b := range data { - d.Write(b) - } - d.Sum(h[:0]) - return h -} - -// Keccak512 calculates and returns the Keccak512 hash of the input data. -func Keccak512(data ...[]byte) []byte { - d := sha3.NewLegacyKeccak512() - for _, b := range data { - d.Write(b) - } - return d.Sum(nil) -} - -// CreateAddress creates an ethereum address given the bytes and the nonce -func CreateAddress(b types.Address, nonce uint64) types.Address { - data, _ := rlp.EncodeToBytes([]interface{}{b, nonce}) - return types.BytesToAddress(Keccak256(data)[12:]) -} - -// CreateAddress2 creates an ethereum address given the address bytes, initial -// contract code hash and a salt. -func CreateAddress2(b types.Address, salt [32]byte, inithash []byte) types.Address { - return types.BytesToAddress(Keccak256([]byte{0xff}, b.Bytes(), salt[:], inithash)[12:]) -} - -// ToECDSA creates a private key with the given D value. -func ToECDSA(d []byte) (*ecdsa.PrivateKey, error) { - return toECDSA(d, true) -} - -// ToECDSAUnsafe blindly converts a binary blob to a private key. It should almost -// never be used unless you are sure the input is valid and want to avoid hitting -// errors due to bad origin encoding (0 prefixes cut off). -func ToECDSAUnsafe(d []byte) *ecdsa.PrivateKey { - priv, _ := toECDSA(d, false) - return priv -} - -// toECDSA creates a private key with the given D value. The strict parameter -// controls whether the key's length should be enforced at the curve size or -// it can also accept legacy encodings (0 prefixes). -func toECDSA(d []byte, strict bool) (*ecdsa.PrivateKey, error) { - priv := new(ecdsa.PrivateKey) - priv.PublicKey.Curve = S256() - if strict && 8*len(d) != priv.Params().BitSize { - return nil, fmt.Errorf("invalid length, need %d bits", priv.Params().BitSize) - } - priv.D = new(big.Int).SetBytes(d) - - // The priv.D must < N - if priv.D.Cmp(secp256k1N) >= 0 { - return nil, fmt.Errorf("invalid private key, >=N") - } - // The priv.D must not be zero or negative. - if priv.D.Sign() <= 0 { - return nil, fmt.Errorf("invalid private key, zero or negative") - } - - priv.PublicKey.X, priv.PublicKey.Y = priv.PublicKey.Curve.ScalarBaseMult(d) - if priv.PublicKey.X == nil { - return nil, errors.New("invalid private key") - } - return priv, nil -} - -// FromECDSA exports a private key into a binary dump. -func FromECDSA(priv *ecdsa.PrivateKey) []byte { - if priv == nil { - return nil - } - return math.PaddedBigBytes(priv.D, priv.Params().BitSize/8) -} - -// UnmarshalPubkey converts bytes to a secp256k1 public key. -func UnmarshalPubkey(pub []byte) (*ecdsa.PublicKey, error) { - x, y := elliptic.Unmarshal(S256(), pub) - if x == nil { - return nil, errInvalidPubkey - } - return &ecdsa.PublicKey{Curve: S256(), X: x, Y: y}, nil -} - -func FromECDSAPub(pub *ecdsa.PublicKey) []byte { - if pub == nil || pub.X == nil || pub.Y == nil { - return nil - } - return elliptic.Marshal(S256(), pub.X, pub.Y) -} - -// HexToECDSA parses a secp256k1 private key. -func HexToECDSA(hexkey string) (*ecdsa.PrivateKey, error) { - b, err := hex.DecodeString(hexkey) - if err != nil { - return nil, errors.New("invalid hex string") - } - return ToECDSA(b) -} - -// LoadECDSA loads a secp256k1 private key from the given file. -func LoadECDSA(file string) (*ecdsa.PrivateKey, error) { - buf := make([]byte, 64) - fd, err := os.Open(file) - if err != nil { - return nil, err - } - defer fd.Close() - if _, err := io.ReadFull(fd, buf); err != nil { - return nil, err - } - - key, err := hex.DecodeString(string(buf)) - if err != nil { - return nil, err - } - return ToECDSA(key) -} - -// SaveECDSA saves a secp256k1 private key to the given file with -// restrictive permissions. The key data is saved hex-encoded. -func SaveECDSA(file string, key *ecdsa.PrivateKey) error { - k := hex.EncodeToString(FromECDSA(key)) - return ioutil.WriteFile(file, []byte(k), 0600) -} - -func GenerateKey() (*ecdsa.PrivateKey, error) { - return ecdsa.GenerateKey(S256(), rand.Reader) -} - -func PubkeyToAddress(p ecdsa.PublicKey) types.Address { - pubBytes := FromECDSAPub(&p) - return types.BytesToAddress(Keccak256(pubBytes[1:])[12:]) -} - -func zeroBytes(bytes []byte) { - for i := range bytes { - bytes[i] = 0 - } -} - -// Ecrecover returns the uncompressed public key that created the given signature. -func Ecrecover(hash, sig []byte) ([]byte, error) { - return secp256k1.RecoverPubkey(hash, sig) -} - -// SigToPub returns the public key that created the given signature. -func SigToPub(hash, sig []byte) (*ecdsa.PublicKey, error) { - s, err := Ecrecover(hash, sig) - if err != nil { - return nil, err - } - - x, y := elliptic.Unmarshal(S256(), s) - return &ecdsa.PublicKey{Curve: S256(), X: x, Y: y}, nil -} - -// DecompressPubkey parses a public key in the 33-byte compressed format. -func DecompressPubkey(pubkey []byte) (*ecdsa.PublicKey, error) { - x, y := secp256k1.DecompressPubkey(pubkey) - if x == nil { - return nil, fmt.Errorf("invalid public key") - } - return &ecdsa.PublicKey{X: x, Y: y, Curve: S256()}, nil -} - -// CompressPubkey encodes a public key to the 33-byte compressed format. -func CompressPubkey(pubkey *ecdsa.PublicKey) []byte { - return secp256k1.CompressPubkey(pubkey.X, pubkey.Y) -} - -// S256 returns an instance of the secp256k1 curve. -func S256() elliptic.Curve { - return secp256k1.S256() -} diff --git a/vendor/github.com/status-im/status-go/eth-node/keystore/keystore.go b/vendor/github.com/status-im/status-go/eth-node/keystore/keystore.go deleted file mode 100644 index 02a3a9e40..000000000 --- a/vendor/github.com/status-im/status-go/eth-node/keystore/keystore.go +++ /dev/null @@ -1,15 +0,0 @@ -// Imported from github.com/ethereum/go-ethereum/accounts/keystore/keystore.go - -package keystore - -import ( - "errors" -) - -const ( - version = 3 -) - -var ( - ErrDecrypt = errors.New("could not decrypt key with given password") -) diff --git a/vendor/github.com/status-im/status-go/eth-node/keystore/passphrase.go b/vendor/github.com/status-im/status-go/eth-node/keystore/passphrase.go deleted file mode 100644 index b13f546aa..000000000 --- a/vendor/github.com/status-im/status-go/eth-node/keystore/passphrase.go +++ /dev/null @@ -1,330 +0,0 @@ -// Imported from github.com/ethereum/go-ethereum/accounts/keystore/passphrase.go -// and github.com/ethereum/go-ethereum/accounts/keystore/presale.go - -package keystore - -import ( - "bytes" - "crypto/aes" - "crypto/cipher" - "crypto/sha256" - "encoding/hex" - "encoding/json" - "fmt" - - "github.com/pborman/uuid" - "golang.org/x/crypto/pbkdf2" - "golang.org/x/crypto/scrypt" - - "github.com/status-im/status-go/eth-node/crypto" - "github.com/status-im/status-go/eth-node/types" - "github.com/status-im/status-go/extkeys" -) - -const ( - keyHeaderKDF = "scrypt" -) - -type encryptedKeyJSONV3 struct { - Address string `json:"address"` - Crypto CryptoJSON `json:"crypto"` - Id string `json:"id"` - Version int `json:"version"` - ExtendedKey CryptoJSON `json:"extendedkey"` - SubAccountIndex uint32 `json:"subaccountindex"` -} - -type encryptedKeyJSONV1 struct { - Address string `json:"address"` - Crypto CryptoJSON `json:"crypto"` - Id string `json:"id"` - Version string `json:"version"` -} - -type CryptoJSON struct { - Cipher string `json:"cipher"` - CipherText string `json:"ciphertext"` - CipherParams cipherparamsJSON `json:"cipherparams"` - KDF string `json:"kdf"` - KDFParams map[string]interface{} `json:"kdfparams"` - MAC string `json:"mac"` -} - -type cipherparamsJSON struct { - IV string `json:"iv"` -} - -// DecryptKey decrypts a key from a json blob, returning the private key itself. -func DecryptKey(keyjson []byte, auth string) (*types.Key, error) { - // Parse the json into a simple map to fetch the key version - m := make(map[string]interface{}) - if err := json.Unmarshal(keyjson, &m); err != nil { - return nil, err - } - // Depending on the version try to parse one way or another - var ( - keyBytes, keyId []byte - err error - extKeyBytes []byte - extKey *extkeys.ExtendedKey - ) - - subAccountIndex, ok := m["subaccountindex"].(float64) - if !ok { - subAccountIndex = 0 - } - - if version, ok := m["version"].(string); ok && version == "1" { - k := new(encryptedKeyJSONV1) - if err := json.Unmarshal(keyjson, k); err != nil { - return nil, err - } - keyBytes, keyId, err = decryptKeyV1(k, auth) - if err != nil { - return nil, err - } - - extKey, err = extkeys.NewKeyFromString(extkeys.EmptyExtendedKeyString) - } else { - k := new(encryptedKeyJSONV3) - if err := json.Unmarshal(keyjson, k); err != nil { - return nil, err - } - keyBytes, keyId, err = decryptKeyV3(k, auth) - if err != nil { - return nil, err - } - - extKeyBytes, err = decryptExtendedKey(k, auth) - if err != nil { - return nil, err - } - extKey, err = extkeys.NewKeyFromString(string(extKeyBytes)) - } - // Handle any decryption errors and return the key - if err != nil { - return nil, err - } - key := crypto.ToECDSAUnsafe(keyBytes) - - return &types.Key{ - Id: uuid.UUID(keyId), - Address: crypto.PubkeyToAddress(key.PublicKey), - PrivateKey: key, - ExtendedKey: extKey, - SubAccountIndex: uint32(subAccountIndex), - }, nil -} - -func DecryptDataV3(cryptoJson CryptoJSON, auth string) ([]byte, error) { - if cryptoJson.Cipher != "aes-128-ctr" { - return nil, fmt.Errorf("Cipher not supported: %v", cryptoJson.Cipher) - } - mac, err := hex.DecodeString(cryptoJson.MAC) - if err != nil { - return nil, err - } - - iv, err := hex.DecodeString(cryptoJson.CipherParams.IV) - if err != nil { - return nil, err - } - - cipherText, err := hex.DecodeString(cryptoJson.CipherText) - if err != nil { - return nil, err - } - - derivedKey, err := getKDFKey(cryptoJson, auth) - if err != nil { - return nil, err - } - - calculatedMAC := crypto.Keccak256(derivedKey[16:32], cipherText) - if !bytes.Equal(calculatedMAC, mac) { - return nil, ErrDecrypt - } - - plainText, err := aesCTRXOR(derivedKey[:16], cipherText, iv) - if err != nil { - return nil, err - } - return plainText, err -} - -func decryptKeyV3(keyProtected *encryptedKeyJSONV3, auth string) (keyBytes []byte, keyId []byte, err error) { - if keyProtected.Version != version { - return nil, nil, fmt.Errorf("Version not supported: %v", keyProtected.Version) - } - keyId = uuid.Parse(keyProtected.Id) - plainText, err := DecryptDataV3(keyProtected.Crypto, auth) - if err != nil { - return nil, nil, err - } - return plainText, keyId, err -} - -func decryptKeyV1(keyProtected *encryptedKeyJSONV1, auth string) (keyBytes []byte, keyId []byte, err error) { - keyId = uuid.Parse(keyProtected.Id) - mac, err := hex.DecodeString(keyProtected.Crypto.MAC) - if err != nil { - return nil, nil, err - } - - iv, err := hex.DecodeString(keyProtected.Crypto.CipherParams.IV) - if err != nil { - return nil, nil, err - } - - cipherText, err := hex.DecodeString(keyProtected.Crypto.CipherText) - if err != nil { - return nil, nil, err - } - - derivedKey, err := getKDFKey(keyProtected.Crypto, auth) - if err != nil { - return nil, nil, err - } - - calculatedMAC := crypto.Keccak256(derivedKey[16:32], cipherText) - if !bytes.Equal(calculatedMAC, mac) { - return nil, nil, ErrDecrypt - } - - plainText, err := aesCBCDecrypt(crypto.Keccak256(derivedKey[:16])[:16], cipherText, iv) - if err != nil { - return nil, nil, err - } - return plainText, keyId, err -} - -func decryptExtendedKey(keyProtected *encryptedKeyJSONV3, auth string) (plainText []byte, err error) { - if len(keyProtected.ExtendedKey.CipherText) == 0 { - return []byte(extkeys.EmptyExtendedKeyString), nil - } - - if keyProtected.Version != version { - return nil, fmt.Errorf("Version not supported: %v", keyProtected.Version) - } - - if keyProtected.ExtendedKey.Cipher != "aes-128-ctr" { - return nil, fmt.Errorf("Cipher not supported: %v", keyProtected.ExtendedKey.Cipher) - } - - mac, err := hex.DecodeString(keyProtected.ExtendedKey.MAC) - if err != nil { - return nil, err - } - - iv, err := hex.DecodeString(keyProtected.ExtendedKey.CipherParams.IV) - if err != nil { - return nil, err - } - - cipherText, err := hex.DecodeString(keyProtected.ExtendedKey.CipherText) - if err != nil { - return nil, err - } - - derivedKey, err := getKDFKey(keyProtected.ExtendedKey, auth) - if err != nil { - return nil, err - } - - calculatedMAC := crypto.Keccak256(derivedKey[16:32], cipherText) - if !bytes.Equal(calculatedMAC, mac) { - return nil, ErrDecrypt - } - - plainText, err = aesCTRXOR(derivedKey[:16], cipherText, iv) - if err != nil { - return nil, err - } - return plainText, err -} - -func getKDFKey(cryptoJSON CryptoJSON, auth string) ([]byte, error) { - authArray := []byte(auth) - salt, err := hex.DecodeString(cryptoJSON.KDFParams["salt"].(string)) - if err != nil { - return nil, err - } - dkLen := ensureInt(cryptoJSON.KDFParams["dklen"]) - - if cryptoJSON.KDF == keyHeaderKDF { - n := ensureInt(cryptoJSON.KDFParams["n"]) - r := ensureInt(cryptoJSON.KDFParams["r"]) - p := ensureInt(cryptoJSON.KDFParams["p"]) - return scrypt.Key(authArray, salt, n, r, p, dkLen) - - } else if cryptoJSON.KDF == "pbkdf2" { - c := ensureInt(cryptoJSON.KDFParams["c"]) - prf := cryptoJSON.KDFParams["prf"].(string) - if prf != "hmac-sha256" { - return nil, fmt.Errorf("Unsupported PBKDF2 PRF: %s", prf) - } - key := pbkdf2.Key(authArray, salt, c, dkLen, sha256.New) - return key, nil - } - - return nil, fmt.Errorf("Unsupported KDF: %s", cryptoJSON.KDF) -} - -// TODO: can we do without this when unmarshalling dynamic JSON? -// why do integers in KDF params end up as float64 and not int after -// unmarshal? -func ensureInt(x interface{}) int { - res, ok := x.(int) - if !ok { - res = int(x.(float64)) - } - return res -} - -func aesCTRXOR(key, inText, iv []byte) ([]byte, error) { - // AES-128 is selected due to size of encryptKey. - aesBlock, err := aes.NewCipher(key) - if err != nil { - return nil, err - } - stream := cipher.NewCTR(aesBlock, iv) - outText := make([]byte, len(inText)) - stream.XORKeyStream(outText, inText) - return outText, err -} - -func aesCBCDecrypt(key, cipherText, iv []byte) ([]byte, error) { - aesBlock, err := aes.NewCipher(key) - if err != nil { - return nil, err - } - decrypter := cipher.NewCBCDecrypter(aesBlock, iv) - paddedPlaintext := make([]byte, len(cipherText)) - decrypter.CryptBlocks(paddedPlaintext, cipherText) - plaintext := pkcs7Unpad(paddedPlaintext) - if plaintext == nil { - return nil, ErrDecrypt - } - return plaintext, err -} - -// From https://leanpub.com/gocrypto/read#leanpub-auto-block-cipher-modes -func pkcs7Unpad(in []byte) []byte { - if len(in) == 0 { - return nil - } - - padding := in[len(in)-1] - if int(padding) > len(in) || padding > aes.BlockSize { - return nil - } else if padding == 0 { - return nil - } - - for i := len(in) - 1; i > len(in)-int(padding)-1; i-- { - if in[i] != padding { - return nil - } - } - return in[:len(in)-int(padding)] -} diff --git a/vendor/github.com/status-im/status-go/eth-node/types/account.go b/vendor/github.com/status-im/status-go/eth-node/types/account.go deleted file mode 100644 index 61795fe02..000000000 --- a/vendor/github.com/status-im/status-go/eth-node/types/account.go +++ /dev/null @@ -1,8 +0,0 @@ -package types - -// Account represents an Ethereum account located at a specific location defined -// by the optional URL field. -type Account struct { - Address Address `json:"address"` // Ethereum account address derived from the key - URL string `json:"url"` // Optional resource locator within a backend -} diff --git a/vendor/github.com/status-im/status-go/eth-node/types/address.go b/vendor/github.com/status-im/status-go/eth-node/types/address.go deleted file mode 100644 index aa5b20c80..000000000 --- a/vendor/github.com/status-im/status-go/eth-node/types/address.go +++ /dev/null @@ -1,219 +0,0 @@ -package types - -import ( - "database/sql/driver" - "encoding/hex" - "encoding/json" - "fmt" - "math/big" - "reflect" - "strings" - - "golang.org/x/crypto/sha3" -) - -/////////// Address - -// AddressLength is the expected length of the address -const AddressLength = 20 - -var ( - addressT = reflect.TypeOf(Address{}) -) - -// Address represents the 20 byte address of an Ethereum account. -type Address [AddressLength]byte - -// BytesToAddress returns Address with value b. -// If b is larger than len(h), b will be cropped from the left. -func BytesToAddress(b []byte) Address { - var a Address - a.SetBytes(b) - return a -} - -// BigToAddress returns Address with byte values of b. -// If b is larger than len(h), b will be cropped from the left. -func BigToAddress(b *big.Int) Address { return BytesToAddress(b.Bytes()) } - -// HexToAddress returns Address with byte values of s. -// If s is larger than len(h), s will be cropped from the left. -func HexToAddress(s string) Address { return BytesToAddress(FromHex(s)) } - -// IsHexAddress verifies whether a string can represent a valid hex-encoded -// Ethereum address or not. -func IsHexAddress(s string) bool { - if has0xPrefix(s) { - s = s[2:] - } - return len(s) == 2*AddressLength && isHex(s) -} - -// Bytes gets the string representation of the underlying address. -func (a Address) Bytes() []byte { return a[:] } - -// Hash converts an address to a hash by left-padding it with zeros. -func (a Address) Hash() Hash { return BytesToHash(a[:]) } - -// Hex returns an EIP55-compliant hex string representation of the address. -func (a Address) Hex() string { - unchecksummed := hex.EncodeToString(a[:]) - sha := sha3.NewLegacyKeccak256() - sha.Write([]byte(unchecksummed)) - hash := sha.Sum(nil) - - result := []byte(unchecksummed) - for i := 0; i < len(result); i++ { - hashByte := hash[i/2] - if i%2 == 0 { - hashByte = hashByte >> 4 - } else { - hashByte &= 0xf - } - if result[i] > '9' && hashByte > 7 { - result[i] -= 32 - } - } - return "0x" + string(result) -} - -// String implements fmt.Stringer. -func (a Address) String() string { - return a.Hex() -} - -// Format implements fmt.Formatter, forcing the byte slice to be formatted as is, -// without going through the stringer interface used for logging. -func (a Address) Format(s fmt.State, c rune) { - fmt.Fprintf(s, "%"+string(c), a[:]) -} - -// SetBytes sets the address to the value of b. -// If b is larger than len(a) it will panic. -func (a *Address) SetBytes(b []byte) { - if len(b) > len(a) { - b = b[len(b)-AddressLength:] - } - copy(a[AddressLength-len(b):], b) -} - -// MarshalText returns the hex representation of a. -func (a Address) MarshalText() ([]byte, error) { - return HexBytes(a[:]).MarshalText() -} - -// UnmarshalText parses a hash in hex syntax. -func (a *Address) UnmarshalText(input []byte) error { - return UnmarshalFixedText("Address", input, a[:]) -} - -// UnmarshalJSON parses a hash in hex syntax. -func (a *Address) UnmarshalJSON(input []byte) error { - return UnmarshalFixedJSON(addressT, input, a[:]) -} - -// Scan implements Scanner for database/sql. -func (a *Address) Scan(src interface{}) error { - srcB, ok := src.([]byte) - if !ok { - return fmt.Errorf("can't scan %T into Address", src) - } - if len(srcB) != AddressLength { - return fmt.Errorf("can't scan []byte of len %d into Address, want %d", len(srcB), AddressLength) - } - copy(a[:], srcB) - return nil -} - -// Value implements valuer for database/sql. -func (a Address) Value() (driver.Value, error) { - return a[:], nil -} - -// ImplementsGraphQLType returns true if Hash implements the specified GraphQL type. -func (a Address) ImplementsGraphQLType(name string) bool { return name == "Address" } - -// UnmarshalGraphQL unmarshals the provided GraphQL query data. -func (a *Address) UnmarshalGraphQL(input interface{}) error { - var err error - switch input := input.(type) { - case string: - err = a.UnmarshalText([]byte(input)) - default: - err = fmt.Errorf("Unexpected type for Address: %v", input) - } - return err -} - -// UnprefixedAddress allows marshaling an Address without 0x prefix. -type UnprefixedAddress Address - -// UnmarshalText decodes the address from hex. The 0x prefix is optional. -func (a *UnprefixedAddress) UnmarshalText(input []byte) error { - return UnmarshalFixedUnprefixedText("UnprefixedAddress", input, a[:]) -} - -// MarshalText encodes the address as hex. -func (a UnprefixedAddress) MarshalText() ([]byte, error) { - return []byte(hex.EncodeToString(a[:])), nil -} - -// MixedcaseAddress retains the original string, which may or may not be -// correctly checksummed -type MixedcaseAddress struct { - addr Address - original string -} - -// NewMixedcaseAddress constructor (mainly for testing) -func NewMixedcaseAddress(addr Address) MixedcaseAddress { - return MixedcaseAddress{addr: addr, original: addr.Hex()} -} - -// NewMixedcaseAddressFromString is mainly meant for unit-testing -func NewMixedcaseAddressFromString(hexaddr string) (*MixedcaseAddress, error) { - if !IsHexAddress(hexaddr) { - return nil, fmt.Errorf("Invalid address") - } - a := FromHex(hexaddr) - return &MixedcaseAddress{addr: BytesToAddress(a), original: hexaddr}, nil -} - -// UnmarshalJSON parses MixedcaseAddress -func (ma *MixedcaseAddress) UnmarshalJSON(input []byte) error { - if err := UnmarshalFixedJSON(addressT, input, ma.addr[:]); err != nil { - return err - } - return json.Unmarshal(input, &ma.original) -} - -// MarshalJSON marshals the original value -func (ma *MixedcaseAddress) MarshalJSON() ([]byte, error) { - if strings.HasPrefix(ma.original, "0x") || strings.HasPrefix(ma.original, "0X") { - return json.Marshal(fmt.Sprintf("0x%s", ma.original[2:])) - } - return json.Marshal(fmt.Sprintf("0x%s", ma.original)) -} - -// Address returns the address -func (ma *MixedcaseAddress) Address() Address { - return ma.addr -} - -// String implements fmt.Stringer -func (ma *MixedcaseAddress) String() string { - if ma.ValidChecksum() { - return fmt.Sprintf("%s [chksum ok]", ma.original) - } - return fmt.Sprintf("%s [chksum INVALID]", ma.original) -} - -// ValidChecksum returns true if the address has valid checksum -func (ma *MixedcaseAddress) ValidChecksum() bool { - return ma.original == ma.addr.Hex() -} - -// Original returns the mixed-case input string -func (ma *MixedcaseAddress) Original() string { - return ma.original -} diff --git a/vendor/github.com/status-im/status-go/eth-node/types/bytes.go b/vendor/github.com/status-im/status-go/eth-node/types/bytes.go deleted file mode 100644 index 1cb48afce..000000000 --- a/vendor/github.com/status-im/status-go/eth-node/types/bytes.go +++ /dev/null @@ -1,37 +0,0 @@ -package types - -import "encoding/hex" - -// has0xPrefix validates str begins with '0x' or '0X'. -func has0xPrefix(str string) bool { - return len(str) >= 2 && str[0] == '0' && (str[1] == 'x' || str[1] == 'X') -} - -// isHexCharacter returns bool of c being a valid hexadecimal. -func isHexCharacter(c byte) bool { - return ('0' <= c && c <= '9') || ('a' <= c && c <= 'f') || ('A' <= c && c <= 'F') -} - -// isHex validates whether each byte is valid hexadecimal string. -func isHex(str string) bool { - if len(str)%2 != 0 { - return false - } - for _, c := range []byte(str) { - if !isHexCharacter(c) { - return false - } - } - return true -} - -// Bytes2Hex returns the hexadecimal encoding of d. -func Bytes2Hex(d []byte) string { - return hex.EncodeToString(d) -} - -// Hex2Bytes returns the bytes represented by the hexadecimal string str. -func Hex2Bytes(str string) []byte { - h, _ := hex.DecodeString(str) - return h -} diff --git a/vendor/github.com/status-im/status-go/eth-node/types/const.go b/vendor/github.com/status-im/status-go/eth-node/types/const.go deleted file mode 100644 index 9e3148d0f..000000000 --- a/vendor/github.com/status-im/status-go/eth-node/types/const.go +++ /dev/null @@ -1,8 +0,0 @@ -package types - -const ( - // PubKeyLength represents the length (in bytes) of an uncompressed public key - PubKeyLength = 512 / 8 - // AesKeyLength represents the length (in bytes) of an private key - AesKeyLength = 256 / 8 -) diff --git a/vendor/github.com/status-im/status-go/eth-node/types/ens/ens.go b/vendor/github.com/status-im/status-go/eth-node/types/ens/ens.go deleted file mode 100644 index 4e0530d35..000000000 --- a/vendor/github.com/status-im/status-go/eth-node/types/ens/ens.go +++ /dev/null @@ -1,22 +0,0 @@ -package enstypes - -import "crypto/ecdsa" - -type ENSVerifier interface { - // CheckBatch verifies that a registered ENS name matches the expected public key - CheckBatch(ensDetails []ENSDetails, rpcEndpoint, contractAddress string) (map[string]ENSResponse, error) -} - -type ENSDetails struct { - Name string `json:"name"` - PublicKeyString string `json:"publicKey"` -} - -type ENSResponse struct { - Name string `json:"name"` - Verified bool `json:"verified"` - VerifiedAt int64 `json:"verifiedAt"` - Error error `json:"error"` - PublicKey *ecdsa.PublicKey `json:"-"` - PublicKeyString string `json:"publicKey"` -} diff --git a/vendor/github.com/status-im/status-go/eth-node/types/envelopes.go b/vendor/github.com/status-im/status-go/eth-node/types/envelopes.go deleted file mode 100644 index c9b8ead3c..000000000 --- a/vendor/github.com/status-im/status-go/eth-node/types/envelopes.go +++ /dev/null @@ -1,88 +0,0 @@ -package 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 { - Wrapped - - Hash() Hash // cached hash of the envelope to avoid rehashing every time - Bloom() []byte - PoW() float64 - Expiry() uint32 - TTL() uint32 - Topic() TopicType - Size() int -} - -// EventType used to define known envelope events. -type EventType string - -// NOTE: This list of event names is extracted from Geth. It must be kept in sync, or otherwise a mapping layer needs to be created -const ( - // EventEnvelopeSent fires when envelope was sent to a peer. - EventEnvelopeSent EventType = "envelope.sent" - // EventEnvelopeExpired fires when envelop expired - EventEnvelopeExpired EventType = "envelope.expired" - // EventEnvelopeReceived is sent once envelope was received from a peer. - // EventEnvelopeReceived must be sent to the feed even if envelope was previously in the cache. - // And event, ideally, should contain information about peer that sent envelope to us. - EventEnvelopeReceived EventType = "envelope.received" - // EventBatchAcknowledged is sent when batch of envelopes was acknowleged by a peer. - EventBatchAcknowledged EventType = "batch.acknowleged" - // EventEnvelopeAvailable fires when envelop is available for filters - EventEnvelopeAvailable EventType = "envelope.available" - // EventMailServerRequestSent fires when such request is sent. - EventMailServerRequestSent EventType = "mailserver.request.sent" - // EventMailServerRequestCompleted fires after mailserver sends all the requested messages - EventMailServerRequestCompleted EventType = "mailserver.request.completed" - // EventMailServerRequestExpired fires after mailserver the request TTL ends. - // This event is independent and concurrent to EventMailServerRequestCompleted. - // Request should be considered as expired only if expiry event was received first. - EventMailServerRequestExpired EventType = "mailserver.request.expired" - // EventMailServerEnvelopeArchived fires after an envelope has been archived - EventMailServerEnvelopeArchived EventType = "mailserver.envelope.archived" - // EventMailServerSyncFinished fires when the sync of messages is finished. - EventMailServerSyncFinished EventType = "mailserver.sync.finished" -) - -const ( - // EnvelopeTimeNotSynced represents the code passed to notify of a clock skew situation - EnvelopeTimeNotSynced uint = 1000 - // EnvelopeOtherError represents the code passed to notify of a generic error situation - EnvelopeOtherError -) - -// EnvelopeEvent used for envelopes events. -type EnvelopeEvent struct { - Event EventType - Hash Hash - Batch Hash - Peer EnodeID - Data interface{} -} - -// EnvelopeError code and optional description of the error. -type EnvelopeError struct { - Hash Hash - Code uint - Description string -} - -// Subscription represents a stream of events. The carrier of the events is typically a -// channel, but isn't part of the interface. -// -// Subscriptions can fail while established. Failures are reported through an error -// channel. It receives a value if there is an issue with the subscription (e.g. the -// network connection delivering the events has been closed). Only one value will ever be -// sent. -// -// The error channel is closed when the subscription ends successfully (i.e. when the -// source of events is closed). It is also closed when Unsubscribe is called. -// -// The Unsubscribe method cancels the sending of events. You must call Unsubscribe in all -// cases to ensure that resources related to the subscription are released. It can be -// called any number of times. -type Subscription interface { - Err() <-chan error // returns the error channel - Unsubscribe() // cancels sending of events, closing the error channel -} diff --git a/vendor/github.com/status-im/status-go/eth-node/types/filter.go b/vendor/github.com/status-im/status-go/eth-node/types/filter.go deleted file mode 100644 index b12cc54fa..000000000 --- a/vendor/github.com/status-im/status-go/eth-node/types/filter.go +++ /dev/null @@ -1,6 +0,0 @@ -package types - -// Filter represents a Whisper message filter -type Filter interface { - ID() string -} diff --git a/vendor/github.com/status-im/status-go/eth-node/types/hash.go b/vendor/github.com/status-im/status-go/eth-node/types/hash.go deleted file mode 100644 index 5c9d7c0e8..000000000 --- a/vendor/github.com/status-im/status-go/eth-node/types/hash.go +++ /dev/null @@ -1,119 +0,0 @@ -// Code extracted from vendor/github.com/ethereum/go-ethereum/common/types.go - -package types - -import ( - "encoding/hex" - "fmt" - "reflect" -) - -const ( - // HashLength is the expected length of the hash - HashLength = 32 -) - -// Hash represents the 32 byte Keccak256 hash of arbitrary data. -type Hash [HashLength]byte - -var hashT = reflect.TypeOf(Hash{}) - -// Encode encodes b as a hex string with 0x prefix. -func encode(b []byte) string { - enc := make([]byte, len(b)*2+2) - copy(enc, "0x") - hex.Encode(enc[2:], b) - return string(enc) -} - -// FromHex returns the bytes represented by the hexadecimal string s. -// s may be prefixed with "0x". -func FromHex(s string) []byte { - if has0xPrefix(s) { - s = s[2:] - } - if len(s)%2 == 1 { - s = "0" + s - } - return Hex2Bytes(s) -} - -// HexToHash sets byte representation of s to hash. -// If b is larger than len(h), b will be cropped from the left. -func HexToHash(s string) Hash { return BytesToHash(FromHex(s)) } - -// Hex converts a hash to a hex string. -func (h *Hash) Hex() string { return encode(h[:]) } - -// Bytes gets the byte representation of the underlying hash. -func (h Hash) Bytes() []byte { return h[:] } - -// String implements the stringer interface and is used also by the logger when -// doing full logging into a file. -func (h Hash) String() string { - return h.Hex() -} - -// SetBytes sets the hash to the value of b. -// If b is larger than len(h), b will be cropped from the left. -func (h *Hash) SetBytes(b []byte) { - if len(b) > len(h) { - b = b[len(b)-HashLength:] - } - - copy(h[HashLength-len(b):], b) -} - -// UnmarshalText parses a hash in hex syntax. -func (h *Hash) UnmarshalText(input []byte) error { - return UnmarshalFixedText("Hash", input, h[:]) -} - -// UnmarshalJSON parses a hash in hex syntax. -func (h *Hash) UnmarshalJSON(input []byte) error { - return UnmarshalFixedJSON(hashT, input, h[:]) -} - -// MarshalText returns the hex representation of h. -func (h Hash) MarshalText() ([]byte, error) { - return HexBytes(h[:]).MarshalText() -} - -// BytesToHash sets b to hash. -// If b is larger than len(h), b will be cropped from the left. -func BytesToHash(b []byte) Hash { - var h Hash - h.SetBytes(b) - return h -} - -// UnmarshalFixedJSON decodes the input as a string with 0x prefix. The length of out -// determines the required input length. This function is commonly used to implement the -// UnmarshalJSON method for fixed-size types. -func UnmarshalFixedJSON(typ reflect.Type, input, out []byte) error { - if !isString(input) { - return errNonString(typ) - } - return wrapTypeError(UnmarshalFixedText(typ.String(), input[1:len(input)-1], out), typ) -} - -// UnmarshalFixedText decodes the input as a string with 0x prefix. The length of out -// determines the required input length. This function is commonly used to implement the -// UnmarshalText method for fixed-size types. -func UnmarshalFixedText(typname string, input, out []byte) error { - raw, err := checkText(input, true) - if err != nil { - return err - } - if len(raw)/2 != len(out) { - return fmt.Errorf("hex string has length %d, want %d for %s", len(raw), len(out)*2, typname) - } - // Pre-verify syntax before modifying out. - for _, b := range raw { - if decodeNibble(b) == badNibble { - return ErrSyntax - } - } - _, err = hex.Decode(out, raw) - return err -} diff --git a/vendor/github.com/status-im/status-go/eth-node/types/hex.go b/vendor/github.com/status-im/status-go/eth-node/types/hex.go deleted file mode 100644 index fb8116be2..000000000 --- a/vendor/github.com/status-im/status-go/eth-node/types/hex.go +++ /dev/null @@ -1,54 +0,0 @@ -// Code extracted from vendor/github.com/ethereum/go-ethereum/common/hexutil/hexutil.go - -package types - -import ( - "encoding/hex" - "fmt" - "reflect" -) - -var ( - bytesT = reflect.TypeOf(HexBytes(nil)) -) - -// HexBytes marshals/unmarshals as a JSON string with 0x prefix. -// The empty slice marshals as "0x". -type HexBytes []byte - -// MarshalText implements encoding.TextMarshaler -func (b HexBytes) MarshalText() ([]byte, error) { - result := make([]byte, len(b)*2+2) - copy(result, `0x`) - hex.Encode(result[2:], b) - return result, nil -} - -// UnmarshalJSON implements json.Unmarshaler. -func (b *HexBytes) UnmarshalJSON(input []byte) error { - if !isString(input) { - return errNonString(bytesT) - } - return wrapTypeError(b.UnmarshalText(input[1:len(input)-1]), bytesT) -} - -// UnmarshalFixedUnprefixedText decodes the input as a string with optional 0x prefix. The -// length of out determines the required input length. This function is commonly used to -// implement the UnmarshalText method for fixed-size types. -func UnmarshalFixedUnprefixedText(typname string, input, out []byte) error { - raw, err := checkText(input, false) - if err != nil { - return err - } - if len(raw)/2 != len(out) { - return fmt.Errorf("hex string has length %d, want %d for %s", len(raw), len(out)*2, typname) - } - // Pre-verify syntax before modifying out. - for _, b := range raw { - if decodeNibble(b) == badNibble { - return ErrSyntax - } - } - hex.Decode(out, raw) - return nil -} diff --git a/vendor/github.com/status-im/status-go/eth-node/types/json.go b/vendor/github.com/status-im/status-go/eth-node/types/json.go deleted file mode 100644 index 43cfbc5e1..000000000 --- a/vendor/github.com/status-im/status-go/eth-node/types/json.go +++ /dev/null @@ -1,171 +0,0 @@ -// Code extracted from vendor/github.com/ethereum/go-ethereum/common/hexutil/json.go - -package types - -import ( - "encoding/hex" - "encoding/json" - "fmt" - "reflect" - "strconv" -) - -const ( - badNibble = ^uint64(0) - uintBits = 32 << (uint64(^uint(0)) >> 63) -) - -// Errors -var ( - ErrEmptyString = &decError{"empty hex string"} - ErrSyntax = &decError{"invalid hex string"} - ErrMissingPrefix = &decError{"hex string without 0x prefix"} - ErrOddLength = &decError{"hex string of odd length"} - ErrEmptyNumber = &decError{"hex string \"0x\""} - ErrLeadingZero = &decError{"hex number with leading zero digits"} - ErrUint64Range = &decError{"hex number > 64 bits"} - ErrUintRange = &decError{fmt.Sprintf("hex number > %d bits", uintBits)} - ErrBig256Range = &decError{"hex number > 256 bits"} -) - -type decError struct{ msg string } - -func (err decError) Error() string { return err.msg } - -func decodeNibble(in byte) uint64 { - switch { - case in >= '0' && in <= '9': - return uint64(in - '0') - case in >= 'A' && in <= 'F': - return uint64(in - 'A' + 10) - case in >= 'a' && in <= 'f': - return uint64(in - 'a' + 10) - default: - return badNibble - } -} - -// UnmarshalText implements encoding.TextUnmarshaler. -func (b *HexBytes) UnmarshalText(input []byte) error { - raw, err := checkText(input, true) - if err != nil { - return err - } - dec := make([]byte, len(raw)/2) - if _, err = hex.Decode(dec, raw); err != nil { - err = mapError(err) - } else { - *b = dec - } - return err -} - -// UnmarshalFixedHexText decodes the input as a string with 0x prefix. The length of out -// determines the required input length. This function is commonly used to implement the -// UnmarshalText method for fixed-size types. -func UnmarshalFixedHexText(typname string, input, out []byte) error { - raw, err := checkText(input, true) - if err != nil { - return err - } - if len(raw)/2 != len(out) { - return fmt.Errorf("hex string has length %d, want %d for %s", len(raw), len(out)*2, typname) - } - // Pre-verify syntax before modifying out. - for _, b := range raw { - if decodeNibble(b) == badNibble { - return ErrSyntax - } - } - _, err = hex.Decode(out, raw) - return err -} - -// String returns the hex encoding of b. -func (b HexBytes) String() string { - return EncodeHex(b) -} - -// EncodeHex encodes b as a hex string with 0x prefix. -func EncodeHex(b []byte) string { - enc := make([]byte, len(b)*2+2) - copy(enc, "0x") - hex.Encode(enc[2:], b) - return string(enc) -} - -// DecodeHex decodes a hex string with 0x prefix. -func DecodeHex(input string) ([]byte, error) { - if len(input) == 0 { - return nil, ErrEmptyString - } - if !has0xPrefix(input) { - return nil, ErrMissingPrefix - } - b, err := hex.DecodeString(input[2:]) - if err != nil { - err = mapError(err) - } - return b, err -} - -// MustDecodeHex decodes a hex string with 0x prefix. It panics for invalid input. -func MustDecodeHex(input string) []byte { - dec, err := DecodeHex(input) - if err != nil { - panic(err) - } - return dec -} - -func isString(input []byte) bool { - return len(input) >= 2 && input[0] == '"' && input[len(input)-1] == '"' -} - -func bytesHave0xPrefix(input []byte) bool { - return len(input) >= 2 && input[0] == '0' && (input[1] == 'x' || input[1] == 'X') -} - -func checkText(input []byte, wantPrefix bool) ([]byte, error) { - if len(input) == 0 { - return nil, nil // empty strings are allowed - } - if bytesHave0xPrefix(input) { - input = input[2:] - } else if wantPrefix { - return nil, ErrMissingPrefix - } - if len(input)%2 != 0 { - return nil, ErrOddLength - } - return input, nil -} - -func mapError(err error) error { - if err, ok := err.(*strconv.NumError); ok { - switch err.Err { - case strconv.ErrRange: - return ErrUint64Range - case strconv.ErrSyntax: - return ErrSyntax - } - } - if _, ok := err.(hex.InvalidByteError); ok { - return ErrSyntax - } - if err == hex.ErrLength { - return ErrOddLength - } - return err -} - -func wrapTypeError(err error, typ reflect.Type) error { - if _, ok := err.(*decError); ok { - return &json.UnmarshalTypeError{Value: err.Error(), Type: typ} - } - return err -} - -func errNonString(typ reflect.Type) error { - return &json.UnmarshalTypeError{Value: "non-string", Type: typ} -} diff --git a/vendor/github.com/status-im/status-go/eth-node/types/key.go b/vendor/github.com/status-im/status-go/eth-node/types/key.go deleted file mode 100644 index c0fded848..000000000 --- a/vendor/github.com/status-im/status-go/eth-node/types/key.go +++ /dev/null @@ -1,25 +0,0 @@ -package types - -import ( - "crypto/ecdsa" - - "github.com/pborman/uuid" - - "github.com/status-im/status-go/extkeys" -) - -type Key struct { - Id uuid.UUID // Version 4 "random" for unique id not derived from key data - // to simplify lookups we also store the address - Address Address - // we only store privkey as pubkey/address can be derived from it - // privkey in this struct is always in plaintext - PrivateKey *ecdsa.PrivateKey - // ExtendedKey is the extended key of the PrivateKey itself, and it's used - // to derive child keys. - ExtendedKey *extkeys.ExtendedKey - // SubAccountIndex is DEPRECATED - // It was use in Status to keep track of the number of sub-account created - // before having multi-account support. - SubAccountIndex uint32 -} diff --git a/vendor/github.com/status-im/status-go/eth-node/types/keystore.go b/vendor/github.com/status-im/status-go/eth-node/types/keystore.go deleted file mode 100644 index 1c491912c..000000000 --- a/vendor/github.com/status-im/status-go/eth-node/types/keystore.go +++ /dev/null @@ -1,26 +0,0 @@ -package types - -import ( - "crypto/ecdsa" - - "github.com/status-im/status-go/extkeys" -) - -type KeyStore interface { - // ImportAccount imports the account specified with privateKey. - ImportECDSA(priv *ecdsa.PrivateKey, passphrase string) (Account, error) - // ImportSingleExtendedKey imports an extended key setting it in both the PrivateKey and ExtendedKey fields - // of the Key struct. - // ImportExtendedKey is used in older version of Status where PrivateKey is set to be the BIP44 key at index 0, - // and ExtendedKey is the extended key of the BIP44 key at index 1. - ImportSingleExtendedKey(extKey *extkeys.ExtendedKey, passphrase string) (Account, error) - // ImportExtendedKeyForPurpose stores ECDSA key (obtained from extended key) along with CKD#2 (root for sub-accounts) - // If key file is not found, it is created. Key is encrypted with the given passphrase. - // Deprecated: status-go is now using ImportSingleExtendedKey - ImportExtendedKeyForPurpose(keyPurpose extkeys.KeyPurpose, extKey *extkeys.ExtendedKey, passphrase string) (Account, error) - // AccountDecryptedKey returns decrypted key for account (provided that password is correct). - AccountDecryptedKey(a Account, auth string) (Account, *Key, error) - // Delete deletes the key matched by account if the passphrase is correct. - // If the account contains no filename, the address must match a unique key. - Delete(a Account, auth string) error -} diff --git a/vendor/github.com/status-im/status-go/eth-node/types/mailserver.go b/vendor/github.com/status-im/status-go/eth-node/types/mailserver.go deleted file mode 100644 index c17dec62f..000000000 --- a/vendor/github.com/status-im/status-go/eth-node/types/mailserver.go +++ /dev/null @@ -1,75 +0,0 @@ -package types - -import ( - "time" -) - -const ( - // MaxLimitInMessagesRequest represents the maximum number of messages - // that can be requested from the mailserver - MaxLimitInMessagesRequest = 1000 -) - -// MessagesRequest contains details of a request of historic messages. -type MessagesRequest struct { - // ID of the request. The current implementation requires ID to be 32-byte array, - // however, it's not enforced for future implementation. - ID []byte `json:"id"` - // From is a lower bound of time range. - From uint32 `json:"from"` - // To is a upper bound of time range. - To uint32 `json:"to"` - // Limit determines the number of messages sent by the mail server - // for the current paginated request. - Limit uint32 `json:"limit"` - // Cursor is used as starting point for paginated requests. - Cursor []byte `json:"cursor"` - // Bloom is a filter to match requested messages. - Bloom []byte `json:"bloom"` -} - -// SetDefaults sets the From and To defaults -func (r *MessagesRequest) SetDefaults(now time.Time) { - // set From and To defaults - if r.To == 0 { - r.To = uint32(now.UTC().Unix()) - } - - if r.From == 0 { - oneDay := uint32(86400) // -24 hours - if r.To < oneDay { - r.From = 0 - } else { - r.From = r.To - oneDay - } - } -} - -// MailServerResponse is the response payload sent by the mailserver. -type MailServerResponse struct { - LastEnvelopeHash Hash - Cursor []byte - Error error -} - -// SyncMailRequest contains details which envelopes should be synced -// between Mail Servers. -type SyncMailRequest struct { - // Lower is a lower bound of time range for which messages are requested. - Lower uint32 - // Upper is a lower bound of time range for which messages are requested. - Upper uint32 - // Bloom is a bloom filter to filter envelopes. - Bloom []byte - // Limit is the max number of envelopes to return. - Limit uint32 - // Cursor is used for pagination of the results. - Cursor []byte -} - -// SyncEventResponse is a response from the Mail Server -// form which the peer received envelopes. -type SyncEventResponse struct { - Cursor []byte - Error string -} diff --git a/vendor/github.com/status-im/status-go/eth-node/types/negotiated_secret.go b/vendor/github.com/status-im/status-go/eth-node/types/negotiated_secret.go deleted file mode 100644 index 7abad04b2..000000000 --- a/vendor/github.com/status-im/status-go/eth-node/types/negotiated_secret.go +++ /dev/null @@ -1,11 +0,0 @@ -package types - -import ( - "crypto/ecdsa" -) - -// NegotiatedSecret represents a negotiated secret (both public and private keys) -type NegotiatedSecret struct { - PublicKey *ecdsa.PublicKey - Key []byte -} diff --git a/vendor/github.com/status-im/status-go/eth-node/types/node.go b/vendor/github.com/status-im/status-go/eth-node/types/node.go deleted file mode 100644 index 4c80c2cb8..000000000 --- a/vendor/github.com/status-im/status-go/eth-node/types/node.go +++ /dev/null @@ -1,25 +0,0 @@ -package types - -import ( - "fmt" - - "go.uber.org/zap" - - enstypes "github.com/status-im/status-go/eth-node/types/ens" -) - -// EnodeID is a unique identifier for each node. -type EnodeID [32]byte - -// ID prints as a long hexadecimal number. -func (n EnodeID) String() string { - return fmt.Sprintf("%x", n[:]) -} - -type Node interface { - NewENSVerifier(logger *zap.Logger) enstypes.ENSVerifier - GetWhisper(ctx interface{}) (Whisper, error) - GetWaku(ctx interface{}) (Waku, error) - AddPeer(url string) error - RemovePeer(url string) error -} diff --git a/vendor/github.com/status-im/status-go/eth-node/types/rpc.go b/vendor/github.com/status-im/status-go/eth-node/types/rpc.go deleted file mode 100644 index 3ee868804..000000000 --- a/vendor/github.com/status-im/status-go/eth-node/types/rpc.go +++ /dev/null @@ -1,87 +0,0 @@ -package types - -import ( - "context" -) - -// NewMessage represents a new whisper message that is posted through the RPC. -type NewMessage struct { - SymKeyID string `json:"symKeyID"` - PublicKey []byte `json:"pubKey"` - SigID string `json:"sig"` - TTL uint32 `json:"ttl"` - Topic TopicType `json:"topic"` - Payload []byte `json:"payload"` - Padding []byte `json:"padding"` - PowTime uint32 `json:"powTime"` - PowTarget float64 `json:"powTarget"` - TargetPeer string `json:"targetPeer"` -} - -// Message is the RPC representation of a whisper message. -type Message struct { - Sig []byte `json:"sig,omitempty"` - TTL uint32 `json:"ttl"` - Timestamp uint32 `json:"timestamp"` - Topic TopicType `json:"topic"` - Payload []byte `json:"payload"` - Padding []byte `json:"padding"` - PoW float64 `json:"pow"` - Hash []byte `json:"hash"` - Dst []byte `json:"recipientPublicKey,omitempty"` - P2P bool `json:"bool,omitempty"` -} - -// Criteria holds various filter options for inbound messages. -type Criteria struct { - SymKeyID string `json:"symKeyID"` - PrivateKeyID string `json:"privateKeyID"` - Sig []byte `json:"sig"` - MinPow float64 `json:"minPow"` - Topics []TopicType `json:"topics"` - AllowP2P bool `json:"allowP2P"` -} - -// PublicWhisperAPI provides the whisper RPC service that can be -// use publicly without security implications. -type PublicWhisperAPI interface { - // AddPrivateKey imports the given private key. - AddPrivateKey(ctx context.Context, privateKey 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. - DeleteKeyPair(ctx context.Context, key string) (bool, error) - - // Post posts a message on the Whisper network. - // returns the hash of the message in case of success. - Post(ctx context.Context, req NewMessage) ([]byte, error) - - // NewMessageFilter creates a new filter that can be used to poll for - // (new) messages that satisfy the given criteria. - NewMessageFilter(req Criteria) (string, error) - // GetFilterMessages returns the messages that match the filter criteria and - // are received between the last poll and now. - GetFilterMessages(id string) ([]*Message, error) -} - -// PublicWakuAPI provides the waku RPC service that can be -// use publicly without security implications. -type PublicWakuAPI interface { - // AddPrivateKey imports the given private key. - AddPrivateKey(ctx context.Context, privateKey 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. - DeleteKeyPair(ctx context.Context, key string) (bool, error) - - // Post posts a message on the Whisper network. - // returns the hash of the message in case of success. - Post(ctx context.Context, req NewMessage) ([]byte, error) - - // NewMessageFilter creates a new filter that can be used to poll for - // (new) messages that satisfy the given criteria. - NewMessageFilter(req Criteria) (string, error) - // GetFilterMessages returns the messages that match the filter criteria and - // are received between the last poll and now. - GetFilterMessages(id string) ([]*Message, error) -} diff --git a/vendor/github.com/status-im/status-go/eth-node/types/subscribe.go b/vendor/github.com/status-im/status-go/eth-node/types/subscribe.go deleted file mode 100644 index fbd347acc..000000000 --- a/vendor/github.com/status-im/status-go/eth-node/types/subscribe.go +++ /dev/null @@ -1,10 +0,0 @@ -package types - -// SubscriptionOptions represents the parameters passed to Subscribe() -// to customize the subscription behavior. -type SubscriptionOptions struct { - PrivateKeyID string - SymKeyID string - PoW float64 - Topics [][]byte -} diff --git a/vendor/github.com/status-im/status-go/eth-node/types/topic.go b/vendor/github.com/status-im/status-go/eth-node/types/topic.go deleted file mode 100644 index 0b1cbed93..000000000 --- a/vendor/github.com/status-im/status-go/eth-node/types/topic.go +++ /dev/null @@ -1,86 +0,0 @@ -package types - -const ( - // TopicLength is the expected length of the topic, in bytes - TopicLength = 4 - // BloomFilterSize is the expected length of a bloom filter byte array, in bytes - BloomFilterSize = 64 -) - -// TopicType represents a cryptographically secure, probabilistic partial -// classifications of a message, determined as the first (left) 4 bytes of the -// SHA3 hash of some arbitrary data given by the original author of the message. -type TopicType [TopicLength]byte - -// BytesToTopic converts from the byte array representation of a topic -// into the TopicType type. -func BytesToTopic(b []byte) (t TopicType) { - sz := TopicLength - if x := len(b); x < TopicLength { - sz = x - } - for i := 0; i < sz; i++ { - t[i] = b[i] - } - return t -} - -// String converts a topic byte array to a string representation. -func (t *TopicType) String() string { - return EncodeHex(t[:]) -} - -// MarshalText returns the hex representation of t. -func (t TopicType) MarshalText() ([]byte, error) { - return HexBytes(t[:]).MarshalText() -} - -// UnmarshalText parses a hex representation to a topic. -func (t *TopicType) UnmarshalText(input []byte) error { - return UnmarshalFixedText("Topic", input, t[:]) -} - -// TopicToBloom converts the topic (4 bytes) to the bloom filter (64 bytes) -func TopicToBloom(topic TopicType) []byte { - b := make([]byte, BloomFilterSize) - var index [3]int - for j := 0; j < 3; j++ { - index[j] = int(topic[j]) - if (topic[3] & (1 << uint(j))) != 0 { - index[j] += 256 - } - } - - for j := 0; j < 3; j++ { - byteIndex := index[j] / 8 - bitIndex := index[j] % 8 - b[byteIndex] = (1 << uint(bitIndex)) - } - return b -} - -// BloomFilterMatch returns true if a sample matches a bloom filter -func BloomFilterMatch(filter, sample []byte) bool { - if filter == nil { - return true - } - - for i := 0; i < BloomFilterSize; i++ { - f := filter[i] - s := sample[i] - if (f | s) != f { - return false - } - } - - return true -} - -// MakeFullNodeBloom returns a bloom filter which matches all topics -func MakeFullNodeBloom() []byte { - bloom := make([]byte, BloomFilterSize) - for i := 0; i < BloomFilterSize; i++ { - bloom[i] = 0xFF - } - return bloom -} diff --git a/vendor/github.com/status-im/status-go/eth-node/types/waku.go b/vendor/github.com/status-im/status-go/eth-node/types/waku.go deleted file mode 100644 index ce81c2cf3..000000000 --- a/vendor/github.com/status-im/status-go/eth-node/types/waku.go +++ /dev/null @@ -1,53 +0,0 @@ -package types - -import ( - "crypto/ecdsa" - "time" -) - -// Whisper represents a dark communication interface through the Ethereum -// network, using its very own P2P communication layer. -type Waku interface { - PublicWakuAPI() PublicWakuAPI - - // MinPow returns the PoW value required by this node. - MinPow() float64 - // BloomFilter returns the aggregated bloom filter for all the topics of interest. - // The nodes are required to send only messages that match the advertised bloom filter. - // If a message does not match the bloom, it will tantamount to spam, and the peer will - // be disconnected. - BloomFilter() []byte - // SetTimeSource assigns a particular source of time to a whisper object. - SetTimeSource(timesource func() time.Time) - // GetCurrentTime returns current time. - GetCurrentTime() time.Time - - // GetPrivateKey retrieves the private key of the specified identity. - GetPrivateKey(id string) (*ecdsa.PrivateKey, error) - - SubscribeEnvelopeEvents(events chan<- EnvelopeEvent) Subscription - - // AddKeyPair imports a asymmetric private key and returns a deterministic identifier. - AddKeyPair(key *ecdsa.PrivateKey) (string, error) - // DeleteKeyPair deletes the key with the specified ID if it exists. - DeleteKeyPair(keyID string) bool - AddSymKeyDirect(key []byte) (string, error) - AddSymKeyFromPassword(password string) (string, error) - DeleteSymKey(id string) bool - GetSymKey(id string) ([]byte, error) - - Subscribe(opts *SubscriptionOptions) (string, error) - GetFilter(id string) Filter - Unsubscribe(id string) error - - // RequestHistoricMessages sends a message with p2pRequestCode to a specific peer, - // which is known to implement MailServer interface, and is supposed to process this - // request and respond with a number of peer-to-peer messages (possibly expired), - // which are not supposed to be forwarded any further. - // The whisper protocol is agnostic of the format and contents of envelope. - // A timeout of 0 never expires. - RequestHistoricMessagesWithTimeout(peerID []byte, envelope Envelope, timeout time.Duration) error - // SendMessagesRequest sends a MessagesRequest. This is an equivalent to RequestHistoricMessages - // in terms of the functionality. - SendMessagesRequest(peerID []byte, request MessagesRequest) error -} diff --git a/vendor/github.com/status-im/status-go/eth-node/types/whisper.go b/vendor/github.com/status-im/status-go/eth-node/types/whisper.go deleted file mode 100644 index f3266bbab..000000000 --- a/vendor/github.com/status-im/status-go/eth-node/types/whisper.go +++ /dev/null @@ -1,57 +0,0 @@ -package types - -import ( - "crypto/ecdsa" - "time" -) - -// Whisper represents a dark communication interface through the Ethereum -// network, using its very own P2P communication layer. -type Whisper interface { - PublicWhisperAPI() PublicWhisperAPI - - // MinPow returns the PoW value required by this node. - MinPow() float64 - // BloomFilter returns the aggregated bloom filter for all the topics of interest. - // The nodes are required to send only messages that match the advertised bloom filter. - // If a message does not match the bloom, it will tantamount to spam, and the peer will - // be disconnected. - BloomFilter() []byte - // SetTimeSource assigns a particular source of time to a whisper object. - SetTimeSource(timesource func() time.Time) - // GetCurrentTime returns current time. - GetCurrentTime() time.Time - - // GetPrivateKey retrieves the private key of the specified identity. - GetPrivateKey(id string) (*ecdsa.PrivateKey, error) - - SubscribeEnvelopeEvents(events chan<- EnvelopeEvent) Subscription - - // AddKeyPair imports a asymmetric private key and returns a deterministic identifier. - AddKeyPair(key *ecdsa.PrivateKey) (string, error) - // DeleteKeyPair deletes the key with the specified ID if it exists. - DeleteKeyPair(keyID string) bool - // DeleteKeyPairs removes all cryptographic identities known to the node - DeleteKeyPairs() error - AddSymKeyDirect(key []byte) (string, error) - AddSymKeyFromPassword(password string) (string, error) - DeleteSymKey(id string) bool - GetSymKey(id string) ([]byte, error) - - Subscribe(opts *SubscriptionOptions) (string, error) - GetFilter(id string) Filter - Unsubscribe(id string) error - - // RequestHistoricMessages sends a message with p2pRequestCode to a specific peer, - // which is known to implement MailServer interface, and is supposed to process this - // request and respond with a number of peer-to-peer messages (possibly expired), - // which are not supposed to be forwarded any further. - // The whisper protocol is agnostic of the format and contents of envelope. - // A timeout of 0 never expires. - RequestHistoricMessagesWithTimeout(peerID []byte, envelope Envelope, timeout time.Duration) error - // SendMessagesRequest sends a MessagesRequest. This is an equivalent to RequestHistoricMessages - // in terms of the functionality. - SendMessagesRequest(peerID []byte, request MessagesRequest) error - // SyncMessages can be sent between two Mail Servers and syncs envelopes between them. - SyncMessages(peerID []byte, req SyncMailRequest) error -} diff --git a/vendor/github.com/status-im/status-go/eth-node/types/wrapped.go b/vendor/github.com/status-im/status-go/eth-node/types/wrapped.go deleted file mode 100644 index c68d9a650..000000000 --- a/vendor/github.com/status-im/status-go/eth-node/types/wrapped.go +++ /dev/null @@ -1,7 +0,0 @@ -package types - -// Wrapped tells that a given object has an underlying representation -// and this representation can be accessed using `Unwrap` method. -type Wrapped interface { - Unwrap() interface{} -} diff --git a/vendor/github.com/status-im/status-go/protocol/LICENSE b/vendor/github.com/status-im/status-go/protocol/LICENSE deleted file mode 100644 index a612ad981..000000000 --- a/vendor/github.com/status-im/status-go/protocol/LICENSE +++ /dev/null @@ -1,373 +0,0 @@ -Mozilla Public License Version 2.0 -================================== - -1. Definitions --------------- - -1.1. "Contributor" - means each individual or legal entity that creates, contributes to - the creation of, or owns Covered Software. - -1.2. "Contributor Version" - means the combination of the Contributions of others (if any) used - by a Contributor and that particular Contributor's Contribution. - -1.3. "Contribution" - means Covered Software of a particular Contributor. - -1.4. "Covered Software" - means Source Code Form to which the initial Contributor has attached - the notice in Exhibit A, the Executable Form of such Source Code - Form, and Modifications of such Source Code Form, in each case - including portions thereof. - -1.5. "Incompatible With Secondary Licenses" - means - - (a) that the initial Contributor has attached the notice described - in Exhibit B to the Covered Software; or - - (b) that the Covered Software was made available under the terms of - version 1.1 or earlier of the License, but not also under the - terms of a Secondary License. - -1.6. "Executable Form" - means any form of the work other than Source Code Form. - -1.7. "Larger Work" - means a work that combines Covered Software with other material, in - a separate file or files, that is not Covered Software. - -1.8. "License" - means this document. - -1.9. "Licensable" - means having the right to grant, to the maximum extent possible, - whether at the time of the initial grant or subsequently, any and - all of the rights conveyed by this License. - -1.10. "Modifications" - means any of the following: - - (a) any file in Source Code Form that results from an addition to, - deletion from, or modification of the contents of Covered - Software; or - - (b) any new file in Source Code Form that contains any Covered - Software. - -1.11. "Patent Claims" of a Contributor - means any patent claim(s), including without limitation, method, - process, and apparatus claims, in any patent Licensable by such - Contributor that would be infringed, but for the grant of the - License, by the making, using, selling, offering for sale, having - made, import, or transfer of either its Contributions or its - Contributor Version. - -1.12. "Secondary License" - means either the GNU General Public License, Version 2.0, the GNU - Lesser General Public License, Version 2.1, the GNU Affero General - Public License, Version 3.0, or any later versions of those - licenses. - -1.13. "Source Code Form" - means the form of the work preferred for making modifications. - -1.14. "You" (or "Your") - means an individual or a legal entity exercising rights under this - License. For legal entities, "You" includes any entity that - controls, is controlled by, or is under common control with You. For - purposes of this definition, "control" means (a) the power, direct - or indirect, to cause the direction or management of such entity, - whether by contract or otherwise, or (b) ownership of more than - fifty percent (50%) of the outstanding shares or beneficial - ownership of such entity. - -2. License Grants and Conditions --------------------------------- - -2.1. Grants - -Each Contributor hereby grants You a world-wide, royalty-free, -non-exclusive license: - -(a) under intellectual property rights (other than patent or trademark) - Licensable by such Contributor to use, reproduce, make available, - modify, display, perform, distribute, and otherwise exploit its - Contributions, either on an unmodified basis, with Modifications, or - as part of a Larger Work; and - -(b) under Patent Claims of such Contributor to make, use, sell, offer - for sale, have made, import, and otherwise transfer either its - Contributions or its Contributor Version. - -2.2. Effective Date - -The licenses granted in Section 2.1 with respect to any Contribution -become effective for each Contribution on the date the Contributor first -distributes such Contribution. - -2.3. Limitations on Grant Scope - -The licenses granted in this Section 2 are the only rights granted under -this License. No additional rights or licenses will be implied from the -distribution or licensing of Covered Software under this License. -Notwithstanding Section 2.1(b) above, no patent license is granted by a -Contributor: - -(a) for any code that a Contributor has removed from Covered Software; - or - -(b) for infringements caused by: (i) Your and any other third party's - modifications of Covered Software, or (ii) the combination of its - Contributions with other software (except as part of its Contributor - Version); or - -(c) under Patent Claims infringed by Covered Software in the absence of - its Contributions. - -This License does not grant any rights in the trademarks, service marks, -or logos of any Contributor (except as may be necessary to comply with -the notice requirements in Section 3.4). - -2.4. Subsequent Licenses - -No Contributor makes additional grants as a result of Your choice to -distribute the Covered Software under a subsequent version of this -License (see Section 10.2) or under the terms of a Secondary License (if -permitted under the terms of Section 3.3). - -2.5. Representation - -Each Contributor represents that the Contributor believes its -Contributions are its original creation(s) or it has sufficient rights -to grant the rights to its Contributions conveyed by this License. - -2.6. Fair Use - -This License is not intended to limit any rights You have under -applicable copyright doctrines of fair use, fair dealing, or other -equivalents. - -2.7. Conditions - -Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted -in Section 2.1. - -3. Responsibilities -------------------- - -3.1. Distribution of Source Form - -All distribution of Covered Software in Source Code Form, including any -Modifications that You create or to which You contribute, must be under -the terms of this License. You must inform recipients that the Source -Code Form of the Covered Software is governed by the terms of this -License, and how they can obtain a copy of this License. You may not -attempt to alter or restrict the recipients' rights in the Source Code -Form. - -3.2. Distribution of Executable Form - -If You distribute Covered Software in Executable Form then: - -(a) such Covered Software must also be made available in Source Code - Form, as described in Section 3.1, and You must inform recipients of - the Executable Form how they can obtain a copy of such Source Code - Form by reasonable means in a timely manner, at a charge no more - than the cost of distribution to the recipient; and - -(b) You may distribute such Executable Form under the terms of this - License, or sublicense it under different terms, provided that the - license for the Executable Form does not attempt to limit or alter - the recipients' rights in the Source Code Form under this License. - -3.3. Distribution of a Larger Work - -You may create and distribute a Larger Work under terms of Your choice, -provided that You also comply with the requirements of this License for -the Covered Software. If the Larger Work is a combination of Covered -Software with a work governed by one or more Secondary Licenses, and the -Covered Software is not Incompatible With Secondary Licenses, this -License permits You to additionally distribute such Covered Software -under the terms of such Secondary License(s), so that the recipient of -the Larger Work may, at their option, further distribute the Covered -Software under the terms of either this License or such Secondary -License(s). - -3.4. Notices - -You may not remove or alter the substance of any license notices -(including copyright notices, patent notices, disclaimers of warranty, -or limitations of liability) contained within the Source Code Form of -the Covered Software, except that You may alter any license notices to -the extent required to remedy known factual inaccuracies. - -3.5. Application of Additional Terms - -You may choose to offer, and to charge a fee for, warranty, support, -indemnity or liability obligations to one or more recipients of Covered -Software. However, You may do so only on Your own behalf, and not on -behalf of any Contributor. You must make it absolutely clear that any -such warranty, support, indemnity, or liability obligation is offered by -You alone, and You hereby agree to indemnify every Contributor for any -liability incurred by such Contributor as a result of warranty, support, -indemnity or liability terms You offer. You may include additional -disclaimers of warranty and limitations of liability specific to any -jurisdiction. - -4. Inability to Comply Due to Statute or Regulation ---------------------------------------------------- - -If it is impossible for You to comply with any of the terms of this -License with respect to some or all of the Covered Software due to -statute, judicial order, or regulation then You must: (a) comply with -the terms of this License to the maximum extent possible; and (b) -describe the limitations and the code they affect. Such description must -be placed in a text file included with all distributions of the Covered -Software under this License. Except to the extent prohibited by statute -or regulation, such description must be sufficiently detailed for a -recipient of ordinary skill to be able to understand it. - -5. Termination --------------- - -5.1. The rights granted under this License will terminate automatically -if You fail to comply with any of its terms. However, if You become -compliant, then the rights granted under this License from a particular -Contributor are reinstated (a) provisionally, unless and until such -Contributor explicitly and finally terminates Your grants, and (b) on an -ongoing basis, if such Contributor fails to notify You of the -non-compliance by some reasonable means prior to 60 days after You have -come back into compliance. Moreover, Your grants from a particular -Contributor are reinstated on an ongoing basis if such Contributor -notifies You of the non-compliance by some reasonable means, this is the -first time You have received notice of non-compliance with this License -from such Contributor, and You become compliant prior to 30 days after -Your receipt of the notice. - -5.2. If You initiate litigation against any entity by asserting a patent -infringement claim (excluding declaratory judgment actions, -counter-claims, and cross-claims) alleging that a Contributor Version -directly or indirectly infringes any patent, then the rights granted to -You by any and all Contributors for the Covered Software under Section -2.1 of this License shall terminate. - -5.3. In the event of termination under Sections 5.1 or 5.2 above, all -end user license agreements (excluding distributors and resellers) which -have been validly granted by You or Your distributors under this License -prior to termination shall survive termination. - -************************************************************************ -* * -* 6. Disclaimer of Warranty * -* ------------------------- * -* * -* Covered Software is provided under this License on an "as is" * -* basis, without warranty of any kind, either expressed, implied, or * -* statutory, including, without limitation, warranties that the * -* Covered Software is free of defects, merchantable, fit for a * -* particular purpose or non-infringing. The entire risk as to the * -* quality and performance of the Covered Software is with You. * -* Should any Covered Software prove defective in any respect, You * -* (not any Contributor) assume the cost of any necessary servicing, * -* repair, or correction. This disclaimer of warranty constitutes an * -* essential part of this License. No use of any Covered Software is * -* authorized under this License except under this disclaimer. * -* * -************************************************************************ - -************************************************************************ -* * -* 7. Limitation of Liability * -* -------------------------- * -* * -* Under no circumstances and under no legal theory, whether tort * -* (including negligence), contract, or otherwise, shall any * -* Contributor, or anyone who distributes Covered Software as * -* permitted above, be liable to You for any direct, indirect, * -* special, incidental, or consequential damages of any character * -* including, without limitation, damages for lost profits, loss of * -* goodwill, work stoppage, computer failure or malfunction, or any * -* and all other commercial damages or losses, even if such party * -* shall have been informed of the possibility of such damages. This * -* limitation of liability shall not apply to liability for death or * -* personal injury resulting from such party's negligence to the * -* extent applicable law prohibits such limitation. Some * -* jurisdictions do not allow the exclusion or limitation of * -* incidental or consequential damages, so this exclusion and * -* limitation may not apply to You. * -* * -************************************************************************ - -8. Litigation -------------- - -Any litigation relating to this License may be brought only in the -courts of a jurisdiction where the defendant maintains its principal -place of business and such litigation shall be governed by laws of that -jurisdiction, without reference to its conflict-of-law provisions. -Nothing in this Section shall prevent a party's ability to bring -cross-claims or counter-claims. - -9. Miscellaneous ----------------- - -This License represents the complete agreement concerning the subject -matter hereof. If any provision of this License is held to be -unenforceable, such provision shall be reformed only to the extent -necessary to make it enforceable. Any law or regulation which provides -that the language of a contract shall be construed against the drafter -shall not be used to construe this License against a Contributor. - -10. Versions of the License ---------------------------- - -10.1. New Versions - -Mozilla Foundation is the license steward. Except as provided in Section -10.3, no one other than the license steward has the right to modify or -publish new versions of this License. Each version will be given a -distinguishing version number. - -10.2. Effect of New Versions - -You may distribute the Covered Software under the terms of the version -of the License under which You originally received the Covered Software, -or under the terms of any subsequent version published by the license -steward. - -10.3. Modified Versions - -If you create software not governed by this License, and you want to -create a new license for such software, you may create and use a -modified version of this License if you rename the license and remove -any references to the name of the license steward (except to note that -such modified license differs from this License). - -10.4. Distributing Source Code Form that is Incompatible With Secondary -Licenses - -If You choose to distribute Source Code Form that is Incompatible With -Secondary Licenses under the terms of this version of the License, the -notice described in Exhibit B of this License must be attached. - -Exhibit A - Source Code Form License Notice -------------------------------------------- - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - -If it is not possible or desirable to put the notice in a particular -file, then You may include the notice in a location (such as a LICENSE -file in a relevant directory) where a recipient would be likely to look -for such a notice. - -You may add additional accurate notices of copyright ownership. - -Exhibit B - "Incompatible With Secondary Licenses" Notice ---------------------------------------------------------- - - This Source Code Form is "Incompatible With Secondary Licenses", as - defined by the Mozilla Public License, v. 2.0. diff --git a/vendor/github.com/status-im/status-go/protocol/Makefile b/vendor/github.com/status-im/status-go/protocol/Makefile deleted file mode 100644 index 0938c512b..000000000 --- a/vendor/github.com/status-im/status-go/protocol/Makefile +++ /dev/null @@ -1,52 +0,0 @@ -GO111MODULE = on - -ENABLE_METRICS ?= true -BUILD_FLAGS ?= $(shell echo "-ldflags '\ - -X github.com/status-im/status-go/protocol/vendor/github.com/ethereum/go-ethereum/metrics.EnabledStr=$(ENABLE_METRICS)'") - -test: - go test ./... -.PHONY: test - -test-race: - go test -race ./... -.PHONY: test-race - -lint: - golangci-lint run -v -.PHONY: lint - -install-linter: - # install linter - curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(shell go env GOPATH)/bin v1.21.0 -.PHONY: install-linter - -install-dev: - # a tool to vendor non-go files - go get github.com/goware/modvendor@latest - - go get github.com/golang/mock/gomock@latest - go install github.com/golang/mock/mockgen - - go get github.com/kevinburke/go-bindata/go-bindata@v3.13.0 - go get github.com/golang/protobuf/protoc-gen-go@v1.3.1 -.PHONY: install-dev - -generate: - go generate ./... -.PHONY: generate - -new-migration: - @if [ -z "$$DIR" ]; then \ - echo 'missing DIR var'; \ - exit 1; \ - fi - - @if [ -z "$$NAME" ]; then \ - echo 'missing NAME var'; \ - exit 1; \ - fi - - mkdir -p $(DIR) - touch $(DIR)/`date +"%s"`_$(NAME).down.sql ./$(DIR)/`date +"%s"`_$(NAME).up.sql -.PHONY: create-migration diff --git a/vendor/github.com/status-im/status-go/protocol/README.md b/vendor/github.com/status-im/status-go/protocol/README.md deleted file mode 100644 index cea57680a..000000000 --- a/vendor/github.com/status-im/status-go/protocol/README.md +++ /dev/null @@ -1,6 +0,0 @@ -# status-go/protocol - -This is the Status Protocol implementation in Go. - - -TBD diff --git a/vendor/github.com/status-im/status-go/protocol/chat.go b/vendor/github.com/status-im/status-go/protocol/chat.go deleted file mode 100644 index c49e27a8c..000000000 --- a/vendor/github.com/status-im/status-go/protocol/chat.go +++ /dev/null @@ -1,330 +0,0 @@ -package protocol - -import ( - "crypto/ecdsa" - "crypto/sha1" - "encoding/hex" - "encoding/json" - "errors" - "math/rand" - - "github.com/status-im/status-go/eth-node/crypto" - "github.com/status-im/status-go/eth-node/types" - "github.com/status-im/status-go/protocol/protobuf" - v1protocol "github.com/status-im/status-go/protocol/v1" -) - -var chatColors = []string{ - "#fa6565", // red - "#887af9", // blue - "#FE8F59", // orange - "#7cda00", // green - "#51d0f0", // light-blue - "#d37ef4", // purple -} - -type ChatType int - -const ( - ChatTypeOneToOne ChatType = iota + 1 - ChatTypePublic - ChatTypePrivateGroupChat -) - -type Chat struct { - // ID is the id of the chat, for public chats it is the name e.g. status, for one-to-one - // is the hex encoded public key and for group chats is a random uuid appended with - // the hex encoded pk of the creator of the chat - ID string `json:"id"` - Name string `json:"name"` - Color string `json:"color"` - // Active indicates whether the chat has been soft deleted - Active bool `json:"active"` - - ChatType ChatType `json:"chatType"` - - // Timestamp indicates the last time this chat has received/sent a message - Timestamp int64 `json:"timestamp"` - // LastClockValue indicates the last clock value to be used when sending messages - LastClockValue uint64 `json:"lastClockValue"` - // DeletedAtClockValue indicates the clock value at time of deletion, messages - // with lower clock value of this should be discarded - DeletedAtClockValue uint64 `json:"deletedAtClockValue"` - - // Denormalized fields - UnviewedMessagesCount uint `json:"unviewedMessagesCount"` - LastMessage []byte `json:"lastMessage"` - - // Group chat fields - // Members are the members who have been invited to the group chat - Members []ChatMember `json:"members"` - // MembershipUpdates is all the membership events in the chat - MembershipUpdates []v1protocol.MembershipUpdateEvent `json:"membershipUpdateEvents"` -} - -func (c *Chat) PublicKey() (*ecdsa.PublicKey, error) { - // For one to one chatID is an encoded public key - if c.ChatType != ChatTypeOneToOne { - return nil, nil - } - pkey, err := hex.DecodeString(c.ID[2:]) - if err != nil { - return nil, err - } - // Safety check, make sure is well formed - return crypto.UnmarshalPubkey(pkey) - -} - -func (c *Chat) Public() bool { - return c.ChatType == ChatTypePublic -} - -func (c *Chat) OneToOne() bool { - return c.ChatType == ChatTypeOneToOne -} - -func (c *Chat) Validate() error { - if c.ID == "" { - return errors.New("chatID can't be blank") - } - - if c.OneToOne() { - _, err := c.PublicKey() - return err - } - return nil -} - -func (c *Chat) MarshalJSON() ([]byte, error) { - type ChatAlias Chat - item := struct { - *ChatAlias - LastMessage json.RawMessage `json:"lastMessage"` - }{ - ChatAlias: (*ChatAlias)(c), - LastMessage: c.LastMessage, - } - - return json.Marshal(item) -} - -func (c *Chat) UnmarshalJSON(data []byte) error { - type ChatAlias Chat - aux := struct { - *ChatAlias - LastMessage *Message `json:"lastMessage"` - }{ - ChatAlias: (*ChatAlias)(c), - } - if err := json.Unmarshal(data, &aux); err != nil { - return err - } - - c.ID = aux.ID - c.Name = aux.Name - c.Color = aux.Color - c.Active = aux.Active - c.ChatType = aux.ChatType - c.Timestamp = aux.Timestamp - c.LastClockValue = aux.LastClockValue - c.DeletedAtClockValue = aux.DeletedAtClockValue - c.UnviewedMessagesCount = aux.UnviewedMessagesCount - c.Members = aux.Members - c.MembershipUpdates = aux.MembershipUpdates - - if aux.LastMessage != nil { - data, err := json.Marshal(aux.LastMessage) - if err != nil { - return err - } - c.LastMessage = data - } - return nil -} - -func (c *Chat) MembersAsPublicKeys() ([]*ecdsa.PublicKey, error) { - publicKeys := make([]string, len(c.Members)) - for idx, item := range c.Members { - publicKeys[idx] = item.ID - } - return stringSliceToPublicKeys(publicKeys, true) -} - -func (c *Chat) updateChatFromProtocolGroup(g *v1protocol.Group) { - // ID - c.ID = g.ChatID() - - // Name - c.Name = g.Name() - - // Members - members := g.Members() - admins := g.Admins() - joined := g.Joined() - chatMembers := make([]ChatMember, 0, len(members)) - for _, m := range members { - chatMember := ChatMember{ - ID: m, - } - chatMember.Admin = stringSliceContains(admins, m) - chatMember.Joined = stringSliceContains(joined, m) - chatMembers = append(chatMembers, chatMember) - } - c.Members = chatMembers - - // MembershipUpdates - c.MembershipUpdates = g.Events() -} - -// NextClockAndTimestamp returns the next clock value -// and the current timestamp -func (c *Chat) NextClockAndTimestamp(timesource TimeSource) (uint64, uint64) { - clock := c.LastClockValue - timestamp := timesource.GetCurrentTime() - if clock == 0 || clock < timestamp { - clock = timestamp - } else { - clock = clock + 1 - } - return clock, timestamp -} - -func (c *Chat) UpdateFromMessage(message *Message, timesource TimeSource) error { - c.Timestamp = int64(timesource.GetCurrentTime()) - if c.LastClockValue <= message.Clock { - jsonMessage, err := json.Marshal(message) - if err != nil { - return err - } - - c.LastClockValue = message.Clock - c.LastMessage = jsonMessage - } - return nil -} - -// ChatMembershipUpdate represent an event on membership of the chat -type ChatMembershipUpdate struct { - // Unique identifier for the event - ID string `json:"id"` - // Type indicates the kind of event - Type protobuf.MembershipUpdateEvent_EventType `json:"type"` - // Name represents the name in the event of changing name events - Name string `json:"name,omitempty"` - // Clock value of the event - ClockValue uint64 `json:"clockValue"` - // Signature of the event - Signature string `json:"signature"` - // Hex encoded public key of the creator of the event - From string `json:"from"` - // Target of the event for single-target events - Member string `json:"member,omitempty"` - // Target of the event for multi-target events - Members []string `json:"members,omitempty"` -} - -func (u *ChatMembershipUpdate) setID() { - sum := sha1.Sum([]byte(u.Signature)) - u.ID = hex.EncodeToString(sum[:]) -} - -// ChatMember represents a member who participates in a group chat -type ChatMember struct { - // ID is the hex encoded public key of the member - ID string `json:"id"` - // Admin indicates if the member is an admin of the group chat - Admin bool `json:"admin"` - // Joined indicates if the member has joined the group chat - Joined bool `json:"joined"` -} - -func (c ChatMember) PublicKey() (*ecdsa.PublicKey, error) { - b, err := types.DecodeHex(c.ID) - if err != nil { - return nil, err - } - return crypto.UnmarshalPubkey(b) -} - -func oneToOneChatID(publicKey *ecdsa.PublicKey) string { - return types.EncodeHex(crypto.FromECDSAPub(publicKey)) -} - -func OneToOneFromPublicKey(pk *ecdsa.PublicKey, timesource TimeSource) *Chat { - chatID := types.EncodeHex(crypto.FromECDSAPub(pk)) - newChat := CreateOneToOneChat(chatID[:8], pk, timesource) - - return &newChat -} - -func CreateOneToOneChat(name string, publicKey *ecdsa.PublicKey, timesource TimeSource) Chat { - return Chat{ - ID: oneToOneChatID(publicKey), - Name: name, - Timestamp: int64(timesource.GetCurrentTime()), - Active: true, - ChatType: ChatTypeOneToOne, - } -} - -func CreatePublicChat(name string, timesource TimeSource) Chat { - return Chat{ - ID: name, - Name: name, - Active: true, - Timestamp: int64(timesource.GetCurrentTime()), - Color: chatColors[rand.Intn(len(chatColors))], - ChatType: ChatTypePublic, - } -} - -func CreateGroupChat(timesource TimeSource) Chat { - return Chat{ - Active: true, - Color: chatColors[rand.Intn(len(chatColors))], - Timestamp: int64(timesource.GetCurrentTime()), - ChatType: ChatTypePrivateGroupChat, - } -} - -func findChatByID(chatID string, chats []*Chat) *Chat { - for _, c := range chats { - if c.ID == chatID { - return c - } - } - return nil -} - -func stringSliceToPublicKeys(slice []string, prefixed bool) ([]*ecdsa.PublicKey, error) { - result := make([]*ecdsa.PublicKey, len(slice)) - for idx, item := range slice { - var ( - b []byte - err error - ) - if prefixed { - b, err = types.DecodeHex(item) - } else { - b, err = hex.DecodeString(item) - } - if err != nil { - return nil, err - } - result[idx], err = crypto.UnmarshalPubkey(b) - if err != nil { - return nil, err - } - } - return result, nil -} - -func stringSliceContains(slice []string, item string) bool { - for _, s := range slice { - if s == item { - return true - } - } - return false -} diff --git a/vendor/github.com/status-im/status-go/protocol/chat_group_proxy.go b/vendor/github.com/status-im/status-go/protocol/chat_group_proxy.go deleted file mode 100644 index 5e2c44964..000000000 --- a/vendor/github.com/status-im/status-go/protocol/chat_group_proxy.go +++ /dev/null @@ -1,9 +0,0 @@ -package protocol - -import ( - v1protocol "github.com/status-im/status-go/protocol/v1" -) - -func newProtocolGroupFromChat(chat *Chat) (*v1protocol.Group, error) { - return v1protocol.NewGroup(chat.ID, chat.MembershipUpdates) -} diff --git a/vendor/github.com/status-im/status-go/protocol/contact.go b/vendor/github.com/status-im/status-go/protocol/contact.go deleted file mode 100644 index f36cc62a8..000000000 --- a/vendor/github.com/status-im/status-go/protocol/contact.go +++ /dev/null @@ -1,122 +0,0 @@ -package protocol - -import ( - "crypto/ecdsa" - "encoding/hex" - - "github.com/status-im/status-go/eth-node/crypto" - "github.com/status-im/status-go/eth-node/types" - "github.com/status-im/status-go/protocol/identity/alias" - "github.com/status-im/status-go/protocol/identity/identicon" -) - -const ( - contactBlocked = ":contact/blocked" - contactAdded = ":contact/added" - contactRequestReceived = ":contact/request-received" -) - -// ContactDeviceInfo is a struct containing information about a particular device owned by a contact -type ContactDeviceInfo struct { - // The installation id of the device - InstallationID string `json:"id"` - // Timestamp represents the last time we received this info - Timestamp int64 `json:"timestamp"` - // FCMToken is to be used for push notifications - FCMToken string `json:"fcmToken"` -} - -// Contact has information about a "Contact". A contact is not necessarily one -// that we added or added us, that's based on SystemTags. -type Contact struct { - // ID of the contact. It's a hex-encoded public key (prefixed with 0x). - ID string `json:"id"` - // Ethereum address of the contact - Address string `json:"address,omitempty"` - // ENS name of contact - Name string `json:"name,omitempty"` - // EnsVerified whether we verified the name of the contact - ENSVerified bool `json:"ensVerified"` - // EnsVerifiedAt the time we last verified the name - ENSVerifiedAt uint64 `json:"ensVerifiedAt"` - // LastENSClockValue is the last clock value of when we - // received an ENS name for the user - LastENSClockValue uint64 `json:"lastENSClockValue"` - // ENSVerificationRetries is how many times we retried the ENS - ENSVerificationRetries uint64 `json:"ensVerificationRetries"` - // Generated username name of the contact - Alias string `json:"alias,omitempty"` - // Identicon generated from public key - Identicon string `json:"identicon"` - // Photo is the base64 encoded photo - Photo string `json:"photoPath,omitempty"` - // LastUpdated is the last time we received an update from the contact - // updates should be discarded if last updated is less than the one stored - LastUpdated uint64 `json:"lastUpdated"` - // SystemTags contains information about whether we blocked/added/have been - // added. - SystemTags []string `json:"systemTags"` - - DeviceInfo []ContactDeviceInfo `json:"deviceInfo"` - TributeToTalk string `json:"tributeToTalk,omitEmpty"` -} - -func (c Contact) PublicKey() (*ecdsa.PublicKey, error) { - b, err := types.DecodeHex(c.ID) - if err != nil { - return nil, err - } - return crypto.UnmarshalPubkey(b) -} - -func (c Contact) IsAdded() bool { - return existsInStringSlice(c.SystemTags, contactAdded) -} - -func (c Contact) HasBeenAdded() bool { - return existsInStringSlice(c.SystemTags, contactRequestReceived) -} - -func (c Contact) IsBlocked() bool { - return existsInStringSlice(c.SystemTags, contactBlocked) -} - -func (c *Contact) ResetENSVerification(clock uint64, name string) { - c.ENSVerifiedAt = 0 - c.ENSVerified = false - c.ENSVerificationRetries = 0 - c.LastENSClockValue = clock - c.Name = name -} - -// existsInStringSlice checks if a string is in a set. -func existsInStringSlice(set []string, find string) bool { - for _, s := range set { - if s == find { - return true - } - } - return false -} - -func buildContact(publicKey *ecdsa.PublicKey) (*Contact, error) { - id := "0x" + hex.EncodeToString(crypto.FromECDSAPub(publicKey)) - - identicon, err := identicon.GenerateBase64(id) - if err != nil { - return nil, err - } - - contact := &Contact{ - ID: id, - Alias: alias.GenerateFromPublicKey(publicKey), - Identicon: identicon, - } - - return contact, nil -} - -func contactIDFromPublicKey(key *ecdsa.PublicKey) string { - return types.EncodeHex(crypto.FromECDSAPub(key)) - -} diff --git a/vendor/github.com/status-im/status-go/protocol/datasync/datasync.go b/vendor/github.com/status-im/status-go/protocol/datasync/datasync.go deleted file mode 100644 index a620860ae..000000000 --- a/vendor/github.com/status-im/status-go/protocol/datasync/datasync.go +++ /dev/null @@ -1,66 +0,0 @@ -package datasync - -import ( - "crypto/ecdsa" - - "github.com/golang/protobuf/proto" - datasyncnode "github.com/vacp2p/mvds/node" - datasyncproto "github.com/vacp2p/mvds/protobuf" - datasynctransport "github.com/vacp2p/mvds/transport" - "go.uber.org/zap" - - datasyncpeer "github.com/status-im/status-go/protocol/datasync/peer" -) - -type DataSync struct { - *datasyncnode.Node - // DataSyncNodeTransport is the implementation of the datasync transport interface. - *DataSyncNodeTransport - logger *zap.Logger - sendingEnabled bool -} - -func New(node *datasyncnode.Node, transport *DataSyncNodeTransport, sendingEnabled bool, logger *zap.Logger) *DataSync { - return &DataSync{Node: node, DataSyncNodeTransport: transport, sendingEnabled: sendingEnabled, logger: logger} -} - -func (d *DataSync) Handle(sender *ecdsa.PublicKey, payload []byte) [][]byte { - var payloads [][]byte - logger := d.logger.With(zap.String("site", "Handle")) - - datasyncMessage, err := unwrap(payload) - // If it failed to decode is not a protobuf message, if it successfully decoded but body is empty, is likedly a protobuf wrapped message - if err != nil || !datasyncMessage.IsValid() { - logger.Debug("handling non-datasync message", zap.Error(err), zap.Bool("datasyncMessage.IsValid()", datasyncMessage.IsValid())) - // Not a datasync message, return unchanged - payloads = append(payloads, payload) - } else { - logger.Debug("handling datasync message") - // datasync message - for _, message := range datasyncMessage.Messages { - payloads = append(payloads, message.Body) - } - if d.sendingEnabled { - d.add(sender, datasyncMessage) - } - } - - return payloads -} - -func (d *DataSync) Stop() { - d.Node.Stop() -} - -func (d *DataSync) add(publicKey *ecdsa.PublicKey, datasyncMessage datasyncproto.Payload) { - packet := datasynctransport.Packet{ - Sender: datasyncpeer.PublicKeyToPeerID(*publicKey), - Payload: datasyncMessage, - } - d.DataSyncNodeTransport.AddPacket(packet) -} - -func unwrap(payload []byte) (datasyncPayload datasyncproto.Payload, err error) { - err = proto.Unmarshal(payload, &datasyncPayload) - return -} diff --git a/vendor/github.com/status-im/status-go/protocol/datasync/peer/utils.go b/vendor/github.com/status-im/status-go/protocol/datasync/peer/utils.go deleted file mode 100644 index 31042bee0..000000000 --- a/vendor/github.com/status-im/status-go/protocol/datasync/peer/utils.go +++ /dev/null @@ -1,19 +0,0 @@ -package peer - -import ( - "crypto/ecdsa" - - "github.com/status-im/status-go/eth-node/crypto" - - "github.com/vacp2p/mvds/state" -) - -func PublicKeyToPeerID(k ecdsa.PublicKey) state.PeerID { - var p state.PeerID - copy(p[:], crypto.FromECDSAPub(&k)) - return p -} - -func PeerIDToPublicKey(p state.PeerID) (*ecdsa.PublicKey, error) { - return crypto.UnmarshalPubkey(p[:]) -} diff --git a/vendor/github.com/status-im/status-go/protocol/datasync/transport.go b/vendor/github.com/status-im/status-go/protocol/datasync/transport.go deleted file mode 100644 index f193870df..000000000 --- a/vendor/github.com/status-im/status-go/protocol/datasync/transport.go +++ /dev/null @@ -1,63 +0,0 @@ -package datasync - -import ( - "context" - "crypto/ecdsa" - "errors" - - "github.com/golang/protobuf/proto" - "github.com/vacp2p/mvds/protobuf" - "github.com/vacp2p/mvds/state" - "github.com/vacp2p/mvds/transport" - - datasyncpeer "github.com/status-im/status-go/protocol/datasync/peer" -) - -var errNotInitialized = errors.New("Datasync transport not initialized") - -type DataSyncNodeTransport struct { - packets chan transport.Packet - dispatch func(context.Context, *ecdsa.PublicKey, []byte, *protobuf.Payload) error -} - -func NewDataSyncNodeTransport() *DataSyncNodeTransport { - return &DataSyncNodeTransport{ - packets: make(chan transport.Packet), - } -} - -func (t *DataSyncNodeTransport) Init(dispatch func(context.Context, *ecdsa.PublicKey, []byte, *protobuf.Payload) error) { - t.dispatch = dispatch -} - -func (t *DataSyncNodeTransport) AddPacket(p transport.Packet) { - t.packets <- p -} - -func (t *DataSyncNodeTransport) Watch() transport.Packet { - return <-t.packets -} - -func (t *DataSyncNodeTransport) Send(_ state.PeerID, peer state.PeerID, payload protobuf.Payload) error { - if t.dispatch == nil { - return errNotInitialized - } - - data, err := proto.Marshal(&payload) - if err != nil { - return err - } - - publicKey, err := datasyncpeer.PeerIDToPublicKey(peer) - if err != nil { - return err - } - - return t.dispatch(context.TODO(), publicKey, data, &payload) -} - -// CalculateSendTime calculates the next epoch -// at which a message should be sent. -func CalculateSendTime(count uint64, time int64) int64 { - return time + int64(count*2) // @todo this should match that time is increased by whisper periods, aka we only retransmit the first time when a message has expired. -} diff --git a/vendor/github.com/status-im/status-go/protocol/datasync/utils.go b/vendor/github.com/status-im/status-go/protocol/datasync/utils.go deleted file mode 100644 index 99cdc3e31..000000000 --- a/vendor/github.com/status-im/status-go/protocol/datasync/utils.go +++ /dev/null @@ -1,30 +0,0 @@ -package datasync - -import ( - "crypto/ecdsa" - - "github.com/vacp2p/mvds/state" - - "github.com/status-im/status-go/eth-node/crypto" -) - -func ToGroupID(data []byte) state.GroupID { - g := state.GroupID{} - copy(g[:], data[:]) - return g -} - -// ToOneToOneGroupID returns a groupID for a onetoonechat, which is taken by -// concatenating the bytes of the compressed keys, in ascending order by X -func ToOneToOneGroupID(key1 *ecdsa.PublicKey, key2 *ecdsa.PublicKey) state.GroupID { - pk1 := crypto.CompressPubkey(key1) - pk2 := crypto.CompressPubkey(key2) - var groupID []byte - if key1.X.Cmp(key2.X) == -1 { - groupID = append(pk1, pk2...) - } else { - groupID = append(pk2, pk1...) - } - - return ToGroupID(crypto.Keccak256(groupID)) -} diff --git a/vendor/github.com/status-im/status-go/protocol/encryption/encryptor.go b/vendor/github.com/status-im/status-go/protocol/encryption/encryptor.go deleted file mode 100644 index bbaa788b0..000000000 --- a/vendor/github.com/status-im/status-go/protocol/encryption/encryptor.go +++ /dev/null @@ -1,592 +0,0 @@ -package encryption - -import ( - "crypto/ecdsa" - "database/sql" - "encoding/hex" - "errors" - "sync" - "time" - - dr "github.com/status-im/doubleratchet" - "go.uber.org/zap" - - "github.com/status-im/status-go/eth-node/crypto" - "github.com/status-im/status-go/eth-node/crypto/ecies" - - "github.com/status-im/status-go/protocol/encryption/multidevice" -) - -var ( - errSessionNotFound = errors.New("session not found") - ErrDeviceNotFound = errors.New("device not found") - // ErrNotPairedDevice means that we received a message signed with our public key - // but from a device that has not been paired. - // This should not happen because the protocol forbids sending a message to - // non-paired devices, however, in theory it is possible to receive such a message. - ErrNotPairedDevice = errors.New("received a message from not paired device") -) - -// If we have no bundles, we use a constant so that the message can reach any device. -const noInstallationID = "none" - -type confirmationData struct { - header *dr.MessageHeader - drInfo *RatchetInfo -} - -// encryptor defines a service that is responsible for the encryption aspect of the protocol. -type encryptor struct { - persistence *sqlitePersistence - config encryptorConfig - messageIDs map[string]*confirmationData - mutex sync.Mutex - logger *zap.Logger -} - -type encryptorConfig struct { - InstallationID string - // Max number of installations we keep synchronized. - MaxInstallations int - // How many consecutive messages can be skipped in the receiving chain. - MaxSkip int - // Any message with seqNo <= currentSeq - maxKeep will be deleted. - MaxKeep int - // How many keys do we store in total per session. - MaxMessageKeysPerSession int - // How long before we refresh the interval in milliseconds - BundleRefreshInterval int64 - // The logging object - Logger *zap.Logger -} - -// defaultEncryptorConfig returns the default values used by the encryption service -func defaultEncryptorConfig(installationID string, logger *zap.Logger) encryptorConfig { - if logger == nil { - logger = zap.NewNop() - } - - return encryptorConfig{ - MaxInstallations: 3, - MaxSkip: 1000, - MaxKeep: 3000, - MaxMessageKeysPerSession: 2000, - BundleRefreshInterval: 24 * 60 * 60 * 1000, - InstallationID: installationID, - Logger: logger, - } -} - -// newEncryptor creates a new EncryptionService instance. -func newEncryptor(db *sql.DB, config encryptorConfig) *encryptor { - return &encryptor{ - persistence: newSQLitePersistence(db), - config: config, - messageIDs: make(map[string]*confirmationData), - logger: config.Logger.With(zap.Namespace("encryptor")), - } -} - -func (s *encryptor) keyFromActiveX3DH(theirIdentityKey []byte, theirSignedPreKey []byte, myIdentityKey *ecdsa.PrivateKey) ([]byte, *ecdsa.PublicKey, error) { - sharedKey, ephemeralPubKey, err := PerformActiveX3DH(theirIdentityKey, theirSignedPreKey, myIdentityKey) - if err != nil { - return nil, nil, err - } - - return sharedKey, ephemeralPubKey, nil -} - -func (s *encryptor) getDRSession(id []byte) (dr.Session, error) { - sessionStorage := s.persistence.SessionStorage() - return dr.Load( - id, - sessionStorage, - dr.WithKeysStorage(s.persistence.KeysStorage()), - dr.WithMaxSkip(s.config.MaxSkip), - dr.WithMaxKeep(s.config.MaxKeep), - dr.WithMaxMessageKeysPerSession(s.config.MaxMessageKeysPerSession), - dr.WithCrypto(crypto.EthereumCrypto{}), - ) -} - -func confirmationIDString(id []byte) string { - return hex.EncodeToString(id) -} - -// ConfirmMessagesProcessed confirms and deletes message keys for the given messages -func (s *encryptor) ConfirmMessageProcessed(messageID []byte) error { - s.mutex.Lock() - defer s.mutex.Unlock() - - id := confirmationIDString(messageID) - confirmationData, ok := s.messageIDs[id] - if !ok { - s.logger.Debug("could not confirm message or message already confirmed", zap.String("messageID", id)) - // We are ok with this, means no key material is stored (public message, or already confirmed) - return nil - } - - // Load session from store first - session, err := s.getDRSession(confirmationData.drInfo.ID) - if err != nil { - return err - } - - if err := session.DeleteMk(confirmationData.header.DH, confirmationData.header.N); err != nil { - return err - } - - // Clean up - delete(s.messageIDs, id) - - return nil -} - -// CreateBundle retrieves or creates an X3DH bundle given a private key -func (s *encryptor) CreateBundle(privateKey *ecdsa.PrivateKey, installations []*multidevice.Installation) (*Bundle, error) { - ourIdentityKeyC := crypto.CompressPubkey(&privateKey.PublicKey) - - bundleContainer, err := s.persistence.GetAnyPrivateBundle(ourIdentityKeyC, installations) - if err != nil { - return nil, err - } - - expired := bundleContainer != nil && bundleContainer.GetBundle().Timestamp < time.Now().Add(-1*time.Duration(s.config.BundleRefreshInterval)*time.Millisecond).UnixNano() - - // If the bundle has expired we create a new one - if expired { - // Mark sessions has expired - if err := s.persistence.MarkBundleExpired(bundleContainer.GetBundle().GetIdentity()); err != nil { - return nil, err - } - - } else if bundleContainer != nil { - err = SignBundle(privateKey, bundleContainer) - if err != nil { - return nil, err - } - return bundleContainer.GetBundle(), nil - } - - // needs transaction/mutex to avoid creating multiple bundles - // although not a problem - bundleContainer, err = NewBundleContainer(privateKey, s.config.InstallationID) - if err != nil { - return nil, err - } - - if err = s.persistence.AddPrivateBundle(bundleContainer); err != nil { - return nil, err - } - - return s.CreateBundle(privateKey, installations) -} - -// DecryptWithDH decrypts message sent with a DH key exchange, and throws away the key after decryption -func (s *encryptor) DecryptWithDH(myIdentityKey *ecdsa.PrivateKey, theirEphemeralKey *ecdsa.PublicKey, payload []byte) ([]byte, error) { - key, err := PerformDH( - ecies.ImportECDSA(myIdentityKey), - ecies.ImportECDSAPublic(theirEphemeralKey), - ) - if err != nil { - return nil, err - } - - return crypto.DecryptSymmetric(key, payload) - -} - -// keyFromPassiveX3DH decrypts message sent with a X3DH key exchange, storing the key for future exchanges -func (s *encryptor) keyFromPassiveX3DH(myIdentityKey *ecdsa.PrivateKey, theirIdentityKey *ecdsa.PublicKey, theirEphemeralKey *ecdsa.PublicKey, ourBundleID []byte) ([]byte, error) { - bundlePrivateKey, err := s.persistence.GetPrivateKeyBundle(ourBundleID) - if err != nil { - s.logger.Error("could not get private bundle", zap.Error(err)) - return nil, err - } - - if bundlePrivateKey == nil { - return nil, errSessionNotFound - } - - signedPreKey, err := crypto.ToECDSA(bundlePrivateKey) - if err != nil { - s.logger.Error("could not convert to ecdsa", zap.Error(err)) - return nil, err - } - - key, err := PerformPassiveX3DH( - theirIdentityKey, - signedPreKey, - theirEphemeralKey, - myIdentityKey, - ) - if err != nil { - s.logger.Error("could not perform passive x3dh", zap.Error(err)) - return nil, err - } - return key, nil -} - -// ProcessPublicBundle persists a bundle -func (s *encryptor) ProcessPublicBundle(myIdentityKey *ecdsa.PrivateKey, b *Bundle) error { - return s.persistence.AddPublicBundle(b) -} - -// DecryptPayload decrypts the payload of a DirectMessageProtocol, given an identity private key and the sender's public key -func (s *encryptor) DecryptPayload(myIdentityKey *ecdsa.PrivateKey, theirIdentityKey *ecdsa.PublicKey, theirInstallationID string, msgs map[string]*DirectMessageProtocol, messageID []byte) ([]byte, error) { - s.mutex.Lock() - defer s.mutex.Unlock() - - msg := msgs[s.config.InstallationID] - if msg == nil { - msg = msgs[noInstallationID] - } - - // We should not be sending a signal if it's coming from us, as we receive our own messages - if msg == nil && !samePublicKeys(*theirIdentityKey, myIdentityKey.PublicKey) { - return nil, ErrDeviceNotFound - } else if msg == nil { - return nil, ErrNotPairedDevice - } - - payload := msg.GetPayload() - - if x3dhHeader := msg.GetX3DHHeader(); x3dhHeader != nil { - bundleID := x3dhHeader.GetId() - theirEphemeralKey, err := crypto.DecompressPubkey(x3dhHeader.GetKey()) - - if err != nil { - return nil, err - } - - symmetricKey, err := s.keyFromPassiveX3DH(myIdentityKey, theirIdentityKey, theirEphemeralKey, bundleID) - if err != nil { - return nil, err - } - - theirIdentityKeyC := crypto.CompressPubkey(theirIdentityKey) - err = s.persistence.AddRatchetInfo(symmetricKey, theirIdentityKeyC, bundleID, nil, theirInstallationID) - if err != nil { - return nil, err - } - } - - if drHeader := msg.GetDRHeader(); drHeader != nil { - drMessage := &dr.Message{ - Header: dr.MessageHeader{ - N: drHeader.GetN(), - PN: drHeader.GetPn(), - DH: drHeader.GetKey(), - }, - Ciphertext: msg.GetPayload(), - } - - theirIdentityKeyC := crypto.CompressPubkey(theirIdentityKey) - - drInfo, err := s.persistence.GetRatchetInfo(drHeader.GetId(), theirIdentityKeyC, theirInstallationID) - if err != nil { - s.logger.Error("could not get ratchet info", zap.Error(err)) - return nil, err - } - - // We mark the exchange as successful so we stop sending x3dh header - if err = s.persistence.RatchetInfoConfirmed(drHeader.GetId(), theirIdentityKeyC, theirInstallationID); err != nil { - s.logger.Error("could not confirm ratchet info", zap.Error(err)) - return nil, err - } - - if drInfo == nil { - s.logger.Error("could not find a session") - return nil, errSessionNotFound - } - - confirmationData := &confirmationData{ - header: &drMessage.Header, - drInfo: drInfo, - } - s.messageIDs[confirmationIDString(messageID)] = confirmationData - - return s.decryptUsingDR(theirIdentityKey, drInfo, drMessage) - } - - // Try DH - if header := msg.GetDHHeader(); header != nil { - decompressedKey, err := crypto.DecompressPubkey(header.GetKey()) - if err != nil { - return nil, err - } - return s.DecryptWithDH(myIdentityKey, decompressedKey, payload) - } - - return nil, errors.New("no key specified") -} - -func (s *encryptor) createNewSession(drInfo *RatchetInfo, sk []byte, keyPair crypto.DHPair) (dr.Session, error) { - var err error - var session dr.Session - - if drInfo.PrivateKey != nil { - session, err = dr.New( - drInfo.ID, - sk, - keyPair, - s.persistence.SessionStorage(), - dr.WithKeysStorage(s.persistence.KeysStorage()), - dr.WithMaxSkip(s.config.MaxSkip), - dr.WithMaxKeep(s.config.MaxKeep), - dr.WithMaxMessageKeysPerSession(s.config.MaxMessageKeysPerSession), - dr.WithCrypto(crypto.EthereumCrypto{})) - } else { - session, err = dr.NewWithRemoteKey( - drInfo.ID, - sk, - keyPair.PubKey, - s.persistence.SessionStorage(), - dr.WithKeysStorage(s.persistence.KeysStorage()), - dr.WithMaxSkip(s.config.MaxSkip), - dr.WithMaxKeep(s.config.MaxKeep), - dr.WithMaxMessageKeysPerSession(s.config.MaxMessageKeysPerSession), - dr.WithCrypto(crypto.EthereumCrypto{})) - } - - return session, err -} - -func (s *encryptor) encryptUsingDR(theirIdentityKey *ecdsa.PublicKey, drInfo *RatchetInfo, payload []byte) ([]byte, *DRHeader, error) { - var err error - - var session dr.Session - - keyPair := crypto.DHPair{ - PrvKey: drInfo.PrivateKey, - PubKey: drInfo.PublicKey, - } - - // Load session from store first - session, err = s.getDRSession(drInfo.ID) - - if err != nil { - return nil, nil, err - } - - // Create a new one - if session == nil { - session, err = s.createNewSession(drInfo, drInfo.Sk, keyPair) - if err != nil { - return nil, nil, err - } - } - - response, err := session.RatchetEncrypt(payload, nil) - if err != nil { - return nil, nil, err - } - - header := &DRHeader{ - Id: drInfo.BundleID, - Key: response.Header.DH[:], - N: response.Header.N, - Pn: response.Header.PN, - } - - return response.Ciphertext, header, nil -} - -func (s *encryptor) decryptUsingDR(theirIdentityKey *ecdsa.PublicKey, drInfo *RatchetInfo, payload *dr.Message) ([]byte, error) { - var err error - - var session dr.Session - - keyPair := crypto.DHPair{ - PrvKey: drInfo.PrivateKey, - PubKey: drInfo.PublicKey, - } - - session, err = s.getDRSession(drInfo.ID) - if err != nil { - return nil, err - } - - if session == nil { - session, err = s.createNewSession(drInfo, drInfo.Sk, keyPair) - if err != nil { - return nil, err - } - } - - plaintext, err := session.RatchetDecrypt(*payload, nil) - if err != nil { - return nil, err - } - - return plaintext, nil -} - -func (s *encryptor) encryptWithDH(theirIdentityKey *ecdsa.PublicKey, payload []byte) (*DirectMessageProtocol, error) { - symmetricKey, ourEphemeralKey, err := PerformActiveDH(theirIdentityKey) - if err != nil { - return nil, err - } - - encryptedPayload, err := crypto.EncryptSymmetric(symmetricKey, payload) - if err != nil { - return nil, err - } - - return &DirectMessageProtocol{ - DHHeader: &DHHeader{ - Key: crypto.CompressPubkey(ourEphemeralKey), - }, - Payload: encryptedPayload, - }, nil -} - -func (s *encryptor) EncryptPayloadWithDH(theirIdentityKey *ecdsa.PublicKey, payload []byte) (map[string]*DirectMessageProtocol, error) { - response := make(map[string]*DirectMessageProtocol) - dmp, err := s.encryptWithDH(theirIdentityKey, payload) - if err != nil { - return nil, err - } - - response[noInstallationID] = dmp - return response, nil -} - -// GetPublicBundle returns the active installations bundles for a given user -func (s *encryptor) GetPublicBundle(theirIdentityKey *ecdsa.PublicKey, installations []*multidevice.Installation) (*Bundle, error) { - return s.persistence.GetPublicBundle(theirIdentityKey, installations) -} - -// EncryptPayload returns a new DirectMessageProtocol with a given payload encrypted, given a recipient's public key and the sender private identity key -func (s *encryptor) EncryptPayload(theirIdentityKey *ecdsa.PublicKey, myIdentityKey *ecdsa.PrivateKey, installations []*multidevice.Installation, payload []byte) (map[string]*DirectMessageProtocol, []*multidevice.Installation, error) { - logger := s.logger.With( - zap.String("site", "EncryptPayload"), - zap.Binary("their-identity-key", crypto.FromECDSAPub(theirIdentityKey))) - - logger.Debug("encrypting payload") - // Which installations we are sending the message to - var targetedInstallations []*multidevice.Installation - - s.mutex.Lock() - defer s.mutex.Unlock() - - // We don't have any, send a message with DH - if len(installations) == 0 { - logger.Debug("no installations, sending to all devices") - encryptedPayload, err := s.EncryptPayloadWithDH(theirIdentityKey, payload) - return encryptedPayload, targetedInstallations, err - } - - theirIdentityKeyC := crypto.CompressPubkey(theirIdentityKey) - response := make(map[string]*DirectMessageProtocol) - - for _, installation := range installations { - installationID := installation.ID - ilogger := logger.With(zap.String("installation-id", installationID)) - ilogger.Debug("processing installation") - if s.config.InstallationID == installationID { - continue - } - - bundle, err := s.persistence.GetPublicBundle(theirIdentityKey, []*multidevice.Installation{installation}) - if err != nil { - return nil, nil, err - } - - // See if a session is there already - drInfo, err := s.persistence.GetAnyRatchetInfo(theirIdentityKeyC, installationID) - if err != nil { - return nil, nil, err - } - - targetedInstallations = append(targetedInstallations, installation) - - if drInfo != nil { - ilogger.Debug("found DR info for installation") - encryptedPayload, drHeader, err := s.encryptUsingDR(theirIdentityKey, drInfo, payload) - if err != nil { - return nil, nil, err - } - - dmp := DirectMessageProtocol{ - Payload: encryptedPayload, - DRHeader: drHeader, - } - - if drInfo.EphemeralKey != nil { - dmp.X3DHHeader = &X3DHHeader{ - Key: drInfo.EphemeralKey, - Id: drInfo.BundleID, - } - } - - response[drInfo.InstallationID] = &dmp - continue - } - - theirSignedPreKeyContainer := bundle.GetSignedPreKeys()[installationID] - - // This should not be nil at this point - if theirSignedPreKeyContainer == nil { - ilogger.Warn("could not find DR info or bundle for installation") - continue - - } - - ilogger.Debug("DR info not found, using bundle") - - theirSignedPreKey := theirSignedPreKeyContainer.GetSignedPreKey() - - sharedKey, ourEphemeralKey, err := s.keyFromActiveX3DH(theirIdentityKeyC, theirSignedPreKey, myIdentityKey) - if err != nil { - return nil, nil, err - } - theirIdentityKeyC := crypto.CompressPubkey(theirIdentityKey) - ourEphemeralKeyC := crypto.CompressPubkey(ourEphemeralKey) - - err = s.persistence.AddRatchetInfo(sharedKey, theirIdentityKeyC, theirSignedPreKey, ourEphemeralKeyC, installationID) - if err != nil { - return nil, nil, err - } - - x3dhHeader := &X3DHHeader{ - Key: ourEphemeralKeyC, - Id: theirSignedPreKey, - } - - drInfo, err = s.persistence.GetRatchetInfo(theirSignedPreKey, theirIdentityKeyC, installationID) - if err != nil { - return nil, nil, err - } - - if drInfo != nil { - encryptedPayload, drHeader, err := s.encryptUsingDR(theirIdentityKey, drInfo, payload) - if err != nil { - return nil, nil, err - } - - dmp := &DirectMessageProtocol{ - Payload: encryptedPayload, - X3DHHeader: x3dhHeader, - DRHeader: drHeader, - } - - response[drInfo.InstallationID] = dmp - } - } - - var installationIDs []string - for _, i := range targetedInstallations { - installationIDs = append(installationIDs, i.ID) - } - logger.Info( - "built a message", - zap.Strings("installation-ids", installationIDs), - ) - - return response, targetedInstallations, nil -} - -func samePublicKeys(pubKey1, pubKey2 ecdsa.PublicKey) bool { - return pubKey1.X.Cmp(pubKey2.X) == 0 && pubKey1.Y.Cmp(pubKey2.Y) == 0 -} diff --git a/vendor/github.com/status-im/status-go/protocol/encryption/migrations/migrations.go b/vendor/github.com/status-im/status-go/protocol/encryption/migrations/migrations.go deleted file mode 100644 index 3e93c617c..000000000 --- a/vendor/github.com/status-im/status-go/protocol/encryption/migrations/migrations.go +++ /dev/null @@ -1,655 +0,0 @@ -// Code generated by go-bindata. DO NOT EDIT. -// sources: -// 1536754952_initial_schema.down.sql (83B) -// 1536754952_initial_schema.up.sql (962B) -// 1539249977_update_ratchet_info.down.sql (311B) -// 1539249977_update_ratchet_info.up.sql (368B) -// 1540715431_add_version.down.sql (127B) -// 1540715431_add_version.up.sql (265B) -// 1541164797_add_installations.down.sql (26B) -// 1541164797_add_installations.up.sql (216B) -// 1558084410_add_secret.down.sql (56B) -// 1558084410_add_secret.up.sql (301B) -// 1558588866_add_version.down.sql (47B) -// 1558588866_add_version.up.sql (57B) -// 1559627659_add_contact_code.down.sql (32B) -// 1559627659_add_contact_code.up.sql (198B) -// 1561368210_add_installation_metadata.down.sql (35B) -// 1561368210_add_installation_metadata.up.sql (267B) -// doc.go (377B) - -package migrations - -import ( - "bytes" - "compress/gzip" - "crypto/sha256" - "fmt" - "io" - "io/ioutil" - "os" - "path/filepath" - "strings" - "time" -) - -func bindataRead(data []byte, name string) ([]byte, error) { - gz, err := gzip.NewReader(bytes.NewBuffer(data)) - if err != nil { - return nil, fmt.Errorf("read %q: %v", name, err) - } - - var buf bytes.Buffer - _, err = io.Copy(&buf, gz) - clErr := gz.Close() - - if err != nil { - return nil, fmt.Errorf("read %q: %v", name, err) - } - if clErr != nil { - return nil, err - } - - return buf.Bytes(), nil -} - -type asset struct { - bytes []byte - info os.FileInfo - digest [sha256.Size]byte -} - -type bindataFileInfo struct { - name string - size int64 - mode os.FileMode - modTime time.Time -} - -func (fi bindataFileInfo) Name() string { - return fi.name -} -func (fi bindataFileInfo) Size() int64 { - return fi.size -} -func (fi bindataFileInfo) Mode() os.FileMode { - return fi.mode -} -func (fi bindataFileInfo) ModTime() time.Time { - return fi.modTime -} -func (fi bindataFileInfo) IsDir() bool { - return false -} -func (fi bindataFileInfo) Sys() interface{} { - return nil -} - -var __1536754952_initial_schemaDownSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x72\x09\xf2\x0f\x50\x08\x71\x74\xf2\x71\x55\x28\x4e\x2d\x2e\xce\xcc\xcf\x2b\xb6\xe6\x42\x12\x4c\x2a\xcd\x4b\xc9\x49\x45\x15\xcb\x4e\xad\x44\x15\x28\x4a\x2c\x49\xce\x48\x2d\x89\xcf\xcc\x4b\xcb\xb7\xe6\x02\x04\x00\x00\xff\xff\x72\x61\x3f\x92\x53\x00\x00\x00") - -func _1536754952_initial_schemaDownSqlBytes() ([]byte, error) { - return bindataRead( - __1536754952_initial_schemaDownSql, - "1536754952_initial_schema.down.sql", - ) -} - -func _1536754952_initial_schemaDownSql() (*asset, error) { - bytes, err := _1536754952_initial_schemaDownSqlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "1536754952_initial_schema.down.sql", size: 83, mode: os.FileMode(0644), modTime: time.Unix(1574354941, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x44, 0xcf, 0x76, 0x71, 0x1f, 0x5e, 0x9a, 0x43, 0xd8, 0xcd, 0xb8, 0xc3, 0x70, 0xc3, 0x7f, 0xfc, 0x90, 0xb4, 0x25, 0x1e, 0xf4, 0x66, 0x20, 0xb8, 0x33, 0x7e, 0xb0, 0x76, 0x1f, 0xc, 0xc0, 0x75}} - return a, nil -} - -var __1536754952_initial_schemaUpSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x8c\x52\xc1\x8e\x9b\x30\x10\xbd\xe7\x2b\xe6\x98\x48\x39\xf4\xde\x13\xb0\x13\x84\x4a\xcd\xd6\x0b\x52\xf7\x64\x79\xe3\x69\xb0\x16\x1b\x64\x3b\xab\xe6\xef\x2b\x20\xa5\xb8\x65\xdb\xde\x98\xc7\x9b\x99\x37\xef\x39\xe3\x98\xd4\x08\x75\x92\x96\x08\x9e\xbc\xd7\xbd\xf5\xb0\xdf\x01\xa8\xd6\x41\x5a\x56\xe9\x71\xfa\xf6\x62\xb8\xbe\x74\xfa\x1c\x43\x4e\xbf\xc9\x40\x0b\xe6\xfa\x3e\x88\x73\x2b\xb5\x15\xaf\x74\x5b\x60\x4f\x56\xfd\x1d\xb6\x50\xb0\x1a\x73\xe4\xd3\x14\x3a\xbf\x6d\xd0\x57\x70\x44\xf7\x81\x86\x75\x3d\x58\x58\x97\x5a\x4d\x13\x80\x55\x35\xb0\xa6\x2c\xe1\x91\x17\x9f\x13\xfe\x0c\x9f\xf0\x79\xfc\xdf\xb0\xe2\x4b\x83\x7b\xad\x0e\x50\x31\xc8\x2a\x76\x2a\x8b\xac\x06\x8e\x8f\x65\x92\xe1\xee\xf0\x71\xb7\x8b\x3c\x7a\xa5\xdb\xec\xcf\xec\xc7\x22\x71\x59\x30\x0e\x35\xfe\x22\xec\xd5\xac\x75\x18\xf2\x5e\x5e\x68\x9b\x3f\x8b\x80\xfd\xbd\xef\xb8\x66\xff\xa7\xae\x97\xab\x55\x1d\xcd\xd2\xb4\x22\x1b\x74\xd8\x58\xa4\xad\x0f\xb2\xeb\x64\xd0\xbd\x15\x5a\x41\x8d\x5f\xeb\x88\x70\x8f\x34\x0e\x4a\x5f\x2c\x29\x31\xb8\x0d\xf5\x6b\x3b\x23\xa1\x45\xce\x2a\x8e\x63\x7b\xd0\x86\x7c\x90\x66\x80\x86\x3d\x15\x39\xc3\x07\x48\x8b\x7c\xf4\x26\xda\x4c\xdf\x07\xed\x48\x41\x5a\x55\x25\x26\x0c\x1e\xf0\x94\x34\x65\x0d\x1f\xfe\xbc\xd5\xc9\x70\x6e\x29\x08\x6d\xbf\xf5\xd3\xc1\xf3\xf1\xe2\xf7\xac\xa7\xb1\x43\x4b\x86\x9c\xec\xa2\x93\xde\x77\xc8\xdf\x8c\xa1\xe0\xde\x4b\xf6\x9f\x06\xde\xdf\xd3\xa2\xe8\xb8\xec\xda\x0c\x72\x6c\x39\x55\x1c\x8b\x9c\x4d\x16\xfe\x6a\x3c\x00\xc7\x13\x72\x64\x19\x3e\xfd\x4c\x77\x1f\x47\x71\x18\xad\xf9\x11\x00\x00\xff\xff\xa9\x50\xa8\xb2\xc2\x03\x00\x00") - -func _1536754952_initial_schemaUpSqlBytes() ([]byte, error) { - return bindataRead( - __1536754952_initial_schemaUpSql, - "1536754952_initial_schema.up.sql", - ) -} - -func _1536754952_initial_schemaUpSql() (*asset, error) { - bytes, err := _1536754952_initial_schemaUpSqlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "1536754952_initial_schema.up.sql", size: 962, mode: os.FileMode(0644), modTime: time.Unix(1574354941, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xea, 0x90, 0x5a, 0x59, 0x3e, 0x3, 0xe2, 0x3c, 0x81, 0x42, 0xcd, 0x4c, 0x9a, 0xe8, 0xda, 0x93, 0x2b, 0x70, 0xa4, 0xd5, 0x29, 0x3e, 0xd5, 0xc9, 0x27, 0xb6, 0xb7, 0x65, 0xff, 0x0, 0xcb, 0xde}} - return a, nil -} - -var __1539249977_update_ratchet_infoDownSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x6c\x8f\x41\x4b\xc4\x30\x10\x85\xef\xf9\x15\xef\xd8\xc2\x9e\xbc\xee\xa9\x8d\x53\x29\x86\x64\x8d\x29\xe8\x29\xd4\xed\xe8\x06\xdb\xec\xd2\x46\xa1\xff\x5e\x22\x52\x59\xf4\x3a\xdf\xf7\x78\x6f\x6e\xad\x39\xc0\x55\xb5\x22\xcc\x7d\x3a\x9e\x38\xf9\x10\x5f\xcf\xfe\xf3\x66\x2f\x84\xb4\x54\x39\xfa\x07\xa3\x10\xc0\xcb\x47\x1c\x46\xf6\x61\x40\xad\x4c\x0d\x6d\x1c\x74\xa7\xd4\x4e\x00\x7c\x39\xf1\xc4\x73\x3f\xfa\x77\x5e\xbf\x71\xbe\x86\x81\x63\x0a\x69\xfd\xeb\x2f\xeb\x34\x71\x9a\xc3\x71\xf3\xaf\x70\x88\x4b\xea\xc7\xb1\x4f\xe1\x1c\x73\x9f\xa3\x27\x77\x25\x74\xba\x7d\xe8\xa8\xd8\x16\xed\xb6\xae\x12\x46\x43\x1a\xdd\xa8\x56\x3a\x58\x3a\xa8\x4a\x52\x8e\x34\xc6\x52\x7b\xa7\x71\x4f\xcf\xf8\x0d\x96\xb0\xd4\x90\x25\x2d\xe9\xf1\xe7\xc1\xa5\x58\xc2\x5b\xe4\xc1\x5f\x66\xce\xf3\x4a\x51\xee\xc5\x57\x00\x00\x00\xff\xff\x69\x51\x9b\xb4\x37\x01\x00\x00") - -func _1539249977_update_ratchet_infoDownSqlBytes() ([]byte, error) { - return bindataRead( - __1539249977_update_ratchet_infoDownSql, - "1539249977_update_ratchet_info.down.sql", - ) -} - -func _1539249977_update_ratchet_infoDownSql() (*asset, error) { - bytes, err := _1539249977_update_ratchet_infoDownSqlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "1539249977_update_ratchet_info.down.sql", size: 311, mode: os.FileMode(0644), modTime: time.Unix(1574354941, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x1, 0xa4, 0xeb, 0xa0, 0xe6, 0xa0, 0xd4, 0x48, 0xbb, 0xad, 0x6f, 0x7d, 0x67, 0x8c, 0xbd, 0x25, 0xde, 0x1f, 0x73, 0x9a, 0xbb, 0xa8, 0xc9, 0x30, 0xb7, 0xa9, 0x7c, 0xaf, 0xb5, 0x1, 0x61, 0xdd}} - return a, nil -} - -var __1539249977_update_ratchet_infoUpSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x6c\x8f\x41\x4f\x84\x30\x10\x85\xef\xfd\x15\x73\x84\x84\x93\x57\x4e\x50\x07\x43\xac\xed\x5a\x4b\xa2\xa7\x06\x97\xd1\x6d\x16\xca\x86\x56\x13\xfe\xbd\xa9\x31\x28\xea\xf5\xbd\x6f\xde\x7b\x73\x8d\x02\x0d\x42\xa3\xd5\x1d\x04\x0a\xc1\xcd\x3e\x94\xec\xa7\x7a\xa6\x35\x29\x5a\x1d\xc0\x54\xb5\x40\x58\xfa\x78\x3c\x51\xb4\xce\xbf\xcc\x25\x63\x5c\x63\x65\xf0\x1f\xcf\xbe\x5f\x41\xc6\x00\x9e\xdf\xfc\x30\x92\x75\x03\xd4\x42\xd5\x20\x95\x01\xd9\x09\x51\x30\x00\xba\x9c\x68\xa2\xa5\x1f\xed\x99\xd6\x4f\x3b\xa9\x6e\x20\x1f\x5d\x5c\xff\xf2\x61\x9d\x26\x8a\x8b\x3b\x6e\xfc\xce\x76\x3e\xc4\x7e\x1c\xfb\xe8\x66\x9f\xfa\x0c\x3e\x9a\x1d\xd0\xc9\xf6\xbe\xc3\x6c\x5b\x54\x6c\x5d\xc5\xef\xe3\x1c\x94\x04\xae\x64\x23\x5a\x6e\x40\xe3\x41\x54\x1c\x53\x46\xa3\x34\xb6\x37\x12\x6e\xf1\x09\xbe\x93\x72\xd0\xd8\xa0\x46\xc9\xf1\xe1\xeb\xe3\x90\x05\xf7\xea\x69\xb0\x97\x85\xd2\xde\x9c\xe5\x25\xfb\x08\x00\x00\xff\xff\xb6\x31\x2b\x32\x70\x01\x00\x00") - -func _1539249977_update_ratchet_infoUpSqlBytes() ([]byte, error) { - return bindataRead( - __1539249977_update_ratchet_infoUpSql, - "1539249977_update_ratchet_info.up.sql", - ) -} - -func _1539249977_update_ratchet_infoUpSql() (*asset, error) { - bytes, err := _1539249977_update_ratchet_infoUpSqlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "1539249977_update_ratchet_info.up.sql", size: 368, mode: os.FileMode(0644), modTime: time.Unix(1574354941, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xc, 0x8e, 0xbf, 0x6f, 0xa, 0xc0, 0xe1, 0x3c, 0x42, 0x28, 0x88, 0x1d, 0xdb, 0xba, 0x1c, 0x83, 0xec, 0xba, 0xd3, 0x5f, 0x5c, 0x77, 0x5e, 0xa7, 0x46, 0x36, 0xec, 0x69, 0xa, 0x4b, 0x17, 0x79}} - return a, nil -} - -var __1540715431_add_versionDownSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x72\xf4\x09\x71\x0d\x52\x08\x71\x74\xf2\x71\x55\xc8\x4e\xad\x2c\x56\x70\x09\xf2\x0f\x50\x70\xf6\xf7\x09\xf5\xf5\x53\x28\x4e\x2d\x2e\xce\xcc\xcf\x8b\xcf\x4c\xb1\xe6\x42\x56\x08\x15\x47\x55\x0c\xd2\x1d\x9f\x9c\x5f\x9a\x57\x82\xaa\x38\xa9\x34\x2f\x25\x27\x15\x55\x6d\x59\x6a\x11\xc8\x00\x6b\x2e\x40\x00\x00\x00\xff\xff\xda\x5d\x80\x2d\x7f\x00\x00\x00") - -func _1540715431_add_versionDownSqlBytes() ([]byte, error) { - return bindataRead( - __1540715431_add_versionDownSql, - "1540715431_add_version.down.sql", - ) -} - -func _1540715431_add_versionDownSql() (*asset, error) { - bytes, err := _1540715431_add_versionDownSqlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "1540715431_add_version.down.sql", size: 127, mode: os.FileMode(0644), modTime: time.Unix(1574354941, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xf5, 0x9, 0x4, 0xe3, 0x76, 0x2e, 0xb8, 0x9, 0x23, 0xf0, 0x70, 0x93, 0xc4, 0x50, 0xe, 0x9d, 0x84, 0x22, 0x8c, 0x94, 0xd3, 0x24, 0x9, 0x9a, 0xc1, 0xa1, 0x48, 0x45, 0xfd, 0x40, 0x6e, 0xe6}} - return a, nil -} - -var __1540715431_add_versionUpSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x8c\xcd\xb1\x0e\x02\x21\x0c\xc6\xf1\xdd\xa7\xf8\x1e\xc1\xdd\x09\xa4\x67\x4c\x7a\x90\x90\x32\x93\xe8\x31\x5c\x54\x2e\x8a\x98\xf8\xf6\x06\xe3\xc2\xa2\xae\x6d\xff\xbf\x1a\x62\x12\xc2\xe0\xdd\x88\x53\x7a\x96\xcd\x4a\xb1\x90\x87\x28\xcd\xf4\x9e\x40\x19\x83\xad\xe3\x30\x5a\x94\x74\x8d\xb9\x5e\xb0\xb7\x42\x3b\xf2\xb0\x4e\x60\x03\x33\x0c\x0d\x2a\xb0\x60\xfd\xab\x2f\x65\x5e\x72\x9c\x27\x68\x76\xba\x3f\xfe\x2c\xbb\xa0\x01\xf1\xb8\xd4\x7c\xff\xfb\xe7\xa1\xe6\xe9\x9c\x3a\xe5\x91\x6e\x4d\xfe\x4a\xbc\x02\x00\x00\xff\xff\x0e\x27\x2c\x52\x09\x01\x00\x00") - -func _1540715431_add_versionUpSqlBytes() ([]byte, error) { - return bindataRead( - __1540715431_add_versionUpSql, - "1540715431_add_version.up.sql", - ) -} - -func _1540715431_add_versionUpSql() (*asset, error) { - bytes, err := _1540715431_add_versionUpSqlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "1540715431_add_version.up.sql", size: 265, mode: os.FileMode(0644), modTime: time.Unix(1574354941, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xc7, 0x4c, 0x36, 0x96, 0xdf, 0x16, 0x10, 0xa6, 0x27, 0x1a, 0x79, 0x8b, 0x42, 0x83, 0x23, 0xc, 0x7e, 0xb6, 0x3d, 0x2, 0xda, 0xa4, 0xb4, 0xd, 0x27, 0x55, 0xba, 0xdc, 0xb2, 0x88, 0x8f, 0xa6}} - return a, nil -} - -var __1541164797_add_installationsDownSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x72\x09\xf2\x0f\x50\x08\x71\x74\xf2\x71\x55\xc8\xcc\x2b\x2e\x49\xcc\xc9\x49\x2c\xc9\xcc\xcf\x2b\xb6\xe6\x02\x04\x00\x00\xff\xff\xd8\xbf\x14\x75\x1a\x00\x00\x00") - -func _1541164797_add_installationsDownSqlBytes() ([]byte, error) { - return bindataRead( - __1541164797_add_installationsDownSql, - "1541164797_add_installations.down.sql", - ) -} - -func _1541164797_add_installationsDownSql() (*asset, error) { - bytes, err := _1541164797_add_installationsDownSqlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "1541164797_add_installations.down.sql", size: 26, mode: os.FileMode(0644), modTime: time.Unix(1574354941, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xf5, 0xfd, 0xe6, 0xd8, 0xca, 0x3b, 0x38, 0x18, 0xee, 0x0, 0x5f, 0x36, 0x9e, 0x1e, 0xd, 0x19, 0x3e, 0xb4, 0x73, 0x53, 0xe9, 0xa5, 0xac, 0xdd, 0xa1, 0x2f, 0xc7, 0x6c, 0xa8, 0xd9, 0xa, 0x88}} - return a, nil -} - -var __1541164797_add_installationsUpSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x5c\xce\xb1\x6a\xc3\x30\x14\x85\xe1\xdd\x4f\x71\x46\x1b\xbc\x74\xee\x24\xc9\xd7\x46\x70\xb9\x6a\x5d\x09\xba\x05\x05\x6b\x10\xd8\x4a\xc0\x5a\xf2\xf6\xc1\x43\x20\xce\xfc\x7f\x70\x8e\x99\x49\x79\x82\x57\x9a\x09\xb9\xec\x35\xae\x6b\xac\xf9\x56\x76\xa0\x6d\x80\xbc\xa4\x52\x73\x7d\x40\xb3\xd3\x10\xe7\x21\x81\xb9\x3f\xca\x1b\xbe\xe4\x05\x9e\xfe\xfd\x09\xd4\xbc\xa5\xbd\xc6\xed\x8e\x20\x7f\x76\x12\x1a\xa0\xed\x04\x2b\x67\x96\x4a\xbc\xae\x69\x81\x76\x8e\x49\x09\x06\x1a\x55\x60\x8f\xaf\x23\x06\xb1\xbf\x81\xda\xd7\x8b\xfe\x73\xb5\x83\x13\x18\x27\x23\x5b\xe3\x31\xd3\x0f\x2b\x43\x4d\xf7\xdd\x3c\x03\x00\x00\xff\xff\x28\x14\xac\x9d\xd8\x00\x00\x00") - -func _1541164797_add_installationsUpSqlBytes() ([]byte, error) { - return bindataRead( - __1541164797_add_installationsUpSql, - "1541164797_add_installations.up.sql", - ) -} - -func _1541164797_add_installationsUpSql() (*asset, error) { - bytes, err := _1541164797_add_installationsUpSqlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "1541164797_add_installations.up.sql", size: 216, mode: os.FileMode(0644), modTime: time.Unix(1574354941, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x2d, 0x18, 0x26, 0xb8, 0x88, 0x47, 0xdb, 0x83, 0xcc, 0xb6, 0x9d, 0x1c, 0x1, 0xae, 0x2f, 0xde, 0x97, 0x82, 0x3, 0x30, 0xa8, 0x63, 0xa1, 0x78, 0x4b, 0xa5, 0x9, 0x8, 0x75, 0xa2, 0x57, 0x81}} - return a, nil -} - -var __1558084410_add_secretDownSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x72\x09\xf2\x0f\x50\x08\x71\x74\xf2\x71\x55\x28\x4e\x4d\x2e\x4a\x2d\x89\xcf\xcc\x2b\x2e\x49\xcc\xc9\x49\x2c\xc9\xcc\xcf\x8b\xcf\x4c\x29\xb6\xe6\xc2\x50\x53\x6c\xcd\x05\x08\x00\x00\xff\xff\xd3\xcd\x41\x83\x38\x00\x00\x00") - -func _1558084410_add_secretDownSqlBytes() ([]byte, error) { - return bindataRead( - __1558084410_add_secretDownSql, - "1558084410_add_secret.down.sql", - ) -} - -func _1558084410_add_secretDownSql() (*asset, error) { - bytes, err := _1558084410_add_secretDownSqlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "1558084410_add_secret.down.sql", size: 56, mode: os.FileMode(0644), modTime: time.Unix(1574354941, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x49, 0xb, 0x65, 0xdf, 0x59, 0xbf, 0xe9, 0x5, 0x5b, 0x6f, 0xd5, 0x3a, 0xb7, 0x57, 0xe8, 0x78, 0x38, 0x73, 0x53, 0x57, 0xf7, 0x24, 0x4, 0xe4, 0xa2, 0x49, 0x22, 0xa2, 0xc6, 0xfd, 0x80, 0xa4}} - return a, nil -} - -var __1558084410_add_secretUpSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x74\x50\xcf\x0a\x82\x30\x1c\xbe\xef\x29\xbe\xa3\x82\x6f\xd0\x49\xc7\x4f\x19\xad\xdf\x6a\x4d\xc8\x93\x48\xf3\x30\x10\x83\xdc\xa5\xb7\x0f\x23\x45\xa1\xce\xdf\xff\x4f\x5a\xca\x1d\xc1\xe5\x85\x26\x4c\xfd\xfd\xd9\xc7\x09\x89\x00\x82\xef\xc7\x18\xe2\x0b\x85\x36\x05\xd8\x38\x70\xad\x35\xce\x56\x9d\x72\xdb\xe0\x48\x0d\x0c\x43\x1a\x2e\xb5\x92\x0e\xaa\x62\x63\x29\x13\xf8\x9a\xec\x65\x22\x3d\x08\xf1\x23\xaa\x0d\xe3\x14\xbb\x61\xe8\x62\x78\x8c\x6d\xf0\x4b\x34\x1c\xdd\xdc\xaa\xce\x36\x75\xda\xe0\xf7\xd6\x33\x58\xb3\xba\xd4\x94\x04\x9f\x6d\x79\xe9\x9f\x82\xa5\xb1\xa4\x2a\xfe\x4c\x48\x76\x7c\x4b\x25\x59\x62\x49\xd7\xe5\x8a\x15\x4f\xe7\x09\xef\x00\x00\x00\xff\xff\xa6\xbb\x2c\x23\x2d\x01\x00\x00") - -func _1558084410_add_secretUpSqlBytes() ([]byte, error) { - return bindataRead( - __1558084410_add_secretUpSql, - "1558084410_add_secret.up.sql", - ) -} - -func _1558084410_add_secretUpSql() (*asset, error) { - bytes, err := _1558084410_add_secretUpSqlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "1558084410_add_secret.up.sql", size: 301, mode: os.FileMode(0644), modTime: time.Unix(1574354941, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xf5, 0x32, 0x36, 0x8e, 0x47, 0xb0, 0x8f, 0xc1, 0xc6, 0xf7, 0xc6, 0x9f, 0x2d, 0x44, 0x75, 0x2b, 0x26, 0xec, 0x6, 0xa0, 0x7b, 0xa5, 0xbd, 0xc8, 0x76, 0x8a, 0x82, 0x68, 0x2, 0x42, 0xb5, 0xf4}} - return a, nil -} - -var __1558588866_add_versionDownSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x72\xf4\x09\x71\x0d\x52\x08\x71\x74\xf2\x71\x55\xc8\xcc\x2b\x2e\x49\xcc\xc9\x49\x2c\xc9\xcc\xcf\x2b\x56\x70\x09\xf2\x0f\x50\x70\xf6\xf7\x09\xf5\xf5\x53\x28\x4b\x2d\x2a\xce\xcc\xcf\xb3\xe6\x02\x04\x00\x00\xff\xff\xdf\x6b\x9f\xbb\x2f\x00\x00\x00") - -func _1558588866_add_versionDownSqlBytes() ([]byte, error) { - return bindataRead( - __1558588866_add_versionDownSql, - "1558588866_add_version.down.sql", - ) -} - -func _1558588866_add_versionDownSql() (*asset, error) { - bytes, err := _1558588866_add_versionDownSqlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "1558588866_add_version.down.sql", size: 47, mode: os.FileMode(0644), modTime: time.Unix(1574354941, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xde, 0x52, 0x34, 0x3c, 0x46, 0x4a, 0xf0, 0x72, 0x47, 0x6f, 0x49, 0x5c, 0xc7, 0xf9, 0x32, 0xce, 0xc4, 0x3d, 0xfd, 0x61, 0xa1, 0x8b, 0x8f, 0xf2, 0x31, 0x34, 0xde, 0x15, 0x49, 0xa6, 0xde, 0xb9}} - return a, nil -} - -var __1558588866_add_versionUpSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x72\xf4\x09\x71\x0d\x52\x08\x71\x74\xf2\x71\x55\xc8\xcc\x2b\x2e\x49\xcc\xc9\x49\x2c\xc9\xcc\xcf\x2b\x56\x70\x74\x71\x51\x28\x4b\x2d\x2a\xce\xcc\xcf\x53\xf0\xf4\x0b\x71\x75\x77\x0d\x52\x70\x71\x75\x73\x0c\xf5\x09\x51\x30\xb0\xe6\x02\x04\x00\x00\xff\xff\x14\x7b\x07\xb5\x39\x00\x00\x00") - -func _1558588866_add_versionUpSqlBytes() ([]byte, error) { - return bindataRead( - __1558588866_add_versionUpSql, - "1558588866_add_version.up.sql", - ) -} - -func _1558588866_add_versionUpSql() (*asset, error) { - bytes, err := _1558588866_add_versionUpSqlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "1558588866_add_version.up.sql", size: 57, mode: os.FileMode(0644), modTime: time.Unix(1574354941, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x2a, 0xea, 0x64, 0x39, 0x61, 0x20, 0x83, 0x83, 0xb, 0x2e, 0x79, 0x64, 0xb, 0x53, 0xfa, 0xfe, 0xc6, 0xf7, 0x67, 0x42, 0xd3, 0x4f, 0xdc, 0x7e, 0x30, 0x32, 0xe8, 0x14, 0x41, 0xe9, 0xe7, 0x3b}} - return a, nil -} - -var __1559627659_add_contact_codeDownSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x72\x09\xf2\x0f\x50\x08\x71\x74\xf2\x71\x55\x48\xce\xcf\x2b\x49\x4c\x2e\x89\x4f\xce\x4f\x49\x8d\x4f\xce\xcf\x4b\xcb\x4c\xb7\xe6\x02\x04\x00\x00\xff\xff\x73\x7b\x50\x80\x20\x00\x00\x00") - -func _1559627659_add_contact_codeDownSqlBytes() ([]byte, error) { - return bindataRead( - __1559627659_add_contact_codeDownSql, - "1559627659_add_contact_code.down.sql", - ) -} - -func _1559627659_add_contact_codeDownSql() (*asset, error) { - bytes, err := _1559627659_add_contact_codeDownSqlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "1559627659_add_contact_code.down.sql", size: 32, mode: os.FileMode(0644), modTime: time.Unix(1574354941, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x5d, 0x64, 0x6d, 0xce, 0x24, 0x42, 0x20, 0x8d, 0x4f, 0x37, 0xaa, 0x9d, 0xc, 0x57, 0x98, 0xc1, 0xd1, 0x1a, 0x34, 0xcd, 0x9f, 0x8f, 0x34, 0x86, 0xb3, 0xd3, 0xdc, 0xf1, 0x7d, 0xe5, 0x1b, 0x6e}} - return a, nil -} - -var __1559627659_add_contact_codeUpSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x6c\xce\xc1\x8e\x82\x30\x18\x04\xe0\x7b\x9f\x62\x6e\x40\xb2\x07\xf6\xcc\xa9\xbb\xfb\xaf\x21\xd6\x62\x4a\x31\x72\x22\xb5\xa0\x34\x21\x45\xa1\xf8\xfc\x06\x13\xe3\xc5\xeb\xe4\x9b\xc9\xfc\x2a\xe2\x9a\xa0\xf9\x8f\x20\xd8\xd1\x07\x63\x43\x63\xc7\xb6\x6b\xec\xe8\xcf\xee\x82\x98\x01\x58\xbc\xbb\x2d\xcf\x68\x0e\x93\x71\x3e\xe0\x6e\x26\xdb\x9b\x29\xfe\x4e\x20\x0b\x0d\x59\x09\x81\xbd\xca\x77\x5c\xd5\xd8\x52\x8d\x3f\xfa\xe7\x95\xd0\x88\x8e\xd1\x17\x03\x06\x33\x87\xe6\xba\x9c\x06\x37\xf7\x5d\x8b\x5c\x6a\xda\x90\x7a\x57\x5f\x3c\x65\x49\xc6\x58\x2e\x4b\x52\x7a\x55\xc5\xc7\x4f\x07\x2e\x2a\x2a\x11\xaf\xe3\x48\x93\x8c\x3d\x02\x00\x00\xff\xff\xdc\x7c\x0c\xd3\xc6\x00\x00\x00") - -func _1559627659_add_contact_codeUpSqlBytes() ([]byte, error) { - return bindataRead( - __1559627659_add_contact_codeUpSql, - "1559627659_add_contact_code.up.sql", - ) -} - -func _1559627659_add_contact_codeUpSql() (*asset, error) { - bytes, err := _1559627659_add_contact_codeUpSqlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "1559627659_add_contact_code.up.sql", size: 198, mode: os.FileMode(0644), modTime: time.Unix(1574354941, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x16, 0xf6, 0xc2, 0x62, 0x9c, 0xd2, 0xc9, 0x1e, 0xd8, 0xea, 0xaa, 0xea, 0x95, 0x8f, 0x89, 0x6a, 0x85, 0x5d, 0x9d, 0x99, 0x78, 0x3c, 0x90, 0x66, 0x99, 0x3e, 0x4b, 0x19, 0x62, 0xfb, 0x31, 0x4d}} - return a, nil -} - -var __1561368210_add_installation_metadataDownSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x72\x09\xf2\x0f\x50\x08\x71\x74\xf2\x71\x55\xc8\xcc\x2b\x2e\x49\xcc\xc9\x49\x2c\xc9\xcc\xcf\x2b\x8e\xcf\x4d\x2d\x49\x4c\x49\x2c\x49\xb4\xe6\x02\x04\x00\x00\xff\xff\x03\x72\x7f\x08\x23\x00\x00\x00") - -func _1561368210_add_installation_metadataDownSqlBytes() ([]byte, error) { - return bindataRead( - __1561368210_add_installation_metadataDownSql, - "1561368210_add_installation_metadata.down.sql", - ) -} - -func _1561368210_add_installation_metadataDownSql() (*asset, error) { - bytes, err := _1561368210_add_installation_metadataDownSqlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "1561368210_add_installation_metadata.down.sql", size: 35, mode: os.FileMode(0644), modTime: time.Unix(1574354941, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xa8, 0xde, 0x3f, 0xd2, 0x4a, 0x50, 0x98, 0x56, 0xe3, 0xc0, 0xcd, 0x9d, 0xb0, 0x34, 0x3b, 0xe5, 0x62, 0x18, 0xb5, 0x20, 0xc9, 0x3e, 0xdc, 0x6a, 0x40, 0x36, 0x66, 0xea, 0x51, 0x8c, 0x71, 0xf5}} - return a, nil -} - -var __1561368210_add_installation_metadataUpSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x7c\xce\xc1\x8a\x83\x30\x10\xc6\xf1\xbb\x4f\xf1\xdd\x54\xf0\x0d\xf6\x14\xb3\x23\x08\x21\xd9\x95\x04\x7a\x93\x60\x52\x08\xd5\x58\xe8\x50\xf0\xed\x8b\x87\x42\xed\xc1\xeb\xcc\xef\x83\xbf\x1c\x48\x58\x82\x15\xad\x22\xa4\xfc\x60\x3f\xcf\x9e\xd3\x9a\xc7\x25\xb2\x0f\x9e\x3d\x50\x15\x40\x0a\x31\x73\xe2\x0d\xad\x32\x2d\xb4\xb1\xd0\x4e\xa9\x66\xff\x7c\x8e\x52\x80\xa5\x8b\x3d\x80\xec\x97\x78\xbc\xe2\x97\x3a\xe1\x94\x45\x59\xee\x20\xc4\x67\x9a\xe2\xc8\xdb\xfd\xdc\x5d\xa7\x65\xe4\xf5\x16\xf3\xa9\x72\xba\xff\x77\x54\xbd\x83\x9b\xef\xc0\x1a\x46\x43\x1a\xdd\xa9\x5e\x5a\x0c\xf4\xa7\x84\xa4\xa2\xfe\x29\x5e\x01\x00\x00\xff\xff\x5d\x6f\xe6\xd3\x0b\x01\x00\x00") - -func _1561368210_add_installation_metadataUpSqlBytes() ([]byte, error) { - return bindataRead( - __1561368210_add_installation_metadataUpSql, - "1561368210_add_installation_metadata.up.sql", - ) -} - -func _1561368210_add_installation_metadataUpSql() (*asset, error) { - bytes, err := _1561368210_add_installation_metadataUpSqlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "1561368210_add_installation_metadata.up.sql", size: 267, mode: os.FileMode(0644), modTime: time.Unix(1574354941, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xb4, 0x71, 0x8f, 0x29, 0xb1, 0xaa, 0xd6, 0xd1, 0x8c, 0x17, 0xef, 0x6c, 0xd5, 0x80, 0xb8, 0x2c, 0xc3, 0xfe, 0xec, 0x24, 0x4d, 0xc8, 0x25, 0xd3, 0xb4, 0xcd, 0xa9, 0xac, 0x63, 0x61, 0xb2, 0x9c}} - return a, nil -} - -var _docGo = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x84\x8f\xbb\x6e\xc3\x30\x0c\x45\x77\x7f\xc5\x45\x96\x2c\xb5\xb4\x74\xea\xd6\xb1\x7b\x7f\x80\x91\x68\x89\x88\x1e\xae\x48\xe7\xf1\xf7\x85\xd3\x02\xcd\xd6\xf5\x00\xe7\xf0\xd2\x7b\x7c\x66\x51\x2c\x52\x18\xa2\x68\x1c\x58\x95\xc6\x1d\x27\x0e\xb4\x29\xe3\x90\xc4\xf2\x76\x72\xa1\x57\xaf\x46\xb6\xe9\x2c\xd5\x57\x49\x83\x8c\xfd\xe5\xf5\x30\x79\x8f\x40\xed\x68\xc8\xd4\x62\xe1\x47\x4b\xa1\x46\xc3\xa4\x25\x5c\xc5\x32\x08\xeb\xe0\x45\x6e\x0e\xef\x86\xc2\xa4\x06\xcb\x64\x47\x85\x65\x46\x20\xe5\x3d\xb3\xf4\x81\xd4\xe7\x93\xb4\x48\x46\x6e\x47\x1f\xcb\x13\xd9\x17\x06\x2a\x85\x23\x96\xd1\xeb\xc3\x55\xaa\x8c\x28\x83\x83\xf5\x71\x7f\x01\xa9\xb2\xa1\x51\x65\xdd\xfd\x4c\x17\x46\xeb\xbf\xe7\x41\x2d\xfe\xff\x11\xae\x7d\x9c\x15\xa4\xe0\xdb\xca\xc1\x38\xba\x69\x5a\x29\x9c\x29\x31\xf4\xab\x88\xf1\x34\x79\x9f\xfa\x5b\xe2\xc6\xbb\xf5\xbc\x71\x5e\xcf\x09\x3f\x35\xe9\x4d\x31\x77\x38\xe7\xff\x80\x4b\x1d\x6e\xfa\x0e\x00\x00\xff\xff\x9d\x60\x3d\x88\x79\x01\x00\x00") - -func docGoBytes() ([]byte, error) { - return bindataRead( - _docGo, - "doc.go", - ) -} - -func docGo() (*asset, error) { - bytes, err := docGoBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "doc.go", size: 377, mode: os.FileMode(0644), modTime: time.Unix(1574354941, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xef, 0xaf, 0xdf, 0xcf, 0x65, 0xae, 0x19, 0xfc, 0x9d, 0x29, 0xc1, 0x91, 0xaf, 0xb5, 0xd5, 0xb1, 0x56, 0xf3, 0xee, 0xa8, 0xba, 0x13, 0x65, 0xdb, 0xab, 0xcf, 0x4e, 0xac, 0x92, 0xe9, 0x60, 0xf1}} - return a, nil -} - -// Asset loads and returns the asset for the given name. -// It returns an error if the asset could not be found or -// could not be loaded. -func Asset(name string) ([]byte, error) { - canonicalName := strings.Replace(name, "\\", "/", -1) - if f, ok := _bindata[canonicalName]; ok { - a, err := f() - if err != nil { - return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err) - } - return a.bytes, nil - } - return nil, fmt.Errorf("Asset %s not found", name) -} - -// AssetString returns the asset contents as a string (instead of a []byte). -func AssetString(name string) (string, error) { - data, err := Asset(name) - return string(data), err -} - -// MustAsset is like Asset but panics when Asset would return an error. -// It simplifies safe initialization of global variables. -func MustAsset(name string) []byte { - a, err := Asset(name) - if err != nil { - panic("asset: Asset(" + name + "): " + err.Error()) - } - - return a -} - -// MustAssetString is like AssetString but panics when Asset would return an -// error. It simplifies safe initialization of global variables. -func MustAssetString(name string) string { - return string(MustAsset(name)) -} - -// AssetInfo loads and returns the asset info for the given name. -// It returns an error if the asset could not be found or -// could not be loaded. -func AssetInfo(name string) (os.FileInfo, error) { - canonicalName := strings.Replace(name, "\\", "/", -1) - if f, ok := _bindata[canonicalName]; ok { - a, err := f() - if err != nil { - return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err) - } - return a.info, nil - } - return nil, fmt.Errorf("AssetInfo %s not found", name) -} - -// AssetDigest returns the digest of the file with the given name. It returns an -// error if the asset could not be found or the digest could not be loaded. -func AssetDigest(name string) ([sha256.Size]byte, error) { - canonicalName := strings.Replace(name, "\\", "/", -1) - if f, ok := _bindata[canonicalName]; ok { - a, err := f() - if err != nil { - return [sha256.Size]byte{}, fmt.Errorf("AssetDigest %s can't read by error: %v", name, err) - } - return a.digest, nil - } - return [sha256.Size]byte{}, fmt.Errorf("AssetDigest %s not found", name) -} - -// Digests returns a map of all known files and their checksums. -func Digests() (map[string][sha256.Size]byte, error) { - mp := make(map[string][sha256.Size]byte, len(_bindata)) - for name := range _bindata { - a, err := _bindata[name]() - if err != nil { - return nil, err - } - mp[name] = a.digest - } - return mp, nil -} - -// AssetNames returns the names of the assets. -func AssetNames() []string { - names := make([]string, 0, len(_bindata)) - for name := range _bindata { - names = append(names, name) - } - return names -} - -// _bindata is a table, holding each asset generator, mapped to its name. -var _bindata = map[string]func() (*asset, error){ - "1536754952_initial_schema.down.sql": _1536754952_initial_schemaDownSql, - - "1536754952_initial_schema.up.sql": _1536754952_initial_schemaUpSql, - - "1539249977_update_ratchet_info.down.sql": _1539249977_update_ratchet_infoDownSql, - - "1539249977_update_ratchet_info.up.sql": _1539249977_update_ratchet_infoUpSql, - - "1540715431_add_version.down.sql": _1540715431_add_versionDownSql, - - "1540715431_add_version.up.sql": _1540715431_add_versionUpSql, - - "1541164797_add_installations.down.sql": _1541164797_add_installationsDownSql, - - "1541164797_add_installations.up.sql": _1541164797_add_installationsUpSql, - - "1558084410_add_secret.down.sql": _1558084410_add_secretDownSql, - - "1558084410_add_secret.up.sql": _1558084410_add_secretUpSql, - - "1558588866_add_version.down.sql": _1558588866_add_versionDownSql, - - "1558588866_add_version.up.sql": _1558588866_add_versionUpSql, - - "1559627659_add_contact_code.down.sql": _1559627659_add_contact_codeDownSql, - - "1559627659_add_contact_code.up.sql": _1559627659_add_contact_codeUpSql, - - "1561368210_add_installation_metadata.down.sql": _1561368210_add_installation_metadataDownSql, - - "1561368210_add_installation_metadata.up.sql": _1561368210_add_installation_metadataUpSql, - - "doc.go": docGo, -} - -// AssetDir returns the file names below a certain -// directory embedded in the file by go-bindata. -// For example if you run go-bindata on data/... and data contains the -// following hierarchy: -// data/ -// foo.txt -// img/ -// a.png -// b.png -// then AssetDir("data") would return []string{"foo.txt", "img"}, -// AssetDir("data/img") would return []string{"a.png", "b.png"}, -// AssetDir("foo.txt") and AssetDir("notexist") would return an error, and -// AssetDir("") will return []string{"data"}. -func AssetDir(name string) ([]string, error) { - node := _bintree - if len(name) != 0 { - canonicalName := strings.Replace(name, "\\", "/", -1) - pathList := strings.Split(canonicalName, "/") - for _, p := range pathList { - node = node.Children[p] - if node == nil { - return nil, fmt.Errorf("Asset %s not found", name) - } - } - } - if node.Func != nil { - return nil, fmt.Errorf("Asset %s not found", name) - } - rv := make([]string, 0, len(node.Children)) - for childName := range node.Children { - rv = append(rv, childName) - } - return rv, nil -} - -type bintree struct { - Func func() (*asset, error) - Children map[string]*bintree -} - -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{}}, -}} - -// RestoreAsset restores an asset under the given directory. -func RestoreAsset(dir, name string) error { - data, err := Asset(name) - if err != nil { - return err - } - info, err := AssetInfo(name) - if err != nil { - return err - } - err = os.MkdirAll(_filePath(dir, filepath.Dir(name)), os.FileMode(0755)) - if err != nil { - return err - } - err = ioutil.WriteFile(_filePath(dir, name), data, info.Mode()) - if err != nil { - return err - } - return os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime()) -} - -// RestoreAssets restores an asset under the given directory recursively. -func RestoreAssets(dir, name string) error { - children, err := AssetDir(name) - // File - if err != nil { - return RestoreAsset(dir, name) - } - // Dir - for _, child := range children { - err = RestoreAssets(dir, filepath.Join(name, child)) - if err != nil { - return err - } - } - return nil -} - -func _filePath(dir, name string) string { - canonicalName := strings.Replace(name, "\\", "/", -1) - return filepath.Join(append([]string{dir}, strings.Split(canonicalName, "/")...)...) -} diff --git a/vendor/github.com/status-im/status-go/protocol/encryption/multidevice/multidevice.go b/vendor/github.com/status-im/status-go/protocol/encryption/multidevice/multidevice.go deleted file mode 100644 index 86d95dc8a..000000000 --- a/vendor/github.com/status-im/status-go/protocol/encryption/multidevice/multidevice.go +++ /dev/null @@ -1,120 +0,0 @@ -package multidevice - -import ( - "crypto/ecdsa" - "database/sql" - - "github.com/status-im/status-go/eth-node/crypto" -) - -type InstallationMetadata struct { - // The name of the device - Name string `json:"name"` - // The type of device - DeviceType string `json:"deviceType"` - // The FCMToken for mobile devices - FCMToken string `json:"fcmToken"` -} - -type Installation struct { - // Identity is the string identity of the owner - Identity string `json:"identity"` - // The installation-id of the device - ID string `json:"id"` - // The last known protocol version of the device - Version uint32 `json:"version"` - // Enabled is whether the installation is enabled - Enabled bool `json:"enabled"` - // Timestamp is the last time we saw this device - Timestamp int64 `json:"timestamp"` - // InstallationMetadata - InstallationMetadata *InstallationMetadata `json:"metadata"` -} - -type Config struct { - MaxInstallations int - ProtocolVersion uint32 - InstallationID string -} - -type Multidevice struct { - persistence *sqlitePersistence - config *Config -} - -func New(db *sql.DB, config *Config) *Multidevice { - return &Multidevice{ - config: config, - persistence: newSQLitePersistence(db), - } -} - -func (s *Multidevice) InstallationID() string { - return s.config.InstallationID -} - -func (s *Multidevice) GetActiveInstallations(identity *ecdsa.PublicKey) ([]*Installation, error) { - identityC := crypto.CompressPubkey(identity) - return s.persistence.GetActiveInstallations(s.config.MaxInstallations, identityC) -} - -func (s *Multidevice) GetOurActiveInstallations(identity *ecdsa.PublicKey) ([]*Installation, error) { - identityC := crypto.CompressPubkey(identity) - installations, err := s.persistence.GetActiveInstallations(s.config.MaxInstallations-1, identityC) - if err != nil { - return nil, err - } - - installations = append(installations, &Installation{ - ID: s.config.InstallationID, - Version: s.config.ProtocolVersion, - }) - - return installations, nil -} - -func (s *Multidevice) GetOurInstallations(identity *ecdsa.PublicKey) ([]*Installation, error) { - var found bool - identityC := crypto.CompressPubkey(identity) - installations, err := s.persistence.GetInstallations(identityC) - if err != nil { - return nil, err - } - - for _, installation := range installations { - if installation.ID == s.config.InstallationID { - found = true - installation.Enabled = true - installation.Version = s.config.ProtocolVersion - } - - } - if !found { - installations = append(installations, &Installation{ - ID: s.config.InstallationID, - Enabled: true, - Version: s.config.ProtocolVersion, - }) - } - - return installations, nil -} - -func (s *Multidevice) AddInstallations(identity []byte, timestamp int64, installations []*Installation, defaultEnabled bool) ([]*Installation, error) { - return s.persistence.AddInstallations(identity, timestamp, installations, defaultEnabled) -} - -func (s *Multidevice) SetInstallationMetadata(identity *ecdsa.PublicKey, installationID string, metadata *InstallationMetadata) error { - identityC := crypto.CompressPubkey(identity) - return s.persistence.SetInstallationMetadata(identityC, installationID, metadata) -} - -func (s *Multidevice) EnableInstallation(identity *ecdsa.PublicKey, installationID string) error { - identityC := crypto.CompressPubkey(identity) - return s.persistence.EnableInstallation(identityC, installationID) -} - -func (s *Multidevice) DisableInstallation(myIdentityKey *ecdsa.PublicKey, installationID string) error { - myIdentityKeyC := crypto.CompressPubkey(myIdentityKey) - return s.persistence.DisableInstallation(myIdentityKeyC, installationID) -} diff --git a/vendor/github.com/status-im/status-go/protocol/encryption/multidevice/persistence.go b/vendor/github.com/status-im/status-go/protocol/encryption/multidevice/persistence.go deleted file mode 100644 index 6acf93837..000000000 --- a/vendor/github.com/status-im/status-go/protocol/encryption/multidevice/persistence.go +++ /dev/null @@ -1,264 +0,0 @@ -package multidevice - -import "database/sql" - -type sqlitePersistence struct { - db *sql.DB -} - -func newSQLitePersistence(db *sql.DB) *sqlitePersistence { - return &sqlitePersistence{db: db} -} - -// GetActiveInstallations returns the active installations for a given identity -func (s *sqlitePersistence) GetActiveInstallations(maxInstallations int, identity []byte) ([]*Installation, error) { - stmt, err := s.db.Prepare(`SELECT installation_id, version - FROM installations - WHERE enabled = 1 AND identity = ? - ORDER BY timestamp DESC - LIMIT ?`) - if err != nil { - return nil, err - } - - var installations []*Installation - rows, err := stmt.Query(identity, maxInstallations) - if err != nil { - return nil, err - } - - for rows.Next() { - var ( - installationID string - version uint32 - ) - err = rows.Scan( - &installationID, - &version, - ) - if err != nil { - return nil, err - } - installations = append(installations, &Installation{ - ID: installationID, - Version: version, - Enabled: true, - }) - - } - - return installations, nil - -} - -// GetInstallations returns all the installations for a given identity -// we both return the installations & the metadata -// metadata is currently stored in a separate table, as in some cases we -// might have metadata for a device, but no other information on the device -func (s *sqlitePersistence) GetInstallations(identity []byte) ([]*Installation, error) { - installationMap := make(map[string]*Installation) - var installations []*Installation - - // We query both tables as sqlite does not support full outer joins - installationsStmt, err := s.db.Prepare(`SELECT installation_id, version, enabled, timestamp FROM installations WHERE identity = ?`) - if err != nil { - return nil, err - } - defer installationsStmt.Close() - - installationRows, err := installationsStmt.Query(identity) - if err != nil { - return nil, err - } - - for installationRows.Next() { - var installation Installation - err = installationRows.Scan( - &installation.ID, - &installation.Version, - &installation.Enabled, - &installation.Timestamp, - ) - if err != nil { - return nil, err - } - // We initialized to empty in this case as we want to - // return metadata as well in this endpoint, but not in others - installation.InstallationMetadata = &InstallationMetadata{} - installationMap[installation.ID] = &installation - } - - metadataStmt, err := s.db.Prepare(`SELECT installation_id, name, device_type, fcm_token FROM installation_metadata WHERE identity = ?`) - if err != nil { - return nil, err - } - defer metadataStmt.Close() - - metadataRows, err := metadataStmt.Query(identity) - if err != nil { - return nil, err - } - - for metadataRows.Next() { - var ( - installationID string - name sql.NullString - deviceType sql.NullString - fcmToken sql.NullString - installation *Installation - ) - err = metadataRows.Scan( - &installationID, - &name, - &deviceType, - &fcmToken, - ) - if err != nil { - return nil, err - } - if _, ok := installationMap[installationID]; ok { - installation = installationMap[installationID] - } else { - installation = &Installation{ID: installationID} - } - installation.InstallationMetadata = &InstallationMetadata{ - Name: name.String, - DeviceType: deviceType.String, - FCMToken: fcmToken.String, - } - installationMap[installationID] = installation - } - - for _, installation := range installationMap { - installations = append(installations, installation) - } - - return installations, nil -} - -// AddInstallations adds the installations for a given identity, maintaining the enabled flag -func (s *sqlitePersistence) AddInstallations(identity []byte, timestamp int64, installations []*Installation, defaultEnabled bool) ([]*Installation, error) { - tx, err := s.db.Begin() - if err != nil { - return nil, err - } - - var insertedInstallations []*Installation - - for _, installation := range installations { - stmt, err := tx.Prepare(`SELECT enabled, version - FROM installations - WHERE identity = ? AND installation_id = ? - LIMIT 1`) - if err != nil { - return nil, err - } - defer stmt.Close() - - var oldEnabled bool - // We don't override version once we saw one - var oldVersion uint32 - latestVersion := installation.Version - - err = stmt.QueryRow(identity, installation.ID).Scan(&oldEnabled, &oldVersion) - if err != nil && err != sql.ErrNoRows { - return nil, err - } - - if err == sql.ErrNoRows { - stmt, err = tx.Prepare(`INSERT INTO installations(identity, installation_id, timestamp, enabled, version) - VALUES (?, ?, ?, ?, ?)`) - if err != nil { - return nil, err - } - defer stmt.Close() - - _, err = stmt.Exec( - identity, - installation.ID, - timestamp, - defaultEnabled, - latestVersion, - ) - if err != nil { - return nil, err - } - insertedInstallations = append(insertedInstallations, installation) - } else { - // We update timestamp if present without changing enabled, only if this is a new bundle - // and we set the version to the latest we ever saw - if oldVersion > installation.Version { - latestVersion = oldVersion - } - - stmt, err = tx.Prepare(`UPDATE installations - SET timestamp = ?, enabled = ?, version = ? - WHERE identity = ? - AND installation_id = ? - AND timestamp < ?`) - if err != nil { - return nil, err - } - defer stmt.Close() - - _, err = stmt.Exec( - timestamp, - oldEnabled, - latestVersion, - identity, - installation.ID, - timestamp, - ) - if err != nil { - return nil, err - } - } - - } - - if err := tx.Commit(); err != nil { - _ = tx.Rollback() - return nil, err - } - - return insertedInstallations, nil - -} - -// EnableInstallation enables the installation -func (s *sqlitePersistence) EnableInstallation(identity []byte, installationID string) error { - stmt, err := s.db.Prepare(`UPDATE installations - SET enabled = 1 - WHERE identity = ? AND installation_id = ?`) - if err != nil { - return err - } - - _, err = stmt.Exec(identity, installationID) - return err - -} - -// DisableInstallation disable the installation -func (s *sqlitePersistence) DisableInstallation(identity []byte, installationID string) error { - stmt, err := s.db.Prepare(`UPDATE installations - SET enabled = 0 - WHERE identity = ? AND installation_id = ?`) - if err != nil { - return err - } - - _, err = stmt.Exec(identity, installationID) - return err -} - -// SetInstallationMetadata sets the metadata for a given installation -func (s *sqlitePersistence) SetInstallationMetadata(identity []byte, installationID string, metadata *InstallationMetadata) error { - stmt, err := s.db.Prepare(`INSERT INTO installation_metadata(name, device_type, fcm_token, identity, installation_id) VALUES(?,?,?,?,?)`) - if err != nil { - return err - } - - _, err = stmt.Exec(metadata.Name, metadata.DeviceType, metadata.FCMToken, identity, installationID) - return err -} diff --git a/vendor/github.com/status-im/status-go/protocol/encryption/persistence.go b/vendor/github.com/status-im/status-go/protocol/encryption/persistence.go deleted file mode 100644 index 1cfbd6dc4..000000000 --- a/vendor/github.com/status-im/status-go/protocol/encryption/persistence.go +++ /dev/null @@ -1,729 +0,0 @@ -package encryption - -import ( - "crypto/ecdsa" - "database/sql" - "strings" - - dr "github.com/status-im/doubleratchet" - - "github.com/status-im/status-go/eth-node/crypto" - - "github.com/status-im/status-go/protocol/encryption/multidevice" -) - -// RatchetInfo holds the current ratchet state. -type RatchetInfo struct { - ID []byte - Sk []byte - PrivateKey []byte - PublicKey []byte - Identity []byte - BundleID []byte - EphemeralKey []byte - InstallationID string -} - -// A safe max number of rows. -const maxNumberOfRows = 100000000 - -type sqlitePersistence struct { - DB *sql.DB - keysStorage dr.KeysStorage - sessionStorage dr.SessionStorage -} - -func newSQLitePersistence(db *sql.DB) *sqlitePersistence { - return &sqlitePersistence{ - DB: db, - keysStorage: newSQLiteKeysStorage(db), - sessionStorage: newSQLiteSessionStorage(db), - } -} - -// GetKeysStorage returns the associated double ratchet KeysStorage object -func (s *sqlitePersistence) KeysStorage() dr.KeysStorage { - return s.keysStorage -} - -// GetSessionStorage returns the associated double ratchet SessionStorage object -func (s *sqlitePersistence) SessionStorage() dr.SessionStorage { - return s.sessionStorage -} - -// AddPrivateBundle adds the specified BundleContainer to the database -func (s *sqlitePersistence) AddPrivateBundle(bc *BundleContainer) error { - tx, err := s.DB.Begin() - if err != nil { - return err - } - - for installationID, signedPreKey := range bc.GetBundle().GetSignedPreKeys() { - var version uint32 - stmt, err := tx.Prepare(`SELECT version - FROM bundles - WHERE installation_id = ? AND identity = ? - ORDER BY version DESC - LIMIT 1`) - if err != nil { - return err - } - - defer stmt.Close() - - err = stmt.QueryRow(installationID, bc.GetBundle().GetIdentity()).Scan(&version) - if err != nil && err != sql.ErrNoRows { - return err - } - - stmt, err = tx.Prepare(`INSERT INTO bundles(identity, private_key, signed_pre_key, installation_id, version, timestamp) - VALUES(?, ?, ?, ?, ?, ?)`) - if err != nil { - return err - } - defer stmt.Close() - - _, err = stmt.Exec( - bc.GetBundle().GetIdentity(), - bc.GetPrivateSignedPreKey(), - signedPreKey.GetSignedPreKey(), - installationID, - version+1, - bc.GetBundle().GetTimestamp(), - ) - if err != nil { - _ = tx.Rollback() - return err - } - } - - if err := tx.Commit(); err != nil { - _ = tx.Rollback() - return err - } - - return nil -} - -// AddPublicBundle adds the specified Bundle to the database -func (s *sqlitePersistence) AddPublicBundle(b *Bundle) error { - tx, err := s.DB.Begin() - - if err != nil { - return err - } - - for installationID, signedPreKeyContainer := range b.GetSignedPreKeys() { - signedPreKey := signedPreKeyContainer.GetSignedPreKey() - version := signedPreKeyContainer.GetVersion() - insertStmt, err := tx.Prepare(`INSERT INTO bundles(identity, signed_pre_key, installation_id, version, timestamp) - VALUES( ?, ?, ?, ?, ?)`) - if err != nil { - return err - } - defer insertStmt.Close() - - _, err = insertStmt.Exec( - b.GetIdentity(), - signedPreKey, - installationID, - version, - b.GetTimestamp(), - ) - if err != nil { - _ = tx.Rollback() - return err - } - // Mark old bundles as expired - updateStmt, err := tx.Prepare(`UPDATE bundles - SET expired = 1 - WHERE identity = ? AND installation_id = ? AND version < ?`) - if err != nil { - return err - } - defer updateStmt.Close() - - _, err = updateStmt.Exec( - b.GetIdentity(), - installationID, - version, - ) - if err != nil { - _ = tx.Rollback() - return err - } - - } - - return tx.Commit() -} - -// GetAnyPrivateBundle retrieves any bundle from the database containing a private key -func (s *sqlitePersistence) GetAnyPrivateBundle(myIdentityKey []byte, installations []*multidevice.Installation) (*BundleContainer, error) { - - versions := make(map[string]uint32) - /* #nosec */ - statement := `SELECT identity, private_key, signed_pre_key, installation_id, timestamp, version - FROM bundles - WHERE expired = 0 AND identity = ? AND installation_id IN (?` + strings.Repeat(",?", len(installations)-1) + ")" - stmt, err := s.DB.Prepare(statement) - if err != nil { - return nil, err - } - defer stmt.Close() - - var timestamp int64 - var identity []byte - var privateKey []byte - var version uint32 - - args := make([]interface{}, len(installations)+1) - args[0] = myIdentityKey - for i, installation := range installations { - // Lookup up map for versions - versions[installation.ID] = installation.Version - - args[i+1] = installation.ID - } - - rows, err := stmt.Query(args...) - rowCount := 0 - - if err != nil { - return nil, err - } - - defer rows.Close() - - bundle := &Bundle{ - SignedPreKeys: make(map[string]*SignedPreKey), - } - - bundleContainer := &BundleContainer{ - Bundle: bundle, - } - - for rows.Next() { - var signedPreKey []byte - var installationID string - rowCount++ - err = rows.Scan( - &identity, - &privateKey, - &signedPreKey, - &installationID, - ×tamp, - &version, - ) - if err != nil { - return nil, err - } - // If there is a private key, we set the timestamp of the bundle container - if privateKey != nil { - bundle.Timestamp = timestamp - } - - bundle.SignedPreKeys[installationID] = &SignedPreKey{ - SignedPreKey: signedPreKey, - Version: version, - ProtocolVersion: versions[installationID], - } - bundle.Identity = identity - } - - // If no records are found or no record with private key, return nil - if rowCount == 0 || bundleContainer.GetBundle().Timestamp == 0 { - return nil, nil - } - - return bundleContainer, nil - -} - -// GetPrivateKeyBundle retrieves a private key for a bundle from the database -func (s *sqlitePersistence) GetPrivateKeyBundle(bundleID []byte) ([]byte, error) { - stmt, err := s.DB.Prepare(`SELECT private_key - FROM bundles - WHERE signed_pre_key = ? LIMIT 1`) - if err != nil { - return nil, err - } - defer stmt.Close() - - var privateKey []byte - - err = stmt.QueryRow(bundleID).Scan(&privateKey) - switch err { - case sql.ErrNoRows: - return nil, nil - case nil: - return privateKey, nil - default: - return nil, err - } -} - -// MarkBundleExpired expires any private bundle for a given identity -func (s *sqlitePersistence) MarkBundleExpired(identity []byte) error { - stmt, err := s.DB.Prepare(`UPDATE bundles - SET expired = 1 - WHERE identity = ? AND private_key IS NOT NULL`) - if err != nil { - return err - } - defer stmt.Close() - - _, err = stmt.Exec(identity) - - return err -} - -// GetPublicBundle retrieves an existing Bundle for the specified public key from the database -func (s *sqlitePersistence) GetPublicBundle(publicKey *ecdsa.PublicKey, installations []*multidevice.Installation) (*Bundle, error) { - - if len(installations) == 0 { - return nil, nil - } - - versions := make(map[string]uint32) - identity := crypto.CompressPubkey(publicKey) - - /* #nosec */ - statement := `SELECT signed_pre_key,installation_id, version - FROM bundles - WHERE expired = 0 AND identity = ? AND installation_id IN (?` + strings.Repeat(",?", len(installations)-1) + `) - ORDER BY version DESC` - stmt, err := s.DB.Prepare(statement) - if err != nil { - return nil, err - } - defer stmt.Close() - - args := make([]interface{}, len(installations)+1) - args[0] = identity - for i, installation := range installations { - // Lookup up map for versions - versions[installation.ID] = installation.Version - args[i+1] = installation.ID - } - - rows, err := stmt.Query(args...) - rowCount := 0 - - if err != nil { - return nil, err - } - - defer rows.Close() - - bundle := &Bundle{ - Identity: identity, - SignedPreKeys: make(map[string]*SignedPreKey), - } - - for rows.Next() { - var signedPreKey []byte - var installationID string - var version uint32 - rowCount++ - err = rows.Scan( - &signedPreKey, - &installationID, - &version, - ) - if err != nil { - return nil, err - } - - bundle.SignedPreKeys[installationID] = &SignedPreKey{ - SignedPreKey: signedPreKey, - Version: version, - ProtocolVersion: versions[installationID], - } - - } - - if rowCount == 0 { - return nil, nil - } - - return bundle, nil - -} - -// AddRatchetInfo persists the specified ratchet info into the database -func (s *sqlitePersistence) AddRatchetInfo(key []byte, identity []byte, bundleID []byte, ephemeralKey []byte, installationID string) error { - stmt, err := s.DB.Prepare(`INSERT INTO ratchet_info_v2(symmetric_key, identity, bundle_id, ephemeral_key, installation_id) - VALUES(?, ?, ?, ?, ?)`) - if err != nil { - return err - } - defer stmt.Close() - - _, err = stmt.Exec( - key, - identity, - bundleID, - ephemeralKey, - installationID, - ) - - return err -} - -// GetRatchetInfo retrieves the existing RatchetInfo for a specified bundle ID and interlocutor public key from the database -func (s *sqlitePersistence) GetRatchetInfo(bundleID []byte, theirIdentity []byte, installationID string) (*RatchetInfo, error) { - stmt, err := s.DB.Prepare(`SELECT ratchet_info_v2.identity, ratchet_info_v2.symmetric_key, bundles.private_key, bundles.signed_pre_key, ratchet_info_v2.ephemeral_key, ratchet_info_v2.installation_id - FROM ratchet_info_v2 JOIN bundles ON bundle_id = signed_pre_key - WHERE ratchet_info_v2.identity = ? AND ratchet_info_v2.installation_id = ? AND bundle_id = ? - LIMIT 1`) - if err != nil { - return nil, err - } - defer stmt.Close() - - ratchetInfo := &RatchetInfo{ - BundleID: bundleID, - } - - err = stmt.QueryRow(theirIdentity, installationID, bundleID).Scan( - &ratchetInfo.Identity, - &ratchetInfo.Sk, - &ratchetInfo.PrivateKey, - &ratchetInfo.PublicKey, - &ratchetInfo.EphemeralKey, - &ratchetInfo.InstallationID, - ) - switch err { - case sql.ErrNoRows: - return nil, nil - case nil: - ratchetInfo.ID = append(bundleID, []byte(ratchetInfo.InstallationID)...) - return ratchetInfo, nil - default: - return nil, err - } -} - -// GetAnyRatchetInfo retrieves any existing RatchetInfo for a specified interlocutor public key from the database -func (s *sqlitePersistence) GetAnyRatchetInfo(identity []byte, installationID string) (*RatchetInfo, error) { - stmt, err := s.DB.Prepare(`SELECT symmetric_key, bundles.private_key, signed_pre_key, bundle_id, ephemeral_key - FROM ratchet_info_v2 JOIN bundles ON bundle_id = signed_pre_key - WHERE expired = 0 AND ratchet_info_v2.identity = ? AND ratchet_info_v2.installation_id = ? - LIMIT 1`) - if err != nil { - return nil, err - } - defer stmt.Close() - - ratchetInfo := &RatchetInfo{ - Identity: identity, - InstallationID: installationID, - } - - err = stmt.QueryRow(identity, installationID).Scan( - &ratchetInfo.Sk, - &ratchetInfo.PrivateKey, - &ratchetInfo.PublicKey, - &ratchetInfo.BundleID, - &ratchetInfo.EphemeralKey, - ) - switch err { - case sql.ErrNoRows: - return nil, nil - case nil: - ratchetInfo.ID = append(ratchetInfo.BundleID, []byte(installationID)...) - return ratchetInfo, nil - default: - return nil, err - } -} - -// RatchetInfoConfirmed clears the ephemeral key in the RatchetInfo -// associated with the specified bundle ID and interlocutor identity public key -func (s *sqlitePersistence) RatchetInfoConfirmed(bundleID []byte, theirIdentity []byte, installationID string) error { - stmt, err := s.DB.Prepare(`UPDATE ratchet_info_v2 - SET ephemeral_key = NULL - WHERE identity = ? AND bundle_id = ? AND installation_id = ?`) - if err != nil { - return err - } - defer stmt.Close() - - _, err = stmt.Exec( - theirIdentity, - bundleID, - installationID, - ) - - return err -} - -type sqliteKeysStorage struct { - db *sql.DB -} - -func newSQLiteKeysStorage(db *sql.DB) *sqliteKeysStorage { - return &sqliteKeysStorage{ - db: db, - } -} - -// Get retrieves the message key for a specified public key and message number -func (s *sqliteKeysStorage) Get(pubKey dr.Key, msgNum uint) (dr.Key, bool, error) { - var key []byte - stmt, err := s.db.Prepare(`SELECT message_key - FROM keys - WHERE public_key = ? AND msg_num = ? - LIMIT 1`) - - if err != nil { - return key, false, err - } - defer stmt.Close() - - err = stmt.QueryRow(pubKey, msgNum).Scan(&key) - switch err { - case sql.ErrNoRows: - return key, false, nil - case nil: - return key, true, nil - default: - return key, false, err - } -} - -// Put stores a key with the specified public key, message number and message key -func (s *sqliteKeysStorage) Put(sessionID []byte, pubKey dr.Key, msgNum uint, mk dr.Key, seqNum uint) error { - stmt, err := s.db.Prepare(`INSERT INTO keys(session_id, public_key, msg_num, message_key, seq_num) - VALUES(?, ?, ?, ?, ?)`) - if err != nil { - return err - } - defer stmt.Close() - - _, err = stmt.Exec( - sessionID, - pubKey, - msgNum, - mk, - seqNum, - ) - - return err -} - -// DeleteOldMks caps remove any key < seq_num, included -func (s *sqliteKeysStorage) DeleteOldMks(sessionID []byte, deleteUntil uint) error { - stmt, err := s.db.Prepare(`DELETE FROM keys - WHERE session_id = ? AND seq_num <= ?`) - if err != nil { - return err - } - defer stmt.Close() - - _, err = stmt.Exec( - sessionID, - deleteUntil, - ) - - return err -} - -// TruncateMks caps the number of keys to maxKeysPerSession deleting them in FIFO fashion -func (s *sqliteKeysStorage) TruncateMks(sessionID []byte, maxKeysPerSession int) error { - stmt, err := s.db.Prepare(`DELETE FROM keys - WHERE rowid IN (SELECT rowid FROM keys WHERE session_id = ? ORDER BY seq_num DESC LIMIT ? OFFSET ?)`) - if err != nil { - return err - } - defer stmt.Close() - - _, err = stmt.Exec( - sessionID, - // We LIMIT to the max number of rows here, as OFFSET can't be used without a LIMIT - maxNumberOfRows, - maxKeysPerSession, - ) - - return err -} - -// DeleteMk deletes the key with the specified public key and message key -func (s *sqliteKeysStorage) DeleteMk(pubKey dr.Key, msgNum uint) error { - stmt, err := s.db.Prepare(`DELETE FROM keys - WHERE public_key = ? AND msg_num = ?`) - if err != nil { - return err - } - defer stmt.Close() - - _, err = stmt.Exec( - pubKey, - msgNum, - ) - - return err -} - -// Count returns the count of keys with the specified public key -func (s *sqliteKeysStorage) Count(pubKey dr.Key) (uint, error) { - stmt, err := s.db.Prepare(`SELECT COUNT(1) - FROM keys - WHERE public_key = ?`) - if err != nil { - return 0, err - } - defer stmt.Close() - - var count uint - err = stmt.QueryRow(pubKey).Scan(&count) - if err != nil { - return 0, err - } - - return count, nil -} - -// CountAll returns the count of keys with the specified public key -func (s *sqliteKeysStorage) CountAll() (uint, error) { - stmt, err := s.db.Prepare(`SELECT COUNT(1) - FROM keys`) - if err != nil { - return 0, err - } - defer stmt.Close() - - var count uint - err = stmt.QueryRow().Scan(&count) - if err != nil { - return 0, err - } - - return count, nil -} - -// All returns nil -func (s *sqliteKeysStorage) All() (map[string]map[uint]dr.Key, error) { - return nil, nil -} - -type sqliteSessionStorage struct { - db *sql.DB -} - -func newSQLiteSessionStorage(db *sql.DB) *sqliteSessionStorage { - return &sqliteSessionStorage{ - db: db, - } -} - -// Save persists the specified double ratchet state -func (s *sqliteSessionStorage) Save(id []byte, state *dr.State) error { - dhr := state.DHr - dhs := state.DHs - dhsPublic := dhs.PublicKey() - dhsPrivate := dhs.PrivateKey() - pn := state.PN - step := state.Step - keysCount := state.KeysCount - - rootChainKey := state.RootCh.CK - - sendChainKey := state.SendCh.CK - sendChainN := state.SendCh.N - - recvChainKey := state.RecvCh.CK - recvChainN := state.RecvCh.N - - stmt, err := s.db.Prepare(`INSERT INTO sessions(id, dhr, dhs_public, dhs_private, root_chain_key, send_chain_key, send_chain_n, recv_chain_key, recv_chain_n, pn, step, keys_count) - VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`) - if err != nil { - return err - } - defer stmt.Close() - - _, err = stmt.Exec( - id, - dhr, - dhsPublic, - dhsPrivate, - rootChainKey, - sendChainKey, - sendChainN, - recvChainKey, - recvChainN, - pn, - step, - keysCount, - ) - - return err -} - -// Load retrieves the double ratchet state for a given ID -func (s *sqliteSessionStorage) Load(id []byte) (*dr.State, error) { - stmt, err := s.db.Prepare(`SELECT dhr, dhs_public, dhs_private, root_chain_key, send_chain_key, send_chain_n, recv_chain_key, recv_chain_n, pn, step, keys_count - FROM sessions - WHERE id = ?`) - if err != nil { - return nil, err - } - - defer stmt.Close() - - var ( - dhr []byte - dhsPublic []byte - dhsPrivate []byte - rootChainKey []byte - sendChainKey []byte - sendChainN uint - recvChainKey []byte - recvChainN uint - pn uint - step uint - keysCount uint - ) - - err = stmt.QueryRow(id).Scan( - &dhr, - &dhsPublic, - &dhsPrivate, - &rootChainKey, - &sendChainKey, - &sendChainN, - &recvChainKey, - &recvChainN, - &pn, - &step, - &keysCount, - ) - switch err { - case sql.ErrNoRows: - return nil, nil - case nil: - state := dr.DefaultState(rootChainKey) - - state.PN = uint32(pn) - state.Step = step - state.KeysCount = keysCount - - state.DHs = crypto.DHPair{ - PrvKey: dhsPrivate, - PubKey: dhsPublic, - } - - state.DHr = dhr - - state.SendCh.CK = sendChainKey - state.SendCh.N = uint32(sendChainN) - - state.RecvCh.CK = recvChainKey - state.RecvCh.N = uint32(recvChainN) - - return &state, nil - default: - return nil, err - } -} diff --git a/vendor/github.com/status-im/status-go/protocol/encryption/protocol.go b/vendor/github.com/status-im/status-go/protocol/encryption/protocol.go deleted file mode 100644 index ac2d5076c..000000000 --- a/vendor/github.com/status-im/status-go/protocol/encryption/protocol.go +++ /dev/null @@ -1,514 +0,0 @@ -package encryption - -import ( - "bytes" - "crypto/ecdsa" - "database/sql" - "fmt" - - "go.uber.org/zap" - - "github.com/pkg/errors" - - "github.com/status-im/status-go/eth-node/crypto" - - "github.com/status-im/status-go/protocol/encryption/multidevice" - "github.com/status-im/status-go/protocol/encryption/publisher" - "github.com/status-im/status-go/protocol/encryption/sharedsecret" -) - -//go:generate protoc --go_out=. ./protocol_message.proto - -const ( - protocolVersion = 1 - sharedSecretNegotiationVersion = 1 - partitionedTopicMinVersion = 1 - defaultMinVersion = 0 -) - -type PartitionTopicMode int - -const ( - PartitionTopicNoSupport PartitionTopicMode = iota - PartitionTopicV1 -) - -type ProtocolMessageSpec struct { - Message *ProtocolMessage - // Installations is the targeted devices - Installations []*multidevice.Installation - // SharedSecret is a shared secret established among the installations - SharedSecret []byte - // Public means that the spec contains a public wrapped message - Public bool -} - -func (p *ProtocolMessageSpec) MinVersion() uint32 { - if len(p.Installations) == 0 { - return defaultMinVersion - } - - version := p.Installations[0].Version - - for _, installation := range p.Installations[1:] { - if installation.Version < version { - version = installation.Version - } - } - return version -} - -func (p *ProtocolMessageSpec) PartitionedTopicMode() PartitionTopicMode { - if p.MinVersion() >= partitionedTopicMinVersion { - return PartitionTopicV1 - } - return PartitionTopicNoSupport -} - -type Protocol struct { - encryptor *encryptor - secret *sharedsecret.SharedSecret - multidevice *multidevice.Multidevice - publisher *publisher.Publisher - - onAddedBundlesHandler func([]*multidevice.Installation) - onNewSharedSecretHandler func([]*sharedsecret.Secret) - onSendContactCodeHandler func(*ProtocolMessageSpec) - - logger *zap.Logger -} - -var ( - // ErrNoPayload means that there was no payload found in the received protocol message. - ErrNoPayload = errors.New("no payload") -) - -// New creates a new ProtocolService instance -func New( - db *sql.DB, - installationID string, - addedBundlesHandler func([]*multidevice.Installation), - onNewSharedSecretHandler func([]*sharedsecret.Secret), - onSendContactCodeHandler func(*ProtocolMessageSpec), - logger *zap.Logger, -) *Protocol { - return NewWithEncryptorConfig( - db, - installationID, - defaultEncryptorConfig(installationID, logger), - addedBundlesHandler, - onNewSharedSecretHandler, - onSendContactCodeHandler, - logger, - ) -} - -// DB and migrations are shared between encryption package -// and its sub-packages. -func NewWithEncryptorConfig( - db *sql.DB, - installationID string, - encryptorConfig encryptorConfig, - addedBundlesHandler func([]*multidevice.Installation), - onNewSharedSecretHandler func([]*sharedsecret.Secret), - onSendContactCodeHandler func(*ProtocolMessageSpec), - logger *zap.Logger, -) *Protocol { - return &Protocol{ - encryptor: newEncryptor(db, encryptorConfig), - secret: sharedsecret.New(db, logger), - multidevice: multidevice.New(db, &multidevice.Config{ - MaxInstallations: 3, - ProtocolVersion: protocolVersion, - InstallationID: installationID, - }), - publisher: publisher.New(logger), - onAddedBundlesHandler: addedBundlesHandler, - onNewSharedSecretHandler: onNewSharedSecretHandler, - onSendContactCodeHandler: onSendContactCodeHandler, - logger: logger.With(zap.Namespace("Protocol")), - } -} - -func (p *Protocol) Start(myIdentity *ecdsa.PrivateKey) error { - // Propagate currently cached shared secrets. - secrets, err := p.secret.All() - if err != nil { - return errors.Wrap(err, "failed to get all secrets") - } - p.onNewSharedSecretHandler(secrets) - - // Handle Publisher system messages. - publisherCh := p.publisher.Start() - - go func() { - for range publisherCh { - messageSpec, err := p.buildContactCodeMessage(myIdentity) - if err != nil { - p.logger.Error("failed to build contact code message", - zap.String("site", "Start"), - zap.Error(err)) - continue - } - - p.onSendContactCodeHandler(messageSpec) - } - }() - - return nil -} - -func (p *Protocol) addBundle(myIdentityKey *ecdsa.PrivateKey, msg *ProtocolMessage) error { - logger := p.logger.With(zap.String("site", "addBundle")) - - // Get a bundle - installations, err := p.multidevice.GetOurActiveInstallations(&myIdentityKey.PublicKey) - if err != nil { - return err - } - - logger.Info("adding bundle to the message", - zap.Any("installations", installations), - ) - - bundle, err := p.encryptor.CreateBundle(myIdentityKey, installations) - if err != nil { - return err - } - - msg.Bundles = []*Bundle{bundle} - - return nil -} - -// BuildPublicMessage marshals a public chat message given the user identity private key and a payload -func (p *Protocol) BuildPublicMessage(myIdentityKey *ecdsa.PrivateKey, payload []byte) (*ProtocolMessageSpec, error) { - // Build message not encrypted - message := &ProtocolMessage{ - InstallationId: p.encryptor.config.InstallationID, - PublicMessage: payload, - } - - err := p.addBundle(myIdentityKey, message) - if err != nil { - return nil, err - } - - return &ProtocolMessageSpec{Message: message, Public: true}, nil -} - -// buildContactCodeMessage creates a contact code message. It's a public message -// without any data but it carries bundle information. -func (p *Protocol) buildContactCodeMessage(myIdentityKey *ecdsa.PrivateKey) (*ProtocolMessageSpec, error) { - return p.BuildPublicMessage(myIdentityKey, nil) -} - -// BuildDirectMessage returns a 1:1 chat message and optionally a negotiated topic given the user identity private key, the recipient's public key, and a payload -func (p *Protocol) BuildDirectMessage(myIdentityKey *ecdsa.PrivateKey, publicKey *ecdsa.PublicKey, payload []byte) (*ProtocolMessageSpec, error) { - logger := p.logger.With( - zap.String("site", "BuildDirectMessage"), - zap.Binary("public-key", crypto.FromECDSAPub(publicKey)), - ) - - logger.Debug("building direct message") - - // Get recipients installations. - activeInstallations, err := p.multidevice.GetActiveInstallations(publicKey) - if err != nil { - return nil, err - } - - // Encrypt payload - directMessage, installations, err := p.encryptor.EncryptPayload(publicKey, myIdentityKey, activeInstallations, payload) - if err != nil { - return nil, err - } - - // Build message - message := &ProtocolMessage{ - InstallationId: p.encryptor.config.InstallationID, - DirectMessage: directMessage, - } - - err = p.addBundle(myIdentityKey, message) - if err != nil { - return nil, err - } - - // Check who we are sending the message to, and see if we have a shared secret - // across devices - var installationIDs []string - for installationID := range message.GetDirectMessage() { - if installationID != noInstallationID { - installationIDs = append(installationIDs, installationID) - } - } - - sharedSecret, agreed, err := p.secret.Agreed(myIdentityKey, p.encryptor.config.InstallationID, publicKey, installationIDs) - if err != nil { - return nil, err - } - - logger.Debug("shared secret agreement", - zap.Bool("has-shared-secret", sharedSecret != nil), - zap.Bool("agreed", agreed)) - - // Call handler - if sharedSecret != nil { - p.onNewSharedSecretHandler([]*sharedsecret.Secret{sharedSecret}) - } - - spec := &ProtocolMessageSpec{ - Message: message, - Installations: installations, - } - if agreed { - spec.SharedSecret = sharedSecret.Key - } - return spec, nil -} - -// BuildDHMessage builds a message with DH encryption so that it can be decrypted by any other device. -func (p *Protocol) BuildDHMessage(myIdentityKey *ecdsa.PrivateKey, destination *ecdsa.PublicKey, payload []byte) (*ProtocolMessageSpec, error) { - // Encrypt payload - encryptionResponse, err := p.encryptor.EncryptPayloadWithDH(destination, payload) - if err != nil { - return nil, err - } - - // Build message - message := &ProtocolMessage{ - InstallationId: p.encryptor.config.InstallationID, - DirectMessage: encryptionResponse, - } - - err = p.addBundle(myIdentityKey, message) - if err != nil { - return nil, err - } - - return &ProtocolMessageSpec{Message: message}, nil -} - -// ProcessPublicBundle processes a received X3DH bundle. -func (p *Protocol) ProcessPublicBundle(myIdentityKey *ecdsa.PrivateKey, bundle *Bundle) ([]*multidevice.Installation, error) { - logger := p.logger.With(zap.String("site", "ProcessPublicBundle")) - - logger.Debug("processing public bundle") - - if err := p.encryptor.ProcessPublicBundle(myIdentityKey, bundle); err != nil { - return nil, err - } - - installations, enabled, err := p.recoverInstallationsFromBundle(myIdentityKey, bundle) - if err != nil { - return nil, err - } - - logger.Debug("recovered installations", - zap.Int("installations", len(installations)), - zap.Bool("enabled", enabled)) - - // TODO(adam): why do we add installations using identity obtained from GetIdentity() - // instead of the output of crypto.CompressPubkey()? I tried the second option - // and the unit tests TestTopic and TestMaxDevices fail. - identityFromBundle := bundle.GetIdentity() - theirIdentity, err := ExtractIdentity(bundle) - if err != nil { - logger.Panic("unrecoverable error extracting identity", zap.Error(err)) - } - compressedIdentity := crypto.CompressPubkey(theirIdentity) - if !bytes.Equal(identityFromBundle, compressedIdentity) { - logger.Panic("identity from bundle and compressed are not equal") - } - - return p.multidevice.AddInstallations(bundle.GetIdentity(), bundle.GetTimestamp(), installations, enabled) -} - -// recoverInstallationsFromBundle extracts installations from the bundle. -// It returns extracted installations and true if the installations -// are ours, i.e. the bundle was created by our identity key. -func (p *Protocol) recoverInstallationsFromBundle(myIdentityKey *ecdsa.PrivateKey, bundle *Bundle) ([]*multidevice.Installation, bool, error) { - var installations []*multidevice.Installation - - theirIdentity, err := ExtractIdentity(bundle) - if err != nil { - return nil, false, err - } - - logger := p.logger.With(zap.String("site", "recoverInstallationsFromBundle")) - - myIdentityStr := fmt.Sprintf("0x%x", crypto.FromECDSAPub(&myIdentityKey.PublicKey)) - theirIdentityStr := fmt.Sprintf("0x%x", crypto.FromECDSAPub(theirIdentity)) - // Any device from other peers will be considered enabled, ours needs to - // be explicitly enabled. - enabled := theirIdentityStr != myIdentityStr - signedPreKeys := bundle.GetSignedPreKeys() - - for installationID, signedPreKey := range signedPreKeys { - logger.Info("recovered installation", zap.String("installation-id", installationID)) - if installationID != p.multidevice.InstallationID() { - installations = append(installations, &multidevice.Installation{ - Identity: theirIdentityStr, - ID: installationID, - Version: signedPreKey.GetProtocolVersion(), - }) - } - } - - return installations, enabled, nil -} - -// GetBundle retrieves or creates a X3DH bundle, given a private identity key. -func (p *Protocol) GetBundle(myIdentityKey *ecdsa.PrivateKey) (*Bundle, error) { - installations, err := p.multidevice.GetOurActiveInstallations(&myIdentityKey.PublicKey) - if err != nil { - return nil, err - } - - return p.encryptor.CreateBundle(myIdentityKey, installations) -} - -// EnableInstallation enables an installation for multi-device sync. -func (p *Protocol) EnableInstallation(myIdentityKey *ecdsa.PublicKey, installationID string) error { - return p.multidevice.EnableInstallation(myIdentityKey, installationID) -} - -// DisableInstallation disables an installation for multi-device sync. -func (p *Protocol) DisableInstallation(myIdentityKey *ecdsa.PublicKey, installationID string) error { - return p.multidevice.DisableInstallation(myIdentityKey, installationID) -} - -// GetOurInstallations returns all the installations available given an identity -func (p *Protocol) GetOurInstallations(myIdentityKey *ecdsa.PublicKey) ([]*multidevice.Installation, error) { - return p.multidevice.GetOurInstallations(myIdentityKey) -} - -// GetOurActiveInstallations returns all the active installations available given an identity -func (p *Protocol) GetOurActiveInstallations(myIdentityKey *ecdsa.PublicKey) ([]*multidevice.Installation, error) { - return p.multidevice.GetOurActiveInstallations(myIdentityKey) -} - -// SetInstallationMetadata sets the metadata for our own installation -func (p *Protocol) SetInstallationMetadata(myIdentityKey *ecdsa.PublicKey, installationID string, data *multidevice.InstallationMetadata) error { - return p.multidevice.SetInstallationMetadata(myIdentityKey, installationID, data) -} - -// GetPublicBundle retrieves a public bundle given an identity -func (p *Protocol) GetPublicBundle(theirIdentityKey *ecdsa.PublicKey) (*Bundle, error) { - installations, err := p.multidevice.GetActiveInstallations(theirIdentityKey) - if err != nil { - return nil, err - } - return p.encryptor.GetPublicBundle(theirIdentityKey, installations) -} - -// ConfirmMessageProcessed confirms and deletes message keys for the given messages -func (p *Protocol) ConfirmMessageProcessed(messageID []byte) error { - logger := p.logger.With(zap.String("site", "ConfirmMessageProcessed")) - logger.Debug("confirming message", zap.Binary("message-id", messageID)) - return p.encryptor.ConfirmMessageProcessed(messageID) -} - -// HandleMessage unmarshals a message and processes it, decrypting it if it is a 1:1 message. -func (p *Protocol) HandleMessage( - myIdentityKey *ecdsa.PrivateKey, - theirPublicKey *ecdsa.PublicKey, - protocolMessage *ProtocolMessage, - messageID []byte, -) ([]byte, error) { - logger := p.logger.With(zap.String("site", "HandleMessage")) - - logger.Debug("received a protocol message", zap.Binary("sender-public-key", crypto.FromECDSAPub(theirPublicKey)), zap.Binary("message-id", messageID)) - - if p.encryptor == nil { - return nil, errors.New("encryption service not initialized") - } - - // Process bundles - for _, bundle := range protocolMessage.GetBundles() { - // Should we stop processing if the bundle cannot be verified? - addedBundles, err := p.ProcessPublicBundle(myIdentityKey, bundle) - if err != nil { - return nil, err - } - - p.onAddedBundlesHandler(addedBundles) - } - - // Check if it's a public message - if publicMessage := protocolMessage.GetPublicMessage(); publicMessage != nil { - logger.Debug("received a public message in direct message") - // Nothing to do, as already in cleartext - return publicMessage, nil - } - - // Decrypt message - if directMessage := protocolMessage.GetDirectMessage(); directMessage != nil { - logger.Debug("processing direct message") - message, err := p.encryptor.DecryptPayload( - myIdentityKey, - theirPublicKey, - protocolMessage.GetInstallationId(), - directMessage, - messageID, - ) - if err != nil { - return nil, err - } - - bundles := protocolMessage.GetBundles() - version := getProtocolVersion(bundles, protocolMessage.GetInstallationId()) - logger.Debug("direct message version", zap.Uint32("version", version)) - if version >= sharedSecretNegotiationVersion { - logger.Debug("negotiating shared secret", - zap.Binary("public-key", crypto.FromECDSAPub(theirPublicKey))) - sharedSecret, err := p.secret.Generate(myIdentityKey, theirPublicKey, protocolMessage.GetInstallationId()) - if err != nil { - return nil, err - } - - p.onNewSharedSecretHandler([]*sharedsecret.Secret{sharedSecret}) - } - return message, nil - } - - // Return error - return nil, ErrNoPayload -} - -func (p *Protocol) ShouldAdvertiseBundle(publicKey *ecdsa.PublicKey, time int64) (bool, error) { - return p.publisher.ShouldAdvertiseBundle(publicKey, time) -} - -func (p *Protocol) ConfirmBundleAdvertisement(publicKey *ecdsa.PublicKey, time int64) { - p.publisher.SetLastAck(publicKey, time) -} - -func (p *Protocol) BuildBundleAdvertiseMessage(myIdentityKey *ecdsa.PrivateKey, publicKey *ecdsa.PublicKey) (*ProtocolMessageSpec, error) { - return p.BuildDHMessage(myIdentityKey, publicKey, nil) -} - -func getProtocolVersion(bundles []*Bundle, installationID string) uint32 { - if installationID == "" { - return defaultMinVersion - } - - for _, bundle := range bundles { - if bundle != nil { - signedPreKeys := bundle.GetSignedPreKeys() - if signedPreKeys == nil { - continue - } - - signedPreKey := signedPreKeys[installationID] - if signedPreKey == nil { - return defaultMinVersion - } - - return signedPreKey.GetProtocolVersion() - } - } - - return defaultMinVersion -} diff --git a/vendor/github.com/status-im/status-go/protocol/encryption/protocol_message.pb.go b/vendor/github.com/status-im/status-go/protocol/encryption/protocol_message.pb.go deleted file mode 100644 index a682bdb61..000000000 --- a/vendor/github.com/status-im/status-go/protocol/encryption/protocol_message.pb.go +++ /dev/null @@ -1,537 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: protocol_message.proto - -package encryption - -import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - math "math" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - -type SignedPreKey struct { - SignedPreKey []byte `protobuf:"bytes,1,opt,name=signed_pre_key,json=signedPreKey,proto3" json:"signed_pre_key,omitempty"` - Version uint32 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty"` - ProtocolVersion uint32 `protobuf:"varint,3,opt,name=protocol_version,json=protocolVersion,proto3" json:"protocol_version,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SignedPreKey) Reset() { *m = SignedPreKey{} } -func (m *SignedPreKey) String() string { return proto.CompactTextString(m) } -func (*SignedPreKey) ProtoMessage() {} -func (*SignedPreKey) Descriptor() ([]byte, []int) { - return fileDescriptor_4e37b52004a72e16, []int{0} -} - -func (m *SignedPreKey) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SignedPreKey.Unmarshal(m, b) -} -func (m *SignedPreKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SignedPreKey.Marshal(b, m, deterministic) -} -func (m *SignedPreKey) XXX_Merge(src proto.Message) { - xxx_messageInfo_SignedPreKey.Merge(m, src) -} -func (m *SignedPreKey) XXX_Size() int { - return xxx_messageInfo_SignedPreKey.Size(m) -} -func (m *SignedPreKey) XXX_DiscardUnknown() { - xxx_messageInfo_SignedPreKey.DiscardUnknown(m) -} - -var xxx_messageInfo_SignedPreKey proto.InternalMessageInfo - -func (m *SignedPreKey) GetSignedPreKey() []byte { - if m != nil { - return m.SignedPreKey - } - return nil -} - -func (m *SignedPreKey) GetVersion() uint32 { - if m != nil { - return m.Version - } - return 0 -} - -func (m *SignedPreKey) GetProtocolVersion() uint32 { - if m != nil { - return m.ProtocolVersion - } - return 0 -} - -// X3DH prekey bundle -type Bundle struct { - // Identity key - Identity []byte `protobuf:"bytes,1,opt,name=identity,proto3" json:"identity,omitempty"` - // Installation id - SignedPreKeys map[string]*SignedPreKey `protobuf:"bytes,2,rep,name=signed_pre_keys,json=signedPreKeys,proto3" json:"signed_pre_keys,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - // Prekey signature - Signature []byte `protobuf:"bytes,4,opt,name=signature,proto3" json:"signature,omitempty"` - // When the bundle was created locally - Timestamp int64 `protobuf:"varint,5,opt,name=timestamp,proto3" json:"timestamp,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Bundle) Reset() { *m = Bundle{} } -func (m *Bundle) String() string { return proto.CompactTextString(m) } -func (*Bundle) ProtoMessage() {} -func (*Bundle) Descriptor() ([]byte, []int) { - return fileDescriptor_4e37b52004a72e16, []int{1} -} - -func (m *Bundle) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Bundle.Unmarshal(m, b) -} -func (m *Bundle) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Bundle.Marshal(b, m, deterministic) -} -func (m *Bundle) XXX_Merge(src proto.Message) { - xxx_messageInfo_Bundle.Merge(m, src) -} -func (m *Bundle) XXX_Size() int { - return xxx_messageInfo_Bundle.Size(m) -} -func (m *Bundle) XXX_DiscardUnknown() { - xxx_messageInfo_Bundle.DiscardUnknown(m) -} - -var xxx_messageInfo_Bundle proto.InternalMessageInfo - -func (m *Bundle) GetIdentity() []byte { - if m != nil { - return m.Identity - } - return nil -} - -func (m *Bundle) GetSignedPreKeys() map[string]*SignedPreKey { - if m != nil { - return m.SignedPreKeys - } - return nil -} - -func (m *Bundle) GetSignature() []byte { - if m != nil { - return m.Signature - } - return nil -} - -func (m *Bundle) GetTimestamp() int64 { - if m != nil { - return m.Timestamp - } - return 0 -} - -type BundleContainer struct { - // X3DH prekey bundle - Bundle *Bundle `protobuf:"bytes,1,opt,name=bundle,proto3" json:"bundle,omitempty"` - // Private signed prekey - PrivateSignedPreKey []byte `protobuf:"bytes,2,opt,name=private_signed_pre_key,json=privateSignedPreKey,proto3" json:"private_signed_pre_key,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *BundleContainer) Reset() { *m = BundleContainer{} } -func (m *BundleContainer) String() string { return proto.CompactTextString(m) } -func (*BundleContainer) ProtoMessage() {} -func (*BundleContainer) Descriptor() ([]byte, []int) { - return fileDescriptor_4e37b52004a72e16, []int{2} -} - -func (m *BundleContainer) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_BundleContainer.Unmarshal(m, b) -} -func (m *BundleContainer) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_BundleContainer.Marshal(b, m, deterministic) -} -func (m *BundleContainer) XXX_Merge(src proto.Message) { - xxx_messageInfo_BundleContainer.Merge(m, src) -} -func (m *BundleContainer) XXX_Size() int { - return xxx_messageInfo_BundleContainer.Size(m) -} -func (m *BundleContainer) XXX_DiscardUnknown() { - xxx_messageInfo_BundleContainer.DiscardUnknown(m) -} - -var xxx_messageInfo_BundleContainer proto.InternalMessageInfo - -func (m *BundleContainer) GetBundle() *Bundle { - if m != nil { - return m.Bundle - } - return nil -} - -func (m *BundleContainer) GetPrivateSignedPreKey() []byte { - if m != nil { - return m.PrivateSignedPreKey - } - return nil -} - -type DRHeader struct { - // Current ratchet public key - Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - // Number of the message in the sending chain - N uint32 `protobuf:"varint,2,opt,name=n,proto3" json:"n,omitempty"` - // Length of the previous sending chain - Pn uint32 `protobuf:"varint,3,opt,name=pn,proto3" json:"pn,omitempty"` - // Bundle ID - Id []byte `protobuf:"bytes,4,opt,name=id,proto3" json:"id,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *DRHeader) Reset() { *m = DRHeader{} } -func (m *DRHeader) String() string { return proto.CompactTextString(m) } -func (*DRHeader) ProtoMessage() {} -func (*DRHeader) Descriptor() ([]byte, []int) { - return fileDescriptor_4e37b52004a72e16, []int{3} -} - -func (m *DRHeader) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_DRHeader.Unmarshal(m, b) -} -func (m *DRHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_DRHeader.Marshal(b, m, deterministic) -} -func (m *DRHeader) XXX_Merge(src proto.Message) { - xxx_messageInfo_DRHeader.Merge(m, src) -} -func (m *DRHeader) XXX_Size() int { - return xxx_messageInfo_DRHeader.Size(m) -} -func (m *DRHeader) XXX_DiscardUnknown() { - xxx_messageInfo_DRHeader.DiscardUnknown(m) -} - -var xxx_messageInfo_DRHeader proto.InternalMessageInfo - -func (m *DRHeader) GetKey() []byte { - if m != nil { - return m.Key - } - return nil -} - -func (m *DRHeader) GetN() uint32 { - if m != nil { - return m.N - } - return 0 -} - -func (m *DRHeader) GetPn() uint32 { - if m != nil { - return m.Pn - } - return 0 -} - -func (m *DRHeader) GetId() []byte { - if m != nil { - return m.Id - } - return nil -} - -type DHHeader struct { - // Compressed ephemeral public key - Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *DHHeader) Reset() { *m = DHHeader{} } -func (m *DHHeader) String() string { return proto.CompactTextString(m) } -func (*DHHeader) ProtoMessage() {} -func (*DHHeader) Descriptor() ([]byte, []int) { - return fileDescriptor_4e37b52004a72e16, []int{4} -} - -func (m *DHHeader) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_DHHeader.Unmarshal(m, b) -} -func (m *DHHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_DHHeader.Marshal(b, m, deterministic) -} -func (m *DHHeader) XXX_Merge(src proto.Message) { - xxx_messageInfo_DHHeader.Merge(m, src) -} -func (m *DHHeader) XXX_Size() int { - return xxx_messageInfo_DHHeader.Size(m) -} -func (m *DHHeader) XXX_DiscardUnknown() { - xxx_messageInfo_DHHeader.DiscardUnknown(m) -} - -var xxx_messageInfo_DHHeader proto.InternalMessageInfo - -func (m *DHHeader) GetKey() []byte { - if m != nil { - return m.Key - } - return nil -} - -type X3DHHeader struct { - // Ephemeral key used - Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - // Used bundle's signed prekey - Id []byte `protobuf:"bytes,4,opt,name=id,proto3" json:"id,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *X3DHHeader) Reset() { *m = X3DHHeader{} } -func (m *X3DHHeader) String() string { return proto.CompactTextString(m) } -func (*X3DHHeader) ProtoMessage() {} -func (*X3DHHeader) Descriptor() ([]byte, []int) { - return fileDescriptor_4e37b52004a72e16, []int{5} -} - -func (m *X3DHHeader) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_X3DHHeader.Unmarshal(m, b) -} -func (m *X3DHHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_X3DHHeader.Marshal(b, m, deterministic) -} -func (m *X3DHHeader) XXX_Merge(src proto.Message) { - xxx_messageInfo_X3DHHeader.Merge(m, src) -} -func (m *X3DHHeader) XXX_Size() int { - return xxx_messageInfo_X3DHHeader.Size(m) -} -func (m *X3DHHeader) XXX_DiscardUnknown() { - xxx_messageInfo_X3DHHeader.DiscardUnknown(m) -} - -var xxx_messageInfo_X3DHHeader proto.InternalMessageInfo - -func (m *X3DHHeader) GetKey() []byte { - if m != nil { - return m.Key - } - return nil -} - -func (m *X3DHHeader) GetId() []byte { - if m != nil { - return m.Id - } - return nil -} - -// Direct message value -type DirectMessageProtocol struct { - X3DHHeader *X3DHHeader `protobuf:"bytes,1,opt,name=X3DH_header,json=X3DHHeader,proto3" json:"X3DH_header,omitempty"` - DRHeader *DRHeader `protobuf:"bytes,2,opt,name=DR_header,json=DRHeader,proto3" json:"DR_header,omitempty"` - DHHeader *DHHeader `protobuf:"bytes,101,opt,name=DH_header,json=DHHeader,proto3" json:"DH_header,omitempty"` - // Encrypted payload - Payload []byte `protobuf:"bytes,3,opt,name=payload,proto3" json:"payload,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *DirectMessageProtocol) Reset() { *m = DirectMessageProtocol{} } -func (m *DirectMessageProtocol) String() string { return proto.CompactTextString(m) } -func (*DirectMessageProtocol) ProtoMessage() {} -func (*DirectMessageProtocol) Descriptor() ([]byte, []int) { - return fileDescriptor_4e37b52004a72e16, []int{6} -} - -func (m *DirectMessageProtocol) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_DirectMessageProtocol.Unmarshal(m, b) -} -func (m *DirectMessageProtocol) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_DirectMessageProtocol.Marshal(b, m, deterministic) -} -func (m *DirectMessageProtocol) XXX_Merge(src proto.Message) { - xxx_messageInfo_DirectMessageProtocol.Merge(m, src) -} -func (m *DirectMessageProtocol) XXX_Size() int { - return xxx_messageInfo_DirectMessageProtocol.Size(m) -} -func (m *DirectMessageProtocol) XXX_DiscardUnknown() { - xxx_messageInfo_DirectMessageProtocol.DiscardUnknown(m) -} - -var xxx_messageInfo_DirectMessageProtocol proto.InternalMessageInfo - -func (m *DirectMessageProtocol) GetX3DHHeader() *X3DHHeader { - if m != nil { - return m.X3DHHeader - } - return nil -} - -func (m *DirectMessageProtocol) GetDRHeader() *DRHeader { - if m != nil { - return m.DRHeader - } - return nil -} - -func (m *DirectMessageProtocol) GetDHHeader() *DHHeader { - if m != nil { - return m.DHHeader - } - return nil -} - -func (m *DirectMessageProtocol) GetPayload() []byte { - if m != nil { - return m.Payload - } - return nil -} - -// Top-level protocol message -type ProtocolMessage struct { - // The device id of the sender - InstallationId string `protobuf:"bytes,2,opt,name=installation_id,json=installationId,proto3" json:"installation_id,omitempty"` - // List of bundles - Bundles []*Bundle `protobuf:"bytes,3,rep,name=bundles,proto3" json:"bundles,omitempty"` - // One to one message, encrypted, indexed by installation_id - DirectMessage map[string]*DirectMessageProtocol `protobuf:"bytes,101,rep,name=direct_message,json=directMessage,proto3" json:"direct_message,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - // Public chats, not encrypted - PublicMessage []byte `protobuf:"bytes,102,opt,name=public_message,json=publicMessage,proto3" json:"public_message,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ProtocolMessage) Reset() { *m = ProtocolMessage{} } -func (m *ProtocolMessage) String() string { return proto.CompactTextString(m) } -func (*ProtocolMessage) ProtoMessage() {} -func (*ProtocolMessage) Descriptor() ([]byte, []int) { - return fileDescriptor_4e37b52004a72e16, []int{7} -} - -func (m *ProtocolMessage) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ProtocolMessage.Unmarshal(m, b) -} -func (m *ProtocolMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ProtocolMessage.Marshal(b, m, deterministic) -} -func (m *ProtocolMessage) XXX_Merge(src proto.Message) { - xxx_messageInfo_ProtocolMessage.Merge(m, src) -} -func (m *ProtocolMessage) XXX_Size() int { - return xxx_messageInfo_ProtocolMessage.Size(m) -} -func (m *ProtocolMessage) XXX_DiscardUnknown() { - xxx_messageInfo_ProtocolMessage.DiscardUnknown(m) -} - -var xxx_messageInfo_ProtocolMessage proto.InternalMessageInfo - -func (m *ProtocolMessage) GetInstallationId() string { - if m != nil { - return m.InstallationId - } - return "" -} - -func (m *ProtocolMessage) GetBundles() []*Bundle { - if m != nil { - return m.Bundles - } - return nil -} - -func (m *ProtocolMessage) GetDirectMessage() map[string]*DirectMessageProtocol { - if m != nil { - return m.DirectMessage - } - return nil -} - -func (m *ProtocolMessage) GetPublicMessage() []byte { - if m != nil { - return m.PublicMessage - } - return nil -} - -func init() { - proto.RegisterType((*SignedPreKey)(nil), "encryption.SignedPreKey") - proto.RegisterType((*Bundle)(nil), "encryption.Bundle") - proto.RegisterMapType((map[string]*SignedPreKey)(nil), "encryption.Bundle.SignedPreKeysEntry") - proto.RegisterType((*BundleContainer)(nil), "encryption.BundleContainer") - proto.RegisterType((*DRHeader)(nil), "encryption.DRHeader") - proto.RegisterType((*DHHeader)(nil), "encryption.DHHeader") - proto.RegisterType((*X3DHHeader)(nil), "encryption.X3DHHeader") - proto.RegisterType((*DirectMessageProtocol)(nil), "encryption.DirectMessageProtocol") - proto.RegisterType((*ProtocolMessage)(nil), "encryption.ProtocolMessage") - proto.RegisterMapType((map[string]*DirectMessageProtocol)(nil), "encryption.ProtocolMessage.DirectMessageEntry") -} - -func init() { proto.RegisterFile("protocol_message.proto", fileDescriptor_4e37b52004a72e16) } - -var fileDescriptor_4e37b52004a72e16 = []byte{ - // 563 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x54, 0xdd, 0x8e, 0xd3, 0x3c, - 0x10, 0x55, 0x92, 0xdd, 0xfe, 0x4c, 0xd3, 0x1f, 0xf9, 0xfb, 0x58, 0x45, 0xd5, 0x5e, 0x94, 0x88, - 0x15, 0x05, 0xa1, 0x48, 0xb4, 0x48, 0x8b, 0xb8, 0x84, 0x22, 0x95, 0x45, 0x2b, 0xad, 0x8c, 0x40, - 0x88, 0x9b, 0xc8, 0xad, 0xcd, 0x62, 0x91, 0x3a, 0x51, 0xec, 0x56, 0xe4, 0x19, 0x78, 0x34, 0x6e, - 0x78, 0x24, 0x14, 0x27, 0x6e, 0xdd, 0x9f, 0xbd, 0x8b, 0x8f, 0x67, 0xce, 0xcc, 0x39, 0xe3, 0x09, - 0x5c, 0x64, 0x79, 0xaa, 0xd2, 0x65, 0x9a, 0xc4, 0x2b, 0x26, 0x25, 0xb9, 0x67, 0x91, 0x06, 0x10, - 0x30, 0xb1, 0xcc, 0x8b, 0x4c, 0xf1, 0x54, 0x84, 0x05, 0xf8, 0x9f, 0xf8, 0xbd, 0x60, 0xf4, 0x2e, - 0x67, 0x1f, 0x59, 0x81, 0x9e, 0x40, 0x4f, 0xea, 0x73, 0x9c, 0xe5, 0x2c, 0xfe, 0xc9, 0x8a, 0xc0, - 0x19, 0x39, 0x63, 0x1f, 0xfb, 0xd2, 0x8e, 0x0a, 0xa0, 0xb9, 0x61, 0xb9, 0xe4, 0xa9, 0x08, 0xdc, - 0x91, 0x33, 0xee, 0x62, 0x73, 0x44, 0xcf, 0x60, 0xb0, 0xad, 0x6a, 0x42, 0x3c, 0x1d, 0xd2, 0x37, - 0xf8, 0x97, 0x0a, 0x0e, 0x7f, 0xbb, 0xd0, 0x78, 0xbb, 0x16, 0x34, 0x61, 0x68, 0x08, 0x2d, 0x4e, - 0x99, 0x50, 0x5c, 0x99, 0x7a, 0xdb, 0x33, 0xba, 0x85, 0xfe, 0x7e, 0x47, 0x32, 0x70, 0x47, 0xde, - 0xb8, 0x33, 0xb9, 0x8a, 0x76, 0x3a, 0xa2, 0x8a, 0x28, 0xb2, 0xb5, 0xc8, 0xf7, 0x42, 0xe5, 0x05, - 0xee, 0xda, 0x9d, 0x4b, 0x74, 0x09, 0xed, 0x12, 0x20, 0x6a, 0x9d, 0xb3, 0xe0, 0x4c, 0xd7, 0xda, - 0x01, 0xe5, 0xad, 0xe2, 0x2b, 0x26, 0x15, 0x59, 0x65, 0xc1, 0xf9, 0xc8, 0x19, 0x7b, 0x78, 0x07, - 0x0c, 0xbf, 0x01, 0x3a, 0x2e, 0x80, 0x06, 0xe0, 0x19, 0x9f, 0xda, 0xb8, 0xfc, 0x44, 0x11, 0x9c, - 0x6f, 0x48, 0xb2, 0x66, 0xda, 0x9c, 0xce, 0x24, 0xb0, 0x1b, 0xb5, 0x09, 0x70, 0x15, 0xf6, 0xc6, - 0x7d, 0xed, 0x84, 0xbf, 0xa0, 0x5f, 0x69, 0x78, 0x97, 0x0a, 0x45, 0xb8, 0x60, 0x39, 0x7a, 0x0e, - 0x8d, 0x85, 0x86, 0x34, 0x77, 0x67, 0x82, 0x8e, 0x05, 0xe3, 0x3a, 0x02, 0x4d, 0xcb, 0x69, 0xf3, - 0x0d, 0x51, 0x2c, 0x3e, 0x98, 0x9f, 0xab, 0x35, 0xfe, 0x57, 0xdf, 0xda, 0xe5, 0x6f, 0xce, 0x5a, - 0xde, 0xe0, 0x2c, 0xbc, 0x81, 0xd6, 0x0c, 0xcf, 0x19, 0xa1, 0x2c, 0xb7, 0xb5, 0xf8, 0x95, 0x16, - 0x1f, 0x1c, 0x33, 0x64, 0x47, 0xa0, 0x1e, 0xb8, 0x99, 0x19, 0xa8, 0x9b, 0xe9, 0x33, 0xa7, 0xb5, - 0x8d, 0x2e, 0xa7, 0xe1, 0x25, 0xb4, 0x66, 0xf3, 0x87, 0xb8, 0xc2, 0x57, 0x00, 0x5f, 0xa7, 0x0f, - 0xdf, 0x1f, 0xb2, 0xd5, 0xfd, 0xfd, 0x75, 0xe0, 0xd1, 0x8c, 0xe7, 0x6c, 0xa9, 0x6e, 0xab, 0x67, - 0x7c, 0x57, 0x3f, 0x24, 0x74, 0x0d, 0x9d, 0x92, 0x2f, 0xfe, 0xa1, 0x09, 0x6b, 0x97, 0x2e, 0x6c, - 0x97, 0x76, 0xe5, 0xb0, 0x5d, 0xfa, 0x25, 0xb4, 0x67, 0xd8, 0xa4, 0x55, 0x43, 0xfa, 0xdf, 0x4e, - 0x33, 0x7e, 0xe0, 0x9d, 0x33, 0x65, 0xca, 0xb6, 0x12, 0x3b, 0x91, 0x32, 0xdf, 0xa6, 0x98, 0x2a, - 0x01, 0x34, 0x33, 0x52, 0x24, 0x29, 0xa1, 0xda, 0x31, 0x1f, 0x9b, 0x63, 0xf8, 0xc7, 0x85, 0xbe, - 0x51, 0x51, 0x8b, 0x42, 0x4f, 0xa1, 0xcf, 0x85, 0x54, 0x24, 0x49, 0x48, 0x49, 0x18, 0x73, 0xaa, - 0x3b, 0x6b, 0xe3, 0x9e, 0x0d, 0x7f, 0xa0, 0xe8, 0x05, 0x34, 0xab, 0xa1, 0xcb, 0xc0, 0xd3, 0x8b, - 0x70, 0xea, 0x5d, 0x98, 0x10, 0xf4, 0x19, 0x7a, 0x54, 0x9b, 0x67, 0x7e, 0x02, 0x01, 0xd3, 0x49, - 0x91, 0x9d, 0x74, 0xd0, 0x4b, 0xb4, 0x67, 0x77, 0xbd, 0x46, 0xd4, 0xc6, 0xd0, 0x15, 0xf4, 0xb2, - 0xf5, 0x22, 0xe1, 0xcb, 0x2d, 0xed, 0x77, 0x2d, 0xb1, 0x5b, 0xa1, 0x75, 0xd8, 0x70, 0x09, 0xe8, - 0x98, 0xeb, 0xc4, 0xc6, 0x5c, 0xef, 0x6f, 0xcc, 0xe3, 0x3d, 0x67, 0x4f, 0xcd, 0xde, 0x5a, 0x9d, - 0x45, 0x43, 0xff, 0x59, 0xa6, 0xff, 0x02, 0x00, 0x00, 0xff, 0xff, 0xa3, 0x5b, 0x5f, 0x6b, 0xf0, - 0x04, 0x00, 0x00, -} diff --git a/vendor/github.com/status-im/status-go/protocol/encryption/protocol_message.proto b/vendor/github.com/status-im/status-go/protocol/encryption/protocol_message.proto deleted file mode 100644 index 9025e3794..000000000 --- a/vendor/github.com/status-im/status-go/protocol/encryption/protocol_message.proto +++ /dev/null @@ -1,78 +0,0 @@ -syntax = "proto3"; - -package encryption; - -message SignedPreKey { - bytes signed_pre_key = 1; - uint32 version = 2; - uint32 protocol_version = 3; -} - -// X3DH prekey bundle -message Bundle { - // Identity key - bytes identity = 1; - // Installation id - map signed_pre_keys = 2; - // Prekey signature - bytes signature = 4; - - // When the bundle was created locally - int64 timestamp = 5; -} - -message BundleContainer { - reserved 3; - // X3DH prekey bundle - Bundle bundle = 1; - // Private signed prekey - bytes private_signed_pre_key = 2; -} - -message DRHeader { - // Current ratchet public key - bytes key = 1; - // Number of the message in the sending chain - uint32 n = 2; - // Length of the previous sending chain - uint32 pn = 3; - // Bundle ID - bytes id = 4; -} - -message DHHeader { - // Compressed ephemeral public key - bytes key = 1; -} - -message X3DHHeader { - reserved 3; - // Ephemeral key used - bytes key = 1; - // Used bundle's signed prekey - bytes id = 4; -} - -// Direct message value -message DirectMessageProtocol { - X3DHHeader X3DH_header = 1; - DRHeader DR_header = 2; - DHHeader DH_header = 101; - // Encrypted payload - bytes payload = 3; -} - -// Top-level protocol message -message ProtocolMessage { - // The device id of the sender - string installation_id = 2; - - // List of bundles - repeated Bundle bundles = 3; - - // One to one message, encrypted, indexed by installation_id - map direct_message = 101; - - // Public chats, not encrypted - bytes public_message = 102; -} diff --git a/vendor/github.com/status-im/status-go/protocol/encryption/publisher/doc.go b/vendor/github.com/status-im/status-go/protocol/encryption/publisher/doc.go deleted file mode 100644 index 3d317e435..000000000 --- a/vendor/github.com/status-im/status-go/protocol/encryption/publisher/doc.go +++ /dev/null @@ -1,6 +0,0 @@ -// Publisher periodically publishes an info about itself on a known channel. -// This channel is a particular topic calculated from the public key. -// It is required for other peers to start a secure conversation immediately -// using distibuted data through the channel. - -package publisher diff --git a/vendor/github.com/status-im/status-go/protocol/encryption/publisher/persistence.go b/vendor/github.com/status-im/status-go/protocol/encryption/publisher/persistence.go deleted file mode 100644 index f55b7d31d..000000000 --- a/vendor/github.com/status-im/status-go/protocol/encryption/publisher/persistence.go +++ /dev/null @@ -1,38 +0,0 @@ -package publisher - -import ( - "encoding/hex" - "sync" -) - -type persistence struct { - lastAcksMutex sync.Mutex - lastPublished int64 - lastAcks map[string]int64 -} - -func newPersistence() *persistence { - return &persistence{ - lastAcks: make(map[string]int64), - } -} - -func (s *persistence) getLastPublished() int64 { - return s.lastPublished -} - -func (s *persistence) setLastPublished(lastPublished int64) { - s.lastPublished = lastPublished -} - -func (s *persistence) lastAck(identity []byte) int64 { - s.lastAcksMutex.Lock() - defer s.lastAcksMutex.Unlock() - return s.lastAcks[hex.EncodeToString(identity)] -} - -func (s *persistence) setLastAck(identity []byte, lastAck int64) { - s.lastAcksMutex.Lock() - defer s.lastAcksMutex.Unlock() - s.lastAcks[hex.EncodeToString(identity)] = lastAck -} diff --git a/vendor/github.com/status-im/status-go/protocol/encryption/publisher/publisher.go b/vendor/github.com/status-im/status-go/protocol/encryption/publisher/publisher.go deleted file mode 100644 index af42e38c6..000000000 --- a/vendor/github.com/status-im/status-go/protocol/encryption/publisher/publisher.go +++ /dev/null @@ -1,119 +0,0 @@ -package publisher - -import ( - "crypto/ecdsa" - "errors" - "time" - - "go.uber.org/zap" - - "github.com/status-im/status-go/eth-node/crypto" -) - -const ( - // How often a ticker fires in seconds. - tickerInterval = 120 - // How often we should publish a contact code in seconds. - publishInterval = 21600 - // Cooldown period on acking messages when not targeting our device. - deviceNotFoundAckInterval = 7200 -) - -var ( - errNotEnoughTimePassed = errors.New("not enough time passed") -) - -type Publisher struct { - persistence *persistence - logger *zap.Logger - notifyCh chan struct{} - quit chan struct{} -} - -func New(logger *zap.Logger) *Publisher { - if logger == nil { - logger = zap.NewNop() - } - - return &Publisher{ - persistence: newPersistence(), - logger: logger.With(zap.Namespace("Publisher")), - } -} - -func (p *Publisher) Start() <-chan struct{} { - logger := p.logger.With(zap.String("site", "Start")) - - logger.Info("starting publisher") - - p.notifyCh = make(chan struct{}) - p.quit = make(chan struct{}) - - go p.tickerLoop() - - return p.notifyCh -} - -func (p *Publisher) Stop() { - select { - case _, ok := <-p.quit: - if !ok { - // channel already closed - return - } - default: - close(p.quit) - } -} - -func (p *Publisher) tickerLoop() { - ticker := time.NewTicker(tickerInterval * time.Second) - - go func() { - logger := p.logger.With(zap.String("site", "tickerLoop")) - - for { - select { - case <-ticker.C: - err := p.notify() - switch err { - case errNotEnoughTimePassed: - logger.Debug("not enough time passed") - case nil: - // skip - default: - logger.Error("error while sending a contact code", zap.Error(err)) - } - case <-p.quit: - ticker.Stop() - return - } - } - }() -} - -func (p *Publisher) notify() error { - lastPublished := p.persistence.getLastPublished() - - now := time.Now().Unix() - - if now-lastPublished < publishInterval { - return errNotEnoughTimePassed - } - - p.notifyCh <- struct{}{} - - p.persistence.setLastPublished(now) - return nil -} - -func (p *Publisher) ShouldAdvertiseBundle(publicKey *ecdsa.PublicKey, now int64) (bool, error) { - identity := crypto.CompressPubkey(publicKey) - lastAcked := p.persistence.lastAck(identity) - return now-lastAcked < deviceNotFoundAckInterval, nil -} - -func (p *Publisher) SetLastAck(publicKey *ecdsa.PublicKey, now int64) { - identity := crypto.CompressPubkey(publicKey) - p.persistence.setLastAck(identity, now) -} diff --git a/vendor/github.com/status-im/status-go/protocol/encryption/sharedsecret/persistence.go b/vendor/github.com/status-im/status-go/protocol/encryption/sharedsecret/persistence.go deleted file mode 100644 index 701070752..000000000 --- a/vendor/github.com/status-im/status-go/protocol/encryption/sharedsecret/persistence.go +++ /dev/null @@ -1,118 +0,0 @@ -package sharedsecret - -import ( - "database/sql" - "strings" -) - -type Response struct { - secret []byte - installationIDs map[string]bool -} - -type sqlitePersistence struct { - db *sql.DB -} - -func newSQLitePersistence(db *sql.DB) *sqlitePersistence { - return &sqlitePersistence{db: db} -} - -func (s *sqlitePersistence) Add(identity []byte, secret []byte, installationID string) error { - tx, err := s.db.Begin() - if err != nil { - return err - } - - insertSecretStmt, err := tx.Prepare("INSERT INTO secrets(identity, secret) VALUES (?, ?)") - if err != nil { - _ = tx.Rollback() - return err - } - defer insertSecretStmt.Close() - - _, err = insertSecretStmt.Exec(identity, secret) - if err != nil { - _ = tx.Rollback() - return err - } - - insertInstallationIDStmt, err := tx.Prepare("INSERT INTO secret_installation_ids(id, identity_id) VALUES (?, ?)") - if err != nil { - _ = tx.Rollback() - return err - } - defer insertInstallationIDStmt.Close() - - _, err = insertInstallationIDStmt.Exec(installationID, identity) - if err != nil { - _ = tx.Rollback() - return err - } - return tx.Commit() -} - -func (s *sqlitePersistence) Get(identity []byte, installationIDs []string) (*Response, error) { - response := &Response{ - installationIDs: make(map[string]bool), - } - args := make([]interface{}, len(installationIDs)+1) - args[0] = identity - for i, installationID := range installationIDs { - args[i+1] = installationID - } - - /* #nosec */ - query := `SELECT secret, id - FROM secrets t - JOIN - secret_installation_ids tid - ON t.identity = tid.identity_id - WHERE - t.identity = ? - AND - tid.id IN (?` + strings.Repeat(",?", len(installationIDs)-1) + `)` - - rows, err := s.db.Query(query, args...) - if err != nil && err != sql.ErrNoRows { - return nil, err - } - - for rows.Next() { - var installationID string - var secret []byte - err = rows.Scan(&secret, &installationID) - if err != nil { - return nil, err - } - - response.secret = secret - response.installationIDs[installationID] = true - } - - return response, nil -} - -func (s *sqlitePersistence) All() ([][][]byte, error) { - query := "SELECT identity, secret FROM secrets" - - var secrets [][][]byte - - rows, err := s.db.Query(query) - if err != nil { - return nil, err - } - - for rows.Next() { - var secret []byte - var identity []byte - err = rows.Scan(&identity, &secret) - if err != nil { - return nil, err - } - - secrets = append(secrets, [][]byte{identity, secret}) - } - - return secrets, nil -} diff --git a/vendor/github.com/status-im/status-go/protocol/encryption/sharedsecret/sharedsecret.go b/vendor/github.com/status-im/status-go/protocol/encryption/sharedsecret/sharedsecret.go deleted file mode 100644 index d170f5b65..000000000 --- a/vendor/github.com/status-im/status-go/protocol/encryption/sharedsecret/sharedsecret.go +++ /dev/null @@ -1,128 +0,0 @@ -package sharedsecret - -import ( - "bytes" - "crypto/ecdsa" - "database/sql" - "errors" - - "go.uber.org/zap" - - "github.com/status-im/status-go/eth-node/crypto" - "github.com/status-im/status-go/eth-node/crypto/ecies" -) - -const sskLen = 16 - -type Secret struct { - Identity *ecdsa.PublicKey - Key []byte -} - -// SharedSecret generates and manages negotiated secrets. -// Identities (public keys) stored by SharedSecret -// are compressed. -// TODO: make compression of public keys a responsibility of sqlitePersistence instead of SharedSecret. -type SharedSecret struct { - persistence *sqlitePersistence - logger *zap.Logger -} - -func New(db *sql.DB, logger *zap.Logger) *SharedSecret { - if logger == nil { - logger = zap.NewNop() - } - - return &SharedSecret{ - persistence: newSQLitePersistence(db), - logger: logger.With(zap.Namespace("SharedSecret")), - } -} - -func (s *SharedSecret) generate(myPrivateKey *ecdsa.PrivateKey, theirPublicKey *ecdsa.PublicKey, installationID string) (*Secret, error) { - sharedKey, err := ecies.ImportECDSA(myPrivateKey).GenerateShared( - ecies.ImportECDSAPublic(theirPublicKey), - sskLen, - sskLen, - ) - if err != nil { - return nil, err - } - - logger := s.logger.With(zap.String("site", "generate")) - - logger.Debug( - "saving a shared key", - zap.Binary("their-public-key", crypto.FromECDSAPub(theirPublicKey)), - zap.String("installation-id", installationID), - ) - - theirIdentity := crypto.CompressPubkey(theirPublicKey) - if err = s.persistence.Add(theirIdentity, sharedKey, installationID); err != nil { - return nil, err - } - - return &Secret{Key: sharedKey, Identity: theirPublicKey}, err -} - -// Generate will generate a shared secret for a given identity, and return it. -func (s *SharedSecret) Generate(myPrivateKey *ecdsa.PrivateKey, theirPublicKey *ecdsa.PublicKey, installationID string) (*Secret, error) { - return s.generate(myPrivateKey, theirPublicKey, installationID) -} - -// Agreed returns true if a secret has been acknowledged by all the installationIDs. -func (s *SharedSecret) Agreed(myPrivateKey *ecdsa.PrivateKey, myInstallationID string, theirPublicKey *ecdsa.PublicKey, theirInstallationIDs []string) (*Secret, bool, error) { - logger := s.logger.With(zap.String("site", "Agreed")) - - logger.Debug( - "checking if shared secret is acknowledged", - zap.Binary("their-public-key", crypto.FromECDSAPub(theirPublicKey)), - zap.Strings("their-installation-ids", theirInstallationIDs), - ) - - secret, err := s.generate(myPrivateKey, theirPublicKey, myInstallationID) - if err != nil { - return nil, false, err - } - - if len(theirInstallationIDs) == 0 { - return secret, false, nil - } - - theirIdentity := crypto.CompressPubkey(theirPublicKey) - response, err := s.persistence.Get(theirIdentity, theirInstallationIDs) - if err != nil { - return nil, false, err - } - - for _, installationID := range theirInstallationIDs { - if !response.installationIDs[installationID] { - logger.Debug("no shared secret for installation", zap.String("installation-id", installationID)) - return secret, false, nil - } - } - - if !bytes.Equal(secret.Key, response.secret) { - return nil, false, errors.New("computed and saved secrets are different for a given identity") - } - - return secret, true, nil -} - -func (s *SharedSecret) All() ([]*Secret, error) { - var secrets []*Secret - tuples, err := s.persistence.All() - if err != nil { - return nil, err - } - - for _, tuple := range tuples { - key, err := crypto.DecompressPubkey(tuple[0]) - if err != nil { - return nil, err - } - secrets = append(secrets, &Secret{Identity: key, Key: tuple[1]}) - } - - return secrets, nil -} diff --git a/vendor/github.com/status-im/status-go/protocol/encryption/x3dh.go b/vendor/github.com/status-im/status-go/protocol/encryption/x3dh.go deleted file mode 100644 index 85b957fa8..000000000 --- a/vendor/github.com/status-im/status-go/protocol/encryption/x3dh.go +++ /dev/null @@ -1,249 +0,0 @@ -package encryption - -import ( - "crypto/ecdsa" - "errors" - "sort" - "strconv" - "time" - - "github.com/status-im/status-go/eth-node/crypto" - "github.com/status-im/status-go/eth-node/crypto/ecies" -) - -const ( - // Shared secret key length - sskLen = 16 -) - -func buildSignatureMaterial(bundle *Bundle) []byte { - signedPreKeys := bundle.GetSignedPreKeys() - timestamp := bundle.GetTimestamp() - var keys []string - - for k := range signedPreKeys { - keys = append(keys, k) - } - var signatureMaterial []byte - - sort.Strings(keys) - - for _, installationID := range keys { - signedPreKey := signedPreKeys[installationID] - signatureMaterial = append(signatureMaterial, []byte(installationID)...) - signatureMaterial = append(signatureMaterial, signedPreKey.SignedPreKey...) - signatureMaterial = append(signatureMaterial, []byte(strconv.FormatUint(uint64(signedPreKey.Version), 10))...) - // We don't use timestamp in the signature if it's 0, for backward compatibility - } - - if timestamp != 0 { - signatureMaterial = append(signatureMaterial, []byte(strconv.FormatInt(timestamp, 10))...) - } - - return signatureMaterial - -} - -// SignBundle signs the bundle and refreshes the timestamps -func SignBundle(identity *ecdsa.PrivateKey, bundleContainer *BundleContainer) error { - bundleContainer.Bundle.Timestamp = time.Now().UnixNano() - signatureMaterial := buildSignatureMaterial(bundleContainer.GetBundle()) - - signature, err := crypto.Sign(crypto.Keccak256(signatureMaterial), identity) - if err != nil { - return err - } - bundleContainer.Bundle.Signature = signature - return nil -} - -// NewBundleContainer creates a new BundleContainer from an identity private key -func NewBundleContainer(identity *ecdsa.PrivateKey, installationID string) (*BundleContainer, error) { - preKey, err := crypto.GenerateKey() - if err != nil { - return nil, err - } - - compressedPreKey := crypto.CompressPubkey(&preKey.PublicKey) - compressedIdentityKey := crypto.CompressPubkey(&identity.PublicKey) - - encodedPreKey := crypto.FromECDSA(preKey) - signedPreKeys := make(map[string]*SignedPreKey) - signedPreKeys[installationID] = &SignedPreKey{ - ProtocolVersion: protocolVersion, - SignedPreKey: compressedPreKey, - } - - bundle := Bundle{ - Timestamp: time.Now().UnixNano(), - Identity: compressedIdentityKey, - SignedPreKeys: signedPreKeys, - } - - return &BundleContainer{ - Bundle: &bundle, - PrivateSignedPreKey: encodedPreKey, - }, nil -} - -// VerifyBundle checks that a bundle is valid -func VerifyBundle(bundle *Bundle) error { - _, err := ExtractIdentity(bundle) - return err -} - -// ExtractIdentity extracts the identity key from a given bundle -func ExtractIdentity(bundle *Bundle) (*ecdsa.PublicKey, error) { - bundleIdentityKey, err := crypto.DecompressPubkey(bundle.GetIdentity()) - if err != nil { - return nil, err - } - - signatureMaterial := buildSignatureMaterial(bundle) - - recoveredKey, err := crypto.SigToPub( - crypto.Keccak256(signatureMaterial), - bundle.GetSignature(), - ) - if err != nil { - return nil, err - } - - if crypto.PubkeyToAddress(*recoveredKey) != crypto.PubkeyToAddress(*bundleIdentityKey) { - return nil, errors.New("identity key and signature mismatch") - } - - return recoveredKey, nil -} - -// PerformDH generates a shared key given a private and a public key -func PerformDH(privateKey *ecies.PrivateKey, publicKey *ecies.PublicKey) ([]byte, error) { - return privateKey.GenerateShared( - publicKey, - sskLen, - sskLen, - ) -} - -func getSharedSecret(dh1 []byte, dh2 []byte, dh3 []byte) []byte { - secretInput := append(append(dh1, dh2...), dh3...) - - return crypto.Keccak256(secretInput) -} - -// x3dhActive handles initiating an X3DH session -func x3dhActive( - myIdentityKey *ecies.PrivateKey, - theirSignedPreKey *ecies.PublicKey, - myEphemeralKey *ecies.PrivateKey, - theirIdentityKey *ecies.PublicKey, -) ([]byte, error) { - var dh1, dh2, dh3 []byte - var err error - - if dh1, err = PerformDH(myIdentityKey, theirSignedPreKey); err != nil { - return nil, err - } - - if dh2, err = PerformDH(myEphemeralKey, theirIdentityKey); err != nil { - return nil, err - } - - if dh3, err = PerformDH(myEphemeralKey, theirSignedPreKey); err != nil { - return nil, err - } - - return getSharedSecret(dh1, dh2, dh3), nil -} - -// x3dhPassive handles the response to an initiated X3DH session -func x3dhPassive( - theirIdentityKey *ecies.PublicKey, - mySignedPreKey *ecies.PrivateKey, - theirEphemeralKey *ecies.PublicKey, - myIdentityKey *ecies.PrivateKey, -) ([]byte, error) { - var dh1, dh2, dh3 []byte - var err error - - if dh1, err = PerformDH(mySignedPreKey, theirIdentityKey); err != nil { - return nil, err - } - - if dh2, err = PerformDH(myIdentityKey, theirEphemeralKey); err != nil { - return nil, err - } - - if dh3, err = PerformDH(mySignedPreKey, theirEphemeralKey); err != nil { - return nil, err - } - - return getSharedSecret(dh1, dh2, dh3), nil -} - -// PerformActiveDH performs a Diffie-Hellman exchange using a public key and a generated ephemeral key. -// Returns the key resulting from the DH exchange as well as the ephemeral public key. -func PerformActiveDH(publicKey *ecdsa.PublicKey) ([]byte, *ecdsa.PublicKey, error) { - ephemeralKey, err := crypto.GenerateKey() - if err != nil { - return nil, nil, err - } - - key, err := PerformDH( - ecies.ImportECDSA(ephemeralKey), - ecies.ImportECDSAPublic(publicKey), - ) - if err != nil { - return nil, nil, err - } - - return key, &ephemeralKey.PublicKey, err -} - -// PerformActiveX3DH takes someone else's bundle and calculates shared secret. -// Returns the shared secret and the ephemeral key used. -func PerformActiveX3DH(identity []byte, signedPreKey []byte, prv *ecdsa.PrivateKey) ([]byte, *ecdsa.PublicKey, error) { - bundleIdentityKey, err := crypto.DecompressPubkey(identity) - if err != nil { - return nil, nil, err - } - - bundleSignedPreKey, err := crypto.DecompressPubkey(signedPreKey) - if err != nil { - return nil, nil, err - } - - ephemeralKey, err := crypto.GenerateKey() - if err != nil { - return nil, nil, err - } - - sharedSecret, err := x3dhActive( - ecies.ImportECDSA(prv), - ecies.ImportECDSAPublic(bundleSignedPreKey), - ecies.ImportECDSA(ephemeralKey), - ecies.ImportECDSAPublic(bundleIdentityKey), - ) - if err != nil { - return nil, nil, err - } - - return sharedSecret, &ephemeralKey.PublicKey, nil -} - -// PerformPassiveX3DH handles the part of the protocol where -// our interlocutor used our bundle, with ID of the signedPreKey, -// we loaded our identity key and the correct signedPreKey and we perform X3DH -func PerformPassiveX3DH(theirIdentityKey *ecdsa.PublicKey, mySignedPreKey *ecdsa.PrivateKey, theirEphemeralKey *ecdsa.PublicKey, myPrivateKey *ecdsa.PrivateKey) ([]byte, error) { - sharedSecret, err := x3dhPassive( - ecies.ImportECDSAPublic(theirIdentityKey), - ecies.ImportECDSA(mySignedPreKey), - ecies.ImportECDSAPublic(theirEphemeralKey), - ecies.ImportECDSA(myPrivateKey), - ) - if err != nil { - return nil, err - } - - return sharedSecret, nil -} diff --git a/vendor/github.com/status-im/status-go/protocol/ens.go b/vendor/github.com/status-im/status-go/protocol/ens.go deleted file mode 100644 index 2166be49e..000000000 --- a/vendor/github.com/status-im/status-go/protocol/ens.go +++ /dev/null @@ -1,63 +0,0 @@ -package protocol - -import ( - "math" - "strings" -) - -// maxRetries is the maximum number of attemps we do before giving up -const maxRetries uint64 = 11 - -// ENSBackoffTimeMs is the step of the exponential backoff -// we retry roughtly for 17 hours after receiving the message 2^11 * 30000 -const ENSBackoffTimeMs uint64 = 30000 - -// We calculate if it's too early to retry, by exponentially backing off -func verifiedENSRecentlyEnough(now, verifiedAt, retries uint64) bool { - return now < verifiedAt+ENSBackoffTimeMs*retries*uint64(math.Exp2(float64(retries))) -} - -func shouldENSBeVerified(c *Contact, now uint64) bool { - if c.Name == "" { - return false - } - - if c.ENSVerified { - return false - } - - if c.ENSVerificationRetries >= maxRetries { - return false - } - - if verifiedENSRecentlyEnough(now, c.ENSVerifiedAt, c.ENSVerificationRetries) { - return false - } - - if !strings.HasSuffix(c.Name, ".eth") { - return false - } - - return true -} - -// This should trigger re-verification of the ENS name for this contact -func hasENSNameChanged(c *Contact, newName string, clockValue uint64) bool { - if c.LastENSClockValue > clockValue { - return false - } - - if newName == "" { - return false - } - - if !strings.HasSuffix(newName, ".eth") { - return false - } - - if newName == c.Name { - return false - } - - return true -} diff --git a/vendor/github.com/status-im/status-go/protocol/go.mod b/vendor/github.com/status-im/status-go/protocol/go.mod deleted file mode 100644 index a9010509b..000000000 --- a/vendor/github.com/status-im/status-go/protocol/go.mod +++ /dev/null @@ -1,31 +0,0 @@ -module github.com/status-im/status-go/protocol - -go 1.13 - -replace github.com/ethereum/go-ethereum v1.9.5 => github.com/status-im/go-ethereum v1.9.5-status.7 - -replace github.com/gomarkdown/markdown v0.0.0-20191209105822-e3ba6c6109ba => github.com/status-im/markdown v0.0.0-20191209105822-e3ba6c6109ba - -replace github.com/status-im/status-go/eth-node => ../eth-node - -replace github.com/status-im/status-go/whisper/v6 => ../whisper - -require ( - github.com/cenkalti/backoff/v3 v3.0.0 - github.com/ethereum/go-ethereum v1.9.5 - github.com/golang/protobuf v1.3.2 - github.com/gomarkdown/markdown v0.0.0-20191209105822-e3ba6c6109ba - github.com/google/uuid v1.1.1 - github.com/jinzhu/copier v0.0.0-20190625015134-976e0346caa8 - github.com/lucasb-eyer/go-colorful v1.0.2 - github.com/mutecomm/go-sqlcipher v0.0.0-20190227152316-55dbde17881f - github.com/pkg/errors v0.8.1 - github.com/russolsen/transit v0.0.0-20180705123435-0794b4c4505a - github.com/status-im/doubleratchet v3.0.0+incompatible - github.com/status-im/migrate/v4 v4.6.2-status.2 - github.com/status-im/status-go/eth-node v1.1.0 - github.com/status-im/status-go/whisper/v6 v6.1.0 - github.com/stretchr/testify v1.4.0 - github.com/vacp2p/mvds v0.0.23 - go.uber.org/zap v1.13.0 -) diff --git a/vendor/github.com/status-im/status-go/protocol/go.sum b/vendor/github.com/status-im/status-go/protocol/go.sum deleted file mode 100644 index 7620481b2..000000000 --- a/vendor/github.com/status-im/status-go/protocol/go.sum +++ /dev/null @@ -1,832 +0,0 @@ -bazil.org/fuse v0.0.0-20160811212531-371fbbdaa898/go.mod h1:Xbm+BRKSBEpa4q4hTSxohYNQpsxXPbPry4JJWOB3LB8= -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.37.4/go.mod h1:NHPJ89PdicEuT9hdPXMROBD91xc5uRDxsMtSB16k7hw= -github.com/AndreasBriese/bbloom v0.0.0-20180913140656-343706a395b7/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8= -github.com/AndreasBriese/bbloom v0.0.0-20190306092124-e2d15f34fcf9/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8= -github.com/Azure/azure-pipeline-go v0.0.0-20180607212504-7571e8eb0876/go.mod h1:XA1kFWRVhSK+KNFiOhfv83Fv8L9achrP7OxIzeTn1Yg= -github.com/Azure/azure-storage-blob-go v0.0.0-20180712005634-eaae161d9d5e/go.mod h1:x2mtS6O3mnMEZOJp7d7oldh8IvatBrMfReiyQ+cKgKY= -github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8= -github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/DATA-DOG/go-sqlmock v1.3.3 h1:CWUqKXe0s8A2z6qCgkP4Kru7wC11YoAnoupUKFDnH08= -github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= -github.com/DataDog/zstd v1.3.6-0.20190409195224-796139022798/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= -github.com/Julusian/godocdown v0.0.0-20170816220326-6d19f8ff2df8/go.mod h1:INZr5t32rG59/5xeltqoCJoNY7e5x/3xoY9WSWVWg74= -github.com/Kubuxu/go-os-helper v0.0.1/go.mod h1:N8B+I7vPCT80IcP58r50u4+gEEcsZETFUpAzWW2ep1Y= -github.com/Microsoft/go-winio v0.4.11/go.mod h1:VhR8bwka0BXejwEJY73c50VrPtXAaKcyvVC4A4RozmA= -github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5/go.mod h1:lmUJ/7eu/Q8D7ML55dXQrVaamCz2vxCfdQBasLZfHKk= -github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= -github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= -github.com/Shopify/sarama v1.23.1/go.mod h1:XLH1GYJnLVE0XCr6KdJGVJRTwY30moWNJ4sERjXX6fs= -github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= -github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= -github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 h1:JYp7IbQjafoB+tBA3gMyHYHrpOtNuDiK/uB5uXxq5wM= -github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4 h1:Hs82Z41s6SdL1CELW+XaDYmOH4hkBN4/N9og/AsOv7E= -github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/allegro/bigcache v0.0.0-20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= -github.com/allegro/bigcache v1.1.0/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= -github.com/allegro/bigcache v1.2.0 h1:qDaE0QoF29wKBb3+pXFrJFy1ihe5OT9OiXhg1t85SxM= -github.com/allegro/bigcache v1.2.0/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= -github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= -github.com/apilayer/freegeoip v3.5.0+incompatible/go.mod h1:CUfFqErhFhXneJendyQ/rRcuA8kH8JxHvYnbOozmlCU= -github.com/aristanetworks/fsnotify v1.4.2/go.mod h1:D/rtu7LpjYM8tRJphJ0hUBYpjai8SfX+aSNsWDTq/Ks= -github.com/aristanetworks/glog v0.0.0-20180419172825-c15b03b3054f/go.mod h1:KASm+qXFKs/xjSoWn30NrWBBvdTTQq+UjkhjEJHfSFA= -github.com/aristanetworks/goarista v0.0.0-20170210015632-ea17b1a17847/go.mod h1:D/tb0zPVXnP7fmsLZjtdUhSsumbK/ij54UXjjVgMGxQ= -github.com/aristanetworks/goarista v0.0.0-20181002214814-33151c4543a7/go.mod h1:D/tb0zPVXnP7fmsLZjtdUhSsumbK/ij54UXjjVgMGxQ= -github.com/aristanetworks/goarista v0.0.0-20190219163901-728bce664cf5 h1:L0TwgZQo7Mga9im6FvKEZGIvyLE/VG/HI5loz5LpvC0= -github.com/aristanetworks/goarista v0.0.0-20190219163901-728bce664cf5/go.mod h1:D/tb0zPVXnP7fmsLZjtdUhSsumbK/ij54UXjjVgMGxQ= -github.com/aristanetworks/goarista v0.0.0-20190502180301-283422fc1708 h1:tS7jSmwRqSxTnonTRlDD1oHo6Q9YOK4xHS9/v4L56eg= -github.com/aristanetworks/goarista v0.0.0-20190502180301-283422fc1708/go.mod h1:D/tb0zPVXnP7fmsLZjtdUhSsumbK/ij54UXjjVgMGxQ= -github.com/aristanetworks/goarista v0.0.0-20191106175434-873d404c7f40 h1:ZdRuixFqR3mfx4FHzclG3COrRgWrYq0VhNgIoYoObcM= -github.com/aristanetworks/goarista v0.0.0-20191106175434-873d404c7f40/go.mod h1:Z4RTxGAuYhPzcq8+EdRM+R8M48Ssle2TsWtwRKa+vns= -github.com/aristanetworks/splunk-hec-go v0.3.3/go.mod h1:1VHO9r17b0K7WmOlLb9nTk/2YanvOEnLMUgsFrxBROc= -github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= -github.com/aws/aws-sdk-go v1.17.7/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= -github.com/beevik/ntp v0.2.0/go.mod h1:hIHWr+l3+/clUnF44zdK+CWW7fO8dR5cIylAQ76NRpg= -github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= -github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= -github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= -github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= -github.com/bitly/go-hostpool v0.0.0-20171023180738-a3a6125de932/go.mod h1:NOuUCSz6Q9T7+igc/hlvDOUdtWKryOrtFyIVABv/p7k= -github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4= -github.com/btcsuite/btcd v0.0.0-20181013004428-67e573d211ac/go.mod h1:Dmm/EzmjnCiweXmzRIAiUWCInVmPgjkzgv5k4tVyXiQ= -github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8= -github.com/btcsuite/btcd v0.0.0-20190418232430-6867ff32788a/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8= -github.com/btcsuite/btcd v0.0.0-20190523000118-16327141da8c/go.mod h1:3J08xEfcugPacsc34/LKRU2yO7YmuT8yt28J8k2+rrI= -github.com/btcsuite/btcd v0.0.0-20190824003749-130ea5bddde3/go.mod h1:3J08xEfcugPacsc34/LKRU2yO7YmuT8yt28J8k2+rrI= -github.com/btcsuite/btcd v0.20.0-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= -github.com/btcsuite/btcd v0.20.1-beta h1:Ik4hyJqN8Jfyv3S4AGBOmyouMsYE3EdYODkMbQjwPGw= -github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= -github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= -github.com/btcsuite/btcutil v0.0.0-20190207003914-4c204d697803/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= -github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d h1:yJzD/yFppdVCf6ApMkVy8cUxV0XrxdP9rVf6D87/Mng= -github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= -github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= -github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= -github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= -github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= -github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= -github.com/cenkalti/backoff/v3 v3.0.0 h1:ske+9nBpD9qZsTBoF41nW5L+AIuFBKMeze18XQ3eG1c= -github.com/cenkalti/backoff/v3 v3.0.0/go.mod h1:cIeZDE3IrqwwJl6VUwCN6trj1oXrTS4rc0ij+ULvLYs= -github.com/cespare/cp v0.1.0/go.mod h1:SOGHArjBr4JWaSDEVpWpo/hNg6RoKrls6Oh40hiwW+s= -github.com/cespare/cp v1.1.1 h1:nCb6ZLdB7NRaqsm91JtQTAme2SKJzXVsdPIPkyJr1MU= -github.com/cespare/cp v1.1.1/go.mod h1:SOGHArjBr4JWaSDEVpWpo/hNg6RoKrls6Oh40hiwW+s= -github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= -github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= -github.com/cespare/xxhash/v2 v2.1.0 h1:yTUvW7Vhb89inJ+8irsUqiWjh8iT6sQPZiQzI6ReGkA= -github.com/cespare/xxhash/v2 v2.1.0/go.mod h1:dgIUBU3pDso/gPgZ1osOZ0iQf77oPR28Tjxl5dIMyVM= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ= -github.com/cockroachdb/cockroach-go v0.0.0-20181001143604-e0a95dfd547c/go.mod h1:XGLbWH/ujMcbPbhZq52Nv6UrCghb1yGn//133kEsvDk= -github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= -github.com/containerd/containerd v1.2.7/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= -github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= -github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= -github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= -github.com/cznic/b v0.0.0-20180115125044-35e9bbe41f07/go.mod h1:URriBxXwVq5ijiJ12C7iIZqlA69nTlI+LgI6/pwftG8= -github.com/cznic/fileutil v0.0.0-20180108211300-6a051e75936f/go.mod h1:8S58EK26zhXSxzv7NQFpnliaOQsmDUxvoQO3rt154Vg= -github.com/cznic/golex v0.0.0-20170803123110-4ab7c5e190e4/go.mod h1:+bmmJDNmKlhWNG+gwWCkaBoTy39Fs+bzRxVBzoTQbIc= -github.com/cznic/internal v0.0.0-20180608152220-f44710a21d00/go.mod h1:olo7eAdKwJdXxb55TKGLiJ6xt1H0/tiiRCWKVLmtjY4= -github.com/cznic/lldb v1.1.0/go.mod h1:FIZVUmYUVhPwRiPzL8nD/mpFcJ/G7SSXjjXYG4uRI3A= -github.com/cznic/mathutil v0.0.0-20180504122225-ca4c9f2c1369/go.mod h1:e6NPNENfs9mPDVNRekM7lKScauxd5kXTr1Mfyig6TDM= -github.com/cznic/ql v1.2.0/go.mod h1:FbpzhyZrqr0PVlK6ury+PoW3T0ODUV22OeWIxcaOrSE= -github.com/cznic/sortutil v0.0.0-20150617083342-4c7342852e65/go.mod h1:q2w6Bg5jeox1B+QkJ6Wp/+Vn0G/bo3f1uY7Fn3vivIQ= -github.com/cznic/strutil v0.0.0-20171016134553-529a34b1c186/go.mod h1:AHHPPPXTw0h6pVabbcbyGRK1DckRn7r/STdZEeIDzZc= -github.com/cznic/zappy v0.0.0-20160723133515-2533cb5b45cc/go.mod h1:Y1SNZ4dRUOKXshKUbwUapqNncRrho4mkjQebgEHZLj8= -github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/deckarep/golang-set v0.0.0-20180603214616-504e848d77ea/go.mod h1:93vsz/8Wt4joVM7c2AVqh+YRMiUSc14yDtF28KmMOgQ= -github.com/deckarep/golang-set v1.7.1 h1:SCQV0S6gTtp6itiFrTqI+pfmJ4LN85S1YzhDf9rTHJQ= -github.com/deckarep/golang-set v1.7.1/go.mod h1:93vsz/8Wt4joVM7c2AVqh+YRMiUSc14yDtF28KmMOgQ= -github.com/denisenkom/go-mssqldb v0.0.0-20190515213511-eb9f6a1743f3/go.mod h1:zAg7JM8CkOJ43xKXIj7eRO9kmWm/TW578qo+oDO6tuM= -github.com/dgraph-io/badger v1.5.5-0.20190226225317-8115aed38f8f/go.mod h1:VZxzAIRPHRVNRKRo6AXrX9BJegn6il06VMTZVJYCIjQ= -github.com/dgraph-io/badger v1.6.0-rc1/go.mod h1:zwt7syl517jmP8s94KqSxTlM6IMsdhYy6psNgSztDR4= -github.com/dgrijalva/jwt-go v0.0.0-20170201225849-2268707a8f08/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= -github.com/dgryski/go-farm v0.0.0-20190104051053-3adb47b1fb0f/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= -github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= -github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= -github.com/dhui/dktest v0.3.0/go.mod h1:cyzIUfGsBEbZ6BT7tnXqAShHSXCZhSNmFl70sZ7c1yc= -github.com/docker/distribution v2.7.0+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= -github.com/docker/docker v0.0.0-20180625184442-8e610b2b55bf/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= -github.com/docker/docker v0.7.3-0.20190103212154-2b7e084dc98b/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= -github.com/docker/docker v0.7.3-0.20190817195342-4760db040282/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= -github.com/docker/docker v1.13.1/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= -github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= -github.com/docker/go-units v0.3.3/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= -github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -github.com/dvyukov/go-fuzz v0.0.0-20191022152526-8cb203812681/go.mod h1:11Gm+ccJnvAhCNLlf5+cS9KjtbaD5I5zaZpFMsTHWTw= -github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= -github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= -github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= -github.com/edsrzf/mmap-go v0.0.0-20160512033002-935e0e8a636c/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= -github.com/edsrzf/mmap-go v0.0.0-20170320065105-0bce6a688712/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= -github.com/edsrzf/mmap-go v1.0.0 h1:CEBF7HpRnUCSJgGUb5h1Gm7e3VkmVDrR8lvWVLtrOFw= -github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= -github.com/elastic/gosigar v0.0.0-20180330100440-37f05ff46ffa/go.mod h1:cdorVVzy1fhmEqmtgqkoE3bYtCfSCkVyjTyCIo22xvs= -github.com/elastic/gosigar v0.10.4 h1:6jfw75dsoflhBMRdO6QPzQUgLqUYTsQQQRkkcsHsuPo= -github.com/elastic/gosigar v0.10.4/go.mod h1:cdorVVzy1fhmEqmtgqkoE3bYtCfSCkVyjTyCIo22xvs= -github.com/elastic/gosigar v0.10.5 h1:GzPQ+78RaAb4J63unidA/JavQRKrB6s8IOzN6Ib59jo= -github.com/elastic/gosigar v0.10.5/go.mod h1:cdorVVzy1fhmEqmtgqkoE3bYtCfSCkVyjTyCIo22xvs= -github.com/elazarl/go-bindata-assetfs v1.0.0/go.mod h1:v+YaWX3bdea5J/mo8dSETolEo7R71Vk1u8bnjau5yw4= -github.com/ethereum/go-ethereum v1.8.20/go.mod h1:PwpWDrCLZrV+tfrhqqF6kPknbISMHaJv9Ln3kPCZLwY= -github.com/ethereum/go-ethereum v1.9.2/go.mod h1:PwpWDrCLZrV+tfrhqqF6kPknbISMHaJv9Ln3kPCZLwY= -github.com/ethereum/go-ethereum v1.9.9 h1:jnoBvjH8aMH++iH14XmiJdAsnRcmZUM+B5fsnEZBVE0= -github.com/fatih/color v1.3.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= -github.com/fjl/memsize v0.0.0-20180418122429-ca190fb6ffbc/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0= -github.com/fjl/memsize v0.0.0-20180929194037-2a09253e352a h1:1znxn4+q2MrEdTk1eCk6KIV3muTYVclBIB6CTVR/zBc= -github.com/fjl/memsize v0.0.0-20180929194037-2a09253e352a/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0= -github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/fsouza/fake-gcs-server v1.7.0/go.mod h1:5XIRs4YvwNbNoz+1JF8j6KLAyDh7RHGAyAK3EP2EsNk= -github.com/garyburd/redigo v1.6.0/go.mod h1:NR3MbYisc3/PwhQ00EMzDiPmrwpPxAn5GI05/YaO1SY= -github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff h1:tY80oXqGNY4FhTFhk+o9oFHGINQ/+vhlm8HFzi6znCI= -github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= -github.com/gballet/go-libpcsclite v0.0.0-20191108122812-4678299bea08 h1:f6D9Hr8xV8uYKlyuj8XIruxlh9WjVjdh1gIicAS7ays= -github.com/gballet/go-libpcsclite v0.0.0-20191108122812-4678299bea08/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= -github.com/gizak/termui v0.0.0-20170117222342-991cd3d38091/go.mod h1:PkJoWUt/zacQKysNfQtcw1RW+eK2SxkieVBtl+4ovLA= -github.com/go-check/check v0.0.0-20180628173108-788fd7840127/go.mod h1:9ES+weclKsC9YodN5RgxqK/VD9HM9JsCSh7rNhMZE98= -github.com/go-kit/kit v0.8.0 h1:Wz+5lgoB0kkuqLEc6NVmwRknTKP6dTGbSqvhZtBI/j0= -github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-kit/kit v0.9.0 h1:wDJmvq38kDhkVxi50ni9ykkdUr1PKgqKOoi01fa0Mdk= -github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-logfmt/logfmt v0.3.0 h1:8HUsc87TaSWLKwrnumgC8/YconD2fJQsRJAsWaPg2ic= -github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= -github.com/go-logfmt/logfmt v0.4.0 h1:MP4Eh7ZCb31lleYCFuwm0oe4/YGak+5l1vA2NOE80nA= -github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= -github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8= -github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q= -github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= -github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD876Lmtgy7VtROAbHHXk8no= -github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= -github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= -github.com/go-stack/stack v1.5.4/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= -github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/gocql/gocql v0.0.0-20190301043612-f6df8288f9b4/go.mod h1:4Fw1eo5iaEhDUs8XyuhSVCVy52Jq3L+/3GJgYkwc+/0= -github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/gogo/protobuf v1.3.0/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= -github.com/golang-migrate/migrate/v4 v4.6.2 h1:LDDOHo/q1W5UDj6PbkxdCv7lv9yunyZHXvxuwDkGo3k= -github.com/golang-migrate/migrate/v4 v4.6.2/go.mod h1:JYi6reN3+Z734VZ0akNuyOJNcrg45ZL7LDBMW3WGJL0= -github.com/golang-migrate/migrate/v4 v4.7.0 h1:gONcHxHApDTKXDyLH/H97gEHmpu1zcnnbAaq2zgrPrs= -github.com/golang-migrate/migrate/v4 v4.7.0/go.mod h1:Qvut3N4xKWjoH3sokBccML6WyHSnggXm/DvMMnTsQIc= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/snappy v0.0.0-20170215233205-553a64147049/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4= -github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/gomarkdown/markdown v0.0.0-20191104174740-4d42851d4d5a h1:DsPLKbIJTzHsGplH4h3cqgd0OMoHLyICj9ZkoqQnUE0= -github.com/gomarkdown/markdown v0.0.0-20191104174740-4d42851d4d5a/go.mod h1:aii0r/K0ZnHv7G0KF7xy1v0A7s2Ljrb5byB7MO5p6TU= -github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ= -github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= -github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= -github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= -github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= -github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= -github.com/gorilla/mux v1.7.1/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= -github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= -github.com/gorilla/websocket v1.4.1 h1:q7AeDBpnBk8AogcD4DSag/Ukw/KV+YhzLj2bP5HvKCM= -github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/graph-gophers/graphql-go v0.0.0-20190724201507-010347b5f9e6/go.mod h1:Au3iQ8DvDis8hZ4q2OzRcaKYlAsPt+fYvib5q4nIqu4= -github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= -github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= -github.com/gyuho/goraph v0.0.0-20171001060514-a7a4454fd3eb/go.mod h1:NtSxZCD+s3sZFwbW6WceOcUD83HM9XD5OE2r4c0P8eg= -github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed/go.mod h1:tMWxXQ9wFIaZeTI9F+hmhFiGpFmhOHzyShyFUhRm0H4= -github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA= -github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= -github.com/hashicorp/go-multierror v1.0.0 h1:iVjPR7a6H0tWELX5NxNe7bYopibicUzc7uPribsnS6o= -github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= -github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/golang-lru v0.0.0-20160813221303-0a025b7e63ad/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.5.1 h1:0hERBMJE1eitiLkihrMvRVBYAkpHzc/J3QdDN+dAcgU= -github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= -github.com/howeyc/fsnotify v0.9.0/go.mod h1:41HzSPxBGeFRQKEEwgh49TRw/nKBsYZ2cF1OzPjSJsA= -github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/huin/goupnp v0.0.0-20161224104101-679507af18f3/go.mod h1:MZ2ZmwcBpvOoJ22IJsc7va19ZwoheaBk43rKg12SKag= -github.com/huin/goupnp v1.0.0 h1:wg75sLpL6DZqwHQN6E1Cfk6mtfzS45z8OV+ic+DtHRo= -github.com/huin/goupnp v1.0.0/go.mod h1:n9v9KO1tAxYH82qOn+UTIFQDmx5n1Zxd/ClZDMX7Bnc= -github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150/go.mod h1:PpLOETDnJ0o3iZrZfqZzyLl6l7F3c6L1oWn7OICBi6o= -github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= -github.com/influxdata/influxdb v0.0.0-20180221223340-01288bdb0883/go.mod h1:qZna6X/4elxqT3yI9iZYdZrWWdeFOOprn86kgg4+IzY= -github.com/influxdata/influxdb v1.7.7/go.mod h1:qZna6X/4elxqT3yI9iZYdZrWWdeFOOprn86kgg4+IzY= -github.com/influxdata/influxdb1-client v0.0.0-20190809212627-fc22c7df067e/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= -github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/ipfs/go-cid v0.0.2/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/ipfs/go-cid v0.0.3/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= -github.com/ipfs/go-datastore v0.0.1/go.mod h1:d4KVXhMt913cLBEI/PXAy6ko+W7e9AhyAKBGh803qeE= -github.com/ipfs/go-detect-race v0.0.1/go.mod h1:8BNT7shDZPo99Q74BpGMK+4D8Mn4j46UU0LZ723meps= -github.com/ipfs/go-ds-badger v0.0.2/go.mod h1:Y3QpeSFWQf6MopLTiZD+VT6IC1yZqaGmjvRcKeSGij8= -github.com/ipfs/go-ds-badger v0.0.5/go.mod h1:g5AuuCGmr7efyzQhLL8MzwqcauPojGPUaHzfGTzuE3s= -github.com/ipfs/go-ds-leveldb v0.0.1/go.mod h1:feO8V3kubwsEF22n0YRQCffeb79OOYIykR4L04tMOYc= -github.com/ipfs/go-ipfs-delay v0.0.0-20181109222059-70721b86a9a8/go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw= -github.com/ipfs/go-ipfs-util v0.0.1/go.mod h1:spsl5z8KUnrve+73pOhSVZND1SIxPW5RyBCNzQxlJBc= -github.com/ipfs/go-log v0.0.1/go.mod h1:kL1d2/hzSpI0thNYjiKfjanbVNU+IIGA/WnNESY9leM= -github.com/jackc/fake v0.0.0-20150926172116-812a484cc733/go.mod h1:WrMFNQdiFJ80sQsxDoMokWK1W5TQtxBFNpzWTD84ibQ= -github.com/jackc/pgx v3.2.0+incompatible/go.mod h1:0ZGrqGqkRlliWnWB4zKnWtjbSWbGkVEFm4TeybAXq+I= -github.com/jackpal/gateway v1.0.5/go.mod h1:lTpwd4ACLXmpyiCTRtfiNyVnUmqT9RivzCDQetPfnjA= -github.com/jackpal/go-nat-pmp v0.0.0-20160603034137-1fa385a6f458/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= -github.com/jackpal/go-nat-pmp v1.0.1 h1:i0LektDkO1QlrTm/cSuP+PyBCDnYvjPLGl4LdWEMiaA= -github.com/jackpal/go-nat-pmp v1.0.1/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= -github.com/jackpal/go-nat-pmp v1.0.2 h1:KzKSgb7qkJvOUTqYl9/Hg/me3pWgBmERKrTGD7BdWus= -github.com/jackpal/go-nat-pmp v1.0.2/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= -github.com/jbenet/go-cienv v0.0.0-20150120210510-1bb1476777ec/go.mod h1:rGaEvXB4uRSZMmzKNLoXvTu1sfx+1kv/DojUlPrSZGs= -github.com/jbenet/go-cienv v0.1.0/go.mod h1:TqNnHUmJgXau0nCzC7kXWeotg3J9W34CUv5Djy1+FlA= -github.com/jbenet/go-temp-err-catcher v0.0.0-20150120210811-aac704a3f4f2/go.mod h1:8GXXJV31xl8whumTzdZsTt3RnUIiPqzkyf7mxToRCMs= -github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8/go.mod h1:Ly/wlsjFq/qrU3Rar62tu1gASgGw6chQbSh/XgIIXCY= -github.com/jbenet/goprocess v0.1.3/go.mod h1:5yspPrukOVuOLORacaBi858NqyClJPQxYZlqdZVfqY4= -github.com/jcmturner/gofork v0.0.0-20190328161633-dc7c13fece03/go.mod h1:MK8+TM0La+2rjBD4jE12Kj1pCCxK7d2LK/UM3ncEo0o= -github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/jinzhu/copier v0.0.0-20190625015134-976e0346caa8 h1:mGIXW/lubQ4B+3bXTLxcTMTjUNDqoF6T/HUW9LbFx9s= -github.com/jinzhu/copier v0.0.0-20190625015134-976e0346caa8/go.mod h1:yL958EeXv8Ylng6IfnvG4oflryUi3vgA3xPs9hmII1s= -github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= -github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= -github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= -github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= -github.com/julienschmidt/httprouter v0.0.0-20170430222011-975b5c4c7c21/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/kami-zh/go-capturer v0.0.0-20171211120116-e492ea43421d/go.mod h1:P2viExyCEfeWGU259JnaQ34Inuec4R38JCyBx2edgD0= -github.com/karalabe/hid v0.0.0-20181128192157-d815e0c1a2e2/go.mod h1:YvbcH+3Wo6XPs9nkgTY3u19KXLauXW+J5nB7hEHuX0A= -github.com/karalabe/usb v0.0.0-20190819132248-550797b1cad8 h1:VhnqxaTIudc9IWKx8uXRLnpdSb9noCEj+vHacjmhp68= -github.com/karalabe/usb v0.0.0-20190819132248-550797b1cad8/go.mod h1:Od972xHfMJowv7NGVDiWVxk2zxnWgjLlJzE+F4F7AGU= -github.com/karalabe/usb v0.0.0-20191104083709-911d15fe12a9 h1:ZHuwnjpP8LsVsUYqTqeVAI+GfDfJ6UNPrExZF+vX/DQ= -github.com/karalabe/usb v0.0.0-20191104083709-911d15fe12a9/go.mod h1:Od972xHfMJowv7NGVDiWVxk2zxnWgjLlJzE+F4F7AGU= -github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0/go.mod h1:1NbS8ALrpOvjt0rHPNLyCIeMtbizbir8U//inJ+zuB8= -github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= -github.com/klauspost/cpuid v1.2.1/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= -github.com/klauspost/reedsolomon v1.9.2/go.mod h1:CwCi+NUr9pqSVktrkN+Ondf06rkhYZ/pcNv7fu+8Un4= -github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/konsorten/go-windows-terminal-sequences v1.0.2 h1:DB17ag19krx9CFsz4o3enTrPXyIXCl+2iCXH/aMAp9s= -github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/koron/go-ssdp v0.0.0-20180514024734-4a0ed625a78b/go.mod h1:5Ky9EC2xfoUKUor0Hjgi2BJhCSXJfMOFlmyYrVKGQMk= -github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515 h1:T+h1c/A9Gawja4Y9mFVWj2vyii2bbUNDw3kt9VxK2EY= -github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kshvakov/clickhouse v1.3.5/go.mod h1:DMzX7FxRymoNkVgizH0DWAL8Cur7wHLgx3MUnGwJqpE= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y= -github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= -github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= -github.com/lib/pq v1.2.0 h1:LXpIM/LZ5xGFhOpXAQUIMM1HdyqzVYM13zNdjCEEcA0= -github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= -github.com/libp2p/go-addr-util v0.0.1/go.mod h1:4ac6O7n9rIAKB1dnd+s8IbbMXkt+oBpzX4/+RACcnlQ= -github.com/libp2p/go-buffer-pool v0.0.1/go.mod h1:xtyIz9PMobb13WaxR6Zo1Pd1zXJKYg0a8KiIvDp3TzQ= -github.com/libp2p/go-buffer-pool v0.0.2/go.mod h1:MvaB6xw5vOrDl8rYZGLFdKAuk/hRoRZd1Vi32+RXyFM= -github.com/libp2p/go-conn-security-multistream v0.1.0/go.mod h1:aw6eD7LOsHEX7+2hJkDxw1MteijaVcI+/eP2/x3J1xc= -github.com/libp2p/go-eventbus v0.1.0/go.mod h1:vROgu5cs5T7cv7POWlWxBaVLxfSegC5UGQf8A2eEmx4= -github.com/libp2p/go-flow-metrics v0.0.1/go.mod h1:Iv1GH0sG8DtYN3SVJ2eG221wMiNpZxBdp967ls1g+k8= -github.com/libp2p/go-libp2p v0.1.1/go.mod h1:I00BRo1UuUSdpuc8Q2mN7yDF/oTUTRAX6JWpTiK9Rp8= -github.com/libp2p/go-libp2p v0.4.0/go.mod h1:9EsEIf9p2UDuwtPd0DwJsAl0qXVxgAnuDGRvHbfATfI= -github.com/libp2p/go-libp2p-autonat v0.1.0/go.mod h1:1tLf2yXxiE/oKGtDwPYWTSYG3PtvYlJmg7NeVtPRqH8= -github.com/libp2p/go-libp2p-blankhost v0.1.1/go.mod h1:pf2fvdLJPsC1FsVrNP3DUUvMzUts2dsLLBEpo1vW1ro= -github.com/libp2p/go-libp2p-blankhost v0.1.4/go.mod h1:oJF0saYsAXQCSfDq254GMNmLNz6ZTHTOvtF4ZydUvwU= -github.com/libp2p/go-libp2p-circuit v0.1.0/go.mod h1:Ahq4cY3V9VJcHcn1SBXjr78AbFkZeIRmfunbA7pmFh8= -github.com/libp2p/go-libp2p-circuit v0.1.3/go.mod h1:Xqh2TjSy8DD5iV2cCOMzdynd6h8OTBGoV1AWbWor3qM= -github.com/libp2p/go-libp2p-core v0.0.1/go.mod h1:g/VxnTZ/1ygHxH3dKok7Vno1VfpvGcGip57wjTU4fco= -github.com/libp2p/go-libp2p-core v0.0.3/go.mod h1:j+YQMNz9WNSkNezXOsahp9kwZBKBvxLpKD316QWSJXE= -github.com/libp2p/go-libp2p-core v0.0.4/go.mod h1:jyuCQP356gzfCFtRKyvAbNkyeuxb7OlyhWZ3nls5d2I= -github.com/libp2p/go-libp2p-core v0.2.0/go.mod h1:X0eyB0Gy93v0DZtSYbEM7RnMChm9Uv3j7yRXjO77xSI= -github.com/libp2p/go-libp2p-core v0.2.2/go.mod h1:8fcwTbsG2B+lTgRJ1ICZtiM5GWCWZVoVrLaDRvIRng0= -github.com/libp2p/go-libp2p-core v0.2.3/go.mod h1:GqhyQqyIAPsxFYXHMjfXgMv03lxsvM0mFzuYA9Ib42A= -github.com/libp2p/go-libp2p-crypto v0.1.0/go.mod h1:sPUokVISZiy+nNuTTH/TY+leRSxnFj/2GLjtOTW90hI= -github.com/libp2p/go-libp2p-discovery v0.1.0/go.mod h1:4F/x+aldVHjHDHuX85x1zWoFTGElt8HnoDzwkFZm29g= -github.com/libp2p/go-libp2p-loggables v0.1.0/go.mod h1:EyumB2Y6PrYjr55Q3/tiJ/o3xoDasoRYM7nOzEpoa90= -github.com/libp2p/go-libp2p-mplex v0.2.0/go.mod h1:Ejl9IyjvXJ0T9iqUTE1jpYATQ9NM3g+OtR+EMMODbKo= -github.com/libp2p/go-libp2p-mplex v0.2.1/go.mod h1:SC99Rxs8Vuzrf/6WhmH41kNn13TiYdAWNYHrwImKLnE= -github.com/libp2p/go-libp2p-nat v0.0.4/go.mod h1:N9Js/zVtAXqaeT99cXgTV9e75KpnWCvVOiGzlcHmBbY= -github.com/libp2p/go-libp2p-netutil v0.1.0/go.mod h1:3Qv/aDqtMLTUyQeundkKsA+YCThNdbQD54k3TqjpbFU= -github.com/libp2p/go-libp2p-peer v0.2.0/go.mod h1:RCffaCvUyW2CJmG2gAWVqwePwW7JMgxjsHm7+J5kjWY= -github.com/libp2p/go-libp2p-peerstore v0.1.0/go.mod h1:2CeHkQsr8svp4fZ+Oi9ykN1HBb6u0MOvdJ7YIsmcwtY= -github.com/libp2p/go-libp2p-peerstore v0.1.3/go.mod h1:BJ9sHlm59/80oSkpWgr1MyY1ciXAXV397W6h1GH/uKI= -github.com/libp2p/go-libp2p-secio v0.1.0/go.mod h1:tMJo2w7h3+wN4pgU2LSYeiKPrfqBgkOsdiKK77hE7c8= -github.com/libp2p/go-libp2p-secio v0.2.0/go.mod h1:2JdZepB8J5V9mBp79BmwsaPQhRPNN2NrnB2lKQcdy6g= -github.com/libp2p/go-libp2p-swarm v0.1.0/go.mod h1:wQVsCdjsuZoc730CgOvh5ox6K8evllckjebkdiY5ta4= -github.com/libp2p/go-libp2p-swarm v0.2.2/go.mod h1:fvmtQ0T1nErXym1/aa1uJEyN7JzaTNyBcHImCxRpPKU= -github.com/libp2p/go-libp2p-testing v0.0.2/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= -github.com/libp2p/go-libp2p-testing v0.0.3/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= -github.com/libp2p/go-libp2p-testing v0.0.4/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= -github.com/libp2p/go-libp2p-testing v0.1.0/go.mod h1:xaZWMJrPUM5GlDBxCeGUi7kI4eqnjVyavGroI2nxEM0= -github.com/libp2p/go-libp2p-transport-upgrader v0.1.1/go.mod h1:IEtA6or8JUbsV07qPW4r01GnTenLW4oi3lOPbUMGJJA= -github.com/libp2p/go-libp2p-yamux v0.2.0/go.mod h1:Db2gU+XfLpm6E4rG5uGCFX6uXA8MEXOxFcRoXUODaK8= -github.com/libp2p/go-libp2p-yamux v0.2.1/go.mod h1:1FBXiHDk1VyRM1C0aez2bCfHQ4vMZKkAQzZbkSQt5fI= -github.com/libp2p/go-maddr-filter v0.0.4/go.mod h1:6eT12kSQMA9x2pvFQa+xesMKUBlj9VImZbj3B9FBH/Q= -github.com/libp2p/go-maddr-filter v0.0.5/go.mod h1:Jk+36PMfIqCJhAnaASRH83bdAvfDRp/w6ENFaC9bG+M= -github.com/libp2p/go-mplex v0.0.3/go.mod h1:pK5yMLmOoBR1pNCqDlA2GQrdAVTMkqFalaTWe7l4Yd0= -github.com/libp2p/go-mplex v0.1.0/go.mod h1:SXgmdki2kwCUlCCbfGLEgHjC4pFqhTp0ZoV6aiKgxDU= -github.com/libp2p/go-msgio v0.0.2/go.mod h1:63lBBgOTDKQL6EWazRMCwXsEeEeK9O2Cd+0+6OOuipQ= -github.com/libp2p/go-msgio v0.0.4/go.mod h1:63lBBgOTDKQL6EWazRMCwXsEeEeK9O2Cd+0+6OOuipQ= -github.com/libp2p/go-nat v0.0.3/go.mod h1:88nUEt0k0JD45Bk93NIwDqjlhiOwOoV36GchpcVc1yI= -github.com/libp2p/go-openssl v0.0.2/go.mod h1:v8Zw2ijCSWBQi8Pq5GAixw6DbFfa9u6VIYDXnvOXkc0= -github.com/libp2p/go-reuseport v0.0.1/go.mod h1:jn6RmB1ufnQwl0Q1f+YxAj8isJgDCQzaaxIFYDhcYEA= -github.com/libp2p/go-reuseport-transport v0.0.2/go.mod h1:YkbSDrvjUVDL6b8XqriyA20obEtsW9BLkuOUyQAOCbs= -github.com/libp2p/go-stream-muxer v0.0.1/go.mod h1:bAo8x7YkSpadMTbtTaxGVHWUQsR/l5MEaHbKaliuT14= -github.com/libp2p/go-stream-muxer-multistream v0.2.0/go.mod h1:j9eyPol/LLRqT+GPLSxvimPhNph4sfYfMoDPd7HkzIc= -github.com/libp2p/go-tcp-transport v0.1.0/go.mod h1:oJ8I5VXryj493DEJ7OsBieu8fcg2nHGctwtInJVpipc= -github.com/libp2p/go-tcp-transport v0.1.1/go.mod h1:3HzGvLbx6etZjnFlERyakbaYPdfjg2pWP97dFZworkY= -github.com/libp2p/go-ws-transport v0.1.0/go.mod h1:rjw1MG1LU9YDC6gzmwObkPd/Sqwhw7yT74kj3raBFuo= -github.com/libp2p/go-ws-transport v0.1.2/go.mod h1:dsh2Ld8F+XNmzpkaAijmg5Is+e9l6/1tK/6VFOdN69Y= -github.com/libp2p/go-yamux v1.2.2/go.mod h1:FGTiPvoV/3DVdgWpX+tM0OW3tsM+W5bSE3gZwqQTcow= -github.com/libp2p/go-yamux v1.2.3/go.mod h1:FGTiPvoV/3DVdgWpX+tM0OW3tsM+W5bSE3gZwqQTcow= -github.com/lucasb-eyer/go-colorful v1.0.2 h1:mCMFu6PgSozg9tDNMMK3g18oJBX7oYGrC09mS6CXfO4= -github.com/lucasb-eyer/go-colorful v1.0.2/go.mod h1:0MS4r+7BZKSJ5mw4/S5MPN+qHFF1fYclkSPilDOKW0s= -github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= -github.com/maruel/panicparse v0.0.0-20160720141634-ad661195ed0e/go.mod h1:nty42YY5QByNC5MM7q/nj938VbgPU7avs45z6NClpxI= -github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= -github.com/mattn/go-colorable v0.1.0/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= -github.com/mattn/go-colorable v0.1.1 h1:G1f5SKeVxmagw/IyvzvtZE4Gybcc4Tr1tf7I8z0XgOg= -github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= -github.com/mattn/go-isatty v0.0.0-20180830101745-3fb116b82035/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/mattn/go-isatty v0.0.7 h1:UvyT9uN+3r7yLEYSlJsbQGdsaB/a0DlgWP3pql6iwOc= -github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/mattn/go-pointer v0.0.0-20190911064623-a0a44394634f/go.mod h1:2zXcozF6qYGgmsG+SeTZz3oAbFLdD3OWqnUbNvJZAlc= -github.com/mattn/go-runewidth v0.0.3/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= -github.com/mattn/go-runewidth v0.0.4 h1:2BvfKmzob6Bmd4YsL0zygOqfdFnK7GR4QL06Do4/p7Y= -github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= -github.com/mattn/go-sqlite3 v1.10.0 h1:jbhqpg7tQe4SupckyijYiy0mJJ/pRyHvXf7JdWK860o= -github.com/mattn/go-sqlite3 v1.10.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= -github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= -github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE= -github.com/miekg/dns v1.1.12/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= -github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/minio/sha256-simd v0.0.0-20190328051042-05b4dd3047e5 h1:l16XLUUJ34wIz+RIvLhSwGvLvKyy+W598b135bJN6mg= -github.com/minio/sha256-simd v0.0.0-20190328051042-05b4dd3047e5/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/minio/sha256-simd v0.1.0/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/minio/sha256-simd v0.1.1-0.20190913151208-6de447530771/go.mod h1:B5e1o+1/KgNmWrSQK08Y6Z1Vb5pwIktudl0J58iy0KM= -github.com/minio/sha256-simd v0.1.1 h1:5QHSlgo3nt5yKOJrC7W8w7X+NFl8cMPZm96iu8kKUJU= -github.com/minio/sha256-simd v0.1.1/go.mod h1:B5e1o+1/KgNmWrSQK08Y6Z1Vb5pwIktudl0J58iy0KM= -github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= -github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8= -github.com/morikuni/aec v0.0.0-20170113033406-39771216ff4c/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= -github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/mr-tron/base58 v1.1.1/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= -github.com/mr-tron/base58 v1.1.2 h1:ZEw4I2EgPKDJ2iEw0cNmLB3ROrEmkOtXIkaG7wZg+78= -github.com/mr-tron/base58 v1.1.2/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= -github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA= -github.com/multiformats/go-multiaddr v0.0.1/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr v0.0.2/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr v0.0.4/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr v0.1.0/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= -github.com/multiformats/go-multiaddr v0.1.1/go.mod h1:aMKBKNEYmzmDmxfX88/vz+J5IU55txyt0p4aiWVohjo= -github.com/multiformats/go-multiaddr-dns v0.0.1/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q= -github.com/multiformats/go-multiaddr-dns v0.0.2/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q= -github.com/multiformats/go-multiaddr-dns v0.1.0/go.mod h1:01k2RAqtoXIuPa3DCavAE9/6jc6nM0H3EgZyfUhN2oY= -github.com/multiformats/go-multiaddr-fmt v0.0.1/go.mod h1:aBYjqL4T/7j4Qx+R73XSv/8JsgnRFlf0w2KGLCmXl3Q= -github.com/multiformats/go-multiaddr-fmt v0.1.0/go.mod h1:hGtDIW4PU4BqJ50gW2quDuPVjyWNZxToGUh/HwTZYJo= -github.com/multiformats/go-multiaddr-net v0.0.1/go.mod h1:nw6HSxNmCIQH27XPGBuX+d1tnvM7ihcFwHMSstNAVUU= -github.com/multiformats/go-multiaddr-net v0.1.0/go.mod h1:5JNbcfBOP4dnhoZOv10JJVkJO0pCCEf8mTnipAo2UZQ= -github.com/multiformats/go-multibase v0.0.1/go.mod h1:bja2MqRZ3ggyXtZSEDKpl0uO/gviWFaSteVbWT51qgs= -github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= -github.com/multiformats/go-multihash v0.0.5 h1:1wxmCvTXAifAepIMyF39vZinRw5sbqjPs/UIi93+uik= -github.com/multiformats/go-multihash v0.0.5/go.mod h1:lt/HCbqlQwlPBz7lv0sQCdtfcMtlJvakRUn/0Ual8po= -github.com/multiformats/go-multihash v0.0.8 h1:wrYcW5yxSi3dU07n5jnuS5PrNwyHy0zRHGVoUugWvXg= -github.com/multiformats/go-multihash v0.0.8/go.mod h1:YSLudS+Pi8NHE7o6tb3D8vrpKa63epEDmG8nTduyAew= -github.com/multiformats/go-multistream v0.1.0/go.mod h1:fJTiDfXJVmItycydCnNx4+wSzZ5NwG2FEVAI30fiovg= -github.com/mutecomm/go-sqlcipher v0.0.0-20190227152316-55dbde17881f h1:hd3r+uv9DNLScbOrnlj82rBldHQf3XWmCeXAWbw8euQ= -github.com/mutecomm/go-sqlcipher v0.0.0-20190227152316-55dbde17881f/go.mod h1:MyUWrZlB1aI5bs7j9/pJ8ckLLZ4QcCYcNiSbsAW32D4= -github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/nakagami/firebirdsql v0.0.0-20190310045651-3c02a58cfed8/go.mod h1:86wM1zFnC6/uDBfZGNwB65O+pR2OFi5q/YQaEUid1qA= -github.com/naoina/toml v0.0.0-20170918210437-9fafd6967416/go.mod h1:NBIhNtsFMo3G2szEBne+bO4gS192HuIYRqfvOWb4i1E= -github.com/nsf/termbox-go v0.0.0-20170211012700-3540b76b9c77/go.mod h1:IuKpRQcYE1Tfu+oAQqaLisqDeXgjyyltCfsaoYN18NQ= -github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= -github.com/okzk/sdnotify v0.0.0-20180710141335-d9becc38acbd/go.mod h1:4soZNh0zW0LtYGdQ416i0jO0EIqMGcbtaspRS4BDvRQ= -github.com/olekukonko/tablewriter v0.0.0-20170128050532-febf2d34b54a/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= -github.com/olekukonko/tablewriter v0.0.1 h1:b3iUnf1v+ppJiOfNX4yxxqfWKMQPZR5yoh8urCTFX88= -github.com/olekukonko/tablewriter v0.0.1/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.7.0 h1:WSHQ+IS43OoUrWtD1/bbclrwK8TTH5hzp+umCiuxHgs= -github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.8.0 h1:VkHVNpR4iVnU8XQR6DBm8BqYjN7CRzw+xKUbVVbbW9w= -github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.10.1 h1:q/mM8GF/n0shIN8SaAZ0V+jnLPzen6WIVZdiwrRlMlo= -github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/gomega v1.4.3 h1:RE1xgDvH7imwFD45h+u2SgIfERHlS2yNG4DObb5BSKU= -github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/onsi/gomega v1.5.0 h1:izbySO9zDPmjJ8rDjLvkA2zJHIo+HkYXHnf7eN7SSyo= -github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/onsi/gomega v1.7.0 h1:XPnZz8VVBHjVsy1vzJmRwIcSwiUO+JFfrv/xGiigmME= -github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/openconfig/gnmi v0.0.0-20190823184014-89b2bf29312c/go.mod h1:t+O9It+LKzfOAhKTT5O0ehDix+MTqbtT0T9t+7zzOvc= -github.com/openconfig/reference v0.0.0-20190727015836-8dfd928c9696/go.mod h1:ym2A+zigScwkSEb/cVQB0/ZMpU3rqiH6X7WRRsxgOGw= -github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= -github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= -github.com/opentracing/opentracing-go v0.0.0-20180606204148-bd9c31933947/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw= -github.com/oschwald/maxminddb-golang v1.3.1/go.mod h1:3jhIUymTJ5VREKyIhWm66LJiQt04F0UCDdodShpjWsY= -github.com/pborman/uuid v0.0.0-20170112150404-1b00554d8222/go.mod h1:VyrYX9gd7irzKovcSS6BIIEwPRkP2Wm2m9ufcdFSJ34= -github.com/pborman/uuid v1.2.0 h1:J7Q5mO4ysT1dv8hyrUGHb9+ooztCXu1D8MY8DZYsu3g= -github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= -github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= -github.com/peterh/liner v0.0.0-20170902204657-a37ad3984311/go.mod h1:xIteQHvHuaLYG9IFj6mSxM0fCKrs34IrEQUhOYuGPHc= -github.com/pierrec/lz4 v0.0.0-20190327172049-315a67e90e41/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc= -github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= -github.com/pkg/errors v0.0.0-20171216070316-e881fd58d78e/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_golang v0.9.2/go.mod h1:OsXs2jCmiKlQ1lTBmv21f2mNfw4xf/QclQDMrYNZzcM= -github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs= -github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= -github.com/prometheus/client_golang v1.1.0/go.mod h1:I1FGZT9+L76gKKOs5djB6ezCbFQP1xR9D75/vuwEF3g= -github.com/prometheus/client_golang v1.2.1 h1:JnMpQc6ppsNgw9QPAGF6Dod479itz7lvlsMzzNayLOI= -github.com/prometheus/client_golang v1.2.1/go.mod h1:XMU6Z2MjaRKVu/dC1qupJI9SiNkDYzz3xecMgSW/F+U= -github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4 h1:gQz4mCbXsO+nc9n1hCxHcGA3Zx3Eo+UHZoInFGUIXNM= -github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/common v0.0.0-20181126121408-4724e9255275/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= -github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.6.0/go.mod h1:eBmuwkDJBwy6iBfxCBob6t6dR6ENT/y+J+Zk0j9GMYc= -github.com/prometheus/common v0.7.0 h1:L+1lyG48J1zAQXA3RBX/nG/B3gjlHq0zTt2tlbJLyCY= -github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA= -github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= -github.com/prometheus/procfs v0.0.3/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ= -github.com/prometheus/procfs v0.0.5 h1:3+auTFlqw+ZaQYJARz6ArODtkaIwtvBTx3N2NehQlL8= -github.com/prometheus/procfs v0.0.5/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ= -github.com/prometheus/prometheus v0.0.0-20170814170113-3101606756c5/go.mod h1:oAIUtOny2rjMX0OWN5vPR5/q/twIROJvdqnQKDdil/s= -github.com/prometheus/tsdb v0.10.0 h1:If5rVCMTp6W2SiRAQFlbpJNgVlgMEd+U2GZckwK38ic= -github.com/prometheus/tsdb v0.10.0/go.mod h1:oi49uRhEe9dPUTlS3JRZOwJuVi6tmh10QSgwXEyGCt4= -github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= -github.com/rjeczalik/notify v0.9.1/go.mod h1:rKwnCoCGeuQnwBtTSPL9Dad03Vh2n40ePRrjvIXnJho= -github.com/rjeczalik/notify v0.9.2 h1:MiTWrPj55mNDHEiIX5YUSKefw/+lCQVoAFmD6oQm5w8= -github.com/rjeczalik/notify v0.9.2/go.mod h1:aErll2f0sUX9PXZnVNyeiObbmTlk5jnMoCa4QEjJeqM= -github.com/robertkrimen/godocdown v0.0.0-20130622164427-0bfa04905481/go.mod h1:C9WhFzY47SzYBIvzFqSvHIR6ROgDo4TtdTuRaOMjF/s= -github.com/robertkrimen/otto v0.0.0-20170205013659-6a77b7cbc37d/go.mod h1:xvqspoSXJTIpemEonrMDFq6XzwHYYgToXWj5eRX1OtY= -github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rs/cors v0.0.0-20160617231935-a62a804a8a00/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= -github.com/rs/cors v1.6.0 h1:G9tHG9lebljV9mfp9SNPDL36nCDxmo3zTlAf1YgvzmI= -github.com/rs/cors v1.6.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= -github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik= -github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= -github.com/rs/xhandler v0.0.0-20160618193221-ed27b6fd6521/go.mod h1:RvLn4FgxWubrpZHtQLnOf6EwhN2hEMusxZOhcW9H3UQ= -github.com/russolsen/ohyeah v0.0.0-20160324131710-f4938c005315 h1:H3hCXwP92pH/hSgNrCLtjxvsKJ50sq26nICbZuoR1tQ= -github.com/russolsen/ohyeah v0.0.0-20160324131710-f4938c005315/go.mod h1:ZbKa3zlLnhGF1dAeJtMSoNtM5LgFQnqzq8eYH3uYYkU= -github.com/russolsen/same v0.0.0-20160222130632-f089df61f51d h1:A926QrjwToaPS7giC4UOBjHhdukq9l1Y15r3qkXYwCY= -github.com/russolsen/same v0.0.0-20160222130632-f089df61f51d/go.mod h1:Cpq811GTlHevuU6BZxk3ObOdK8AY5gHu9QGmDak0DT4= -github.com/russolsen/transit v0.0.0-20180705123435-0794b4c4505a h1:yVNJFSzkEG8smsvd9udiQcMJA0MIsFvlG7ba314cu+s= -github.com/russolsen/transit v0.0.0-20180705123435-0794b4c4505a/go.mod h1:TPq+fcJOdGrkpZpXF4UVmFjYxH0gGqnxdgZ+OzAmvJk= -github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= -github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= -github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24 h1:pntxY8Ary0t43dCZ5dqY4YTJCObLY1kIXl0uzMv+7DE= -github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4= -github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= -github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= -github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4= -github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= -github.com/smola/gocompat v0.2.0/go.mod h1:1B0MlxbmoZNo3h8guHp8HztB3BSYR5itql9qtVc0ypY= -github.com/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a/go.mod h1:7AyxJNCJ7SBZ1MfVQCWD6Uqo2oubI2Eq2y2eqf+A5r0= -github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572/go.mod h1:w0SWMsp6j9O/dk4/ZpIhL+3CkG8ofA2vuv7k+ltqUMc= -github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= -github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= -github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= -github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= -github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= -github.com/src-d/envconfig v1.0.0/go.mod h1:Q9YQZ7BKITldTBnoxsE5gOeB5y66RyPXeue/R4aaNBc= -github.com/status-im/doubleratchet v3.0.0+incompatible h1:aJ1ejcSERpSzmWZBgtfYtiU2nF0Q8ZkGyuEPYETXkCY= -github.com/status-im/doubleratchet v3.0.0+incompatible/go.mod h1:1sqR0+yhiM/bd+wrdX79AOt2csZuJOni0nUDzKNuqOU= -github.com/status-im/go-ethereum v1.9.5-status.6 h1:ytuTO1yBIAuTVRtRQoc2mrdyngtP+XOQ9IHIibbz7/I= -github.com/status-im/go-ethereum v1.9.5-status.6/go.mod h1:08JvQWE+IOnAFSe4UD4ACLNe2fDd9XmWMCq5Yzy9mk0= -github.com/status-im/go-ethereum v1.9.5-status.7 h1:DKH1GiF52LwaZaw6YDBliFEgm/JDsbIT+hn7ph6X94Q= -github.com/status-im/go-ethereum v1.9.5-status.7/go.mod h1:YyH5DKB6+z+Vaya7eIm67pnuPZ1oiUMbbsZW41ktN0g= -github.com/status-im/go-multiaddr-ethv4 v1.2.0/go.mod h1:2VQ3C+9zEurcceasz12gPAtmEzCeyLUGPeKLSXYQKHo= -github.com/status-im/keycard-go v0.0.0-20190424133014-d95853db0f48 h1:ju5UTwk5Odtm4trrY+4Ca4RMj5OyXbmVeDAVad2T0Jw= -github.com/status-im/keycard-go v0.0.0-20190424133014-d95853db0f48/go.mod h1:RZLeN1LMWmRsyYjvAu+I6Dm9QmlDaIIt+Y+4Kd7Tp+Q= -github.com/status-im/keycard-go v0.0.0-20191119114148-6dd40a46baa0 h1:5UdlDkkBoPrJfh7zkfoR3X5utJhNs/MCQysK3x0ycgg= -github.com/status-im/keycard-go v0.0.0-20191119114148-6dd40a46baa0/go.mod h1:RZLeN1LMWmRsyYjvAu+I6Dm9QmlDaIIt+Y+4Kd7Tp+Q= -github.com/status-im/markdown v0.0.0-20191209105822-e3ba6c6109ba h1:Ut2CKuG+L9eWFL7dTEPuLE+RKecUYBkDNhqXSIgY92U= -github.com/status-im/markdown v0.0.0-20191209105822-e3ba6c6109ba/go.mod h1:tmG2bxyvZ2EItDO5JewbdFvV45j13IYQgvnMJ3+qAaE= -github.com/status-im/migrate/v4 v4.6.2-status.2 h1:SdC+sMDl/aI7vUlwD2qj2p7KsK4T60IS9z4/rYCCbI8= -github.com/status-im/migrate/v4 v4.6.2-status.2/go.mod h1:c/kc90n47GZu/58nnz1OMLTf7uE4Da4gZP5qmU+A/v8= -github.com/status-im/rendezvous v1.3.0/go.mod h1:+hzjuP+j/XzLPeF6E50b88pWOTLdTcwjvNYt+Gh1W1s= -github.com/status-im/status-go v0.36.0 h1:91qDMJjHv+T3Li9FwxsWQ2JBVcYtvVDT0nGFSMnmM+8= -github.com/status-im/status-go v0.36.1 h1:nb9eTq0UQJ57YyTZSl5U05emFT+R4AW8/Bga6ocgOks= -github.com/status-im/status-go v0.37.3 h1:94/bOA8qrEIgWd23mSLN39SwUJwCu2TPQFV2HzSI2ZE= -github.com/status-im/status-go v0.37.3/go.mod h1:9qHQ2+8NS6ivPJS5YbsI3gWkr0t6DWmJzKnr4M7vudw= -github.com/status-im/status-go v0.38.0 h1:3toC1ToY48wbRBVt7CMWSSG5FZAcPPMlnt0+G6iCbcE= -github.com/status-im/status-go v0.38.0/go.mod h1:u3tlXqVkxAW35dui3LjHajIkbOaF4d4CnriJ8zhntOw= -github.com/status-im/status-go v0.38.5 h1:vnbGgk5+X5ZUmn3/gJ88GlaNaAO9kGVgm8E5mR0umiQ= -github.com/status-im/status-go v0.38.5/go.mod h1:UKxySGdqFuVPvCyPSYD0+zKeV2OzDijZqICvR+tZ3uM= -github.com/status-im/status-go/extkeys v1.0.0 h1:Qyirsoi5Ye5UFfisgPtCjPb/RkBxyK+UsSiEcr2PVlM= -github.com/status-im/status-go/extkeys v1.0.0/go.mod h1:GdqJbrcpkNm5ZsSCpp+PdMxnXx+OcRBdm3PI0rs1FpU= -github.com/status-im/status-go/protocol v1.0.1/go.mod h1:LpA7BsaNmj6EOdq7BwuqncewjPqIRHCletZOb2wlWrY= -github.com/status-im/status-go/waku v1.0.0 h1:XFcJ9Am1cK657dpUP/ysyCp+A99MWSvb1DVTtjo1fE8= -github.com/status-im/status-go/waku v1.0.0/go.mod h1:1bjvQAL4cJYtxCsm6DnKdJbxcZwnvvZmxb6pmoUDtuY= -github.com/status-im/tcp-shaker v0.0.0-20191114194237-215893130501/go.mod h1:RYo/itke1oU5k/6sj9DNM3QAwtE5rZSgg5JnkOv83hk= -github.com/status-im/whisper v1.5.2 h1:26NgiKusmPic38eQdtXnaY+iaQ/LuQ3Dh0kCGYT/Uxs= -github.com/status-im/whisper v1.5.2/go.mod h1:emrOxzJme0k66QtbbQ2bdd3P8RCdLZ8sTD7SkwH1s2s= -github.com/steakknife/bloomfilter v0.0.0-20180922174646-6819c0d2a570 h1:gIlAHnH1vJb5vwEjIp5kBj/eu99p/bl0Ay2goiPe5xE= -github.com/steakknife/bloomfilter v0.0.0-20180922174646-6819c0d2a570/go.mod h1:8OR4w3TdeIHIh1g6EMY5p0gVNOovcWC+1vpc7naMuAw= -github.com/steakknife/hamming v0.0.0-20180906055917-c99c65617cd3 h1:njlZPzLwU639dk2kqnCPPv+wNjq7Xb6EfUxe/oX0/NM= -github.com/steakknife/hamming v0.0.0-20180906055917-c99c65617cd3/go.mod h1:hpGUWaI9xL8pRQCTXQgocU38Qw1g0Us7n5PxxTwTCYU= -github.com/stephens2424/writerset v1.0.2/go.mod h1:aS2JhsMn6eA7e82oNmW4rfsgAOp9COBTTl8mzkwADnc= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1 h1:2vfRuCMp5sSVIDSqO8oNnWJq7mPa6KVP3iPIwFBuy8A= -github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.2.0 h1:Hbg2NidpLE8veEBkEZTL3CvlkUIVzuU9jDplZO54c48= -github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= -github.com/stretchr/testify v0.0.0-20170809224252-890a5c3458b4/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.3.1-0.20190712000136-221dbe5ed467/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/syndtr/goleveldb v0.0.0-20181128100959-b001fa50d6b2/go.mod h1:Z4AUp2Km+PwemOoO/VB5AOx9XSsIItzFjoJlOSiYmn0= -github.com/syndtr/goleveldb v1.0.0 h1:fBdIW9lB4Iz0n9khmH8w27SJ3QEJ7+IgjPEwGSZiFdE= -github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ= -github.com/templexxx/cpufeat v0.0.0-20180724012125-cef66df7f161/go.mod h1:wM7WEvslTq+iOEAMDLSzhVuOt5BRZ05WirO+b09GHQU= -github.com/templexxx/xor v0.0.0-20181023030647-4e92f724b73b/go.mod h1:5XA7W9S6mni3h5uvOC75dA3m9CCCaS83lltmc0ukdi4= -github.com/tidwall/pretty v0.0.0-20180105212114-65a9db5fad51/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= -github.com/tjfoc/gmsm v1.0.1/go.mod h1:XxO4hdhhrzAd+G4CjDqaOkd0hUzmtPR/d3EiBBMn/wc= -github.com/tsenart/tb v0.0.0-20181025101425-0d2499c8b6e9 h1:kjbwitOGH46vD01f2s3leBfrMnePQa3NSAIlW35MvY8= -github.com/tsenart/tb v0.0.0-20181025101425-0d2499c8b6e9/go.mod h1:EcGP24b8DY+bWHnpfJDP7fM+o8Nmz4fYH0l2xTtNr3I= -github.com/tyler-smith/go-bip39 v1.0.2 h1:+t3w+KwLXO6154GNJY+qUtIxLTmFjfUmpguQT1OlOT8= -github.com/tyler-smith/go-bip39 v1.0.2/go.mod h1:sJ5fKU0s6JVwZjjcUEX2zFOnvq0ASQ2K9Zr6cf67kNs= -github.com/uber/jaeger-client-go v0.0.0-20180607151842-f7e0d4744fa6/go.mod h1:WVhlPFC8FDjOFMMWRy2pZqQJSXxYSwNYOkTr/Z6d3Kk= -github.com/uber/jaeger-lib v0.0.0-20180615202729-a51202d6f4a7/go.mod h1:ComeNDZlWwrWnDv8aPp0Ba6+uUTzImX/AauajbLI56U= -github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= -github.com/vacp2p/mvds v0.0.23 h1:BKdn7tyGvl/J/Pwv6FlcW6Xbzm+17jv141GB1mFXyOU= -github.com/vacp2p/mvds v0.0.23/go.mod h1:uUmtiahU7efOVl/5w5yk9jOze5xYpDZDrSrT8TvHXjQ= -github.com/wealdtech/go-ens/v3 v3.0.9 h1:gXMBNXikJ/XV9k6ybPOZMXIMPjBGSCC9N10dxe8Y2Xk= -github.com/wealdtech/go-ens/v3 v3.0.9/go.mod h1:P2OEBvgkhXLrPzPN+eR5z2/wFIGwHyijTDvpuC1xLlo= -github.com/wealdtech/go-multicodec v1.2.0 h1:9AHSxcSE9F9r6ZvQLAO0EXCdM08QfYohaXmW3k6sSh4= -github.com/wealdtech/go-multicodec v1.2.0/go.mod h1:aedGMaTeYkIqi/KCPre1ho5rTb3hGpu/snBOS3GQLw4= -github.com/wealdtech/go-string2eth v1.0.0 h1:jY6b1MVqU6k2Uw/kvcU1Y9/3dDyXfPzZrOFspt82UJs= -github.com/wealdtech/go-string2eth v1.0.0/go.mod h1:UZA/snEybGcD6n+Pl+yoDjmexlEJ6dtoS9myfM83Ol4= -github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1/go.mod h1:8UvriyWtv5Q5EOgjHaSseUEdkQfvwFv1I/In/O2M9gc= -github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc/go.mod h1:bopw91TMyo8J3tvftk8xmU2kPmlrt4nScJQZU2hE5EM= -github.com/whyrusleeping/go-notifier v0.0.0-20170827234753-097c5d47330f/go.mod h1:cZNvX9cFybI01GriPRMXDtczuvUhgbcYr9iCGaNlRv8= -github.com/whyrusleeping/mafmt v1.2.8/go.mod h1:faQJFPbLSxzD9xpA02ttW/tS9vZykNvXwGvqIpk20FA= -github.com/whyrusleeping/mdns v0.0.0-20180901202407-ef14215e6b30/go.mod h1:j4l84WPFclQPj320J9gp0XwNKBb3U0zt5CBqjPp22G4= -github.com/whyrusleeping/mdns v0.0.0-20190826153040-b9b60ed33aa9/go.mod h1:j4l84WPFclQPj320J9gp0XwNKBb3U0zt5CBqjPp22G4= -github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7/go.mod h1:X2c0RVCI1eSUFI8eLcY3c0423ykwiUdxLJtkDvruhjI= -github.com/wsddn/go-ecdh v0.0.0-20161211032359-48726bab9208 h1:1cngl9mPEoITZG8s8cVcUy5CeIBYhEESkOB7m6Gmkrk= -github.com/wsddn/go-ecdh v0.0.0-20161211032359-48726bab9208/go.mod h1:IotVbo4F+mw0EzQ08zFqg7pK3FebNXpaMsRy2RT+Ees= -github.com/x-cray/logrus-prefixed-formatter v0.5.2/go.mod h1:2duySbKsL6M18s5GU7VPsoEPHyzalCE06qoARUCeBBE= -github.com/xanzy/go-gitlab v0.15.0/go.mod h1:8zdQa/ri1dfn8eS3Ir1SyfvOKlw7WBJ8DVThkpGiXrs= -github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c/go.mod h1:lB8K/P019DLNhemzwFU4jHLhdvlE6uDZjXFejJXr49I= -github.com/xdg/stringprep v1.0.0/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y= -github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= -github.com/xtaci/kcp-go v5.4.5+incompatible/go.mod h1:bN6vIwHQbfHaHtFpEssmWsN45a+AZwO7eyRCmEIbtvE= -github.com/xtaci/lossyconn v0.0.0-20190602105132-8df528c0c9ae/go.mod h1:gXtu8J62kEgmN++bm9BVICuT/e8yiLI2KFobd/TRFsE= -gitlab.com/nyarla/go-crypt v0.0.0-20160106005555-d9a5dc2b789b/go.mod h1:T3BPAOm2cqquPa0MKWeNkmOM5RQsRhkrwMWonFMN7fE= -go.mongodb.org/mongo-driver v1.1.0/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM= -go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= -go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= -go.opencensus.io v0.22.1/go.mod h1:Ap50jQcDJrx6rB6VgeeFPtuPIf3wMRvRfrfYDO6+BmA= -go.uber.org/atomic v1.4.0 h1:cxzIVoETapQEqDhQu3QfnvXAV4AlzcvUCxkVUFw3+EU= -go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= -go.uber.org/atomic v1.5.0 h1:OI5t8sDa1Or+q8AeE+yKeB/SDYioSHAgcVljj9JIETY= -go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= -go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= -go.uber.org/multierr v1.3.0 h1:sFPn2GLc3poCkfrpIXGhBD2X0CMIo4Q/zSULXrj/+uc= -go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= -go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee h1:0mgffUl7nfd+FpvXMVz4IDEaUSmT1ysygQC7qYo7sG4= -go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= -go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= -go.uber.org/zap v1.13.0 h1:nR6NoDBgAf67s68NhaXbsojM+2gxp3S1hWkHDl27pVU= -go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= -golang.org/dl v0.0.0-20190829154251-82a15e2f2ead/go.mod h1:IUMfjQLJQd4UTqG1Z90tenwKoCX93Gn3MAQJMOSBsDQ= -golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190103213133-ff983b9c42bc/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190225124518-7f87c0fbb88b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190404164418-38d8ce5564a5/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE= -golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190530122614-20be4c3c3ed5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190618222545-ea8f1a30c443/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3H3cr1v9wB50oz8l4C4h62xy7jSTY= -golang.org/x/crypto v0.0.0-20191029031824-8986dd9e96cf h1:fnPsqIDRbCSgumaMCRpoIoF2s4qxv0xSSS0BVZUE/ss= -golang.org/x/crypto v0.0.0-20191029031824-8986dd9e96cf/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20191119213627-4f8c1d86b1ba h1:9bFeDpN3gTqNanMVqNcoR/pJQuP5uroC3t1D7eXozTE= -golang.org/x/crypto v0.0.0-20191119213627-4f8c1d86b1ba/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20191122220453-ac88ee75c92c h1:/nJuwDLoL/zrqY6gf57vxC+Pi+pZ8bfhpPkicO5H7W4= -golang.org/x/crypto v0.0.0-20191122220453-ac88ee75c92c/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190930215403-16217165b5de h1:5hukYrvBGR8/eNkX5mdUezrA6JiaEZDtJb9Ei+1LlBs= -golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= -golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181011144130-49bb7cea24b1/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181108082009-03003ca0c849/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190225153610-fe579d43d832/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190227160552-c95aed5357e7/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190424112056-4829fb13d2c6/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859 h1:R/3boaszxrf1GEUWTVDzSKVwLmSJpwZ1yqXm8j0v2QI= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190912160710-24e19bdeb0f2 h1:4dVFTC832rPn4pomLSz1vA+are2+dU19w1H8OngV7nc= -golang.org/x/net v0.0.0-20190912160710-24e19bdeb0f2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190930134127-c5a3c61f89f3 h1:6KET3Sqa7fkVfD63QnAM81ZeYg5n4HwApOJkufONnHA= -golang.org/x/net v0.0.0-20190930134127-c5a3c61f89f3/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20181106182150-f42d05182288/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20190402181905-9f3314589c9a/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e h1:vcxGaoTs7kV8m5Np9uUNQin4BrLOthgV7252N8V+FwY= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180926160741-c2ed4eda69e7/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190102155601-82a175fd1598/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190228124157-a34e9553db1e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190426135247-a129542de9ae h1:mQLHiymj/JXKnnjc62tb7nD5pZLs940/sXJu+Xp3DBA= -golang.org/x/sys v0.0.0-20190426135247-a129542de9ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190801041406-cbf593c0f2f3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190912141932-bc967efca4b8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190922100055-0a153f010e69/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191010194322-b09406accb47 h1:/XfQ9z7ib8eEJX2hdgFTZJ/ntt0swNk5oYBziWeTCvY= -golang.org/x/sys v0.0.0-20191010194322-b09406accb47/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191113165036-4c7a9d0fe056 h1:dHtDnRWQtSx0Hjq9kvKFpBh9uPPKfQN70NZZmvssGwk= -golang.org/x/sys v0.0.0-20191113165036-4c7a9d0fe056/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20181130052023-1c3d964395ce/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190425222832-ad9eeb80039a/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190912185636-87d9f09c5d89/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191109212701-97ad0ed33101 h1:LCmXVkvpQCDj724eX6irUTPCJP5GelFHxqGSWL2D1R0= -golang.org/x/tools v0.0.0-20191109212701-97ad0ed33101/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191213032237-7093a17b0467 h1:Jybbe55FT+YYZIJGWmJIA4ZGcglFuZOduakIW3+gHXY= -golang.org/x/tools v0.0.0-20191213032237-7093a17b0467/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk= -google.golang.org/api v0.3.2/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk= -google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.3.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190404172233-64821d5d2107/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= -google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -gopkg.in/alecthomas/kingpin.v2 v2.2.6 h1:jMFz6MfLP0/4fUyZle81rXUoxOBFi19VUFKVDOQfozc= -gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= -gopkg.in/bsm/ratelimit.v1 v1.0.0-20160220154919-db14e161995a/go.mod h1:KF9sEfUPAXdG8Oev9e99iLGnl2uJMjc5B+4y3O7x610= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= -gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE= -gopkg.in/go-playground/validator.v9 v9.29.1 h1:SvGtYmN60a5CVKTOzMSyfzWDeZRxRuGvRQyEAKbw1xc= -gopkg.in/go-playground/validator.v9 v9.29.1/go.mod h1:+c9/zcJMFNgbLvly1L1V+PpxWdVbfP1avr/N00E2vyQ= -gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= -gopkg.in/jcmturner/aescts.v1 v1.0.1/go.mod h1:nsR8qBOg+OucoIW+WMhB3GspUQXq9XorLnQb9XtvcOo= -gopkg.in/jcmturner/dnsutils.v1 v1.0.1/go.mod h1:m3v+5svpVOhtFAP/wSz+yzh4Mc0Fg7eRhxkJMWSIz9Q= -gopkg.in/jcmturner/goidentity.v3 v3.0.0/go.mod h1:oG2kH0IvSYNIu80dVAyu/yoefjq1mNfM5bm88whjWx4= -gopkg.in/jcmturner/gokrb5.v7 v7.2.3/go.mod h1:l8VISx+WGYp+Fp7KRbsiUuXTTOnxIc3Tuvyavf11/WM= -gopkg.in/jcmturner/rpc.v1 v1.1.0/go.mod h1:YIdkC4XfD6GXbzje11McwsDuOlZQSb9W4vfLvuNnlv8= -gopkg.in/natefinch/lumberjack.v2 v2.0.0 h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXLknAOE8= -gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k= -gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce h1:+JknDZhAj8YMt7GC73Ei8pv4MzjDUNPHgQWJdtMAaDU= -gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce/go.mod h1:5AcXVHNjg+BDxry382+8OKon8SEWiKktQR07RKPsv1c= -gopkg.in/olebedev/go-duktape.v3 v3.0.0-20180302121509-abf0ba0be5d5/go.mod h1:uAJfkITjFhyEEuUfm7bsmCZRbW5WRq8s9EY8HZ6hCns= -gopkg.in/olebedev/go-duktape.v3 v3.0.0-20190709231704-1e4459ed25ff h1:uuol9OUzSvZntY1v963NAbVd7A+PHLMz1FlCe3Lorcs= -gopkg.in/olebedev/go-duktape.v3 v3.0.0-20190709231704-1e4459ed25ff/go.mod h1:uAJfkITjFhyEEuUfm7bsmCZRbW5WRq8s9EY8HZ6hCns= -gopkg.in/redis.v4 v4.2.4/go.mod h1:8KREHdypkCEojGKQcjMqAODMICIVwZAONWq8RowTITA= -gopkg.in/sourcemap.v1 v1.0.5/go.mod h1:2RlvNNSMglmRrcvhfuzp4hQHwOtjxlbjX7UPY/GXb78= -gopkg.in/src-d/go-cli.v0 v0.0.0-20181105080154-d492247bbc0d/go.mod h1:z+K8VcOYVYcSwSjGebuDL6176A1XskgbtNl64NSg+n8= -gopkg.in/src-d/go-log.v1 v1.0.1/go.mod h1:GN34hKP0g305ysm2/hctJ0Y8nWP3zxXXJ8GFabTyABE= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/urfave/cli.v1 v1.20.0 h1:NdAVW6RYxDif9DhDHaAortIu956m2c0v+09AZBPTbE0= -gopkg.in/urfave/cli.v1 v1.20.0/go.mod h1:vuBzUtMdQeixQj8LVd+/98pzhxNGQoyuPBlsXHOQNO0= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= -honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.1-2019.2.3 h1:3JgtbtFHMiCmsznwGVTUWbgGov+pVqnlf1dEJTNAXeM= -honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= diff --git a/vendor/github.com/status-im/status-go/protocol/group_chat_system_messages.go b/vendor/github.com/status-im/status-go/protocol/group_chat_system_messages.go deleted file mode 100644 index cbbd7260d..000000000 --- a/vendor/github.com/status-im/status-go/protocol/group_chat_system_messages.go +++ /dev/null @@ -1,88 +0,0 @@ -package protocol - -import ( - "fmt" - "strings" - "time" - - "github.com/status-im/status-go/eth-node/crypto" - "github.com/status-im/status-go/eth-node/types" - "github.com/status-im/status-go/protocol/protobuf" - v1protocol "github.com/status-im/status-go/protocol/v1" -) - -var defaultSystemMessagesTranslations = map[protobuf.MembershipUpdateEvent_EventType]string{ - protobuf.MembershipUpdateEvent_CHAT_CREATED: "{{from}} created the group {{name}}", - protobuf.MembershipUpdateEvent_NAME_CHANGED: "{{from}} changed the group's name to {{name}}", - protobuf.MembershipUpdateEvent_MEMBERS_ADDED: "{{from}} has invited {{members}}", - protobuf.MembershipUpdateEvent_MEMBER_JOINED: "{{from}} joined the group", - protobuf.MembershipUpdateEvent_ADMINS_ADDED: "{{from}} has made {{members}} admin", - protobuf.MembershipUpdateEvent_MEMBER_REMOVED: "{{member}} left the group", - protobuf.MembershipUpdateEvent_ADMIN_REMOVED: "{{member}} is not admin anymore", -} - -func tsprintf(format string, params map[string]string) string { - for key, val := range params { - format = strings.Replace(format, "{{"+key+"}}", fmt.Sprintf("%s", val), -1) - } - return fmt.Sprintf(format) -} - -func eventToSystemMessage(e v1protocol.MembershipUpdateEvent, translations map[protobuf.MembershipUpdateEvent_EventType]string) *Message { - var text string - switch e.Type { - case protobuf.MembershipUpdateEvent_CHAT_CREATED: - text = tsprintf(translations[protobuf.MembershipUpdateEvent_CHAT_CREATED], map[string]string{"from": "@" + e.From, "name": e.Name}) - case protobuf.MembershipUpdateEvent_NAME_CHANGED: - text = tsprintf(translations[protobuf.MembershipUpdateEvent_NAME_CHANGED], map[string]string{"from": "@" + e.From, "name": e.Name}) - case protobuf.MembershipUpdateEvent_MEMBERS_ADDED: - - var memberMentions []string - for _, s := range e.Members { - memberMentions = append(memberMentions, "@"+s) - } - text = tsprintf(translations[protobuf.MembershipUpdateEvent_MEMBERS_ADDED], map[string]string{"from": "@" + e.From, "members": strings.Join(memberMentions, ", ")}) - case protobuf.MembershipUpdateEvent_MEMBER_JOINED: - text = tsprintf(translations[protobuf.MembershipUpdateEvent_MEMBER_JOINED], map[string]string{"from": "@" + e.From}) - case protobuf.MembershipUpdateEvent_ADMINS_ADDED: - var memberMentions []string - for _, s := range e.Members { - memberMentions = append(memberMentions, "@"+s) - } - text = tsprintf(translations[protobuf.MembershipUpdateEvent_ADMINS_ADDED], map[string]string{"from": "@" + e.From, "members": strings.Join(memberMentions, ", ")}) - case protobuf.MembershipUpdateEvent_MEMBER_REMOVED: - text = tsprintf(translations[protobuf.MembershipUpdateEvent_MEMBER_REMOVED], map[string]string{"member": "@" + e.Members[0]}) - case protobuf.MembershipUpdateEvent_ADMIN_REMOVED: - text = tsprintf(translations[protobuf.MembershipUpdateEvent_ADMIN_REMOVED], map[string]string{"member": "@" + e.Members[0]}) - - } - timestamp := v1protocol.TimestampInMsFromTime(time.Now()) - message := &Message{ - ChatMessage: protobuf.ChatMessage{ - ChatId: e.ChatID, - Text: text, - MessageType: protobuf.ChatMessage_SYSTEM_MESSAGE_PRIVATE_GROUP, - ContentType: protobuf.ChatMessage_TEXT_PLAIN, - Clock: e.ClockValue, - Timestamp: timestamp, - }, - From: e.From, - WhisperTimestamp: timestamp, - LocalChatID: e.ChatID, - Seen: true, - ID: types.EncodeHex(crypto.Keccak256(e.Signature)), - } - message.PrepareContent() - return message -} - -func buildSystemMessages(events []v1protocol.MembershipUpdateEvent, translations map[protobuf.MembershipUpdateEvent_EventType]string) []*Message { - var messages []*Message - - for _, e := range events { - messages = append(messages, eventToSystemMessage(e, translations)) - - } - - return messages -} diff --git a/vendor/github.com/status-im/status-go/protocol/identity/alias/data.go b/vendor/github.com/status-im/status-go/protocol/identity/alias/data.go deleted file mode 100644 index d66903878..000000000 --- a/vendor/github.com/status-im/status-go/protocol/identity/alias/data.go +++ /dev/null @@ -1,3100 +0,0 @@ -package alias - -var animals = [...]string{ - "Aardvark", - "Aardwolf", - "Abalone", - "Abyssiniancat", - "Abyssiniangroundhornbill", - "Acaciarat", - "Achillestang", - "Acornbarnacle", - "Acornweevil", - "Acornwoodpecker", - "Acouchi", - "Adamsstaghornedbeetle", - "Addax", - "Adder", - "Adeliepenguin", - "Admiralbutterfly", - "Adouri", - "Aegeancat", - "Affenpinscher", - "Hound", - "Augurbuzzard", - "Bushviper", - "Civet", - "Clawedfrog", - "Elephant", - "Fisheagle", - "Goldencat", - "Groundhornbill", - "Harrierhawk", - "Hornbill", - "Jacana", - "Molesnake", - "Paradiseflycatcher", - "Piedkingfisher", - "Porcupine", - "Rockpython", - "Wildcat", - "Wilddog", - "Agama", - "Agouti", - "Aidi", - "Airedale", - "Airedaleterrier", - "Akitainu", - "Mapturtle", - "Jingle", - "Husky", - "Kleekai", - "Malamute", - "Albacoretuna", - "Albatross", - "Albertosaurus", - "Albino", - "Aldabratortoise", - "Allensbigearedbat", - "Alleycat", - "Alligator", - "Alligatorgar", - "Alligatorsnappingturtle", - "Allosaurus", - "Alpaca", - "Alpinegoat", - "Alpineroadguidetigerbeetle", - "Altiplanochinchillamouse", - "Amazondolphin", - "Amazonparrot", - "Amazontreeboa", - "Amberpenshell", - "Ambushbug", - "Alligator", - "Avocet", - "Badger", - "Bittern", - "Vulture", - "Bobtail", - "Bulldog", - "Cicada", - "Crayfish", - "Creamdraft", - "Crocodile", - "Crow", - "Curl", - "Goldfinch", - "Indianhorse", - "Kestrel", - "Lobster", - "Marten", - "Painthorse", - "Quarterhorse", - "Ratsnake", - "Redsquirrel", - "Riverotter", - "Robin", - "Saddlebred", - "Shorthair", - "Toad", - "Warmblood", - "Wigeon", - "Wirehair", - "Amethystgemclam", - "Amethystinepython", - "Amethystsunbird", - "Ammonite", - "Amoeba", - "Amphibian", - "Amphiuma", - "Amurminnow", - "Amurratsnake", - "Amurstarfish", - "Anaconda", - "Anchovy", - "Andalusianhorse", - "Andeancat", - "Andeancondor", - "Anemone", - "Anemonecrab", - "Anemoneshrimp", - "Angelfish", - "Angelwingmussel", - "Anglerfish", - "Angora", - "Angwantibo", - "Anhinga", - "Ankole", - "Ankolewatusi", - "Annashummingbird", - "Annelid", - "Annelida", - "Anole", - "Anophelesmosquito", - "Ant", - "Antarcticfurseal", - "Antarcticgiantpetrel", - "Antbear", - "Anteater", - "Antelope", - "Antelopegroundsquirrel", - "Antipodesgreenparakeet", - "Antlion", - "Anura", - "Aoudad", - "Apatosaur", - "Ape", - "Aphid", - "Apisdorsatalaboriosa", - "Aplomadofalcon", - "Appaloosa", - "Aquaticleech", - "Arabianhorse", - "Arabianoryx", - "Arabianwildcat", - "Aracari", - "Arachnid", - "Arawana", - "Archaeocete", - "Archaeopteryx", - "Archerfish", - "Arcticduck", - "Arcticfox", - "Arctichare", - "Arcticseal", - "Arcticwolf", - "Argali", - "Argentinehornedfrog", - "Argentineruddyduck", - "Argusfish", - "Arieltoucan", - "Arizonaalligatorlizard", - "Arkshell", - "Armadillo", - "Armedcrab", - "Armednylonshrimp", - "Armyant", - "Armyworm", - "Arrowana", - "Arrowcrab", - "Arrowworm", - "Arthropods", - "Aruanas", - "Constablebutterfly", - "Damselfly", - "Elephant", - "Lion", - "Piedstarling", - "Porcupine", - "Smallclawedotter", - "Trumpetfish", - "Waterbuffalo", - "Greaterfreshwaterclam", - "Lesserfreshwaterclam", - "Mouflon", - "Asp", - "Assassinbug", - "Astarte", - "Astrangiacoral", - "Atlanticblackgoby", - "Atlanticbluetang", - "Atlanticridleyturtle", - "Atlanticsharpnosepuffer", - "Atlanticspadefish", - "Atlasmoth", - "Attwatersprairiechicken", - "Auk", - "Auklet", - "Aurochs", - "Australiancattledog", - "Australiancurlew", - "Australianfreshwatercrocodile", - "Australianfurseal", - "Australiankelpie", - "Australiankestrel", - "Australianshelduck", - "Australiansilkyterrier", - "Austrianpinscher", - "Avians", - "Avocet", - "Axisdeer", - "Axolotl", - "Ayeaye", - "Aztecant", - "Azurevase", - "Azurevasesponge", - "Azurewingedmagpie", - "Babirusa", - "Baboon", - "Backswimmer", - "Bactrian", - "Badger", - "Bagworm", - "Baiji", - "Baldeagle", - "Baleenwhale", - "Balloonfish", - "Ballpython", - "Bandicoot", - "Bangeltiger", - "Bantamrooster", - "Banteng", - "Barasinga", - "Barasingha", - "Barb", - "Barbet", - "Barebirdbat", - "Barnacle", - "Barnowl", - "Barnswallow", - "Barracuda", - "Basenji", - "Basil", - "Basilisk", - "Bass", - "Bassethound", - "Bat", - "Bats", - "Beagle", - "Bear", - "Beardedcollie", - "Beardeddragon", - "Beauceron", - "Beaver", - "Bedbug", - "Bedlingtonterrier", - "Bee", - "Beetle", - "Bellfrog", - "Bellsnake", - "Belugawhale", - "Bengaltiger", - "Bergerpicard", - "Bernesemountaindog", - "Betafish", - "Bettong", - "Bichonfrise", - "Bighorn", - "Bighornedsheep", - "Bighornsheep", - "Bigmouthbass", - "Bilby", - "Binturong", - "Bird", - "Birdofparadise", - "Bison", - "Bittern", - "Blackbear", - "Blackbird", - "Blackbuck", - "Blackfish", - "Blackfly", - "Blackfootedferret", - "Blacklab", - "Blacklemur", - "Blackmamba", - "Blacknorwegianelkhound", - "Blackpanther", - "Blackrhino", - "Blackrussianterrier", - "Blackwidowspider", - "Blesbok", - "Blobfish", - "Blowfish", - "Blueandgoldmackaw", - "Bluebird", - "Bluebottle", - "Bluebottlejellyfish", - "Bluefintuna", - "Bluefish", - "Bluegill", - "Bluejay", - "Blueshark", - "Bluet", - "Bluetickcoonhound", - "Bluetonguelizard", - "Bluewhale", - "Boa", - "Boaconstrictor", - "Boar", - "Bobcat", - "Bobolink", - "Bobwhite", - "Boilweevil", - "Bongo", - "Bonobo", - "Booby", - "Bordercollie", - "Borderterrier", - "Borer", - "Borzoi", - "Boto", - "Boubou", - "Boutu", - "Bovine", - "Brahmanbull", - "Brahmancow", - "Brant", - "Bream", - "Brocketdeer", - "Bronco", - "Brontosaurus", - "Brownbear", - "Brownbutterfly", - "Bubblefish", - "Buck", - "Buckeyebutterfly", - "Budgie", - "Bufeo", - "Buffalo", - "Bufflehead", - "Bug", - "Bull", - "Bullfrog", - "Bullmastiff", - "Bumblebee", - "Bunny", - "Bunting", - "Burro", - "Bushbaby", - "Bushsqueaker", - "Bustard", - "Butterfly", - "Buzzard", - "Caecilian", - "Caiman", - "Caimanlizard", - "Calf", - "Camel", - "Canadagoose", - "Canary", - "Canine", - "Canvasback", - "Capeghostfrog", - "Capybara", - "Caracal", - "Cardinal", - "Caribou", - "Carp", - "Carpenterant", - "Cassowary", - "Cat", - "Catbird", - "Caterpillar", - "Catfish", - "Cats", - "Cattle", - "Caudata", - "Cavy", - "Centipede", - "Cero", - "Chafer", - "Chameleon", - "Chamois", - "Chanticleer", - "Cheetah", - "Chevrotain", - "Chick", - "Chickadee", - "Chicken", - "Chihuahua", - "Chimneyswift", - "Chimpanzee", - "Chinchilla", - "Chinesecrocodilelizard", - "Chipmunk", - "Chital", - "Chrysalis", - "Chrysomelid", - "Chuckwalla", - "Chupacabra", - "Cicada", - "Cirriped", - "Civet", - "Clam", - "Cleanerwrasse", - "Clingfish", - "Clownanemonefish", - "Clumber", - "Coati", - "Cob", - "Cobra", - "Cockerspaniel", - "Cod", - "Coelacanth", - "Collardlizard", - "Collie", - "Colt", - "Comet", - "Commabutterfly", - "Commongonolek", - "Conch", - "Condor", - "Coney", - "Conure", - "Cony", - "Coot", - "Cooter", - "Copepod", - "Copperbutterfly", - "Copperhead", - "Coqui", - "Coral", - "Cormorant", - "Cornsnake", - "Corydorascatfish", - "Cottonmouth", - "Cottontail", - "Cow", - "Cowbird", - "Cowrie", - "Coyote", - "Coypu", - "Crab", - "Crane", - "Cranefly", - "Crayfish", - "Creature", - "Cricket", - "Crocodile", - "Crocodileskink", - "Crossbill", - "Crow", - "Crownofthornsstarfish", - "Crustacean", - "Cub", - "Cuckoo", - "Cur", - "Curassow", - "Curlew", - "Cuscus", - "Cusimanse", - "Cuttlefish", - "Cutworm", - "Cygnet", - "Dachshund", - "Dalmatian", - "Damselfly", - "Danishswedishfarmdog", - "Darklingbeetle", - "Dartfrog", - "Darwinsfox", - "Dassie", - "Dassierat", - "Davidstiger", - "Deer", - "Deermouse", - "Degu", - "Degus", - "Deinonychus", - "Desertpupfish", - "Devilfish", - "Deviltasmanian", - "Diamondbackrattlesnake", - "Dikdik", - "Dikkops", - "Dingo", - "Dinosaur", - "Diplodocus", - "Dipper", - "Discus", - "Dobermanpinscher", - "Doctorfish", - "Dodo", - "Dodobird", - "Doe", - "Dog", - "Dogfish", - "Dolphin", - "Donkey", - "Dorado", - "Dore", - "Dorking", - "Dormouse", - "Dotterel", - "Dove", - "Dowitcher", - "Drafthorse", - "Dragon", - "Dragonfly", - "Drake", - "Drever", - "Dromaeosaur", - "Dromedary", - "Drongo", - "Duck", - "Duckbillcat", - "Duckbillplatypus", - "Duckling", - "Dugong", - "Duiker", - "Dunlin", - "Dunnart", - "Dutchshepherddog", - "Dutchsmoushond", - "Eagle", - "Earthworm", - "Earwig", - "Easternglasslizard", - "Easternnewt", - "Echidna", - "Eel", - "Eelelephant", - "Eeve", - "Eft", - "Egg", - "Egret", - "Eider", - "Eidolonhelvum", - "Ekaltadeta", - "Eland", - "Electriceel", - "Elephant", - "Elephantbeetle", - "Elephantseal", - "Elk", - "Elkhound", - "Elver", - "Emeraldtreeskink", - "Emperorpenguin", - "Emperorshrimp", - "Emu", - "Englishpointer", - "Englishsetter", - "Equestrian", - "Equine", - "Erin", - "Ermine", - "Erne", - "Eskimodog", - "Esok", - "Estuarinecrocodile", - "Ethiopianwolf", - "Europeanfiresalamander", - "Europeanpolecat", - "Ewe", - "Eyas", - "Eyelashpitviper", - "Eyra", - "Fairybluebird", - "Fairyfly", - "Falcon", - "Fallowdeer", - "Fantail", - "Fanworms", - "Fattaileddunnart", - "Fawn", - "Feline", - "Fennecfox", - "Ferret", - "Fiddlercrab", - "Fieldmouse", - "Fieldspaniel", - "Finch", - "Finnishspitz", - "Finwhale", - "Fireant", - "Firebelliedtoad", - "Firecrest", - "Firefly", - "Fish", - "Fishingcat", - "Flamingo", - "Flatcoatretriever", - "Flatfish", - "Flea", - "Flee", - "Flicker", - "Flickertailsquirrel", - "Flies", - "Flounder", - "Fluke", - "Fly", - "Flycatcher", - "Flyingfish", - "Flyingfox", - "Flyinglemur", - "Flyingsquirrel", - "Foal", - "Fossa", - "Fowl", - "Fox", - "Foxhound", - "Foxterrier", - "Frenchbulldog", - "Freshwatereel", - "Frigatebird", - "Frilledlizard", - "Frillneckedlizard", - "Fritillarybutterfly", - "Frog", - "Frogmouth", - "Fruitbat", - "Fruitfly", - "Fugu", - "Fulmar", - "Funnelweaverspider", - "Furseal", - "Gadwall", - "Galago", - "Galah", - "Galapagosalbatross", - "Galapagosdove", - "Galapagoshawk", - "Galapagosmockingbird", - "Galapagospenguin", - "Galapagossealion", - "Galapagostortoise", - "Gallinule", - "Gallowaycow", - "Gander", - "Gangesdolphin", - "Gannet", - "Gar", - "Gardensnake", - "Garpike", - "Gartersnake", - "Gaur", - "Gavial", - "Gazelle", - "Gecko", - "Geese", - "Gelada", - "Gelding", - "Gemsbok", - "Gemsbuck", - "Genet", - "Gentoopenguin", - "Gerbil", - "Gerenuk", - "Germanpinscher", - "Germanshepherd", - "Germanshorthairedpointer", - "Germanspaniel", - "Germanspitz", - "Germanwirehairedpointer", - "Gharial", - "Ghostshrimp", - "Giantschnauzer", - "Gibbon", - "Gilamonster", - "Giraffe", - "Glassfrog", - "Globefish", - "Glowworm", - "Gnat", - "Gnatcatcher", - "Gnu", - "Goa", - "Goat", - "Godwit", - "Goitered", - "Goldeneye", - "Goldenmantledgroundsquirrel", - "Goldenretriever", - "Goldfinch", - "Goldfish", - "Gonolek", - "Goose", - "Goosefish", - "Gopher", - "Goral", - "Gordonsetter", - "Gorilla", - "Goshawk", - "Gosling", - "Gossamerwingedbutterfly", - "Gourami", - "Grackle", - "Grasshopper", - "Grassspider", - "Grayfox", - "Grayling", - "Grayreefshark", - "Graysquirrel", - "Graywolf", - "Greatargus", - "Greatdane", - "Greathornedowl", - "Greatwhiteshark", - "Grebe", - "Greendarnerdragonfly", - "Greyhounddog", - "Grison", - "Grizzlybear", - "Grosbeak", - "Groundbeetle", - "Groundhog", - "Grouper", - "Grouse", - "Grub", - "Grunion", - "Guanaco", - "Guernseycow", - "Guillemot", - "Guineafowl", - "Guineapig", - "Gull", - "Guppy", - "Gyrfalcon", - "Hackee", - "Haddock", - "Hadrosaurus", - "Hagfish", - "Hairstreak", - "Hairstreakbutterfly", - "Hake", - "Halcyon", - "Halibut", - "Halicore", - "Hamadryad", - "Hamadryas", - "Hammerheadbird", - "Hammerheadshark", - "Hammerkop", - "Hamster", - "Hanumanmonkey", - "Hapuka", - "Hapuku", - "Harborporpoise", - "Harborseal", - "Hare", - "Harlequinbug", - "Harpseal", - "Harpyeagle", - "Harrier", - "Harrierhawk", - "Hart", - "Hartebeest", - "Harvestmen", - "Harvestmouse", - "Hatchetfish", - "Hawaiianmonkseal", - "Hawk", - "Hectorsdolphin", - "Hedgehog", - "Heifer", - "Hellbender", - "Hen", - "Herald", - "Herculesbeetle", - "Hermitcrab", - "Heron", - "Herring", - "Hind", - "Hippopotamus", - "Hoatzin", - "Hochstettersfrog", - "Hog", - "Hogget", - "Hoiho", - "Hoki", - "Homalocephale", - "Honeybadger", - "Honeybee", - "Honeycreeper", - "Honeyeater", - "Hookersealion", - "Hoopoe", - "Hornbill", - "Hornedtoad", - "Hornedviper", - "Hornet", - "Hornshark", - "Horse", - "Horsechestnutleafminer", - "Horsefly", - "Horsemouse", - "Horseshoebat", - "Horseshoecrab", - "Hound", - "Housefly", - "Hoverfly", - "Howlermonkey", - "Huemul", - "Huia", - "Human", - "Hummingbird", - "Humpbackwhale", - "Husky", - "Hydatidtapeworm", - "Hydra", - "Hyena", - "Hylaeosaurus", - "Hypacrosaurus", - "Hypsilophodon", - "Hyracotherium", - "Hyrax", - "Iaerismetalmark", - "Ibadanmalimbe", - "Iberianbarbel", - "Iberianchiffchaff", - "Iberianemeraldlizard", - "Iberianlynx", - "Iberianmidwifetoad", - "Iberianmole", - "Iberiannase", - "Ibex", - "Ibis", - "Ibisbill", - "Ibizanhound", - "Iceblueredtopzebra", - "Icefish", - "Icelandgull", - "Icelandichorse", - "Icelandicsheepdog", - "Ichidna", - "Ichneumonfly", - "Ichthyosaurs", - "Ichthyostega", - "Icterinewarbler", - "Iggypops", - "Iguana", - "Iguanodon", - "Illadopsis", - "Ilsamochadegu", - "Imago", - "Impala", - "Imperatorangel", - "Imperialeagle", - "Incatern", - "Inchworm", - "Indianabat", - "Indiancow", - "Indianelephant", - "Indianglassfish", - "Indianhare", - "Indianjackal", - "Indianpalmsquirrel", - "Indianpangolin", - "Indianrhinoceros", - "Indianringneckparakeet", - "Indianrockpython", - "Indianskimmer", - "Indianspinyloach", - "Indigobunting", - "Indigowingedparrot", - "Indochinahogdeer", - "Indochinesetiger", - "Indri", - "Indusriverdolphin", - "Inexpectatumpleco", - "Inganue", - "Insect", - "Intermediateegret", - "Invisiblerail", - "Iraniangroundjay", - "Iridescentshark", - "Iriomotecat", - "Irishdraughthorse", - "Irishredandwhitesetter", - "Irishsetter", - "Irishterrier", - "Irishwaterspaniel", - "Irishwolfhound", - "Irrawaddydolphin", - "Irukandjijellyfish", - "Isabellineshrike", - "Isabellinewheatear", - "Islandcanary", - "Islandwhistler", - "Isopod", - "Italianbrownbear", - "Italiangreyhound", - "Ivorybackedwoodswallow", - "Ivorybilledwoodpecker", - "Ivorygull", - "Izuthrush", - "Jabiru", - "Jackal", - "Jackrabbit", - "Jaeger", - "Jaguar", - "Jaguarundi", - "Janenschia", - "Japanesebeetle", - "Javalina", - "Jay", - "Jellyfish", - "Jenny", - "Jerboa", - "Joey", - "Johndory", - "Juliabutterfly", - "Jumpingbean", - "Junco", - "Junebug", - "Kagu", - "Kakapo", - "Kakarikis", - "Kangaroo", - "Karakul", - "Katydid", - "Kawala", - "Kentrosaurus", - "Kestrel", - "Kid", - "Killdeer", - "Killerwhale", - "Killifish", - "Kingbird", - "Kingfisher", - "Kinglet", - "Kingsnake", - "Kinkajou", - "Kiskadee", - "Kissingbug", - "Kite", - "Kitfox", - "Kitten", - "Kittiwake", - "Kitty", - "Kiwi", - "Koala", - "Koalabear", - "Kob", - "Kodiakbear", - "Koi", - "Komododragon", - "Koodoo", - "Kookaburra", - "Kouprey", - "Krill", - "Kronosaurus", - "Kudu", - "Kusimanse", - "Labradorretriever", - "Lacewing", - "Ladybird", - "Ladybug", - "Lamb", - "Lamprey", - "Langur", - "Lark", - "Larva", - "Laughingthrush", - "Lcont", - "Leafbird", - "Leafcutterant", - "Leafhopper", - "Leafwing", - "Leech", - "Lemming", - "Lemur", - "Leonberger", - "Leopard", - "Leopardseal", - "Leveret", - "Lhasaapso", - "Liger", - "Lightningbug", - "Limpet", - "Limpkin", - "Ling", - "Lion", - "Lionfish", - "Littlenightmonkeys", - "Lizard", - "Llama", - "Lobo", - "Lobster", - "Locust", - "Loggerheadturtle", - "Longhorn", - "Longhornbeetle", - "Longspur", - "Loon", - "Lorikeet", - "Loris", - "Louse", - "Lovebird", - "Lowchen", - "Lunamoth", - "Lungfish", - "Lynx", - "Macaque", - "Macaw", - "Macropod", - "Magpie", - "Maiasaura", - "Majungatholus", - "Malamute", - "Mallard", - "Maltesedog", - "Mamba", - "Mamenchisaurus", - "Mammal", - "Mammoth", - "Manatee", - "Mandrill", - "Mangabey", - "Manta", - "Mantaray", - "Mantid", - "Mantis", - "Mantisray", - "Manxcat", - "Mara", - "Marabou", - "Marbledmurrelet", - "Mare", - "Marlin", - "Marmoset", - "Marmot", - "Marten", - "Martin", - "Massasauga", - "Massospondylus", - "Mastiff", - "Mastodon", - "Mayfly", - "Meadowhawk", - "Meadowlark", - "Mealworm", - "Meerkat", - "Megalosaurus", - "Megaraptor", - "Merganser", - "Merlin", - "Metalmarkbutterfly", - "Metamorphosis", - "Microvenator", - "Midge", - "Milksnake", - "Milkweedbug", - "Millipede", - "Minibeast", - "Mink", - "Minnow", - "Mite", - "Moa", - "Mockingbird", - "Mole", - "Mollies", - "Mollusk", - "Molly", - "Monarch", - "Mongoose", - "Monkey", - "Monkfish", - "Monoclonius", - "Montanoceratops", - "Moorhen", - "Moose", - "Moray", - "Morayeel", - "Morpho", - "Mosasaur", - "Mosquito", - "Moth", - "Motmot", - "Mouflon", - "Mountaincat", - "Mountainlion", - "Mouse", - "Mousebird", - "Mudpuppy", - "Mule", - "Mullet", - "Muntjac", - "Murrelet", - "Muskox", - "Muskrat", - "Mussaurus", - "Mussel", - "Mustang", - "Mutt", - "Myna", - "Mynah", - "Myotis", - "Nabarlek", - "Nag", - "Naga", - "Nagapies", - "Nandine", - "Nandoo", - "Nandu", - "Narwhal", - "Narwhale", - "Natterjacktoad", - "Nauplius", - "Nautilus", - "Needlefish", - "Needletail", - "Nematode", - "Nene", - "Neonblueguppy", - "Neonbluehermitcrab", - "Neondwarfgourami", - "Neonrainbowfish", - "Neonredguppy", - "Neontetra", - "Nerka", - "Nettlefish", - "Newfoundlanddog", - "Newt", - "Newtnutria", - "Nightcrawler", - "Nighthawk", - "Nightheron", - "Nightingale", - "Nightjar", - "Nilgai", - "Armadillo", - "Noctilio", - "Noctule", - "Noddy", - "Noolbenger", - "Northerncardinals", - "Northernelephantseal", - "Northernflyingsquirrel", - "Northernfurseal", - "Northernpike", - "Northernseahorse", - "Northernspottedowl", - "Norwaylobster", - "Norwayrat", - "Nubiangoat", - "Nudibranch", - "Numbat", - "Nurseshark", - "Nutcracker", - "Nuthatch", - "Nutria", - "Nyala", - "Ocelot", - "Octopus", - "Okapi", - "Olingo", - "Olm", - "Opossum", - "Orangutan", - "Orca", - "Oregonsilverspotbutterfly", - "Oriole", - "Oropendola", - "Oropendula", - "Oryx", - "Osprey", - "Ostracod", - "Ostrich", - "Otter", - "Ovenbird", - "Owl", - "Owlbutterfly", - "Ox", - "Oxen", - "Oxpecker", - "Oyster", - "Ozarkbigearedbat", - "Paca", - "Pachyderm", - "Pacificparrotlet", - "Paddlefish", - "Paintedladybutterfly", - "Panda", - "Pangolin", - "Panther", - "Paperwasp", - "Papillon", - "Parakeet", - "Parrot", - "Partridge", - "Peacock", - "Peafowl", - "Peccary", - "Pekingese", - "Pelican", - "Pelicinuspetrel", - "Penguin", - "Perch", - "Peregrinefalcon", - "Pewee", - "Phalarope", - "Pharaohhound", - "Pheasant", - "Phoebe", - "Phoenix", - "Pigeon", - "Piglet", - "Pika", - "Pike", - "Pikeperch", - "Pilchard", - "Pinemarten", - "Pinkriverdolphin", - "Pinniped", - "Pintail", - "Pipistrelle", - "Pipit", - "Piranha", - "Pitbull", - "Pittabird", - "Plainsqueaker", - "Plankton", - "Planthopper", - "Platypus", - "Plover", - "Polarbear", - "Polecat", - "Polyp", - "Polyturator", - "Pomeranian", - "Pondskater", - "Pony", - "Pooch", - "Poodle", - "Porcupine", - "Porpoise", - "Portuguesemanofwar", - "Possum", - "Prairiedog", - "Prawn", - "Prayingmantid", - "Prayingmantis", - "Primate", - "Pronghorn", - "Pseudodynerusquadrisectus", - "Ptarmigan", - "Pterodactyls", - "Pterosaurs", - "Puffer", - "Pufferfish", - "Puffin", - "Pug", - "Pullet", - "Puma", - "Pupa", - "Pupfish", - "Puppy", - "Purplemarten", - "Pygmy", - "Python", - "Quadrisectus", - "Quagga", - "Quahog", - "Quail", - "Queenalexandrasbirdwing", - "Queenalexandrasbirdwingbutterfly", - "Queenant", - "Queenbee", - "Queenconch", - "Queenslandgrouper", - "Queenslandheeler", - "Queensnake", - "Quelea", - "Quetzal", - "Quetzalcoatlus", - "Quillback", - "Quinquespinosus", - "Quokka", - "Quoll", - "Rabbit", - "Rabidsquirrel", - "Raccoon", - "Racer", - "Racerunner", - "Ragfish", - "Rail", - "Rainbowfish", - "Rainbowlorikeet", - "Rainbowtrout", - "Ram", - "Raptors", - "Rasbora", - "Rat", - "Ratfish", - "Rattail", - "Rattlesnake", - "Raven", - "Ray", - "Redhead", - "Redheadedwoodpecker", - "Redpoll", - "Redstart", - "Redtailedhawk", - "Reindeer", - "Reptile", - "Reynard", - "Rhea", - "Rhesusmonkey", - "Rhino", - "Rhinoceros", - "Rhinocerosbeetle", - "Rhodesianridgeback", - "Ringtailedlemur", - "Ringworm", - "Riograndeescuerzo", - "Roach", - "Roadrunner", - "Roan", - "Robberfly", - "Robin", - "Rockrat", - "Rodent", - "Roebuck", - "Roller", - "Rook", - "Rooster", - "Rottweiler", - "Sable", - "Sableantelope", - "Sablefish", - "Saiga", - "Sakimonkey", - "Salamander", - "Salmon", - "Saltwatercrocodile", - "Sambar", - "Samoyeddog", - "Sandbarshark", - "Sanddollar", - "Sanderling", - "Sandpiper", - "Sapsucker", - "Sardine", - "Sawfish", - "Scallop", - "Scarab", - "Scarletibis", - "Scaup", - "Schapendoes", - "Schipperke", - "Schnauzer", - "Scorpion", - "Scoter", - "Screamer", - "Seabird", - "Seagull", - "Seahog", - "Seahorse", - "Seal", - "Sealion", - "Seamonkey", - "Seaslug", - "Seaurchin", - "Senegalpython", - "Seriema", - "Serpent", - "Serval", - "Shark", - "Shearwater", - "Sheep", - "Sheldrake", - "Shelduck", - "Shibainu", - "Shihtzu", - "Shorebird", - "Shoveler", - "Shrew", - "Shrike", - "Shrimp", - "Siamang", - "Siamesecat", - "Siberiantiger", - "Sidewinder", - "Sifaka", - "Silkworm", - "Silverfish", - "Silverfox", - "Silversidefish", - "Siskin", - "Skimmer", - "Skipper", - "Skua", - "Skylark", - "Sloth", - "Slothbear", - "Slug", - "Smelts", - "Smew", - "Snail", - "Snake", - "Snipe", - "Snoutbutterfly", - "Snowdog", - "Snowgeese", - "Snowleopard", - "Snowmonkey", - "Snowyowl", - "Sockeyesalmon", - "Solenodon", - "Solitaire", - "Songbird", - "Sora", - "Southernhairnosedwombat", - "Sow", - "Spadefoot", - "Sparrow", - "Sphinx", - "Spider", - "Spidermonkey", - "Spiketail", - "Spittlebug", - "Sponge", - "Spoonbill", - "Spotteddolphin", - "Spreadwing", - "Springbok", - "Springpeeper", - "Springtail", - "Squab", - "Squamata", - "Squeaker", - "Squid", - "Squirrel", - "Stag", - "Stagbeetle", - "Stallion", - "Starfish", - "Starling", - "Steed", - "Steer", - "Stegosaurus", - "Stickinsect", - "Stickleback", - "Stilt", - "Stingray", - "Stinkbug", - "Stinkpot", - "Stoat", - "Stonefly", - "Stork", - "Stud", - "Sturgeon", - "Sugarglider", - "Sulphurbutterfly", - "Sunbear", - "Sunbittern", - "Sunfish", - "Swallow", - "Swallowtail", - "Swallowtailbutterfly", - "Swan", - "Swellfish", - "Swift", - "Swordfish", - "Tadpole", - "Tahr", - "Takin", - "Tamarin", - "Tanager", - "Tapaculo", - "Tapeworm", - "Tapir", - "Tarantula", - "Tarpan", - "Tarsier", - "Taruca", - "Tasmaniandevil", - "Tasmaniantiger", - "Tattler", - "Tayra", - "Teal", - "Tegus", - "Teledu", - "Tench", - "Tenrec", - "Termite", - "Tern", - "Terrapin", - "Terrier", - "Thoroughbred", - "Thrasher", - "Thrip", - "Thrush", - "Thunderbird", - "Thylacine", - "Tick", - "Tiger", - "Tigerbeetle", - "Tigermoth", - "Tigershark", - "Tilefish", - "Tinamou", - "Titi", - "Titmouse", - "Toad", - "Toadfish", - "Tomtit", - "Topi", - "Tortoise", - "Toucan", - "Towhee", - "Tragopan", - "Treecreeper", - "Trex", - "Triceratops", - "Trogon", - "Trout", - "Trumpeterbird", - "Trumpeterswan", - "Tsetsefly", - "Tuatara", - "Tuna", - "Turaco", - "Turkey", - "Turnstone", - "Turtle", - "Turtledove", - "Uakari", - "Ugandakob", - "Uintagroundsquirrel", - "Ulyssesbutterfly", - "Umbrellabird", - "Umbrette", - "Unau", - "Ungulate", - "Unicorn", - "Upupa", - "Urchin", - "Urial", - "Uromastyxmaliensis", - "Uromastyxspinipes", - "Urson", - "Urubu", - "Urus", - "Urutu", - "Urva", - "Utahprairiedog", - "Vampirebat", - "Vaquita", - "Veery", - "Velociraptor", - "Velvetcrab", - "Velvetworm", - "Venomoussnake", - "Verdin", - "Vervet", - "Viceroybutterfly", - "Vicuna", - "Viper", - "Viperfish", - "Vipersquid", - "Vireo", - "Virginiaopossum", - "Vixen", - "Vole", - "Volvox", - "Vulpesvelox", - "Vulpesvulpes", - "Vulture", - "Walkingstick", - "Wallaby", - "Wallaroo", - "Walleye", - "Walrus", - "Warbler", - "Warthog", - "Wasp", - "Waterboatman", - "Waterbuck", - "Waterbuffalo", - "Waterbug", - "Waterdogs", - "Waterdragons", - "Watermoccasin", - "Waterstrider", - "Waterthrush", - "Wattlebird", - "Watussi", - "Waxwing", - "Weasel", - "Weaverbird", - "Weevil", - "Westafricanantelope", - "Whale", - "Whapuku", - "Whelp", - "Whimbrel", - "Whippet", - "Whippoorwill", - "Whitebeakeddolphin", - "Whiteeye", - "Whitepelican", - "Whiterhino", - "Whitetaileddeer", - "Whitetippedreefshark", - "Whooper", - "Whoopingcrane", - "Widgeon", - "Widowspider", - "Wildcat", - "Wildebeast", - "Wildebeest", - "Willet", - "Wireworm", - "Wisent", - "Wobbegongshark", - "Wolf", - "Wolfspider", - "Wolverine", - "Wombat", - "Woodborer", - "Woodchuck", - "Woodnymphbutterfly", - "Woodpecker", - "Woodstorks", - "Woollybearcaterpillar", - "Worm", - "Wrasse", - "Wreckfish", - "Wren", - "Wrenchbird", - "Wryneck", - "Wuerhosaurus", - "Wyvern", - "Xanclomys", - "Xanthareel", - "Xantus", - "Xantusmurrelet", - "Xeme", - "Xenarthra", - "Xenoposeidon", - "Xenops", - "Xenopterygii", - "Xenopus", - "Xenotarsosaurus", - "Xenurusunicinctus", - "Xerus", - "Xiaosaurus", - "Xinjiangovenator", - "Xiphias", - "Xiphiasgladius", - "Xiphosuran", - "Xoloitzcuintli", - "Xoni", - "Xrayfish", - "Xraytetra", - "Xuanhanosaurus", - "Xuanhuaceratops", - "Xuanhuasaurus", - "Yaffle", - "Yak", - "Yapok", - "Yardant", - "Yearling", - "Yellowbelliedmarmot", - "Yellowbellylizard", - "Yellowhammer", - "Yellowjacket", - "Yellowlegs", - "Yellowthroat", - "Yellowwhitebutterfly", - "Yeti", - "Ynambu", - "Yorkshireterrier", - "Yosemitetoad", - "Yucker", - "Zander", - "Zanzibardaygecko", - "Zebra", - "Zebradove", - "Zebrafinch", - "Zebrafish", - "Zebralongwingbutterfly", - "Zebraswallowtailbutterfly", - "Zebratailedlizard", - "Zebu", - "Zenaida", - "Zeren", - "Zethusspinipes", - "Zethuswasp", - "Zigzagsalamander", - "Zonetailedpigeon", - "Zooplankton", - "Zopilote", - "Zorilla", -} - -var adjectives = [...]string{ - "Able", - "Absolute", - "Academic", - "Acceptable", - "Acclaimed", - "Accomplished", - "Accurate", - "Aching", - "Acidic", - "Acrobatic", - "Adorable", - "Adventurous", - "Babyish", - "Back", - "Baggy", - "Bare", - "Basic", - "Beautiful", - "Belated", - "Beloved", - "Bitter", - "Calculating", - "Calm", - "Candid", - "Canine", - "Capital", - "Carefree", - "Careful", - "Careless", - "Caring", - "Cautious", - "Cavernous", - "Celebrated", - "Charming", - "Damp", - "Dangerous", - "Dapper", - "Daring", - "Dark", - "Darling", - "Dazzling", - "Deadly", - "Deafening", - "Dear", - "Dearest", - "Each", - "Eager", - "Early", - "Earnest", - "Easy", - "Easygoing", - "Ecstatic", - "Edible", - "Educated", - "Elderly", - "Fabulous", - "Failing", - "Faint", - "Fair", - "Faithful", - "Familiar", - "Famous", - "Fancy", - "Fantastic", - "Far", - "Faraway", - "Farflung", - "Faroff", - "Gargantuan", - "Gaseous", - "General", - "Generous", - "Gentle", - "Genuine", - "Giant", - "Giddy", - "Gigantic", - "Hairy", - "Half", - "Handmade", - "Handsome", - "Handy", - "Happy", - "Happygolucky", - "Hard", - "Icky", - "Icy", - "Ideal", - "Idealistic", - "Identical", - "Idle", - "Idolized", - "Ill", - "Jaded", - "Jagged", - "Jampacked", - "Kaleidoscopic", - "Keen", - "Lanky", - "Large", - "Last", - "Lasting", - "Lavish", - "Lawful", - "Madeup", - "Magnificent", - "Majestic", - "Major", - "Mammoth", - "Marvelous", - "Married", - "Naive", - "Narrow", - "Nasty", - "Natural", - "Oblong", - "Obvious", - "Occasional", - "Oily", - "Palatable", - "Pale", - "Paltry", - "Parallel", - "Parched", - "Partial", - "Passionate", - "Past", - "Pastel", - "Peaceful", - "Peppery", - "Perfect", - "Perfumed", - "Quaint", - "Qualified", - "Radiant", - "Ragged", - "Rapid", - "Rare", - "Rash", - "Raw", - "Recent", - "Reckless", - "Rectangular", - "Safe", - "Salty", - "Same", - "Sandy", - "Sane", - "Sarcastic", - "Sardonic", - "Satisfied", - "Scaly", - "Scarce", - "Scary", - "Scented", - "Scholarly", - "Scientific", - "Scornful", - "Scratchy", - "Scrawny", - "Second", - "Secondary", - "Secret", - "Selfassured", - "Selfreliant", - "Sentimental", - "Single", - "Talkative", - "Tall", - "Tame", - "Tan", - "Tangible", - "Tart", - "Tasty", - "Tattered", - "Taut", - "Tedious", - "Teeming", - "Ultimate", - "Unaware", - "Uncommon", - "Unconscious", - "Understated", - "Unequaled", - "Vacant", - "Vague", - "Vain", - "Valid", - "Wan", - "Warlike", - "Warm", - "Warmhearted", - "Warped", - "Wary", - "Wasteful", - "Watchful", - "Waterlogged", - "Watery", - "Wavy", - "Weak", - "Weird", - "Yawning", - "Yearly", - "Zany", - "Active", - "Actual", - "Adept", - "Admirable", - "Admired", - "Adolescent", - "Adorable", - "Adored", - "Advanced", - "Affectionate", - "Afraid", - "Aged", - "Aggravating", - "Beneficial", - "Best", - "Better", - "Bewitched", - "Big", - "Bighearted", - "Biodegradable", - "Bitesized", - "Cheerful", - "Cheery", - "Chief", - "Chilly", - "Chubby", - "Circular", - "Classic", - "Clean", - "Clear", - "Clearcut", - "Clever", - "Close", - "Closed", - "Decent", - "Decimal", - "Decisive", - "Deep", - "Defenseless", - "Defensive", - "Defiant", - "Deficient", - "Definite", - "Definitive", - "Delayed", - "Delectable", - "Delicious", - "Elaborate", - "Elastic", - "Elated", - "Electric", - "Elegant", - "Elementary", - "Elliptical", - "Fast", - "Fatal", - "Favorable", - "Favorite", - "Fearless", - "Feisty", - "Feline", - "Few", - "Fickle", - "Gifted", - "Giving", - "Glamorous", - "Glaring", - "Glass", - "Gleaming", - "Gleeful", - "Glistening", - "Glittering", - "Gross", - "Hardtofind", - "Harmful", - "Harmless", - "Harmonious", - "Harsh", - "Hasty", - "Haunting", - "Illustrious", - "Imaginary", - "Imaginative", - "Immaculate", - "Immaterial", - "Immediate", - "Immense", - "Impassioned", - "Jaunty", - "Jealous", - "Jittery", - "Key", - "Kind", - "Leading", - "Leafy", - "Lean", - "Left", - "Legal", - "Legitimate", - "Light", - "Massive", - "Mature", - "Meager", - "Mealy", - "Mean", - "Measly", - "Meaty", - "Medical", - "Mediocre", - "Nautical", - "Near", - "Neat", - "Necessary", - "Needy", - "Odd", - "Oddball", - "Offbeat", - "Official", - "Old", - "Periodic", - "Perky", - "Personal", - "Pertinent", - "Pesky", - "Pessimistic", - "Petty", - "Physical", - "Piercing", - "Pink", - "Pitiful", - "Plain", - "Quarrelsome", - "Quarterly", - "Ready", - "Real", - "Realistic", - "Reasonable", - "Red", - "Reflecting", - "Regal", - "Regular", - "Separate", - "Serene", - "Serious", - "Serpentine", - "Several", - "Severe", - "Shabby", - "Shadowy", - "Shady", - "Shallow", - "Sharp", - "Shimmering", - "Shiny", - "Shocked", - "Shocking", - "Shoddy", - "Short", - "Shortterm", - "Showy", - "Shrill", - "Shy", - "Silent", - "Silky", - "Tempting", - "Tender", - "Tense", - "Tepid", - "Terrific", - "Testy", - "Thankful", - "That", - "These", - "Tremendous", - "Uneven", - "Unfinished", - "Unfolded", - "Uniform", - "Unique", - "Valuable", - "Vapid", - "Variable", - "Vast", - "Velvety", - "Wealthy", - "Weary", - "Webbed", - "Wee", - "Weekly", - "Weepy", - "Weighty", - "Welcome", - "Welldocumented", - "Yellow", - "Zealous", - "Aggressive", - "Agile", - "Agitated", - "Agonizing", - "Agreeable", - "Ajar", - "Alarmed", - "Alarming", - "Alert", - "Alienated", - "Alive", - "All", - "Altruistic", - "Bland", - "Blank", - "Blaring", - "Bleak", - "Blind", - "Blissful", - "Blond", - "Blue", - "Blushing", - "Cloudy", - "Clueless", - "Clumsy", - "Cluttered", - "Coarse", - "Cold", - "Colorful", - "Colorless", - "Colossal", - "Comfortable", - "Common", - "Compassionate", - "Competent", - "Complete", - "Delightful", - "Demanding", - "Dense", - "Dental", - "Dependable", - "Dependent", - "Descriptive", - "Deserted", - "Detailed", - "Determined", - "Devoted", - "Different", - "Embellished", - "Eminent", - "Emotional", - "Empty", - "Enchanted", - "Enchanting", - "Energetic", - "Enlightened", - "Enormous", - "Fine", - "Finished", - "Firm", - "First", - "Firsthand", - "Fitting", - "Fixed", - "Flaky", - "Flamboyant", - "Flashy", - "Flat", - "Flawless", - "Flickering", - "Gloomy", - "Glorious", - "Glossy", - "Glum", - "Golden", - "Good", - "Goodnatured", - "Gorgeous", - "Graceful", - "Healthy", - "Heartfelt", - "Hearty", - "Heavenly", - "Heavy", - "Hefty", - "Helpful", - "Humongous", - "Impartial", - "Impeccable", - "Imperfect", - "Imperturbable", - "Important", - "Impossible", - "Impractical", - "Impressionable", - "Impressive", - "Improbable", - "Joint", - "Jolly", - "Jovial", - "Juvenile", - "Kindhearted", - "Kindly", - "Lighthearted", - "Likable", - "Likely", - "Limited", - "Limp", - "Limping", - "Linear", - "Lined", - "Liquid", - "Medium", - "Meek", - "Mellow", - "Melodic", - "Memorable", - "Menacing", - "Merry", - "Messy", - "Metallic", - "Mild", - "Negative", - "Neglected", - "Negligible", - "Neighboring", - "Nervous", - "New", - "Oldfashioned", - "Only", - "Open", - "Optimal", - "Optimistic", - "Opulent", - "Plaintive", - "Plastic", - "Playful", - "Pleasant", - "Pleased", - "Pleasing", - "Plump", - "Plush", - "Pointed", - "Pointless", - "Poised", - "Polished", - "Polite", - "Political", - "Pungent", - "Queasy", - "Querulous", - "Reliable", - "Relieved", - "Remarkable", - "Remorseful", - "Remote", - "Repentant", - "Required", - "Respectful", - "Responsible", - "Silly", - "Silver", - "Similar", - "Simple", - "Simplistic", - "Sizzling", - "Skeletal", - "Skinny", - "Sleepy", - "Slight", - "Slim", - "Slimy", - "Slippery", - "Slow", - "Slushy", - "Small", - "Smart", - "Smoggy", - "Smooth", - "Smug", - "Snappy", - "Snarling", - "Sneaky", - "Sniveling", - "Snoopy", - "Thick", - "Thin", - "Third", - "Thirsty", - "This", - "Thorny", - "Thorough", - "Those", - "Thoughtful", - "Threadbare", - "United", - "Unkempt", - "Unknown", - "Unlined", - "Unnatural", - "Unrealistic", - "Venerated", - "Vengeful", - "Verifiable", - "Vibrant", - "Vicious", - "Wellgroomed", - "Wellinformed", - "Welllit", - "Wellmade", - "Welloff", - "Welltodo", - "Wellworn", - "Wet", - "Which", - "Whimsical", - "Whirlwind", - "Whispered", - "Worse", - "Writhing", - "Yellowish", - "Zesty", - "Amazing", - "Ambitious", - "Ample", - "Amused", - "Amusing", - "Anchored", - "Ancient", - "Angelic", - "Angry", - "Anguished", - "Animated", - "Annual", - "Another", - "Antique", - "Bogus", - "Boiling", - "Bold", - "Bony", - "Boring", - "Bossy", - "Both", - "Bouncy", - "Bountiful", - "Bowed", - "Complex", - "Complicated", - "Composed", - "Concerned", - "Concrete", - "Confused", - "Conscious", - "Considerate", - "Constant", - "Content", - "Conventional", - "Cooked", - "Cool", - "Cooperative", - "Difficult", - "Digital", - "Diligent", - "Dim", - "Dimpled", - "Dimwitted", - "Direct", - "Discrete", - "Entire", - "Envious", - "Equal", - "Equatorial", - "Essential", - "Esteemed", - "Ethical", - "Euphoric", - "Flimsy", - "Flippant", - "Flowery", - "Fluffy", - "Fluid", - "Flustered", - "Focused", - "Fond", - "Foolhardy", - "Foolish", - "Forceful", - "Forked", - "Formal", - "Forsaken", - "Gracious", - "Grand", - "Grandiose", - "Granular", - "Grateful", - "Grave", - "Gray", - "Great", - "Greedy", - "Green", - "Hidden", - "High", - "Highlevel", - "Hilarious", - "Hoarse", - "Hollow", - "Homely", - "Inborn", - "Incomparable", - "Incompatible", - "Incomplete", - "Inconsequential", - "Incredible", - "Indelible", - "Indolent", - "Inexperienced", - "Infamous", - "Infantile", - "Joyful", - "Joyous", - "Jubilant", - "Klutzy", - "Knobby", - "Little", - "Live", - "Lively", - "Livid", - "Lone", - "Long", - "Milky", - "Mindless", - "Miniature", - "Minor", - "Minty", - "Misguided", - "Misty", - "Mixed", - "Next", - "Nice", - "Nifty", - "Nimble", - "Nippy", - "Orange", - "Orderly", - "Ordinary", - "Organic", - "Ornate", - "Ornery", - "Poor", - "Popular", - "Portly", - "Posh", - "Positive", - "Possible", - "Potable", - "Powerful", - "Powerless", - "Practical", - "Precious", - "Present", - "Prestigious", - "Questionable", - "Quick", - "Revolving", - "Rewarding", - "Rich", - "Right", - "Rigid", - "Ringed", - "Ripe", - "Sociable", - "Soft", - "Soggy", - "Solid", - "Somber", - "Some", - "Sophisticated", - "Sore", - "Sorrowful", - "Soulful", - "Soupy", - "Sour", - "Spanish", - "Sparkling", - "Sparse", - "Specific", - "Spectacular", - "Speedy", - "Spherical", - "Spicy", - "Spiffy", - "Spirited", - "Spiteful", - "Splendid", - "Spotless", - "Spotted", - "Spry", - "Thrifty", - "Thunderous", - "Tidy", - "Tight", - "Timely", - "Tinted", - "Tiny", - "Tired", - "Torn", - "Total", - "Unripe", - "Unruly", - "Unselfish", - "Unsightly", - "Unsteady", - "Unsung", - "Untidy", - "Untimely", - "Untried", - "Victorious", - "Vigilant", - "Vigorous", - "Villainous", - "Violet", - "Whole", - "Whopping", - "Wicked", - "Wide", - "Wideeyed", - "Wiggly", - "Wild", - "Willing", - "Wilted", - "Winding", - "Windy", - "Young", - "Zigzag", - "Anxious", - "Any", - "Apprehensive", - "Appropriate", - "Apt", - "Arctic", - "Arid", - "Aromatic", - "Artistic", - "Assured", - "Astonishing", - "Athletic", - "Brave", - "Breakable", - "Brief", - "Bright", - "Brilliant", - "Brisk", - "Broken", - "Bronze", - "Brown", - "Bruised", - "Coordinated", - "Corny", - "Corrupt", - "Costly", - "Courageous", - "Courteous", - "Crafty", - "Crazy", - "Creamy", - "Creative", - "Creepy", - "Crisp", - "Dirty", - "Disguised", - "Distant", - "Distant", - "Distinct", - "Distorted", - "Dizzy", - "Dopey", - "Downright", - "Dreary", - "Even", - "Evergreen", - "Everlasting", - "Every", - "Evil", - "Exalted", - "Excellent", - "Excitable", - "Exemplary", - "Exhausted", - "Forthright", - "Fortunate", - "Fragrant", - "Frail", - "Frank", - "Frayed", - "Free", - "French", - "Frequent", - "Fresh", - "Friendly", - "Frightened", - "Frightening", - "Gregarious", - "Grim", - "Grimy", - "Gripping", - "Grizzled", - "Grouchy", - "Grounded", - "Honest", - "Honorable", - "Honored", - "Hopeful", - "Hospitable", - "Hot", - "Huge", - "Infatuated", - "Inferior", - "Infinite", - "Informal", - "Innocent", - "Insecure", - "Insignificant", - "Insistent", - "Instructive", - "Insubstantial", - "Judicious", - "Juicy", - "Jumbo", - "Knotty", - "Knowing", - "Knowledgeable", - "Longterm", - "Loose", - "Lopsided", - "Lost", - "Loud", - "Lovable", - "Lovely", - "Loving", - "Modern", - "Modest", - "Moist", - "Monthly", - "Monumental", - "Moral", - "Mortified", - "Motionless", - "Nocturnal", - "Noisy", - "Nonstop", - "Normal", - "Notable", - "Noted", - "Original", - "Other", - "Our", - "Outgoing", - "Outlandish", - "Outlying", - "Precious", - "Pretty", - "Previous", - "Pricey", - "Prickly", - "Primary", - "Prime", - "Pristine", - "Private", - "Prize", - "Probable", - "Productive", - "Profitable", - "Quickwitted", - "Quiet", - "Quintessential", - "Roasted", - "Robust", - "Rosy", - "Rotating", - "Rotten", - "Rough", - "Round", - "Rowdy", - "Square", - "Squeaky", - "Squiggly", - "Stable", - "Staid", - "Stained", - "Stale", - "Standard", - "Starchy", - "Stark", - "Starry", - "Steel", - "Steep", - "Sticky", - "Stiff", - "Stimulating", - "Stingy", - "Stormy", - "Strange", - "Strict", - "Strident", - "Striking", - "Striped", - "Strong", - "Studious", - "Stunning", - "Tough", - "Tragic", - "Trained", - "Treasured", - "Tremendous", - "Triangular", - "Tricky", - "Trifling", - "Trim", - "Untrue", - "Unused", - "Unusual", - "Unwelcome", - "Unwieldy", - "Unwilling", - "Unwitting", - "Unwritten", - "Upbeat", - "Virtual", - "Virtuous", - "Visible", - "Winged", - "Wiry", - "Wise", - "Witty", - "Wobbly", - "Woeful", - "Wonderful", - "Wooden", - "Woozy", - "Wordy", - "Worldly", - "Worn", - "Youthful", - "Attached", - "Attentive", - "Attractive", - "Austere", - "Authentic", - "Authorized", - "Automatic", - "Avaricious", - "Average", - "Aware", - "Awesome", - "Awful", - "Awkward", - "Bubbly", - "Bulky", - "Bumpy", - "Buoyant", - "Burdensome", - "Burly", - "Bustling", - "Busy", - "Buttery", - "Buzzing", - "Critical", - "Crooked", - "Crowded", - "Crushing", - "Cuddly", - "Cultivated", - "Cultured", - "Cumbersome", - "Curly", - "Curvy", - "Cute", - "Cylindrical", - "Doting", - "Double", - "Downright", - "Drab", - "Drafty", - "Dramatic", - "Dry", - "Dual", - "Dutiful", - "Excited", - "Exciting", - "Exotic", - "Expensive", - "Experienced", - "Expert", - "Extralarge", - "Extraneous", - "Extrasmall", - "Extroverted", - "Frilly", - "Frivolous", - "Frizzy", - "Front", - "Frosty", - "Frozen", - "Frugal", - "Fruitful", - "Full", - "Fumbling", - "Functional", - "Funny", - "Fussy", - "Fuzzy", - "Growing", - "Growling", - "Grown", - "Grubby", - "Grumpy", - "Guilty", - "Gullible", - "Gummy", - "Humble", - "Humming", - "Hungry", - "Husky", - "Intelligent", - "Intent", - "Intentional", - "Interesting", - "Internal", - "International", - "Intrepid", - "Ironclad", - "Irresponsible", - "Itchy", - "Jumpy", - "Junior", - "Known", - "Kooky", - "Low", - "Loyal", - "Lucky", - "Lumbering", - "Luminous", - "Lumpy", - "Lustrous", - "Luxurious", - "Mountainous", - "Muddy", - "Muffled", - "Mundane", - "Murky", - "Mushy", - "Musty", - "Mysterious", - "Noteworthy", - "Novel", - "Noxious", - "Numb", - "Nutritious", - "Nutty", - "Outrageous", - "Outstanding", - "Oval", - "Overcooked", - "Overdue", - "Overjoyed", - "Profuse", - "Proper", - "Proud", - "Prudent", - "Punctual", - "Puny", - "Pure", - "Purple", - "Pushy", - "Puzzled", - "Puzzling", - "Quirky", - "Quixotic", - "Quizzical", - "Royal", - "Rubbery", - "Ruddy", - "Rundown", - "Runny", - "Rural", - "Rusty", - "Stupendous", - "Sturdy", - "Stylish", - "Subdued", - "Substantial", - "Subtle", - "Suburban", - "Sudden", - "Sugary", - "Sunny", - "Super", - "Superb", - "Superficial", - "Superior", - "Supportive", - "Surefooted", - "Surprised", - "Suspicious", - "Svelte", - "Sweaty", - "Sweet", - "Sweltering", - "Swift", - "Sympathetic", - "Trivial", - "Troubled", - "Trusting", - "Trustworthy", - "Trusty", - "Truthful", - "Tubby", - "Turbulent", - "Twin", - "Upright", - "Upset", - "Urban", - "Usable", - "Used", - "Useful", - "Useless", - "Utilized", - "Utter", - "Vital", - "Vivacious", - "Vivid", - "Voluminous", - "Worst", - "Worthwhile", - "Worthy", - "Wrathful", - "Wry", - "Yummy", - "True", - "Aliceblue", - "Aqua", - "Aquamarine", - "Azure", - "Beige", - "Bisque", - "Blanchedalmond", - "Blue", - "Blueviolet", - "Brown", - "Burlywood", - "Cadetblue", - "Chartreuse", - "Chocolate", - "Coral", - "Cornflowerblue", - "Cornsilk", - "Crimson", - "Cyan", - "Darkblue", - "Darkcyan", - "Darkgoldenrod", - "Darkgray", - "Darkgreen", - "Darkgrey", - "Darkkhaki", - "Darkmagenta", - "Darkolivegreen", - "Darkorange", - "Darkorchid", - "Darkred", - "Darksalmon", - "Darkseagreen", - "Darkslateblue", - "Darkslategray", - "Darkslategrey", - "Darkturquoise", - "Darkviolet", - "Deeppink", - "Deepskyblue", - "Dimgray", - "Dimgrey", - "Dodgerblue", - "Firebrick", - "Floralwhite", - "Forestgreen", - "Fractal", - "Fuchsia", - "Gainsboro", - "Ghostwhite", - "Gold", - "Goldenrod", - "Gray", - "Green", - "Greenyellow", - "Honeydew", - "Hotpink", - "Indianred", - "Indigo", - "Ivory", - "Khaki", - "Lavender", - "Lavenderblush", - "Lawngreen", - "Lemonchiffon", - "Lightblue", - "Lightcoral", - "Lightcyan", - "Lightgoldenrod", - "Lightgoldenrodyellow", - "Lightgray", - "Lightgreen", - "Lightgrey", - "Lightpink", - "Lightsalmon", - "Lightseagreen", - "Lightskyblue", - "Lightslateblue", - "Lightslategray", - "Lightsteelblue", - "Lightyellow", - "Lime", - "Limegreen", - "Linen", - "Magenta", - "Maroon", - "Mediumaquamarine", - "Mediumblue", - "Mediumforestgreen", - "Mediumgoldenrod", - "Mediumorchid", - "Mediumpurple", - "Mediumseagreen", - "Mediumslateblue", - "Mediumspringgreen", - "Mediumturquoise", - "Mediumvioletred", - "Midnightblue", - "Mintcream", - "Mistyrose", - "Moccasin", - "Navajowhite", - "Navy", - "Navyblue", - "Oldlace", - "Olive", - "Olivedrab", - "Opaque", - "Orange", - "Orangered", - "Orchid", - "Palegoldenrod", - "Palegreen", - "Paleturquoise", - "Palevioletred", - "Papayawhip", - "Peachpuff", - "Peru", - "Pink", - "Plum", - "Powderblue", - "Purple", - "Red", - "Rosybrown", - "Royalblue", - "Saddlebrown", - "Salmon", - "Sandybrown", - "Seagreen", - "Seashell", - "Sienna", - "Silver", - "Skyblue", - "Slateblue", - "Slategray", - "Slategrey", - "Snow", - "Springgreen", - "Steelblue", - "Tan", - "Teal", - "Thistle", - "Tomato", - "Transparent", - "Turquoise", - "Violet", - "Violetred", - "Wheat", - "Whitesmoke", - "Yellow", - "Yellowgreen", -} diff --git a/vendor/github.com/status-im/status-go/protocol/identity/alias/flfsr.go b/vendor/github.com/status-im/status-go/protocol/identity/alias/flfsr.go deleted file mode 100644 index 6a3a752a2..000000000 --- a/vendor/github.com/status-im/status-go/protocol/identity/alias/flfsr.go +++ /dev/null @@ -1,27 +0,0 @@ -package alias - -// For details: https://en.wikipedia.org/wiki/Linear-feedback_shift_register -type LSFR struct { - data uint64 - poly uint64 -} - -func newLSFR(poly uint64, seed uint64) *LSFR { - return &LSFR{data: seed, poly: poly} -} - -func (f *LSFR) next() uint64 { - var bit uint64 - var i uint64 - - for i = 0; i < 64; i++ { - if f.poly&(1<> i) - } - } - bit &= 0x01 - - f.data = (f.data << 1) | bit - - return f.data -} diff --git a/vendor/github.com/status-im/status-go/protocol/identity/alias/generate.go b/vendor/github.com/status-im/status-go/protocol/identity/alias/generate.go deleted file mode 100644 index 8c175142a..000000000 --- a/vendor/github.com/status-im/status-go/protocol/identity/alias/generate.go +++ /dev/null @@ -1,45 +0,0 @@ -package alias - -import ( - "crypto/ecdsa" - "encoding/hex" - "fmt" - - "github.com/status-im/status-go/eth-node/crypto" -) - -const poly uint64 = 0xB8 - -func generate(seed uint64) string { - generator := newLSFR(poly, seed) - adjective1Index := generator.next() % uint64(len(adjectives)) - adjective2Index := generator.next() % uint64(len(adjectives)) - animalIndex := generator.next() % uint64(len(animals)) - adjective1 := adjectives[adjective1Index] - adjective2 := adjectives[adjective2Index] - animal := animals[animalIndex] - - return fmt.Sprintf("%s %s %s", adjective1, adjective2, animal) -} - -// GenerateFromPublicKey returns the 3 words name given an *ecdsa.PublicKey -func GenerateFromPublicKey(publicKey *ecdsa.PublicKey) string { - // Here we truncate the public key to the least significant 64 bits - return generate(uint64(publicKey.X.Int64())) -} - -// GenerateFromPublicKeyString returns the 3 words name given a public key -// prefixed with 0x -func GenerateFromPublicKeyString(publicKeyString string) (string, error) { - publicKeyBytes, err := hex.DecodeString(publicKeyString[2:]) - if err != nil { - return "", err - } - - publicKey, err := crypto.UnmarshalPubkey(publicKeyBytes) - if err != nil { - return "", err - } - - return GenerateFromPublicKey(publicKey), nil -} diff --git a/vendor/github.com/status-im/status-go/protocol/identity/identicon/identicon.go b/vendor/github.com/status-im/status-go/protocol/identity/identicon/identicon.go deleted file mode 100644 index 80d8b0462..000000000 --- a/vendor/github.com/status-im/status-go/protocol/identity/identicon/identicon.go +++ /dev/null @@ -1,61 +0,0 @@ -package identicon - -import ( - "crypto/md5" - "image/color" - - colorful "github.com/lucasb-eyer/go-colorful" -) - -const ( - defaultSaturation = 0.5 - defaultLightness = 0.7 -) - -type Identicon struct { - bitmap []byte - color color.Color -} - -func generate(key string) Identicon { - hash := md5.Sum([]byte(key)) - return Identicon{ - convertPatternToBinarySwitch(generatePatternFromHash(hash)), - getColorFromHash(hash), - } -} - -func getColorFromHash(h [16]byte) color.Color { - // Take the last 3 relevant bytes, and convert to a float between [0..360] - var sum float64 = float64(h[13]) + float64(h[14]) + float64(h[15]) - t := (sum / 765) * 360 - return colorful.Hsl(t, defaultSaturation, defaultLightness) -} - -func generatePatternFromHash(sum [16]byte) []byte { - p := make([]byte, 25) - for i := 0; i < 5; i++ { - for j := 0; j < 5; j++ { - jCount := j - - if j > 2 { - jCount = 4 - j - } - - p[5*i+j] = sum[3*i+jCount] - } - } - return p -} - -func convertPatternToBinarySwitch(pattern []byte) []byte { - b := make([]byte, 25) - for i, v := range pattern { - if v%2 == 0 { - b[i] = 1 - } else { - b[i] = 0 - } - } - return b -} diff --git a/vendor/github.com/status-im/status-go/protocol/identity/identicon/renderer.go b/vendor/github.com/status-im/status-go/protocol/identity/identicon/renderer.go deleted file mode 100644 index 368f992ea..000000000 --- a/vendor/github.com/status-im/status-go/protocol/identity/identicon/renderer.go +++ /dev/null @@ -1,55 +0,0 @@ -package identicon - -import ( - "bytes" - "encoding/base64" - "image" - "image/color" - "image/draw" - "image/png" -) - -func renderBase64(id Identicon) (string, error) { - img := image.NewRGBA(image.Rect(0, 0, 50, 50)) - var buff bytes.Buffer - - setBackgroundWhite(img) - - for i, v := range id.bitmap { - if v == 1 { - drawRect(img, i, id.color) - } - } - - if err := png.Encode(&buff, img); err != nil { - return "", err - } - - encodedString := base64.StdEncoding.EncodeToString(buff.Bytes()) - image := "data:image/png;base64," + encodedString - return image, nil -} - -func setBackgroundWhite(img *image.RGBA) { - draw.Draw(img, img.Bounds(), &image.Uniform{C: color.White}, image.Point{}, draw.Src) -} - -func drawRect(rgba *image.RGBA, i int, c color.Color) { - sizeSquare := 6 - maxRow := 5 - - r := image.Rect( - 10+(i%maxRow)*sizeSquare, - 10+(i/maxRow)*sizeSquare, - 10+(i%maxRow)*sizeSquare+sizeSquare, - 10+(i/maxRow)*sizeSquare+sizeSquare, - ) - - draw.Draw(rgba, r, &image.Uniform{C: c}, image.Point{}, draw.Src) -} - -// GenerateBase64 generates an identicon in base64 png format given a string -func GenerateBase64(id string) (string, error) { - i := generate(id) - return renderBase64(i) -} diff --git a/vendor/github.com/status-im/status-go/protocol/message.go b/vendor/github.com/status-im/status-go/protocol/message.go deleted file mode 100644 index a58610a6a..000000000 --- a/vendor/github.com/status-im/status-go/protocol/message.go +++ /dev/null @@ -1,224 +0,0 @@ -package protocol - -import ( - "crypto/ecdsa" - "encoding/json" - "strings" - "unicode" - "unicode/utf8" - - "github.com/gomarkdown/markdown" - - "github.com/status-im/status-go/protocol/protobuf" -) - -// QuotedMessage contains the original text of the message replied to -type QuotedMessage struct { - // From is a public key of the author of the message. - From string `json:"from"` - Text string `json:"text"` -} - -type CommandState int - -const ( - CommandStateRequestAddressForTransaction CommandState = iota + 1 - CommandStateRequestAddressForTransactionDeclined - CommandStateRequestAddressForTransactionAccepted - CommandStateRequestTransaction - CommandStateRequestTransactionDeclined - CommandStateTransactionPending - CommandStateTransactionSent -) - -type CommandParameters struct { - // ID is the ID of the initial message - ID string `json:"id"` - // From is the address we are sending the command from - From string `json:"from"` - // Address is the address sent with the command - Address string `json:"address"` - // Contract is the contract address for ERC20 tokens - Contract string `json:"contract"` - // Value is the value as a string sent - Value string `json:"value"` - // TransactionHash is the hash of the transaction - TransactionHash string `json:"transactionHash"` - // CommandState is the state of the command - CommandState CommandState `json:"commandState"` - // The Signature of the pk-bytes+transaction-hash from the wallet - // address originating - Signature []byte `json:"signature"` -} - -func (c *CommandParameters) IsTokenTransfer() bool { - return len(c.Contract) != 0 -} - -const ( - OutgoingStatusSending = "sending" - OutgoingStatusSent = "sent" -) - -// Message represents a message record in the database, -// more specifically in user_messages table. -type Message struct { - protobuf.ChatMessage - - // ID calculated as keccak256(compressedAuthorPubKey, data) where data is unencrypted payload. - ID string `json:"id"` - // WhisperTimestamp is a timestamp of a Whisper envelope. - WhisperTimestamp uint64 `json:"whisperTimestamp"` - // From is a public key of the author of the message. - From string `json:"from"` - // Random 3 words name - Alias string `json:"alias"` - // Identicon of the author - Identicon string `json:"identicon"` - // The chat id to be stored locally - LocalChatID string `json:"localChatId"` - - Seen bool `json:"seen"` - OutgoingStatus string `json:"outgoingStatus,omitempty"` - - QuotedMessage *QuotedMessage `json:"quotedMessage"` - - // CommandParameters is the parameters sent with the message - CommandParameters *CommandParameters `json:"commandParameters"` - - // Computed fields - RTL bool `json:"rtl"` - ParsedText []byte `json:"parsedText"` - LineCount int `json:"lineCount"` - - // Replace indicates that this is a replacement of a message - // that has been updated - Replace string `json:"replace,omitEmpty"` - SigPubKey *ecdsa.PublicKey `json:"-"` -} - -// RawMessage represent a sent or received message, kept for being able -// to re-send/propagate -type RawMessage struct { - ID string - LocalChatID string - LastSent uint64 - SendCount int - Sent bool - ResendAutomatically bool - MessageType protobuf.ApplicationMetadataMessage_Type - Payload []byte - Recipients []*ecdsa.PublicKey -} - -func (m *Message) MarshalJSON() ([]byte, error) { - type MessageAlias Message - type StickerAlias struct { - Hash string `json:"hash"` - Pack int32 `json:"pack"` - } - item := struct { - ID string `json:"id"` - WhisperTimestamp uint64 `json:"whisperTimestamp"` - From string `json:"from"` - Alias string `json:"alias"` - Identicon string `json:"identicon"` - Seen bool `json:"seen"` - OutgoingStatus string `json:"outgoingStatus,omitempty"` - QuotedMessage *QuotedMessage `json:"quotedMessage"` - RTL bool `json:"rtl"` - ParsedText json.RawMessage `json:"parsedText"` - LineCount int `json:"lineCount"` - Text string `json:"text"` - ChatId string `json:"chatId"` - LocalChatID string `json:"localChatId"` - Clock uint64 `json:"clock"` - Replace string `json:"replace,omitEmpty"` - ResponseTo string `json:"responseTo"` - EnsName string `json:"ensName"` - Sticker *StickerAlias `json:"sticker"` - CommandParameters *CommandParameters `json:"commandParameters"` - Timestamp uint64 `json:"timestamp"` - ContentType protobuf.ChatMessage_ContentType `json:"contentType"` - MessageType protobuf.ChatMessage_MessageType `json:"messageType"` - }{ - ID: m.ID, - WhisperTimestamp: m.WhisperTimestamp, - From: m.From, - Alias: m.Alias, - Identicon: m.Identicon, - Seen: m.Seen, - OutgoingStatus: m.OutgoingStatus, - QuotedMessage: m.QuotedMessage, - RTL: m.RTL, - ParsedText: m.ParsedText, - LineCount: m.LineCount, - Text: m.Text, - Replace: m.Replace, - ChatId: m.ChatId, - LocalChatID: m.LocalChatID, - Clock: m.Clock, - ResponseTo: m.ResponseTo, - EnsName: m.EnsName, - Timestamp: m.Timestamp, - ContentType: m.ContentType, - MessageType: m.MessageType, - CommandParameters: m.CommandParameters, - } - - if sticker := m.GetSticker(); sticker != nil { - item.Sticker = &StickerAlias{ - Pack: sticker.Pack, - Hash: sticker.Hash, - } - } - return json.Marshal(item) -} - -func (m *Message) UnmarshalJSON(data []byte) error { - type Alias Message - aux := struct { - *Alias - ResponseTo string `json:"responseTo"` - EnsName string `json:"ensName"` - ChatID string `json:"chatId"` - Sticker *protobuf.StickerMessage `json:"sticker"` - ContentType protobuf.ChatMessage_ContentType `json:"contentType"` - }{ - Alias: (*Alias)(m), - } - if err := json.Unmarshal(data, &aux); err != nil { - return err - } - if aux.ContentType == protobuf.ChatMessage_STICKER { - m.Payload = &protobuf.ChatMessage_Sticker{Sticker: aux.Sticker} - } - m.ResponseTo = aux.ResponseTo - m.EnsName = aux.EnsName - m.ChatId = aux.ChatID - m.ContentType = aux.ContentType - return nil -} - -// Check if the first character is Hebrew or Arabic or the RTL character -func isRTL(s string) bool { - first, _ := utf8.DecodeRuneInString(s) - return unicode.Is(unicode.Hebrew, first) || - unicode.Is(unicode.Arabic, first) || - // RTL character - first == '\u200f' -} - -// PrepareContent return the parsed content of the message, the line-count and whether -// is a right-to-left message -func (m *Message) PrepareContent() error { - parsedText := markdown.Parse([]byte(m.Text), nil) - jsonParsedText, err := json.Marshal(parsedText) - if err != nil { - return err - } - m.ParsedText = jsonParsedText - m.LineCount = strings.Count(m.Text, "\n") - m.RTL = isRTL(m.Text) - return nil -} diff --git a/vendor/github.com/status-im/status-go/protocol/message_builder.go b/vendor/github.com/status-im/status-go/protocol/message_builder.go deleted file mode 100644 index e76018dce..000000000 --- a/vendor/github.com/status-im/status-go/protocol/message_builder.go +++ /dev/null @@ -1,39 +0,0 @@ -package protocol - -import ( - "crypto/ecdsa" - - "github.com/status-im/status-go/eth-node/crypto" - "github.com/status-im/status-go/eth-node/types" - "github.com/status-im/status-go/protocol/identity/alias" - "github.com/status-im/status-go/protocol/identity/identicon" -) - -func extendMessageFromChat(message *Message, chat *Chat, key *ecdsa.PublicKey, timesource TimeSource) error { - clock, timestamp := chat.NextClockAndTimestamp(timesource) - - message.LocalChatID = chat.ID - message.Clock = clock - message.Timestamp = timestamp - message.From = types.EncodeHex(crypto.FromECDSAPub(key)) - message.SigPubKey = key - message.WhisperTimestamp = timestamp - message.Seen = true - message.OutgoingStatus = OutgoingStatusSending - - identicon, err := identicon.GenerateBase64(message.From) - if err != nil { - return err - } - - message.Identicon = identicon - - alias, err := alias.GenerateFromPublicKeyString(message.From) - if err != nil { - return err - } - - message.Alias = alias - return nil - -} diff --git a/vendor/github.com/status-im/status-go/protocol/message_handler.go b/vendor/github.com/status-im/status-go/protocol/message_handler.go deleted file mode 100644 index 108ba9725..000000000 --- a/vendor/github.com/status-im/status-go/protocol/message_handler.go +++ /dev/null @@ -1,654 +0,0 @@ -package protocol - -import ( - "crypto/ecdsa" - "encoding/hex" - - "github.com/pkg/errors" - "go.uber.org/zap" - - "github.com/status-im/status-go/eth-node/crypto" - "github.com/status-im/status-go/protocol/encryption/multidevice" - "github.com/status-im/status-go/protocol/protobuf" - v1protocol "github.com/status-im/status-go/protocol/v1" -) - -type MessageHandler struct { - identity *ecdsa.PrivateKey - persistence *sqlitePersistence - logger *zap.Logger -} - -func newMessageHandler(identity *ecdsa.PrivateKey, logger *zap.Logger, persistence *sqlitePersistence) *MessageHandler { - return &MessageHandler{ - identity: identity, - persistence: persistence, - logger: logger} -} - -// HandleMembershipUpdate updates a Chat instance according to the membership updates. -// It retrieves chat, if exists, and merges membership updates from the message. -// Finally, the Chat is updated with the new group events. -func (m *MessageHandler) HandleMembershipUpdate(messageState *ReceivedMessageState, chat *Chat, rawMembershipUpdate protobuf.MembershipUpdateMessage, translations map[protobuf.MembershipUpdateEvent_EventType]string) error { - var group *v1protocol.Group - var err error - - logger := m.logger.With(zap.String("site", "HandleMembershipUpdate")) - - message, err := v1protocol.MembershipUpdateMessageFromProtobuf(&rawMembershipUpdate) - if err != nil { - return err - - } - - if err := ValidateMembershipUpdateMessage(message, messageState.Timesource.GetCurrentTime()); err != nil { - logger.Warn("failed to validate message", zap.Error(err)) - return err - } - - if chat == nil { - if len(message.Events) == 0 { - return errors.New("can't create new group chat without events") - } - group, err = v1protocol.NewGroupWithEvents(message.ChatID, message.Events) - if err != nil { - return err - } - - // A new chat must contain us - if !group.IsMember(contactIDFromPublicKey(&m.identity.PublicKey)) { - return errors.New("can't create a new group chat without us being a member") - } - newChat := CreateGroupChat(messageState.Timesource) - chat = &newChat - - } else { - existingGroup, err := newProtocolGroupFromChat(chat) - if err != nil { - return errors.Wrap(err, "failed to create a Group from Chat") - } - updateGroup, err := v1protocol.NewGroupWithEvents(message.ChatID, message.Events) - if err != nil { - return errors.Wrap(err, "invalid membership update") - } - merged := v1protocol.MergeMembershipUpdateEvents(existingGroup.Events(), updateGroup.Events()) - group, err = v1protocol.NewGroup(chat.ID, merged) - if err != nil { - return errors.Wrap(err, "failed to create a group with new membership updates") - } - } - - chat.updateChatFromProtocolGroup(group) - systemMessages := buildSystemMessages(message.Events, translations) - - for _, message := range systemMessages { - messageID := message.ID - exists, err := m.messageExists(messageID, messageState.ExistingMessagesMap) - if err != nil { - m.logger.Warn("failed to check message exists", zap.Error(err)) - } - if exists { - continue - } - messageState.Response.Messages = append(messageState.Response.Messages, message) - } - - // Store in chats map as it might be a new one - messageState.AllChats[chat.ID] = chat - // Set in the map - messageState.ModifiedChats[chat.ID] = true - - if message.Message != nil { - messageState.CurrentMessageState.Message = *message.Message - return m.HandleChatMessage(messageState) - } - - return nil -} - -func (m *MessageHandler) handleCommandMessage(state *ReceivedMessageState, message *Message) error { - message.ID = state.CurrentMessageState.MessageID - message.From = state.CurrentMessageState.Contact.ID - message.Alias = state.CurrentMessageState.Contact.Alias - message.SigPubKey = state.CurrentMessageState.PublicKey - message.Identicon = state.CurrentMessageState.Contact.Identicon - message.WhisperTimestamp = state.CurrentMessageState.WhisperTimestamp - - message.PrepareContent() - chat, err := m.matchMessage(message, state.AllChats, state.Timesource) - if err != nil { - return err - } - - // If deleted-at is greater, ignore message - if chat.DeletedAtClockValue >= message.Clock { - return nil - } - - // Set the LocalChatID for the message - message.LocalChatID = chat.ID - - if c, ok := state.AllChats[chat.ID]; ok { - chat = c - } - - // Set the LocalChatID for the message - message.LocalChatID = chat.ID - - // Increase unviewed count - if !isPubKeyEqual(message.SigPubKey, &m.identity.PublicKey) { - chat.UnviewedMessagesCount++ - message.OutgoingStatus = "" - } else { - // Our own message, mark as sent - message.OutgoingStatus = OutgoingStatusSent - } - - err = chat.UpdateFromMessage(message, state.Timesource) - if err != nil { - return err - } - - // Set chat active - chat.Active = true - // Set in the modified maps chat - state.ModifiedChats[chat.ID] = true - state.AllChats[chat.ID] = chat - - // Add to response - if message != nil { - state.Response.Messages = append(state.Response.Messages, message) - } - return nil -} - -func (m *MessageHandler) HandleSyncInstallationContact(state *ReceivedMessageState, message protobuf.SyncInstallationContact) error { - chat, ok := state.AllChats[state.CurrentMessageState.Contact.ID] - if !ok { - chat = OneToOneFromPublicKey(state.CurrentMessageState.PublicKey, state.Timesource) - // We don't want to show the chat to the user - chat.Active = false - } - - contact, ok := state.AllContacts[message.Id] - if !ok { - publicKeyBytes, err := hex.DecodeString(message.Id[2:]) - if err != nil { - return err - } - publicKey, err := crypto.UnmarshalPubkey(publicKeyBytes) - if err != nil { - return err - } - contact, err = buildContact(publicKey) - if err != nil { - return err - } - } - - if contact.LastUpdated < message.Clock { - if !contact.IsAdded() { - contact.SystemTags = append(contact.SystemTags, contactAdded) - } - if contact.Name != message.EnsName { - contact.Name = message.EnsName - contact.ENSVerified = false - } - contact.Photo = message.ProfileImage - contact.LastUpdated = message.Clock - state.ModifiedContacts[contact.ID] = true - state.AllContacts[contact.ID] = contact - } - - state.AllChats[chat.ID] = chat - - return nil -} - -func (m *MessageHandler) HandleSyncInstallationPublicChat(state *ReceivedMessageState, message protobuf.SyncInstallationPublicChat) error { - chatID := message.Id - _, ok := state.AllChats[chatID] - if ok { - return nil - } - - chat := CreatePublicChat(chatID, state.Timesource) - - state.AllChats[chat.ID] = &chat - state.ModifiedChats[chat.ID] = true - - return nil -} - -func (m *MessageHandler) HandleContactUpdate(state *ReceivedMessageState, message protobuf.ContactUpdate) error { - logger := m.logger.With(zap.String("site", "HandleContactUpdate")) - contact := state.CurrentMessageState.Contact - chat, ok := state.AllChats[contact.ID] - if !ok { - chat = OneToOneFromPublicKey(state.CurrentMessageState.PublicKey, state.Timesource) - // We don't want to show the chat to the user - chat.Active = false - } - - logger.Info("Handling contact update") - - if contact.LastUpdated < message.Clock { - logger.Info("Updating contact") - if !contact.HasBeenAdded() && contact.ID != contactIDFromPublicKey(&m.identity.PublicKey) { - contact.SystemTags = append(contact.SystemTags, contactRequestReceived) - } - if contact.Name != message.EnsName { - contact.Name = message.EnsName - contact.ENSVerified = false - } - contact.Photo = message.ProfileImage - contact.LastUpdated = message.Clock - state.ModifiedContacts[contact.ID] = true - state.AllContacts[contact.ID] = contact - } - - if chat.LastClockValue < message.Clock { - chat.LastClockValue = message.Clock - } - - state.ModifiedChats[chat.ID] = true - state.AllChats[chat.ID] = chat - - return nil -} - -func (m *MessageHandler) HandlePairInstallation(state *ReceivedMessageState, message protobuf.PairInstallation) error { - logger := m.logger.With(zap.String("site", "HandlePairInstallation")) - if err := ValidateReceivedPairInstallation(&message, state.CurrentMessageState.WhisperTimestamp); err != nil { - logger.Warn("failed to validate message", zap.Error(err)) - return err - } - - installation, ok := state.AllInstallations[message.InstallationId] - if !ok { - return errors.New("installation not found") - } - - metadata := &multidevice.InstallationMetadata{ - Name: message.Name, - DeviceType: message.DeviceType, - } - - installation.InstallationMetadata = metadata - state.AllInstallations[message.InstallationId] = installation - state.ModifiedInstallations[message.InstallationId] = true - - return nil -} - -func (m *MessageHandler) HandleChatMessage(state *ReceivedMessageState) error { - logger := m.logger.With(zap.String("site", "handleChatMessage")) - if err := ValidateReceivedChatMessage(&state.CurrentMessageState.Message, state.CurrentMessageState.WhisperTimestamp); err != nil { - logger.Warn("failed to validate message", zap.Error(err)) - return err - } - receivedMessage := &Message{ - ID: state.CurrentMessageState.MessageID, - ChatMessage: state.CurrentMessageState.Message, - From: state.CurrentMessageState.Contact.ID, - Alias: state.CurrentMessageState.Contact.Alias, - SigPubKey: state.CurrentMessageState.PublicKey, - Identicon: state.CurrentMessageState.Contact.Identicon, - WhisperTimestamp: state.CurrentMessageState.WhisperTimestamp, - } - - receivedMessage.PrepareContent() - chat, err := m.matchMessage(receivedMessage, state.AllChats, state.Timesource) - if err != nil { - return err - } - - // If deleted-at is greater, ignore message - if chat.DeletedAtClockValue >= receivedMessage.Clock { - return nil - } - - // Set the LocalChatID for the message - receivedMessage.LocalChatID = chat.ID - - if c, ok := state.AllChats[chat.ID]; ok { - chat = c - } - - // Set the LocalChatID for the message - receivedMessage.LocalChatID = chat.ID - - // Increase unviewed count - if !isPubKeyEqual(receivedMessage.SigPubKey, &m.identity.PublicKey) { - chat.UnviewedMessagesCount++ - } else { - // Our own message, mark as sent - receivedMessage.OutgoingStatus = OutgoingStatusSent - } - - err = chat.UpdateFromMessage(receivedMessage, state.Timesource) - if err != nil { - return err - } - - // Set chat active - chat.Active = true - // Set in the modified maps chat - state.ModifiedChats[chat.ID] = true - state.AllChats[chat.ID] = chat - - contact := state.CurrentMessageState.Contact - if hasENSNameChanged(contact, receivedMessage.EnsName, receivedMessage.Clock) { - contact.ResetENSVerification(receivedMessage.Clock, receivedMessage.EnsName) - state.ModifiedContacts[contact.ID] = true - state.AllContacts[contact.ID] = contact - } - - // Add to response - if receivedMessage != nil { - state.Response.Messages = append(state.Response.Messages, receivedMessage) - } - - return nil -} - -func (m *MessageHandler) HandleRequestAddressForTransaction(messageState *ReceivedMessageState, command protobuf.RequestAddressForTransaction) error { - err := ValidateReceivedRequestAddressForTransaction(&command, messageState.CurrentMessageState.WhisperTimestamp) - if err != nil { - return err - } - message := &Message{ - ChatMessage: protobuf.ChatMessage{ - Clock: command.Clock, - Timestamp: messageState.CurrentMessageState.WhisperTimestamp, - Text: "Request address for transaction", - ChatId: contactIDFromPublicKey(&m.identity.PublicKey), - MessageType: protobuf.ChatMessage_ONE_TO_ONE, - ContentType: protobuf.ChatMessage_TRANSACTION_COMMAND, - }, - CommandParameters: &CommandParameters{ - ID: messageState.CurrentMessageState.MessageID, - Value: command.Value, - Contract: command.Contract, - CommandState: CommandStateRequestAddressForTransaction, - }, - } - return m.handleCommandMessage(messageState, message) -} - -func (m *MessageHandler) HandleRequestTransaction(messageState *ReceivedMessageState, command protobuf.RequestTransaction) error { - err := ValidateReceivedRequestTransaction(&command, messageState.CurrentMessageState.WhisperTimestamp) - if err != nil { - return err - } - message := &Message{ - ChatMessage: protobuf.ChatMessage{ - Clock: command.Clock, - Timestamp: messageState.CurrentMessageState.WhisperTimestamp, - Text: "Request transaction", - ChatId: contactIDFromPublicKey(&m.identity.PublicKey), - MessageType: protobuf.ChatMessage_ONE_TO_ONE, - ContentType: protobuf.ChatMessage_TRANSACTION_COMMAND, - }, - CommandParameters: &CommandParameters{ - ID: messageState.CurrentMessageState.MessageID, - Value: command.Value, - Contract: command.Contract, - CommandState: CommandStateRequestTransaction, - Address: command.Address, - }, - } - return m.handleCommandMessage(messageState, message) -} - -func (m *MessageHandler) HandleAcceptRequestAddressForTransaction(messageState *ReceivedMessageState, command protobuf.AcceptRequestAddressForTransaction) error { - err := ValidateReceivedAcceptRequestAddressForTransaction(&command, messageState.CurrentMessageState.WhisperTimestamp) - if err != nil { - return err - } - initialMessage, err := m.persistence.MessageByID(command.Id) - if err != nil { - return err - } - if initialMessage == nil { - return errors.New("message not found") - } - - if initialMessage.LocalChatID != messageState.CurrentMessageState.Contact.ID { - return errors.New("From must match") - } - - if initialMessage.OutgoingStatus == "" { - return errors.New("Initial message must originate from us") - } - - if initialMessage.CommandParameters.CommandState != CommandStateRequestAddressForTransaction { - return errors.New("Wrong state for command") - } - - initialMessage.Clock = command.Clock - initialMessage.Timestamp = messageState.CurrentMessageState.WhisperTimestamp - initialMessage.Text = "Request address for transaction accepted" - initialMessage.CommandParameters.Address = command.Address - initialMessage.CommandParameters.CommandState = CommandStateRequestAddressForTransactionAccepted - - // Hide previous message - previousMessage, err := m.persistence.MessageByCommandID(messageState.CurrentMessageState.Contact.ID, command.Id) - if err != nil && err != errRecordNotFound { - return err - } - - if previousMessage != nil { - err = m.persistence.HideMessage(previousMessage.ID) - if err != nil { - return err - } - - initialMessage.Replace = previousMessage.ID - } - - return m.handleCommandMessage(messageState, initialMessage) -} - -func (m *MessageHandler) HandleSendTransaction(messageState *ReceivedMessageState, command protobuf.SendTransaction) error { - err := ValidateReceivedSendTransaction(&command, messageState.CurrentMessageState.WhisperTimestamp) - if err != nil { - return err - } - transactionToValidate := &TransactionToValidate{ - MessageID: messageState.CurrentMessageState.MessageID, - CommandID: command.Id, - TransactionHash: command.TransactionHash, - FirstSeen: messageState.CurrentMessageState.WhisperTimestamp, - Signature: command.Signature, - Validate: true, - From: messageState.CurrentMessageState.PublicKey, - RetryCount: 0, - } - m.logger.Info("Saving transction to validate", zap.Any("transaction", transactionToValidate)) - - return m.persistence.SaveTransactionToValidate(transactionToValidate) -} - -func (m *MessageHandler) HandleDeclineRequestAddressForTransaction(messageState *ReceivedMessageState, command protobuf.DeclineRequestAddressForTransaction) error { - err := ValidateReceivedDeclineRequestAddressForTransaction(&command, messageState.CurrentMessageState.WhisperTimestamp) - if err != nil { - return err - } - oldMessage, err := m.persistence.MessageByID(command.Id) - if err != nil { - return err - } - if oldMessage == nil { - return errors.New("message not found") - } - - if oldMessage.LocalChatID != messageState.CurrentMessageState.Contact.ID { - return errors.New("From must match") - } - - if oldMessage.OutgoingStatus == "" { - return errors.New("Initial message must originate from us") - } - - if oldMessage.CommandParameters.CommandState != CommandStateRequestAddressForTransaction { - return errors.New("Wrong state for command") - } - - oldMessage.Clock = command.Clock - oldMessage.Timestamp = messageState.CurrentMessageState.WhisperTimestamp - oldMessage.Text = "Request address for transaction declined" - oldMessage.CommandParameters.CommandState = CommandStateRequestAddressForTransactionDeclined - - // Hide previous message - err = m.persistence.HideMessage(command.Id) - if err != nil { - return err - } - oldMessage.Replace = command.Id - - return m.handleCommandMessage(messageState, oldMessage) -} - -func (m *MessageHandler) HandleDeclineRequestTransaction(messageState *ReceivedMessageState, command protobuf.DeclineRequestTransaction) error { - err := ValidateReceivedDeclineRequestTransaction(&command, messageState.CurrentMessageState.WhisperTimestamp) - if err != nil { - return err - } - oldMessage, err := m.persistence.MessageByID(command.Id) - if err != nil { - return err - } - if oldMessage == nil { - return errors.New("message not found") - } - - if oldMessage.LocalChatID != messageState.CurrentMessageState.Contact.ID { - return errors.New("From must match") - } - - if oldMessage.OutgoingStatus == "" { - return errors.New("Initial message must originate from us") - } - - if oldMessage.CommandParameters.CommandState != CommandStateRequestTransaction { - return errors.New("Wrong state for command") - } - - oldMessage.Clock = command.Clock - oldMessage.Timestamp = messageState.CurrentMessageState.WhisperTimestamp - oldMessage.Text = "Transaction request declined" - oldMessage.CommandParameters.CommandState = CommandStateRequestTransactionDeclined - - // Hide previous message - err = m.persistence.HideMessage(command.Id) - if err != nil { - return err - } - oldMessage.Replace = command.Id - - return m.handleCommandMessage(messageState, oldMessage) -} - -func (m *MessageHandler) matchMessage(message *Message, chats map[string]*Chat, timesource TimeSource) (*Chat, error) { - if message.SigPubKey == nil { - m.logger.Error("public key can't be empty") - return nil, errors.New("received a message with empty public key") - } - - switch { - case message.MessageType == protobuf.ChatMessage_PUBLIC_GROUP: - // For public messages, all outgoing and incoming messages have the same chatID - // equal to a public chat name. - chatID := message.ChatId - chat := chats[chatID] - if chat == nil { - return nil, errors.New("received a public message from non-existing chat") - } - return chat, nil - case message.MessageType == protobuf.ChatMessage_ONE_TO_ONE && isPubKeyEqual(message.SigPubKey, &m.identity.PublicKey): - // It's a private message coming from us so we rely on Message.ChatId - // If chat does not exist, it should be created to support multidevice synchronization. - chatID := message.ChatId - chat := chats[chatID] - if chat == nil { - if len(chatID) != PubKeyStringLength { - return nil, errors.New("invalid pubkey length") - } - bytePubKey, err := hex.DecodeString(chatID[2:]) - if err != nil { - return nil, errors.Wrap(err, "failed to decode hex chatID") - } - - pubKey, err := crypto.UnmarshalPubkey(bytePubKey) - if err != nil { - return nil, errors.Wrap(err, "failed to decode pubkey") - } - - newChat := CreateOneToOneChat(chatID[:8], pubKey, timesource) - chat = &newChat - } - return chat, nil - case message.MessageType == protobuf.ChatMessage_ONE_TO_ONE: - // 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 := contactIDFromPublicKey(message.SigPubKey) - chat := chats[chatID] - if chat == nil { - // TODO: this should be a three-word name used in the mobile client - newChat := CreateOneToOneChat(chatID[:8], message.SigPubKey, timesource) - chat = &newChat - } - return chat, nil - case message.MessageType == protobuf.ChatMessage_PRIVATE_GROUP: - // In the case of a group message, ChatID is the same for all messages belonging to a group. - // It needs to be verified if the signature public key belongs to the chat. - chatID := message.ChatId - chat := chats[chatID] - if chat == nil { - return nil, errors.New("received group chat message for non-existing chat") - } - - theirKeyHex := contactIDFromPublicKey(message.SigPubKey) - myKeyHex := contactIDFromPublicKey(&m.identity.PublicKey) - var theyJoined bool - var iJoined bool - for _, member := range chat.Members { - if member.ID == theirKeyHex && member.Joined { - theyJoined = true - } - } - for _, member := range chat.Members { - if member.ID == myKeyHex && member.Joined { - iJoined = true - } - } - - if theyJoined && iJoined { - return chat, nil - } - - return nil, errors.New("did not find a matching group chat") - default: - return nil, errors.New("can not match a chat because there is no valid case") - } -} - -func (m *MessageHandler) messageExists(messageID string, existingMessagesMap map[string]bool) (bool, error) { - if _, ok := existingMessagesMap[messageID]; ok { - return true, nil - } - - existingMessagesMap[messageID] = true - - // Check against the database, this is probably a bit slow for - // each message, but for now might do, we'll make it faster later - existingMessage, err := m.persistence.MessageByID(messageID) - if err != nil && err != errRecordNotFound { - return false, err - } - if existingMessage != nil { - return true, nil - } - return false, nil -} diff --git a/vendor/github.com/status-im/status-go/protocol/message_processor.go b/vendor/github.com/status-im/status-go/protocol/message_processor.go deleted file mode 100644 index 1b05403f1..000000000 --- a/vendor/github.com/status-im/status-go/protocol/message_processor.go +++ /dev/null @@ -1,449 +0,0 @@ -package protocol - -import ( - "context" - "crypto/ecdsa" - "database/sql" - "time" - - "github.com/golang/protobuf/proto" - "github.com/pkg/errors" - datasyncnode "github.com/vacp2p/mvds/node" - datasyncproto "github.com/vacp2p/mvds/protobuf" - "go.uber.org/zap" - - "github.com/status-im/status-go/eth-node/crypto" - "github.com/status-im/status-go/eth-node/types" - "github.com/status-im/status-go/protocol/datasync" - datasyncpeer "github.com/status-im/status-go/protocol/datasync/peer" - "github.com/status-im/status-go/protocol/encryption" - "github.com/status-im/status-go/protocol/encryption/multidevice" - "github.com/status-im/status-go/protocol/protobuf" - "github.com/status-im/status-go/protocol/transport" - v1protocol "github.com/status-im/status-go/protocol/v1" -) - -// Whisper message properties. -const ( - whisperTTL = 15 - whisperPoW = 0.002 - whisperPoWTime = 5 -) - -type messageProcessor struct { - identity *ecdsa.PrivateKey - datasync *datasync.DataSync - protocol *encryption.Protocol - transport transport.Transport - logger *zap.Logger - - featureFlags featureFlags -} - -func newMessageProcessor( - identity *ecdsa.PrivateKey, - database *sql.DB, - enc *encryption.Protocol, - transport transport.Transport, - logger *zap.Logger, - features featureFlags, -) (*messageProcessor, error) { - dataSyncTransport := datasync.NewDataSyncNodeTransport() - dataSyncNode, err := datasyncnode.NewPersistentNode( - database, - dataSyncTransport, - datasyncpeer.PublicKeyToPeerID(identity.PublicKey), - datasyncnode.BATCH, - datasync.CalculateSendTime, - logger, - ) - if err != nil { - return nil, err - } - ds := datasync.New(dataSyncNode, dataSyncTransport, features.datasync, logger) - - p := &messageProcessor{ - identity: identity, - datasync: ds, - protocol: enc, - transport: transport, - logger: logger, - featureFlags: features, - } - - // Initializing DataSync is required to encrypt and send messages. - // With DataSync enabled, messages are added to the DataSync - // but actual encrypt and send calls are postponed. - // sendDataSync is responsible for encrypting and sending postponed messages. - if features.datasync { - ds.Init(p.sendDataSync) - ds.Start(300 * time.Millisecond) - } - - return p, nil -} - -func (p *messageProcessor) Stop() { - p.datasync.Stop() // idempotent op -} - -// SendPrivateRaw takes encoded data, encrypts it and sends through the wire. -func (p *messageProcessor) SendPrivateRaw( - ctx context.Context, - recipient *ecdsa.PublicKey, - data []byte, - messageType protobuf.ApplicationMetadataMessage_Type, -) ([]byte, error) { - p.logger.Debug( - "sending a private message", - zap.Binary("public-key", crypto.FromECDSAPub(recipient)), - zap.String("site", "SendPrivateRaw"), - ) - return p.sendPrivate(ctx, recipient, data, messageType) -} - -// SendGroupRaw takes encoded data, encrypts it and sends through the wire, -// always return the messageID -func (p *messageProcessor) SendGroupRaw( - ctx context.Context, - recipients []*ecdsa.PublicKey, - data []byte, - messageType protobuf.ApplicationMetadataMessage_Type, -) ([]byte, error) { - p.logger.Debug( - "sending a private group message", - zap.String("site", "SendGroupRaw"), - ) - // Calculate messageID first - wrappedMessage, err := p.wrapMessageV1(data, messageType) - if err != nil { - return nil, errors.Wrap(err, "failed to wrap message") - } - - messageID := v1protocol.MessageID(&p.identity.PublicKey, wrappedMessage) - - for _, recipient := range recipients { - _, err = p.sendPrivate(ctx, recipient, data, messageType) - if err != nil { - return nil, errors.Wrap(err, "failed to send message") - } - } - return messageID, nil -} - -// sendPrivate sends data to the recipient identifying with a given public key. -func (p *messageProcessor) sendPrivate( - ctx context.Context, - recipient *ecdsa.PublicKey, - data []byte, - messageType protobuf.ApplicationMetadataMessage_Type, -) ([]byte, error) { - p.logger.Debug("sending private message", zap.Binary("recipient", crypto.FromECDSAPub(recipient))) - - wrappedMessage, err := p.wrapMessageV1(data, messageType) - if err != nil { - return nil, errors.Wrap(err, "failed to wrap message") - } - - messageID := v1protocol.MessageID(&p.identity.PublicKey, wrappedMessage) - - if p.featureFlags.datasync { - if err := p.addToDataSync(recipient, wrappedMessage); err != nil { - return nil, errors.Wrap(err, "failed to send message with datasync") - } - - // No need to call transport tracking. - // It is done in a data sync dispatch step. - } else { - messageSpec, err := p.protocol.BuildDirectMessage(p.identity, recipient, wrappedMessage) - if err != nil { - return nil, errors.Wrap(err, "failed to encrypt message") - } - - hash, newMessage, err := p.sendMessageSpec(ctx, recipient, messageSpec) - if err != nil { - return nil, errors.Wrap(err, "failed to send a message spec") - } - - p.transport.Track([][]byte{messageID}, hash, newMessage) - } - - return messageID, nil -} - -// sendPairInstallation sends data to the recipients, using DH -func (p *messageProcessor) SendPairInstallation( - ctx context.Context, - recipient *ecdsa.PublicKey, - data []byte, - messageType protobuf.ApplicationMetadataMessage_Type, -) ([]byte, error) { - p.logger.Debug("sending private message", zap.Binary("recipient", crypto.FromECDSAPub(recipient))) - - wrappedMessage, err := p.wrapMessageV1(data, messageType) - if err != nil { - return nil, errors.Wrap(err, "failed to wrap message") - } - - messageSpec, err := p.protocol.BuildDHMessage(p.identity, recipient, wrappedMessage) - if err != nil { - return nil, errors.Wrap(err, "failed to encrypt message") - } - - hash, newMessage, err := p.sendMessageSpec(ctx, recipient, messageSpec) - if err != nil { - return nil, errors.Wrap(err, "failed to send a message spec") - } - - messageID := v1protocol.MessageID(&p.identity.PublicKey, wrappedMessage) - p.transport.Track([][]byte{messageID}, hash, newMessage) - - return messageID, nil -} - -func (p *messageProcessor) EncodeMembershipUpdate( - group *v1protocol.Group, - chatMessage *protobuf.ChatMessage, -) ([]byte, error) { - - message := v1protocol.MembershipUpdateMessage{ - ChatID: group.ChatID(), - Events: group.Events(), - Message: chatMessage, - } - encodedMessage, err := v1protocol.EncodeMembershipUpdateMessage(message) - if err != nil { - return nil, errors.Wrap(err, "failed to encode membership update message") - } - - return encodedMessage, nil -} - -// SendPublicRaw takes encoded data, encrypts it and sends through the wire. -func (p *messageProcessor) SendPublicRaw( - ctx context.Context, - chatName string, - data []byte, - messageType protobuf.ApplicationMetadataMessage_Type, -) ([]byte, error) { - var newMessage *types.NewMessage - - wrappedMessage, err := p.wrapMessageV1(data, messageType) - if err != nil { - return nil, errors.Wrap(err, "failed to wrap message") - } - - newMessage = &types.NewMessage{ - TTL: whisperTTL, - Payload: wrappedMessage, - PowTarget: whisperPoW, - PowTime: whisperPoWTime, - } - - hash, err := p.transport.SendPublic(ctx, newMessage, chatName) - if err != nil { - return nil, err - } - - messageID := v1protocol.MessageID(&p.identity.PublicKey, wrappedMessage) - - p.transport.Track([][]byte{messageID}, hash, newMessage) - - return messageID, nil -} - -func (p *messageProcessor) processPairMessage(m v1protocol.PairMessage) error { - metadata := &multidevice.InstallationMetadata{ - Name: m.Name, - FCMToken: m.FCMToken, - DeviceType: m.DeviceType, - } - return p.protocol.SetInstallationMetadata(&p.identity.PublicKey, m.InstallationID, metadata) -} - -// handleMessages expects a whisper message as input, and it will go through -// a series of transformations until the message is parsed into an application -// layer message, or in case of Raw methods, the processing stops at the layer -// before. -// It returns an error only if the processing of required steps failed. -func (p *messageProcessor) handleMessages(shhMessage *types.Message, applicationLayer bool) ([]*v1protocol.StatusMessage, error) { - logger := p.logger.With(zap.String("site", "handleMessages")) - hlogger := logger.With(zap.ByteString("hash", shhMessage.Hash)) - var statusMessage v1protocol.StatusMessage - - err := statusMessage.HandleTransport(shhMessage) - if err != nil { - hlogger.Error("failed to handle transport layer message", zap.Error(err)) - return nil, err - } - - err = p.handleEncryptionLayer(context.Background(), &statusMessage) - if err != nil { - hlogger.Debug("failed to handle an encryption message", zap.Error(err)) - } - - statusMessages, err := statusMessage.HandleDatasync(p.datasync) - if err != nil { - hlogger.Debug("failed to handle datasync message", zap.Error(err)) - } - - for _, statusMessage := range statusMessages { - err := statusMessage.HandleApplicationMetadata() - if err != nil { - hlogger.Error("failed to handle application metadata layer message", zap.Error(err)) - } - - if applicationLayer { - err = statusMessage.HandleApplication() - if err != nil { - hlogger.Error("failed to handle application layer message", zap.Error(err)) - } - } - } - - return statusMessages, nil -} - -func (p *messageProcessor) handleEncryptionLayer(ctx context.Context, message *v1protocol.StatusMessage) error { - logger := p.logger.With(zap.String("site", "handleEncryptionLayer")) - publicKey := message.SigPubKey() - - err := message.HandleEncryption(p.identity, publicKey, p.protocol) - if err == encryption.ErrDeviceNotFound { - if err := p.handleErrDeviceNotFound(ctx, publicKey); err != nil { - logger.Error("failed to handle ErrDeviceNotFound", zap.Error(err)) - } - } - if err != nil { - return errors.Wrap(err, "failed to process an encrypted message") - } - - return nil -} - -func (p *messageProcessor) handleErrDeviceNotFound(ctx context.Context, publicKey *ecdsa.PublicKey) error { - now := time.Now().Unix() - advertise, err := p.protocol.ShouldAdvertiseBundle(publicKey, now) - if err != nil { - return err - } - if !advertise { - return nil - } - - messageSpec, err := p.protocol.BuildBundleAdvertiseMessage(p.identity, publicKey) - if err != nil { - return err - } - - ctx, cancel := context.WithTimeout(ctx, time.Second) - defer cancel() - _, _, err = p.sendMessageSpec(ctx, publicKey, messageSpec) - if err != nil { - return err - } - - p.protocol.ConfirmBundleAdvertisement(publicKey, now) - - return nil -} - -func (p *messageProcessor) wrapMessageV1(encodedMessage []byte, messageType protobuf.ApplicationMetadataMessage_Type) ([]byte, error) { - wrappedMessage, err := v1protocol.WrapMessageV1(encodedMessage, messageType, p.identity) - if err != nil { - return nil, errors.Wrap(err, "failed to wrap message") - } - return wrappedMessage, nil -} - -func (p *messageProcessor) addToDataSync(publicKey *ecdsa.PublicKey, message []byte) error { - groupID := datasync.ToOneToOneGroupID(&p.identity.PublicKey, publicKey) - peerID := datasyncpeer.PublicKeyToPeerID(*publicKey) - exist, err := p.datasync.IsPeerInGroup(groupID, peerID) - if err != nil { - return errors.Wrap(err, "failed to check if peer is in group") - } - if !exist { - if err := p.datasync.AddPeer(groupID, peerID); err != nil { - return errors.Wrap(err, "failed to add peer") - } - } - _, err = p.datasync.AppendMessage(groupID, message) - if err != nil { - return errors.Wrap(err, "failed to append message to datasync") - } - - return nil -} - -// sendDataSync sends a message scheduled by the data sync layer. -// Data Sync layer calls this method "dispatch" function. -func (p *messageProcessor) sendDataSync(ctx context.Context, publicKey *ecdsa.PublicKey, encodedMessage []byte, payload *datasyncproto.Payload) error { - messageIDs := make([][]byte, 0, len(payload.Messages)) - for _, payload := range payload.Messages { - messageIDs = append(messageIDs, v1protocol.MessageID(&p.identity.PublicKey, payload.Body)) - } - - messageSpec, err := p.protocol.BuildDirectMessage(p.identity, publicKey, encodedMessage) - if err != nil { - return errors.Wrap(err, "failed to encrypt message") - } - - hash, newMessage, err := p.sendMessageSpec(ctx, publicKey, messageSpec) - if err != nil { - return err - } - - p.transport.Track(messageIDs, hash, newMessage) - - return nil -} - -// sendMessageSpec analyses the spec properties and selects a proper transport method. -func (p *messageProcessor) sendMessageSpec(ctx context.Context, publicKey *ecdsa.PublicKey, messageSpec *encryption.ProtocolMessageSpec) ([]byte, *types.NewMessage, error) { - newMessage, err := messageSpecToWhisper(messageSpec) - if err != nil { - return nil, nil, err - } - - logger := p.logger.With(zap.String("site", "sendMessageSpec")) - - var hash []byte - - switch { - case messageSpec.SharedSecret != nil: - logger.Debug("sending using shared secret") - hash, err = p.transport.SendPrivateWithSharedSecret(ctx, newMessage, publicKey, messageSpec.SharedSecret) - default: - logger.Debug("sending partitioned topic") - hash, err = p.transport.SendPrivateWithPartitioned(ctx, newMessage, publicKey) - } - if err != nil { - return nil, nil, err - } - - return hash, newMessage, nil -} - -func messageSpecToWhisper(spec *encryption.ProtocolMessageSpec) (*types.NewMessage, error) { - var newMessage *types.NewMessage - - payload, err := proto.Marshal(spec.Message) - if err != nil { - return newMessage, err - } - - newMessage = &types.NewMessage{ - TTL: whisperTTL, - Payload: payload, - PowTarget: whisperPoW, - PowTime: whisperPoWTime, - } - return newMessage, nil -} - -// isPubKeyEqual checks that two public keys are equal -func isPubKeyEqual(a, b *ecdsa.PublicKey) bool { - // the curve is always the same, just compare the points - return a.X.Cmp(b.X) == 0 && a.Y.Cmp(b.Y) == 0 -} diff --git a/vendor/github.com/status-im/status-go/protocol/message_validator.go b/vendor/github.com/status-im/status-go/protocol/message_validator.go deleted file mode 100644 index cd2fe7ee0..000000000 --- a/vendor/github.com/status-im/status-go/protocol/message_validator.go +++ /dev/null @@ -1,195 +0,0 @@ -package protocol - -import ( - "errors" - "strconv" - "strings" - - "github.com/status-im/status-go/protocol/protobuf" - "github.com/status-im/status-go/protocol/v1" -) - -// maxWhisperDrift is how many milliseconds we allow the clock value to differ -// from whisperTimestamp -const maxWhisperFutureDriftMs uint64 = 120000 - -func validateClockValue(clock uint64, whisperTimestamp uint64) error { - if clock == 0 { - return errors.New("clock can't be 0") - } - - if clock > whisperTimestamp && clock-whisperTimestamp > maxWhisperFutureDriftMs { - return errors.New("clock value too high") - } - - return nil -} - -func ValidateMembershipUpdateMessage(message *protocol.MembershipUpdateMessage, timeNowMs uint64) error { - - for _, e := range message.Events { - if err := validateClockValue(e.ClockValue, timeNowMs); err != nil { - return err - } - - } - return nil -} - -func ValidateReceivedPairInstallation(message *protobuf.PairInstallation, whisperTimestamp uint64) error { - if err := validateClockValue(message.Clock, whisperTimestamp); err != nil { - return err - } - - if len(strings.TrimSpace(message.Name)) == 0 { - return errors.New("name can't be empty") - } - - if len(strings.TrimSpace(message.DeviceType)) == 0 { - return errors.New("device type can't be empty") - } - - if len(strings.TrimSpace(message.InstallationId)) == 0 { - return errors.New("installationId can't be empty") - } - - return nil -} - -func ValidateReceivedSendTransaction(message *protobuf.SendTransaction, whisperTimestamp uint64) error { - if err := validateClockValue(message.Clock, whisperTimestamp); err != nil { - return err - } - - if len(strings.TrimSpace(message.TransactionHash)) == 0 { - return errors.New("transaction hash can't be empty") - } - - if message.Signature == nil { - return errors.New("signature can't be nil") - } - - return nil -} - -func ValidateReceivedRequestAddressForTransaction(message *protobuf.RequestAddressForTransaction, whisperTimestamp uint64) error { - if err := validateClockValue(message.Clock, whisperTimestamp); err != nil { - return err - } - - if len(strings.TrimSpace(message.Value)) == 0 { - return errors.New("value can't be empty") - } - - _, err := strconv.ParseFloat(message.Value, 64) - if err != nil { - return err - } - - return nil -} - -func ValidateReceivedRequestTransaction(message *protobuf.RequestTransaction, whisperTimestamp uint64) error { - if err := validateClockValue(message.Clock, whisperTimestamp); err != nil { - return err - } - - if len(strings.TrimSpace(message.Value)) == 0 { - return errors.New("value can't be empty") - } - - if len(strings.TrimSpace(message.Address)) == 0 { - return errors.New("address can't be empty") - } - - _, err := strconv.ParseFloat(message.Value, 64) - if err != nil { - return err - } - - return nil -} - -func ValidateReceivedAcceptRequestAddressForTransaction(message *protobuf.AcceptRequestAddressForTransaction, whisperTimestamp uint64) error { - if err := validateClockValue(message.Clock, whisperTimestamp); err != nil { - return err - } - - if len(message.Id) == 0 { - return errors.New("messageID can't be empty") - } - - if len(strings.TrimSpace(message.Address)) == 0 { - return errors.New("address can't be empty") - } - - return nil -} - -func ValidateReceivedDeclineRequestAddressForTransaction(message *protobuf.DeclineRequestAddressForTransaction, whisperTimestamp uint64) error { - if err := validateClockValue(message.Clock, whisperTimestamp); err != nil { - return err - } - - if len(message.Id) == 0 { - return errors.New("messageID can't be empty") - } - - return nil -} - -func ValidateReceivedDeclineRequestTransaction(message *protobuf.DeclineRequestTransaction, whisperTimestamp uint64) error { - if err := validateClockValue(message.Clock, whisperTimestamp); err != nil { - return err - } - - if len(message.Id) == 0 { - return errors.New("messageID can't be empty") - } - - return nil -} - -func ValidateReceivedChatMessage(message *protobuf.ChatMessage, whisperTimestamp uint64) error { - if err := validateClockValue(message.Clock, whisperTimestamp); err != nil { - return err - } - - if message.Timestamp == 0 { - return errors.New("timestamp can't be 0") - } - - if len(strings.TrimSpace(message.Text)) == 0 { - return errors.New("text can't be empty") - } - - if len(message.ChatId) == 0 { - return errors.New("chatId can't be empty") - } - - if message.ContentType == protobuf.ChatMessage_UNKNOWN_CONTENT_TYPE { - return errors.New("unknown content type") - } - - if message.ContentType == protobuf.ChatMessage_TRANSACTION_COMMAND { - return errors.New("can't receive request address for transaction from others") - } - - if message.MessageType == protobuf.ChatMessage_UNKNOWN_MESSAGE_TYPE || message.MessageType == protobuf.ChatMessage_SYSTEM_MESSAGE_PRIVATE_GROUP { - return errors.New("unknown message type") - } - - if message.ContentType == protobuf.ChatMessage_STICKER { - if message.Payload == nil { - return errors.New("no sticker content") - } - sticker := message.GetSticker() - if sticker == nil { - return errors.New("no sticker content") - } - if len(sticker.Hash) == 0 { - return errors.New("sticker hash not set") - } - } - return nil -} diff --git a/vendor/github.com/status-im/status-go/protocol/messenger.go b/vendor/github.com/status-im/status-go/protocol/messenger.go deleted file mode 100644 index 074e96d2b..000000000 --- a/vendor/github.com/status-im/status-go/protocol/messenger.go +++ /dev/null @@ -1,2822 +0,0 @@ -package protocol - -import ( - "context" - "crypto/ecdsa" - "database/sql" - "math/rand" - "sync" - "time" - - "github.com/pkg/errors" - "go.uber.org/zap" - - "github.com/golang/protobuf/proto" - - "github.com/status-im/status-go/eth-node/crypto" - "github.com/status-im/status-go/eth-node/types" - enstypes "github.com/status-im/status-go/eth-node/types/ens" - "github.com/status-im/status-go/protocol/encryption" - "github.com/status-im/status-go/protocol/encryption/multidevice" - "github.com/status-im/status-go/protocol/encryption/sharedsecret" - "github.com/status-im/status-go/protocol/identity/alias" - "github.com/status-im/status-go/protocol/identity/identicon" - "github.com/status-im/status-go/protocol/protobuf" - "github.com/status-im/status-go/protocol/sqlite" - "github.com/status-im/status-go/protocol/transport" - wakutransp "github.com/status-im/status-go/protocol/transport/waku" - shhtransp "github.com/status-im/status-go/protocol/transport/whisper" - v1protocol "github.com/status-im/status-go/protocol/v1" -) - -const PubKeyStringLength = 132 - -var ( - ErrChatIDEmpty = errors.New("chat ID is empty") - ErrNotImplemented = errors.New("not implemented") - - errChatNotFound = errors.New("chat not found") -) - -// Messenger is a entity managing chats and messages. -// It acts as a bridge between the application and encryption -// layers. -// It needs to expose an interface to manage installations -// because installations are managed by the user. -// Similarly, it needs to expose an interface to manage -// mailservers because they can also be managed by the user. -type Messenger struct { - node types.Node - identity *ecdsa.PrivateKey - persistence *sqlitePersistence - transport transport.Transport - encryptor *encryption.Protocol - processor *messageProcessor - handler *MessageHandler - logger *zap.Logger - verifyTransactionClient EthClient - featureFlags featureFlags - messagesPersistenceEnabled bool - shutdownTasks []func() error - systemMessagesTranslations map[protobuf.MembershipUpdateEvent_EventType]string - allChats map[string]*Chat - allContacts map[string]*Contact - allInstallations map[string]*multidevice.Installation - modifiedInstallations map[string]bool - installationID string - - mutex sync.Mutex -} - -type RawResponse struct { - Filter *transport.Filter `json:"filter"` - Messages []*v1protocol.StatusMessage `json:"messages"` -} - -type MessengerResponse struct { - Chats []*Chat `json:"chats,omitEmpty"` - Messages []*Message `json:"messages,omitEmpty"` - Contacts []*Contact `json:"contacts,omitEmpty"` - Installations []*multidevice.Installation `json:"installations,omitEmpty"` - // Raw unprocessed messages - RawMessages []*RawResponse `json:"rawMessages,omitEmpty"` -} - -func (m *MessengerResponse) IsEmpty() bool { - return len(m.Chats) == 0 && len(m.Messages) == 0 && len(m.Contacts) == 0 && len(m.RawMessages) == 0 && len(m.Installations) == 0 -} - -type featureFlags struct { - // datasync indicates whether direct messages should be sent exclusively - // using datasync, breaking change for non-v1 clients. Public messages - // are not impacted - datasync bool -} - -type dbConfig struct { - dbPath string - dbKey string -} - -type config struct { - // This needs to be exposed until we move here mailserver logic - // as otherwise the client is not notified of a new filter and - // won't be pulling messages from mailservers until it reloads the chats/filters - onNegotiatedFilters func([]*transport.Filter) - // DEPRECATED: no need to expose it - onSendContactCodeHandler func(*encryption.ProtocolMessageSpec) - - // systemMessagesTranslations holds translations for system-messages - systemMessagesTranslations map[protobuf.MembershipUpdateEvent_EventType]string - // Config for the envelopes monitor - envelopesMonitorConfig *transport.EnvelopesMonitorConfig - - messagesPersistenceEnabled bool - featureFlags featureFlags - - // A path to a database or a database instance is required. - // The database instance has a higher priority. - dbConfig dbConfig - db *sql.DB - - verifyTransactionClient EthClient - - logger *zap.Logger -} - -type Option func(*config) error - -// WithSystemMessagesTranslations is required for Group Chats which are currently disabled. -// nolint: unused -func WithSystemMessagesTranslations(t map[protobuf.MembershipUpdateEvent_EventType]string) Option { - return func(c *config) error { - c.systemMessagesTranslations = t - return nil - } -} - -func WithOnNegotiatedFilters(h func([]*transport.Filter)) Option { - return func(c *config) error { - c.onNegotiatedFilters = h - return nil - } -} - -func WithCustomLogger(logger *zap.Logger) Option { - return func(c *config) error { - c.logger = logger - return nil - } -} - -func WithMessagesPersistenceEnabled() Option { - return func(c *config) error { - c.messagesPersistenceEnabled = true - return nil - } -} - -func WithDatabaseConfig(dbPath, dbKey string) Option { - return func(c *config) error { - c.dbConfig = dbConfig{dbPath: dbPath, dbKey: dbKey} - return nil - } -} - -func WithVerifyTransactionClient(client EthClient) Option { - return func(c *config) error { - c.verifyTransactionClient = client - return nil - } -} - -func WithDatabase(db *sql.DB) Option { - return func(c *config) error { - c.db = db - return nil - } -} - -func WithDatasync() func(c *config) error { - return func(c *config) error { - c.featureFlags.datasync = true - return nil - } -} - -func WithEnvelopesMonitorConfig(emc *transport.EnvelopesMonitorConfig) Option { - return func(c *config) error { - c.envelopesMonitorConfig = emc - return nil - } -} - -func NewMessenger( - identity *ecdsa.PrivateKey, - node types.Node, - installationID string, - opts ...Option, -) (*Messenger, error) { - var messenger *Messenger - - c := config{} - - for _, opt := range opts { - if err := opt(&c); err != nil { - return nil, err - } - } - - logger := c.logger - if c.logger == nil { - var err error - if logger, err = zap.NewDevelopment(); err != nil { - return nil, errors.Wrap(err, "failed to create a logger") - } - } - - onNewInstallationsHandler := func(installations []*multidevice.Installation) { - - for _, installation := range installations { - if installation.Identity == contactIDFromPublicKey(&messenger.identity.PublicKey) { - if _, ok := messenger.allInstallations[installation.ID]; !ok { - messenger.allInstallations[installation.ID] = installation - messenger.modifiedInstallations[installation.ID] = true - } - } - } - } - // Set default config fields. - onNewSharedSecretHandler := func(secrets []*sharedsecret.Secret) { - filters, err := messenger.handleSharedSecrets(secrets) - if err != nil { - slogger := logger.With(zap.String("site", "onNewSharedSecretHandler")) - slogger.Warn("failed to process secrets", zap.Error(err)) - } - - if c.onNegotiatedFilters != nil { - c.onNegotiatedFilters(filters) - } - } - if c.onSendContactCodeHandler == nil { - c.onSendContactCodeHandler = func(messageSpec *encryption.ProtocolMessageSpec) { - slogger := logger.With(zap.String("site", "onSendContactCodeHandler")) - slogger.Debug("received a SendContactCode request") - - newMessage, err := messageSpecToWhisper(messageSpec) - if err != nil { - slogger.Warn("failed to convert spec to Whisper message", zap.Error(err)) - return - } - - ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) - defer cancel() - chatName := transport.ContactCodeTopic(&messenger.identity.PublicKey) - _, err = messenger.transport.SendPublic(ctx, newMessage, chatName) - if err != nil { - slogger.Warn("failed to send a contact code", zap.Error(err)) - } - } - } - - if c.systemMessagesTranslations == nil { - c.systemMessagesTranslations = defaultSystemMessagesTranslations - } - - // Configure the database. - database := c.db - if c.db == nil && c.dbConfig == (dbConfig{}) { - return nil, errors.New("database instance or database path needs to be provided") - } - if c.db == nil { - logger.Info("opening a database", zap.String("dbPath", c.dbConfig.dbPath)) - var err error - database, err = sqlite.Open(c.dbConfig.dbPath, c.dbConfig.dbKey) - if err != nil { - return nil, errors.Wrap(err, "failed to initialize database from the db config") - } - } - - // Apply migrations for all components. - err := sqlite.Migrate(database) - if err != nil { - return nil, errors.Wrap(err, "failed to apply migrations") - } - - // Initialize transport layer. - var transp transport.Transport - if shh, err := node.GetWhisper(nil); err == nil && shh != nil { - transp, err = shhtransp.NewWhisperServiceTransport( - shh, - identity, - database, - nil, - c.envelopesMonitorConfig, - logger, - ) - if err != nil { - return nil, errors.Wrap(err, "failed to create WhisperServiceTransport") - } - } else { - logger.Info("failed to find Whisper service; trying Waku", zap.Error(err)) - waku, err := node.GetWaku(nil) - if err != nil || waku == nil { - return nil, errors.Wrap(err, "failed to find Whisper and Waku services") - } - transp, err = wakutransp.NewWakuServiceTransport( - waku, - identity, - database, - nil, - c.envelopesMonitorConfig, - logger, - ) - if err != nil { - return nil, errors.Wrap(err, "failed to create WakuServiceTransport") - } - } - - // Initialize encryption layer. - encryptionProtocol := encryption.New( - database, - installationID, - onNewInstallationsHandler, - onNewSharedSecretHandler, - c.onSendContactCodeHandler, - logger, - ) - - processor, err := newMessageProcessor( - identity, - database, - encryptionProtocol, - transp, - logger, - c.featureFlags, - ) - if err != nil { - return nil, errors.Wrap(err, "failed to create messageProcessor") - } - - handler := newMessageHandler(identity, logger, &sqlitePersistence{db: database}) - - messenger = &Messenger{ - node: node, - identity: identity, - persistence: &sqlitePersistence{db: database}, - transport: transp, - encryptor: encryptionProtocol, - processor: processor, - handler: handler, - featureFlags: c.featureFlags, - systemMessagesTranslations: c.systemMessagesTranslations, - allChats: make(map[string]*Chat), - allContacts: make(map[string]*Contact), - allInstallations: make(map[string]*multidevice.Installation), - installationID: installationID, - modifiedInstallations: make(map[string]bool), - messagesPersistenceEnabled: c.messagesPersistenceEnabled, - verifyTransactionClient: c.verifyTransactionClient, - shutdownTasks: []func() error{ - database.Close, - transp.ResetFilters, - transp.Stop, - func() error { processor.Stop(); return nil }, - // Currently this often fails, seems like it's safe to ignore them - // https://github.com/uber-go/zap/issues/328 - func() error { _ = logger.Sync; return nil }, - }, - logger: logger, - } - - logger.Debug("messages persistence", zap.Bool("enabled", c.messagesPersistenceEnabled)) - - return messenger, nil -} - -func (m *Messenger) Start() error { - return m.encryptor.Start(m.identity) -} - -// Init analyzes chats and contacts in order to setup filters -// which are responsible for retrieving messages. -func (m *Messenger) Init() error { - m.mutex.Lock() - defer m.mutex.Unlock() - - // Seed the for color generation - rand.Seed(time.Now().Unix()) - - logger := m.logger.With(zap.String("site", "Init")) - - var ( - publicChatIDs []string - publicKeys []*ecdsa.PublicKey - ) - - // Get chat IDs and public keys from the existing chats. - // TODO: Get only active chats by the query. - chats, err := m.persistence.Chats() - if err != nil { - return err - } - for _, chat := range chats { - if err := chat.Validate(); err != nil { - logger.Warn("failed to validate chat", zap.Error(err)) - continue - } - - m.allChats[chat.ID] = chat - if !chat.Active { - continue - } - switch chat.ChatType { - case ChatTypePublic: - publicChatIDs = append(publicChatIDs, chat.ID) - case ChatTypeOneToOne: - pk, err := chat.PublicKey() - if err != nil { - return err - } - publicKeys = append(publicKeys, pk) - case ChatTypePrivateGroupChat: - for _, member := range chat.Members { - publicKey, err := member.PublicKey() - if err != nil { - return errors.Wrapf(err, "invalid public key for member %s in chat %s", member.ID, chat.Name) - } - publicKeys = append(publicKeys, publicKey) - } - default: - return errors.New("invalid chat type") - } - } - - // Get chat IDs and public keys from the contacts. - contacts, err := m.persistence.Contacts() - if err != nil { - return err - } - for _, contact := range contacts { - m.allContacts[contact.ID] = contact - // We only need filters for contacts added by us and not blocked. - if !contact.IsAdded() || contact.IsBlocked() { - continue - } - publicKey, err := contact.PublicKey() - if err != nil { - logger.Error("failed to get contact's public key", zap.Error(err)) - continue - } - publicKeys = append(publicKeys, publicKey) - } - - installations, err := m.encryptor.GetOurInstallations(&m.identity.PublicKey) - if err != nil { - return err - } - - for _, installation := range installations { - m.allInstallations[installation.ID] = installation - } - - _, err = m.transport.InitFilters(publicChatIDs, publicKeys) - return err -} - -// Shutdown takes care of ensuring a clean shutdown of Messenger -func (m *Messenger) Shutdown() (err error) { - for _, task := range m.shutdownTasks { - if tErr := task(); tErr != nil { - if err == nil { - // First error appeared. - err = tErr - } else { - // We return all errors. They will be concatenated in the order of occurrence, - // however, they will also be returned as a single error. - err = errors.Wrap(err, tErr.Error()) - } - } - } - return -} - -func (m *Messenger) handleSharedSecrets(secrets []*sharedsecret.Secret) ([]*transport.Filter, error) { - logger := m.logger.With(zap.String("site", "handleSharedSecrets")) - var result []*transport.Filter - for _, secret := range secrets { - logger.Debug("received shared secret", zap.Binary("identity", crypto.FromECDSAPub(secret.Identity))) - fSecret := types.NegotiatedSecret{ - PublicKey: secret.Identity, - Key: secret.Key, - } - filter, err := m.transport.ProcessNegotiatedSecret(fSecret) - if err != nil { - return nil, err - } - result = append(result, filter) - } - return result, nil -} - -func (m *Messenger) EnableInstallation(id string) error { - m.mutex.Lock() - defer m.mutex.Unlock() - - installation, ok := m.allInstallations[id] - if !ok { - return errors.New("no installation found") - } - - err := m.encryptor.EnableInstallation(&m.identity.PublicKey, id) - if err != nil { - return err - } - installation.Enabled = true - m.allInstallations[id] = installation - return nil -} - -func (m *Messenger) DisableInstallation(id string) error { - m.mutex.Lock() - defer m.mutex.Unlock() - - installation, ok := m.allInstallations[id] - if !ok { - return errors.New("no installation found") - } - - err := m.encryptor.DisableInstallation(&m.identity.PublicKey, id) - if err != nil { - return err - } - installation.Enabled = false - m.allInstallations[id] = installation - return nil -} - -func (m *Messenger) Installations() []*multidevice.Installation { - m.mutex.Lock() - defer m.mutex.Unlock() - installations := make([]*multidevice.Installation, len(m.allInstallations)) - - var i = 0 - for _, installation := range m.allInstallations { - installations[i] = installation - i++ - } - return installations -} - -func (m *Messenger) setInstallationMetadata(id string, data *multidevice.InstallationMetadata) error { - installation, ok := m.allInstallations[id] - if !ok { - return errors.New("no installation found") - } - - installation.InstallationMetadata = data - return m.encryptor.SetInstallationMetadata(&m.identity.PublicKey, id, data) -} - -func (m *Messenger) SetInstallationMetadata(id string, data *multidevice.InstallationMetadata) error { - m.mutex.Lock() - defer m.mutex.Unlock() - return m.setInstallationMetadata(id, data) -} - -// NOT IMPLEMENTED -func (m *Messenger) SelectMailserver(id string) error { - return ErrNotImplemented -} - -// NOT IMPLEMENTED -func (m *Messenger) AddMailserver(enode string) error { - return ErrNotImplemented -} - -// NOT IMPLEMENTED -func (m *Messenger) RemoveMailserver(id string) error { - return ErrNotImplemented -} - -// NOT IMPLEMENTED -func (m *Messenger) Mailservers() ([]string, error) { - return nil, ErrNotImplemented -} - -func (m *Messenger) Join(chat Chat) error { - switch chat.ChatType { - case ChatTypeOneToOne: - pk, err := chat.PublicKey() - if err != nil { - return err - } - - return m.transport.JoinPrivate(pk) - case ChatTypePrivateGroupChat: - members, err := chat.MembersAsPublicKeys() - if err != nil { - return err - } - return m.transport.JoinGroup(members) - case ChatTypePublic: - return m.transport.JoinPublic(chat.ID) - default: - return errors.New("chat is neither public nor private") - } -} - -// This is not accurate, it should not leave transport on removal of chat/group -// only once there is no more: Group chat with that member, one-to-one chat, contact added by us -func (m *Messenger) Leave(chat Chat) error { - switch chat.ChatType { - case ChatTypeOneToOne: - pk, err := chat.PublicKey() - if err != nil { - return err - } - return m.transport.LeavePrivate(pk) - case ChatTypePrivateGroupChat: - members, err := chat.MembersAsPublicKeys() - if err != nil { - return err - } - return m.transport.LeaveGroup(members) - case ChatTypePublic: - return m.transport.LeavePublic(chat.Name) - default: - return errors.New("chat is neither public nor private") - } -} - -func (m *Messenger) CreateGroupChatWithMembers(ctx context.Context, name string, members []string) (*MessengerResponse, error) { - m.mutex.Lock() - defer m.mutex.Unlock() - - var response MessengerResponse - logger := m.logger.With(zap.String("site", "CreateGroupChatWithMembers")) - logger.Info("Creating group chat", zap.String("name", name), zap.Any("members", members)) - chat := CreateGroupChat(m.getTimesource()) - group, err := v1protocol.NewGroupWithCreator(name, m.identity) - if err != nil { - return nil, err - } - chat.updateChatFromProtocolGroup(group) - - clock, _ := chat.NextClockAndTimestamp(m.getTimesource()) - // Add members - event := v1protocol.NewMembersAddedEvent(members, clock) - event.ChatID = chat.ID - err = event.Sign(m.identity) - if err != nil { - return nil, err - } - - err = group.ProcessEvent(event) - if err != nil { - return nil, err - } - recipients, err := stringSliceToPublicKeys(group.Members(), true) - if err != nil { - return nil, err - } - - encodedMessage, err := m.processor.EncodeMembershipUpdate(group, nil) - if err != nil { - return nil, err - } - m.allChats[chat.ID] = &chat - - _, err = m.dispatchMessage(ctx, &RawMessage{ - LocalChatID: chat.ID, - Payload: encodedMessage, - MessageType: protobuf.ApplicationMetadataMessage_MEMBERSHIP_UPDATE_MESSAGE, - Recipients: recipients, - ResendAutomatically: true, - }) - - if err != nil { - return nil, err - } - - chat.updateChatFromProtocolGroup(group) - - response.Chats = []*Chat{&chat} - response.Messages = buildSystemMessages(chat.MembershipUpdates, m.systemMessagesTranslations) - err = m.persistence.SaveMessagesLegacy(response.Messages) - if err != nil { - return nil, err - } - - return &response, m.saveChat(&chat) -} - -func (m *Messenger) RemoveMemberFromGroupChat(ctx context.Context, chatID string, member string) (*MessengerResponse, error) { - m.mutex.Lock() - defer m.mutex.Unlock() - - var response MessengerResponse - logger := m.logger.With(zap.String("site", "RemoveMemberFromGroupChat")) - logger.Info("Removing member form group chat", zap.String("chatID", chatID), zap.String("member", member)) - chat, ok := m.allChats[chatID] - if !ok { - return nil, errors.New("can't find chat") - } - - group, err := newProtocolGroupFromChat(chat) - if err != nil { - return nil, err - } - - // We save the initial recipients as we want to send updates to also - // the members kicked out - oldRecipients, err := stringSliceToPublicKeys(group.Members(), true) - if err != nil { - return nil, err - } - - clock, _ := chat.NextClockAndTimestamp(m.getTimesource()) - // Remove member - event := v1protocol.NewMemberRemovedEvent(member, clock) - event.ChatID = chat.ID - err = event.Sign(m.identity) - if err != nil { - return nil, err - } - - err = group.ProcessEvent(event) - if err != nil { - return nil, err - } - - encodedMessage, err := m.processor.EncodeMembershipUpdate(group, nil) - if err != nil { - return nil, err - } - _, err = m.dispatchMessage(ctx, &RawMessage{ - LocalChatID: chat.ID, - Payload: encodedMessage, - MessageType: protobuf.ApplicationMetadataMessage_MEMBERSHIP_UPDATE_MESSAGE, - Recipients: oldRecipients, - ResendAutomatically: true, - }) - if err != nil { - return nil, err - } - - chat.updateChatFromProtocolGroup(group) - response.Chats = []*Chat{chat} - response.Messages = buildSystemMessages(chat.MembershipUpdates, m.systemMessagesTranslations) - err = m.persistence.SaveMessagesLegacy(response.Messages) - if err != nil { - return nil, err - } - - return &response, m.saveChat(chat) -} - -func (m *Messenger) AddMembersToGroupChat(ctx context.Context, chatID string, members []string) (*MessengerResponse, error) { - m.mutex.Lock() - defer m.mutex.Unlock() - - var response MessengerResponse - logger := m.logger.With(zap.String("site", "AddMembersFromGroupChat")) - logger.Info("Adding members form group chat", zap.String("chatID", chatID), zap.Any("members", members)) - chat, ok := m.allChats[chatID] - if !ok { - return nil, errors.New("can't find chat") - } - - group, err := newProtocolGroupFromChat(chat) - if err != nil { - return nil, err - } - - clock, _ := chat.NextClockAndTimestamp(m.getTimesource()) - // Add members - event := v1protocol.NewMembersAddedEvent(members, clock) - event.ChatID = chat.ID - err = event.Sign(m.identity) - if err != nil { - return nil, err - } - - err = group.ProcessEvent(event) - if err != nil { - return nil, err - } - - recipients, err := stringSliceToPublicKeys(group.Members(), true) - if err != nil { - return nil, err - } - - encodedMessage, err := m.processor.EncodeMembershipUpdate(group, nil) - if err != nil { - return nil, err - } - _, err = m.dispatchMessage(ctx, &RawMessage{ - LocalChatID: chat.ID, - Payload: encodedMessage, - MessageType: protobuf.ApplicationMetadataMessage_MEMBERSHIP_UPDATE_MESSAGE, - Recipients: recipients, - ResendAutomatically: true, - }) - - if err != nil { - return nil, err - } - - chat.updateChatFromProtocolGroup(group) - - response.Chats = []*Chat{chat} - response.Messages = buildSystemMessages([]v1protocol.MembershipUpdateEvent{event}, m.systemMessagesTranslations) - err = m.persistence.SaveMessagesLegacy(response.Messages) - if err != nil { - return nil, err - } - - return &response, m.saveChat(chat) -} - -func (m *Messenger) AddAdminsToGroupChat(ctx context.Context, chatID string, members []string) (*MessengerResponse, error) { - m.mutex.Lock() - defer m.mutex.Unlock() - - var response MessengerResponse - logger := m.logger.With(zap.String("site", "AddAdminsToGroupChat")) - logger.Info("Add admins to group chat", zap.String("chatID", chatID), zap.Any("members", members)) - - chat, ok := m.allChats[chatID] - if !ok { - return nil, errors.New("can't find chat") - } - - group, err := newProtocolGroupFromChat(chat) - if err != nil { - return nil, err - } - - clock, _ := chat.NextClockAndTimestamp(m.getTimesource()) - // Add members - event := v1protocol.NewAdminsAddedEvent(members, clock) - event.ChatID = chat.ID - err = event.Sign(m.identity) - if err != nil { - return nil, err - } - - err = group.ProcessEvent(event) - if err != nil { - return nil, err - } - - recipients, err := stringSliceToPublicKeys(group.Members(), true) - if err != nil { - return nil, err - } - - encodedMessage, err := m.processor.EncodeMembershipUpdate(group, nil) - if err != nil { - return nil, err - } - _, err = m.dispatchMessage(ctx, &RawMessage{ - LocalChatID: chat.ID, - Payload: encodedMessage, - MessageType: protobuf.ApplicationMetadataMessage_MEMBERSHIP_UPDATE_MESSAGE, - Recipients: recipients, - ResendAutomatically: true, - }) - - if err != nil { - return nil, err - } - - chat.updateChatFromProtocolGroup(group) - - response.Chats = []*Chat{chat} - response.Messages = buildSystemMessages([]v1protocol.MembershipUpdateEvent{event}, m.systemMessagesTranslations) - err = m.persistence.SaveMessagesLegacy(response.Messages) - if err != nil { - return nil, err - } - - return &response, m.saveChat(chat) -} - -func (m *Messenger) ConfirmJoiningGroup(ctx context.Context, chatID string) (*MessengerResponse, error) { - m.mutex.Lock() - defer m.mutex.Unlock() - - var response MessengerResponse - - chat, ok := m.allChats[chatID] - if !ok { - return nil, errors.New("can't find chat") - } - - err := m.Join(*chat) - if err != nil { - return nil, err - } - - group, err := newProtocolGroupFromChat(chat) - if err != nil { - return nil, err - } - clock, _ := chat.NextClockAndTimestamp(m.getTimesource()) - event := v1protocol.NewMemberJoinedEvent( - clock, - ) - event.ChatID = chat.ID - err = event.Sign(m.identity) - if err != nil { - return nil, err - } - - err = group.ProcessEvent(event) - if err != nil { - return nil, err - } - - recipients, err := stringSliceToPublicKeys(group.Members(), true) - if err != nil { - return nil, err - } - - encodedMessage, err := m.processor.EncodeMembershipUpdate(group, nil) - if err != nil { - return nil, err - } - _, err = m.dispatchMessage(ctx, &RawMessage{ - LocalChatID: chat.ID, - Payload: encodedMessage, - MessageType: protobuf.ApplicationMetadataMessage_MEMBERSHIP_UPDATE_MESSAGE, - Recipients: recipients, - ResendAutomatically: true, - }) - if err != nil { - return nil, err - } - - chat.updateChatFromProtocolGroup(group) - - response.Chats = []*Chat{chat} - response.Messages = buildSystemMessages([]v1protocol.MembershipUpdateEvent{event}, m.systemMessagesTranslations) - err = m.persistence.SaveMessagesLegacy(response.Messages) - if err != nil { - return nil, err - } - - return &response, m.saveChat(chat) -} - -func (m *Messenger) LeaveGroupChat(ctx context.Context, chatID string) (*MessengerResponse, error) { - m.mutex.Lock() - defer m.mutex.Unlock() - - var response MessengerResponse - - chat, ok := m.allChats[chatID] - if !ok { - return nil, errors.New("can't find chat") - } - - err := m.Leave(*chat) - if err != nil { - return nil, err - } - - group, err := newProtocolGroupFromChat(chat) - if err != nil { - return nil, err - } - clock, _ := chat.NextClockAndTimestamp(m.getTimesource()) - event := v1protocol.NewMemberRemovedEvent( - contactIDFromPublicKey(&m.identity.PublicKey), - clock, - ) - event.ChatID = chat.ID - err = event.Sign(m.identity) - if err != nil { - return nil, err - } - - err = group.ProcessEvent(event) - if err != nil { - return nil, err - } - - recipients, err := stringSliceToPublicKeys(group.Members(), true) - if err != nil { - return nil, err - } - - encodedMessage, err := m.processor.EncodeMembershipUpdate(group, nil) - if err != nil { - return nil, err - } - _, err = m.dispatchMessage(ctx, &RawMessage{ - LocalChatID: chat.ID, - Payload: encodedMessage, - MessageType: protobuf.ApplicationMetadataMessage_MEMBERSHIP_UPDATE_MESSAGE, - Recipients: recipients, - ResendAutomatically: true, - }) - if err != nil { - return nil, err - } - - chat.updateChatFromProtocolGroup(group) - chat.Active = false - - response.Chats = []*Chat{chat} - response.Messages = buildSystemMessages([]v1protocol.MembershipUpdateEvent{event}, m.systemMessagesTranslations) - err = m.persistence.SaveMessagesLegacy(response.Messages) - if err != nil { - return nil, err - } - - return &response, m.saveChat(chat) -} - -func (m *Messenger) saveChat(chat *Chat) error { - _, ok := m.allChats[chat.ID] - // Sync chat if it's a new active public chat - if !ok && chat.Active && chat.Public() { - if err := m.syncPublicChat(context.Background(), chat); err != nil { - return err - } - } - - err := m.persistence.SaveChat(*chat) - if err != nil { - return err - } - m.allChats[chat.ID] = chat - - return nil -} - -func (m *Messenger) saveChats(chats []*Chat) error { - err := m.persistence.SaveChats(chats) - if err != nil { - return err - } - for _, chat := range chats { - m.allChats[chat.ID] = chat - } - - return nil - -} - -func (m *Messenger) SaveChat(chat *Chat) error { - m.mutex.Lock() - defer m.mutex.Unlock() - return m.saveChat(chat) -} - -func (m *Messenger) Chats() []*Chat { - m.mutex.Lock() - defer m.mutex.Unlock() - - var chats []*Chat - - for _, c := range m.allChats { - chats = append(chats, c) - } - - return chats -} - -func (m *Messenger) DeleteChat(chatID string) error { - m.mutex.Lock() - defer m.mutex.Unlock() - - err := m.persistence.DeleteChat(chatID) - if err != nil { - return err - } - delete(m.allChats, chatID) - - return nil -} - -func (m *Messenger) isNewContact(contact *Contact) bool { - previousContact, ok := m.allContacts[contact.ID] - return contact.IsAdded() && (!ok || !previousContact.IsAdded()) -} - -func (m *Messenger) saveContact(contact *Contact) error { - identicon, err := identicon.GenerateBase64(contact.ID) - if err != nil { - return err - } - - contact.Identicon = identicon - - name, err := alias.GenerateFromPublicKeyString(contact.ID) - if err != nil { - return err - } - - contact.Alias = name - - if m.isNewContact(contact) { - err := m.syncContact(context.Background(), contact) - if err != nil { - return err - } - } - - err = m.persistence.SaveContact(contact, nil) - if err != nil { - return err - } - - m.allContacts[contact.ID] = contact - return nil - -} -func (m *Messenger) SaveContact(contact *Contact) error { - m.mutex.Lock() - defer m.mutex.Unlock() - return m.saveContact(contact) -} - -func (m *Messenger) BlockContact(contact *Contact) ([]*Chat, error) { - m.mutex.Lock() - defer m.mutex.Unlock() - chats, err := m.persistence.BlockContact(contact) - if err != nil { - return nil, err - } - m.allContacts[contact.ID] = contact - for _, chat := range chats { - m.allChats[chat.ID] = chat - } - delete(m.allChats, contact.ID) - return chats, nil -} - -func (m *Messenger) Contacts() []*Contact { - m.mutex.Lock() - defer m.mutex.Unlock() - var contacts []*Contact - for _, contact := range m.allContacts { - contacts = append(contacts, contact) - } - - return contacts -} - -// ReSendChatMessage pulls a message from the database and sends it again -func (m *Messenger) ReSendChatMessage(ctx context.Context, messageID string) error { - m.mutex.Lock() - defer m.mutex.Unlock() - - message, err := m.persistence.RawMessageByID(messageID) - if err != nil { - return err - } - - chat, ok := m.allChats[message.LocalChatID] - if !ok { - return errors.New("chat not found") - } - - _, err = m.dispatchMessage(ctx, &RawMessage{ - LocalChatID: chat.ID, - Payload: message.Payload, - MessageType: message.MessageType, - Recipients: message.Recipients, - }) - return err -} - -func (m *Messenger) hasPairedDevices() bool { - var count int - for _, i := range m.allInstallations { - if i.Enabled { - count += 1 - } - } - return count > 1 -} - -// sendToPairedDevices will check if we have any paired devices and send to them if necessary -func (m *Messenger) sendToPairedDevices(ctx context.Context, payload []byte, messageType protobuf.ApplicationMetadataMessage_Type) error { - hasPairedDevices := m.hasPairedDevices() - // We send a message to any paired device - if hasPairedDevices { - _, err := m.processor.SendPrivateRaw(ctx, &m.identity.PublicKey, payload, messageType) - if err != nil { - return err - } - } - return nil -} - -func (m *Messenger) dispatchPairInstallationMessage(ctx context.Context, spec *RawMessage) ([]byte, error) { - var err error - var id []byte - - id, err = m.processor.SendPairInstallation(ctx, &m.identity.PublicKey, spec.Payload, spec.MessageType) - - if err != nil { - return nil, err - } - spec.ID = types.EncodeHex(id) - spec.SendCount += 1 - err = m.persistence.SaveRawMessage(spec) - if err != nil { - return nil, err - } - - return id, nil -} - -func (m *Messenger) dispatchMessage(ctx context.Context, spec *RawMessage) ([]byte, error) { - var err error - var id []byte - logger := m.logger.With(zap.String("site", "dispatchMessage"), zap.String("chatID", spec.LocalChatID)) - chat, ok := m.allChats[spec.LocalChatID] - if !ok { - return nil, errors.New("no chat found") - } - - switch chat.ChatType { - case ChatTypeOneToOne: - publicKey, err := chat.PublicKey() - if err != nil { - return nil, err - } - if !isPubKeyEqual(publicKey, &m.identity.PublicKey) { - id, err = m.processor.SendPrivateRaw(ctx, publicKey, spec.Payload, spec.MessageType) - - if err != nil { - return nil, err - } - } - - err = m.sendToPairedDevices(ctx, spec.Payload, spec.MessageType) - - if err != nil { - return nil, err - } - - case ChatTypePublic: - logger.Debug("sending public message", zap.String("chatName", chat.Name)) - id, err = m.processor.SendPublicRaw(ctx, chat.ID, spec.Payload, spec.MessageType) - if err != nil { - return nil, err - } - - case ChatTypePrivateGroupChat: - logger.Debug("sending group message", zap.String("chatName", chat.Name)) - if spec.Recipients == nil { - spec.Recipients, err = chat.MembersAsPublicKeys() - if err != nil { - return nil, err - } - } - hasPairedDevices := m.hasPairedDevices() - - if !hasPairedDevices { - // Filter out my key from the recipients - n := 0 - for _, recipient := range spec.Recipients { - if !isPubKeyEqual(recipient, &m.identity.PublicKey) { - spec.Recipients[n] = recipient - n++ - } - } - spec.Recipients = spec.Recipients[:n] - } - - // We always wrap in group information - id, err = m.processor.SendGroupRaw(ctx, spec.Recipients, spec.Payload, protobuf.ApplicationMetadataMessage_MEMBERSHIP_UPDATE_MESSAGE) - if err != nil { - return nil, err - } - - default: - return nil, errors.New("chat type not supported") - } - spec.ID = types.EncodeHex(id) - spec.SendCount += 1 - err = m.persistence.SaveRawMessage(spec) - if err != nil { - return nil, err - } - - return id, nil -} - -// SendChatMessage takes a minimal message and sends it based on the corresponding chat -func (m *Messenger) SendChatMessage(ctx context.Context, message *Message) (*MessengerResponse, error) { - m.mutex.Lock() - defer m.mutex.Unlock() - - logger := m.logger.With(zap.String("site", "Send"), zap.String("chatID", message.ChatId)) - var response MessengerResponse - - // A valid added chat is required. - chat, ok := m.allChats[message.ChatId] - if !ok { - return nil, errors.New("Chat not found") - } - - err := extendMessageFromChat(message, chat, &m.identity.PublicKey, m.getTimesource()) - if err != nil { - return nil, err - } - - var encodedMessage []byte - switch chat.ChatType { - case ChatTypeOneToOne: - logger.Debug("sending private message") - message.MessageType = protobuf.ChatMessage_ONE_TO_ONE - encodedMessage, err = proto.Marshal(message) - if err != nil { - return nil, err - } - case ChatTypePublic: - logger.Debug("sending public message", zap.String("chatName", chat.Name)) - message.MessageType = protobuf.ChatMessage_PUBLIC_GROUP - encodedMessage, err = proto.Marshal(message) - if err != nil { - return nil, err - } - case ChatTypePrivateGroupChat: - message.MessageType = protobuf.ChatMessage_PRIVATE_GROUP - logger.Debug("sending group message", zap.String("chatName", chat.Name)) - - group, err := newProtocolGroupFromChat(chat) - if err != nil { - return nil, err - } - - encodedMessage, err = m.processor.EncodeMembershipUpdate(group, &message.ChatMessage) - if err != nil { - return nil, err - } - - default: - return nil, errors.New("chat type not supported") - } - - id, err := m.dispatchMessage(ctx, &RawMessage{ - LocalChatID: chat.ID, - Payload: encodedMessage, - MessageType: protobuf.ApplicationMetadataMessage_CHAT_MESSAGE, - }) - if err != nil { - return nil, err - } - - message.ID = types.EncodeHex(id) - err = message.PrepareContent() - if err != nil { - return nil, err - } - - err = chat.UpdateFromMessage(message, m.getTimesource()) - if err != nil { - return nil, err - } - - err = m.persistence.SaveMessagesLegacy([]*Message{message}) - if err != nil { - return nil, err - } - - response.Chats = []*Chat{chat} - response.Messages = []*Message{message} - return &response, m.saveChat(chat) -} - -// Send contact updates to all contacts added by us -func (m *Messenger) SendContactUpdates(ctx context.Context, ensName, profileImage string) error { - m.mutex.Lock() - defer m.mutex.Unlock() - - myID := contactIDFromPublicKey(&m.identity.PublicKey) - - if _, err := m.sendContactUpdate(ctx, myID, ensName, profileImage); err != nil { - return err - } - - // TODO: This should not be sending paired messages, as we do it above - for _, contact := range m.allContacts { - if contact.IsAdded() { - if _, err := m.sendContactUpdate(ctx, contact.ID, ensName, profileImage); err != nil { - return err - } - } - } - return nil -} - -// SendContactUpdate sends a contact update to a user and adds the user to contacts -func (m *Messenger) SendContactUpdate(ctx context.Context, chatID, ensName, profileImage string) (*MessengerResponse, error) { - m.mutex.Lock() - defer m.mutex.Unlock() - return m.sendContactUpdate(ctx, chatID, ensName, profileImage) -} - -func (m *Messenger) sendContactUpdate(ctx context.Context, chatID, ensName, profileImage string) (*MessengerResponse, error) { - var response MessengerResponse - - contact, ok := m.allContacts[chatID] - if !ok { - pubkeyBytes, err := types.DecodeHex(chatID) - if err != nil { - return nil, err - } - - publicKey, err := crypto.UnmarshalPubkey(pubkeyBytes) - if err != nil { - return nil, err - } - - contact, err = buildContact(publicKey) - if err != nil { - return nil, err - } - } - - chat, ok := m.allChats[chatID] - 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[chat.ID] = chat - clock, _ := chat.NextClockAndTimestamp(m.getTimesource()) - - contactUpdate := &protobuf.ContactUpdate{ - Clock: clock, - EnsName: ensName, - ProfileImage: profileImage} - encodedMessage, err := proto.Marshal(contactUpdate) - if err != nil { - return nil, err - } - - _, err = m.dispatchMessage(ctx, &RawMessage{ - LocalChatID: chatID, - Payload: encodedMessage, - MessageType: protobuf.ApplicationMetadataMessage_CONTACT_UPDATE, - ResendAutomatically: true, - }) - if err != nil { - return nil, err - } - - if !contact.IsAdded() && contact.ID != contactIDFromPublicKey(&m.identity.PublicKey) { - contact.SystemTags = append(contact.SystemTags, contactAdded) - } - - response.Contacts = []*Contact{contact} - response.Chats = []*Chat{chat} - - chat.LastClockValue = clock - err = m.saveChat(chat) - if err != nil { - return nil, err - } - return &response, m.saveContact(contact) -} - -// SyncDevices sends all public chats and contacts to paired devices -func (m *Messenger) SyncDevices(ctx context.Context, ensName, photoPath string) error { - m.mutex.Lock() - defer m.mutex.Unlock() - - myID := contactIDFromPublicKey(&m.identity.PublicKey) - - if _, err := m.sendContactUpdate(ctx, myID, ensName, photoPath); err != nil { - return err - } - - for _, chat := range m.allChats { - if chat.Public() && chat.Active { - if err := m.syncPublicChat(ctx, chat); err != nil { - return err - } - } - } - - for _, contact := range m.allContacts { - if contact.IsAdded() && contact.ID != myID { - if err := m.syncContact(ctx, contact); err != nil { - return err - } - } - } - - return nil -} - -// SendPairInstallation sends a pair installation message -func (m *Messenger) SendPairInstallation(ctx context.Context) (*MessengerResponse, error) { - m.mutex.Lock() - defer m.mutex.Unlock() - - var err error - var response MessengerResponse - - installation, ok := m.allInstallations[m.installationID] - if !ok { - return nil, errors.New("no installation found") - } - - if installation.InstallationMetadata == nil { - return nil, errors.New("no installation metadata") - } - - chatID := contactIDFromPublicKey(&m.identity.PublicKey) - - chat, ok := m.allChats[chatID] - if !ok { - chat = OneToOneFromPublicKey(&m.identity.PublicKey, m.getTimesource()) - // We don't want to show the chat to the user - chat.Active = false - } - - m.allChats[chat.ID] = chat - clock, _ := chat.NextClockAndTimestamp(m.getTimesource()) - - pairMessage := &protobuf.PairInstallation{ - Clock: clock, - Name: installation.InstallationMetadata.Name, - InstallationId: installation.ID, - DeviceType: installation.InstallationMetadata.DeviceType} - encodedMessage, err := proto.Marshal(pairMessage) - if err != nil { - return nil, err - } - - _, err = m.dispatchPairInstallationMessage(ctx, &RawMessage{ - LocalChatID: chatID, - Payload: encodedMessage, - MessageType: protobuf.ApplicationMetadataMessage_PAIR_INSTALLATION, - ResendAutomatically: true, - }) - if err != nil { - return nil, err - } - - response.Chats = []*Chat{chat} - - chat.LastClockValue = clock - err = m.saveChat(chat) - if err != nil { - return nil, err - } - return &response, nil -} - -// syncPublicChat sync a public chat with paired devices -func (m *Messenger) syncPublicChat(ctx context.Context, publicChat *Chat) error { - var err error - if !m.hasPairedDevices() { - return nil - } - chatID := contactIDFromPublicKey(&m.identity.PublicKey) - - chat, ok := m.allChats[chatID] - if !ok { - chat = OneToOneFromPublicKey(&m.identity.PublicKey, m.getTimesource()) - // We don't want to show the chat to the user - chat.Active = false - } - - m.allChats[chat.ID] = chat - clock, _ := chat.NextClockAndTimestamp(m.getTimesource()) - - syncMessage := &protobuf.SyncInstallationPublicChat{ - Clock: clock, - Id: publicChat.ID, - } - encodedMessage, err := proto.Marshal(syncMessage) - if err != nil { - return err - } - - _, err = m.dispatchMessage(ctx, &RawMessage{ - LocalChatID: chatID, - Payload: encodedMessage, - MessageType: protobuf.ApplicationMetadataMessage_SYNC_INSTALLATION_PUBLIC_CHAT, - ResendAutomatically: true, - }) - if err != nil { - return err - } - - chat.LastClockValue = clock - return m.saveChat(chat) -} - -// syncContact sync as contact with paired devices -func (m *Messenger) syncContact(ctx context.Context, contact *Contact) error { - var err error - if !m.hasPairedDevices() { - return nil - } - chatID := contactIDFromPublicKey(&m.identity.PublicKey) - - chat, ok := m.allChats[chatID] - if !ok { - chat = OneToOneFromPublicKey(&m.identity.PublicKey, m.getTimesource()) - // We don't want to show the chat to the user - chat.Active = false - } - - m.allChats[chat.ID] = chat - clock, _ := chat.NextClockAndTimestamp(m.getTimesource()) - - syncMessage := &protobuf.SyncInstallationContact{ - Clock: clock, - Id: contact.ID, - EnsName: contact.Name, - ProfileImage: contact.Photo, - } - encodedMessage, err := proto.Marshal(syncMessage) - if err != nil { - return err - } - - _, err = m.dispatchMessage(ctx, &RawMessage{ - LocalChatID: chatID, - Payload: encodedMessage, - MessageType: protobuf.ApplicationMetadataMessage_SYNC_INSTALLATION_CONTACT, - ResendAutomatically: true, - }) - if err != nil { - return err - } - - chat.LastClockValue = clock - return m.saveChat(chat) -} - -// SendRaw takes encoded data, encrypts it and sends through the wire. -// DEPRECATED -func (m *Messenger) SendRaw(ctx context.Context, chat Chat, data []byte) ([]byte, error) { - publicKey, err := chat.PublicKey() - if err != nil { - return nil, err - } - if publicKey != nil { - return m.processor.SendPrivateRaw(ctx, publicKey, data, protobuf.ApplicationMetadataMessage_UNKNOWN) - } else if chat.Name != "" { - return m.processor.SendPublicRaw(ctx, chat.Name, data, protobuf.ApplicationMetadataMessage_UNKNOWN) - } - return nil, errors.New("chat is neither public nor private") -} - -// RetrieveAll retrieves messages from all filters, processes them and returns a -// MessengerResponse to the client -func (m *Messenger) RetrieveAll() (*MessengerResponse, error) { - chatWithMessages, err := m.transport.RetrieveRawAll() - if err != nil { - return nil, err - } - - return m.handleRetrievedMessages(chatWithMessages) -} - -type CurrentMessageState struct { - // Message is the protobuf message received - Message protobuf.ChatMessage - // MessageID is the ID of the message - MessageID string - // WhisperTimestamp is the whisper timestamp of the message - WhisperTimestamp uint64 - // Contact is the contact associated with the author of the message - Contact *Contact - // PublicKey is the public key of the author of the message - PublicKey *ecdsa.PublicKey -} - -type ReceivedMessageState struct { - // State on the message being processed - CurrentMessageState *CurrentMessageState - // AllChats in memory - AllChats map[string]*Chat - // List of chats modified - ModifiedChats map[string]bool - // All contacts in memory - AllContacts map[string]*Contact - // List of contacs modified - ModifiedContacts map[string]bool - // All installations in memory - AllInstallations map[string]*multidevice.Installation - // List of installations modified - ModifiedInstallations map[string]bool - // Map of existing messages - ExistingMessagesMap map[string]bool - // Response to the client - Response *MessengerResponse - // Timesource is a time source for clock values/timestamps. - Timesource TimeSource -} - -func (m *Messenger) handleRetrievedMessages(chatWithMessages map[transport.Filter][]*types.Message) (*MessengerResponse, error) { - m.mutex.Lock() - defer m.mutex.Unlock() - messageState := &ReceivedMessageState{ - AllChats: m.allChats, - ModifiedChats: make(map[string]bool), - AllContacts: m.allContacts, - ModifiedContacts: make(map[string]bool), - AllInstallations: m.allInstallations, - ModifiedInstallations: m.modifiedInstallations, - ExistingMessagesMap: make(map[string]bool), - Response: &MessengerResponse{}, - Timesource: m.getTimesource(), - } - - logger := m.logger.With(zap.String("site", "RetrieveAll")) - rawMessages := make(map[transport.Filter][]*v1protocol.StatusMessage) - - for chat, messages := range chatWithMessages { - for _, shhMessage := range messages { - // TODO: fix this to use an exported method. - statusMessages, err := m.processor.handleMessages(shhMessage, true) - if err != nil { - logger.Info("failed to decode messages", zap.Error(err)) - continue - } - - for _, msg := range statusMessages { - publicKey := msg.SigPubKey() - - // Check for messages from blocked users - senderID := contactIDFromPublicKey(publicKey) - if _, ok := messageState.AllContacts[senderID]; ok && messageState.AllContacts[senderID].IsBlocked() { - continue - } - // Don't process duplicates - messageID := types.EncodeHex(msg.ID) - exists, err := m.handler.messageExists(messageID, messageState.ExistingMessagesMap) - if err != nil { - logger.Warn("failed to check message exists", zap.Error(err)) - } - if exists { - continue - } - - var contact *Contact - if c, ok := messageState.AllContacts[senderID]; ok { - contact = c - } else { - c, err := buildContact(publicKey) - if err != nil { - logger.Info("failed to build contact", zap.Error(err)) - continue - } - contact = c - messageState.AllContacts[senderID] = c - messageState.ModifiedContacts[contact.ID] = true - } - messageState.CurrentMessageState = &CurrentMessageState{ - MessageID: messageID, - WhisperTimestamp: uint64(msg.TransportMessage.Timestamp) * 1000, - Contact: contact, - PublicKey: publicKey, - } - - if msg.ParsedMessage != nil { - logger.Debug("Handling parsed message") - switch msg.ParsedMessage.(type) { - case protobuf.MembershipUpdateMessage: - logger.Debug("Handling MembershipUpdateMessage") - - rawMembershipUpdate := msg.ParsedMessage.(protobuf.MembershipUpdateMessage) - - err = m.handler.HandleMembershipUpdate(messageState, messageState.AllChats[rawMembershipUpdate.ChatId], rawMembershipUpdate, m.systemMessagesTranslations) - if err != nil { - logger.Warn("failed to handle MembershipUpdate", zap.Error(err)) - continue - } - - case protobuf.ChatMessage: - logger.Debug("Handling ChatMessage") - messageState.CurrentMessageState.Message = msg.ParsedMessage.(protobuf.ChatMessage) - err = m.handler.HandleChatMessage(messageState) - if err != nil { - logger.Warn("failed to handle ChatMessage", zap.Error(err)) - continue - } - case protobuf.PairInstallation: - if !isPubKeyEqual(messageState.CurrentMessageState.PublicKey, &m.identity.PublicKey) { - logger.Warn("not coming from us, ignoring") - continue - } - p := msg.ParsedMessage.(protobuf.PairInstallation) - logger.Debug("Handling PairInstallation", zap.Any("message", p)) - err = m.handler.HandlePairInstallation(messageState, p) - if err != nil { - logger.Warn("failed to handle PairInstallation", zap.Error(err)) - continue - } - - case protobuf.SyncInstallationContact: - if !isPubKeyEqual(messageState.CurrentMessageState.PublicKey, &m.identity.PublicKey) { - logger.Warn("not coming from us, ignoring") - continue - } - - p := msg.ParsedMessage.(protobuf.SyncInstallationContact) - logger.Debug("Handling SyncInstallationContact", zap.Any("message", p)) - err = m.handler.HandleSyncInstallationContact(messageState, p) - if err != nil { - logger.Warn("failed to handle SyncInstallationContact", zap.Error(err)) - continue - } - case protobuf.SyncInstallationPublicChat: - if !isPubKeyEqual(messageState.CurrentMessageState.PublicKey, &m.identity.PublicKey) { - logger.Warn("not coming from us, ignoring") - continue - } - - p := msg.ParsedMessage.(protobuf.SyncInstallationPublicChat) - logger.Debug("Handling SyncInstallationPublicChat", zap.Any("message", p)) - err = m.handler.HandleSyncInstallationPublicChat(messageState, p) - if err != nil { - logger.Warn("failed to handle SyncInstallationPublicChat", zap.Error(err)) - continue - } - case protobuf.RequestAddressForTransaction: - command := msg.ParsedMessage.(protobuf.RequestAddressForTransaction) - logger.Debug("Handling RequestAddressForTransaction", zap.Any("message", command)) - err = m.handler.HandleRequestAddressForTransaction(messageState, command) - if err != nil { - logger.Warn("failed to handle RequestAddressForTransaction", zap.Error(err)) - continue - } - case protobuf.SendTransaction: - command := msg.ParsedMessage.(protobuf.SendTransaction) - logger.Debug("Handling SendTransaction", zap.Any("message", command)) - err = m.handler.HandleSendTransaction(messageState, command) - if err != nil { - logger.Warn("failed to handle SendTransaction", zap.Error(err)) - continue - } - case protobuf.AcceptRequestAddressForTransaction: - command := msg.ParsedMessage.(protobuf.AcceptRequestAddressForTransaction) - logger.Debug("Handling AcceptRequestAddressForTransaction") - err = m.handler.HandleAcceptRequestAddressForTransaction(messageState, command) - if err != nil { - logger.Warn("failed to handle AcceptRequestAddressForTransaction", zap.Error(err)) - continue - } - - case protobuf.DeclineRequestAddressForTransaction: - command := msg.ParsedMessage.(protobuf.DeclineRequestAddressForTransaction) - logger.Debug("Handling DeclineRequestAddressForTransaction") - err = m.handler.HandleDeclineRequestAddressForTransaction(messageState, command) - if err != nil { - logger.Warn("failed to handle DeclineRequestAddressForTransaction", zap.Error(err)) - continue - } - - case protobuf.DeclineRequestTransaction: - command := msg.ParsedMessage.(protobuf.DeclineRequestTransaction) - logger.Debug("Handling DeclineRequestTransaction") - err = m.handler.HandleDeclineRequestTransaction(messageState, command) - if err != nil { - logger.Warn("failed to handle DeclineRequestTransaction", zap.Error(err)) - continue - } - - case protobuf.RequestTransaction: - command := msg.ParsedMessage.(protobuf.RequestTransaction) - logger.Debug("Handling RequestTransaction") - err = m.handler.HandleRequestTransaction(messageState, command) - if err != nil { - logger.Warn("failed to handle RequestTransaction", zap.Error(err)) - continue - } - case protobuf.ContactUpdate: - logger.Debug("Handling ContactUpdate") - - contactUpdate := msg.ParsedMessage.(protobuf.ContactUpdate) - - err = m.handler.HandleContactUpdate(messageState, contactUpdate) - if err != nil { - logger.Warn("failed to handle ContactUpdate", zap.Error(err)) - continue - } - - default: - // RawMessage, not processed here, pass straight to the client - rawMessages[chat] = append(rawMessages[chat], msg) - - } - } else { - logger.Debug("Adding raw message", zap.Any("msg", msg)) - rawMessages[chat] = append(rawMessages[chat], msg) - } - } - } - } - - for id := range messageState.ModifiedChats { - messageState.Response.Chats = append(messageState.Response.Chats, messageState.AllChats[id]) - } - - for id := range messageState.ModifiedContacts { - messageState.Response.Contacts = append(messageState.Response.Contacts, messageState.AllContacts[id]) - } - - for id, _ := range messageState.ModifiedInstallations { - installation := messageState.AllInstallations[id] - messageState.Response.Installations = append(messageState.Response.Installations, installation) - if installation.InstallationMetadata != nil { - err := m.setInstallationMetadata(id, installation.InstallationMetadata) - if err != nil { - return nil, err - } - } - } - - var err error - if len(messageState.Response.Chats) > 0 { - err = m.saveChats(messageState.Response.Chats) - if err != nil { - return nil, err - } - } - if len(messageState.Response.Messages) > 0 { - err = m.SaveMessages(messageState.Response.Messages) - if err != nil { - return nil, err - } - } - - if len(messageState.Response.Contacts) > 0 { - err = m.persistence.SaveContacts(messageState.Response.Contacts) - if err != nil { - return nil, err - } - } - - for filter, messages := range rawMessages { - messageState.Response.RawMessages = append(messageState.Response.RawMessages, &RawResponse{Filter: &filter, Messages: messages}) - } - - // Reset installations - m.modifiedInstallations = make(map[string]bool) - - return messageState.Response, nil -} - -func (m *Messenger) RequestHistoricMessages( - ctx context.Context, - peer []byte, // should be removed after mailserver logic is ported - from, to uint32, - cursor []byte, -) ([]byte, error) { - return m.transport.SendMessagesRequest(ctx, peer, from, to, cursor) -} - -// DEPRECATED -func (m *Messenger) LoadFilters(filters []*transport.Filter) ([]*transport.Filter, error) { - return m.transport.LoadFilters(filters) -} - -// DEPRECATED -func (m *Messenger) RemoveFilters(filters []*transport.Filter) error { - return m.transport.RemoveFilters(filters) -} - -// DEPRECATED -func (m *Messenger) ConfirmMessagesProcessed(messageIDs [][]byte) error { - for _, id := range messageIDs { - if err := m.encryptor.ConfirmMessageProcessed(id); err != nil { - return err - } - } - return nil -} - -// DEPRECATED: required by status-react. -func (m *Messenger) MessageByID(id string) (*Message, error) { - return m.persistence.MessageByID(id) -} - -// DEPRECATED: required by status-react. -func (m *Messenger) MessagesExist(ids []string) (map[string]bool, error) { - return m.persistence.MessagesExist(ids) -} - -// DEPRECATED: required by status-react. -func (m *Messenger) MessageByChatID(chatID, cursor string, limit int) ([]*Message, string, error) { - return m.persistence.MessageByChatID(chatID, cursor, limit) -} - -// DEPRECATED: required by status-react. -func (m *Messenger) SaveMessages(messages []*Message) error { - return m.persistence.SaveMessagesLegacy(messages) -} - -// DEPRECATED: required by status-react. -func (m *Messenger) DeleteMessage(id string) error { - return m.persistence.DeleteMessage(id) -} - -// DEPRECATED: required by status-react. -func (m *Messenger) DeleteMessagesByChatID(id string) error { - return m.persistence.DeleteMessagesByChatID(id) -} - -// DEPRECATED: required by status-react. -func (m *Messenger) MarkMessagesSeen(chatID string, ids []string) error { - m.mutex.Lock() - defer m.mutex.Unlock() - - err := m.persistence.MarkMessagesSeen(chatID, ids) - if err != nil { - return err - } - chat, err := m.persistence.Chat(chatID) - if err != nil { - return err - } - m.allChats[chatID] = chat - return nil -} - -// DEPRECATED: required by status-react. -func (m *Messenger) UpdateMessageOutgoingStatus(id, newOutgoingStatus string) error { - return m.persistence.UpdateMessageOutgoingStatus(id, newOutgoingStatus) -} - -// Identicon returns an identicon based on the input string -func Identicon(id string) (string, error) { - return identicon.GenerateBase64(id) -} - -// VerifyENSNames verifies that a registered ENS name matches the expected public key -func (m *Messenger) VerifyENSNames(ctx context.Context, rpcEndpoint, contractAddress string) (*MessengerResponse, error) { - m.mutex.Lock() - defer m.mutex.Unlock() - - m.logger.Debug("verifying ENS Names", zap.String("endpoint", rpcEndpoint)) - verifier := m.node.NewENSVerifier(m.logger) - - var response MessengerResponse - - var ensDetails []enstypes.ENSDetails - - now := m.getTimesource().GetCurrentTime() - for _, contact := range m.allContacts { - if shouldENSBeVerified(contact, now) { - ensDetails = append(ensDetails, enstypes.ENSDetails{ - PublicKeyString: contact.ID[2:], - Name: contact.Name, - }) - } - } - - ensResponse, err := verifier.CheckBatch(ensDetails, rpcEndpoint, contractAddress) - if err != nil { - return nil, err - } - - for _, details := range ensResponse { - contact, ok := m.allContacts["0x"+details.PublicKeyString] - if !ok { - return nil, errors.New("contact must be existing") - } - - m.logger.Debug("verifying ENS Name", zap.Any("details", details), zap.Any("contact", contact)) - - contact.ENSVerifiedAt = uint64(details.VerifiedAt) - - if details.Error == nil { - contact.ENSVerified = details.Verified - m.allContacts[contact.ID] = contact - } else { - m.logger.Warn("Failed to resolve ens name", - zap.String("name", details.Name), - zap.String("publicKey", details.PublicKeyString), - zap.Error(details.Error), - ) - } - response.Contacts = append(response.Contacts, contact) - } - - if len(response.Contacts) != 0 { - err = m.persistence.SaveContacts(response.Contacts) - if err != nil { - return nil, err - } - } - - return &response, nil -} - -// GenerateAlias name returns the generated name given a public key hex encoded prefixed with 0x -func GenerateAlias(id string) (string, error) { - return alias.GenerateFromPublicKeyString(id) -} - -func (m *Messenger) RequestTransaction(ctx context.Context, chatID, value, contract, address string) (*MessengerResponse, error) { - m.mutex.Lock() - defer m.mutex.Unlock() - - var response MessengerResponse - - // A valid added chat is required. - chat, ok := m.allChats[chatID] - if !ok { - return nil, errors.New("Chat not found") - } - if chat.ChatType != ChatTypeOneToOne { - return nil, errors.New("Need to be a one-to-one chat") - } - - message := &Message{} - err := extendMessageFromChat(message, chat, &m.identity.PublicKey, m.transport) - if err != nil { - return nil, err - } - - message.MessageType = protobuf.ChatMessage_ONE_TO_ONE - message.ContentType = protobuf.ChatMessage_TRANSACTION_COMMAND - message.Text = "Request transaction" - - request := &protobuf.RequestTransaction{ - Clock: message.Clock, - Address: address, - Value: value, - Contract: contract, - } - encodedMessage, err := proto.Marshal(request) - if err != nil { - return nil, err - } - id, err := m.dispatchMessage(ctx, &RawMessage{ - LocalChatID: chat.ID, - Payload: encodedMessage, - MessageType: protobuf.ApplicationMetadataMessage_REQUEST_TRANSACTION, - ResendAutomatically: true, - }) - - message.CommandParameters = &CommandParameters{ - ID: types.EncodeHex(id), - Value: value, - Address: address, - Contract: contract, - CommandState: CommandStateRequestTransaction, - } - - if err != nil { - return nil, err - } - messageID := types.EncodeHex(id) - - message.ID = messageID - message.CommandParameters.ID = messageID - err = message.PrepareContent() - if err != nil { - return nil, err - } - - err = chat.UpdateFromMessage(message, m.transport) - if err != nil { - return nil, err - } - - err = m.persistence.SaveMessagesLegacy([]*Message{message}) - if err != nil { - return nil, err - } - - response.Chats = []*Chat{chat} - response.Messages = []*Message{message} - return &response, m.saveChat(chat) -} - -func (m *Messenger) RequestAddressForTransaction(ctx context.Context, chatID, from, value, contract string) (*MessengerResponse, error) { - m.mutex.Lock() - defer m.mutex.Unlock() - - var response MessengerResponse - - // A valid added chat is required. - chat, ok := m.allChats[chatID] - if !ok { - return nil, errors.New("Chat not found") - } - if chat.ChatType != ChatTypeOneToOne { - return nil, errors.New("Need to be a one-to-one chat") - } - - message := &Message{} - err := extendMessageFromChat(message, chat, &m.identity.PublicKey, m.transport) - if err != nil { - return nil, err - } - - message.MessageType = protobuf.ChatMessage_ONE_TO_ONE - message.ContentType = protobuf.ChatMessage_TRANSACTION_COMMAND - message.Text = "Request address for transaction" - - request := &protobuf.RequestAddressForTransaction{ - Clock: message.Clock, - Value: value, - Contract: contract, - } - encodedMessage, err := proto.Marshal(request) - if err != nil { - return nil, err - } - id, err := m.dispatchMessage(ctx, &RawMessage{ - LocalChatID: chat.ID, - Payload: encodedMessage, - MessageType: protobuf.ApplicationMetadataMessage_REQUEST_ADDRESS_FOR_TRANSACTION, - ResendAutomatically: true, - }) - - message.CommandParameters = &CommandParameters{ - ID: types.EncodeHex(id), - From: from, - Value: value, - Contract: contract, - CommandState: CommandStateRequestAddressForTransaction, - } - - if err != nil { - return nil, err - } - messageID := types.EncodeHex(id) - - message.ID = messageID - message.CommandParameters.ID = messageID - err = message.PrepareContent() - if err != nil { - return nil, err - } - - err = chat.UpdateFromMessage(message, m.transport) - if err != nil { - return nil, err - } - - err = m.persistence.SaveMessagesLegacy([]*Message{message}) - if err != nil { - return nil, err - } - - response.Chats = []*Chat{chat} - response.Messages = []*Message{message} - return &response, m.saveChat(chat) -} - -func (m *Messenger) AcceptRequestAddressForTransaction(ctx context.Context, messageID, address string) (*MessengerResponse, error) { - m.mutex.Lock() - defer m.mutex.Unlock() - - var response MessengerResponse - - message, err := m.MessageByID(messageID) - if err != nil { - return nil, err - } - - if message == nil { - return nil, errors.New("message not found") - } - - chatID := message.LocalChatID - - // A valid added chat is required. - chat, ok := m.allChats[chatID] - if !ok { - return nil, errors.New("Chat not found") - } - if chat.ChatType != ChatTypeOneToOne { - return nil, errors.New("Need to be a one-to-one chat") - } - - clock, timestamp := chat.NextClockAndTimestamp(m.transport) - message.Clock = clock - message.WhisperTimestamp = timestamp - message.Timestamp = timestamp - message.Text = "Request address for transaction accepted" - message.OutgoingStatus = OutgoingStatusSending - - // Hide previous message - previousMessage, err := m.persistence.MessageByCommandID(chatID, messageID) - if err != nil { - return nil, err - } - - if previousMessage == nil { - return nil, errors.New("No previous message found") - } - - err = m.persistence.HideMessage(previousMessage.ID) - if err != nil { - return nil, err - } - - message.Replace = previousMessage.ID - - request := &protobuf.AcceptRequestAddressForTransaction{ - Clock: message.Clock, - Id: messageID, - Address: address, - } - encodedMessage, err := proto.Marshal(request) - if err != nil { - return nil, err - } - - newMessageID, err := m.dispatchMessage(ctx, &RawMessage{ - LocalChatID: chat.ID, - Payload: encodedMessage, - MessageType: protobuf.ApplicationMetadataMessage_ACCEPT_REQUEST_ADDRESS_FOR_TRANSACTION, - ResendAutomatically: true, - }) - - if err != nil { - return nil, err - } - - message.ID = types.EncodeHex(newMessageID) - message.CommandParameters.Address = address - message.CommandParameters.CommandState = CommandStateRequestAddressForTransactionAccepted - - err = message.PrepareContent() - if err != nil { - return nil, err - } - - err = chat.UpdateFromMessage(message, m.transport) - if err != nil { - return nil, err - } - - err = m.persistence.SaveMessagesLegacy([]*Message{message}) - if err != nil { - return nil, err - } - - response.Chats = []*Chat{chat} - response.Messages = []*Message{message} - return &response, m.saveChat(chat) -} - -func (m *Messenger) DeclineRequestTransaction(ctx context.Context, messageID string) (*MessengerResponse, error) { - m.mutex.Lock() - defer m.mutex.Unlock() - - var response MessengerResponse - - message, err := m.MessageByID(messageID) - if err != nil { - return nil, err - } - - if message == nil { - return nil, errors.New("message not found") - } - - chatID := message.LocalChatID - - // A valid added chat is required. - chat, ok := m.allChats[chatID] - if !ok { - return nil, errors.New("Chat not found") - } - if chat.ChatType != ChatTypeOneToOne { - return nil, errors.New("Need to be a one-to-one chat") - } - - clock, timestamp := chat.NextClockAndTimestamp(m.transport) - message.Clock = clock - message.WhisperTimestamp = timestamp - message.Timestamp = timestamp - message.Text = "Transaction request declined" - message.OutgoingStatus = OutgoingStatusSending - message.Replace = messageID - - err = m.persistence.HideMessage(messageID) - if err != nil { - return nil, err - } - - request := &protobuf.DeclineRequestTransaction{ - Clock: message.Clock, - Id: messageID, - } - encodedMessage, err := proto.Marshal(request) - if err != nil { - return nil, err - } - - newMessageID, err := m.dispatchMessage(ctx, &RawMessage{ - LocalChatID: chat.ID, - Payload: encodedMessage, - MessageType: protobuf.ApplicationMetadataMessage_DECLINE_REQUEST_TRANSACTION, - ResendAutomatically: true, - }) - - if err != nil { - return nil, err - } - - message.ID = types.EncodeHex(newMessageID) - message.CommandParameters.CommandState = CommandStateRequestTransactionDeclined - - err = message.PrepareContent() - if err != nil { - return nil, err - } - - err = chat.UpdateFromMessage(message, m.transport) - if err != nil { - return nil, err - } - - err = m.persistence.SaveMessagesLegacy([]*Message{message}) - if err != nil { - return nil, err - } - - response.Chats = []*Chat{chat} - response.Messages = []*Message{message} - return &response, m.saveChat(chat) -} - -func (m *Messenger) DeclineRequestAddressForTransaction(ctx context.Context, messageID string) (*MessengerResponse, error) { - m.mutex.Lock() - defer m.mutex.Unlock() - - var response MessengerResponse - - message, err := m.MessageByID(messageID) - if err != nil { - return nil, err - } - - if message == nil { - return nil, errors.New("message not found") - } - - chatID := message.LocalChatID - - // A valid added chat is required. - chat, ok := m.allChats[chatID] - if !ok { - return nil, errors.New("Chat not found") - } - if chat.ChatType != ChatTypeOneToOne { - return nil, errors.New("Need to be a one-to-one chat") - } - - clock, timestamp := chat.NextClockAndTimestamp(m.transport) - message.Clock = clock - message.WhisperTimestamp = timestamp - message.Timestamp = timestamp - message.Text = "Request address for transaction declined" - message.OutgoingStatus = OutgoingStatusSending - message.Replace = messageID - - err = m.persistence.HideMessage(messageID) - if err != nil { - return nil, err - } - - request := &protobuf.DeclineRequestAddressForTransaction{ - Clock: message.Clock, - Id: messageID, - } - encodedMessage, err := proto.Marshal(request) - if err != nil { - return nil, err - } - - newMessageID, err := m.dispatchMessage(ctx, &RawMessage{ - LocalChatID: chat.ID, - Payload: encodedMessage, - MessageType: protobuf.ApplicationMetadataMessage_DECLINE_REQUEST_ADDRESS_FOR_TRANSACTION, - ResendAutomatically: true, - }) - - if err != nil { - return nil, err - } - - message.ID = types.EncodeHex(newMessageID) - message.CommandParameters.CommandState = CommandStateRequestAddressForTransactionDeclined - - err = message.PrepareContent() - if err != nil { - return nil, err - } - - err = chat.UpdateFromMessage(message, m.transport) - if err != nil { - return nil, err - } - - err = m.persistence.SaveMessagesLegacy([]*Message{message}) - if err != nil { - return nil, err - } - - response.Chats = []*Chat{chat} - response.Messages = []*Message{message} - return &response, m.saveChat(chat) -} - -func (m *Messenger) AcceptRequestTransaction(ctx context.Context, transactionHash, messageID string, signature []byte) (*MessengerResponse, error) { - m.mutex.Lock() - defer m.mutex.Unlock() - - var response MessengerResponse - - message, err := m.MessageByID(messageID) - if err != nil { - return nil, err - } - - if message == nil { - return nil, errors.New("message not found") - } - - chatID := message.LocalChatID - - // A valid added chat is required. - chat, ok := m.allChats[chatID] - if !ok { - return nil, errors.New("Chat not found") - } - if chat.ChatType != ChatTypeOneToOne { - return nil, errors.New("Need to be a one-to-one chat") - } - - clock, timestamp := chat.NextClockAndTimestamp(m.transport) - message.Clock = clock - message.WhisperTimestamp = timestamp - message.Timestamp = timestamp - message.Text = "Transaction sent" - message.OutgoingStatus = OutgoingStatusSending - - // Hide previous message - previousMessage, err := m.persistence.MessageByCommandID(chatID, messageID) - if err != nil && err != errRecordNotFound { - return nil, err - } - - if previousMessage != nil { - err = m.persistence.HideMessage(previousMessage.ID) - if err != nil { - return nil, err - } - message.Replace = previousMessage.ID - } - - err = m.persistence.HideMessage(messageID) - if err != nil { - return nil, err - } - - request := &protobuf.SendTransaction{ - Clock: message.Clock, - Id: messageID, - TransactionHash: transactionHash, - Signature: signature, - } - encodedMessage, err := proto.Marshal(request) - if err != nil { - return nil, err - } - - newMessageID, err := m.dispatchMessage(ctx, &RawMessage{ - LocalChatID: chat.ID, - Payload: encodedMessage, - MessageType: protobuf.ApplicationMetadataMessage_SEND_TRANSACTION, - ResendAutomatically: true, - }) - - if err != nil { - return nil, err - } - - message.ID = types.EncodeHex(newMessageID) - message.CommandParameters.TransactionHash = transactionHash - message.CommandParameters.Signature = signature - message.CommandParameters.CommandState = CommandStateTransactionSent - - err = message.PrepareContent() - if err != nil { - return nil, err - } - - err = chat.UpdateFromMessage(message, m.transport) - if err != nil { - return nil, err - } - - err = m.persistence.SaveMessagesLegacy([]*Message{message}) - if err != nil { - return nil, err - } - - response.Chats = []*Chat{chat} - response.Messages = []*Message{message} - return &response, m.saveChat(chat) -} - -func (m *Messenger) SendTransaction(ctx context.Context, chatID, value, contract, transactionHash string, signature []byte) (*MessengerResponse, error) { - m.mutex.Lock() - defer m.mutex.Unlock() - - var response MessengerResponse - - // A valid added chat is required. - chat, ok := m.allChats[chatID] - if !ok { - return nil, errors.New("Chat not found") - } - if chat.ChatType != ChatTypeOneToOne { - return nil, errors.New("Need to be a one-to-one chat") - } - - message := &Message{} - err := extendMessageFromChat(message, chat, &m.identity.PublicKey, m.transport) - if err != nil { - return nil, err - } - - message.MessageType = protobuf.ChatMessage_ONE_TO_ONE - message.ContentType = protobuf.ChatMessage_TRANSACTION_COMMAND - message.LocalChatID = chatID - - clock, timestamp := chat.NextClockAndTimestamp(m.transport) - message.Clock = clock - message.WhisperTimestamp = timestamp - message.Timestamp = timestamp - message.Text = "Transaction sent" - - request := &protobuf.SendTransaction{ - Clock: message.Clock, - TransactionHash: transactionHash, - Signature: signature, - } - encodedMessage, err := proto.Marshal(request) - if err != nil { - return nil, err - } - - newMessageID, err := m.dispatchMessage(ctx, &RawMessage{ - LocalChatID: chat.ID, - Payload: encodedMessage, - MessageType: protobuf.ApplicationMetadataMessage_SEND_TRANSACTION, - ResendAutomatically: true, - }) - - if err != nil { - return nil, err - } - - message.ID = types.EncodeHex(newMessageID) - message.CommandParameters = &CommandParameters{ - TransactionHash: transactionHash, - Value: value, - Contract: contract, - Signature: signature, - CommandState: CommandStateTransactionSent, - } - - err = message.PrepareContent() - if err != nil { - return nil, err - } - - err = chat.UpdateFromMessage(message, m.transport) - if err != nil { - return nil, err - } - - err = m.persistence.SaveMessagesLegacy([]*Message{message}) - if err != nil { - return nil, err - } - - response.Chats = []*Chat{chat} - response.Messages = []*Message{message} - return &response, m.saveChat(chat) -} - -func (m *Messenger) ValidateTransactions(ctx context.Context, addresses []types.Address) (*MessengerResponse, error) { - if m.verifyTransactionClient == nil { - return nil, nil - } - m.mutex.Lock() - defer m.mutex.Unlock() - - modifiedChats := make(map[string]bool) - - logger := m.logger.With(zap.String("site", "ValidateTransactions")) - logger.Debug("Validating transactions") - txs, err := m.persistence.TransactionsToValidate() - if err != nil { - logger.Error("Error pulling", zap.Error(err)) - return nil, err - } - logger.Debug("Txs", zap.Int("count", len(txs)), zap.Any("txs", txs)) - var response MessengerResponse - validator := NewTransactionValidator(addresses, m.persistence, m.verifyTransactionClient, m.logger) - responses, err := validator.ValidateTransactions(ctx) - if err != nil { - logger.Error("Error validating", zap.Error(err)) - return nil, err - } - for _, validationResult := range responses { - var message *Message - chatID := contactIDFromPublicKey(validationResult.Transaction.From) - chat, ok := m.allChats[chatID] - if !ok { - chat = OneToOneFromPublicKey(validationResult.Transaction.From, m.transport) - } - if validationResult.Message != nil { - message = validationResult.Message - } else { - message = &Message{} - err := extendMessageFromChat(message, chat, &m.identity.PublicKey, m.transport) - if err != nil { - return nil, err - } - } - - message.MessageType = protobuf.ChatMessage_ONE_TO_ONE - message.ContentType = protobuf.ChatMessage_TRANSACTION_COMMAND - message.LocalChatID = chatID - message.OutgoingStatus = "" - - clock, timestamp := chat.NextClockAndTimestamp(m.transport) - message.Clock = clock - message.Timestamp = timestamp - message.WhisperTimestamp = timestamp - message.Text = "Transaction received" - - message.ID = validationResult.Transaction.MessageID - if message.CommandParameters == nil { - message.CommandParameters = &CommandParameters{} - } else { - message.CommandParameters = validationResult.Message.CommandParameters - } - - message.CommandParameters.Value = validationResult.Value - message.CommandParameters.Contract = validationResult.Contract - message.CommandParameters.Address = validationResult.Address - message.CommandParameters.CommandState = CommandStateTransactionSent - message.CommandParameters.TransactionHash = validationResult.Transaction.TransactionHash - - err = message.PrepareContent() - if err != nil { - return nil, err - } - - err = chat.UpdateFromMessage(message, m.transport) - if err != nil { - return nil, err - } - - if len(message.CommandParameters.ID) != 0 { - // Hide previous message - previousMessage, err := m.persistence.MessageByCommandID(chatID, message.CommandParameters.ID) - if err != nil && err != errRecordNotFound { - return nil, err - } - - if previousMessage != nil { - err = m.persistence.HideMessage(previousMessage.ID) - if err != nil { - return nil, err - } - message.Replace = previousMessage.ID - } - } - - response.Messages = append(response.Messages, message) - m.allChats[chat.ID] = chat - modifiedChats[chat.ID] = true - - } - for id, _ := range modifiedChats { - response.Chats = append(response.Chats, m.allChats[id]) - } - - if len(response.Messages) > 0 { - err = m.SaveMessages(response.Messages) - if err != nil { - return nil, err - } - } - return &response, nil -} - -func (m *Messenger) getTimesource() TimeSource { - return m.transport -} - -func (m *Messenger) Timesource() TimeSource { - return m.getTimesource() -} diff --git a/vendor/github.com/status-im/status-go/protocol/migrations/migrations.go b/vendor/github.com/status-im/status-go/protocol/migrations/migrations.go deleted file mode 100644 index 9e628220e..000000000 --- a/vendor/github.com/status-im/status-go/protocol/migrations/migrations.go +++ /dev/null @@ -1,367 +0,0 @@ -// Code generated by go-bindata. DO NOT EDIT. -// sources: -// 000001_init.down.db.sql (65B) -// 000001_init.up.db.sql (2.719kB) -// 000002_add_last_ens_clock_value.down.sql (0) -// 000002_add_last_ens_clock_value.up.sql (77B) -// doc.go (377B) - -package migrations - -import ( - "bytes" - "compress/gzip" - "crypto/sha256" - "fmt" - "io" - "io/ioutil" - "os" - "path/filepath" - "strings" - "time" -) - -func bindataRead(data []byte, name string) ([]byte, error) { - gz, err := gzip.NewReader(bytes.NewBuffer(data)) - if err != nil { - return nil, fmt.Errorf("read %q: %v", name, err) - } - - var buf bytes.Buffer - _, err = io.Copy(&buf, gz) - clErr := gz.Close() - - if err != nil { - return nil, fmt.Errorf("read %q: %v", name, err) - } - if clErr != nil { - return nil, err - } - - return buf.Bytes(), nil -} - -type asset struct { - bytes []byte - info os.FileInfo - digest [sha256.Size]byte -} - -type bindataFileInfo struct { - name string - size int64 - mode os.FileMode - modTime time.Time -} - -func (fi bindataFileInfo) Name() string { - return fi.name -} -func (fi bindataFileInfo) Size() int64 { - return fi.size -} -func (fi bindataFileInfo) Mode() os.FileMode { - return fi.mode -} -func (fi bindataFileInfo) ModTime() time.Time { - return fi.modTime -} -func (fi bindataFileInfo) IsDir() bool { - return false -} -func (fi bindataFileInfo) Sys() interface{} { - return nil -} - -var __000001_initDownDbSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x72\x09\xf2\x0f\x50\x08\x71\x74\xf2\x71\x55\x48\xce\x48\x2c\x29\xb6\xe6\x42\x12\x29\x2d\x4e\x2d\x8a\xcf\x4d\x2d\x2e\x4e\x4c\x4f\x45\x95\x49\xce\xcf\x2b\x49\x4c\x06\x29\x07\x04\x00\x00\xff\xff\x61\x86\xbd\x5f\x41\x00\x00\x00") - -func _000001_initDownDbSqlBytes() ([]byte, error) { - return bindataRead( - __000001_initDownDbSql, - "000001_init.down.db.sql", - ) -} - -func _000001_initDownDbSql() (*asset, error) { - bytes, err := _000001_initDownDbSqlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "000001_init.down.db.sql", size: 65, mode: os.FileMode(0644), modTime: time.Unix(1578682784, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x5e, 0xbb, 0x3f, 0x1, 0x75, 0x19, 0x70, 0x86, 0xa7, 0x34, 0x40, 0x17, 0x34, 0x3e, 0x18, 0x51, 0x79, 0xd4, 0x22, 0xad, 0x8f, 0x80, 0xcc, 0xa6, 0xcc, 0x6, 0x2b, 0x62, 0x2, 0x47, 0xba, 0xf9}} - return a, nil -} - -var __000001_initUpDbSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xa4\x56\xd1\x6f\xe2\xb8\x13\x7e\xe7\xaf\x18\xe9\xf7\x40\x2b\xd1\x9f\xf6\xa4\xbd\xbd\x93\xfa\x44\xd9\xf4\x0e\x1d\x07\x2b\x9a\x9e\xba\x4f\xd6\xe0\x0c\xc4\xc2\xb1\x23\x7b\x02\x8b\xb4\x7f\xfc\xc9\x81\x40\x0c\x81\xee\xea\xfa\x50\xb5\x33\xe3\x19\xcf\x37\xf3\x7d\xce\x68\x9e\x0c\xd3\x04\xd2\xe1\xd3\x24\x81\xf1\x33\x4c\x67\x29\x24\x6f\xe3\x97\xf4\x05\x64\x8e\xec\xe1\xae\x07\xa0\x32\xf8\x67\x38\x1f\xfd\x39\x9c\xc3\x97\xf9\xf8\xef\xe1\xfc\x2b\xfc\x95\x7c\x85\xd9\x14\x46\xb3\xe9\xf3\x64\x3c\x4a\x61\x9e\x7c\x99\x0c\x47\xc9\xa0\x07\x60\xb0\xa0\x63\x7c\xc8\x37\x7d\x9d\x4c\x82\x43\x5a\x6d\xdd\x85\x07\x3e\x27\xcf\xc3\xd7\x49\x0a\xfd\xff\xe1\x2f\xbf\xff\x96\xfd\xda\x0f\xb1\xbc\x2b\x09\xc6\xd3\x34\x4a\x80\x92\xd5\x86\xe0\x69\x36\x9b\x24\xc3\xe9\x65\x86\x74\xfe\x5a\xdf\x80\x55\x41\x9e\xb1\x28\x2f\x32\x64\xa4\x89\x29\x13\xc8\x42\x6a\x2b\xd7\x62\x83\xba\x8a\x0b\x1d\xb3\x7d\x08\x07\xca\x6a\xa1\x95\x14\x6b\xda\xc1\xd3\x64\xf6\x14\x4c\x95\xd9\x28\xda\x52\x26\x0a\xf2\x1e\x57\x24\xa4\xad\x0c\xdf\xc8\xa1\xd1\xff\x68\xb9\x3a\xf4\x90\xf7\x58\xb0\xa0\x62\x41\xce\x9f\xff\x9f\xab\x52\x54\x65\x86\x4c\x7b\x57\xef\xfe\xb1\xd7\x8b\xe6\x29\xad\x61\x94\xa7\x21\xa6\xc9\x5b\xfa\x23\x13\xc4\x2c\x73\xe4\xfd\x3e\xbe\x0d\x5f\x3d\xda\x0b\x2b\x19\x2f\x36\xe4\xd4\x52\x51\x76\x1c\x4e\xd3\xd6\xf3\x70\xf2\x92\x9c\x47\x09\xbc\x85\x17\x6a\x85\x1d\xc5\x55\x46\x86\x95\xb4\xe6\xd2\x55\xe6\x96\xed\xa5\xb9\x46\x73\x0f\x51\x76\xa3\x9e\xdf\x79\xa6\x42\x30\xae\x4e\x18\x67\xb4\x51\x92\x84\x32\x4b\x7b\xb4\xb1\x53\x8b\x8a\x49\xb0\x15\x8c\x7a\x1d\xd7\xab\xd1\x7f\x78\x80\x31\xf7\x3d\xa8\xa2\xb4\x8e\xd1\x30\x70\x8e\xe1\x97\xf2\xc0\xb8\xd0\x04\x39\x7a\x70\x76\xab\x32\x40\x0f\x5b\x02\x47\x7a\x07\xd6\x80\xe2\x70\x78\x9b\x93\x09\x87\x35\x15\xa1\x57\xb3\x02\x65\x96\xca\x28\xa6\x07\x2f\x9d\xd5\xfa\xff\xbd\x1b\x84\xad\x3c\xb9\x66\x79\xf6\x33\xff\x59\xea\x02\x6c\x73\xe5\x4b\x72\x22\xa2\x50\xf2\x47\x12\x33\x19\xc0\xdb\xca\xc9\x8e\x5d\x08\xc8\x79\x56\x06\x59\x59\x73\x44\x0e\x80\xe9\x1b\x77\x8a\x02\xd4\x5b\x4a\x86\x45\x27\xe5\xa1\xee\xaa\x2d\x29\x87\x7c\x57\x29\x0e\xb5\x70\x89\x56\xe3\xb1\x57\x5b\x89\x5a\xdc\x8e\xc9\x55\x46\xd7\x37\x19\xc0\x91\x2f\xad\xf1\x61\x15\xe2\x6b\x35\x92\xd0\xf4\x72\xb8\xd0\x15\xee\x1f\xa0\x24\x32\xd7\x35\xad\x55\xd5\x56\xbc\xb2\xca\xac\x84\x67\xe4\xca\xc7\x95\x4b\x74\x9e\x32\x51\xe3\x7c\x82\xdd\xe1\x56\x94\xb8\xd3\x16\xb3\x96\xd5\xb3\x92\x6b\x72\xa2\x44\xb9\x3e\xdd\xb2\xb1\xe6\xe8\xf3\x38\xb7\xb4\x45\x81\x26\x6b\xe1\x15\xdb\xf7\x9d\x75\xba\x1a\x29\xe9\x74\x2e\x9d\x2d\xba\x3d\x61\x27\x1c\x4a\xee\xf6\xb2\x43\xe3\xc3\x63\x60\xcd\x8d\xdb\x7a\xb5\x32\xc8\x95\xa3\x56\xe7\x47\x1f\x23\xd7\xb3\x68\x8b\xe6\x78\xfa\x39\x79\x03\x95\x7d\x13\x87\xed\x9e\x4d\x63\x4e\xdd\xed\xed\xf7\x8f\x1d\x27\x08\x9d\xcc\xc5\x62\x77\xdc\xac\xd9\x14\xce\x4e\xef\x51\xae\x16\x9e\xdd\x5d\xff\xc3\x7f\xfc\xe9\xc3\xf7\xef\xed\xc5\x1a\xc0\xc3\xa7\x8f\x03\xf8\xf4\xf1\x3e\x38\x54\x36\x68\x68\x30\xa8\xb7\xf9\xf2\x71\x88\xb5\x23\x2c\x4a\x24\x1d\x3f\x27\x1c\xef\x93\xaa\xd6\x62\x4f\x67\x0f\x65\x2d\xbf\x54\x0f\xfc\xfc\x0d\x3d\xb8\xf8\x3a\x0f\x1d\xd5\x47\xb1\x62\x5b\x20\x2b\x89\x5a\xef\xae\x47\x77\x51\xd3\x91\x54\xa5\x22\xc3\x27\xe1\x6f\xb3\xe5\x1d\xcc\x42\x46\x32\xab\xa0\x96\xa7\x85\xf4\xe1\x79\xd8\xa0\x56\xe1\xd5\xa9\x91\x6c\x0a\xc7\xec\xb9\xe4\x54\xd4\xf9\xb5\x15\x6f\x0f\x63\xdf\x01\xbb\xdd\x09\xbd\x60\x5a\x2a\x57\x43\x4d\xa6\xb1\xc4\x4c\x88\xeb\xb4\x2e\x7b\x0e\x5d\xf3\x39\x75\xf6\x0d\xd4\xc9\x98\x4e\x2c\x22\x28\x02\x1f\xde\x47\xec\xae\xf5\xf7\xfd\x63\xef\xdf\x00\x00\x00\xff\xff\xd7\x95\x8b\x6b\x9f\x0a\x00\x00") - -func _000001_initUpDbSqlBytes() ([]byte, error) { - return bindataRead( - __000001_initUpDbSql, - "000001_init.up.db.sql", - ) -} - -func _000001_initUpDbSql() (*asset, error) { - bytes, err := _000001_initUpDbSqlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "000001_init.up.db.sql", size: 2719, mode: os.FileMode(0644), modTime: time.Unix(1578682784, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x60, 0xdc, 0xeb, 0xe, 0xc2, 0x4f, 0x75, 0xa, 0xf6, 0x3e, 0xc7, 0xc4, 0x4, 0xe2, 0xe1, 0xa4, 0x73, 0x2f, 0x4a, 0xad, 0x1a, 0x0, 0xc3, 0x93, 0x9d, 0x77, 0x3e, 0x31, 0x91, 0x77, 0x2e, 0xc8}} - return a, nil -} - -var __000002_add_last_ens_clock_valueDownSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x01\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00") - -func _000002_add_last_ens_clock_valueDownSqlBytes() ([]byte, error) { - return bindataRead( - __000002_add_last_ens_clock_valueDownSql, - "000002_add_last_ens_clock_value.down.sql", - ) -} - -func _000002_add_last_ens_clock_valueDownSql() (*asset, error) { - bytes, err := _000002_add_last_ens_clock_valueDownSqlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "000002_add_last_ens_clock_value.down.sql", size: 0, mode: os.FileMode(0644), modTime: time.Unix(1580459788, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xe3, 0xb0, 0xc4, 0x42, 0x98, 0xfc, 0x1c, 0x14, 0x9a, 0xfb, 0xf4, 0xc8, 0x99, 0x6f, 0xb9, 0x24, 0x27, 0xae, 0x41, 0xe4, 0x64, 0x9b, 0x93, 0x4c, 0xa4, 0x95, 0x99, 0x1b, 0x78, 0x52, 0xb8, 0x55}} - return a, nil -} - -var __000002_add_last_ens_clock_valueUpSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x04\xc0\x41\x0a\x85\x20\x10\x06\xe0\xfd\x3b\xc5\x7f\x84\xb7\x6f\x35\xa5\x41\x30\x8d\x10\xe3\x5a\x64\x70\x95\xe8\x42\xeb\xfc\x7d\xc4\xea\x2f\x28\xad\xec\x61\xbd\xcd\x6c\x73\x80\x9c\xc3\x16\x38\x9e\x82\x9a\xc7\x4c\xa5\x8d\x64\xb5\xdb\x9d\xde\x5c\x9f\x82\x43\x14\x12\x14\x12\x99\xe1\xfc\x4e\x91\x15\xff\xe5\xf7\x05\x00\x00\xff\xff\xd0\x66\x8a\xf7\x4d\x00\x00\x00") - -func _000002_add_last_ens_clock_valueUpSqlBytes() ([]byte, error) { - return bindataRead( - __000002_add_last_ens_clock_valueUpSql, - "000002_add_last_ens_clock_value.up.sql", - ) -} - -func _000002_add_last_ens_clock_valueUpSql() (*asset, error) { - bytes, err := _000002_add_last_ens_clock_valueUpSqlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "000002_add_last_ens_clock_value.up.sql", size: 77, mode: os.FileMode(0644), modTime: time.Unix(1580459768, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x4d, 0x3, 0x8f, 0xd5, 0x85, 0x83, 0x47, 0xbe, 0xf9, 0x82, 0x7e, 0x81, 0xa4, 0xbd, 0xaa, 0xd5, 0x98, 0x18, 0x5, 0x2d, 0x82, 0x42, 0x3b, 0x3, 0x50, 0xc3, 0x1e, 0x84, 0x35, 0xf, 0xb6, 0x2b}} - return a, nil -} - -var _docGo = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x84\x8f\xbb\x6e\xc3\x30\x0c\x45\x77\x7f\xc5\x45\x96\x2c\xb5\xb4\x74\xea\xd6\xb1\x7b\x7f\x80\x91\x68\x89\x88\x1e\xae\x48\xe7\xf1\xf7\x85\xd3\x02\xcd\xd6\xf5\x00\xe7\xf0\xd2\x7b\x7c\x66\x51\x2c\x52\x18\xa2\x68\x1c\x58\x95\xc6\x1d\x27\x0e\xb4\x29\xe3\x90\xc4\xf2\x76\x72\xa1\x57\xaf\x46\xb6\xe9\x2c\xd5\x57\x49\x83\x8c\xfd\xe5\xf5\x30\x79\x8f\x40\xed\x68\xc8\xd4\x62\xe1\x47\x4b\xa1\x46\xc3\xa4\x25\x5c\xc5\x32\x08\xeb\xe0\x45\x6e\x0e\xef\x86\xc2\xa4\x06\xcb\x64\x47\x85\x65\x46\x20\xe5\x3d\xb3\xf4\x81\xd4\xe7\x93\xb4\x48\x46\x6e\x47\x1f\xcb\x13\xd9\x17\x06\x2a\x85\x23\x96\xd1\xeb\xc3\x55\xaa\x8c\x28\x83\x83\xf5\x71\x7f\x01\xa9\xb2\xa1\x51\x65\xdd\xfd\x4c\x17\x46\xeb\xbf\xe7\x41\x2d\xfe\xff\x11\xae\x7d\x9c\x15\xa4\xe0\xdb\xca\xc1\x38\xba\x69\x5a\x29\x9c\x29\x31\xf4\xab\x88\xf1\x34\x79\x9f\xfa\x5b\xe2\xc6\xbb\xf5\xbc\x71\x5e\xcf\x09\x3f\x35\xe9\x4d\x31\x77\x38\xe7\xff\x80\x4b\x1d\x6e\xfa\x0e\x00\x00\xff\xff\x9d\x60\x3d\x88\x79\x01\x00\x00") - -func docGoBytes() ([]byte, error) { - return bindataRead( - _docGo, - "doc.go", - ) -} - -func docGo() (*asset, error) { - bytes, err := docGoBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "doc.go", size: 377, mode: os.FileMode(0644), modTime: time.Unix(1574354941, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xef, 0xaf, 0xdf, 0xcf, 0x65, 0xae, 0x19, 0xfc, 0x9d, 0x29, 0xc1, 0x91, 0xaf, 0xb5, 0xd5, 0xb1, 0x56, 0xf3, 0xee, 0xa8, 0xba, 0x13, 0x65, 0xdb, 0xab, 0xcf, 0x4e, 0xac, 0x92, 0xe9, 0x60, 0xf1}} - return a, nil -} - -// Asset loads and returns the asset for the given name. -// It returns an error if the asset could not be found or -// could not be loaded. -func Asset(name string) ([]byte, error) { - canonicalName := strings.Replace(name, "\\", "/", -1) - if f, ok := _bindata[canonicalName]; ok { - a, err := f() - if err != nil { - return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err) - } - return a.bytes, nil - } - return nil, fmt.Errorf("Asset %s not found", name) -} - -// AssetString returns the asset contents as a string (instead of a []byte). -func AssetString(name string) (string, error) { - data, err := Asset(name) - return string(data), err -} - -// MustAsset is like Asset but panics when Asset would return an error. -// It simplifies safe initialization of global variables. -func MustAsset(name string) []byte { - a, err := Asset(name) - if err != nil { - panic("asset: Asset(" + name + "): " + err.Error()) - } - - return a -} - -// MustAssetString is like AssetString but panics when Asset would return an -// error. It simplifies safe initialization of global variables. -func MustAssetString(name string) string { - return string(MustAsset(name)) -} - -// AssetInfo loads and returns the asset info for the given name. -// It returns an error if the asset could not be found or -// could not be loaded. -func AssetInfo(name string) (os.FileInfo, error) { - canonicalName := strings.Replace(name, "\\", "/", -1) - if f, ok := _bindata[canonicalName]; ok { - a, err := f() - if err != nil { - return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err) - } - return a.info, nil - } - return nil, fmt.Errorf("AssetInfo %s not found", name) -} - -// AssetDigest returns the digest of the file with the given name. It returns an -// error if the asset could not be found or the digest could not be loaded. -func AssetDigest(name string) ([sha256.Size]byte, error) { - canonicalName := strings.Replace(name, "\\", "/", -1) - if f, ok := _bindata[canonicalName]; ok { - a, err := f() - if err != nil { - return [sha256.Size]byte{}, fmt.Errorf("AssetDigest %s can't read by error: %v", name, err) - } - return a.digest, nil - } - return [sha256.Size]byte{}, fmt.Errorf("AssetDigest %s not found", name) -} - -// Digests returns a map of all known files and their checksums. -func Digests() (map[string][sha256.Size]byte, error) { - mp := make(map[string][sha256.Size]byte, len(_bindata)) - for name := range _bindata { - a, err := _bindata[name]() - if err != nil { - return nil, err - } - mp[name] = a.digest - } - return mp, nil -} - -// AssetNames returns the names of the assets. -func AssetNames() []string { - names := make([]string, 0, len(_bindata)) - for name := range _bindata { - names = append(names, name) - } - return names -} - -// _bindata is a table, holding each asset generator, mapped to its name. -var _bindata = map[string]func() (*asset, error){ - "000001_init.down.db.sql": _000001_initDownDbSql, - - "000001_init.up.db.sql": _000001_initUpDbSql, - - "000002_add_last_ens_clock_value.down.sql": _000002_add_last_ens_clock_valueDownSql, - - "000002_add_last_ens_clock_value.up.sql": _000002_add_last_ens_clock_valueUpSql, - - "doc.go": docGo, -} - -// AssetDir returns the file names below a certain -// directory embedded in the file by go-bindata. -// For example if you run go-bindata on data/... and data contains the -// following hierarchy: -// data/ -// foo.txt -// img/ -// a.png -// b.png -// then AssetDir("data") would return []string{"foo.txt", "img"}, -// AssetDir("data/img") would return []string{"a.png", "b.png"}, -// AssetDir("foo.txt") and AssetDir("notexist") would return an error, and -// AssetDir("") will return []string{"data"}. -func AssetDir(name string) ([]string, error) { - node := _bintree - if len(name) != 0 { - canonicalName := strings.Replace(name, "\\", "/", -1) - pathList := strings.Split(canonicalName, "/") - for _, p := range pathList { - node = node.Children[p] - if node == nil { - return nil, fmt.Errorf("Asset %s not found", name) - } - } - } - if node.Func != nil { - return nil, fmt.Errorf("Asset %s not found", name) - } - rv := make([]string, 0, len(node.Children)) - for childName := range node.Children { - rv = append(rv, childName) - } - return rv, nil -} - -type bintree struct { - Func func() (*asset, error) - Children map[string]*bintree -} - -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_last_ens_clock_value.down.sql": &bintree{_000002_add_last_ens_clock_valueDownSql, map[string]*bintree{}}, - "000002_add_last_ens_clock_value.up.sql": &bintree{_000002_add_last_ens_clock_valueUpSql, map[string]*bintree{}}, - "doc.go": &bintree{docGo, map[string]*bintree{}}, -}} - -// RestoreAsset restores an asset under the given directory. -func RestoreAsset(dir, name string) error { - data, err := Asset(name) - if err != nil { - return err - } - info, err := AssetInfo(name) - if err != nil { - return err - } - err = os.MkdirAll(_filePath(dir, filepath.Dir(name)), os.FileMode(0755)) - if err != nil { - return err - } - err = ioutil.WriteFile(_filePath(dir, name), data, info.Mode()) - if err != nil { - return err - } - return os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime()) -} - -// RestoreAssets restores an asset under the given directory recursively. -func RestoreAssets(dir, name string) error { - children, err := AssetDir(name) - // File - if err != nil { - return RestoreAsset(dir, name) - } - // Dir - for _, child := range children { - err = RestoreAssets(dir, filepath.Join(name, child)) - if err != nil { - return err - } - } - return nil -} - -func _filePath(dir, name string) string { - canonicalName := strings.Replace(name, "\\", "/", -1) - return filepath.Join(append([]string{dir}, strings.Split(canonicalName, "/")...)...) -} diff --git a/vendor/github.com/status-im/status-go/protocol/persistence.go b/vendor/github.com/status-im/status-go/protocol/persistence.go deleted file mode 100644 index 411836bd3..000000000 --- a/vendor/github.com/status-im/status-go/protocol/persistence.go +++ /dev/null @@ -1,604 +0,0 @@ -package protocol - -import ( - "bytes" - "context" - "database/sql" - "encoding/gob" - - "github.com/pkg/errors" - - "github.com/status-im/status-go/eth-node/crypto" -) - -var ( - // ErrMsgAlreadyExist returned if msg already exist. - ErrMsgAlreadyExist = errors.New("message with given ID already exist") -) - -// sqlitePersistence wrapper around sql db with operations common for a client. -type sqlitePersistence struct { - db *sql.DB -} - -func (db sqlitePersistence) SaveChat(chat Chat) error { - err := chat.Validate() - if err != nil { - return err - } - return db.saveChat(nil, chat) -} - -func (db sqlitePersistence) SaveChats(chats []*Chat) error { - tx, err := db.db.BeginTx(context.Background(), &sql.TxOptions{}) - defer func() { - if err == nil { - err = tx.Commit() - return - } - // don't shadow original error - _ = tx.Rollback() - }() - - for _, chat := range chats { - err := db.saveChat(tx, *chat) - if err != nil { - return err - } - } - return nil -} - -func (db sqlitePersistence) SaveContacts(contacts []*Contact) error { - tx, err := db.db.BeginTx(context.Background(), &sql.TxOptions{}) - defer func() { - if err == nil { - err = tx.Commit() - return - } - // don't shadow original error - _ = tx.Rollback() - }() - - for _, contact := range contacts { - err := db.SaveContact(contact, tx) - if err != nil { - return err - } - } - return nil -} - -func (db sqlitePersistence) saveChat(tx *sql.Tx, chat Chat) error { - var err error - if tx == nil { - tx, err = db.db.BeginTx(context.Background(), &sql.TxOptions{}) - if err != nil { - return err - } - defer func() { - if err == nil { - err = tx.Commit() - return - } - // don't shadow original error - _ = tx.Rollback() - }() - } - - // Encode members - var encodedMembers bytes.Buffer - memberEncoder := gob.NewEncoder(&encodedMembers) - - if err := memberEncoder.Encode(chat.Members); err != nil { - return err - } - - // Encode membership updates - var encodedMembershipUpdates bytes.Buffer - membershipUpdatesEncoder := gob.NewEncoder(&encodedMembershipUpdates) - - if err := membershipUpdatesEncoder.Encode(chat.MembershipUpdates); err != nil { - return err - } - - // Insert record - stmt, err := tx.Prepare(`INSERT INTO chats(id, name, color, active, type, timestamp, deleted_at_clock_value, unviewed_message_count, last_clock_value, last_message, members, membership_updates) - VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`) - if err != nil { - return err - } - defer stmt.Close() - - _, err = stmt.Exec( - chat.ID, - chat.Name, - chat.Color, - chat.Active, - chat.ChatType, - chat.Timestamp, - chat.DeletedAtClockValue, - chat.UnviewedMessagesCount, - chat.LastClockValue, - chat.LastMessage, - encodedMembers.Bytes(), - encodedMembershipUpdates.Bytes(), - ) - if err != nil { - return err - } - - return err -} - -func (db sqlitePersistence) DeleteChat(chatID string) error { - _, err := db.db.Exec("DELETE FROM chats WHERE id = ?", chatID) - return err -} - -func (db sqlitePersistence) Chats() ([]*Chat, error) { - return db.chats(nil) -} - -func (db sqlitePersistence) chats(tx *sql.Tx) (chats []*Chat, err error) { - if tx == nil { - tx, err = db.db.BeginTx(context.Background(), &sql.TxOptions{}) - if err != nil { - return - } - defer func() { - if err == nil { - err = tx.Commit() - return - } - // don't shadow original error - _ = tx.Rollback() - }() - } - - rows, err := tx.Query(` - SELECT - id, - name, - color, - active, - type, - timestamp, - deleted_at_clock_value, - unviewed_message_count, - last_clock_value, - last_message, - members, - membership_updates - FROM chats - ORDER BY chats.timestamp DESC - `) - if err != nil { - return - } - defer rows.Close() - - for rows.Next() { - var ( - chat Chat - encodedMembers []byte - encodedMembershipUpdates []byte - ) - err = rows.Scan( - &chat.ID, - &chat.Name, - &chat.Color, - &chat.Active, - &chat.ChatType, - &chat.Timestamp, - &chat.DeletedAtClockValue, - &chat.UnviewedMessagesCount, - &chat.LastClockValue, - &chat.LastMessage, - &encodedMembers, - &encodedMembershipUpdates, - ) - if err != nil { - return - } - - // Restore members - membersDecoder := gob.NewDecoder(bytes.NewBuffer(encodedMembers)) - err = membersDecoder.Decode(&chat.Members) - if err != nil { - return - } - - // Restore membership updates - membershipUpdatesDecoder := gob.NewDecoder(bytes.NewBuffer(encodedMembershipUpdates)) - err = membershipUpdatesDecoder.Decode(&chat.MembershipUpdates) - if err != nil { - return - } - - chats = append(chats, &chat) - } - - return -} - -func (db sqlitePersistence) Chat(chatID string) (*Chat, error) { - var ( - chat Chat - encodedMembers []byte - encodedMembershipUpdates []byte - ) - - err := db.db.QueryRow(` - SELECT - id, - name, - color, - active, - type, - timestamp, - deleted_at_clock_value, - unviewed_message_count, - last_clock_value, - last_message, - members, - membership_updates - FROM chats - WHERE id = ? - `, chatID).Scan(&chat.ID, - &chat.Name, - &chat.Color, - &chat.Active, - &chat.ChatType, - &chat.Timestamp, - &chat.DeletedAtClockValue, - &chat.UnviewedMessagesCount, - &chat.LastClockValue, - &chat.LastMessage, - &encodedMembers, - &encodedMembershipUpdates, - ) - switch err { - case sql.ErrNoRows: - return nil, nil - case nil: - // Restore members - membersDecoder := gob.NewDecoder(bytes.NewBuffer(encodedMembers)) - err = membersDecoder.Decode(&chat.Members) - if err != nil { - return nil, err - } - - // Restore membership updates - membershipUpdatesDecoder := gob.NewDecoder(bytes.NewBuffer(encodedMembershipUpdates)) - err = membershipUpdatesDecoder.Decode(&chat.MembershipUpdates) - if err != nil { - return nil, err - } - - return &chat, nil - } - - return nil, err - -} - -func (db sqlitePersistence) Contacts() ([]*Contact, error) { - rows, err := db.db.Query(` - SELECT - id, - address, - name, - alias, - identicon, - photo, - last_updated, - system_tags, - device_info, - ens_verified, - ens_verified_at, - tribute_to_talk - FROM contacts - `) - if err != nil { - return nil, err - } - defer rows.Close() - - var response []*Contact - - for rows.Next() { - var ( - contact Contact - encodedDeviceInfo []byte - encodedSystemTags []byte - ) - err := rows.Scan( - &contact.ID, - &contact.Address, - &contact.Name, - &contact.Alias, - &contact.Identicon, - &contact.Photo, - &contact.LastUpdated, - &encodedSystemTags, - &encodedDeviceInfo, - &contact.ENSVerified, - &contact.ENSVerifiedAt, - &contact.TributeToTalk, - ) - if err != nil { - return nil, err - } - - if encodedDeviceInfo != nil { - // Restore device info - deviceInfoDecoder := gob.NewDecoder(bytes.NewBuffer(encodedDeviceInfo)) - if err := deviceInfoDecoder.Decode(&contact.DeviceInfo); err != nil { - return nil, err - } - } - - if encodedSystemTags != nil { - // Restore system tags - systemTagsDecoder := gob.NewDecoder(bytes.NewBuffer(encodedSystemTags)) - if err := systemTagsDecoder.Decode(&contact.SystemTags); err != nil { - return nil, err - } - } - - response = append(response, &contact) - } - - return response, nil -} - -func (db sqlitePersistence) SaveRawMessage(message *RawMessage) error { - var pubKeys [][]byte - for _, pk := range message.Recipients { - pubKeys = append(pubKeys, crypto.CompressPubkey(pk)) - } - // Encode recipients - var encodedRecipients bytes.Buffer - encoder := gob.NewEncoder(&encodedRecipients) - - if err := encoder.Encode(pubKeys); err != nil { - return err - } - - _, err := db.db.Exec(` - INSERT INTO - raw_messages - ( - id, - local_chat_id, - last_sent, - send_count, - sent, - message_type, - resend_automatically, - recipients, - payload - ) - VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`, - message.ID, - message.LocalChatID, - message.LastSent, - message.SendCount, - message.Sent, - message.MessageType, - message.ResendAutomatically, - encodedRecipients.Bytes(), - message.Payload) - return err -} - -func (db sqlitePersistence) RawMessageByID(id string) (*RawMessage, error) { - var rawPubKeys [][]byte - var encodedRecipients []byte - message := &RawMessage{} - - err := db.db.QueryRow(` - SELECT - id, - local_chat_id, - last_sent, - send_count, - sent, - message_type, - resend_automatically, - recipients, - payload - FROM - raw_messages - WHERE - id = ?`, - id, - ).Scan( - &message.ID, - &message.LocalChatID, - &message.LastSent, - &message.SendCount, - &message.Sent, - &message.MessageType, - &message.ResendAutomatically, - &encodedRecipients, - &message.Payload, - ) - if err != nil { - return nil, err - } - - // Restore recipients - decoder := gob.NewDecoder(bytes.NewBuffer(encodedRecipients)) - err = decoder.Decode(&rawPubKeys) - if err != nil { - return nil, err - } - for _, pkBytes := range rawPubKeys { - pubkey, err := crypto.UnmarshalPubkey(pkBytes) - if err != nil { - return nil, err - } - message.Recipients = append(message.Recipients, pubkey) - } - - return message, nil -} - -func (db sqlitePersistence) SaveContact(contact *Contact, tx *sql.Tx) (err error) { - if tx == nil { - tx, err = db.db.BeginTx(context.Background(), &sql.TxOptions{}) - if err != nil { - return - } - defer func() { - if err == nil { - err = tx.Commit() - return - } - // don't shadow original error - _ = tx.Rollback() - }() - } - - // Encode device info - var encodedDeviceInfo bytes.Buffer - deviceInfoEncoder := gob.NewEncoder(&encodedDeviceInfo) - err = deviceInfoEncoder.Encode(contact.DeviceInfo) - if err != nil { - return - } - - // Encoded system tags - var encodedSystemTags bytes.Buffer - systemTagsEncoder := gob.NewEncoder(&encodedSystemTags) - err = systemTagsEncoder.Encode(contact.SystemTags) - if err != nil { - return - } - - // Insert record - stmt, err := tx.Prepare(` - INSERT INTO contacts( - id, - address, - name, - alias, - identicon, - photo, - last_updated, - system_tags, - device_info, - ens_verified, - ens_verified_at, - tribute_to_talk - ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) - `) - if err != nil { - return - } - defer stmt.Close() - - _, err = stmt.Exec( - contact.ID, - contact.Address, - contact.Name, - contact.Alias, - contact.Identicon, - contact.Photo, - contact.LastUpdated, - encodedSystemTags.Bytes(), - encodedDeviceInfo.Bytes(), - contact.ENSVerified, - contact.ENSVerifiedAt, - contact.TributeToTalk, - ) - return -} - -func (db sqlitePersistence) SaveTransactionToValidate(transaction *TransactionToValidate) error { - compressedKey := crypto.CompressPubkey(transaction.From) - - _, err := db.db.Exec(`INSERT INTO messenger_transactions_to_validate( - command_id, - message_id, - transaction_hash, - retry_count, - first_seen, - public_key, - signature, - to_validate) - VALUES (?, ?, ?, ?, ?, ?, ?, ?)`, - transaction.CommandID, - transaction.MessageID, - transaction.TransactionHash, - transaction.RetryCount, - transaction.FirstSeen, - compressedKey, - transaction.Signature, - transaction.Validate, - ) - - return err -} - -func (db sqlitePersistence) UpdateTransactionToValidate(transaction *TransactionToValidate) error { - _, err := db.db.Exec(`UPDATE messenger_transactions_to_validate - SET retry_count = ?, to_validate = ? - WHERE transaction_hash = ?`, - transaction.RetryCount, - transaction.Validate, - transaction.TransactionHash, - ) - return err -} - -func (db sqlitePersistence) TransactionsToValidate() ([]*TransactionToValidate, error) { - var transactions []*TransactionToValidate - rows, err := db.db.Query(` - SELECT - command_id, - message_id, - transaction_hash, - retry_count, - first_seen, - public_key, - signature, - to_validate - FROM messenger_transactions_to_validate - WHERE to_validate = 1; - `) - if err != nil { - return nil, err - } - defer rows.Close() - - for rows.Next() { - var t TransactionToValidate - var pkBytes []byte - err = rows.Scan( - &t.CommandID, - &t.MessageID, - &t.TransactionHash, - &t.RetryCount, - &t.FirstSeen, - &pkBytes, - &t.Signature, - &t.Validate, - ) - if err != nil { - return nil, err - } - - publicKey, err := crypto.DecompressPubkey(pkBytes) - if err != nil { - return nil, err - } - t.From = publicKey - - transactions = append(transactions, &t) - } - - return transactions, nil -} diff --git a/vendor/github.com/status-im/status-go/protocol/persistence_legacy.go b/vendor/github.com/status-im/status-go/protocol/persistence_legacy.go deleted file mode 100644 index 95cb7a31c..000000000 --- a/vendor/github.com/status-im/status-go/protocol/persistence_legacy.go +++ /dev/null @@ -1,577 +0,0 @@ -package protocol - -import ( - "context" - "database/sql" - "encoding/json" - "fmt" - "strings" - - "github.com/status-im/status-go/protocol/protobuf" - - "github.com/pkg/errors" -) - -var ( - errRecordNotFound = errors.New("record not found") -) - -func (db sqlitePersistence) tableUserMessagesLegacyAllFields() string { - return `id, - whisper_timestamp, - source, - text, - content_type, - username, - timestamp, - chat_id, - local_chat_id, - message_type, - clock_value, - seen, - outgoing_status, - parsed_text, - sticker_pack, - sticker_hash, - command_id, - command_value, - command_from, - command_address, - command_contract, - command_transaction_hash, - command_state, - command_signature, - response_to` -} - -func (db sqlitePersistence) tableUserMessagesLegacyAllFieldsJoin() string { - return `m1.id, - m1.whisper_timestamp, - m1.source, - m1.text, - m1.content_type, - m1.username, - m1.timestamp, - m1.chat_id, - m1.local_chat_id, - m1.message_type, - m1.clock_value, - m1.seen, - m1.outgoing_status, - m1.parsed_text, - m1.sticker_pack, - m1.sticker_hash, - m1.command_id, - m1.command_value, - m1.command_from, - m1.command_address, - m1.command_contract, - m1.command_transaction_hash, - m1.command_state, - m1.command_signature, - m1.response_to, - m2.source, - m2.text, - c.alias, - c.identicon` -} - -func (db sqlitePersistence) tableUserMessagesLegacyAllFieldsCount() int { - return strings.Count(db.tableUserMessagesLegacyAllFields(), ",") + 1 -} - -type scanner interface { - Scan(dest ...interface{}) error -} - -func (db sqlitePersistence) tableUserMessagesLegacyScanAllFields(row scanner, message *Message, others ...interface{}) error { - var quotedText sql.NullString - var quotedFrom sql.NullString - var alias sql.NullString - var identicon sql.NullString - - sticker := &protobuf.StickerMessage{} - command := &CommandParameters{} - - args := []interface{}{ - &message.ID, - &message.WhisperTimestamp, - &message.From, // source in table - &message.Text, - &message.ContentType, - &message.Alias, - &message.Timestamp, - &message.ChatId, - &message.LocalChatID, - &message.MessageType, - &message.Clock, - &message.Seen, - &message.OutgoingStatus, - &message.ParsedText, - &sticker.Pack, - &sticker.Hash, - &command.ID, - &command.Value, - &command.From, - &command.Address, - &command.Contract, - &command.TransactionHash, - &command.CommandState, - &command.Signature, - &message.ResponseTo, - "edFrom, - "edText, - &alias, - &identicon, - } - err := row.Scan(append(args, others...)...) - if err != nil { - return err - } - - if quotedText.Valid { - message.QuotedMessage = &QuotedMessage{ - From: quotedFrom.String, - Text: quotedText.String, - } - } - message.Alias = alias.String - message.Identicon = identicon.String - if message.ContentType == protobuf.ChatMessage_STICKER { - message.Payload = &protobuf.ChatMessage_Sticker{Sticker: sticker} - } - - if message.ContentType == protobuf.ChatMessage_TRANSACTION_COMMAND { - message.CommandParameters = command - } - - return nil -} - -func (db sqlitePersistence) tableUserMessagesLegacyAllValues(message *Message) ([]interface{}, error) { - sticker := message.GetSticker() - if sticker == nil { - sticker = &protobuf.StickerMessage{} - } - command := message.CommandParameters - if command == nil { - command = &CommandParameters{} - } - return []interface{}{ - message.ID, - message.WhisperTimestamp, - message.From, // source in table - message.Text, - message.ContentType, - message.Alias, - message.Timestamp, - message.ChatId, - message.LocalChatID, - message.MessageType, - message.Clock, - message.Seen, - message.OutgoingStatus, - message.ParsedText, - sticker.Pack, - sticker.Hash, - command.ID, - command.Value, - command.From, - command.Address, - command.Contract, - command.TransactionHash, - command.CommandState, - command.Signature, - message.ResponseTo, - }, nil -} - -func (db sqlitePersistence) messageByID(tx *sql.Tx, id string) (*Message, error) { - var err error - if tx == nil { - tx, err = db.db.BeginTx(context.Background(), &sql.TxOptions{}) - if err != nil { - return nil, err - } - defer func() { - if err == nil { - err = tx.Commit() - return - } - // don't shadow original error - _ = tx.Rollback() - }() - } - - var message Message - - allFields := db.tableUserMessagesLegacyAllFieldsJoin() - row := tx.QueryRow( - fmt.Sprintf(` - SELECT - %s - FROM - user_messages m1 - LEFT JOIN - user_messages m2 - ON - m1.response_to = m2.id - - LEFT JOIN - contacts c - ON - m1.source = c.id - WHERE - m1.id = ? - `, allFields), - id, - ) - err = db.tableUserMessagesLegacyScanAllFields(row, &message) - switch err { - case sql.ErrNoRows: - return nil, errRecordNotFound - case nil: - return &message, nil - default: - return nil, err - } -} - -func (db sqlitePersistence) MessageByCommandID(chatID, id string) (*Message, error) { - - var message Message - - allFields := db.tableUserMessagesLegacyAllFieldsJoin() - row := db.db.QueryRow( - fmt.Sprintf(` - SELECT - %s - FROM - user_messages m1 - LEFT JOIN - user_messages m2 - ON - m1.response_to = m2.id - - LEFT JOIN - contacts c - ON - m1.source = c.id - WHERE - m1.command_id = ? - AND - m1.local_chat_id = ? - ORDER BY m1.clock_value DESC - LIMIT 1 - `, allFields), - id, - chatID, - ) - err := db.tableUserMessagesLegacyScanAllFields(row, &message) - switch err { - case sql.ErrNoRows: - return nil, errRecordNotFound - case nil: - return &message, nil - default: - return nil, err - } -} - -func (db sqlitePersistence) MessageByID(id string) (*Message, error) { - return db.messageByID(nil, id) -} - -func (db sqlitePersistence) MessagesExist(ids []string) (map[string]bool, error) { - result := make(map[string]bool) - if len(ids) == 0 { - return result, nil - } - - idsArgs := make([]interface{}, 0, len(ids)) - for _, id := range ids { - idsArgs = append(idsArgs, id) - } - - inVector := strings.Repeat("?, ", len(ids)-1) + "?" - query := fmt.Sprintf(`SELECT id FROM user_messages WHERE id IN (%s)`, inVector) - rows, err := db.db.Query(query, idsArgs...) - if err != nil { - return nil, err - } - defer rows.Close() - - for rows.Next() { - var id string - err := rows.Scan(&id) - if err != nil { - return nil, err - } - result[id] = true - } - - return result, nil -} - -// MessageByChatID returns all messages for a given chatID in descending order. -// Ordering is accomplished using two concatenated values: ClockValue and ID. -// These two values are also used to compose a cursor which is returned to the result. -func (db sqlitePersistence) MessageByChatID(chatID string, currCursor string, limit int) ([]*Message, string, error) { - cursorWhere := "" - if currCursor != "" { - cursorWhere = "AND cursor <= ?" - } - allFields := db.tableUserMessagesLegacyAllFieldsJoin() - args := []interface{}{chatID} - if currCursor != "" { - args = append(args, currCursor) - } - // Build a new column `cursor` at the query time by having a fixed-sized clock value at the beginning - // concatenated with message ID. Results are sorted using this new column. - // This new column values can also be returned as a cursor for subsequent requests. - rows, err := db.db.Query( - fmt.Sprintf(` - SELECT - %s, - substr('0000000000000000000000000000000000000000000000000000000000000000' || m1.clock_value, -64, 64) || m1.id as cursor - FROM - user_messages m1 - LEFT JOIN - user_messages m2 - ON - m1.response_to = m2.id - - LEFT JOIN - contacts c - ON - - m1.source = c.id - WHERE - m1.hide != 1 AND m1.local_chat_id = ? %s - ORDER BY cursor DESC - LIMIT ? - `, allFields, cursorWhere), - append(args, limit+1)..., // take one more to figure our whether a cursor should be returned - ) - if err != nil { - return nil, "", err - } - defer rows.Close() - - var ( - result []*Message - cursors []string - ) - for rows.Next() { - var ( - message Message - cursor string - ) - if err := db.tableUserMessagesLegacyScanAllFields(rows, &message, &cursor); err != nil { - return nil, "", err - } - result = append(result, &message) - cursors = append(cursors, cursor) - } - - var newCursor string - if len(result) > limit { - newCursor = cursors[limit] - result = result[:limit] - } - return result, newCursor, nil -} - -func (db sqlitePersistence) SaveMessagesLegacy(messages []*Message) (err error) { - tx, err := db.db.BeginTx(context.Background(), &sql.TxOptions{}) - if err != nil { - return - } - defer func() { - if err == nil { - err = tx.Commit() - return - } - // don't shadow original error - _ = tx.Rollback() - }() - - allFields := db.tableUserMessagesLegacyAllFields() - valuesVector := strings.Repeat("?, ", db.tableUserMessagesLegacyAllFieldsCount()-1) + "?" - query := fmt.Sprintf(`INSERT INTO user_messages(%s) VALUES (%s)`, allFields, valuesVector) - stmt, err := tx.Prepare(query) - if err != nil { - return - } - - for _, msg := range messages { - var allValues []interface{} - allValues, err = db.tableUserMessagesLegacyAllValues(msg) - if err != nil { - return - } - - _, err = stmt.Exec(allValues...) - if err != nil { - return - } - } - return -} - -func (db sqlitePersistence) DeleteMessage(id string) error { - _, err := db.db.Exec(`DELETE FROM user_messages WHERE id = ?`, id) - return err -} - -func (db sqlitePersistence) HideMessage(id string) error { - _, err := db.db.Exec(`UPDATE user_messages SET hide = 1 WHERE id = ?`, id) - return err -} - -func (db sqlitePersistence) DeleteMessagesByChatID(id string) error { - _, err := db.db.Exec(`DELETE FROM user_messages WHERE local_chat_id = ?`, id) - return err -} - -func (db sqlitePersistence) MarkMessagesSeen(chatID string, ids []string) error { - tx, err := db.db.BeginTx(context.Background(), &sql.TxOptions{}) - if err != nil { - return err - } - defer func() { - if err == nil { - err = tx.Commit() - return - } - // don't shadow original error - _ = tx.Rollback() - }() - - idsArgs := make([]interface{}, 0, len(ids)) - for _, id := range ids { - idsArgs = append(idsArgs, id) - } - - inVector := strings.Repeat("?, ", len(ids)-1) + "?" - _, err = tx.Exec( - fmt.Sprintf(` - UPDATE user_messages - SET seen = 1 - WHERE id IN (%s) - `, inVector), - idsArgs...) - if err != nil { - return err - } - - // Update denormalized count - _, err = tx.Exec( - `UPDATE chats - SET unviewed_message_count = - (SELECT COUNT(1) - FROM user_messages - WHERE local_chat_id = ? AND seen = 0) - WHERE id = ?`, chatID, chatID) - return err -} - -func (db sqlitePersistence) UpdateMessageOutgoingStatus(id string, newOutgoingStatus string) error { - _, err := db.db.Exec(` - UPDATE user_messages - SET outgoing_status = ? - WHERE id = ? - `, newOutgoingStatus, id) - return err -} - -// BlockContact updates a contact, deletes all the messages and 1-to-1 chat, updates the unread messages count and returns a map with the new count -func (db sqlitePersistence) BlockContact(contact *Contact) ([]*Chat, error) { - var chats []*Chat - tx, err := db.db.BeginTx(context.Background(), &sql.TxOptions{}) - if err != nil { - return nil, err - } - defer func() { - if err == nil { - err = tx.Commit() - return - } - // don't shadow original error - _ = tx.Rollback() - }() - - // Delete messages - _, err = tx.Exec( - `DELETE - FROM user_messages - WHERE source = ?`, - contact.ID, - ) - if err != nil { - return nil, err - } - - // Update contact - err = db.SaveContact(contact, tx) - if err != nil { - return nil, err - } - - // Delete one-to-one chat - _, err = tx.Exec("DELETE FROM chats WHERE id = ?", contact.ID) - if err != nil { - return nil, err - } - - // Recalculate denormalized fields - _, err = tx.Exec(` - UPDATE chats - SET - unviewed_message_count = (SELECT COUNT(1) FROM user_messages WHERE seen = 0 AND local_chat_id = chats.id)`) - if err != nil { - return nil, err - } - - // return the updated chats - chats, err = db.chats(tx) - if err != nil { - return nil, err - } - for _, c := range chats { - var lastMessageID string - row := tx.QueryRow(`SELECT id FROM user_messages WHERE local_chat_id = ? ORDER BY clock_value DESC LIMIT 1`, c.ID) - switch err := row.Scan(&lastMessageID); err { - - case nil: - message, err := db.messageByID(tx, lastMessageID) - if err != nil { - return nil, err - } - if message != nil { - encodedMessage, err := json.Marshal(message) - if err != nil { - return nil, err - } - _, err = tx.Exec(`UPDATE chats SET last_message = ? WHERE id = ?`, encodedMessage, c.ID) - if err != nil { - return nil, err - } - c.LastMessage = encodedMessage - - } - - case sql.ErrNoRows: - // Reset LastMessage - _, err = tx.Exec(`UPDATE chats SET last_message = NULL WHERE id = ?`, c.ID) - if err != nil { - return nil, err - } - c.LastMessage = nil - default: - return nil, err - } - } - - return chats, err -} diff --git a/vendor/github.com/status-im/status-go/protocol/protobuf/application_metadata_message.pb.go b/vendor/github.com/status-im/status-go/protocol/protobuf/application_metadata_message.pb.go deleted file mode 100644 index b166e283f..000000000 --- a/vendor/github.com/status-im/status-go/protocol/protobuf/application_metadata_message.pb.go +++ /dev/null @@ -1,178 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: application_metadata_message.proto - -package protobuf - -import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - math "math" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - -type ApplicationMetadataMessage_Type int32 - -const ( - ApplicationMetadataMessage_UNKNOWN ApplicationMetadataMessage_Type = 0 - ApplicationMetadataMessage_CHAT_MESSAGE ApplicationMetadataMessage_Type = 1 - ApplicationMetadataMessage_CONTACT_UPDATE ApplicationMetadataMessage_Type = 2 - ApplicationMetadataMessage_MEMBERSHIP_UPDATE_MESSAGE ApplicationMetadataMessage_Type = 3 - ApplicationMetadataMessage_PAIR_INSTALLATION ApplicationMetadataMessage_Type = 4 - ApplicationMetadataMessage_SYNC_INSTALLATION ApplicationMetadataMessage_Type = 5 - ApplicationMetadataMessage_REQUEST_ADDRESS_FOR_TRANSACTION ApplicationMetadataMessage_Type = 6 - ApplicationMetadataMessage_ACCEPT_REQUEST_ADDRESS_FOR_TRANSACTION ApplicationMetadataMessage_Type = 7 - ApplicationMetadataMessage_DECLINE_REQUEST_ADDRESS_FOR_TRANSACTION ApplicationMetadataMessage_Type = 8 - ApplicationMetadataMessage_REQUEST_TRANSACTION ApplicationMetadataMessage_Type = 9 - ApplicationMetadataMessage_SEND_TRANSACTION ApplicationMetadataMessage_Type = 10 - ApplicationMetadataMessage_DECLINE_REQUEST_TRANSACTION ApplicationMetadataMessage_Type = 11 - ApplicationMetadataMessage_SYNC_INSTALLATION_CONTACT ApplicationMetadataMessage_Type = 12 - ApplicationMetadataMessage_SYNC_INSTALLATION_ACCOUNT ApplicationMetadataMessage_Type = 13 - ApplicationMetadataMessage_SYNC_INSTALLATION_PUBLIC_CHAT ApplicationMetadataMessage_Type = 14 -) - -var ApplicationMetadataMessage_Type_name = map[int32]string{ - 0: "UNKNOWN", - 1: "CHAT_MESSAGE", - 2: "CONTACT_UPDATE", - 3: "MEMBERSHIP_UPDATE_MESSAGE", - 4: "PAIR_INSTALLATION", - 5: "SYNC_INSTALLATION", - 6: "REQUEST_ADDRESS_FOR_TRANSACTION", - 7: "ACCEPT_REQUEST_ADDRESS_FOR_TRANSACTION", - 8: "DECLINE_REQUEST_ADDRESS_FOR_TRANSACTION", - 9: "REQUEST_TRANSACTION", - 10: "SEND_TRANSACTION", - 11: "DECLINE_REQUEST_TRANSACTION", - 12: "SYNC_INSTALLATION_CONTACT", - 13: "SYNC_INSTALLATION_ACCOUNT", - 14: "SYNC_INSTALLATION_PUBLIC_CHAT", -} - -var ApplicationMetadataMessage_Type_value = map[string]int32{ - "UNKNOWN": 0, - "CHAT_MESSAGE": 1, - "CONTACT_UPDATE": 2, - "MEMBERSHIP_UPDATE_MESSAGE": 3, - "PAIR_INSTALLATION": 4, - "SYNC_INSTALLATION": 5, - "REQUEST_ADDRESS_FOR_TRANSACTION": 6, - "ACCEPT_REQUEST_ADDRESS_FOR_TRANSACTION": 7, - "DECLINE_REQUEST_ADDRESS_FOR_TRANSACTION": 8, - "REQUEST_TRANSACTION": 9, - "SEND_TRANSACTION": 10, - "DECLINE_REQUEST_TRANSACTION": 11, - "SYNC_INSTALLATION_CONTACT": 12, - "SYNC_INSTALLATION_ACCOUNT": 13, - "SYNC_INSTALLATION_PUBLIC_CHAT": 14, -} - -func (x ApplicationMetadataMessage_Type) String() string { - return proto.EnumName(ApplicationMetadataMessage_Type_name, int32(x)) -} - -func (ApplicationMetadataMessage_Type) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_ad09a6406fcf24c7, []int{0, 0} -} - -type ApplicationMetadataMessage struct { - // Signature of the payload field - Signature []byte `protobuf:"bytes,1,opt,name=signature,proto3" json:"signature,omitempty"` - // This is the encoded protobuf of the application level message, i.e ChatMessage - Payload []byte `protobuf:"bytes,2,opt,name=payload,proto3" json:"payload,omitempty"` - // The type of protobuf message sent - Type ApplicationMetadataMessage_Type `protobuf:"varint,3,opt,name=type,proto3,enum=protobuf.ApplicationMetadataMessage_Type" json:"type,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ApplicationMetadataMessage) Reset() { *m = ApplicationMetadataMessage{} } -func (m *ApplicationMetadataMessage) String() string { return proto.CompactTextString(m) } -func (*ApplicationMetadataMessage) ProtoMessage() {} -func (*ApplicationMetadataMessage) Descriptor() ([]byte, []int) { - return fileDescriptor_ad09a6406fcf24c7, []int{0} -} - -func (m *ApplicationMetadataMessage) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ApplicationMetadataMessage.Unmarshal(m, b) -} -func (m *ApplicationMetadataMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ApplicationMetadataMessage.Marshal(b, m, deterministic) -} -func (m *ApplicationMetadataMessage) XXX_Merge(src proto.Message) { - xxx_messageInfo_ApplicationMetadataMessage.Merge(m, src) -} -func (m *ApplicationMetadataMessage) XXX_Size() int { - return xxx_messageInfo_ApplicationMetadataMessage.Size(m) -} -func (m *ApplicationMetadataMessage) XXX_DiscardUnknown() { - xxx_messageInfo_ApplicationMetadataMessage.DiscardUnknown(m) -} - -var xxx_messageInfo_ApplicationMetadataMessage proto.InternalMessageInfo - -func (m *ApplicationMetadataMessage) GetSignature() []byte { - if m != nil { - return m.Signature - } - return nil -} - -func (m *ApplicationMetadataMessage) GetPayload() []byte { - if m != nil { - return m.Payload - } - return nil -} - -func (m *ApplicationMetadataMessage) GetType() ApplicationMetadataMessage_Type { - if m != nil { - return m.Type - } - return ApplicationMetadataMessage_UNKNOWN -} - -func init() { - proto.RegisterEnum("protobuf.ApplicationMetadataMessage_Type", ApplicationMetadataMessage_Type_name, ApplicationMetadataMessage_Type_value) - proto.RegisterType((*ApplicationMetadataMessage)(nil), "protobuf.ApplicationMetadataMessage") -} - -func init() { proto.RegisterFile("application_metadata_message.proto", fileDescriptor_ad09a6406fcf24c7) } - -var fileDescriptor_ad09a6406fcf24c7 = []byte{ - // 377 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x91, 0xcf, 0x8e, 0xd3, 0x30, - 0x10, 0xc6, 0xc9, 0x36, 0x6c, 0x77, 0x67, 0x4b, 0x65, 0x06, 0x10, 0xe1, 0xcf, 0x6a, 0x97, 0x22, - 0xc1, 0x02, 0x52, 0x0e, 0x70, 0xe6, 0xe0, 0x75, 0x0c, 0x1b, 0x91, 0x38, 0xc1, 0x76, 0x84, 0x38, - 0x59, 0x2e, 0x0d, 0x55, 0xa5, 0xb6, 0x89, 0xda, 0xf4, 0xd0, 0x07, 0xe3, 0x29, 0x78, 0x29, 0x94, - 0xd0, 0xd2, 0x96, 0x82, 0x7a, 0xb2, 0xe6, 0xfb, 0x7e, 0x9f, 0x47, 0x33, 0x03, 0x3d, 0x5b, 0x96, - 0xe3, 0xd1, 0x37, 0x5b, 0x8d, 0x8a, 0xa9, 0x99, 0xe4, 0x95, 0x1d, 0xd8, 0xca, 0x9a, 0x49, 0x3e, - 0x9f, 0xdb, 0x61, 0xee, 0x97, 0xb3, 0xa2, 0x2a, 0xf0, 0xa4, 0x79, 0xfa, 0x8b, 0xef, 0xbd, 0x9f, - 0x2e, 0x3c, 0xa6, 0x9b, 0x40, 0xbc, 0xe2, 0xe3, 0xdf, 0x38, 0x3e, 0x85, 0xd3, 0xf9, 0x68, 0x38, - 0xb5, 0xd5, 0x62, 0x96, 0x7b, 0xce, 0xa5, 0x73, 0xd5, 0x91, 0x1b, 0x01, 0x3d, 0x68, 0x97, 0x76, - 0x39, 0x2e, 0xec, 0xc0, 0x3b, 0x6a, 0xbc, 0x75, 0x89, 0xef, 0xc1, 0xad, 0x96, 0x65, 0xee, 0xb5, - 0x2e, 0x9d, 0xab, 0xee, 0xdb, 0x57, 0xfe, 0xba, 0x9f, 0xff, 0xff, 0x5e, 0xbe, 0x5e, 0x96, 0xb9, - 0x6c, 0x62, 0xbd, 0x1f, 0x2d, 0x70, 0xeb, 0x12, 0xcf, 0xa0, 0x9d, 0x89, 0x4f, 0x22, 0xf9, 0x22, - 0xc8, 0x2d, 0x24, 0xd0, 0x61, 0x37, 0x54, 0x9b, 0x98, 0x2b, 0x45, 0x3f, 0x72, 0xe2, 0x20, 0x42, - 0x97, 0x25, 0x42, 0x53, 0xa6, 0x4d, 0x96, 0x06, 0x54, 0x73, 0x72, 0x84, 0xe7, 0xf0, 0x28, 0xe6, - 0xf1, 0x35, 0x97, 0xea, 0x26, 0x4c, 0x57, 0xf2, 0x9f, 0x48, 0x0b, 0x1f, 0xc0, 0xdd, 0x94, 0x86, - 0xd2, 0x84, 0x42, 0x69, 0x1a, 0x45, 0x54, 0x87, 0x89, 0x20, 0x6e, 0x2d, 0xab, 0xaf, 0x82, 0xed, - 0xca, 0xb7, 0xf1, 0x39, 0x5c, 0x48, 0xfe, 0x39, 0xe3, 0x4a, 0x1b, 0x1a, 0x04, 0x92, 0x2b, 0x65, - 0x3e, 0x24, 0xd2, 0x68, 0x49, 0x85, 0xa2, 0xac, 0x81, 0x8e, 0xf1, 0x35, 0xbc, 0xa0, 0x8c, 0xf1, - 0x54, 0x9b, 0x43, 0x6c, 0x1b, 0xdf, 0xc0, 0xcb, 0x80, 0xb3, 0x28, 0x14, 0xfc, 0x20, 0x7c, 0x82, - 0x0f, 0xe1, 0xde, 0x1a, 0xda, 0x36, 0x4e, 0xf1, 0x3e, 0x10, 0xc5, 0x45, 0xb0, 0xa3, 0x02, 0x5e, - 0xc0, 0x93, 0xbf, 0xff, 0xde, 0x06, 0xce, 0xea, 0xd5, 0xec, 0x0d, 0x69, 0x56, 0x0b, 0x24, 0x9d, - 0x7f, 0xdb, 0x94, 0xb1, 0x24, 0x13, 0x9a, 0xdc, 0xc1, 0x67, 0x70, 0xbe, 0x6f, 0xa7, 0xd9, 0x75, - 0x14, 0x32, 0x53, 0xdf, 0x85, 0x74, 0xfb, 0xc7, 0xcd, 0x9d, 0xdf, 0xfd, 0x0a, 0x00, 0x00, 0xff, - 0xff, 0xb7, 0x6c, 0xd6, 0xba, 0x84, 0x02, 0x00, 0x00, -} diff --git a/vendor/github.com/status-im/status-go/protocol/protobuf/application_metadata_message.proto b/vendor/github.com/status-im/status-go/protocol/protobuf/application_metadata_message.proto deleted file mode 100644 index dae1d78be..000000000 --- a/vendor/github.com/status-im/status-go/protocol/protobuf/application_metadata_message.proto +++ /dev/null @@ -1,31 +0,0 @@ -syntax = "proto3"; - -package protobuf; - -message ApplicationMetadataMessage { - // Signature of the payload field - bytes signature = 1; - // This is the encoded protobuf of the application level message, i.e ChatMessage - bytes payload = 2; - - // The type of protobuf message sent - Type type = 3; - - enum Type { - UNKNOWN = 0; - CHAT_MESSAGE = 1; - CONTACT_UPDATE = 2; - MEMBERSHIP_UPDATE_MESSAGE = 3; - PAIR_INSTALLATION = 4; - SYNC_INSTALLATION = 5; - REQUEST_ADDRESS_FOR_TRANSACTION = 6; - ACCEPT_REQUEST_ADDRESS_FOR_TRANSACTION = 7; - DECLINE_REQUEST_ADDRESS_FOR_TRANSACTION = 8; - REQUEST_TRANSACTION = 9; - SEND_TRANSACTION = 10; - DECLINE_REQUEST_TRANSACTION = 11; - SYNC_INSTALLATION_CONTACT = 12; - SYNC_INSTALLATION_ACCOUNT = 13; - SYNC_INSTALLATION_PUBLIC_CHAT = 14; - } -} diff --git a/vendor/github.com/status-im/status-go/protocol/protobuf/chat_message.pb.go b/vendor/github.com/status-im/status-go/protocol/protobuf/chat_message.pb.go deleted file mode 100644 index 49247f30c..000000000 --- a/vendor/github.com/status-im/status-go/protocol/protobuf/chat_message.pb.go +++ /dev/null @@ -1,323 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: chat_message.proto - -package protobuf - -import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - math "math" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - -type ChatMessage_MessageType int32 - -const ( - ChatMessage_UNKNOWN_MESSAGE_TYPE ChatMessage_MessageType = 0 - ChatMessage_ONE_TO_ONE ChatMessage_MessageType = 1 - ChatMessage_PUBLIC_GROUP ChatMessage_MessageType = 2 - ChatMessage_PRIVATE_GROUP ChatMessage_MessageType = 3 - // Only local - ChatMessage_SYSTEM_MESSAGE_PRIVATE_GROUP ChatMessage_MessageType = 4 -) - -var ChatMessage_MessageType_name = map[int32]string{ - 0: "UNKNOWN_MESSAGE_TYPE", - 1: "ONE_TO_ONE", - 2: "PUBLIC_GROUP", - 3: "PRIVATE_GROUP", - 4: "SYSTEM_MESSAGE_PRIVATE_GROUP", -} - -var ChatMessage_MessageType_value = map[string]int32{ - "UNKNOWN_MESSAGE_TYPE": 0, - "ONE_TO_ONE": 1, - "PUBLIC_GROUP": 2, - "PRIVATE_GROUP": 3, - "SYSTEM_MESSAGE_PRIVATE_GROUP": 4, -} - -func (x ChatMessage_MessageType) String() string { - return proto.EnumName(ChatMessage_MessageType_name, int32(x)) -} - -func (ChatMessage_MessageType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_263952f55fd35689, []int{1, 0} -} - -type ChatMessage_ContentType int32 - -const ( - ChatMessage_UNKNOWN_CONTENT_TYPE ChatMessage_ContentType = 0 - ChatMessage_TEXT_PLAIN ChatMessage_ContentType = 1 - ChatMessage_STICKER ChatMessage_ContentType = 2 - ChatMessage_STATUS ChatMessage_ContentType = 3 - ChatMessage_EMOJI ChatMessage_ContentType = 4 - ChatMessage_TRANSACTION_COMMAND ChatMessage_ContentType = 5 -) - -var ChatMessage_ContentType_name = map[int32]string{ - 0: "UNKNOWN_CONTENT_TYPE", - 1: "TEXT_PLAIN", - 2: "STICKER", - 3: "STATUS", - 4: "EMOJI", - 5: "TRANSACTION_COMMAND", -} - -var ChatMessage_ContentType_value = map[string]int32{ - "UNKNOWN_CONTENT_TYPE": 0, - "TEXT_PLAIN": 1, - "STICKER": 2, - "STATUS": 3, - "EMOJI": 4, - "TRANSACTION_COMMAND": 5, -} - -func (x ChatMessage_ContentType) String() string { - return proto.EnumName(ChatMessage_ContentType_name, int32(x)) -} - -func (ChatMessage_ContentType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_263952f55fd35689, []int{1, 1} -} - -type StickerMessage struct { - Hash string `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` - Pack int32 `protobuf:"varint,2,opt,name=pack,proto3" json:"pack,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *StickerMessage) Reset() { *m = StickerMessage{} } -func (m *StickerMessage) String() string { return proto.CompactTextString(m) } -func (*StickerMessage) ProtoMessage() {} -func (*StickerMessage) Descriptor() ([]byte, []int) { - return fileDescriptor_263952f55fd35689, []int{0} -} - -func (m *StickerMessage) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_StickerMessage.Unmarshal(m, b) -} -func (m *StickerMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_StickerMessage.Marshal(b, m, deterministic) -} -func (m *StickerMessage) XXX_Merge(src proto.Message) { - xxx_messageInfo_StickerMessage.Merge(m, src) -} -func (m *StickerMessage) XXX_Size() int { - return xxx_messageInfo_StickerMessage.Size(m) -} -func (m *StickerMessage) XXX_DiscardUnknown() { - xxx_messageInfo_StickerMessage.DiscardUnknown(m) -} - -var xxx_messageInfo_StickerMessage proto.InternalMessageInfo - -func (m *StickerMessage) GetHash() string { - if m != nil { - return m.Hash - } - return "" -} - -func (m *StickerMessage) GetPack() int32 { - if m != nil { - return m.Pack - } - return 0 -} - -type ChatMessage struct { - // Lamport timestamp of the chat message - Clock uint64 `protobuf:"varint,1,opt,name=clock,proto3" json:"clock,omitempty"` - // Unix timestamps in milliseconds, currently not used as we use whisper as more reliable, but here - // so that we don't rely on it - Timestamp uint64 `protobuf:"varint,2,opt,name=timestamp,proto3" json:"timestamp,omitempty"` - // Text of the message - Text string `protobuf:"bytes,3,opt,name=text,proto3" json:"text,omitempty"` - // Id of the message that we are replying to - ResponseTo string `protobuf:"bytes,4,opt,name=response_to,json=responseTo,proto3" json:"response_to,omitempty"` - // Ens name of the sender - EnsName string `protobuf:"bytes,5,opt,name=ens_name,json=ensName,proto3" json:"ens_name,omitempty"` - // Chat id, this field is symmetric for public-chats and private group chats, - // but asymmetric in case of one-to-ones, as the sender will use the chat-id - // of the received, while the receiver will use the chat-id of the sender. - // Probably should be the concatenation of sender-pk & receiver-pk in alphabetical order - ChatId string `protobuf:"bytes,6,opt,name=chat_id,json=chatId,proto3" json:"chat_id,omitempty"` - // The type of message (public/one-to-one/private-group-chat) - MessageType ChatMessage_MessageType `protobuf:"varint,7,opt,name=message_type,json=messageType,proto3,enum=protobuf.ChatMessage_MessageType" json:"message_type,omitempty"` - // The type of the content of the message - ContentType ChatMessage_ContentType `protobuf:"varint,8,opt,name=content_type,json=contentType,proto3,enum=protobuf.ChatMessage_ContentType" json:"content_type,omitempty"` - // Types that are valid to be assigned to Payload: - // *ChatMessage_Sticker - Payload isChatMessage_Payload `protobuf_oneof:"payload"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ChatMessage) Reset() { *m = ChatMessage{} } -func (m *ChatMessage) String() string { return proto.CompactTextString(m) } -func (*ChatMessage) ProtoMessage() {} -func (*ChatMessage) Descriptor() ([]byte, []int) { - return fileDescriptor_263952f55fd35689, []int{1} -} - -func (m *ChatMessage) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ChatMessage.Unmarshal(m, b) -} -func (m *ChatMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ChatMessage.Marshal(b, m, deterministic) -} -func (m *ChatMessage) XXX_Merge(src proto.Message) { - xxx_messageInfo_ChatMessage.Merge(m, src) -} -func (m *ChatMessage) XXX_Size() int { - return xxx_messageInfo_ChatMessage.Size(m) -} -func (m *ChatMessage) XXX_DiscardUnknown() { - xxx_messageInfo_ChatMessage.DiscardUnknown(m) -} - -var xxx_messageInfo_ChatMessage proto.InternalMessageInfo - -func (m *ChatMessage) GetClock() uint64 { - if m != nil { - return m.Clock - } - return 0 -} - -func (m *ChatMessage) GetTimestamp() uint64 { - if m != nil { - return m.Timestamp - } - return 0 -} - -func (m *ChatMessage) GetText() string { - if m != nil { - return m.Text - } - return "" -} - -func (m *ChatMessage) GetResponseTo() string { - if m != nil { - return m.ResponseTo - } - return "" -} - -func (m *ChatMessage) GetEnsName() string { - if m != nil { - return m.EnsName - } - return "" -} - -func (m *ChatMessage) GetChatId() string { - if m != nil { - return m.ChatId - } - return "" -} - -func (m *ChatMessage) GetMessageType() ChatMessage_MessageType { - if m != nil { - return m.MessageType - } - return ChatMessage_UNKNOWN_MESSAGE_TYPE -} - -func (m *ChatMessage) GetContentType() ChatMessage_ContentType { - if m != nil { - return m.ContentType - } - return ChatMessage_UNKNOWN_CONTENT_TYPE -} - -type isChatMessage_Payload interface { - isChatMessage_Payload() -} - -type ChatMessage_Sticker struct { - Sticker *StickerMessage `protobuf:"bytes,9,opt,name=sticker,proto3,oneof"` -} - -func (*ChatMessage_Sticker) isChatMessage_Payload() {} - -func (m *ChatMessage) GetPayload() isChatMessage_Payload { - if m != nil { - return m.Payload - } - return nil -} - -func (m *ChatMessage) GetSticker() *StickerMessage { - if x, ok := m.GetPayload().(*ChatMessage_Sticker); ok { - return x.Sticker - } - return nil -} - -// XXX_OneofWrappers is for the internal use of the proto package. -func (*ChatMessage) XXX_OneofWrappers() []interface{} { - return []interface{}{ - (*ChatMessage_Sticker)(nil), - } -} - -func init() { - proto.RegisterEnum("protobuf.ChatMessage_MessageType", ChatMessage_MessageType_name, ChatMessage_MessageType_value) - proto.RegisterEnum("protobuf.ChatMessage_ContentType", ChatMessage_ContentType_name, ChatMessage_ContentType_value) - proto.RegisterType((*StickerMessage)(nil), "protobuf.StickerMessage") - proto.RegisterType((*ChatMessage)(nil), "protobuf.ChatMessage") -} - -func init() { proto.RegisterFile("chat_message.proto", fileDescriptor_263952f55fd35689) } - -var fileDescriptor_263952f55fd35689 = []byte{ - // 460 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x91, 0x4d, 0x6f, 0xd3, 0x4c, - 0x10, 0xc7, 0xeb, 0xc4, 0x89, 0x93, 0x71, 0x9f, 0xc8, 0xcf, 0x52, 0xa9, 0x8b, 0x54, 0x89, 0x90, - 0x53, 0x4e, 0x39, 0x14, 0x0e, 0x5c, 0x5d, 0x77, 0x55, 0x4c, 0xeb, 0xb5, 0xb5, 0xde, 0x00, 0x3d, - 0xad, 0xb6, 0xce, 0x42, 0xa2, 0xd4, 0x2f, 0x8a, 0x17, 0x89, 0x5c, 0xf8, 0xc6, 0x7c, 0x07, 0xe4, - 0x75, 0x42, 0xdc, 0x0b, 0xa7, 0x9d, 0x97, 0xff, 0xfc, 0xc6, 0xf3, 0x37, 0xa0, 0x6c, 0x2d, 0xb5, - 0xc8, 0x55, 0x5d, 0xcb, 0xef, 0x6a, 0x51, 0xed, 0x4a, 0x5d, 0xa2, 0x91, 0x79, 0x9e, 0x7e, 0x7c, - 0x9b, 0x7d, 0x80, 0x49, 0xaa, 0x37, 0xd9, 0x56, 0xed, 0xa2, 0x56, 0x81, 0x10, 0xd8, 0x6b, 0x59, - 0xaf, 0xb1, 0x35, 0xb5, 0xe6, 0x63, 0x66, 0xe2, 0xa6, 0x56, 0xc9, 0x6c, 0x8b, 0x7b, 0x53, 0x6b, - 0x3e, 0x60, 0x26, 0x9e, 0xfd, 0xb6, 0xc1, 0x0d, 0xd6, 0x52, 0x1f, 0xe7, 0x2e, 0x60, 0x90, 0x3d, - 0x97, 0xd9, 0xd6, 0x0c, 0xda, 0xac, 0x4d, 0xd0, 0x15, 0x8c, 0xf5, 0x26, 0x57, 0xb5, 0x96, 0x79, - 0x65, 0xc6, 0x6d, 0x76, 0x2a, 0x34, 0x5c, 0xad, 0x7e, 0x6a, 0xdc, 0x6f, 0x77, 0x35, 0x31, 0x7a, - 0x03, 0xee, 0x4e, 0xd5, 0x55, 0x59, 0xd4, 0x4a, 0xe8, 0x12, 0xdb, 0xa6, 0x05, 0xc7, 0x12, 0x2f, - 0xd1, 0x6b, 0x18, 0xa9, 0xa2, 0x16, 0x85, 0xcc, 0x15, 0x1e, 0x98, 0xae, 0xa3, 0x8a, 0x9a, 0xca, - 0x5c, 0xa1, 0x4b, 0x70, 0xcc, 0xb5, 0x9b, 0x15, 0x1e, 0x9a, 0xce, 0xb0, 0x49, 0xc3, 0x15, 0xba, - 0x85, 0xf3, 0x83, 0x03, 0x42, 0xef, 0x2b, 0x85, 0x9d, 0xa9, 0x35, 0x9f, 0x5c, 0xbf, 0x5d, 0x1c, - 0x7d, 0x58, 0x74, 0x2e, 0x59, 0x1c, 0x5e, 0xbe, 0xaf, 0x14, 0x73, 0xf3, 0x53, 0xd2, 0x50, 0xb2, - 0xb2, 0xd0, 0xaa, 0xd0, 0x2d, 0x65, 0xf4, 0x2f, 0x4a, 0xd0, 0x2a, 0x5b, 0x4a, 0x76, 0x4a, 0xd0, - 0x7b, 0x70, 0xea, 0xd6, 0x72, 0x3c, 0x9e, 0x5a, 0x73, 0xf7, 0x1a, 0x9f, 0x00, 0x2f, 0xff, 0xc5, - 0xc7, 0x33, 0x76, 0x94, 0xce, 0x7e, 0x81, 0xdb, 0xf9, 0x2e, 0x84, 0xe1, 0x62, 0x49, 0xef, 0x69, - 0xfc, 0x85, 0x8a, 0x88, 0xa4, 0xa9, 0x7f, 0x47, 0x04, 0x7f, 0x4c, 0x88, 0x77, 0x86, 0x26, 0x00, - 0x31, 0x25, 0x82, 0xc7, 0x22, 0xa6, 0xc4, 0xb3, 0x90, 0x07, 0xe7, 0xc9, 0xf2, 0xe6, 0x21, 0x0c, - 0xc4, 0x1d, 0x8b, 0x97, 0x89, 0xd7, 0x43, 0xff, 0xc3, 0x7f, 0x09, 0x0b, 0x3f, 0xfb, 0x9c, 0x1c, - 0x4a, 0x7d, 0x34, 0x85, 0xab, 0xf4, 0x31, 0xe5, 0x24, 0xfa, 0x4b, 0x7b, 0xa9, 0xb0, 0x67, 0x1a, - 0xdc, 0xce, 0x45, 0xdd, 0xfd, 0x41, 0x4c, 0x39, 0xa1, 0xbc, 0xb3, 0x9f, 0x93, 0xaf, 0x5c, 0x24, - 0x0f, 0x7e, 0x48, 0x3d, 0x0b, 0xb9, 0xe0, 0xa4, 0x3c, 0x0c, 0xee, 0x09, 0xf3, 0x7a, 0x08, 0x60, - 0x98, 0x72, 0x9f, 0x2f, 0x53, 0xaf, 0x8f, 0xc6, 0x30, 0x20, 0x51, 0xfc, 0x29, 0xf4, 0x6c, 0x74, - 0x09, 0xaf, 0x38, 0xf3, 0x69, 0xea, 0x07, 0x3c, 0x8c, 0x1b, 0x62, 0x14, 0xf9, 0xf4, 0xd6, 0x1b, - 0xdc, 0x8c, 0xc1, 0xa9, 0xe4, 0xfe, 0xb9, 0x94, 0xab, 0xa7, 0xa1, 0x31, 0xe9, 0xdd, 0x9f, 0x00, - 0x00, 0x00, 0xff, 0xff, 0x54, 0x6d, 0xd5, 0x10, 0xd0, 0x02, 0x00, 0x00, -} diff --git a/vendor/github.com/status-im/status-go/protocol/protobuf/chat_message.proto b/vendor/github.com/status-im/status-go/protocol/protobuf/chat_message.proto deleted file mode 100644 index 8dbb5f6e1..000000000 --- a/vendor/github.com/status-im/status-go/protocol/protobuf/chat_message.proto +++ /dev/null @@ -1,53 +0,0 @@ -syntax = "proto3"; - -package protobuf; - -message StickerMessage { - string hash = 1; - int32 pack = 2; -} - -message ChatMessage { - // Lamport timestamp of the chat message - uint64 clock = 1; - // Unix timestamps in milliseconds, currently not used as we use whisper as more reliable, but here - // so that we don't rely on it - uint64 timestamp = 2; - // Text of the message - string text = 3; - // Id of the message that we are replying to - string response_to = 4; - // Ens name of the sender - string ens_name = 5; - // Chat id, this field is symmetric for public-chats and private group chats, - // but asymmetric in case of one-to-ones, as the sender will use the chat-id - // of the received, while the receiver will use the chat-id of the sender. - // Probably should be the concatenation of sender-pk & receiver-pk in alphabetical order - string chat_id = 6; - - // The type of message (public/one-to-one/private-group-chat) - MessageType message_type = 7; - // The type of the content of the message - ContentType content_type = 8; - - oneof payload { - StickerMessage sticker = 9; - } - - enum MessageType { - UNKNOWN_MESSAGE_TYPE = 0; - ONE_TO_ONE = 1; - PUBLIC_GROUP = 2; - PRIVATE_GROUP = 3; - // Only local - SYSTEM_MESSAGE_PRIVATE_GROUP = 4; - } - enum ContentType { - UNKNOWN_CONTENT_TYPE = 0; - TEXT_PLAIN = 1; - STICKER = 2; - STATUS = 3; - EMOJI = 4; - TRANSACTION_COMMAND = 5; - } -} diff --git a/vendor/github.com/status-im/status-go/protocol/protobuf/command.pb.go b/vendor/github.com/status-im/status-go/protocol/protobuf/command.pb.go deleted file mode 100644 index c2a959938..000000000 --- a/vendor/github.com/status-im/status-go/protocol/protobuf/command.pb.go +++ /dev/null @@ -1,383 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: command.proto - -package protobuf - -import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - math "math" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - -type RequestAddressForTransaction struct { - Clock uint64 `protobuf:"varint,1,opt,name=clock,proto3" json:"clock,omitempty"` - Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` - Contract string `protobuf:"bytes,3,opt,name=contract,proto3" json:"contract,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *RequestAddressForTransaction) Reset() { *m = RequestAddressForTransaction{} } -func (m *RequestAddressForTransaction) String() string { return proto.CompactTextString(m) } -func (*RequestAddressForTransaction) ProtoMessage() {} -func (*RequestAddressForTransaction) Descriptor() ([]byte, []int) { - return fileDescriptor_213c0bb044472049, []int{0} -} - -func (m *RequestAddressForTransaction) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RequestAddressForTransaction.Unmarshal(m, b) -} -func (m *RequestAddressForTransaction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RequestAddressForTransaction.Marshal(b, m, deterministic) -} -func (m *RequestAddressForTransaction) XXX_Merge(src proto.Message) { - xxx_messageInfo_RequestAddressForTransaction.Merge(m, src) -} -func (m *RequestAddressForTransaction) XXX_Size() int { - return xxx_messageInfo_RequestAddressForTransaction.Size(m) -} -func (m *RequestAddressForTransaction) XXX_DiscardUnknown() { - xxx_messageInfo_RequestAddressForTransaction.DiscardUnknown(m) -} - -var xxx_messageInfo_RequestAddressForTransaction proto.InternalMessageInfo - -func (m *RequestAddressForTransaction) GetClock() uint64 { - if m != nil { - return m.Clock - } - return 0 -} - -func (m *RequestAddressForTransaction) GetValue() string { - if m != nil { - return m.Value - } - return "" -} - -func (m *RequestAddressForTransaction) GetContract() string { - if m != nil { - return m.Contract - } - return "" -} - -type AcceptRequestAddressForTransaction struct { - Clock uint64 `protobuf:"varint,1,opt,name=clock,proto3" json:"clock,omitempty"` - Id string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"` - Address string `protobuf:"bytes,3,opt,name=address,proto3" json:"address,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *AcceptRequestAddressForTransaction) Reset() { *m = AcceptRequestAddressForTransaction{} } -func (m *AcceptRequestAddressForTransaction) String() string { return proto.CompactTextString(m) } -func (*AcceptRequestAddressForTransaction) ProtoMessage() {} -func (*AcceptRequestAddressForTransaction) Descriptor() ([]byte, []int) { - return fileDescriptor_213c0bb044472049, []int{1} -} - -func (m *AcceptRequestAddressForTransaction) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_AcceptRequestAddressForTransaction.Unmarshal(m, b) -} -func (m *AcceptRequestAddressForTransaction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_AcceptRequestAddressForTransaction.Marshal(b, m, deterministic) -} -func (m *AcceptRequestAddressForTransaction) XXX_Merge(src proto.Message) { - xxx_messageInfo_AcceptRequestAddressForTransaction.Merge(m, src) -} -func (m *AcceptRequestAddressForTransaction) XXX_Size() int { - return xxx_messageInfo_AcceptRequestAddressForTransaction.Size(m) -} -func (m *AcceptRequestAddressForTransaction) XXX_DiscardUnknown() { - xxx_messageInfo_AcceptRequestAddressForTransaction.DiscardUnknown(m) -} - -var xxx_messageInfo_AcceptRequestAddressForTransaction proto.InternalMessageInfo - -func (m *AcceptRequestAddressForTransaction) GetClock() uint64 { - if m != nil { - return m.Clock - } - return 0 -} - -func (m *AcceptRequestAddressForTransaction) GetId() string { - if m != nil { - return m.Id - } - return "" -} - -func (m *AcceptRequestAddressForTransaction) GetAddress() string { - if m != nil { - return m.Address - } - return "" -} - -type DeclineRequestAddressForTransaction struct { - Clock uint64 `protobuf:"varint,1,opt,name=clock,proto3" json:"clock,omitempty"` - Id string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *DeclineRequestAddressForTransaction) Reset() { *m = DeclineRequestAddressForTransaction{} } -func (m *DeclineRequestAddressForTransaction) String() string { return proto.CompactTextString(m) } -func (*DeclineRequestAddressForTransaction) ProtoMessage() {} -func (*DeclineRequestAddressForTransaction) Descriptor() ([]byte, []int) { - return fileDescriptor_213c0bb044472049, []int{2} -} - -func (m *DeclineRequestAddressForTransaction) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_DeclineRequestAddressForTransaction.Unmarshal(m, b) -} -func (m *DeclineRequestAddressForTransaction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_DeclineRequestAddressForTransaction.Marshal(b, m, deterministic) -} -func (m *DeclineRequestAddressForTransaction) XXX_Merge(src proto.Message) { - xxx_messageInfo_DeclineRequestAddressForTransaction.Merge(m, src) -} -func (m *DeclineRequestAddressForTransaction) XXX_Size() int { - return xxx_messageInfo_DeclineRequestAddressForTransaction.Size(m) -} -func (m *DeclineRequestAddressForTransaction) XXX_DiscardUnknown() { - xxx_messageInfo_DeclineRequestAddressForTransaction.DiscardUnknown(m) -} - -var xxx_messageInfo_DeclineRequestAddressForTransaction proto.InternalMessageInfo - -func (m *DeclineRequestAddressForTransaction) GetClock() uint64 { - if m != nil { - return m.Clock - } - return 0 -} - -func (m *DeclineRequestAddressForTransaction) GetId() string { - if m != nil { - return m.Id - } - return "" -} - -type DeclineRequestTransaction struct { - Clock uint64 `protobuf:"varint,1,opt,name=clock,proto3" json:"clock,omitempty"` - Id string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *DeclineRequestTransaction) Reset() { *m = DeclineRequestTransaction{} } -func (m *DeclineRequestTransaction) String() string { return proto.CompactTextString(m) } -func (*DeclineRequestTransaction) ProtoMessage() {} -func (*DeclineRequestTransaction) Descriptor() ([]byte, []int) { - return fileDescriptor_213c0bb044472049, []int{3} -} - -func (m *DeclineRequestTransaction) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_DeclineRequestTransaction.Unmarshal(m, b) -} -func (m *DeclineRequestTransaction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_DeclineRequestTransaction.Marshal(b, m, deterministic) -} -func (m *DeclineRequestTransaction) XXX_Merge(src proto.Message) { - xxx_messageInfo_DeclineRequestTransaction.Merge(m, src) -} -func (m *DeclineRequestTransaction) XXX_Size() int { - return xxx_messageInfo_DeclineRequestTransaction.Size(m) -} -func (m *DeclineRequestTransaction) XXX_DiscardUnknown() { - xxx_messageInfo_DeclineRequestTransaction.DiscardUnknown(m) -} - -var xxx_messageInfo_DeclineRequestTransaction proto.InternalMessageInfo - -func (m *DeclineRequestTransaction) GetClock() uint64 { - if m != nil { - return m.Clock - } - return 0 -} - -func (m *DeclineRequestTransaction) GetId() string { - if m != nil { - return m.Id - } - return "" -} - -type RequestTransaction struct { - Clock uint64 `protobuf:"varint,1,opt,name=clock,proto3" json:"clock,omitempty"` - Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"` - Value string `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` - Contract string `protobuf:"bytes,4,opt,name=contract,proto3" json:"contract,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *RequestTransaction) Reset() { *m = RequestTransaction{} } -func (m *RequestTransaction) String() string { return proto.CompactTextString(m) } -func (*RequestTransaction) ProtoMessage() {} -func (*RequestTransaction) Descriptor() ([]byte, []int) { - return fileDescriptor_213c0bb044472049, []int{4} -} - -func (m *RequestTransaction) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RequestTransaction.Unmarshal(m, b) -} -func (m *RequestTransaction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RequestTransaction.Marshal(b, m, deterministic) -} -func (m *RequestTransaction) XXX_Merge(src proto.Message) { - xxx_messageInfo_RequestTransaction.Merge(m, src) -} -func (m *RequestTransaction) XXX_Size() int { - return xxx_messageInfo_RequestTransaction.Size(m) -} -func (m *RequestTransaction) XXX_DiscardUnknown() { - xxx_messageInfo_RequestTransaction.DiscardUnknown(m) -} - -var xxx_messageInfo_RequestTransaction proto.InternalMessageInfo - -func (m *RequestTransaction) GetClock() uint64 { - if m != nil { - return m.Clock - } - return 0 -} - -func (m *RequestTransaction) GetAddress() string { - if m != nil { - return m.Address - } - return "" -} - -func (m *RequestTransaction) GetValue() string { - if m != nil { - return m.Value - } - return "" -} - -func (m *RequestTransaction) GetContract() string { - if m != nil { - return m.Contract - } - return "" -} - -type SendTransaction struct { - Clock uint64 `protobuf:"varint,1,opt,name=clock,proto3" json:"clock,omitempty"` - Id string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"` - TransactionHash string `protobuf:"bytes,3,opt,name=transaction_hash,json=transactionHash,proto3" json:"transaction_hash,omitempty"` - Signature []byte `protobuf:"bytes,4,opt,name=signature,proto3" json:"signature,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SendTransaction) Reset() { *m = SendTransaction{} } -func (m *SendTransaction) String() string { return proto.CompactTextString(m) } -func (*SendTransaction) ProtoMessage() {} -func (*SendTransaction) Descriptor() ([]byte, []int) { - return fileDescriptor_213c0bb044472049, []int{5} -} - -func (m *SendTransaction) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SendTransaction.Unmarshal(m, b) -} -func (m *SendTransaction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SendTransaction.Marshal(b, m, deterministic) -} -func (m *SendTransaction) XXX_Merge(src proto.Message) { - xxx_messageInfo_SendTransaction.Merge(m, src) -} -func (m *SendTransaction) XXX_Size() int { - return xxx_messageInfo_SendTransaction.Size(m) -} -func (m *SendTransaction) XXX_DiscardUnknown() { - xxx_messageInfo_SendTransaction.DiscardUnknown(m) -} - -var xxx_messageInfo_SendTransaction proto.InternalMessageInfo - -func (m *SendTransaction) GetClock() uint64 { - if m != nil { - return m.Clock - } - return 0 -} - -func (m *SendTransaction) GetId() string { - if m != nil { - return m.Id - } - return "" -} - -func (m *SendTransaction) GetTransactionHash() string { - if m != nil { - return m.TransactionHash - } - return "" -} - -func (m *SendTransaction) GetSignature() []byte { - if m != nil { - return m.Signature - } - return nil -} - -func init() { - proto.RegisterType((*RequestAddressForTransaction)(nil), "protobuf.RequestAddressForTransaction") - proto.RegisterType((*AcceptRequestAddressForTransaction)(nil), "protobuf.AcceptRequestAddressForTransaction") - proto.RegisterType((*DeclineRequestAddressForTransaction)(nil), "protobuf.DeclineRequestAddressForTransaction") - proto.RegisterType((*DeclineRequestTransaction)(nil), "protobuf.DeclineRequestTransaction") - proto.RegisterType((*RequestTransaction)(nil), "protobuf.RequestTransaction") - proto.RegisterType((*SendTransaction)(nil), "protobuf.SendTransaction") -} - -func init() { proto.RegisterFile("command.proto", fileDescriptor_213c0bb044472049) } - -var fileDescriptor_213c0bb044472049 = []byte{ - // 257 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x92, 0x41, 0x4b, 0x03, 0x31, - 0x10, 0x85, 0xd9, 0x6d, 0xd5, 0x76, 0x50, 0x2b, 0xc1, 0xc3, 0x2a, 0x3d, 0x94, 0x78, 0xa9, 0x17, - 0x2f, 0xfe, 0x82, 0x05, 0x11, 0xc1, 0xdb, 0xea, 0x5d, 0xa6, 0x93, 0xa9, 0x1b, 0xdc, 0x26, 0x35, - 0xc9, 0xf6, 0xec, 0x4f, 0x17, 0xb3, 0xab, 0xdb, 0x0a, 0x82, 0xab, 0xa7, 0xf0, 0x5e, 0x78, 0xf3, - 0x65, 0x1e, 0x81, 0x23, 0xb2, 0xab, 0x15, 0x1a, 0x75, 0xb5, 0x76, 0x36, 0x58, 0x31, 0x8a, 0xc7, - 0xa2, 0x5e, 0xca, 0x25, 0x4c, 0x0b, 0x7e, 0xad, 0xd9, 0x87, 0x5c, 0x29, 0xc7, 0xde, 0xdf, 0x5a, - 0xf7, 0xe8, 0xd0, 0x78, 0xa4, 0xa0, 0xad, 0x11, 0xa7, 0xb0, 0x47, 0x95, 0xa5, 0x97, 0x2c, 0x99, - 0x25, 0xf3, 0x61, 0xd1, 0x88, 0x0f, 0x77, 0x83, 0x55, 0xcd, 0x59, 0x3a, 0x4b, 0xe6, 0xe3, 0xa2, - 0x11, 0xe2, 0x1c, 0x46, 0x64, 0x4d, 0x70, 0x48, 0x21, 0x1b, 0xc4, 0x8b, 0x2f, 0x2d, 0x15, 0xc8, - 0x9c, 0x88, 0xd7, 0xe1, 0x0f, 0xb4, 0x63, 0x48, 0xb5, 0x6a, 0x51, 0xa9, 0x56, 0x22, 0x83, 0x03, - 0x6c, 0xe2, 0x2d, 0xe6, 0x53, 0xca, 0x7b, 0xb8, 0xb8, 0x61, 0xaa, 0xb4, 0xe1, 0xff, 0x63, 0x64, - 0x0e, 0x67, 0xbb, 0xc3, 0xfa, 0x8f, 0xd8, 0x80, 0xf8, 0x75, 0x76, 0x6b, 0xab, 0x74, 0x67, 0xab, - 0xae, 0xed, 0xc1, 0x4f, 0x6d, 0x0f, 0xbf, 0xb5, 0xfd, 0x96, 0xc0, 0xe4, 0x81, 0x8d, 0xea, 0xdf, - 0xed, 0x25, 0x9c, 0x84, 0x2e, 0xf4, 0x54, 0xa2, 0x2f, 0x5b, 0xec, 0x64, 0xcb, 0xbf, 0x43, 0x5f, - 0x8a, 0x29, 0x8c, 0xbd, 0x7e, 0x36, 0x18, 0x6a, 0xc7, 0xf1, 0x05, 0x87, 0x45, 0x67, 0x2c, 0xf6, - 0xe3, 0x17, 0xbb, 0x7e, 0x0f, 0x00, 0x00, 0xff, 0xff, 0x13, 0xdb, 0x87, 0x02, 0x7a, 0x02, 0x00, - 0x00, -} diff --git a/vendor/github.com/status-im/status-go/protocol/protobuf/command.proto b/vendor/github.com/status-im/status-go/protocol/protobuf/command.proto deleted file mode 100644 index 195e9035d..000000000 --- a/vendor/github.com/status-im/status-go/protocol/protobuf/command.proto +++ /dev/null @@ -1,39 +0,0 @@ -syntax = "proto3"; - -package protobuf; - -message RequestAddressForTransaction { - uint64 clock = 1; - string value = 2; - string contract = 3; -} - -message AcceptRequestAddressForTransaction { - uint64 clock = 1; - string id = 2; - string address = 3; -} - -message DeclineRequestAddressForTransaction { - uint64 clock = 1; - string id = 2; -} - -message DeclineRequestTransaction { - uint64 clock = 1; - string id = 2; -} - -message RequestTransaction { - uint64 clock = 1; - string address = 2; - string value = 3; - string contract = 4; -} - -message SendTransaction { - uint64 clock = 1; - string id = 2; - string transaction_hash = 3; - bytes signature = 4; -} diff --git a/vendor/github.com/status-im/status-go/protocol/protobuf/contact.pb.go b/vendor/github.com/status-im/status-go/protocol/protobuf/contact.pb.go deleted file mode 100644 index 0bc4ce7b8..000000000 --- a/vendor/github.com/status-im/status-go/protocol/protobuf/contact.pb.go +++ /dev/null @@ -1,95 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: contact.proto - -package protobuf - -import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - math "math" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - -type ContactUpdate struct { - Clock uint64 `protobuf:"varint,1,opt,name=clock,proto3" json:"clock,omitempty"` - EnsName string `protobuf:"bytes,2,opt,name=ens_name,json=ensName,proto3" json:"ens_name,omitempty"` - ProfileImage string `protobuf:"bytes,3,opt,name=profile_image,json=profileImage,proto3" json:"profile_image,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ContactUpdate) Reset() { *m = ContactUpdate{} } -func (m *ContactUpdate) String() string { return proto.CompactTextString(m) } -func (*ContactUpdate) ProtoMessage() {} -func (*ContactUpdate) Descriptor() ([]byte, []int) { - return fileDescriptor_a5036fff2565fb15, []int{0} -} - -func (m *ContactUpdate) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ContactUpdate.Unmarshal(m, b) -} -func (m *ContactUpdate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ContactUpdate.Marshal(b, m, deterministic) -} -func (m *ContactUpdate) XXX_Merge(src proto.Message) { - xxx_messageInfo_ContactUpdate.Merge(m, src) -} -func (m *ContactUpdate) XXX_Size() int { - return xxx_messageInfo_ContactUpdate.Size(m) -} -func (m *ContactUpdate) XXX_DiscardUnknown() { - xxx_messageInfo_ContactUpdate.DiscardUnknown(m) -} - -var xxx_messageInfo_ContactUpdate proto.InternalMessageInfo - -func (m *ContactUpdate) GetClock() uint64 { - if m != nil { - return m.Clock - } - return 0 -} - -func (m *ContactUpdate) GetEnsName() string { - if m != nil { - return m.EnsName - } - return "" -} - -func (m *ContactUpdate) GetProfileImage() string { - if m != nil { - return m.ProfileImage - } - return "" -} - -func init() { - proto.RegisterType((*ContactUpdate)(nil), "protobuf.ContactUpdate") -} - -func init() { proto.RegisterFile("contact.proto", fileDescriptor_a5036fff2565fb15) } - -var fileDescriptor_a5036fff2565fb15 = []byte{ - // 135 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x4d, 0xce, 0xcf, 0x2b, - 0x49, 0x4c, 0x2e, 0xd1, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x00, 0x53, 0x49, 0xa5, 0x69, - 0x4a, 0xa9, 0x5c, 0xbc, 0xce, 0x10, 0xa9, 0xd0, 0x82, 0x94, 0xc4, 0x92, 0x54, 0x21, 0x11, 0x2e, - 0xd6, 0xe4, 0x9c, 0xfc, 0xe4, 0x6c, 0x09, 0x46, 0x05, 0x46, 0x0d, 0x96, 0x20, 0x08, 0x47, 0x48, - 0x92, 0x8b, 0x23, 0x35, 0xaf, 0x38, 0x3e, 0x2f, 0x31, 0x37, 0x55, 0x82, 0x49, 0x81, 0x51, 0x83, - 0x33, 0x88, 0x3d, 0x35, 0xaf, 0xd8, 0x2f, 0x31, 0x37, 0x55, 0x48, 0x99, 0x8b, 0xb7, 0xa0, 0x28, - 0x3f, 0x2d, 0x33, 0x27, 0x35, 0x3e, 0x33, 0x37, 0x31, 0x3d, 0x55, 0x82, 0x19, 0x2c, 0xcf, 0x03, - 0x15, 0xf4, 0x04, 0x89, 0x25, 0xb1, 0x81, 0x2d, 0x34, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0x74, - 0xf9, 0x5c, 0xff, 0x88, 0x00, 0x00, 0x00, -} diff --git a/vendor/github.com/status-im/status-go/protocol/protobuf/contact.proto b/vendor/github.com/status-im/status-go/protocol/protobuf/contact.proto deleted file mode 100644 index 06bb8b24a..000000000 --- a/vendor/github.com/status-im/status-go/protocol/protobuf/contact.proto +++ /dev/null @@ -1,9 +0,0 @@ -syntax = "proto3"; - -package protobuf; - -message ContactUpdate { - uint64 clock = 1; - string ens_name = 2; - string profile_image = 3; -} diff --git a/vendor/github.com/status-im/status-go/protocol/protobuf/membership_update_message.pb.go b/vendor/github.com/status-im/status-go/protocol/protobuf/membership_update_message.pb.go deleted file mode 100644 index 30dd3d1f2..000000000 --- a/vendor/github.com/status-im/status-go/protocol/protobuf/membership_update_message.pb.go +++ /dev/null @@ -1,227 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: membership_update_message.proto - -package protobuf - -import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - math "math" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - -type MembershipUpdateEvent_EventType int32 - -const ( - MembershipUpdateEvent_UNKNOWN MembershipUpdateEvent_EventType = 0 - MembershipUpdateEvent_CHAT_CREATED MembershipUpdateEvent_EventType = 1 - MembershipUpdateEvent_NAME_CHANGED MembershipUpdateEvent_EventType = 2 - MembershipUpdateEvent_MEMBERS_ADDED MembershipUpdateEvent_EventType = 3 - MembershipUpdateEvent_MEMBER_JOINED MembershipUpdateEvent_EventType = 4 - MembershipUpdateEvent_MEMBER_REMOVED MembershipUpdateEvent_EventType = 5 - MembershipUpdateEvent_ADMINS_ADDED MembershipUpdateEvent_EventType = 6 - MembershipUpdateEvent_ADMIN_REMOVED MembershipUpdateEvent_EventType = 7 -) - -var MembershipUpdateEvent_EventType_name = map[int32]string{ - 0: "UNKNOWN", - 1: "CHAT_CREATED", - 2: "NAME_CHANGED", - 3: "MEMBERS_ADDED", - 4: "MEMBER_JOINED", - 5: "MEMBER_REMOVED", - 6: "ADMINS_ADDED", - 7: "ADMIN_REMOVED", -} - -var MembershipUpdateEvent_EventType_value = map[string]int32{ - "UNKNOWN": 0, - "CHAT_CREATED": 1, - "NAME_CHANGED": 2, - "MEMBERS_ADDED": 3, - "MEMBER_JOINED": 4, - "MEMBER_REMOVED": 5, - "ADMINS_ADDED": 6, - "ADMIN_REMOVED": 7, -} - -func (x MembershipUpdateEvent_EventType) String() string { - return proto.EnumName(MembershipUpdateEvent_EventType_name, int32(x)) -} - -func (MembershipUpdateEvent_EventType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_8d37dd0dc857a6be, []int{0, 0} -} - -type MembershipUpdateEvent struct { - // Lamport timestamp of the event - Clock uint64 `protobuf:"varint,1,opt,name=clock,proto3" json:"clock,omitempty"` - // List of public keys of objects of the action - Members []string `protobuf:"bytes,2,rep,name=members,proto3" json:"members,omitempty"` - // Name of the chat for the CHAT_CREATED/NAME_CHANGED event types - Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` - // The type of the event - Type MembershipUpdateEvent_EventType `protobuf:"varint,4,opt,name=type,proto3,enum=protobuf.MembershipUpdateEvent_EventType" json:"type,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *MembershipUpdateEvent) Reset() { *m = MembershipUpdateEvent{} } -func (m *MembershipUpdateEvent) String() string { return proto.CompactTextString(m) } -func (*MembershipUpdateEvent) ProtoMessage() {} -func (*MembershipUpdateEvent) Descriptor() ([]byte, []int) { - return fileDescriptor_8d37dd0dc857a6be, []int{0} -} - -func (m *MembershipUpdateEvent) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_MembershipUpdateEvent.Unmarshal(m, b) -} -func (m *MembershipUpdateEvent) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_MembershipUpdateEvent.Marshal(b, m, deterministic) -} -func (m *MembershipUpdateEvent) XXX_Merge(src proto.Message) { - xxx_messageInfo_MembershipUpdateEvent.Merge(m, src) -} -func (m *MembershipUpdateEvent) XXX_Size() int { - return xxx_messageInfo_MembershipUpdateEvent.Size(m) -} -func (m *MembershipUpdateEvent) XXX_DiscardUnknown() { - xxx_messageInfo_MembershipUpdateEvent.DiscardUnknown(m) -} - -var xxx_messageInfo_MembershipUpdateEvent proto.InternalMessageInfo - -func (m *MembershipUpdateEvent) GetClock() uint64 { - if m != nil { - return m.Clock - } - return 0 -} - -func (m *MembershipUpdateEvent) GetMembers() []string { - if m != nil { - return m.Members - } - return nil -} - -func (m *MembershipUpdateEvent) GetName() string { - if m != nil { - return m.Name - } - return "" -} - -func (m *MembershipUpdateEvent) GetType() MembershipUpdateEvent_EventType { - if m != nil { - return m.Type - } - return MembershipUpdateEvent_UNKNOWN -} - -// MembershipUpdateMessage is a message used to propagate information -// about group membership changes. -// For more information, see https://github.com/status-im/specs/blob/master/status-group-chats-spec.md. -type MembershipUpdateMessage struct { - // The chat id of the private group chat - ChatId string `protobuf:"bytes,1,opt,name=chat_id,json=chatId,proto3" json:"chat_id,omitempty"` - // A list of events for this group chat, first x bytes are the signature, then is a - // protobuf encoded MembershipUpdateEvent - Events [][]byte `protobuf:"bytes,2,rep,name=events,proto3" json:"events,omitempty"` - // An optional chat message - Message *ChatMessage `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *MembershipUpdateMessage) Reset() { *m = MembershipUpdateMessage{} } -func (m *MembershipUpdateMessage) String() string { return proto.CompactTextString(m) } -func (*MembershipUpdateMessage) ProtoMessage() {} -func (*MembershipUpdateMessage) Descriptor() ([]byte, []int) { - return fileDescriptor_8d37dd0dc857a6be, []int{1} -} - -func (m *MembershipUpdateMessage) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_MembershipUpdateMessage.Unmarshal(m, b) -} -func (m *MembershipUpdateMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_MembershipUpdateMessage.Marshal(b, m, deterministic) -} -func (m *MembershipUpdateMessage) XXX_Merge(src proto.Message) { - xxx_messageInfo_MembershipUpdateMessage.Merge(m, src) -} -func (m *MembershipUpdateMessage) XXX_Size() int { - return xxx_messageInfo_MembershipUpdateMessage.Size(m) -} -func (m *MembershipUpdateMessage) XXX_DiscardUnknown() { - xxx_messageInfo_MembershipUpdateMessage.DiscardUnknown(m) -} - -var xxx_messageInfo_MembershipUpdateMessage proto.InternalMessageInfo - -func (m *MembershipUpdateMessage) GetChatId() string { - if m != nil { - return m.ChatId - } - return "" -} - -func (m *MembershipUpdateMessage) GetEvents() [][]byte { - if m != nil { - return m.Events - } - return nil -} - -func (m *MembershipUpdateMessage) GetMessage() *ChatMessage { - if m != nil { - return m.Message - } - return nil -} - -func init() { - proto.RegisterEnum("protobuf.MembershipUpdateEvent_EventType", MembershipUpdateEvent_EventType_name, MembershipUpdateEvent_EventType_value) - proto.RegisterType((*MembershipUpdateEvent)(nil), "protobuf.MembershipUpdateEvent") - proto.RegisterType((*MembershipUpdateMessage)(nil), "protobuf.MembershipUpdateMessage") -} - -func init() { proto.RegisterFile("membership_update_message.proto", fileDescriptor_8d37dd0dc857a6be) } - -var fileDescriptor_8d37dd0dc857a6be = []byte{ - // 340 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x50, 0x41, 0x4f, 0xf2, 0x40, - 0x10, 0xfd, 0x0a, 0xa5, 0xfd, 0x3a, 0x20, 0xa9, 0x13, 0x91, 0xc6, 0x8b, 0x0d, 0xa7, 0x7a, 0xa9, - 0x09, 0x9e, 0x3d, 0xd4, 0xee, 0x46, 0xd0, 0xec, 0x92, 0xac, 0xa0, 0xc7, 0xa6, 0xc0, 0x2a, 0x44, - 0x0b, 0x0d, 0x14, 0x13, 0xe2, 0x4f, 0xf1, 0x8f, 0xf8, 0xf3, 0x4c, 0x97, 0x16, 0xa2, 0xf1, 0xb2, - 0xbb, 0xef, 0xcd, 0xbc, 0x37, 0x3b, 0x0f, 0xce, 0x13, 0x99, 0x8c, 0xe5, 0x6a, 0x3d, 0x9b, 0xa7, - 0xd1, 0x26, 0x9d, 0xc6, 0x99, 0x8c, 0x12, 0xb9, 0x5e, 0xc7, 0x2f, 0xd2, 0x4f, 0x57, 0xcb, 0x6c, - 0x89, 0xff, 0xd5, 0x35, 0xde, 0x3c, 0x9f, 0xe1, 0x64, 0x16, 0x67, 0x3f, 0xab, 0x9d, 0xaf, 0x0a, - 0xb4, 0xd8, 0xde, 0x61, 0xa4, 0x0c, 0xe8, 0xbb, 0x5c, 0x64, 0x78, 0x02, 0xb5, 0xc9, 0xdb, 0x72, - 0xf2, 0xea, 0x68, 0xae, 0xe6, 0xe9, 0x62, 0x07, 0xd0, 0x01, 0xb3, 0x18, 0xe8, 0x54, 0xdc, 0xaa, - 0x67, 0x89, 0x12, 0x22, 0x82, 0xbe, 0x88, 0x13, 0xe9, 0x54, 0x5d, 0xcd, 0xb3, 0x84, 0x7a, 0xe3, - 0x35, 0xe8, 0xd9, 0x36, 0x95, 0x8e, 0xee, 0x6a, 0x5e, 0xb3, 0x7b, 0xe1, 0x97, 0x5f, 0xf1, 0xff, - 0x1c, 0xe9, 0xab, 0x73, 0xb8, 0x4d, 0xa5, 0x50, 0xb2, 0xce, 0xa7, 0x06, 0xd6, 0x9e, 0xc3, 0x3a, - 0x98, 0x23, 0x7e, 0xcf, 0x07, 0x4f, 0xdc, 0xfe, 0x87, 0x36, 0x34, 0xc2, 0x5e, 0x30, 0x8c, 0x42, - 0x41, 0x83, 0x21, 0x25, 0xb6, 0x96, 0x33, 0x3c, 0x60, 0x34, 0x0a, 0x7b, 0x01, 0xbf, 0xa5, 0xc4, - 0xae, 0xe0, 0x31, 0x1c, 0x31, 0xca, 0x6e, 0xa8, 0x78, 0x88, 0x02, 0x42, 0x28, 0xb1, 0xab, 0x07, - 0x2a, 0xba, 0x1b, 0xf4, 0x39, 0x25, 0xb6, 0x8e, 0x08, 0xcd, 0x82, 0x12, 0x94, 0x0d, 0x1e, 0x29, - 0xb1, 0x6b, 0xb9, 0x57, 0x40, 0x58, 0x9f, 0x97, 0x42, 0x23, 0x17, 0x2a, 0x66, 0xdf, 0x64, 0x76, - 0x3e, 0xa0, 0xfd, 0x7b, 0x0d, 0xb6, 0xcb, 0x16, 0xdb, 0x60, 0xaa, 0xac, 0xe7, 0x53, 0x95, 0x9e, - 0x25, 0x8c, 0x1c, 0xf6, 0xa7, 0x78, 0x0a, 0x86, 0xcc, 0x17, 0xda, 0xa5, 0xd7, 0x10, 0x05, 0xc2, - 0xcb, 0x3c, 0x56, 0xa5, 0x55, 0xf9, 0xd5, 0xbb, 0xad, 0x43, 0x56, 0xe1, 0x2c, 0xce, 0x0a, 0x63, - 0x51, 0x76, 0x8d, 0x0d, 0x55, 0xbe, 0xfa, 0x0e, 0x00, 0x00, 0xff, 0xff, 0x7f, 0xb8, 0xe8, 0x9e, - 0xff, 0x01, 0x00, 0x00, -} diff --git a/vendor/github.com/status-im/status-go/protocol/protobuf/membership_update_message.proto b/vendor/github.com/status-im/status-go/protocol/protobuf/membership_update_message.proto deleted file mode 100644 index 8831b3f3c..000000000 --- a/vendor/github.com/status-im/status-go/protocol/protobuf/membership_update_message.proto +++ /dev/null @@ -1,40 +0,0 @@ -syntax = "proto3"; - -package protobuf; - -import "chat_message.proto"; - -message MembershipUpdateEvent { - // Lamport timestamp of the event - uint64 clock = 1; - // List of public keys of objects of the action - repeated string members = 2; - // Name of the chat for the CHAT_CREATED/NAME_CHANGED event types - string name = 3; - // The type of the event - EventType type = 4; - - enum EventType { - UNKNOWN = 0; - CHAT_CREATED = 1; - NAME_CHANGED = 2; - MEMBERS_ADDED = 3; - MEMBER_JOINED = 4; - MEMBER_REMOVED = 5; - ADMINS_ADDED = 6; - ADMIN_REMOVED = 7; - } -} - -// MembershipUpdateMessage is a message used to propagate information -// about group membership changes. -// For more information, see https://github.com/status-im/specs/blob/master/status-group-chats-spec.md. -message MembershipUpdateMessage { - // The chat id of the private group chat - string chat_id = 1; - // A list of events for this group chat, first x bytes are the signature, then is a - // protobuf encoded MembershipUpdateEvent - repeated bytes events = 2; - // An optional chat message - ChatMessage message = 3; -} diff --git a/vendor/github.com/status-im/status-go/protocol/protobuf/pairing.pb.go b/vendor/github.com/status-im/status-go/protocol/protobuf/pairing.pb.go deleted file mode 100644 index e1c3e2fa7..000000000 --- a/vendor/github.com/status-im/status-go/protocol/protobuf/pairing.pb.go +++ /dev/null @@ -1,358 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: pairing.proto - -package protobuf - -import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - math "math" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - -type PairInstallation struct { - Clock uint64 `protobuf:"varint,1,opt,name=clock,proto3" json:"clock,omitempty"` - InstallationId string `protobuf:"bytes,2,opt,name=installation_id,json=installationId,proto3" json:"installation_id,omitempty"` - DeviceType string `protobuf:"bytes,3,opt,name=device_type,json=deviceType,proto3" json:"device_type,omitempty"` - Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *PairInstallation) Reset() { *m = PairInstallation{} } -func (m *PairInstallation) String() string { return proto.CompactTextString(m) } -func (*PairInstallation) ProtoMessage() {} -func (*PairInstallation) Descriptor() ([]byte, []int) { - return fileDescriptor_d61ab7221f0b5518, []int{0} -} - -func (m *PairInstallation) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_PairInstallation.Unmarshal(m, b) -} -func (m *PairInstallation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_PairInstallation.Marshal(b, m, deterministic) -} -func (m *PairInstallation) XXX_Merge(src proto.Message) { - xxx_messageInfo_PairInstallation.Merge(m, src) -} -func (m *PairInstallation) XXX_Size() int { - return xxx_messageInfo_PairInstallation.Size(m) -} -func (m *PairInstallation) XXX_DiscardUnknown() { - xxx_messageInfo_PairInstallation.DiscardUnknown(m) -} - -var xxx_messageInfo_PairInstallation proto.InternalMessageInfo - -func (m *PairInstallation) GetClock() uint64 { - if m != nil { - return m.Clock - } - return 0 -} - -func (m *PairInstallation) GetInstallationId() string { - if m != nil { - return m.InstallationId - } - return "" -} - -func (m *PairInstallation) GetDeviceType() string { - if m != nil { - return m.DeviceType - } - return "" -} - -func (m *PairInstallation) GetName() string { - if m != nil { - return m.Name - } - return "" -} - -type SyncInstallationContact struct { - Clock uint64 `protobuf:"varint,1,opt,name=clock,proto3" json:"clock,omitempty"` - Id string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"` - ProfileImage string `protobuf:"bytes,3,opt,name=profile_image,json=profileImage,proto3" json:"profile_image,omitempty"` - EnsName string `protobuf:"bytes,4,opt,name=ens_name,json=ensName,proto3" json:"ens_name,omitempty"` - LastUpdated uint64 `protobuf:"varint,5,opt,name=last_updated,json=lastUpdated,proto3" json:"last_updated,omitempty"` - SystemTags []string `protobuf:"bytes,6,rep,name=system_tags,json=systemTags,proto3" json:"system_tags,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SyncInstallationContact) Reset() { *m = SyncInstallationContact{} } -func (m *SyncInstallationContact) String() string { return proto.CompactTextString(m) } -func (*SyncInstallationContact) ProtoMessage() {} -func (*SyncInstallationContact) Descriptor() ([]byte, []int) { - return fileDescriptor_d61ab7221f0b5518, []int{1} -} - -func (m *SyncInstallationContact) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SyncInstallationContact.Unmarshal(m, b) -} -func (m *SyncInstallationContact) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SyncInstallationContact.Marshal(b, m, deterministic) -} -func (m *SyncInstallationContact) XXX_Merge(src proto.Message) { - xxx_messageInfo_SyncInstallationContact.Merge(m, src) -} -func (m *SyncInstallationContact) XXX_Size() int { - return xxx_messageInfo_SyncInstallationContact.Size(m) -} -func (m *SyncInstallationContact) XXX_DiscardUnknown() { - xxx_messageInfo_SyncInstallationContact.DiscardUnknown(m) -} - -var xxx_messageInfo_SyncInstallationContact proto.InternalMessageInfo - -func (m *SyncInstallationContact) GetClock() uint64 { - if m != nil { - return m.Clock - } - return 0 -} - -func (m *SyncInstallationContact) GetId() string { - if m != nil { - return m.Id - } - return "" -} - -func (m *SyncInstallationContact) GetProfileImage() string { - if m != nil { - return m.ProfileImage - } - return "" -} - -func (m *SyncInstallationContact) GetEnsName() string { - if m != nil { - return m.EnsName - } - return "" -} - -func (m *SyncInstallationContact) GetLastUpdated() uint64 { - if m != nil { - return m.LastUpdated - } - return 0 -} - -func (m *SyncInstallationContact) GetSystemTags() []string { - if m != nil { - return m.SystemTags - } - return nil -} - -type SyncInstallationAccount struct { - Clock uint64 `protobuf:"varint,1,opt,name=clock,proto3" json:"clock,omitempty"` - ProfileImage string `protobuf:"bytes,2,opt,name=profile_image,json=profileImage,proto3" json:"profile_image,omitempty"` - LastUpdated uint64 `protobuf:"varint,3,opt,name=last_updated,json=lastUpdated,proto3" json:"last_updated,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SyncInstallationAccount) Reset() { *m = SyncInstallationAccount{} } -func (m *SyncInstallationAccount) String() string { return proto.CompactTextString(m) } -func (*SyncInstallationAccount) ProtoMessage() {} -func (*SyncInstallationAccount) Descriptor() ([]byte, []int) { - return fileDescriptor_d61ab7221f0b5518, []int{2} -} - -func (m *SyncInstallationAccount) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SyncInstallationAccount.Unmarshal(m, b) -} -func (m *SyncInstallationAccount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SyncInstallationAccount.Marshal(b, m, deterministic) -} -func (m *SyncInstallationAccount) XXX_Merge(src proto.Message) { - xxx_messageInfo_SyncInstallationAccount.Merge(m, src) -} -func (m *SyncInstallationAccount) XXX_Size() int { - return xxx_messageInfo_SyncInstallationAccount.Size(m) -} -func (m *SyncInstallationAccount) XXX_DiscardUnknown() { - xxx_messageInfo_SyncInstallationAccount.DiscardUnknown(m) -} - -var xxx_messageInfo_SyncInstallationAccount proto.InternalMessageInfo - -func (m *SyncInstallationAccount) GetClock() uint64 { - if m != nil { - return m.Clock - } - return 0 -} - -func (m *SyncInstallationAccount) GetProfileImage() string { - if m != nil { - return m.ProfileImage - } - return "" -} - -func (m *SyncInstallationAccount) GetLastUpdated() uint64 { - if m != nil { - return m.LastUpdated - } - return 0 -} - -type SyncInstallationPublicChat struct { - Clock uint64 `protobuf:"varint,1,opt,name=clock,proto3" json:"clock,omitempty"` - Id string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SyncInstallationPublicChat) Reset() { *m = SyncInstallationPublicChat{} } -func (m *SyncInstallationPublicChat) String() string { return proto.CompactTextString(m) } -func (*SyncInstallationPublicChat) ProtoMessage() {} -func (*SyncInstallationPublicChat) Descriptor() ([]byte, []int) { - return fileDescriptor_d61ab7221f0b5518, []int{3} -} - -func (m *SyncInstallationPublicChat) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SyncInstallationPublicChat.Unmarshal(m, b) -} -func (m *SyncInstallationPublicChat) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SyncInstallationPublicChat.Marshal(b, m, deterministic) -} -func (m *SyncInstallationPublicChat) XXX_Merge(src proto.Message) { - xxx_messageInfo_SyncInstallationPublicChat.Merge(m, src) -} -func (m *SyncInstallationPublicChat) XXX_Size() int { - return xxx_messageInfo_SyncInstallationPublicChat.Size(m) -} -func (m *SyncInstallationPublicChat) XXX_DiscardUnknown() { - xxx_messageInfo_SyncInstallationPublicChat.DiscardUnknown(m) -} - -var xxx_messageInfo_SyncInstallationPublicChat proto.InternalMessageInfo - -func (m *SyncInstallationPublicChat) GetClock() uint64 { - if m != nil { - return m.Clock - } - return 0 -} - -func (m *SyncInstallationPublicChat) GetId() string { - if m != nil { - return m.Id - } - return "" -} - -type SyncInstallation struct { - Contacts []*SyncInstallationContact `protobuf:"bytes,1,rep,name=contacts,proto3" json:"contacts,omitempty"` - PublicChats []*SyncInstallationPublicChat `protobuf:"bytes,2,rep,name=public_chats,json=publicChats,proto3" json:"public_chats,omitempty"` - Account *SyncInstallationAccount `protobuf:"bytes,3,opt,name=account,proto3" json:"account,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SyncInstallation) Reset() { *m = SyncInstallation{} } -func (m *SyncInstallation) String() string { return proto.CompactTextString(m) } -func (*SyncInstallation) ProtoMessage() {} -func (*SyncInstallation) Descriptor() ([]byte, []int) { - return fileDescriptor_d61ab7221f0b5518, []int{4} -} - -func (m *SyncInstallation) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SyncInstallation.Unmarshal(m, b) -} -func (m *SyncInstallation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SyncInstallation.Marshal(b, m, deterministic) -} -func (m *SyncInstallation) XXX_Merge(src proto.Message) { - xxx_messageInfo_SyncInstallation.Merge(m, src) -} -func (m *SyncInstallation) XXX_Size() int { - return xxx_messageInfo_SyncInstallation.Size(m) -} -func (m *SyncInstallation) XXX_DiscardUnknown() { - xxx_messageInfo_SyncInstallation.DiscardUnknown(m) -} - -var xxx_messageInfo_SyncInstallation proto.InternalMessageInfo - -func (m *SyncInstallation) GetContacts() []*SyncInstallationContact { - if m != nil { - return m.Contacts - } - return nil -} - -func (m *SyncInstallation) GetPublicChats() []*SyncInstallationPublicChat { - if m != nil { - return m.PublicChats - } - return nil -} - -func (m *SyncInstallation) GetAccount() *SyncInstallationAccount { - if m != nil { - return m.Account - } - return nil -} - -func init() { - proto.RegisterType((*PairInstallation)(nil), "protobuf.PairInstallation") - proto.RegisterType((*SyncInstallationContact)(nil), "protobuf.SyncInstallationContact") - proto.RegisterType((*SyncInstallationAccount)(nil), "protobuf.SyncInstallationAccount") - proto.RegisterType((*SyncInstallationPublicChat)(nil), "protobuf.SyncInstallationPublicChat") - proto.RegisterType((*SyncInstallation)(nil), "protobuf.SyncInstallation") -} - -func init() { proto.RegisterFile("pairing.proto", fileDescriptor_d61ab7221f0b5518) } - -var fileDescriptor_d61ab7221f0b5518 = []byte{ - // 378 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0xcf, 0x6e, 0x9b, 0x40, - 0x10, 0xc6, 0x05, 0xf8, 0x5f, 0x07, 0xdb, 0xb5, 0x56, 0x95, 0xba, 0xed, 0xa5, 0x98, 0x56, 0xaa, - 0x4f, 0x3e, 0xb4, 0xc7, 0xaa, 0x87, 0xc4, 0x87, 0xc8, 0x97, 0xc8, 0x22, 0xce, 0x19, 0xad, 0x97, - 0x35, 0x5e, 0x05, 0x96, 0x15, 0xbb, 0x24, 0xe2, 0x05, 0xf2, 0x62, 0x79, 0x88, 0xbc, 0x4e, 0xc4, - 0x62, 0x3b, 0xc8, 0x0e, 0x51, 0x4e, 0x2c, 0x1f, 0xb3, 0xf3, 0xfd, 0xbe, 0x19, 0x60, 0x24, 0x09, - 0xcf, 0xb9, 0x88, 0xe7, 0x32, 0xcf, 0x74, 0x86, 0x06, 0xe6, 0xb1, 0x29, 0xb6, 0xfe, 0xa3, 0x05, - 0x93, 0x15, 0xe1, 0xf9, 0x52, 0x28, 0x4d, 0x92, 0x84, 0x68, 0x9e, 0x09, 0xf4, 0x05, 0xba, 0x34, - 0xc9, 0xe8, 0x1d, 0xb6, 0x3c, 0x6b, 0xd6, 0x09, 0xea, 0x17, 0xf4, 0x1b, 0x3e, 0xf3, 0x46, 0x55, - 0xc8, 0x23, 0x6c, 0x7b, 0xd6, 0xec, 0x53, 0x30, 0x6e, 0xca, 0xcb, 0x08, 0xfd, 0x00, 0x37, 0x62, - 0xf7, 0x9c, 0xb2, 0x50, 0x97, 0x92, 0x61, 0xc7, 0x14, 0x41, 0x2d, 0xad, 0x4b, 0xc9, 0x10, 0x82, - 0x8e, 0x20, 0x29, 0xc3, 0x1d, 0xf3, 0xc5, 0x9c, 0xfd, 0x27, 0x0b, 0xbe, 0xde, 0x94, 0x82, 0x36, - 0x41, 0x16, 0x99, 0xd0, 0x84, 0xea, 0x16, 0x9e, 0x31, 0xd8, 0x47, 0x04, 0x9b, 0x47, 0xe8, 0x27, - 0x8c, 0x64, 0x9e, 0x6d, 0x79, 0xc2, 0x42, 0x9e, 0x92, 0xf8, 0x60, 0x3c, 0xdc, 0x8b, 0xcb, 0x4a, - 0x43, 0xdf, 0x60, 0xc0, 0x84, 0x0a, 0x1b, 0xf6, 0x7d, 0x26, 0xd4, 0x35, 0x49, 0x19, 0x9a, 0xc2, - 0x30, 0x21, 0x4a, 0x87, 0x85, 0x8c, 0x88, 0x66, 0x11, 0xee, 0x1a, 0x33, 0xb7, 0xd2, 0x6e, 0x6b, - 0xa9, 0x4a, 0xa6, 0x4a, 0xa5, 0x59, 0x1a, 0x6a, 0x12, 0x2b, 0xdc, 0xf3, 0x9c, 0x2a, 0x59, 0x2d, - 0xad, 0x49, 0xac, 0xfc, 0x87, 0xf3, 0x10, 0x17, 0x94, 0x66, 0x85, 0x68, 0x0b, 0x71, 0x06, 0x6d, - 0xbf, 0x01, 0x7d, 0x4a, 0xe6, 0x9c, 0x91, 0xf9, 0x97, 0xf0, 0xfd, 0xd4, 0x78, 0x55, 0x6c, 0x12, - 0x4e, 0x17, 0x3b, 0xf2, 0xc1, 0x01, 0xfa, 0xcf, 0x16, 0x4c, 0x4e, 0x9b, 0xa0, 0xff, 0x30, 0xa0, - 0xf5, 0x1a, 0x14, 0xb6, 0x3c, 0x67, 0xe6, 0xfe, 0x99, 0xce, 0x0f, 0x7f, 0xcf, 0xbc, 0x65, 0x61, - 0xc1, 0xf1, 0x0a, 0xba, 0x82, 0xa1, 0x34, 0x1c, 0x21, 0xdd, 0x11, 0xad, 0xb0, 0x6d, 0x5a, 0xfc, - 0x6a, 0x6f, 0xf1, 0x4a, 0x1d, 0xb8, 0xf2, 0x78, 0x56, 0xe8, 0x1f, 0xf4, 0x49, 0x3d, 0x49, 0x13, - 0xff, 0x5d, 0x8c, 0xfd, 0xc8, 0x83, 0xc3, 0x8d, 0x4d, 0xcf, 0x94, 0xfe, 0x7d, 0x09, 0x00, 0x00, - 0xff, 0xff, 0xd7, 0x5f, 0x3a, 0x87, 0x07, 0x03, 0x00, 0x00, -} diff --git a/vendor/github.com/status-im/status-go/protocol/protobuf/pairing.proto b/vendor/github.com/status-im/status-go/protocol/protobuf/pairing.proto deleted file mode 100644 index 9b6bce63e..000000000 --- a/vendor/github.com/status-im/status-go/protocol/protobuf/pairing.proto +++ /dev/null @@ -1,36 +0,0 @@ -syntax = "proto3"; - -package protobuf; - -message PairInstallation { - uint64 clock = 1; - string installation_id = 2; - string device_type = 3; - string name = 4; -} - -message SyncInstallationContact { - uint64 clock = 1; - string id = 2; - string profile_image = 3; - string ens_name = 4; - uint64 last_updated = 5; - repeated string system_tags = 6; -} - -message SyncInstallationAccount { - uint64 clock = 1; - string profile_image = 2; - uint64 last_updated = 3; -} - -message SyncInstallationPublicChat { - uint64 clock = 1; - string id = 2; -} - -message SyncInstallation { - repeated SyncInstallationContact contacts = 1; - repeated SyncInstallationPublicChat public_chats = 2; - SyncInstallationAccount account = 3; -} diff --git a/vendor/github.com/status-im/status-go/protocol/protobuf/pubkey.go b/vendor/github.com/status-im/status-go/protocol/protobuf/pubkey.go deleted file mode 100644 index 77f01624a..000000000 --- a/vendor/github.com/status-im/status-go/protocol/protobuf/pubkey.go +++ /dev/null @@ -1,23 +0,0 @@ -package protobuf - -import ( - "crypto/ecdsa" - - "github.com/status-im/status-go/eth-node/crypto" -) - -func (m *ApplicationMetadataMessage) RecoverKey() (*ecdsa.PublicKey, error) { - if m.Signature == nil { - return nil, nil - } - - recoveredKey, err := crypto.SigToPub( - crypto.Keccak256(m.Payload), - m.Signature, - ) - if err != nil { - return nil, err - } - - return recoveredKey, nil -} diff --git a/vendor/github.com/status-im/status-go/protocol/protobuf/service.go b/vendor/github.com/status-im/status-go/protocol/protobuf/service.go deleted file mode 100644 index f6652e485..000000000 --- a/vendor/github.com/status-im/status-go/protocol/protobuf/service.go +++ /dev/null @@ -1,17 +0,0 @@ -package protobuf - -import ( - "github.com/golang/protobuf/proto" -) - -//go:generate protoc --go_out=. ./chat_message.proto ./application_metadata_message.proto ./membership_update_message.proto ./command.proto ./contact.proto ./pairing.proto - -func Unmarshal(payload []byte) (*ApplicationMetadataMessage, error) { - var message ApplicationMetadataMessage - err := proto.Unmarshal(payload, &message) - if err != nil { - return nil, err - } - - return &message, nil -} diff --git a/vendor/github.com/status-im/status-go/protocol/sqlite/db.go b/vendor/github.com/status-im/status-go/protocol/sqlite/db.go deleted file mode 100644 index 87d4b783a..000000000 --- a/vendor/github.com/status-im/status-go/protocol/sqlite/db.go +++ /dev/null @@ -1,147 +0,0 @@ -package sqlite - -import ( - "database/sql" - "fmt" - "os" - - "github.com/pkg/errors" - - _ "github.com/mutecomm/go-sqlcipher" // We require go sqlcipher that overrides default implementation - "github.com/status-im/migrate/v4" - "github.com/status-im/migrate/v4/database/sqlcipher" - bindata "github.com/status-im/migrate/v4/source/go_bindata" - mvdsmigrations "github.com/vacp2p/mvds/persistenceutil" -) - -// The default number of kdf iterations in sqlcipher (from version 3.0.0) -// https://github.com/sqlcipher/sqlcipher/blob/fda4c68bb474da7e955be07a2b807bda1bb19bd2/CHANGELOG.md#300---2013-11-05 -// https://www.zetetic.net/sqlcipher/sqlcipher-api/#kdf_iter -const defaultKdfIterationsNumber = 64000 // nolint: deadcode,varcheck,unused - -// The reduced number of kdf iterations (for performance reasons) which is -// currently used for derivation of the database key -// https://github.com/status-im/status-go/pull/1343 -// https://notes.status.im/i8Y_l7ccTiOYq09HVgoFwA -const reducedKdfIterationsNumber = 3200 - -const inMemoryPath = ":memory:" - -// MigrationConfig is a struct that allows to define bindata migrations. -type MigrationConfig struct { - AssetNames []string - AssetGetter func(name string) ([]byte, error) -} - -// Open opens or initializes a new database for a given file path. -// MigrationConfig is optional but if provided migrations are applied automatically. -func Open(path, key string) (*sql.DB, error) { - return open(path, key, reducedKdfIterationsNumber) -} - -// OpenInMemory opens an in memory SQLite database. -// Number of KDF iterations is reduced to 0. -func OpenInMemory() (*sql.DB, error) { - return open(inMemoryPath, "", 0) -} - -// OpenWithIter allows to open a new database with a custom number of kdf iterations. -// Higher kdf iterations number makes it slower to open the database. -func OpenWithIter(path, key string, kdfIter int) (*sql.DB, error) { - return open(path, key, kdfIter) -} - -func open(path string, key string, kdfIter int) (*sql.DB, error) { - if path != inMemoryPath { - _, err := os.OpenFile(path, os.O_CREATE, 0644) - if err != nil { - return nil, err - } - } - - db, err := sql.Open("sqlite3", path) - if err != nil { - return nil, err - } - - keyString := fmt.Sprintf("PRAGMA key = '%s'", key) - - // Disable concurrent access as not supported by the driver - db.SetMaxOpenConns(1) - - if _, err = db.Exec("PRAGMA foreign_keys=ON"); err != nil { - return nil, err - } - - if _, err = db.Exec(keyString); err != nil { - return nil, err - } - - kdfString := fmt.Sprintf("PRAGMA kdf_iter = '%d'", kdfIter) - - if _, err = db.Exec(kdfString); err != nil { - return nil, err - } - - if err := Migrate(db); err != nil { - return nil, err - } - - return db, nil -} - -// ApplyMigrations allows to apply bindata migrations on the current *sql.DB. -// `assetNames` is a list of assets with migrations and `assetGetter` is responsible -// for returning the content of the asset with a given name. -func ApplyMigrations(db *sql.DB, assetNames []string, assetGetter func(name string) ([]byte, error)) error { - resources := bindata.Resource( - assetNames, - assetGetter, - ) - - source, err := bindata.WithInstance(resources) - if err != nil { - return errors.Wrap(err, "failed to create migration source") - } - - driver, err := sqlcipher.WithInstance(db, &sqlcipher.Config{ - MigrationsTable: "status_protocol_go_" + sqlcipher.DefaultMigrationsTable, - }) - if err != nil { - return errors.Wrap(err, "failed to create driver") - } - - m, err := migrate.NewWithInstance( - "go-bindata", - source, - "sqlcipher", - driver, - ) - if err != nil { - return errors.Wrap(err, "failed to create migration instance") - } - - if err = m.Up(); err != migrate.ErrNoChange { - return errors.Wrap(err, "failed to migrate") - } - - return nil -} - -func Migrate(database *sql.DB) error { - // Apply migrations for all components. - err := mvdsmigrations.Migrate(database) - if err != nil { - return errors.Wrap(err, "failed to apply mvds migrations") - } - - migrationNames, migrationGetter, err := prepareMigrations(defaultMigrations) - if err != nil { - return errors.Wrap(err, "failed to prepare status-go/protocol migrations") - } - err = ApplyMigrations(database, migrationNames, migrationGetter) - if err != nil { - return errors.Wrap(err, "failed to apply status-go/protocol migrations") - } - return nil -} diff --git a/vendor/github.com/status-im/status-go/protocol/sqlite/doc.go b/vendor/github.com/status-im/status-go/protocol/sqlite/doc.go deleted file mode 100644 index dd971beda..000000000 --- a/vendor/github.com/status-im/status-go/protocol/sqlite/doc.go +++ /dev/null @@ -1,7 +0,0 @@ -// Package sqlite is responsible for creation of encrypted sqlite3 database using sqlcipher driver. -// It is optimized for mobile usage as well. -// -// sqlite package also provides a capability to apply bindata migration. -// You can keep your migrations close to your business logic and use this package -// to create an encrypted sqlite3 database and then apply the migrations easily. -package sqlite diff --git a/vendor/github.com/status-im/status-go/protocol/sqlite/migrations.go b/vendor/github.com/status-im/status-go/protocol/sqlite/migrations.go deleted file mode 100644 index 387f7608d..000000000 --- a/vendor/github.com/status-im/status-go/protocol/sqlite/migrations.go +++ /dev/null @@ -1,70 +0,0 @@ -package sqlite - -import ( - "strings" - - "github.com/pkg/errors" - - encryptmigrations "github.com/status-im/status-go/protocol/encryption/migrations" - appmigrations "github.com/status-im/status-go/protocol/migrations" - wakumigrations "github.com/status-im/status-go/protocol/transport/waku/migrations" - whispermigrations "github.com/status-im/status-go/protocol/transport/whisper/migrations" -) - -type getter func(string) ([]byte, error) - -type migrationsWithGetter struct { - Names []string - Getter getter -} - -var defaultMigrations = []migrationsWithGetter{ - { - Names: whispermigrations.AssetNames(), - Getter: whispermigrations.Asset, - }, - { - Names: wakumigrations.AssetNames(), - Getter: wakumigrations.Asset, - }, - { - Names: encryptmigrations.AssetNames(), - Getter: encryptmigrations.Asset, - }, - { - Names: appmigrations.AssetNames(), - Getter: appmigrations.Asset, - }, -} - -func prepareMigrations(migrations []migrationsWithGetter) ([]string, getter, error) { - var allNames []string - nameToGetter := make(map[string]getter) - - for _, m := range migrations { - for _, name := range m.Names { - if !validateName(name) { - continue - } - - if _, ok := nameToGetter[name]; ok { - return nil, nil, errors.Errorf("migration with name %s already exists", name) - } - allNames = append(allNames, name) - nameToGetter[name] = m.Getter - } - } - - return allNames, func(name string) ([]byte, error) { - getter, ok := nameToGetter[name] - if !ok { - return nil, errors.Errorf("no migration for name %s", name) - } - return getter(name) - }, nil -} - -// validateName verifies that only *.sql files are taken into consideration. -func validateName(name string) bool { - return strings.HasSuffix(name, ".sql") -} diff --git a/vendor/github.com/status-im/status-go/protocol/timesource.go b/vendor/github.com/status-im/status-go/protocol/timesource.go deleted file mode 100644 index fba77e0f7..000000000 --- a/vendor/github.com/status-im/status-go/protocol/timesource.go +++ /dev/null @@ -1,12 +0,0 @@ -package protocol - -// TimeSource provides a unified way of getting the current time. -// The intention is to always use a synchronized time source -// between all components of the protocol. -// -// This is required by Whisper and Waku protocols -// which rely on a fact that all peers -// have a synchronized time source. -type TimeSource interface { - GetCurrentTime() uint64 -} diff --git a/vendor/github.com/status-im/status-go/protocol/transaction_validator.go b/vendor/github.com/status-im/status-go/protocol/transaction_validator.go deleted file mode 100644 index e19d72caa..000000000 --- a/vendor/github.com/status-im/status-go/protocol/transaction_validator.go +++ /dev/null @@ -1,331 +0,0 @@ -package protocol - -import ( - "context" - "crypto/ecdsa" - "encoding/hex" - "fmt" - "time" - - "math/big" - "strings" - - "github.com/pkg/errors" - "go.uber.org/zap" - - coretypes "github.com/status-im/status-go/eth-node/core/types" - "github.com/status-im/status-go/eth-node/crypto" - "github.com/status-im/status-go/eth-node/types" -) - -const ( - transferFunction = "a9059cbb" - tokenTransferDataLength = 68 - transactionHashLength = 66 -) - -type TransactionValidator struct { - persistence *sqlitePersistence - addresses map[string]bool - client EthClient - logger *zap.Logger -} - -var invalidResponse = &VerifyTransactionResponse{Valid: false} - -type TransactionToValidate struct { - TransactionHash string - CommandID string - MessageID string - RetryCount int - // First seen indicates the whisper timestamp of the first time we seen this - FirstSeen uint64 - // Validate indicates whether we should be validating this transaction - Validate bool - Signature []byte - From *ecdsa.PublicKey -} - -func NewTransactionValidator(addresses []types.Address, persistence *sqlitePersistence, client EthClient, logger *zap.Logger) *TransactionValidator { - addressesMap := make(map[string]bool) - for _, a := range addresses { - addressesMap[strings.ToLower(a.Hex())] = true - } - logger.Debug("Checking addresses", zap.Any("addrse", addressesMap)) - - return &TransactionValidator{ - persistence: persistence, - addresses: addressesMap, - logger: logger, - client: client, - } -} - -type EthClient interface { - TransactionByHash(context.Context, types.Hash) (coretypes.Message, coretypes.TransactionStatus, error) -} - -func (t *TransactionValidator) verifyTransactionSignature(ctx context.Context, from *ecdsa.PublicKey, address types.Address, transactionHash string, signature []byte) error { - publicKeyBytes := crypto.FromECDSAPub(from) - - if len(transactionHash) != transactionHashLength { - return errors.New("wrong transaction hash lenght") - } - - hashBytes, err := hex.DecodeString(transactionHash[2:]) - if err != nil { - return err - } - signatureMaterial := append(publicKeyBytes, hashBytes...) - - // We take a copy as EcRecover modifies the byte slice - signatureCopy := make([]byte, len(signature)) - copy(signatureCopy, signature) - extractedAddress, err := crypto.EcRecover(ctx, signatureMaterial, signatureCopy) - if err != nil { - return err - } - - if extractedAddress != address { - return errors.New("failed to verify signature") - } - return nil -} - -func (t *TransactionValidator) validateTokenTransfer(parameters *CommandParameters, transaction coretypes.Message) (*VerifyTransactionResponse, error) { - - data := transaction.Data() - if len(data) != tokenTransferDataLength { - return nil, errors.New(fmt.Sprintf("wrong data length: %d", len(data))) - } - - functionCalled := hex.EncodeToString(data[:4]) - - if functionCalled != transferFunction { - return invalidResponse, nil - } - - actualContractAddress := strings.ToLower(transaction.To().Hex()) - - if parameters.Contract != "" && actualContractAddress != parameters.Contract { - return invalidResponse, nil - } - - to := types.EncodeHex(data[16:36]) - - if !t.validateToAddress(parameters.Address, to) { - return invalidResponse, nil - } - - value := data[36:] - amount := new(big.Int).SetBytes(value) - - if parameters.Value != "" { - advertisedAmount, ok := new(big.Int).SetString(parameters.Value, 10) - if !ok { - return nil, errors.New("can't parse amount") - } - - return &VerifyTransactionResponse{ - Value: parameters.Value, - Contract: actualContractAddress, - Address: to, - AccordingToSpec: amount.Cmp(advertisedAmount) == 0, - Valid: true, - }, nil - } - - return &VerifyTransactionResponse{ - Value: amount.String(), - Address: to, - Contract: actualContractAddress, - AccordingToSpec: false, - Valid: true, - }, nil - -} - -func (t *TransactionValidator) validateToAddress(specifiedTo, actualTo string) bool { - if len(specifiedTo) != 0 && (strings.ToLower(specifiedTo) != strings.ToLower(actualTo) || !t.addresses[strings.ToLower(actualTo)]) { - return false - } - - return t.addresses[actualTo] -} - -func (t *TransactionValidator) validateEthereumTransfer(parameters *CommandParameters, transaction coretypes.Message) (*VerifyTransactionResponse, error) { - toAddress := strings.ToLower(transaction.To().Hex()) - - if !t.validateToAddress(parameters.Address, toAddress) { - return invalidResponse, nil - } - amount := transaction.Value() - if parameters.Value != "" { - advertisedAmount, ok := new(big.Int).SetString(parameters.Value, 10) - if !ok { - return nil, errors.New("can't parse amount") - } - return &VerifyTransactionResponse{ - AccordingToSpec: amount.Cmp(advertisedAmount) == 0, - Valid: true, - Value: amount.String(), - Address: toAddress, - }, nil - - } else { - return &VerifyTransactionResponse{ - AccordingToSpec: false, - Valid: true, - Value: amount.String(), - Address: toAddress, - }, nil - - } - -} - -type VerifyTransactionResponse struct { - Pending bool - // AccordingToSpec means that the transaction is valid, - // the user should be notified, but is not the same as - // what was requested, for example because the value is different - AccordingToSpec bool - // Valid means that the transaction is valid - Valid bool - // The actual value received - Value string - // The contract used in case of tokens - Contract string - // The address the transaction was actually sent - Address string - - Message *Message - Transaction *TransactionToValidate -} - -// validateTransaction validates a transaction and returns a response. -// If a negative response is returned, i.e `Valid` is false, it should -// not be retried. -// If an error is returned, validation can be retried. -func (t *TransactionValidator) validateTransaction(ctx context.Context, message coretypes.Message, parameters *CommandParameters, from *ecdsa.PublicKey) (*VerifyTransactionResponse, error) { - - fromAddress := types.BytesToAddress(message.From().Bytes()) - - err := t.verifyTransactionSignature(ctx, from, fromAddress, parameters.TransactionHash, parameters.Signature) - if err != nil { - t.logger.Error("failed validating signature", zap.Error(err)) - return invalidResponse, nil - } - - if len(message.Data()) != 0 { - t.logger.Debug("Validating token") - return t.validateTokenTransfer(parameters, message) - } else { - t.logger.Debug("Validating eth") - return t.validateEthereumTransfer(parameters, message) - } -} - -func (t *TransactionValidator) ValidateTransactions(ctx context.Context) ([]*VerifyTransactionResponse, error) { - if t.client == nil { - return nil, nil - } - var response []*VerifyTransactionResponse - t.logger.Debug("Started validating transactions") - transactions, err := t.persistence.TransactionsToValidate() - if err != nil { - return nil, err - } - - t.logger.Debug("Transactions to validated", zap.Any("transactions", transactions)) - - for _, transaction := range transactions { - var validationResult *VerifyTransactionResponse - t.logger.Debug("Validating transaction", zap.Any("transaction", transaction)) - if transaction.CommandID != "" { - chatID := contactIDFromPublicKey(transaction.From) - message, err := t.persistence.MessageByCommandID(chatID, transaction.CommandID) - if err != nil { - - t.logger.Error("error pulling message", zap.Error(err)) - return nil, err - } - if message == nil { - t.logger.Info("No message found, ignoring transaction") - // This is not a valid case, ignore transaction - transaction.Validate = false - transaction.RetryCount += 1 - err = t.persistence.UpdateTransactionToValidate(transaction) - if err != nil { - return nil, err - } - continue - - } - commandParameters := message.CommandParameters - commandParameters.TransactionHash = transaction.TransactionHash - commandParameters.Signature = transaction.Signature - validationResult, err = t.ValidateTransaction(ctx, message.CommandParameters, transaction.From) - if err != nil { - t.logger.Error("Error validating transaction", zap.Error(err)) - continue - } - validationResult.Message = message - } else { - commandParameters := &CommandParameters{} - commandParameters.TransactionHash = transaction.TransactionHash - commandParameters.Signature = transaction.Signature - - validationResult, err = t.ValidateTransaction(ctx, commandParameters, transaction.From) - if err != nil { - t.logger.Error("Error validating transaction", zap.Error(err)) - continue - } - } - - if validationResult.Pending { - t.logger.Debug("Pending transaction skipping") - // Check if we should stop updating - continue - } - - // Mark transaction as valid - transaction.Validate = false - transaction.RetryCount += 1 - err = t.persistence.UpdateTransactionToValidate(transaction) - if err != nil { - return nil, err - } - - if !validationResult.Valid { - t.logger.Debug("Transaction not valid") - continue - } - t.logger.Debug("Transaction valid") - validationResult.Transaction = transaction - response = append(response, validationResult) - } - return response, nil -} - -func (t *TransactionValidator) ValidateTransaction(ctx context.Context, parameters *CommandParameters, from *ecdsa.PublicKey) (*VerifyTransactionResponse, error) { - t.logger.Debug("validating transaction", zap.Any("transaction", parameters), zap.Any("from", from)) - hash := parameters.TransactionHash - c, cancel := context.WithTimeout(ctx, 10*time.Second) - defer cancel() - - message, status, err := t.client.TransactionByHash(c, types.HexToHash(hash)) - if err != nil { - return nil, err - } - switch status { - case coretypes.TransactionStatusPending: - t.logger.Debug("Transaction pending") - return &VerifyTransactionResponse{Pending: true}, nil - case coretypes.TransactionStatusFailed: - - return invalidResponse, nil - } - - return t.validateTransaction(ctx, message, parameters, from) -} diff --git a/vendor/github.com/status-im/status-go/protocol/transport/envelopes_monitor.go b/vendor/github.com/status-im/status-go/protocol/transport/envelopes_monitor.go deleted file mode 100644 index be1490565..000000000 --- a/vendor/github.com/status-im/status-go/protocol/transport/envelopes_monitor.go +++ /dev/null @@ -1,23 +0,0 @@ -package transport - -import ( - "go.uber.org/zap" - - "github.com/status-im/status-go/eth-node/types" -) - -type EnvelopesMonitorConfig struct { - EnvelopeEventsHandler EnvelopeEventsHandler - MaxAttempts int - MailserverConfirmationsEnabled bool - IsMailserver func(types.EnodeID) bool - Logger *zap.Logger -} - -// EnvelopeEventsHandler used for two different event types. -type EnvelopeEventsHandler interface { - EnvelopeSent([][]byte) - EnvelopeExpired([][]byte, error) - MailServerRequestCompleted(types.Hash, types.Hash, []byte, error) - MailServerRequestExpired(types.Hash) -} diff --git a/vendor/github.com/status-im/status-go/protocol/transport/filter.go b/vendor/github.com/status-im/status-go/protocol/transport/filter.go deleted file mode 100644 index a1f7369a5..000000000 --- a/vendor/github.com/status-im/status-go/protocol/transport/filter.go +++ /dev/null @@ -1,30 +0,0 @@ -package transport - -import "github.com/status-im/status-go/eth-node/types" - -// TODO: revise fields encoding/decoding. Some are encoded using hexutil and some using encoding/hex. -type Filter struct { - // ChatID is the identifier of the chat - ChatID string `json:"chatId"` - // FilterID the whisper filter id generated - FilterID string `json:"filterId"` - // SymKeyID is the symmetric key id used for symmetric filters - SymKeyID string `json:"symKeyId"` - // OneToOne tells us if we need to use asymmetric encryption for this chat - OneToOne bool `json:"oneToOne"` - // Identity is the public key of the other recipient for non-public filters. - // It's encoded using encoding/hex. - Identity string `json:"identity"` - // Topic is the whisper topic - Topic types.TopicType `json:"topic"` - // Discovery is whether this is a discovery topic - Discovery bool `json:"discovery"` - // Negotiated tells us whether is a negotiated topic - Negotiated bool `json:"negotiated"` - // Listen is whether we are actually listening for messages on this chat, or the filter is only created in order to be able to post on the topic - Listen bool `json:"listen"` -} - -func (c *Filter) IsPublic() bool { - return !c.OneToOne -} diff --git a/vendor/github.com/status-im/status-go/protocol/transport/filters_manager.go b/vendor/github.com/status-im/status-go/protocol/transport/filters_manager.go deleted file mode 100644 index ad914e9d7..000000000 --- a/vendor/github.com/status-im/status-go/protocol/transport/filters_manager.go +++ /dev/null @@ -1,480 +0,0 @@ -package transport - -import ( - "crypto/ecdsa" - "encoding/hex" - "sync" - - "github.com/pkg/errors" - "go.uber.org/zap" - - "github.com/status-im/status-go/eth-node/types" -) - -const ( - minPow = 0.0 -) - -type RawFilter struct { - FilterID string - Topic types.TopicType - SymKeyID string -} - -type KeysPersistence interface { - All() (map[string][]byte, error) - Add(chatID string, key []byte) error -} - -type FiltersService interface { - AddKeyPair(key *ecdsa.PrivateKey) (string, error) - DeleteKeyPair(keyID string) bool - - AddSymKeyDirect(key []byte) (string, error) - AddSymKeyFromPassword(password string) (string, error) - GetSymKey(id string) ([]byte, error) - DeleteSymKey(id string) bool - - Subscribe(opts *types.SubscriptionOptions) (string, error) - Unsubscribe(id string) error -} - -type FiltersManager struct { - service FiltersService - persistence KeysPersistence - privateKey *ecdsa.PrivateKey - keys map[string][]byte // a cache of symmetric manager derived from passwords - logger *zap.Logger - - genericDiscoveryTopicEnabled bool - - mutex sync.Mutex - filters map[string]*Filter -} - -// NewFiltersManager returns a new filtersManager. -func NewFiltersManager(persistence KeysPersistence, service FiltersService, privateKey *ecdsa.PrivateKey, logger *zap.Logger) (*FiltersManager, error) { - if logger == nil { - logger = zap.NewNop() - } - - keys, err := persistence.All() - if err != nil { - return nil, err - } - - return &FiltersManager{ - privateKey: privateKey, - service: service, - persistence: persistence, - keys: keys, - filters: make(map[string]*Filter), - logger: logger.With(zap.Namespace("filtersManager")), - }, nil -} - -func (s *FiltersManager) Init( - chatIDs []string, - publicKeys []*ecdsa.PublicKey, -) ([]*Filter, error) { - logger := s.logger.With(zap.String("site", "Init")) - - logger.Info("initializing") - - // Load our contact code. - _, err := s.LoadContactCode(&s.privateKey.PublicKey) - if err != nil { - return nil, errors.Wrap(err, "failed to load contact code") - } - - // Load partitioned topic. - _, err = s.loadMyPartitioned() - if err != nil { - return nil, err - } - - // Add discovery topic. - _, err = s.LoadDiscovery() - if err != nil { - return nil, err - } - - // Add public, one-to-one and negotiated filters. - for _, chatID := range chatIDs { - _, err := s.LoadPublic(chatID) - if err != nil { - return nil, err - } - } - - for _, publicKey := range publicKeys { - _, err := s.LoadContactCode(publicKey) - if err != nil { - return nil, err - } - } - - s.mutex.Lock() - defer s.mutex.Unlock() - - var allFilters []*Filter - for _, f := range s.filters { - allFilters = append(allFilters, f) - } - return allFilters, nil -} - -// DEPRECATED -func (s *FiltersManager) InitWithFilters(filters []*Filter) ([]*Filter, error) { - var ( - chatIDs []string - publicKeys []*ecdsa.PublicKey - ) - - for _, filter := range filters { - if filter.Identity != "" && filter.OneToOne { - publicKey, err := StrToPublicKey(filter.Identity) - if err != nil { - return nil, err - } - publicKeys = append(publicKeys, publicKey) - } else if filter.ChatID != "" { - chatIDs = append(chatIDs, filter.ChatID) - } - } - - return s.Init(chatIDs, publicKeys) -} - -func (s *FiltersManager) Reset() error { - var filters []*Filter - - s.mutex.Lock() - for _, f := range s.filters { - filters = append(filters, f) - } - s.mutex.Unlock() - - return s.Remove(filters...) -} - -func (s *FiltersManager) Filters() (result []*Filter) { - s.mutex.Lock() - defer s.mutex.Unlock() - - for _, f := range s.filters { - result = append(result, f) - } - - return -} - -func (s *FiltersManager) Filter(chatID string) *Filter { - s.mutex.Lock() - defer s.mutex.Unlock() - return s.filters[chatID] -} - -// FilterByFilterID returns a Filter with a given Whisper filter ID. -func (s *FiltersManager) FilterByFilterID(filterID string) *Filter { - s.mutex.Lock() - defer s.mutex.Unlock() - for _, f := range s.filters { - if f.FilterID == filterID { - return f - } - } - return nil -} - -func (s *FiltersManager) FiltersByPublicKey(publicKey *ecdsa.PublicKey) (result []*Filter) { - s.mutex.Lock() - defer s.mutex.Unlock() - - identityStr := PublicKeyToStr(publicKey) - - for _, f := range s.filters { - if f.Identity == identityStr { - result = append(result, f) - } - } - - return -} - -// Remove remove all the filters associated with a chat/identity -func (s *FiltersManager) Remove(filters ...*Filter) error { - s.mutex.Lock() - defer s.mutex.Unlock() - - for _, f := range filters { - if err := s.service.Unsubscribe(f.FilterID); err != nil { - return err - } - if f.SymKeyID != "" { - s.service.DeleteSymKey(f.SymKeyID) - } - delete(s.filters, f.ChatID) - } - - return nil -} - -// LoadPartitioned creates a filter for a partitioned topic. -func (s *FiltersManager) LoadPartitioned(publicKey *ecdsa.PublicKey) (*Filter, error) { - return s.loadPartitioned(publicKey, false) -} - -func (s *FiltersManager) loadMyPartitioned() (*Filter, error) { - return s.loadPartitioned(&s.privateKey.PublicKey, true) -} - -func (s *FiltersManager) loadPartitioned(publicKey *ecdsa.PublicKey, listen bool) (*Filter, error) { - s.mutex.Lock() - defer s.mutex.Unlock() - - chatID := PartitionedTopic(publicKey) - if _, ok := s.filters[chatID]; ok { - return s.filters[chatID], nil - } - - // We set up a filter so we can publish, - // but we discard envelopes if listen is false. - filter, err := s.addAsymmetric(chatID, listen) - if err != nil { - return nil, err - } - - chat := &Filter{ - ChatID: chatID, - FilterID: filter.FilterID, - Topic: filter.Topic, - Identity: PublicKeyToStr(publicKey), - Listen: listen, - OneToOne: true, - } - - s.filters[chatID] = chat - - return chat, nil -} - -// LoadNegotiated loads a negotiated secret as a filter. -func (s *FiltersManager) LoadNegotiated(secret types.NegotiatedSecret) (*Filter, error) { - s.mutex.Lock() - defer s.mutex.Unlock() - - chatID := NegotiatedTopic(secret.PublicKey) - - if _, ok := s.filters[chatID]; ok { - return s.filters[chatID], nil - } - - keyString := hex.EncodeToString(secret.Key) - filter, err := s.addSymmetric(keyString) - if err != nil { - return nil, err - } - - chat := &Filter{ - ChatID: chatID, - Topic: filter.Topic, - SymKeyID: filter.SymKeyID, - FilterID: filter.FilterID, - Identity: PublicKeyToStr(secret.PublicKey), - Negotiated: true, - Listen: true, - OneToOne: true, - } - - s.filters[chat.ChatID] = chat - - return chat, nil -} - -// LoadDiscovery adds 1 discovery filter -// for the personal discovery topic. -func (s *FiltersManager) LoadDiscovery() ([]*Filter, error) { - s.mutex.Lock() - defer s.mutex.Unlock() - - personalDiscoveryTopic := PersonalDiscoveryTopic(&s.privateKey.PublicKey) - - // Check if filters are already loaded. - var result []*Filter - - expectedTopicCount := 1 - - if chat, ok := s.filters[personalDiscoveryTopic]; ok { - result = append(result, chat) - } - - if len(result) == expectedTopicCount { - return result, nil - } - - identityStr := PublicKeyToStr(&s.privateKey.PublicKey) - - // Load personal discovery - personalDiscoveryChat := &Filter{ - ChatID: personalDiscoveryTopic, - Identity: identityStr, - Discovery: true, - Listen: true, - OneToOne: true, - } - - discoveryResponse, err := s.addAsymmetric(personalDiscoveryChat.ChatID, true) - if err != nil { - return nil, err - } - - personalDiscoveryChat.Topic = discoveryResponse.Topic - personalDiscoveryChat.FilterID = discoveryResponse.FilterID - - s.filters[personalDiscoveryChat.ChatID] = personalDiscoveryChat - - return []*Filter{personalDiscoveryChat}, nil -} - -// LoadPublic adds a filter for a public chat. -func (s *FiltersManager) LoadPublic(chatID string) (*Filter, error) { - s.mutex.Lock() - defer s.mutex.Unlock() - - if chat, ok := s.filters[chatID]; ok { - return chat, nil - } - - filterAndTopic, err := s.addSymmetric(chatID) - if err != nil { - return nil, err - } - - chat := &Filter{ - ChatID: chatID, - FilterID: filterAndTopic.FilterID, - SymKeyID: filterAndTopic.SymKeyID, - Topic: filterAndTopic.Topic, - Listen: true, - OneToOne: false, - } - - s.filters[chatID] = chat - - return chat, nil -} - -// LoadContactCode creates a filter for the advertise topic for a given public key. -func (s *FiltersManager) LoadContactCode(pubKey *ecdsa.PublicKey) (*Filter, error) { - s.mutex.Lock() - defer s.mutex.Unlock() - - chatID := ContactCodeTopic(pubKey) - - if _, ok := s.filters[chatID]; ok { - return s.filters[chatID], nil - } - - contactCodeFilter, err := s.addSymmetric(chatID) - if err != nil { - return nil, err - } - - chat := &Filter{ - ChatID: chatID, - FilterID: contactCodeFilter.FilterID, - Topic: contactCodeFilter.Topic, - SymKeyID: contactCodeFilter.SymKeyID, - Identity: PublicKeyToStr(pubKey), - Listen: true, - } - - s.filters[chatID] = chat - return chat, nil -} - -// addSymmetric adds a symmetric key filter -func (s *FiltersManager) addSymmetric(chatID string) (*RawFilter, error) { - var symKeyID string - var err error - - topic := ToTopic(chatID) - topics := [][]byte{topic} - - symKey, ok := s.keys[chatID] - if ok { - symKeyID, err = s.service.AddSymKeyDirect(symKey) - if err != nil { - return nil, err - } - } else { - symKeyID, err = s.service.AddSymKeyFromPassword(chatID) - if err != nil { - return nil, err - } - if symKey, err = s.service.GetSymKey(symKeyID); err != nil { - return nil, err - } - s.keys[chatID] = symKey - - err = s.persistence.Add(chatID, symKey) - if err != nil { - return nil, err - } - } - - id, err := s.service.Subscribe(&types.SubscriptionOptions{ - SymKeyID: symKeyID, - PoW: minPow, - Topics: topics, - }) - if err != nil { - return nil, err - } - - return &RawFilter{ - FilterID: id, - SymKeyID: symKeyID, - Topic: types.BytesToTopic(topic), - }, nil -} - -// addAsymmetricFilter adds a filter with our private key -// and set minPow according to the listen parameter. -func (s *FiltersManager) addAsymmetric(chatID string, listen bool) (*RawFilter, error) { - var ( - err error - pow = 1.0 // use PoW high enough to discard all messages for the filter - ) - - if listen { - pow = minPow - } - - topic := ToTopic(chatID) - topics := [][]byte{topic} - - privateKeyID, err := s.service.AddKeyPair(s.privateKey) - if err != nil { - return nil, err - } - - id, err := s.service.Subscribe(&types.SubscriptionOptions{ - PrivateKeyID: privateKeyID, - PoW: pow, - Topics: topics, - }) - if err != nil { - return nil, err - } - return &RawFilter{FilterID: id, Topic: types.BytesToTopic(topic)}, nil -} - -// GetNegotiated returns a negotiated chat given an identity -func (s *FiltersManager) GetNegotiated(identity *ecdsa.PublicKey) *Filter { - s.mutex.Lock() - defer s.mutex.Unlock() - - return s.filters[NegotiatedTopic(identity)] -} diff --git a/vendor/github.com/status-im/status-go/protocol/transport/message.go b/vendor/github.com/status-im/status-go/protocol/transport/message.go deleted file mode 100644 index 3d7d9d499..000000000 --- a/vendor/github.com/status-im/status-go/protocol/transport/message.go +++ /dev/null @@ -1,13 +0,0 @@ -package transport - -import "github.com/status-im/status-go/eth-node/types" - -func DefaultMessage() types.NewMessage { - msg := types.NewMessage{} - - msg.TTL = 10 - msg.PowTarget = 0.002 - msg.PowTime = 1 - - return msg -} diff --git a/vendor/github.com/status-im/status-go/protocol/transport/topic.go b/vendor/github.com/status-im/status-go/protocol/transport/topic.go deleted file mode 100644 index 876e6e39f..000000000 --- a/vendor/github.com/status-im/status-go/protocol/transport/topic.go +++ /dev/null @@ -1,59 +0,0 @@ -package transport - -import ( - "crypto/ecdsa" - "encoding/hex" - "math/big" - "strconv" - - "github.com/status-im/status-go/eth-node/crypto" - "github.com/status-im/status-go/eth-node/types" -) - -const discoveryTopic = "contact-discovery" - -var ( - // The number of partitions. - nPartitions = big.NewInt(5000) -) - -// ToTopic converts a string to a whisper topic. -func ToTopic(s string) []byte { - return crypto.Keccak256([]byte(s))[:types.TopicLength] -} - -func StrToPublicKey(str string) (*ecdsa.PublicKey, error) { - publicKeyBytes, err := hex.DecodeString(str) - if err != nil { - return nil, err - } - return crypto.UnmarshalPubkey(publicKeyBytes) -} - -func PublicKeyToStr(publicKey *ecdsa.PublicKey) string { - return hex.EncodeToString(crypto.FromECDSAPub(publicKey)) -} - -func PersonalDiscoveryTopic(publicKey *ecdsa.PublicKey) string { - return "contact-discovery-" + PublicKeyToStr(publicKey) -} - -// PartitionedTopic returns the associated partitioned topic string -// with the given public key. -func PartitionedTopic(publicKey *ecdsa.PublicKey) string { - partition := big.NewInt(0) - partition.Mod(publicKey.X, nPartitions) - return "contact-discovery-" + strconv.FormatInt(partition.Int64(), 10) -} - -func ContactCodeTopic(publicKey *ecdsa.PublicKey) string { - return "0x" + PublicKeyToStr(publicKey) + "-contact-code" -} - -func NegotiatedTopic(publicKey *ecdsa.PublicKey) string { - return "0x" + PublicKeyToStr(publicKey) + "-negotiated" -} - -func DiscoveryTopic() string { - return discoveryTopic -} diff --git a/vendor/github.com/status-im/status-go/protocol/transport/transport.go b/vendor/github.com/status-im/status-go/protocol/transport/transport.go deleted file mode 100644 index 6a75fe546..000000000 --- a/vendor/github.com/status-im/status-go/protocol/transport/transport.go +++ /dev/null @@ -1,40 +0,0 @@ -package transport - -import ( - "context" - "crypto/ecdsa" - - "github.com/status-im/status-go/eth-node/types" -) - -type Transport interface { - Stop() error - - JoinPrivate(publicKey *ecdsa.PublicKey) error - LeavePrivate(publicKey *ecdsa.PublicKey) error - JoinGroup(publicKeys []*ecdsa.PublicKey) error - LeaveGroup(publicKeys []*ecdsa.PublicKey) error - JoinPublic(chatID string) error - LeavePublic(chatID string) error - GetCurrentTime() uint64 - - SendPublic(ctx context.Context, newMessage *types.NewMessage, chatName string) ([]byte, error) - SendPrivateWithSharedSecret(ctx context.Context, newMessage *types.NewMessage, publicKey *ecdsa.PublicKey, secret []byte) ([]byte, error) - SendPrivateWithPartitioned(ctx context.Context, newMessage *types.NewMessage, publicKey *ecdsa.PublicKey) ([]byte, error) - SendMessagesRequest( - ctx context.Context, - peerID []byte, - from, to uint32, - previousCursor []byte, - ) (cursor []byte, err error) - - Track(identifiers [][]byte, hash []byte, newMessage *types.NewMessage) - - InitFilters(chatIDs []string, publicKeys []*ecdsa.PublicKey) ([]*Filter, error) - LoadFilters(filters []*Filter) ([]*Filter, error) - RemoveFilters(filters []*Filter) error - ResetFilters() error - Filters() []*Filter - ProcessNegotiatedSecret(secret types.NegotiatedSecret) (*Filter, error) - RetrieveRawAll() (map[Filter][]*types.Message, error) -} diff --git a/vendor/github.com/status-im/status-go/protocol/transport/waku/envelopes.go b/vendor/github.com/status-im/status-go/protocol/transport/waku/envelopes.go deleted file mode 100644 index 0d991475f..000000000 --- a/vendor/github.com/status-im/status-go/protocol/transport/waku/envelopes.go +++ /dev/null @@ -1,310 +0,0 @@ -package waku - -import ( - "context" - "errors" - "sync" - - "go.uber.org/zap" - - "github.com/status-im/status-go/eth-node/types" - "github.com/status-im/status-go/protocol/transport" -) - -// EnvelopeState in local tracker -type EnvelopeState int - -const ( - // NotRegistered returned if asked hash wasn't registered in the tracker. - NotRegistered EnvelopeState = -1 - // EnvelopePosted is set when envelope was added to a local waku queue. - EnvelopePosted EnvelopeState = iota - // EnvelopeSent is set when envelope is sent to at least one peer. - EnvelopeSent -) - -// EnvelopeEventsHandler used for two different event types. -type EnvelopeEventsHandler interface { - EnvelopeSent([][]byte) - EnvelopeExpired([][]byte, error) - MailServerRequestCompleted(types.Hash, types.Hash, []byte, error) - MailServerRequestExpired(types.Hash) -} - -// NewEnvelopesMonitor returns a pointer to an instance of the EnvelopesMonitor. -func NewEnvelopesMonitor(w types.Waku, config transport.EnvelopesMonitorConfig) *EnvelopesMonitor { - logger := config.Logger - - if logger == nil { - logger = zap.NewNop() - } - - var api types.PublicWakuAPI - if w != nil { - api = w.PublicWakuAPI() - } - - return &EnvelopesMonitor{ - w: w, - api: api, - handler: config.EnvelopeEventsHandler, - mailServerConfirmation: config.MailserverConfirmationsEnabled, - maxAttempts: config.MaxAttempts, - isMailserver: config.IsMailserver, - logger: logger.With(zap.Namespace("EnvelopesMonitor")), - - // key is envelope hash (event.Hash) - envelopes: map[types.Hash]EnvelopeState{}, - messages: map[types.Hash]*types.NewMessage{}, - attempts: map[types.Hash]int{}, - identifiers: make(map[types.Hash][][]byte), - - // key is hash of the batch (event.Batch) - batches: map[types.Hash]map[types.Hash]struct{}{}, - } -} - -// EnvelopesMonitor is responsible for monitoring waku envelopes state. -type EnvelopesMonitor struct { - w types.Waku - api types.PublicWakuAPI - handler EnvelopeEventsHandler - mailServerConfirmation bool - maxAttempts int - - mu sync.Mutex - envelopes map[types.Hash]EnvelopeState - batches map[types.Hash]map[types.Hash]struct{} - - messages map[types.Hash]*types.NewMessage - attempts map[types.Hash]int - identifiers map[types.Hash][][]byte - - wg sync.WaitGroup - quit chan struct{} - isMailserver func(peer types.EnodeID) bool - - logger *zap.Logger -} - -// Start processing events. -func (m *EnvelopesMonitor) Start() { - m.quit = make(chan struct{}) - m.wg.Add(1) - go func() { - m.handleEnvelopeEvents() - m.wg.Done() - }() -} - -// Stop process events. -func (m *EnvelopesMonitor) Stop() { - close(m.quit) - m.wg.Wait() -} - -// Add hash to a tracker. -func (m *EnvelopesMonitor) Add(identifiers [][]byte, envelopeHash types.Hash, message types.NewMessage) { - m.mu.Lock() - defer m.mu.Unlock() - m.envelopes[envelopeHash] = EnvelopePosted - m.identifiers[envelopeHash] = identifiers - m.messages[envelopeHash] = &message - m.attempts[envelopeHash] = 1 -} - -func (m *EnvelopesMonitor) GetState(hash types.Hash) EnvelopeState { - m.mu.Lock() - defer m.mu.Unlock() - state, exist := m.envelopes[hash] - if !exist { - return NotRegistered - } - return state -} - -// handleEnvelopeEvents processes waku envelope events -func (m *EnvelopesMonitor) handleEnvelopeEvents() { - events := make(chan types.EnvelopeEvent, 100) // must be buffered to prevent blocking waku - sub := m.w.SubscribeEnvelopeEvents(events) - defer func() { - close(events) - sub.Unsubscribe() - }() - for { - select { - case <-m.quit: - return - case event := <-events: - m.handleEvent(event) - } - } -} - -// handleEvent based on type of the event either triggers -// confirmation handler or removes hash from tracker -func (m *EnvelopesMonitor) handleEvent(event types.EnvelopeEvent) { - handlers := map[types.EventType]func(types.EnvelopeEvent){ - types.EventEnvelopeSent: m.handleEventEnvelopeSent, - types.EventEnvelopeExpired: m.handleEventEnvelopeExpired, - types.EventBatchAcknowledged: m.handleAcknowledgedBatch, - types.EventEnvelopeReceived: m.handleEventEnvelopeReceived, - } - if handler, ok := handlers[event.Event]; ok { - handler(event) - } -} - -func (m *EnvelopesMonitor) handleEventEnvelopeSent(event types.EnvelopeEvent) { - if m.mailServerConfirmation { - if !m.isMailserver(event.Peer) { - return - } - } - - m.mu.Lock() - defer m.mu.Unlock() - - state, ok := m.envelopes[event.Hash] - // if we didn't send a message using extension - skip it - // if message was already confirmed - skip it - if !ok || state == EnvelopeSent { - return - } - m.logger.Debug("envelope is sent", zap.String("hash", event.Hash.String()), zap.String("peer", event.Peer.String())) - if event.Batch != (types.Hash{}) { - if _, ok := m.batches[event.Batch]; !ok { - m.batches[event.Batch] = map[types.Hash]struct{}{} - } - m.batches[event.Batch][event.Hash] = struct{}{} - m.logger.Debug("waiting for a confirmation", zap.String("batch", event.Batch.String())) - } else { - m.envelopes[event.Hash] = EnvelopeSent - if m.handler != nil { - m.handler.EnvelopeSent(m.identifiers[event.Hash]) - } - } -} - -func (m *EnvelopesMonitor) handleAcknowledgedBatch(event types.EnvelopeEvent) { - if m.mailServerConfirmation { - if !m.isMailserver(event.Peer) { - return - } - } - - m.mu.Lock() - defer m.mu.Unlock() - - envelopes, ok := m.batches[event.Batch] - if !ok { - m.logger.Debug("batch is not found", zap.String("batch", event.Batch.String())) - } - m.logger.Debug("received a confirmation", zap.String("batch", event.Batch.String()), zap.String("peer", event.Peer.String())) - envelopeErrors, ok := event.Data.([]types.EnvelopeError) - if event.Data != nil && !ok { - m.logger.Error("received unexpected data in the the confirmation event", zap.Any("data", event.Data)) - } - failedEnvelopes := map[types.Hash]struct{}{} - for i := range envelopeErrors { - envelopeError := envelopeErrors[i] - _, exist := m.envelopes[envelopeError.Hash] - if exist { - m.logger.Warn("envelope that was posted by us is discarded", zap.String("hash", envelopeError.Hash.String()), zap.String("peer", event.Peer.String()), zap.String("error", envelopeError.Description)) - var err error - switch envelopeError.Code { - case types.EnvelopeTimeNotSynced: - err = errors.New("envelope wasn't delivered due to time sync issues") - } - m.handleEnvelopeFailure(envelopeError.Hash, err) - } - failedEnvelopes[envelopeError.Hash] = struct{}{} - } - - for hash := range envelopes { - if _, exist := failedEnvelopes[hash]; exist { - continue - } - state, ok := m.envelopes[hash] - if !ok || state == EnvelopeSent { - continue - } - m.envelopes[hash] = EnvelopeSent - if m.handler != nil { - m.handler.EnvelopeSent(m.identifiers[hash]) - } - } - delete(m.batches, event.Batch) -} - -func (m *EnvelopesMonitor) handleEventEnvelopeExpired(event types.EnvelopeEvent) { - m.mu.Lock() - defer m.mu.Unlock() - m.handleEnvelopeFailure(event.Hash, errors.New("envelope expired due to connectivity issues")) -} - -// 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 types.Hash, err error) { - if state, ok := m.envelopes[hash]; ok { - message, exist := m.messages[hash] - if !exist { - m.logger.Error("message was deleted erroneously", zap.String("envelope hash", hash.String())) - } - attempt := m.attempts[hash] - identifiers := m.identifiers[hash] - m.clearMessageState(hash) - if state == EnvelopeSent { - return - } - if attempt < m.maxAttempts { - m.logger.Debug("retrying to send a message", zap.String("hash", hash.String()), zap.Int("attempt", attempt+1)) - hex, err := m.api.Post(context.TODO(), *message) - if err != nil { - m.logger.Error("failed to retry sending message", zap.String("hash", hash.String()), zap.Int("attempt", attempt+1), zap.Error(err)) - if m.handler != nil { - m.handler.EnvelopeExpired(identifiers, err) - } - - } - envelopeID := types.BytesToHash(hex) - m.envelopes[envelopeID] = EnvelopePosted - m.messages[envelopeID] = message - m.attempts[envelopeID] = attempt + 1 - m.identifiers[envelopeID] = identifiers - } else { - m.logger.Debug("envelope expired", zap.String("hash", hash.String())) - if m.handler != nil { - m.handler.EnvelopeExpired(identifiers, err) - } - } - } -} - -func (m *EnvelopesMonitor) handleEventEnvelopeReceived(event types.EnvelopeEvent) { - if m.mailServerConfirmation { - if !m.isMailserver(event.Peer) { - return - } - } - m.mu.Lock() - defer m.mu.Unlock() - state, ok := m.envelopes[event.Hash] - if !ok || state != EnvelopePosted { - return - } - m.logger.Debug("expected envelope received", zap.String("hash", event.Hash.String()), zap.String("peer", event.Peer.String())) - m.envelopes[event.Hash] = EnvelopeSent - if m.handler != nil { - m.handler.EnvelopeSent(m.identifiers[event.Hash]) - } -} - -// clearMessageState removes all message and envelope state. -// not thread-safe, should be protected on a higher level. -func (m *EnvelopesMonitor) clearMessageState(envelopeID types.Hash) { - delete(m.envelopes, envelopeID) - delete(m.messages, envelopeID) - delete(m.attempts, envelopeID) - delete(m.identifiers, envelopeID) -} diff --git a/vendor/github.com/status-im/status-go/protocol/transport/waku/mailserver.go b/vendor/github.com/status-im/status-go/protocol/transport/waku/mailserver.go deleted file mode 100644 index b4419d10f..000000000 --- a/vendor/github.com/status-im/status-go/protocol/transport/waku/mailserver.go +++ /dev/null @@ -1,38 +0,0 @@ -package waku - -import ( - "encoding/hex" - "math/big" - - "github.com/google/uuid" - - "github.com/status-im/status-go/eth-node/types" -) - -func createMessagesRequest(from, to uint32, cursor []byte, topics []types.TopicType) types.MessagesRequest { - aUUID := uuid.New() - // uuid is 16 bytes, converted to hex it's 32 bytes as expected by types.MessagesRequest - id := []byte(hex.EncodeToString(aUUID[:])) - return types.MessagesRequest{ - ID: id, - From: from, - To: to, - Limit: 100, - Cursor: cursor, - Bloom: topicsToBloom(topics...), - } -} - -func topicsToBloom(topics ...types.TopicType) []byte { - i := new(big.Int) - for _, topic := range topics { - bloom := types.TopicToBloom(topic) - i.Or(i, new(big.Int).SetBytes(bloom[:])) - } - - combined := make([]byte, types.BloomFilterSize) - data := i.Bytes() - copy(combined[types.BloomFilterSize-len(data):], data[:]) - - return combined -} diff --git a/vendor/github.com/status-im/status-go/protocol/transport/waku/migrations/migrations.go b/vendor/github.com/status-im/status-go/protocol/transport/waku/migrations/migrations.go deleted file mode 100644 index 5af483398..000000000 --- a/vendor/github.com/status-im/status-go/protocol/transport/waku/migrations/migrations.go +++ /dev/null @@ -1,319 +0,0 @@ -// Code generated by go-bindata. DO NOT EDIT. -// sources: -// 1561059284_add_waku_keys.down.sql (22B) -// 1561059284_add_waku_keys.up.sql (109B) -// doc.go (373B) - -package sqlite - -import ( - "bytes" - "compress/gzip" - "crypto/sha256" - "fmt" - "io" - "io/ioutil" - "os" - "path/filepath" - "strings" - "time" -) - -func bindataRead(data []byte, name string) ([]byte, error) { - gz, err := gzip.NewReader(bytes.NewBuffer(data)) - if err != nil { - return nil, fmt.Errorf("read %q: %v", name, err) - } - - var buf bytes.Buffer - _, err = io.Copy(&buf, gz) - clErr := gz.Close() - - if err != nil { - return nil, fmt.Errorf("read %q: %v", name, err) - } - if clErr != nil { - return nil, err - } - - return buf.Bytes(), nil -} - -type asset struct { - bytes []byte - info os.FileInfo - digest [sha256.Size]byte -} - -type bindataFileInfo struct { - name string - size int64 - mode os.FileMode - modTime time.Time -} - -func (fi bindataFileInfo) Name() string { - return fi.name -} -func (fi bindataFileInfo) Size() int64 { - return fi.size -} -func (fi bindataFileInfo) Mode() os.FileMode { - return fi.mode -} -func (fi bindataFileInfo) ModTime() time.Time { - return fi.modTime -} -func (fi bindataFileInfo) IsDir() bool { - return false -} -func (fi bindataFileInfo) Sys() interface{} { - return nil -} - -var __1561059284_add_waku_keysDownSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x72\x09\xf2\x0f\x50\x08\x71\x74\xf2\x71\x55\x28\x4f\xcc\x2e\x8d\xcf\x4e\xad\x2c\xb6\xe6\x02\x04\x00\x00\xff\xff\x4f\x00\xe6\x8e\x16\x00\x00\x00") - -func _1561059284_add_waku_keysDownSqlBytes() ([]byte, error) { - return bindataRead( - __1561059284_add_waku_keysDownSql, - "1561059284_add_waku_keys.down.sql", - ) -} - -func _1561059284_add_waku_keysDownSql() (*asset, error) { - bytes, err := _1561059284_add_waku_keysDownSqlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "1561059284_add_waku_keys.down.sql", size: 22, mode: os.FileMode(0644), modTime: time.Unix(1579069853, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xe5, 0x2a, 0x7e, 0x9, 0xa3, 0xdd, 0xc6, 0x3, 0xfa, 0xaa, 0x98, 0xa0, 0x26, 0x5e, 0x67, 0x43, 0xe6, 0x20, 0xfd, 0x10, 0xfd, 0x60, 0x89, 0x17, 0x13, 0x87, 0x1b, 0x44, 0x36, 0x79, 0xb6, 0x60}} - return a, nil -} - -var __1561059284_add_waku_keysUpSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x04\xc0\xb1\x0a\xc2\x40\x0c\x06\xe0\xfd\x9e\xe2\x1f\x15\x7c\x03\xa7\xbb\x33\x6a\x30\x26\x12\x52\x6a\xa7\x52\xb4\xa0\xdc\xa8\x22\x7d\xfb\x7e\xd5\x29\x07\x21\x72\x11\xc2\x7f\x6a\xbf\xb1\xcd\xcb\x07\x9b\x04\x3c\x5e\xd3\x77\x7c\x3f\x11\x74\x0f\xdc\x9c\xaf\xd9\x07\x5c\x68\x80\x29\xaa\xe9\x51\xb8\x06\xf8\xa4\xe6\xb4\x4b\x40\x9b\x17\x14\xb1\x02\xb5\x80\x76\x22\x69\x8b\x9e\xe3\x6c\x5d\xc0\xad\xe7\xc3\x3e\xad\x01\x00\x00\xff\xff\xbc\x45\x31\x54\x6d\x00\x00\x00") - -func _1561059284_add_waku_keysUpSqlBytes() ([]byte, error) { - return bindataRead( - __1561059284_add_waku_keysUpSql, - "1561059284_add_waku_keys.up.sql", - ) -} - -func _1561059284_add_waku_keysUpSql() (*asset, error) { - bytes, err := _1561059284_add_waku_keysUpSqlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "1561059284_add_waku_keys.up.sql", size: 109, mode: os.FileMode(0644), modTime: time.Unix(1579069853, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xa9, 0x5c, 0x8, 0x32, 0xef, 0x12, 0x88, 0x21, 0xd, 0x7a, 0x42, 0x4d, 0xe7, 0x2d, 0x6c, 0x99, 0xb6, 0x1, 0xf1, 0xba, 0x2c, 0x40, 0x8d, 0xa9, 0x4b, 0xe6, 0xc4, 0x21, 0xec, 0x47, 0x6b, 0xf7}} - return a, nil -} - -var _docGo = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x84\x8f\x3d\x72\xeb\x30\x0c\x84\x7b\x9d\x62\xc7\x8d\x9b\x27\xb2\x79\x55\xba\x94\xe9\x73\x01\x98\x5a\x91\x18\x4b\xa4\x42\xc0\x7f\xb7\xcf\xc8\xe3\xc2\x5d\xda\x1d\x7c\x1f\x76\x63\xc4\x77\x51\xc3\xac\x0b\xa1\x86\xca\x44\x33\xe9\x0f\x9c\x98\xe4\x62\xc4\x21\xab\x97\xcb\x29\xa4\xb6\x46\x73\xf1\x8b\x8d\xba\xc6\x55\x73\x17\x67\xbc\xfe\x3f\x0c\x31\x22\x49\x3d\x3a\x8a\xd4\x69\xe1\xd3\x65\x30\x97\xee\x5a\x33\x6e\xea\x05\x82\xad\x73\xd6\x7b\xc0\xa7\x63\xa1\x98\xc3\x8b\xf8\xd1\xe0\x85\x48\x62\xdc\x35\x73\xeb\xc8\x6d\x3c\x69\x9d\xc4\x25\xec\xd1\xd7\xfc\x96\xec\x0d\x93\x2c\x0b\x27\xcc\xbd\xad\x4f\xd6\x64\x25\x26\xed\x4c\xde\xfa\xe3\x1f\xc4\x8c\x8e\x2a\x2b\x6d\xe7\x8b\x5c\x89\xda\x5e\xef\x21\x75\xfa\x7b\x11\x6e\xad\x9f\x0d\x62\xe0\x7d\x63\x72\x4e\x61\x18\x36\x49\x67\xc9\x84\xfd\x2c\xea\x1c\x86\x18\x73\xfb\xc8\xac\xdc\xa9\xf7\x8e\xe3\x76\xce\xaf\x2b\x8c\x0d\x21\xbc\xd4\xda\xaa\x85\xdc\x10\x86\xdf\x00\x00\x00\xff\xff\x21\xa5\x75\x05\x75\x01\x00\x00") - -func docGoBytes() ([]byte, error) { - return bindataRead( - _docGo, - "doc.go", - ) -} - -func docGo() (*asset, error) { - bytes, err := docGoBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "doc.go", size: 373, mode: os.FileMode(0644), modTime: time.Unix(1579069853, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x23, 0x6a, 0xc1, 0xce, 0x94, 0xf6, 0xef, 0xf1, 0x97, 0x95, 0xb, 0x35, 0xaf, 0x5f, 0xe7, 0x5f, 0xac, 0x6e, 0xb8, 0xab, 0xba, 0xb5, 0x35, 0x97, 0x22, 0x36, 0x11, 0xce, 0x44, 0xfc, 0xfa, 0xac}} - return a, nil -} - -// Asset loads and returns the asset for the given name. -// It returns an error if the asset could not be found or -// could not be loaded. -func Asset(name string) ([]byte, error) { - canonicalName := strings.Replace(name, "\\", "/", -1) - if f, ok := _bindata[canonicalName]; ok { - a, err := f() - if err != nil { - return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err) - } - return a.bytes, nil - } - return nil, fmt.Errorf("Asset %s not found", name) -} - -// AssetString returns the asset contents as a string (instead of a []byte). -func AssetString(name string) (string, error) { - data, err := Asset(name) - return string(data), err -} - -// MustAsset is like Asset but panics when Asset would return an error. -// It simplifies safe initialization of global variables. -func MustAsset(name string) []byte { - a, err := Asset(name) - if err != nil { - panic("asset: Asset(" + name + "): " + err.Error()) - } - - return a -} - -// MustAssetString is like AssetString but panics when Asset would return an -// error. It simplifies safe initialization of global variables. -func MustAssetString(name string) string { - return string(MustAsset(name)) -} - -// AssetInfo loads and returns the asset info for the given name. -// It returns an error if the asset could not be found or -// could not be loaded. -func AssetInfo(name string) (os.FileInfo, error) { - canonicalName := strings.Replace(name, "\\", "/", -1) - if f, ok := _bindata[canonicalName]; ok { - a, err := f() - if err != nil { - return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err) - } - return a.info, nil - } - return nil, fmt.Errorf("AssetInfo %s not found", name) -} - -// AssetDigest returns the digest of the file with the given name. It returns an -// error if the asset could not be found or the digest could not be loaded. -func AssetDigest(name string) ([sha256.Size]byte, error) { - canonicalName := strings.Replace(name, "\\", "/", -1) - if f, ok := _bindata[canonicalName]; ok { - a, err := f() - if err != nil { - return [sha256.Size]byte{}, fmt.Errorf("AssetDigest %s can't read by error: %v", name, err) - } - return a.digest, nil - } - return [sha256.Size]byte{}, fmt.Errorf("AssetDigest %s not found", name) -} - -// Digests returns a map of all known files and their checksums. -func Digests() (map[string][sha256.Size]byte, error) { - mp := make(map[string][sha256.Size]byte, len(_bindata)) - for name := range _bindata { - a, err := _bindata[name]() - if err != nil { - return nil, err - } - mp[name] = a.digest - } - return mp, nil -} - -// AssetNames returns the names of the assets. -func AssetNames() []string { - names := make([]string, 0, len(_bindata)) - for name := range _bindata { - names = append(names, name) - } - return names -} - -// _bindata is a table, holding each asset generator, mapped to its name. -var _bindata = map[string]func() (*asset, error){ - "1561059284_add_waku_keys.down.sql": _1561059284_add_waku_keysDownSql, - - "1561059284_add_waku_keys.up.sql": _1561059284_add_waku_keysUpSql, - - "doc.go": docGo, -} - -// AssetDir returns the file names below a certain -// directory embedded in the file by go-bindata. -// For example if you run go-bindata on data/... and data contains the -// following hierarchy: -// data/ -// foo.txt -// img/ -// a.png -// b.png -// then AssetDir("data") would return []string{"foo.txt", "img"}, -// AssetDir("data/img") would return []string{"a.png", "b.png"}, -// AssetDir("foo.txt") and AssetDir("notexist") would return an error, and -// AssetDir("") will return []string{"data"}. -func AssetDir(name string) ([]string, error) { - node := _bintree - if len(name) != 0 { - canonicalName := strings.Replace(name, "\\", "/", -1) - pathList := strings.Split(canonicalName, "/") - for _, p := range pathList { - node = node.Children[p] - if node == nil { - return nil, fmt.Errorf("Asset %s not found", name) - } - } - } - if node.Func != nil { - return nil, fmt.Errorf("Asset %s not found", name) - } - rv := make([]string, 0, len(node.Children)) - for childName := range node.Children { - rv = append(rv, childName) - } - return rv, nil -} - -type bintree struct { - Func func() (*asset, error) - Children map[string]*bintree -} - -var _bintree = &bintree{nil, map[string]*bintree{ - "1561059284_add_waku_keys.down.sql": &bintree{_1561059284_add_waku_keysDownSql, map[string]*bintree{}}, - "1561059284_add_waku_keys.up.sql": &bintree{_1561059284_add_waku_keysUpSql, map[string]*bintree{}}, - "doc.go": &bintree{docGo, map[string]*bintree{}}, -}} - -// RestoreAsset restores an asset under the given directory. -func RestoreAsset(dir, name string) error { - data, err := Asset(name) - if err != nil { - return err - } - info, err := AssetInfo(name) - if err != nil { - return err - } - err = os.MkdirAll(_filePath(dir, filepath.Dir(name)), os.FileMode(0755)) - if err != nil { - return err - } - err = ioutil.WriteFile(_filePath(dir, name), data, info.Mode()) - if err != nil { - return err - } - return os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime()) -} - -// RestoreAssets restores an asset under the given directory recursively. -func RestoreAssets(dir, name string) error { - children, err := AssetDir(name) - // File - if err != nil { - return RestoreAsset(dir, name) - } - // Dir - for _, child := range children { - err = RestoreAssets(dir, filepath.Join(name, child)) - if err != nil { - return err - } - } - return nil -} - -func _filePath(dir, name string) string { - canonicalName := strings.Replace(name, "\\", "/", -1) - return filepath.Join(append([]string{dir}, strings.Split(canonicalName, "/")...)...) -} diff --git a/vendor/github.com/status-im/status-go/protocol/transport/waku/persistence.go b/vendor/github.com/status-im/status-go/protocol/transport/waku/persistence.go deleted file mode 100644 index df5e89e68..000000000 --- a/vendor/github.com/status-im/status-go/protocol/transport/waku/persistence.go +++ /dev/null @@ -1,57 +0,0 @@ -package waku - -import ( - "database/sql" -) - -type sqlitePersistence struct { - db *sql.DB -} - -func newSQLitePersistence(db *sql.DB) *sqlitePersistence { - return &sqlitePersistence{db: db} -} - -func (s *sqlitePersistence) Add(chatID string, key []byte) error { - statement := "INSERT INTO waku_keys(chat_id, key) VALUES(?, ?)" - stmt, err := s.db.Prepare(statement) - if err != nil { - return err - } - defer stmt.Close() - - _, err = stmt.Exec(chatID, key) - return err -} - -func (s *sqlitePersistence) All() (map[string][]byte, error) { - keys := make(map[string][]byte) - - statement := "SELECT chat_id, key FROM waku_keys" - - stmt, err := s.db.Prepare(statement) - if err != nil { - return nil, err - } - defer stmt.Close() - - rows, err := stmt.Query() - if err != nil && err != sql.ErrNoRows { - return nil, err - } - - for rows.Next() { - var ( - chatID string - key []byte - ) - - err := rows.Scan(&chatID, &key) - if err != nil { - return nil, err - } - keys[chatID] = key - } - - return keys, nil -} diff --git a/vendor/github.com/status-im/status-go/protocol/transport/waku/waku.go b/vendor/github.com/status-im/status-go/protocol/transport/waku/waku.go deleted file mode 100644 index 3a0eaa4ea..000000000 --- a/vendor/github.com/status-im/status-go/protocol/transport/waku/waku.go +++ /dev/null @@ -1,13 +0,0 @@ -package waku - -import ( - "github.com/status-im/status-go/eth-node/types" -) - -type RequestOptions struct { - Topics []types.TopicType - Password string - Limit int - From int64 // in seconds - To int64 // in seconds -} diff --git a/vendor/github.com/status-im/status-go/protocol/transport/waku/waku_service.go b/vendor/github.com/status-im/status-go/protocol/transport/waku/waku_service.go deleted file mode 100644 index 92adec1af..000000000 --- a/vendor/github.com/status-im/status-go/protocol/transport/waku/waku_service.go +++ /dev/null @@ -1,432 +0,0 @@ -package waku - -import ( - "bytes" - "context" - "crypto/ecdsa" - "database/sql" - "sync" - "time" - - "github.com/pkg/errors" - "go.uber.org/zap" - - "github.com/status-im/status-go/eth-node/crypto" - "github.com/status-im/status-go/eth-node/types" - "github.com/status-im/status-go/protocol/transport" -) - -var ( - // ErrNoMailservers returned if there is no configured mailservers that can be used. - ErrNoMailservers = errors.New("no configured mailservers") -) - -type wakuServiceKeysManager struct { - waku types.Waku - - // Identity of the current user. - privateKey *ecdsa.PrivateKey - - passToSymKeyMutex sync.RWMutex - passToSymKeyCache map[string]string -} - -func (m *wakuServiceKeysManager) AddOrGetKeyPair(priv *ecdsa.PrivateKey) (string, error) { - // caching is handled in waku - return m.waku.AddKeyPair(priv) -} - -func (m *wakuServiceKeysManager) AddOrGetSymKeyFromPassword(password string) (string, error) { - m.passToSymKeyMutex.Lock() - defer m.passToSymKeyMutex.Unlock() - - if val, ok := m.passToSymKeyCache[password]; ok { - return val, nil - } - - id, err := m.waku.AddSymKeyFromPassword(password) - if err != nil { - return id, err - } - - m.passToSymKeyCache[password] = id - - return id, nil -} - -func (m *wakuServiceKeysManager) RawSymKey(id string) ([]byte, error) { - return m.waku.GetSymKey(id) -} - -type Option func(*WakuServiceTransport) error - -// WakuServiceTransport is a transport based on Whisper service. -type WakuServiceTransport struct { - waku types.Waku - api types.PublicWakuAPI // only PublicWakuAPI implements logic to send messages - keysManager *wakuServiceKeysManager - filters *transport.FiltersManager - logger *zap.Logger - - mailservers []string - envelopesMonitor *EnvelopesMonitor -} - -// NewWakuServiceTransport returns a new WakuServiceTransport. -// TODO: leaving a chat should verify that for a given public key -// there are no other chats. It may happen that we leave a private chat -// but still have a public chat for a given public key. -func NewWakuServiceTransport( - waku types.Waku, - privateKey *ecdsa.PrivateKey, - db *sql.DB, - mailservers []string, - envelopesMonitorConfig *transport.EnvelopesMonitorConfig, - logger *zap.Logger, - opts ...Option, -) (*WakuServiceTransport, error) { - filtersManager, err := transport.NewFiltersManager(newSQLitePersistence(db), waku, privateKey, logger) - if err != nil { - return nil, err - } - - var envelopesMonitor *EnvelopesMonitor - if envelopesMonitorConfig != nil { - envelopesMonitor = NewEnvelopesMonitor(waku, *envelopesMonitorConfig) - envelopesMonitor.Start() - } - - var api types.PublicWhisperAPI - if waku != nil { - api = waku.PublicWakuAPI() - } - t := &WakuServiceTransport{ - waku: waku, - api: api, - envelopesMonitor: envelopesMonitor, - keysManager: &wakuServiceKeysManager{ - waku: waku, - privateKey: privateKey, - passToSymKeyCache: make(map[string]string), - }, - filters: filtersManager, - mailservers: mailservers, - logger: logger.With(zap.Namespace("WakuServiceTransport")), - } - - for _, opt := range opts { - if err := opt(t); err != nil { - return nil, err - } - } - - return t, nil -} - -func (a *WakuServiceTransport) InitFilters(chatIDs []string, publicKeys []*ecdsa.PublicKey) ([]*transport.Filter, error) { - return a.filters.Init(chatIDs, publicKeys) -} - -func (a *WakuServiceTransport) Filters() []*transport.Filter { - return a.filters.Filters() -} - -// DEPRECATED -func (a *WakuServiceTransport) LoadFilters(filters []*transport.Filter) ([]*transport.Filter, error) { - return a.filters.InitWithFilters(filters) -} - -// DEPRECATED -func (a *WakuServiceTransport) RemoveFilters(filters []*transport.Filter) error { - return a.filters.Remove(filters...) -} - -func (a *WakuServiceTransport) ResetFilters() error { - return a.filters.Reset() -} - -func (a *WakuServiceTransport) ProcessNegotiatedSecret(secret types.NegotiatedSecret) (*transport.Filter, error) { - filter, err := a.filters.LoadNegotiated(secret) - if err != nil { - return nil, err - } - return filter, nil -} - -func (a *WakuServiceTransport) JoinPublic(chatID string) error { - _, err := a.filters.LoadPublic(chatID) - return err -} - -func (a *WakuServiceTransport) LeavePublic(chatID string) error { - chat := a.filters.Filter(chatID) - if chat != nil { - return nil - } - return a.filters.Remove(chat) -} - -func (a *WakuServiceTransport) JoinPrivate(publicKey *ecdsa.PublicKey) error { - _, err := a.filters.LoadDiscovery() - if err != nil { - return err - } - _, err = a.filters.LoadContactCode(publicKey) - return err -} - -func (a *WakuServiceTransport) LeavePrivate(publicKey *ecdsa.PublicKey) error { - filters := a.filters.FiltersByPublicKey(publicKey) - return a.filters.Remove(filters...) -} - -func (a *WakuServiceTransport) JoinGroup(publicKeys []*ecdsa.PublicKey) error { - _, err := a.filters.LoadDiscovery() - if err != nil { - return err - } - for _, pk := range publicKeys { - _, err = a.filters.LoadContactCode(pk) - if err != nil { - return err - } - } - return nil -} - -func (a *WakuServiceTransport) LeaveGroup(publicKeys []*ecdsa.PublicKey) error { - for _, publicKey := range publicKeys { - filters := a.filters.FiltersByPublicKey(publicKey) - if err := a.filters.Remove(filters...); err != nil { - return err - } - } - return nil -} - -type Message struct { - Message *types.Message - Public bool -} - -func (a *WakuServiceTransport) RetrieveAllMessages() ([]Message, error) { - var messages []Message - - for _, filter := range a.filters.Filters() { - filterMsgs, err := a.api.GetFilterMessages(filter.FilterID) - if err != nil { - return nil, err - } - - for _, m := range filterMsgs { - messages = append(messages, Message{ - Message: m, - Public: filter.IsPublic(), - }) - } - } - - return messages, nil -} - -func (a *WakuServiceTransport) RetrievePublicMessages(chatID string) ([]*types.Message, error) { - filter, err := a.filters.LoadPublic(chatID) - if err != nil { - return nil, err - } - - return a.api.GetFilterMessages(filter.FilterID) -} - -func (a *WakuServiceTransport) RetrievePrivateMessages(publicKey *ecdsa.PublicKey) ([]*types.Message, error) { - chats := a.filters.FiltersByPublicKey(publicKey) - discoveryChats, err := a.filters.Init(nil, nil) - if err != nil { - return nil, err - } - - var result []*types.Message - - for _, chat := range append(chats, discoveryChats...) { - filterMsgs, err := a.api.GetFilterMessages(chat.FilterID) - if err != nil { - return nil, err - } - - result = append(result, filterMsgs...) - } - - return result, nil -} - -func (a *WakuServiceTransport) RetrieveRawAll() (map[transport.Filter][]*types.Message, error) { - result := make(map[transport.Filter][]*types.Message) - - allFilters := a.filters.Filters() - for _, filter := range allFilters { - msgs, err := a.api.GetFilterMessages(filter.FilterID) - if err != nil { - continue - } - result[*filter] = append(result[*filter], msgs...) - } - - return result, nil -} - -// SendPublic sends a new message using the Whisper service. -// For public filters, chat name is used as an ID as well as -// a topic. -func (a *WakuServiceTransport) SendPublic(ctx context.Context, newMessage *types.NewMessage, chatName string) ([]byte, error) { - if err := a.addSig(newMessage); err != nil { - return nil, err - } - - filter, err := a.filters.LoadPublic(chatName) - if err != nil { - return nil, err - } - - newMessage.SymKeyID = filter.SymKeyID - newMessage.Topic = filter.Topic - - return a.api.Post(ctx, *newMessage) -} - -func (a *WakuServiceTransport) SendPrivateWithSharedSecret(ctx context.Context, newMessage *types.NewMessage, publicKey *ecdsa.PublicKey, secret []byte) ([]byte, error) { - if err := a.addSig(newMessage); err != nil { - return nil, err - } - - filter, err := a.filters.LoadNegotiated(types.NegotiatedSecret{ - PublicKey: publicKey, - Key: secret, - }) - if err != nil { - return nil, err - } - - newMessage.SymKeyID = filter.SymKeyID - newMessage.Topic = filter.Topic - newMessage.PublicKey = nil - - return a.api.Post(ctx, *newMessage) -} - -func (a *WakuServiceTransport) SendPrivateWithPartitioned(ctx context.Context, newMessage *types.NewMessage, publicKey *ecdsa.PublicKey) ([]byte, error) { - if err := a.addSig(newMessage); err != nil { - return nil, err - } - - filter, err := a.filters.LoadPartitioned(publicKey) - if err != nil { - return nil, err - } - - newMessage.Topic = filter.Topic - newMessage.PublicKey = crypto.FromECDSAPub(publicKey) - - return a.api.Post(ctx, *newMessage) -} - -func (a *WakuServiceTransport) SendPrivateOnDiscovery(ctx context.Context, newMessage *types.NewMessage, publicKey *ecdsa.PublicKey) ([]byte, error) { - if err := a.addSig(newMessage); err != nil { - return nil, err - } - - // There is no need to load any chat - // because listening on the discovery topic - // is done automatically. - // TODO: change this anyway, it should be explicit - // and idempotent. - - newMessage.Topic = types.BytesToTopic(transport.ToTopic(transport.DiscoveryTopic())) - newMessage.PublicKey = crypto.FromECDSAPub(publicKey) - - return a.api.Post(ctx, *newMessage) -} - -func (a *WakuServiceTransport) addSig(newMessage *types.NewMessage) error { - sigID, err := a.keysManager.AddOrGetKeyPair(a.keysManager.privateKey) - if err != nil { - return err - } - newMessage.SigID = sigID - return nil -} - -func (a *WakuServiceTransport) Track(identifiers [][]byte, hash []byte, newMessage *types.NewMessage) { - if a.envelopesMonitor != nil { - a.envelopesMonitor.Add(identifiers, types.BytesToHash(hash), *newMessage) - } -} - -// GetCurrentTime returns the current unix timestamp in milliseconds -func (a *WakuServiceTransport) GetCurrentTime() uint64 { - return uint64(a.waku.GetCurrentTime().UnixNano() / int64(time.Millisecond)) -} - -func (a *WakuServiceTransport) Stop() error { - if a.envelopesMonitor != nil { - a.envelopesMonitor.Stop() - } - return nil -} - -// RequestHistoricMessages requests historic messages for all registered filters. -func (a *WakuServiceTransport) SendMessagesRequest( - ctx context.Context, - peerID []byte, - from, to uint32, - previousCursor []byte, -) (cursor []byte, err error) { - topics := make([]types.TopicType, len(a.Filters())) - for _, f := range a.Filters() { - topics = append(topics, f.Topic) - } - - r := createMessagesRequest(from, to, previousCursor, topics) - r.SetDefaults(a.waku.GetCurrentTime()) - - events := make(chan types.EnvelopeEvent, 10) - sub := a.waku.SubscribeEnvelopeEvents(events) - defer sub.Unsubscribe() - - err = a.waku.SendMessagesRequest(peerID, r) - if err != nil { - return - } - - resp, err := a.waitForRequestCompleted(ctx, r.ID, events) - if err == nil && resp != nil && resp.Error != nil { - err = resp.Error - } else if err == nil && resp != nil { - cursor = resp.Cursor - } - return -} - -func (a *WakuServiceTransport) waitForRequestCompleted(ctx context.Context, requestID []byte, events chan types.EnvelopeEvent) (*types.MailServerResponse, error) { - for { - select { - case ev := <-events: - a.logger.Debug( - "waiting for request completed and received an event", - zap.Binary("requestID", requestID), - zap.Any("event", ev), - ) - if !bytes.Equal(ev.Hash.Bytes(), requestID) { - continue - } - if ev.Event != types.EventMailServerRequestCompleted { - continue - } - data, ok := ev.Data.(*types.MailServerResponse) - if ok { - return data, nil - } - case <-ctx.Done(): - return nil, ctx.Err() - } - } -} diff --git a/vendor/github.com/status-im/status-go/protocol/transport/whisper/envelopes.go b/vendor/github.com/status-im/status-go/protocol/transport/whisper/envelopes.go deleted file mode 100644 index 1efadd74a..000000000 --- a/vendor/github.com/status-im/status-go/protocol/transport/whisper/envelopes.go +++ /dev/null @@ -1,311 +0,0 @@ -package whisper - -import ( - "context" - "errors" - "sync" - - "github.com/status-im/status-go/protocol/transport" - - "go.uber.org/zap" - - "github.com/status-im/status-go/eth-node/types" -) - -// EnvelopeState in local tracker -type EnvelopeState int - -const ( - // NotRegistered returned if asked hash wasn't registered in the tracker. - NotRegistered EnvelopeState = -1 - // EnvelopePosted is set when envelope was added to a local whisper queue. - EnvelopePosted EnvelopeState = iota - // EnvelopeSent is set when envelope is sent to at least one peer. - EnvelopeSent -) - -// EnvelopeEventsHandler used for two different event types. -type EnvelopeEventsHandler interface { - EnvelopeSent([][]byte) - EnvelopeExpired([][]byte, error) - MailServerRequestCompleted(types.Hash, types.Hash, []byte, error) - MailServerRequestExpired(types.Hash) -} - -// NewEnvelopesMonitor returns a pointer to an instance of the EnvelopesMonitor. -func NewEnvelopesMonitor(w types.Whisper, config transport.EnvelopesMonitorConfig) *EnvelopesMonitor { - logger := config.Logger - - if logger == nil { - logger = zap.NewNop() - } - - var whisperAPI types.PublicWhisperAPI - if w != nil { - whisperAPI = w.PublicWhisperAPI() - } - - return &EnvelopesMonitor{ - w: w, - whisperAPI: whisperAPI, - handler: config.EnvelopeEventsHandler, - mailServerConfirmation: config.MailserverConfirmationsEnabled, - maxAttempts: config.MaxAttempts, - isMailserver: config.IsMailserver, - logger: logger.With(zap.Namespace("EnvelopesMonitor")), - - // key is envelope hash (event.Hash) - envelopes: map[types.Hash]EnvelopeState{}, - messages: map[types.Hash]*types.NewMessage{}, - attempts: map[types.Hash]int{}, - identifiers: make(map[types.Hash][][]byte), - - // key is hash of the batch (event.Batch) - batches: map[types.Hash]map[types.Hash]struct{}{}, - } -} - -// EnvelopesMonitor is responsible for monitoring whisper envelopes state. -type EnvelopesMonitor struct { - w types.Whisper - whisperAPI types.PublicWhisperAPI - handler EnvelopeEventsHandler - mailServerConfirmation bool - maxAttempts int - - mu sync.Mutex - envelopes map[types.Hash]EnvelopeState - batches map[types.Hash]map[types.Hash]struct{} - - messages map[types.Hash]*types.NewMessage - attempts map[types.Hash]int - identifiers map[types.Hash][][]byte - - wg sync.WaitGroup - quit chan struct{} - isMailserver func(peer types.EnodeID) bool - - logger *zap.Logger -} - -// Start processing events. -func (m *EnvelopesMonitor) Start() { - m.quit = make(chan struct{}) - m.wg.Add(1) - go func() { - m.handleEnvelopeEvents() - m.wg.Done() - }() -} - -// Stop process events. -func (m *EnvelopesMonitor) Stop() { - close(m.quit) - m.wg.Wait() -} - -// Add hash to a tracker. -func (m *EnvelopesMonitor) Add(identifiers [][]byte, envelopeHash types.Hash, message types.NewMessage) { - m.mu.Lock() - defer m.mu.Unlock() - m.envelopes[envelopeHash] = EnvelopePosted - m.identifiers[envelopeHash] = identifiers - m.messages[envelopeHash] = &message - m.attempts[envelopeHash] = 1 -} - -func (m *EnvelopesMonitor) GetState(hash types.Hash) EnvelopeState { - m.mu.Lock() - defer m.mu.Unlock() - state, exist := m.envelopes[hash] - if !exist { - return NotRegistered - } - return state -} - -// handleEnvelopeEvents processes whisper envelope events -func (m *EnvelopesMonitor) handleEnvelopeEvents() { - events := make(chan types.EnvelopeEvent, 100) // must be buffered to prevent blocking whisper - sub := m.w.SubscribeEnvelopeEvents(events) - defer func() { - close(events) - sub.Unsubscribe() - }() - for { - select { - case <-m.quit: - return - case event := <-events: - m.handleEvent(event) - } - } -} - -// handleEvent based on type of the event either triggers -// confirmation handler or removes hash from tracker -func (m *EnvelopesMonitor) handleEvent(event types.EnvelopeEvent) { - handlers := map[types.EventType]func(types.EnvelopeEvent){ - types.EventEnvelopeSent: m.handleEventEnvelopeSent, - types.EventEnvelopeExpired: m.handleEventEnvelopeExpired, - types.EventBatchAcknowledged: m.handleAcknowledgedBatch, - types.EventEnvelopeReceived: m.handleEventEnvelopeReceived, - } - if handler, ok := handlers[event.Event]; ok { - handler(event) - } -} - -func (m *EnvelopesMonitor) handleEventEnvelopeSent(event types.EnvelopeEvent) { - if m.mailServerConfirmation { - if !m.isMailserver(event.Peer) { - return - } - } - - m.mu.Lock() - defer m.mu.Unlock() - - state, ok := m.envelopes[event.Hash] - // if we didn't send a message using extension - skip it - // if message was already confirmed - skip it - if !ok || state == EnvelopeSent { - return - } - m.logger.Debug("envelope is sent", zap.String("hash", event.Hash.String()), zap.String("peer", event.Peer.String())) - if event.Batch != (types.Hash{}) { - if _, ok := m.batches[event.Batch]; !ok { - m.batches[event.Batch] = map[types.Hash]struct{}{} - } - m.batches[event.Batch][event.Hash] = struct{}{} - m.logger.Debug("waiting for a confirmation", zap.String("batch", event.Batch.String())) - } else { - m.envelopes[event.Hash] = EnvelopeSent - if m.handler != nil { - m.handler.EnvelopeSent(m.identifiers[event.Hash]) - } - } -} - -func (m *EnvelopesMonitor) handleAcknowledgedBatch(event types.EnvelopeEvent) { - if m.mailServerConfirmation { - if !m.isMailserver(event.Peer) { - return - } - } - - m.mu.Lock() - defer m.mu.Unlock() - - envelopes, ok := m.batches[event.Batch] - if !ok { - m.logger.Debug("batch is not found", zap.String("batch", event.Batch.String())) - } - m.logger.Debug("received a confirmation", zap.String("batch", event.Batch.String()), zap.String("peer", event.Peer.String())) - envelopeErrors, ok := event.Data.([]types.EnvelopeError) - if event.Data != nil && !ok { - m.logger.Error("received unexpected data in the the confirmation event", zap.Any("data", event.Data)) - } - failedEnvelopes := map[types.Hash]struct{}{} - for i := range envelopeErrors { - envelopeError := envelopeErrors[i] - _, exist := m.envelopes[envelopeError.Hash] - if exist { - m.logger.Warn("envelope that was posted by us is discarded", zap.String("hash", envelopeError.Hash.String()), zap.String("peer", event.Peer.String()), zap.String("error", envelopeError.Description)) - var err error - switch envelopeError.Code { - case types.EnvelopeTimeNotSynced: - err = errors.New("envelope wasn't delivered due to time sync issues") - } - m.handleEnvelopeFailure(envelopeError.Hash, err) - } - failedEnvelopes[envelopeError.Hash] = struct{}{} - } - - for hash := range envelopes { - if _, exist := failedEnvelopes[hash]; exist { - continue - } - state, ok := m.envelopes[hash] - if !ok || state == EnvelopeSent { - continue - } - m.envelopes[hash] = EnvelopeSent - if m.handler != nil { - m.handler.EnvelopeSent(m.identifiers[hash]) - } - } - delete(m.batches, event.Batch) -} - -func (m *EnvelopesMonitor) handleEventEnvelopeExpired(event types.EnvelopeEvent) { - m.mu.Lock() - defer m.mu.Unlock() - m.handleEnvelopeFailure(event.Hash, errors.New("envelope expired due to connectivity issues")) -} - -// 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 types.Hash, err error) { - if state, ok := m.envelopes[hash]; ok { - message, exist := m.messages[hash] - if !exist { - m.logger.Error("message was deleted erroneously", zap.String("envelope hash", hash.String())) - } - attempt := m.attempts[hash] - identifiers := m.identifiers[hash] - m.clearMessageState(hash) - if state == EnvelopeSent { - return - } - if attempt < m.maxAttempts { - m.logger.Debug("retrying to send a message", zap.String("hash", hash.String()), zap.Int("attempt", attempt+1)) - hex, err := m.whisperAPI.Post(context.TODO(), *message) - if err != nil { - m.logger.Error("failed to retry sending message", zap.String("hash", hash.String()), zap.Int("attempt", attempt+1), zap.Error(err)) - if m.handler != nil { - m.handler.EnvelopeExpired(identifiers, err) - } - - } - envelopeID := types.BytesToHash(hex) - m.envelopes[envelopeID] = EnvelopePosted - m.messages[envelopeID] = message - m.attempts[envelopeID] = attempt + 1 - m.identifiers[envelopeID] = identifiers - } else { - m.logger.Debug("envelope expired", zap.String("hash", hash.String())) - if m.handler != nil { - m.handler.EnvelopeExpired(identifiers, err) - } - } - } -} - -func (m *EnvelopesMonitor) handleEventEnvelopeReceived(event types.EnvelopeEvent) { - if m.mailServerConfirmation { - if !m.isMailserver(event.Peer) { - return - } - } - m.mu.Lock() - defer m.mu.Unlock() - state, ok := m.envelopes[event.Hash] - if !ok || state != EnvelopePosted { - return - } - m.logger.Debug("expected envelope received", zap.String("hash", event.Hash.String()), zap.String("peer", event.Peer.String())) - m.envelopes[event.Hash] = EnvelopeSent - if m.handler != nil { - m.handler.EnvelopeSent(m.identifiers[event.Hash]) - } -} - -// clearMessageState removes all message and envelope state. -// not thread-safe, should be protected on a higher level. -func (m *EnvelopesMonitor) clearMessageState(envelopeID types.Hash) { - delete(m.envelopes, envelopeID) - delete(m.messages, envelopeID) - delete(m.attempts, envelopeID) - delete(m.identifiers, envelopeID) -} diff --git a/vendor/github.com/status-im/status-go/protocol/transport/whisper/mailserver.go b/vendor/github.com/status-im/status-go/protocol/transport/whisper/mailserver.go deleted file mode 100644 index d630b69ab..000000000 --- a/vendor/github.com/status-im/status-go/protocol/transport/whisper/mailserver.go +++ /dev/null @@ -1,38 +0,0 @@ -package whisper - -import ( - "encoding/hex" - "math/big" - - "github.com/google/uuid" - - "github.com/status-im/status-go/eth-node/types" -) - -func createMessagesRequest(from, to uint32, cursor []byte, topics []types.TopicType) types.MessagesRequest { - aUUID := uuid.New() - // uuid is 16 bytes, converted to hex it's 32 bytes as expected by types.MessagesRequest - id := []byte(hex.EncodeToString(aUUID[:])) - return types.MessagesRequest{ - ID: id, - From: from, - To: to, - Limit: 100, - Cursor: cursor, - Bloom: topicsToBloom(topics...), - } -} - -func topicsToBloom(topics ...types.TopicType) []byte { - i := new(big.Int) - for _, topic := range topics { - bloom := types.TopicToBloom(topic) - i.Or(i, new(big.Int).SetBytes(bloom[:])) - } - - combined := make([]byte, types.BloomFilterSize) - data := i.Bytes() - copy(combined[types.BloomFilterSize-len(data):], data[:]) - - return combined -} diff --git a/vendor/github.com/status-im/status-go/protocol/transport/whisper/migrations/migrations.go b/vendor/github.com/status-im/status-go/protocol/transport/whisper/migrations/migrations.go deleted file mode 100644 index 368797f1a..000000000 --- a/vendor/github.com/status-im/status-go/protocol/transport/whisper/migrations/migrations.go +++ /dev/null @@ -1,319 +0,0 @@ -// Code generated by go-bindata. DO NOT EDIT. -// sources: -// 1561059285_add_whisper_keys.down.sql (25B) -// 1561059285_add_whisper_keys.up.sql (112B) -// doc.go (373B) - -package sqlite - -import ( - "bytes" - "compress/gzip" - "crypto/sha256" - "fmt" - "io" - "io/ioutil" - "os" - "path/filepath" - "strings" - "time" -) - -func bindataRead(data []byte, name string) ([]byte, error) { - gz, err := gzip.NewReader(bytes.NewBuffer(data)) - if err != nil { - return nil, fmt.Errorf("read %q: %v", name, err) - } - - var buf bytes.Buffer - _, err = io.Copy(&buf, gz) - clErr := gz.Close() - - if err != nil { - return nil, fmt.Errorf("read %q: %v", name, err) - } - if clErr != nil { - return nil, err - } - - return buf.Bytes(), nil -} - -type asset struct { - bytes []byte - info os.FileInfo - digest [sha256.Size]byte -} - -type bindataFileInfo struct { - name string - size int64 - mode os.FileMode - modTime time.Time -} - -func (fi bindataFileInfo) Name() string { - return fi.name -} -func (fi bindataFileInfo) Size() int64 { - return fi.size -} -func (fi bindataFileInfo) Mode() os.FileMode { - return fi.mode -} -func (fi bindataFileInfo) ModTime() time.Time { - return fi.modTime -} -func (fi bindataFileInfo) IsDir() bool { - return false -} -func (fi bindataFileInfo) Sys() interface{} { - return nil -} - -var __1561059285_add_whisper_keysDownSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x72\x09\xf2\x0f\x50\x08\x71\x74\xf2\x71\x55\x28\xcf\xc8\x2c\x2e\x48\x2d\x8a\xcf\x4e\xad\x2c\xb6\xe6\x02\x04\x00\x00\xff\xff\x42\x93\x8e\x79\x19\x00\x00\x00") - -func _1561059285_add_whisper_keysDownSqlBytes() ([]byte, error) { - return bindataRead( - __1561059285_add_whisper_keysDownSql, - "1561059285_add_whisper_keys.down.sql", - ) -} - -func _1561059285_add_whisper_keysDownSql() (*asset, error) { - bytes, err := _1561059285_add_whisper_keysDownSqlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "1561059285_add_whisper_keys.down.sql", size: 25, mode: os.FileMode(0644), modTime: time.Unix(1574354941, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xb9, 0x31, 0x3f, 0xce, 0xfa, 0x44, 0x36, 0x1b, 0xb0, 0xec, 0x5d, 0xb, 0x90, 0xb, 0x21, 0x4f, 0xd5, 0xe5, 0x50, 0xed, 0xc7, 0x43, 0xdf, 0x83, 0xb4, 0x3a, 0xc1, 0x55, 0x2e, 0x53, 0x7c, 0x67}} - return a, nil -} - -var __1561059285_add_whisper_keysUpSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x04\xc0\xb1\x0a\xc2\x40\x0c\x06\xe0\xfd\x9e\xe2\x1f\x15\x7c\x03\xa7\xde\x19\x35\x18\x13\x09\x29\xb5\x53\x11\x3d\x68\xe9\x22\x56\x90\xbe\xbd\x5f\x71\x6a\x82\x10\x4d\x16\xc2\x6f\x9c\x96\x77\xfd\x0c\x73\x5d\x17\x6c\x12\xf0\x1c\x1f\xdf\x61\x7a\x21\xe8\x1e\xb8\x39\x5f\x1b\xef\x71\xa1\x1e\xa6\x28\xa6\x47\xe1\x12\xe0\x93\x9a\xd3\x2e\x01\x73\x5d\x91\xc5\x32\xd4\x02\xda\x8a\xa4\x2d\x3a\x8e\xb3\xb5\x01\xb7\x8e\x0f\xfb\xf4\x0f\x00\x00\xff\xff\x6e\x23\x28\x7d\x70\x00\x00\x00") - -func _1561059285_add_whisper_keysUpSqlBytes() ([]byte, error) { - return bindataRead( - __1561059285_add_whisper_keysUpSql, - "1561059285_add_whisper_keys.up.sql", - ) -} - -func _1561059285_add_whisper_keysUpSql() (*asset, error) { - bytes, err := _1561059285_add_whisper_keysUpSqlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "1561059285_add_whisper_keys.up.sql", size: 112, mode: os.FileMode(0644), modTime: time.Unix(1574354941, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x25, 0x41, 0xc, 0x92, 0xdd, 0x9e, 0xff, 0x5d, 0xd0, 0x93, 0xe4, 0x24, 0x50, 0x29, 0xcf, 0xc6, 0xf7, 0x49, 0x3c, 0x73, 0xd9, 0x8c, 0xfa, 0xf2, 0xcf, 0xf6, 0x6f, 0xbc, 0x31, 0xe6, 0xf7, 0xe2}} - return a, nil -} - -var _docGo = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x84\x8f\x3d\x72\xeb\x30\x0c\x84\x7b\x9d\x62\xc7\x8d\x9b\x27\xb2\x79\x55\xba\x94\xe9\x73\x01\x98\x5a\x91\x18\x4b\xa4\x42\xc0\x7f\xb7\xcf\xc8\xe3\xc2\x5d\xda\x1d\x7c\x1f\x76\x63\xc4\x77\x51\xc3\xac\x0b\xa1\x86\xca\x44\x33\xe9\x0f\x9c\x98\xe4\x62\xc4\x21\xab\x97\xcb\x29\xa4\xb6\x46\x73\xf1\x8b\x8d\xba\xc6\x55\x73\x17\x67\xbc\xfe\x3f\x0c\x31\x22\x49\x3d\x3a\x8a\xd4\x69\xe1\xd3\x65\x30\x97\xee\x5a\x33\x6e\xea\x05\x82\xad\x73\xd6\x7b\xc0\xa7\x63\xa1\x98\xc3\x8b\xf8\xd1\xe0\x85\x48\x62\xdc\x35\x73\xeb\xc8\x6d\x3c\x69\x9d\xc4\x25\xec\xd1\xd7\xfc\x96\xec\x0d\x93\x2c\x0b\x27\xcc\xbd\xad\x4f\xd6\x64\x25\x26\xed\x4c\xde\xfa\xe3\x1f\xc4\x8c\x8e\x2a\x2b\x6d\xe7\x8b\x5c\x89\xda\x5e\xef\x21\x75\xfa\x7b\x11\x6e\xad\x9f\x0d\x62\xe0\x7d\x63\x72\x4e\x61\x18\x36\x49\x67\xc9\x84\xfd\x2c\xea\x1c\x86\x18\x73\xfb\xc8\xac\xdc\xa9\xf7\x8e\xe3\x76\xce\xaf\x2b\x8c\x0d\x21\xbc\xd4\xda\xaa\x85\xdc\x10\x86\xdf\x00\x00\x00\xff\xff\x21\xa5\x75\x05\x75\x01\x00\x00") - -func docGoBytes() ([]byte, error) { - return bindataRead( - _docGo, - "doc.go", - ) -} - -func docGo() (*asset, error) { - bytes, err := docGoBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "doc.go", size: 373, mode: os.FileMode(0644), modTime: time.Unix(1574354941, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x23, 0x6a, 0xc1, 0xce, 0x94, 0xf6, 0xef, 0xf1, 0x97, 0x95, 0xb, 0x35, 0xaf, 0x5f, 0xe7, 0x5f, 0xac, 0x6e, 0xb8, 0xab, 0xba, 0xb5, 0x35, 0x97, 0x22, 0x36, 0x11, 0xce, 0x44, 0xfc, 0xfa, 0xac}} - return a, nil -} - -// Asset loads and returns the asset for the given name. -// It returns an error if the asset could not be found or -// could not be loaded. -func Asset(name string) ([]byte, error) { - canonicalName := strings.Replace(name, "\\", "/", -1) - if f, ok := _bindata[canonicalName]; ok { - a, err := f() - if err != nil { - return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err) - } - return a.bytes, nil - } - return nil, fmt.Errorf("Asset %s not found", name) -} - -// AssetString returns the asset contents as a string (instead of a []byte). -func AssetString(name string) (string, error) { - data, err := Asset(name) - return string(data), err -} - -// MustAsset is like Asset but panics when Asset would return an error. -// It simplifies safe initialization of global variables. -func MustAsset(name string) []byte { - a, err := Asset(name) - if err != nil { - panic("asset: Asset(" + name + "): " + err.Error()) - } - - return a -} - -// MustAssetString is like AssetString but panics when Asset would return an -// error. It simplifies safe initialization of global variables. -func MustAssetString(name string) string { - return string(MustAsset(name)) -} - -// AssetInfo loads and returns the asset info for the given name. -// It returns an error if the asset could not be found or -// could not be loaded. -func AssetInfo(name string) (os.FileInfo, error) { - canonicalName := strings.Replace(name, "\\", "/", -1) - if f, ok := _bindata[canonicalName]; ok { - a, err := f() - if err != nil { - return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err) - } - return a.info, nil - } - return nil, fmt.Errorf("AssetInfo %s not found", name) -} - -// AssetDigest returns the digest of the file with the given name. It returns an -// error if the asset could not be found or the digest could not be loaded. -func AssetDigest(name string) ([sha256.Size]byte, error) { - canonicalName := strings.Replace(name, "\\", "/", -1) - if f, ok := _bindata[canonicalName]; ok { - a, err := f() - if err != nil { - return [sha256.Size]byte{}, fmt.Errorf("AssetDigest %s can't read by error: %v", name, err) - } - return a.digest, nil - } - return [sha256.Size]byte{}, fmt.Errorf("AssetDigest %s not found", name) -} - -// Digests returns a map of all known files and their checksums. -func Digests() (map[string][sha256.Size]byte, error) { - mp := make(map[string][sha256.Size]byte, len(_bindata)) - for name := range _bindata { - a, err := _bindata[name]() - if err != nil { - return nil, err - } - mp[name] = a.digest - } - return mp, nil -} - -// AssetNames returns the names of the assets. -func AssetNames() []string { - names := make([]string, 0, len(_bindata)) - for name := range _bindata { - names = append(names, name) - } - return names -} - -// _bindata is a table, holding each asset generator, mapped to its name. -var _bindata = map[string]func() (*asset, error){ - "1561059285_add_whisper_keys.down.sql": _1561059285_add_whisper_keysDownSql, - - "1561059285_add_whisper_keys.up.sql": _1561059285_add_whisper_keysUpSql, - - "doc.go": docGo, -} - -// AssetDir returns the file names below a certain -// directory embedded in the file by go-bindata. -// For example if you run go-bindata on data/... and data contains the -// following hierarchy: -// data/ -// foo.txt -// img/ -// a.png -// b.png -// then AssetDir("data") would return []string{"foo.txt", "img"}, -// AssetDir("data/img") would return []string{"a.png", "b.png"}, -// AssetDir("foo.txt") and AssetDir("notexist") would return an error, and -// AssetDir("") will return []string{"data"}. -func AssetDir(name string) ([]string, error) { - node := _bintree - if len(name) != 0 { - canonicalName := strings.Replace(name, "\\", "/", -1) - pathList := strings.Split(canonicalName, "/") - for _, p := range pathList { - node = node.Children[p] - if node == nil { - return nil, fmt.Errorf("Asset %s not found", name) - } - } - } - if node.Func != nil { - return nil, fmt.Errorf("Asset %s not found", name) - } - rv := make([]string, 0, len(node.Children)) - for childName := range node.Children { - rv = append(rv, childName) - } - return rv, nil -} - -type bintree struct { - Func func() (*asset, error) - Children map[string]*bintree -} - -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{}}, -}} - -// RestoreAsset restores an asset under the given directory. -func RestoreAsset(dir, name string) error { - data, err := Asset(name) - if err != nil { - return err - } - info, err := AssetInfo(name) - if err != nil { - return err - } - err = os.MkdirAll(_filePath(dir, filepath.Dir(name)), os.FileMode(0755)) - if err != nil { - return err - } - err = ioutil.WriteFile(_filePath(dir, name), data, info.Mode()) - if err != nil { - return err - } - return os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime()) -} - -// RestoreAssets restores an asset under the given directory recursively. -func RestoreAssets(dir, name string) error { - children, err := AssetDir(name) - // File - if err != nil { - return RestoreAsset(dir, name) - } - // Dir - for _, child := range children { - err = RestoreAssets(dir, filepath.Join(name, child)) - if err != nil { - return err - } - } - return nil -} - -func _filePath(dir, name string) string { - canonicalName := strings.Replace(name, "\\", "/", -1) - return filepath.Join(append([]string{dir}, strings.Split(canonicalName, "/")...)...) -} diff --git a/vendor/github.com/status-im/status-go/protocol/transport/whisper/persistence.go b/vendor/github.com/status-im/status-go/protocol/transport/whisper/persistence.go deleted file mode 100644 index d672d581e..000000000 --- a/vendor/github.com/status-im/status-go/protocol/transport/whisper/persistence.go +++ /dev/null @@ -1,57 +0,0 @@ -package whisper - -import ( - "database/sql" -) - -type sqlitePersistence struct { - db *sql.DB -} - -func newSQLitePersistence(db *sql.DB) *sqlitePersistence { - return &sqlitePersistence{db: db} -} - -func (s *sqlitePersistence) Add(chatID string, key []byte) error { - statement := "INSERT INTO whisper_keys(chat_id, key) VALUES(?, ?)" - stmt, err := s.db.Prepare(statement) - if err != nil { - return err - } - defer stmt.Close() - - _, err = stmt.Exec(chatID, key) - return err -} - -func (s *sqlitePersistence) All() (map[string][]byte, error) { - keys := make(map[string][]byte) - - statement := "SELECT chat_id, key FROM whisper_keys" - - stmt, err := s.db.Prepare(statement) - if err != nil { - return nil, err - } - defer stmt.Close() - - rows, err := stmt.Query() - if err != nil && err != sql.ErrNoRows { - return nil, err - } - - for rows.Next() { - var ( - chatID string - key []byte - ) - - err := rows.Scan(&chatID, &key) - if err != nil { - return nil, err - } - keys[chatID] = key - } - - return keys, nil -} diff --git a/vendor/github.com/status-im/status-go/protocol/transport/whisper/whisper.go b/vendor/github.com/status-im/status-go/protocol/transport/whisper/whisper.go deleted file mode 100644 index ef4970900..000000000 --- a/vendor/github.com/status-im/status-go/protocol/transport/whisper/whisper.go +++ /dev/null @@ -1,13 +0,0 @@ -package whisper - -import ( - "github.com/status-im/status-go/eth-node/types" -) - -type RequestOptions struct { - Topics []types.TopicType - Password string - Limit int - From int64 // in seconds - To int64 // in seconds -} diff --git a/vendor/github.com/status-im/status-go/protocol/transport/whisper/whisper_service.go b/vendor/github.com/status-im/status-go/protocol/transport/whisper/whisper_service.go deleted file mode 100644 index 2c54c367e..000000000 --- a/vendor/github.com/status-im/status-go/protocol/transport/whisper/whisper_service.go +++ /dev/null @@ -1,432 +0,0 @@ -package whisper - -import ( - "bytes" - "context" - "crypto/ecdsa" - "database/sql" - "sync" - "time" - - "github.com/pkg/errors" - "go.uber.org/zap" - - "github.com/status-im/status-go/eth-node/crypto" - "github.com/status-im/status-go/eth-node/types" - "github.com/status-im/status-go/protocol/transport" -) - -var ( - // ErrNoMailservers returned if there is no configured mailservers that can be used. - ErrNoMailservers = errors.New("no configured mailservers") -) - -type whisperServiceKeysManager struct { - shh types.Whisper - - // Identity of the current user. - privateKey *ecdsa.PrivateKey - - passToSymKeyMutex sync.RWMutex - passToSymKeyCache map[string]string -} - -func (m *whisperServiceKeysManager) AddOrGetKeyPair(priv *ecdsa.PrivateKey) (string, error) { - // caching is handled in Whisper - return m.shh.AddKeyPair(priv) -} - -func (m *whisperServiceKeysManager) AddOrGetSymKeyFromPassword(password string) (string, error) { - m.passToSymKeyMutex.Lock() - defer m.passToSymKeyMutex.Unlock() - - if val, ok := m.passToSymKeyCache[password]; ok { - return val, nil - } - - id, err := m.shh.AddSymKeyFromPassword(password) - if err != nil { - return id, err - } - - m.passToSymKeyCache[password] = id - - return id, nil -} - -func (m *whisperServiceKeysManager) RawSymKey(id string) ([]byte, error) { - return m.shh.GetSymKey(id) -} - -type Option func(*WhisperServiceTransport) error - -// WhisperServiceTransport is a transport based on Whisper service. -type WhisperServiceTransport struct { - shh types.Whisper - shhAPI types.PublicWhisperAPI // only PublicWhisperAPI implements logic to send messages - keysManager *whisperServiceKeysManager - filters *transport.FiltersManager - logger *zap.Logger - - mailservers []string - envelopesMonitor *EnvelopesMonitor -} - -// NewWhisperServiceTransport returns a new WhisperServiceTransport. -// TODO: leaving a chat should verify that for a given public key -// there are no other chats. It may happen that we leave a private chat -// but still have a public chat for a given public key. -func NewWhisperServiceTransport( - shh types.Whisper, - privateKey *ecdsa.PrivateKey, - db *sql.DB, - mailservers []string, - envelopesMonitorConfig *transport.EnvelopesMonitorConfig, - logger *zap.Logger, - opts ...Option, -) (*WhisperServiceTransport, error) { - filtersManager, err := transport.NewFiltersManager(newSQLitePersistence(db), shh, privateKey, logger) - if err != nil { - return nil, err - } - - var envelopesMonitor *EnvelopesMonitor - if envelopesMonitorConfig != nil { - envelopesMonitor = NewEnvelopesMonitor(shh, *envelopesMonitorConfig) - envelopesMonitor.Start() - } - - var shhAPI types.PublicWhisperAPI - if shh != nil { - shhAPI = shh.PublicWhisperAPI() - } - t := &WhisperServiceTransport{ - shh: shh, - shhAPI: shhAPI, - envelopesMonitor: envelopesMonitor, - keysManager: &whisperServiceKeysManager{ - shh: shh, - privateKey: privateKey, - passToSymKeyCache: make(map[string]string), - }, - filters: filtersManager, - mailservers: mailservers, - logger: logger.With(zap.Namespace("WhisperServiceTransport")), - } - - for _, opt := range opts { - if err := opt(t); err != nil { - return nil, err - } - } - - return t, nil -} - -func (a *WhisperServiceTransport) InitFilters(chatIDs []string, publicKeys []*ecdsa.PublicKey) ([]*transport.Filter, error) { - return a.filters.Init(chatIDs, publicKeys) -} - -func (a *WhisperServiceTransport) Filters() []*transport.Filter { - return a.filters.Filters() -} - -// DEPRECATED -func (a *WhisperServiceTransport) LoadFilters(filters []*transport.Filter) ([]*transport.Filter, error) { - return a.filters.InitWithFilters(filters) -} - -// DEPRECATED -func (a *WhisperServiceTransport) RemoveFilters(filters []*transport.Filter) error { - return a.filters.Remove(filters...) -} - -func (a *WhisperServiceTransport) ResetFilters() error { - return a.filters.Reset() -} - -func (a *WhisperServiceTransport) ProcessNegotiatedSecret(secret types.NegotiatedSecret) (*transport.Filter, error) { - filter, err := a.filters.LoadNegotiated(secret) - if err != nil { - return nil, err - } - return filter, nil -} - -func (a *WhisperServiceTransport) JoinPublic(chatID string) error { - _, err := a.filters.LoadPublic(chatID) - return err -} - -func (a *WhisperServiceTransport) LeavePublic(chatID string) error { - chat := a.filters.Filter(chatID) - if chat != nil { - return nil - } - return a.filters.Remove(chat) -} - -func (a *WhisperServiceTransport) JoinPrivate(publicKey *ecdsa.PublicKey) error { - _, err := a.filters.LoadDiscovery() - if err != nil { - return err - } - _, err = a.filters.LoadContactCode(publicKey) - return err -} - -func (a *WhisperServiceTransport) LeavePrivate(publicKey *ecdsa.PublicKey) error { - filters := a.filters.FiltersByPublicKey(publicKey) - return a.filters.Remove(filters...) -} - -func (a *WhisperServiceTransport) JoinGroup(publicKeys []*ecdsa.PublicKey) error { - _, err := a.filters.LoadDiscovery() - if err != nil { - return err - } - for _, pk := range publicKeys { - _, err = a.filters.LoadContactCode(pk) - if err != nil { - return err - } - } - return nil -} - -func (a *WhisperServiceTransport) LeaveGroup(publicKeys []*ecdsa.PublicKey) error { - for _, publicKey := range publicKeys { - filters := a.filters.FiltersByPublicKey(publicKey) - if err := a.filters.Remove(filters...); err != nil { - return err - } - } - return nil -} - -type Message struct { - Message *types.Message - Public bool -} - -func (a *WhisperServiceTransport) RetrieveAllMessages() ([]Message, error) { - var messages []Message - - for _, filter := range a.filters.Filters() { - filterMsgs, err := a.shhAPI.GetFilterMessages(filter.FilterID) - if err != nil { - return nil, err - } - - for _, m := range filterMsgs { - messages = append(messages, Message{ - Message: m, - Public: filter.IsPublic(), - }) - } - } - - return messages, nil -} - -func (a *WhisperServiceTransport) RetrievePublicMessages(chatID string) ([]*types.Message, error) { - filter, err := a.filters.LoadPublic(chatID) - if err != nil { - return nil, err - } - - return a.shhAPI.GetFilterMessages(filter.FilterID) -} - -func (a *WhisperServiceTransport) RetrievePrivateMessages(publicKey *ecdsa.PublicKey) ([]*types.Message, error) { - chats := a.filters.FiltersByPublicKey(publicKey) - discoveryChats, err := a.filters.Init(nil, nil) - if err != nil { - return nil, err - } - - var result []*types.Message - - for _, chat := range append(chats, discoveryChats...) { - filterMsgs, err := a.shhAPI.GetFilterMessages(chat.FilterID) - if err != nil { - return nil, err - } - - result = append(result, filterMsgs...) - } - - return result, nil -} - -func (a *WhisperServiceTransport) RetrieveRawAll() (map[transport.Filter][]*types.Message, error) { - result := make(map[transport.Filter][]*types.Message) - - allFilters := a.filters.Filters() - for _, filter := range allFilters { - msgs, err := a.shhAPI.GetFilterMessages(filter.FilterID) - if err != nil { - continue - } - result[*filter] = append(result[*filter], msgs...) - } - - return result, nil -} - -// SendPublic sends a new message using the Whisper service. -// For public filters, chat name is used as an ID as well as -// a topic. -func (a *WhisperServiceTransport) SendPublic(ctx context.Context, newMessage *types.NewMessage, chatName string) ([]byte, error) { - if err := a.addSig(newMessage); err != nil { - return nil, err - } - - filter, err := a.filters.LoadPublic(chatName) - if err != nil { - return nil, err - } - - newMessage.SymKeyID = filter.SymKeyID - newMessage.Topic = filter.Topic - - return a.shhAPI.Post(ctx, *newMessage) -} - -func (a *WhisperServiceTransport) SendPrivateWithSharedSecret(ctx context.Context, newMessage *types.NewMessage, publicKey *ecdsa.PublicKey, secret []byte) ([]byte, error) { - if err := a.addSig(newMessage); err != nil { - return nil, err - } - - filter, err := a.filters.LoadNegotiated(types.NegotiatedSecret{ - PublicKey: publicKey, - Key: secret, - }) - if err != nil { - return nil, err - } - - newMessage.SymKeyID = filter.SymKeyID - newMessage.Topic = filter.Topic - newMessage.PublicKey = nil - - return a.shhAPI.Post(ctx, *newMessage) -} - -func (a *WhisperServiceTransport) SendPrivateWithPartitioned(ctx context.Context, newMessage *types.NewMessage, publicKey *ecdsa.PublicKey) ([]byte, error) { - if err := a.addSig(newMessage); err != nil { - return nil, err - } - - filter, err := a.filters.LoadPartitioned(publicKey) - if err != nil { - return nil, err - } - - newMessage.Topic = filter.Topic - newMessage.PublicKey = crypto.FromECDSAPub(publicKey) - - return a.shhAPI.Post(ctx, *newMessage) -} - -func (a *WhisperServiceTransport) SendPrivateOnDiscovery(ctx context.Context, newMessage *types.NewMessage, publicKey *ecdsa.PublicKey) ([]byte, error) { - if err := a.addSig(newMessage); err != nil { - return nil, err - } - - // There is no need to load any chat - // because listening on the discovery topic - // is done automatically. - // TODO: change this anyway, it should be explicit - // and idempotent. - - newMessage.Topic = types.BytesToTopic(transport.ToTopic(transport.DiscoveryTopic())) - newMessage.PublicKey = crypto.FromECDSAPub(publicKey) - - return a.shhAPI.Post(ctx, *newMessage) -} - -func (a *WhisperServiceTransport) addSig(newMessage *types.NewMessage) error { - sigID, err := a.keysManager.AddOrGetKeyPair(a.keysManager.privateKey) - if err != nil { - return err - } - newMessage.SigID = sigID - return nil -} - -func (a *WhisperServiceTransport) Track(identifiers [][]byte, hash []byte, newMessage *types.NewMessage) { - if a.envelopesMonitor != nil { - a.envelopesMonitor.Add(identifiers, types.BytesToHash(hash), *newMessage) - } -} - -// GetCurrentTime returns the current unix timestamp in milliseconds -func (a *WhisperServiceTransport) GetCurrentTime() uint64 { - return uint64(a.shh.GetCurrentTime().UnixNano() / int64(time.Millisecond)) -} - -func (a *WhisperServiceTransport) Stop() error { - if a.envelopesMonitor != nil { - a.envelopesMonitor.Stop() - } - return nil -} - -// RequestHistoricMessages requests historic messages for all registered filters. -func (a *WhisperServiceTransport) SendMessagesRequest( - ctx context.Context, - peerID []byte, - from, to uint32, - previousCursor []byte, -) (cursor []byte, err error) { - topics := make([]types.TopicType, len(a.Filters())) - for _, f := range a.Filters() { - topics = append(topics, f.Topic) - } - - r := createMessagesRequest(from, to, previousCursor, topics) - r.SetDefaults(a.shh.GetCurrentTime()) - - events := make(chan types.EnvelopeEvent, 10) - sub := a.shh.SubscribeEnvelopeEvents(events) - defer sub.Unsubscribe() - - err = a.shh.SendMessagesRequest(peerID, r) - if err != nil { - return - } - - resp, err := a.waitForRequestCompleted(ctx, r.ID, events) - if err == nil && resp != nil && resp.Error != nil { - err = resp.Error - } else if err == nil && resp != nil { - cursor = resp.Cursor - } - return -} - -func (a *WhisperServiceTransport) waitForRequestCompleted(ctx context.Context, requestID []byte, events chan types.EnvelopeEvent) (*types.MailServerResponse, error) { - for { - select { - case ev := <-events: - a.logger.Debug( - "waiting for request completed and received an event", - zap.Binary("requestID", requestID), - zap.Any("event", ev), - ) - if !bytes.Equal(ev.Hash.Bytes(), requestID) { - continue - } - if ev.Event != types.EventMailServerRequestCompleted { - continue - } - data, ok := ev.Data.(*types.MailServerResponse) - if ok { - return data, nil - } - case <-ctx.Done(): - return nil, ctx.Err() - } - } -} diff --git a/vendor/github.com/status-im/status-go/protocol/v1/README.md b/vendor/github.com/status-im/status-go/protocol/v1/README.md deleted file mode 100644 index 7065c5604..000000000 --- a/vendor/github.com/status-im/status-go/protocol/v1/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# v1 protocol package folder - -This folder contains only data types mentioned in the specification and required for its implementation. diff --git a/vendor/github.com/status-im/status-go/protocol/v1/clock.go b/vendor/github.com/status-im/status-go/protocol/v1/clock.go deleted file mode 100644 index 652b3dcd4..000000000 --- a/vendor/github.com/status-im/status-go/protocol/v1/clock.go +++ /dev/null @@ -1,20 +0,0 @@ -package protocol - -import "time" - -const clockBumpInMs = uint64(time.Minute / time.Millisecond) - -// CalcMessageClock calculates a new clock value for Message. -// It is used to properly sort messages and accommodate the fact -// that time might be different on each device. -func CalcMessageClock(lastObservedValue uint64, timeInMs uint64) uint64 { - clock := lastObservedValue - if clock < timeInMs { - // Added time should be larger than time skew tollerance for a message. - // Here, we use 1 minute which is larger than accepted message time skew by Whisper. - clock = timeInMs + clockBumpInMs - } else { - clock++ - } - return clock -} diff --git a/vendor/github.com/status-im/status-go/protocol/v1/decoder.go b/vendor/github.com/status-im/status-go/protocol/v1/decoder.go deleted file mode 100644 index efe29681a..000000000 --- a/vendor/github.com/status-im/status-go/protocol/v1/decoder.go +++ /dev/null @@ -1,70 +0,0 @@ -package protocol - -import ( - "errors" - "fmt" - "io" - - "github.com/russolsen/transit" -) - -// NewMessageDecoder returns a new Transit decoder -// that can deserialize Message structs. -// More about Transit: https://github.com/cognitect/transit-format -func NewMessageDecoder(r io.Reader) *transit.Decoder { - decoder := transit.NewDecoder(r) - decoder.AddHandler(pairMessageTag, pairMessageHandler) - return decoder -} - -const ( - messageTag = "c4" - pairMessageTag = "p2" -) - -func pairMessageHandler(d transit.Decoder, value interface{}) (interface{}, error) { - taggedValue, ok := value.(transit.TaggedValue) - if !ok { - return nil, errors.New("not a tagged value") - } - values, ok := taggedValue.Value.([]interface{}) - if !ok { - return nil, errors.New("tagged value does not contain values") - } - - pm := PairMessage{} - for idx, v := range values { - var ok bool - - switch idx { - case 0: - pm.InstallationID, ok = v.(string) - case 1: - pm.DeviceType, ok = v.(string) - case 2: - pm.Name, ok = v.(string) - case 3: - pm.FCMToken, ok = v.(string) - default: - // skip any other values - ok = true - } - - if !ok { - return nil, fmt.Errorf("invalid value for index: %d", idx) - } - } - return pm, nil -} - -func setToString(set *transit.Set) ([]string, bool) { - result := make([]string, 0, len(set.Contents)) - for _, item := range set.Contents { - val, ok := item.(string) - if !ok { - return nil, false - } - result = append(result, val) - } - return result, true -} diff --git a/vendor/github.com/status-im/status-go/protocol/v1/encoder.go b/vendor/github.com/status-im/status-go/protocol/v1/encoder.go deleted file mode 100644 index b0678cea1..000000000 --- a/vendor/github.com/status-im/status-go/protocol/v1/encoder.go +++ /dev/null @@ -1,48 +0,0 @@ -package protocol - -import ( - "errors" - "io" - "reflect" - - "github.com/russolsen/transit" -) - -var ( - pairMessageType = reflect.TypeOf(PairMessage{}) - - defaultMessageValueEncoder = &messageValueEncoder{} -) - -// NewMessageEncoder returns a new Transit encoder -// that can encode Message values. -// More about Transit: https://github.com/cognitect/transit-format -func NewMessageEncoder(w io.Writer) *transit.Encoder { - encoder := transit.NewEncoder(w, false) - encoder.AddHandler(pairMessageType, defaultMessageValueEncoder) - return encoder -} - -type messageValueEncoder struct{} - -func (messageValueEncoder) IsStringable(reflect.Value) bool { - return false -} - -func (messageValueEncoder) Encode(e transit.Encoder, value reflect.Value, asString bool) error { - switch message := value.Interface().(type) { - case PairMessage: - taggedValue := transit.TaggedValue{ - Tag: pairMessageTag, - Value: []interface{}{ - message.InstallationID, - message.DeviceType, - message.Name, - message.FCMToken, - }, - } - return e.EncodeInterface(taggedValue, false) - } - - return errors.New("unknown message type to encode") -} diff --git a/vendor/github.com/status-im/status-go/protocol/v1/membership_update_message.go b/vendor/github.com/status-im/status-go/protocol/v1/membership_update_message.go deleted file mode 100644 index a2d42430d..000000000 --- a/vendor/github.com/status-im/status-go/protocol/v1/membership_update_message.go +++ /dev/null @@ -1,519 +0,0 @@ -package protocol - -import ( - "bytes" - "crypto/ecdsa" - "fmt" - "sort" - "strings" - "time" - - "github.com/golang/protobuf/proto" - "github.com/google/uuid" - "github.com/pkg/errors" - - "github.com/status-im/status-go/eth-node/crypto" - "github.com/status-im/status-go/eth-node/types" - "github.com/status-im/status-go/protocol/protobuf" -) - -// MembershipUpdateMessage is a message used to propagate information -// about group membership changes. -// For more information, see https://github.com/status-im/specs/blob/master/status-group-chats-spec.md. -type MembershipUpdateMessage struct { - ChatID string `json:"chatId"` // UUID concatenated with hex-encoded public key of the creator for the chat - Events []MembershipUpdateEvent `json:"events"` - Message *protobuf.ChatMessage `json:"-"` -} - -const signatureLength = 65 - -func MembershipUpdateEventFromProtobuf(chatID string, raw []byte) (*MembershipUpdateEvent, error) { - if len(raw) <= signatureLength { - return nil, errors.New("invalid payload length") - } - decodedEvent := protobuf.MembershipUpdateEvent{} - signature := raw[:signatureLength] - encodedEvent := raw[signatureLength:] - - signatureMaterial := append([]byte(chatID), encodedEvent...) - publicKey, err := crypto.ExtractSignature(signatureMaterial, signature) - if err != nil { - return nil, errors.Wrap(err, "failed to extract signature") - } - - from := types.EncodeHex(crypto.FromECDSAPub(publicKey)) - - err = proto.Unmarshal(encodedEvent, &decodedEvent) - if err != nil { - return nil, err - } - return &MembershipUpdateEvent{ - ClockValue: decodedEvent.Clock, - ChatID: chatID, - Members: decodedEvent.Members, - Name: decodedEvent.Name, - Type: decodedEvent.Type, - Signature: signature, - RawPayload: encodedEvent, - From: from, - }, nil -} - -func (m *MembershipUpdateMessage) ToProtobuf() *protobuf.MembershipUpdateMessage { - var rawEvents [][]byte - for _, e := range m.Events { - var encodedEvent []byte - encodedEvent = append(encodedEvent, e.Signature...) - encodedEvent = append(encodedEvent, e.RawPayload...) - rawEvents = append(rawEvents, encodedEvent) - } - return &protobuf.MembershipUpdateMessage{ - ChatId: m.ChatID, - Events: rawEvents, - Message: m.Message, - } -} - -func MembershipUpdateMessageFromProtobuf(raw *protobuf.MembershipUpdateMessage) (*MembershipUpdateMessage, error) { - var events []MembershipUpdateEvent - for _, e := range raw.Events { - verifiedEvent, err := MembershipUpdateEventFromProtobuf(raw.ChatId, e) - if err != nil { - return nil, err - } - events = append(events, *verifiedEvent) - } - return &MembershipUpdateMessage{ - ChatID: raw.ChatId, - Events: events, - Message: raw.Message, - }, nil -} - -// EncodeMembershipUpdateMessage encodes a MembershipUpdateMessage using protobuf serialization. -func EncodeMembershipUpdateMessage(value MembershipUpdateMessage) ([]byte, error) { - return proto.Marshal(value.ToProtobuf()) -} - -// MembershipUpdateEvent contains an event information. -// Member and Members are hex-encoded values with 0x prefix. -type MembershipUpdateEvent struct { - Type protobuf.MembershipUpdateEvent_EventType `json:"type"` - ClockValue uint64 `json:"clockValue"` - Members []string `json:"members,omitempty"` // in "members-added" and "admins-added" events - Name string `json:"name,omitempty"` // name of the group chat - From string - Signature []byte - ChatID string - RawPayload []byte -} - -func (u *MembershipUpdateEvent) Equal(update MembershipUpdateEvent) bool { - return bytes.Compare(u.Signature, update.Signature) == 0 -} - -func (u *MembershipUpdateEvent) Sign(key *ecdsa.PrivateKey) error { - if len(u.ChatID) == 0 { - return errors.New("can't sign with empty chatID") - } - encodedEvent, err := proto.Marshal(u.ToProtobuf()) - if err != nil { - return err - } - u.RawPayload = encodedEvent - var signatureMaterial []byte - signatureMaterial = append(signatureMaterial, []byte(u.ChatID)...) - signatureMaterial = crypto.Keccak256(append(signatureMaterial, u.RawPayload...)) - signature, err := crypto.Sign(signatureMaterial, key) - - if err != nil { - return err - } - u.Signature = signature - u.From = types.EncodeHex(crypto.FromECDSAPub(&key.PublicKey)) - return nil -} - -func (u *MembershipUpdateEvent) ToProtobuf() *protobuf.MembershipUpdateEvent { - return &protobuf.MembershipUpdateEvent{ - Clock: u.ClockValue, - Name: u.Name, - Members: u.Members, - Type: u.Type, - } -} - -func MergeMembershipUpdateEvents(dest []MembershipUpdateEvent, src []MembershipUpdateEvent) []MembershipUpdateEvent { - for _, update := range src { - var exists bool - for _, existing := range dest { - if existing.Equal(update) { - exists = true - break - } - } - if !exists { - dest = append(dest, update) - } - } - return dest -} - -func NewChatCreatedEvent(name string, clock uint64) MembershipUpdateEvent { - return MembershipUpdateEvent{ - Type: protobuf.MembershipUpdateEvent_CHAT_CREATED, - Name: name, - ClockValue: clock, - } -} - -func NewNameChangedEvent(name string, clock uint64) MembershipUpdateEvent { - return MembershipUpdateEvent{ - Type: protobuf.MembershipUpdateEvent_NAME_CHANGED, - Name: name, - ClockValue: clock, - } -} - -func NewMembersAddedEvent(members []string, clock uint64) MembershipUpdateEvent { - return MembershipUpdateEvent{ - Type: protobuf.MembershipUpdateEvent_MEMBERS_ADDED, - Members: members, - ClockValue: clock, - } -} - -func NewMemberJoinedEvent(clock uint64) MembershipUpdateEvent { - return MembershipUpdateEvent{ - Type: protobuf.MembershipUpdateEvent_MEMBER_JOINED, - ClockValue: clock, - } -} - -func NewAdminsAddedEvent(admins []string, clock uint64) MembershipUpdateEvent { - return MembershipUpdateEvent{ - Type: protobuf.MembershipUpdateEvent_ADMINS_ADDED, - Members: admins, - ClockValue: clock, - } -} - -func NewMemberRemovedEvent(member string, clock uint64) MembershipUpdateEvent { - return MembershipUpdateEvent{ - Type: protobuf.MembershipUpdateEvent_MEMBER_REMOVED, - Members: []string{member}, - ClockValue: clock, - } -} - -func NewAdminRemovedEvent(admin string, clock uint64) MembershipUpdateEvent { - return MembershipUpdateEvent{ - Type: protobuf.MembershipUpdateEvent_ADMIN_REMOVED, - Members: []string{admin}, - ClockValue: clock, - } -} - -type Group struct { - chatID string - name string - events []MembershipUpdateEvent - admins *stringSet - members *stringSet - joined *stringSet -} - -func groupChatID(creator *ecdsa.PublicKey) string { - return uuid.New().String() + "-" + types.EncodeHex(crypto.FromECDSAPub(creator)) -} - -func NewGroupWithEvents(chatID string, events []MembershipUpdateEvent) (*Group, error) { - return newGroup(chatID, events) -} - -func NewGroupWithCreator(name string, creator *ecdsa.PrivateKey) (*Group, error) { - chatID := groupChatID(&creator.PublicKey) - clock := TimestampInMsFromTime(time.Now()) - chatCreated := NewChatCreatedEvent(name, clock) - chatCreated.ChatID = chatID - err := chatCreated.Sign(creator) - if err != nil { - return nil, err - } - return newGroup(chatID, []MembershipUpdateEvent{chatCreated}) -} - -func NewGroup(chatID string, events []MembershipUpdateEvent) (*Group, error) { - return newGroup(chatID, events) -} - -func newGroup(chatID string, events []MembershipUpdateEvent) (*Group, error) { - g := Group{ - chatID: chatID, - events: events, - admins: newStringSet(), - members: newStringSet(), - joined: newStringSet(), - } - if err := g.init(); err != nil { - return nil, err - } - return &g, nil -} - -func (g *Group) init() error { - g.sortEvents() - - var chatID string - - for _, event := range g.events { - if chatID == "" { - chatID = event.ChatID - } else if event.ChatID != chatID { - return errors.New("updates contain different chat IDs") - } - valid := g.validateEvent(event) - if !valid { - return fmt.Errorf("invalid event %#+v from %s", event, event.From) - } - g.processEvent(event) - } - - valid := g.validateChatID(g.chatID) - if !valid { - return fmt.Errorf("invalid chat ID: %s", g.chatID) - } - if chatID != g.chatID { - return fmt.Errorf("expected chat ID equal %s, got %s", g.chatID, chatID) - } - - return nil -} - -func (g Group) ChatID() string { - return g.chatID -} - -func (g Group) Events() []MembershipUpdateEvent { - return g.events -} - -func (g Group) Name() string { - return g.name -} - -func (g Group) Members() []string { - return g.members.List() -} - -func (g Group) Admins() []string { - return g.admins.List() -} - -func (g Group) Joined() []string { - return g.joined.List() -} - -func (g *Group) ProcessEvents(events []MembershipUpdateEvent) error { - for _, event := range events { - err := g.ProcessEvent(event) - if err != nil { - return err - } - } - return nil -} - -func (g *Group) ProcessEvent(event MembershipUpdateEvent) error { - if !g.validateEvent(event) { - return fmt.Errorf("invalid event %#+v", event) - } - // Check if exists - g.events = append(g.events, event) - g.processEvent(event) - return nil -} - -func (g Group) LastClockValue() uint64 { - if len(g.events) == 0 { - return 0 - } - return g.events[len(g.events)-1].ClockValue -} - -func (g Group) creator() (string, error) { - if len(g.events) == 0 { - return "", errors.New("no events in the group") - } - first := g.events[0] - if first.Type != protobuf.MembershipUpdateEvent_CHAT_CREATED { - return "", fmt.Errorf("expected first event to be 'chat-created', got %s", first.Type) - } - return first.From, nil -} - -func (g Group) validateChatID(chatID string) bool { - creator, err := g.creator() - if err != nil || creator == "" { - return false - } - // TODO: It does not verify that the prefix is a valid UUID. - // Improve it so that the prefix follows UUIDv4 spec. - return strings.HasSuffix(chatID, creator) && chatID != creator -} - -func (g Group) IsMember(id string) bool { - return g.members.Has(id) -} - -// validateEvent returns true if a given event is valid. -func (g Group) validateEvent(event MembershipUpdateEvent) bool { - if len(event.From) == 0 { - return false - } - switch event.Type { - case protobuf.MembershipUpdateEvent_CHAT_CREATED: - return g.admins.Empty() && g.members.Empty() - case protobuf.MembershipUpdateEvent_NAME_CHANGED: - return g.admins.Has(event.From) && len(event.Name) > 0 - case protobuf.MembershipUpdateEvent_MEMBERS_ADDED: - return g.admins.Has(event.From) - case protobuf.MembershipUpdateEvent_MEMBER_JOINED: - return g.members.Has(event.From) - case protobuf.MembershipUpdateEvent_MEMBER_REMOVED: - // Member can remove themselves or admin can remove a member. - return len(event.Members) == 1 && (event.From == event.Members[0] || (g.admins.Has(event.From) && !g.admins.Has(event.Members[0]))) - case protobuf.MembershipUpdateEvent_ADMINS_ADDED: - return g.admins.Has(event.From) && stringSliceSubset(event.Members, g.members.List()) - case protobuf.MembershipUpdateEvent_ADMIN_REMOVED: - return len(event.Members) == 1 && g.admins.Has(event.From) && event.From == event.Members[0] - default: - return false - } -} - -func (g *Group) processEvent(event MembershipUpdateEvent) { - switch event.Type { - case protobuf.MembershipUpdateEvent_CHAT_CREATED: - g.name = event.Name - g.members.Add(event.From) - g.joined.Add(event.From) - g.admins.Add(event.From) - case protobuf.MembershipUpdateEvent_NAME_CHANGED: - g.name = event.Name - case protobuf.MembershipUpdateEvent_ADMINS_ADDED: - g.admins.Add(event.Members...) - case protobuf.MembershipUpdateEvent_ADMIN_REMOVED: - g.admins.Remove(event.Members[0]) - case protobuf.MembershipUpdateEvent_MEMBERS_ADDED: - g.members.Add(event.Members...) - case protobuf.MembershipUpdateEvent_MEMBER_REMOVED: - g.admins.Remove(event.Members[0]) - g.joined.Remove(event.Members[0]) - g.members.Remove(event.Members[0]) - case protobuf.MembershipUpdateEvent_MEMBER_JOINED: - g.joined.Add(event.From) - } -} - -func (g *Group) sortEvents() { - sort.Slice(g.events, func(i, j int) bool { - return g.events[i].ClockValue < g.events[j].ClockValue - }) -} - -func stringSliceSubset(subset []string, set []string) bool { - for _, item1 := range set { - var found bool - for _, item2 := range subset { - if item1 == item2 { - found = true - break - } - } - if found { - return true - } - } - return false -} - -func stringSliceEquals(slice1, slice2 []string) bool { - set := map[string]struct{}{} - for _, s := range slice1 { - set[s] = struct{}{} - } - for _, s := range slice2 { - _, ok := set[s] - if !ok { - return false - } - } - return true -} - -func publicKeyToString(publicKey *ecdsa.PublicKey) string { - return types.EncodeHex(crypto.FromECDSAPub(publicKey)) -} - -type stringSet struct { - m map[string]struct{} - items []string -} - -func newStringSet() *stringSet { - return &stringSet{ - m: make(map[string]struct{}), - } -} - -func newStringSetFromSlice(s []string) *stringSet { - set := newStringSet() - if len(s) > 0 { - set.Add(s...) - } - return set -} - -func (s *stringSet) Add(items ...string) { - for _, item := range items { - if _, ok := s.m[item]; !ok { - s.m[item] = struct{}{} - s.items = append(s.items, item) - } - } -} - -func (s *stringSet) Remove(items ...string) { - for _, item := range items { - if _, ok := s.m[item]; ok { - delete(s.m, item) - s.removeFromItems(item) - } - } -} - -func (s *stringSet) Has(item string) bool { - _, ok := s.m[item] - return ok -} - -func (s *stringSet) Empty() bool { - return len(s.items) == 0 -} - -func (s *stringSet) List() []string { - return s.items -} - -func (s *stringSet) removeFromItems(dropped string) { - n := 0 - for _, item := range s.items { - if item != dropped { - s.items[n] = item - n++ - } - } - s.items = s.items[:n] -} diff --git a/vendor/github.com/status-im/status-go/protocol/v1/message.go b/vendor/github.com/status-im/status-go/protocol/v1/message.go deleted file mode 100644 index d3607fe5e..000000000 --- a/vendor/github.com/status-im/status-go/protocol/v1/message.go +++ /dev/null @@ -1,50 +0,0 @@ -package protocol - -import ( - "crypto/ecdsa" - "time" - - "github.com/golang/protobuf/proto" - "github.com/pkg/errors" - - "github.com/status-im/status-go/eth-node/crypto" - "github.com/status-im/status-go/eth-node/types" - "github.com/status-im/status-go/protocol/protobuf" -) - -var ( - // ErrInvalidDecodedValue means that the decoded message is of wrong type. - // This might mean that the status message serialization tag changed. - ErrInvalidDecodedValue = errors.New("invalid decoded value type") -) - -// TimestampInMsFromTime returns a TimestampInMs from a time.Time instance. -func TimestampInMsFromTime(t time.Time) uint64 { - return uint64(t.UnixNano() / int64(time.Millisecond)) -} - -// MessageID calculates the messageID from author's compressed public key -// and not encrypted but encoded payload. -func MessageID(author *ecdsa.PublicKey, data []byte) types.HexBytes { - keyBytes := crypto.FromECDSAPub(author) - return types.HexBytes(crypto.Keccak256(append(keyBytes, data...))) -} - -// WrapMessageV1 wraps a payload into a protobuf message and signs it if an identity is provided -func WrapMessageV1(payload []byte, messageType protobuf.ApplicationMetadataMessage_Type, identity *ecdsa.PrivateKey) ([]byte, error) { - var signature []byte - if identity != nil { - var err error - signature, err = crypto.Sign(crypto.Keccak256(payload), identity) - if err != nil { - return nil, err - } - } - - message := &protobuf.ApplicationMetadataMessage{ - Signature: signature, - Type: messageType, - Payload: payload, - } - return proto.Marshal(message) -} diff --git a/vendor/github.com/status-im/status-go/protocol/v1/pair_message.go b/vendor/github.com/status-im/status-go/protocol/v1/pair_message.go deleted file mode 100644 index 90eef8f58..000000000 --- a/vendor/github.com/status-im/status-go/protocol/v1/pair_message.go +++ /dev/null @@ -1,71 +0,0 @@ -package protocol - -import ( - "bytes" - "encoding/hex" - "encoding/json" -) - -// PairMessage contains all message details. -type PairMessage struct { - InstallationID string `json:"installationId"` - // The type of the device - DeviceType string `json:"deviceType"` - // Name the user set name - Name string `json:"name"` - // The FCMToken for mobile platforms - FCMToken string `json:"fcmToken"` - - // not protocol defined fields - ID []byte `json:"-"` -} - -func (m *PairMessage) MarshalJSON() ([]byte, error) { - type PairMessageAlias PairMessage - item := struct { - *PairMessageAlias - ID string `json:"id"` - }{ - PairMessageAlias: (*PairMessageAlias)(m), - ID: "0x" + hex.EncodeToString(m.ID), - } - - return json.Marshal(item) -} - -// CreatePairMessage creates a PairMessage which is used -// to pair devices. -func CreatePairMessage(installationID string, name string, deviceType string, fcmToken string) PairMessage { - return PairMessage{ - InstallationID: installationID, - Name: name, - DeviceType: deviceType, - FCMToken: fcmToken, - } -} - -// DecodePairMessage decodes a raw payload to Message struct. -func DecodePairMessage(data []byte) (message PairMessage, err error) { - buf := bytes.NewBuffer(data) - decoder := NewMessageDecoder(buf) - value, err := decoder.Decode() - if err != nil { - return - } - - message, ok := value.(PairMessage) - if !ok { - return message, ErrInvalidDecodedValue - } - return -} - -// EncodePairMessage encodes a PairMessage using Transit serialization. -func EncodePairMessage(value PairMessage) ([]byte, error) { - var buf bytes.Buffer - encoder := NewMessageEncoder(&buf) - if err := encoder.Encode(value); err != nil { - return nil, err - } - return buf.Bytes(), nil -} diff --git a/vendor/github.com/status-im/status-go/protocol/v1/status_message.go b/vendor/github.com/status-im/status-go/protocol/v1/status_message.go deleted file mode 100644 index e1653e235..000000000 --- a/vendor/github.com/status-im/status-go/protocol/v1/status_message.go +++ /dev/null @@ -1,324 +0,0 @@ -package protocol - -import ( - "crypto/ecdsa" - "encoding/json" - "log" - - "github.com/golang/protobuf/proto" - "github.com/jinzhu/copier" - "github.com/pkg/errors" - - "github.com/status-im/status-go/eth-node/crypto" - "github.com/status-im/status-go/eth-node/types" - "github.com/status-im/status-go/protocol/datasync" - "github.com/status-im/status-go/protocol/encryption" - "github.com/status-im/status-go/protocol/protobuf" -) - -type StatusMessageT int - -// StatusMessage is any Status Protocol message. -type StatusMessage struct { - // TransportMessage is the parsed message received from the transport layer, i.e the input - TransportMessage *types.Message `json:"transportMessage"` - // Type is the type of application message contained - Type protobuf.ApplicationMetadataMessage_Type `json:"-"` - // ParsedMessage is the parsed message by the application layer, i.e the output - ParsedMessage interface{} `json:"-"` - - // TransportPayload is the payload as received from the transport layer - TransportPayload []byte `json:"-"` - // DecryptedPayload is the payload after having been processed by the encryption layer - DecryptedPayload []byte `json:"decryptedPayload"` - - // ID is the canonical ID of the message - ID types.HexBytes `json:"id"` - // Hash is the transport layer hash - Hash []byte `json:"-"` - - // TransportLayerSigPubKey contains the public key provided by the transport layer - TransportLayerSigPubKey *ecdsa.PublicKey `json:"-"` - // ApplicationMetadataLayerPubKey contains the public key provided by the application metadata layer - ApplicationMetadataLayerSigPubKey *ecdsa.PublicKey `json:"-"` -} - -// Temporary JSON marshaling for those messages that are not yet processed -// by the go code -func (m *StatusMessage) MarshalJSON() ([]byte, error) { - item := struct { - ID types.HexBytes `json:"id"` - Payload string `json:"payload"` - From types.HexBytes `json:"from"` - Timestamp uint32 `json:"timestamp"` - }{ - ID: m.ID, - Payload: string(m.DecryptedPayload), - Timestamp: m.TransportMessage.Timestamp, - From: m.TransportMessage.Sig, - } - return json.Marshal(item) -} - -// SigPubKey returns the most important signature, from the application layer to transport -func (m *StatusMessage) SigPubKey() *ecdsa.PublicKey { - if m.ApplicationMetadataLayerSigPubKey != nil { - return m.ApplicationMetadataLayerSigPubKey - } - - return m.TransportLayerSigPubKey -} - -func (m *StatusMessage) Clone() (*StatusMessage, error) { - copy := &StatusMessage{} - - err := copier.Copy(©, m) - return copy, err -} - -func (m *StatusMessage) HandleTransport(shhMessage *types.Message) error { - publicKey, err := crypto.UnmarshalPubkey(shhMessage.Sig) - if err != nil { - return errors.Wrap(err, "failed to get signature") - } - - m.TransportMessage = shhMessage - m.Hash = shhMessage.Hash - m.TransportLayerSigPubKey = publicKey - m.TransportPayload = shhMessage.Payload - - return nil -} - -func (m *StatusMessage) HandleEncryption(myKey *ecdsa.PrivateKey, senderKey *ecdsa.PublicKey, enc *encryption.Protocol) error { - // As we handle non-encrypted messages, we make sure that DecryptPayload - // is set regardless of whether this step is successful - m.DecryptedPayload = m.TransportPayload - - var protocolMessage encryption.ProtocolMessage - err := proto.Unmarshal(m.TransportPayload, &protocolMessage) - if err != nil { - return errors.Wrap(err, "failed to unmarshal ProtocolMessage") - } - - payload, err := enc.HandleMessage( - myKey, - senderKey, - &protocolMessage, - m.Hash, - ) - - if err != nil { - return errors.Wrap(err, "failed to handle Encryption message") - } - - m.DecryptedPayload = payload - return nil -} - -// HandleDatasync processes StatusMessage through data sync layer. -// This is optional and DataSync might be nil. In such a case, -// only one payload will be returned equal to DecryptedPayload. -func (m *StatusMessage) HandleDatasync(datasync *datasync.DataSync) ([]*StatusMessage, error) { - var statusMessages []*StatusMessage - - payloads := datasync.Handle( - m.SigPubKey(), - m.DecryptedPayload, - ) - - for _, payload := range payloads { - message, err := m.Clone() - if err != nil { - return nil, err - } - message.DecryptedPayload = payload - statusMessages = append(statusMessages, message) - } - return statusMessages, nil -} - -func (m *StatusMessage) HandleApplicationMetadata() error { - message, err := protobuf.Unmarshal(m.DecryptedPayload) - if err != nil { - return err - } - - recoveredKey, err := message.RecoverKey() - if err != nil { - return err - } - m.ApplicationMetadataLayerSigPubKey = recoveredKey - // Calculate ID using the wrapped record - m.ID = MessageID(recoveredKey, m.DecryptedPayload) - m.DecryptedPayload = message.Payload - m.Type = message.Type - return nil - -} - -func (m *StatusMessage) HandleApplication() error { - switch m.Type { - case protobuf.ApplicationMetadataMessage_CHAT_MESSAGE: - var message protobuf.ChatMessage - - err := proto.Unmarshal(m.DecryptedPayload, &message) - if err != nil { - m.ParsedMessage = nil - log.Printf("[message::DecodeMessage] could not decode ChatMessage: %#x, err: %v", m.Hash, err.Error()) - } else { - m.ParsedMessage = message - - return nil - } - case protobuf.ApplicationMetadataMessage_MEMBERSHIP_UPDATE_MESSAGE: - var message protobuf.MembershipUpdateMessage - err := proto.Unmarshal(m.DecryptedPayload, &message) - if err != nil { - m.ParsedMessage = nil - log.Printf("[message::DecodeMessage] could not decode MembershipUpdateMessage: %#x, err: %v", m.Hash, err.Error()) - } else { - m.ParsedMessage = message - - return nil - } - case protobuf.ApplicationMetadataMessage_ACCEPT_REQUEST_ADDRESS_FOR_TRANSACTION: - var message protobuf.AcceptRequestAddressForTransaction - err := proto.Unmarshal(m.DecryptedPayload, &message) - if err != nil { - m.ParsedMessage = nil - log.Printf("[message::DecodeMessage] could not decode AcceptRequestAddressForTransaction: %#x, err: %v", m.Hash, err.Error()) - } else { - m.ParsedMessage = message - - return nil - } - case protobuf.ApplicationMetadataMessage_SEND_TRANSACTION: - var message protobuf.SendTransaction - err := proto.Unmarshal(m.DecryptedPayload, &message) - if err != nil { - m.ParsedMessage = nil - log.Printf("[message::DecodeMessage] could not decode SendTransaction: %#x, err: %v", m.Hash, err.Error()) - } else { - m.ParsedMessage = message - - return nil - } - - case protobuf.ApplicationMetadataMessage_REQUEST_TRANSACTION: - var message protobuf.RequestTransaction - err := proto.Unmarshal(m.DecryptedPayload, &message) - if err != nil { - m.ParsedMessage = nil - log.Printf("[message::DecodeMessage] could not decode RequestTransaction: %#x, err: %v", m.Hash, err.Error()) - } else { - m.ParsedMessage = message - - return nil - } - - case protobuf.ApplicationMetadataMessage_DECLINE_REQUEST_ADDRESS_FOR_TRANSACTION: - var message protobuf.DeclineRequestAddressForTransaction - err := proto.Unmarshal(m.DecryptedPayload, &message) - if err != nil { - m.ParsedMessage = nil - log.Printf("[message::DecodeMessage] could not decode DeclineRequestAddressForTransaction: %#x, err: %v", m.Hash, err.Error()) - } else { - m.ParsedMessage = message - - return nil - } - case protobuf.ApplicationMetadataMessage_DECLINE_REQUEST_TRANSACTION: - var message protobuf.DeclineRequestTransaction - err := proto.Unmarshal(m.DecryptedPayload, &message) - if err != nil { - m.ParsedMessage = nil - log.Printf("[message::DecodeMessage] could not decode DeclineRequestTransaction: %#x, err: %v", m.Hash, err.Error()) - } else { - m.ParsedMessage = message - - return nil - } - - case protobuf.ApplicationMetadataMessage_REQUEST_ADDRESS_FOR_TRANSACTION: - var message protobuf.RequestAddressForTransaction - err := proto.Unmarshal(m.DecryptedPayload, &message) - if err != nil { - m.ParsedMessage = nil - log.Printf("[message::DecodeMessage] could not decode RequestAddressForTransaction: %#x, err: %v", m.Hash, err.Error()) - } else { - m.ParsedMessage = message - - return nil - } - - case protobuf.ApplicationMetadataMessage_CONTACT_UPDATE: - var message protobuf.ContactUpdate - err := proto.Unmarshal(m.DecryptedPayload, &message) - if err != nil { - m.ParsedMessage = nil - log.Printf("[message::DecodeMessage] could not decode ContactUpdate: %#x, err: %v", m.Hash, err.Error()) - } else { - m.ParsedMessage = message - - return nil - } - case protobuf.ApplicationMetadataMessage_SYNC_INSTALLATION: - var message protobuf.SyncInstallation - err := proto.Unmarshal(m.DecryptedPayload, &message) - if err != nil { - m.ParsedMessage = nil - log.Printf("[message::DecodeMessage] could not decode SyncInstallation: %#x, err: %v", m.Hash, err.Error()) - } else { - m.ParsedMessage = message - - return nil - } - case protobuf.ApplicationMetadataMessage_SYNC_INSTALLATION_CONTACT: - var message protobuf.SyncInstallationContact - log.Printf("Sync installation contact") - err := proto.Unmarshal(m.DecryptedPayload, &message) - if err != nil { - m.ParsedMessage = nil - log.Printf("[message::DecodeMessage] could not decode SyncInstallationContact: %#x, err: %v", m.Hash, err.Error()) - } else { - m.ParsedMessage = message - - return nil - } - case protobuf.ApplicationMetadataMessage_SYNC_INSTALLATION_PUBLIC_CHAT: - var message protobuf.SyncInstallationPublicChat - err := proto.Unmarshal(m.DecryptedPayload, &message) - if err != nil { - m.ParsedMessage = nil - log.Printf("[message::DecodeMessage] could not decode SyncInstallationPublicChat: %#x, err: %v", m.Hash, err.Error()) - } else { - m.ParsedMessage = message - - return nil - } - case protobuf.ApplicationMetadataMessage_SYNC_INSTALLATION_ACCOUNT: - var message protobuf.SyncInstallationAccount - err := proto.Unmarshal(m.DecryptedPayload, &message) - if err != nil { - m.ParsedMessage = nil - log.Printf("[message::DecodeMessage] could not decode SyncInstallationAccount: %#x, err: %v", m.Hash, err.Error()) - } else { - m.ParsedMessage = message - - return nil - } - case protobuf.ApplicationMetadataMessage_PAIR_INSTALLATION: - var message protobuf.PairInstallation - err := proto.Unmarshal(m.DecryptedPayload, &message) - if err != nil { - m.ParsedMessage = nil - log.Printf("[message::DecodeMessage] could not decode PairInstallation: %#x, err: %v", m.Hash, err.Error()) - } else { - m.ParsedMessage = message - - return nil - } - } - return nil -} diff --git a/vendor/github.com/status-im/status-go/protocol/v1/value_is_zero.go b/vendor/github.com/status-im/status-go/protocol/v1/value_is_zero.go deleted file mode 100644 index caf4cb77c..000000000 --- a/vendor/github.com/status-im/status-go/protocol/v1/value_is_zero.go +++ /dev/null @@ -1,11 +0,0 @@ -// +build go1.13 - -package protocol - -import "reflect" - -// isZeroValue reports whether v is the zero value for its type. -// It panics if the argument is invalid. -func isZeroValue(v reflect.Value) bool { - return v.IsZero() -} diff --git a/vendor/github.com/status-im/status-go/protocol/v1/value_is_zero_1_12.go b/vendor/github.com/status-im/status-go/protocol/v1/value_is_zero_1_12.go deleted file mode 100644 index 957855f94..000000000 --- a/vendor/github.com/status-im/status-go/protocol/v1/value_is_zero_1_12.go +++ /dev/null @@ -1,48 +0,0 @@ -// +build !go1.13 - -package protocol - -import ( - "math" - "reflect" -) - -// isZeroValue reports whether v is the zero value for its type. -// It panics if the argument is invalid. -func isZeroValue(v reflect.Value) bool { - switch v.Kind() { - case reflect.Bool: - return !v.Bool() - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - return v.Int() == 0 - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: - return v.Uint() == 0 - case reflect.Float32, reflect.Float64: - return math.Float64bits(v.Float()) == 0 - case reflect.Complex64, reflect.Complex128: - c := v.Complex() - return math.Float64bits(real(c)) == 0 && math.Float64bits(imag(c)) == 0 - case reflect.Array: - for i := 0; i < v.Len(); i++ { - if !isZeroValue(v.Index(i)) { - return false - } - } - return true - case reflect.Chan, reflect.Func, reflect.Interface, reflect.Map, reflect.Ptr, reflect.Slice, reflect.UnsafePointer: - return v.IsNil() - case reflect.String: - return v.Len() == 0 - case reflect.Struct: - for i := 0; i < v.NumField(); i++ { - if !isZeroValue(v.Field(i)) { - return false - } - } - return true - default: - // This should never happens, but will act as a safeguard for - // later, as a default value doesn't makes sense here. - panic(&reflect.ValueError{Method: "reflect.Value.IsZero", Kind: v.Kind()}) - } -} diff --git a/vendor/github.com/status-im/status-go/protocol/zaputil/encoder.go b/vendor/github.com/status-im/status-go/protocol/zaputil/encoder.go deleted file mode 100644 index f5cb44632..000000000 --- a/vendor/github.com/status-im/status-go/protocol/zaputil/encoder.go +++ /dev/null @@ -1,67 +0,0 @@ -package zaputil - -import ( - "encoding/hex" - - "go.uber.org/zap" - "go.uber.org/zap/zapcore" -) - -type jsonHexEncoder struct { - zapcore.Encoder -} - -// NewJSONHexEncoder creates a JSON logger based on zapcore.NewJSONEncoder -// but overwrites encoding of byte slices. Instead encoding them with base64, -// jsonHexEncoder uses hex-encoding. -// Each hex-encoded value is prefixed with 0x so that it's clear it's a hex string. -func NewJSONHexEncoder(cfg zapcore.EncoderConfig) zapcore.Encoder { - jsonEncoder := zapcore.NewJSONEncoder(cfg) - return &jsonHexEncoder{ - Encoder: jsonEncoder, - } -} - -func (enc *jsonHexEncoder) AddBinary(key string, val []byte) { - enc.AddString(key, "0x"+hex.EncodeToString(val)) -} - -func (enc *jsonHexEncoder) Clone() zapcore.Encoder { - encoderClone := enc.Encoder.Clone() - return &jsonHexEncoder{Encoder: encoderClone} -} - -// RegisterJSONHexEncoder registers a jsonHexEncoder under "json-hex" name. -// Later, this name can be used as a value for zap.Config.Encoding to enable -// jsonHexEncoder. -func RegisterJSONHexEncoder() error { - return zap.RegisterEncoder("json-hex", func(cfg zapcore.EncoderConfig) (zapcore.Encoder, error) { - return NewJSONHexEncoder(cfg), nil - }) -} - -type consoleHexEncoder struct { - zapcore.Encoder -} - -func NewConsoleHexEncoder(cfg zapcore.EncoderConfig) zapcore.Encoder { - consoleEncoder := zapcore.NewConsoleEncoder(cfg) - return &consoleHexEncoder{ - Encoder: consoleEncoder, - } -} - -func (enc *consoleHexEncoder) AddBinary(key string, val []byte) { - enc.AddString(key, "0x"+hex.EncodeToString(val)) -} - -func (enc *consoleHexEncoder) Clone() zapcore.Encoder { - encoderClone := enc.Encoder.Clone() - return &consoleHexEncoder{Encoder: encoderClone} -} - -func RegisterConsoleHexEncoder() error { - return zap.RegisterEncoder("console-hex", func(cfg zapcore.EncoderConfig) (zapcore.Encoder, error) { - return NewConsoleHexEncoder(cfg), nil - }) -} diff --git a/vendor/github.com/status-im/status-go/whisper/v6/whisper.go b/vendor/github.com/status-im/status-go/whisper/v6/whisper.go index 8bd55ff81..693fede2d 100644 --- a/vendor/github.com/status-im/status-go/whisper/v6/whisper.go +++ b/vendor/github.com/status-im/status-go/whisper/v6/whisper.go @@ -1202,14 +1202,18 @@ func (whisper *Whisper) runMessageLoop(p *Peer, rw p2p.MsgReadWriter) error { log.Warn("failed to decode response message, peer will be disconnected", "peer", p.peer.ID(), "err", err) return errors.New("invalid request response message") } + event, err := CreateMailServerEvent(p.peer.ID(), payload) + if err != nil { log.Warn("error while parsing request complete code, peer will be disconnected", "peer", p.peer.ID(), "err", err) return err } + if event != nil { whisper.postP2P(*event) } + } default: // New message types might be implemented in the future versions of Whisper. diff --git a/vendor/github.com/wealdtech/go-ens/v3/README.md b/vendor/github.com/wealdtech/go-ens/v3/README.md index ab2b767e3..39fc7ece0 100644 --- a/vendor/github.com/wealdtech/go-ens/v3/README.md +++ b/vendor/github.com/wealdtech/go-ens/v3/README.md @@ -62,7 +62,8 @@ A top-level name is one that sits directly underneath `.eth`, for example `mydom Starting out with names in `go-ens` is easy: ```go -name, err := ens.Name("mydomain.eth") +client, err := ethclient.Dial("https://infura.io/v3/SECRET") +name, err := ens.NewName(client, "mydomain.eth") ``` Addresses can be set and obtained using the address functions, for example to get an address: diff --git a/vendor/github.com/wealdtech/go-ens/v3/baseregistrar.go b/vendor/github.com/wealdtech/go-ens/v3/baseregistrar.go index 544745c52..61338b22d 100644 --- a/vendor/github.com/wealdtech/go-ens/v3/baseregistrar.go +++ b/vendor/github.com/wealdtech/go-ens/v3/baseregistrar.go @@ -53,14 +53,14 @@ func NewBaseRegistrar(backend bind.ContractBackend, domain string) (*BaseRegistr // Ensure this really is a base registrar. To do this confirm that it supports // the expected interfaces. - supported, err := contract.SupportsInterface(nil, [4]byte{0x6c, 0xcb, 0x2d, 0xf4}) - if err != nil { - return nil, err - } - if !supported { - return nil, fmt.Errorf("purported registrar for domain %s does not support nametoken functionality", domain) - } - supported, err = contract.SupportsInterface(nil, [4]byte{0x28, 0xed, 0x4f, 0x6c}) + //supported, err := contract.SupportsInterface(nil, [4]byte{0x01, 0x8f, 0xac, 0x06}) + //if err != nil { + // return nil, err + //} + //if !supported { + // return nil, fmt.Errorf("purported registrar for domain %s does not support nametoken functionality", domain) + //} + supported, err := contract.SupportsInterface(nil, [4]byte{0x28, 0xed, 0x4f, 0x6c}) if err != nil { return nil, err } @@ -80,7 +80,8 @@ func NewBaseRegistrar(backend bind.ContractBackend, domain string) (*BaseRegistr func (r *BaseRegistrar) PriorAuctionContract() (*AuctionRegistrar, error) { address, err := r.Contract.PreviousRegistrar(nil) if err != nil { - return nil, errors.New("no prior auction contract") + // Means there is no prior registrar. + return nil, nil } auctionContract, err := NewAuctionRegistrarAt(r.backend, r.domain, address) if err != nil { @@ -91,18 +92,26 @@ func (r *BaseRegistrar) PriorAuctionContract() (*AuctionRegistrar, error) { var shaBid [32]byte var emptyHash [32]byte sha := sha3.NewLegacyKeccak256() - sha.Write(emptyHash[:]) - sha.Write(UnknownAddress.Bytes()) + if _, err := sha.Write(emptyHash[:]); err != nil { + return nil, err + } + if _, err := sha.Write(UnknownAddress.Bytes()); err != nil { + return nil, err + } var amountBytes [32]byte - sha.Write(amountBytes[:]) - sha.Write(emptyHash[:]) + if _, err := sha.Write(amountBytes[:]); err != nil { + return nil, err + } + if _, err := sha.Write(emptyHash[:]); err != nil { + return nil, err + } sha.Sum(shaBid[:0]) contractShaBid, err := auctionContract.ShaBid(emptyHash, UnknownAddress, big.NewInt(0), emptyHash) if err != nil { return nil, errors.New("failed to confirm auction contract") } - if bytes.Compare(contractShaBid[:], shaBid[:]) != 0 { + if !bytes.Equal(contractShaBid[:], shaBid[:]) { return nil, errors.New("failed to confirm auction contract") } diff --git a/vendor/github.com/wealdtech/go-ens/v3/contracts/dnsresolver/contract.abi b/vendor/github.com/wealdtech/go-ens/v3/contracts/dnsresolver/contract.abi index c34c3854d..f61f8302c 100644 --- a/vendor/github.com/wealdtech/go-ens/v3/contracts/dnsresolver/contract.abi +++ b/vendor/github.com/wealdtech/go-ens/v3/contracts/dnsresolver/contract.abi @@ -3,13 +3,15 @@ "constant": true, "inputs": [ { - "name": "interfaceId", + "internalType": "bytes4", + "name": "interfaceID", "type": "bytes4" } ], "name": "supportsInterface", "outputs": [ { + "internalType": "bool", "name": "", "type": "bool" } @@ -22,11 +24,13 @@ "constant": false, "inputs": [ { - "name": "_node", + "internalType": "bytes32", + "name": "node", "type": "bytes32" }, { - "name": "_data", + "internalType": "bytes", + "name": "data", "type": "bytes" } ], @@ -36,45 +40,21 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "bytes32" - }, - { - "name": "", - "type": "uint16" - }, - { - "name": "", - "type": "bytes32" - } - ], - "name": "nameEntriesCount", - "outputs": [ - { - "name": "", - "type": "uint16" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, { "constant": false, "inputs": [ { + "internalType": "bytes32", "name": "node", "type": "bytes32" }, { + "internalType": "string", "name": "key", "type": "string" }, { + "internalType": "string", "name": "value", "type": "string" } @@ -89,10 +69,12 @@ "constant": true, "inputs": [ { + "internalType": "bytes32", "name": "node", "type": "bytes32" }, { + "internalType": "bytes4", "name": "interfaceID", "type": "bytes4" } @@ -100,6 +82,7 @@ "name": "interfaceImplementer", "outputs": [ { + "internalType": "address", "name": "", "type": "address" } @@ -112,10 +95,12 @@ "constant": true, "inputs": [ { + "internalType": "bytes32", "name": "node", "type": "bytes32" }, { + "internalType": "uint256", "name": "contentTypes", "type": "uint256" } @@ -123,10 +108,12 @@ "name": "ABI", "outputs": [ { + "internalType": "uint256", "name": "", "type": "uint256" }, { + "internalType": "bytes", "name": "", "type": "bytes" } @@ -139,14 +126,17 @@ "constant": false, "inputs": [ { + "internalType": "bytes32", "name": "node", "type": "bytes32" }, { + "internalType": "bytes32", "name": "x", "type": "bytes32" }, { + "internalType": "bytes32", "name": "y", "type": "bytes32" } @@ -161,10 +151,12 @@ "constant": false, "inputs": [ { + "internalType": "bytes32", "name": "node", "type": "bytes32" }, { + "internalType": "bytes", "name": "hash", "type": "bytes" } @@ -179,6 +171,7 @@ "constant": true, "inputs": [ { + "internalType": "bytes32", "name": "node", "type": "bytes32" } @@ -186,6 +179,7 @@ "name": "addr", "outputs": [ { + "internalType": "address payable", "name": "", "type": "address" } @@ -198,14 +192,17 @@ "constant": false, "inputs": [ { + "internalType": "bytes32", "name": "node", "type": "bytes32" }, { + "internalType": "address", "name": "target", "type": "address" }, { + "internalType": "bool", "name": "isAuthorised", "type": "bool" } @@ -220,17 +217,20 @@ "constant": true, "inputs": [ { - "name": "_node", + "internalType": "bytes32", + "name": "node", "type": "bytes32" }, { - "name": "_name", + "internalType": "bytes32", + "name": "name", "type": "bytes32" } ], "name": "hasDNSRecords", "outputs": [ { + "internalType": "bool", "name": "", "type": "bool" } @@ -243,27 +243,22 @@ "constant": true, "inputs": [ { - "name": "", + "internalType": "bytes32", + "name": "node", "type": "bytes32" }, { - "name": "", - "type": "uint16" - }, - { - "name": "", - "type": "bytes32" - }, - { - "name": "", - "type": "uint16" + "internalType": "string", + "name": "key", + "type": "string" } ], - "name": "records", + "name": "text", "outputs": [ { + "internalType": "string", "name": "", - "type": "bytes" + "type": "string" } ], "payable": false, @@ -274,19 +269,17 @@ "constant": true, "inputs": [ { + "internalType": "bytes32", "name": "node", "type": "bytes32" - }, - { - "name": "key", - "type": "string" } ], - "name": "text", + "name": "zonehash", "outputs": [ { + "internalType": "bytes", "name": "", - "type": "string" + "type": "bytes" } ], "payable": false, @@ -297,14 +290,17 @@ "constant": false, "inputs": [ { + "internalType": "bytes32", "name": "node", "type": "bytes32" }, { + "internalType": "uint256", "name": "contentType", "type": "uint256" }, { + "internalType": "bytes", "name": "data", "type": "bytes" } @@ -319,6 +315,7 @@ "constant": true, "inputs": [ { + "internalType": "bytes32", "name": "node", "type": "bytes32" } @@ -326,6 +323,7 @@ "name": "name", "outputs": [ { + "internalType": "string", "name": "", "type": "string" } @@ -338,10 +336,12 @@ "constant": false, "inputs": [ { + "internalType": "bytes32", "name": "node", "type": "bytes32" }, { + "internalType": "string", "name": "name", "type": "string" } @@ -352,25 +352,54 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "coinType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "a", + "type": "bytes" + } + ], + "name": "setAddr", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, { "constant": true, "inputs": [ { - "name": "_node", + "internalType": "bytes32", + "name": "node", "type": "bytes32" }, { - "name": "_name", + "internalType": "bytes32", + "name": "name", "type": "bytes32" }, { - "name": "_resource", + "internalType": "uint16", + "name": "resource", "type": "uint16" } ], "name": "dnsRecord", "outputs": [ { + "internalType": "bytes", "name": "", "type": "bytes" } @@ -383,7 +412,8 @@ "constant": false, "inputs": [ { - "name": "_node", + "internalType": "bytes32", + "name": "node", "type": "bytes32" } ], @@ -397,6 +427,7 @@ "constant": true, "inputs": [ { + "internalType": "bytes32", "name": "node", "type": "bytes32" } @@ -404,6 +435,7 @@ "name": "contenthash", "outputs": [ { + "internalType": "bytes", "name": "", "type": "bytes" } @@ -416,25 +448,7 @@ "constant": true, "inputs": [ { - "name": "", - "type": "bytes32" - } - ], - "name": "versions", - "outputs": [ - { - "name": "", - "type": "uint16" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { + "internalType": "bytes32", "name": "node", "type": "bytes32" } @@ -442,10 +456,12 @@ "name": "pubkey", "outputs": [ { + "internalType": "bytes32", "name": "x", "type": "bytes32" }, { + "internalType": "bytes32", "name": "y", "type": "bytes32" } @@ -458,11 +474,33 @@ "constant": false, "inputs": [ { + "internalType": "bytes32", "name": "node", "type": "bytes32" }, { - "name": "addr", + "internalType": "bytes", + "name": "hash", + "type": "bytes" + } + ], + "name": "setZonehash", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "a", "type": "address" } ], @@ -476,14 +514,17 @@ "constant": false, "inputs": [ { + "internalType": "bytes32", "name": "node", "type": "bytes32" }, { + "internalType": "bytes4", "name": "interfaceID", "type": "bytes4" }, { + "internalType": "address", "name": "implementer", "type": "address" } @@ -498,14 +539,43 @@ "constant": true, "inputs": [ { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "coinType", + "type": "uint256" + } + ], + "name": "addr", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "bytes32", "name": "", "type": "bytes32" }, { + "internalType": "address", "name": "", "type": "address" }, { + "internalType": "address", "name": "", "type": "address" } @@ -513,6 +583,7 @@ "name": "authorisations", "outputs": [ { + "internalType": "bool", "name": "", "type": "bool" } @@ -524,7 +595,8 @@ { "inputs": [ { - "name": "_registry", + "internalType": "contract ENS", + "name": "_ens", "type": "address" } ], @@ -532,82 +604,30 @@ "stateMutability": "nonpayable", "type": "constructor" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "node", - "type": "bytes32" - }, - { - "indexed": false, - "name": "name", - "type": "bytes" - }, - { - "indexed": false, - "name": "resource", - "type": "uint16" - } - ], - "name": "Updated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "node", - "type": "bytes32" - }, - { - "indexed": false, - "name": "name", - "type": "bytes" - }, - { - "indexed": false, - "name": "resource", - "type": "uint16" - } - ], - "name": "Deleted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "node", - "type": "bytes32" - } - ], - "name": "Cleared", - "type": "event" - }, { "anonymous": false, "inputs": [ { "indexed": true, + "internalType": "bytes32", "name": "node", "type": "bytes32" }, { "indexed": true, + "internalType": "address", "name": "owner", "type": "address" }, { "indexed": true, + "internalType": "address", "name": "target", "type": "address" }, { "indexed": false, + "internalType": "bool", "name": "isAuthorised", "type": "bool" } @@ -620,16 +640,19 @@ "inputs": [ { "indexed": true, + "internalType": "bytes32", "name": "node", "type": "bytes32" }, { - "indexed": false, + "indexed": true, + "internalType": "string", "name": "indexedKey", "type": "string" }, { "indexed": false, + "internalType": "string", "name": "key", "type": "string" } @@ -642,16 +665,19 @@ "inputs": [ { "indexed": true, + "internalType": "bytes32", "name": "node", "type": "bytes32" }, { "indexed": false, + "internalType": "bytes32", "name": "x", "type": "bytes32" }, { "indexed": false, + "internalType": "bytes32", "name": "y", "type": "bytes32" } @@ -664,11 +690,13 @@ "inputs": [ { "indexed": true, + "internalType": "bytes32", "name": "node", "type": "bytes32" }, { "indexed": false, + "internalType": "string", "name": "name", "type": "string" } @@ -681,16 +709,19 @@ "inputs": [ { "indexed": true, + "internalType": "bytes32", "name": "node", "type": "bytes32" }, { "indexed": true, + "internalType": "bytes4", "name": "interfaceID", "type": "bytes4" }, { "indexed": false, + "internalType": "address", "name": "implementer", "type": "address" } @@ -703,11 +734,107 @@ "inputs": [ { "indexed": true, + "internalType": "bytes32", "name": "node", "type": "bytes32" }, { "indexed": false, + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "uint16", + "name": "resource", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "record", + "type": "bytes" + } + ], + "name": "DNSRecordChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "name", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "uint16", + "name": "resource", + "type": "uint16" + } + ], + "name": "DNSRecordDeleted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], + "name": "DNSZoneCleared", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "lastzonehash", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "zonehash", + "type": "bytes" + } + ], + "name": "DNSZonehashChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes", "name": "hash", "type": "bytes" } @@ -720,11 +847,13 @@ "inputs": [ { "indexed": true, + "internalType": "bytes32", "name": "node", "type": "bytes32" }, { "indexed": false, + "internalType": "address", "name": "a", "type": "address" } @@ -737,11 +866,38 @@ "inputs": [ { "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "coinType", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "newAddress", + "type": "bytes" + } + ], + "name": "AddressChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", "name": "node", "type": "bytes32" }, { "indexed": true, + "internalType": "uint256", "name": "contentType", "type": "uint256" } diff --git a/vendor/github.com/wealdtech/go-ens/v3/contracts/dnsresolver/contract.go b/vendor/github.com/wealdtech/go-ens/v3/contracts/dnsresolver/contract.go index 644839852..fb7400a42 100644 --- a/vendor/github.com/wealdtech/go-ens/v3/contracts/dnsresolver/contract.go +++ b/vendor/github.com/wealdtech/go-ens/v3/contracts/dnsresolver/contract.go @@ -28,7 +28,7 @@ var ( ) // ContractABI is the input ABI used to generate the binding from. -const ContractABI = "[{\"constant\":true,\"inputs\":[{\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_node\",\"type\":\"bytes32\"},{\"name\":\"_data\",\"type\":\"bytes\"}],\"name\":\"setDNSRecords\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"\",\"type\":\"bytes32\"},{\"name\":\"\",\"type\":\"uint16\"},{\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"nameEntriesCount\",\"outputs\":[{\"name\":\"\",\"type\":\"uint16\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"node\",\"type\":\"bytes32\"},{\"name\":\"key\",\"type\":\"string\"},{\"name\":\"value\",\"type\":\"string\"}],\"name\":\"setText\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"node\",\"type\":\"bytes32\"},{\"name\":\"interfaceID\",\"type\":\"bytes4\"}],\"name\":\"interfaceImplementer\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"node\",\"type\":\"bytes32\"},{\"name\":\"contentTypes\",\"type\":\"uint256\"}],\"name\":\"ABI\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"},{\"name\":\"\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"node\",\"type\":\"bytes32\"},{\"name\":\"x\",\"type\":\"bytes32\"},{\"name\":\"y\",\"type\":\"bytes32\"}],\"name\":\"setPubkey\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"node\",\"type\":\"bytes32\"},{\"name\":\"hash\",\"type\":\"bytes\"}],\"name\":\"setContenthash\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"addr\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"node\",\"type\":\"bytes32\"},{\"name\":\"target\",\"type\":\"address\"},{\"name\":\"isAuthorised\",\"type\":\"bool\"}],\"name\":\"setAuthorisation\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_node\",\"type\":\"bytes32\"},{\"name\":\"_name\",\"type\":\"bytes32\"}],\"name\":\"hasDNSRecords\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"\",\"type\":\"bytes32\"},{\"name\":\"\",\"type\":\"uint16\"},{\"name\":\"\",\"type\":\"bytes32\"},{\"name\":\"\",\"type\":\"uint16\"}],\"name\":\"records\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"node\",\"type\":\"bytes32\"},{\"name\":\"key\",\"type\":\"string\"}],\"name\":\"text\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"node\",\"type\":\"bytes32\"},{\"name\":\"contentType\",\"type\":\"uint256\"},{\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"setABI\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"name\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"node\",\"type\":\"bytes32\"},{\"name\":\"name\",\"type\":\"string\"}],\"name\":\"setName\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_node\",\"type\":\"bytes32\"},{\"name\":\"_name\",\"type\":\"bytes32\"},{\"name\":\"_resource\",\"type\":\"uint16\"}],\"name\":\"dnsRecord\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_node\",\"type\":\"bytes32\"}],\"name\":\"clearDNSZone\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"contenthash\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"versions\",\"outputs\":[{\"name\":\"\",\"type\":\"uint16\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"pubkey\",\"outputs\":[{\"name\":\"x\",\"type\":\"bytes32\"},{\"name\":\"y\",\"type\":\"bytes32\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"node\",\"type\":\"bytes32\"},{\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"setAddr\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"node\",\"type\":\"bytes32\"},{\"name\":\"interfaceID\",\"type\":\"bytes4\"},{\"name\":\"implementer\",\"type\":\"address\"}],\"name\":\"setInterface\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"\",\"type\":\"bytes32\"},{\"name\":\"\",\"type\":\"address\"},{\"name\":\"\",\"type\":\"address\"}],\"name\":\"authorisations\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"name\":\"_registry\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"name\":\"name\",\"type\":\"bytes\"},{\"indexed\":false,\"name\":\"resource\",\"type\":\"uint16\"}],\"name\":\"Updated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"name\":\"name\",\"type\":\"bytes\"},{\"indexed\":false,\"name\":\"resource\",\"type\":\"uint16\"}],\"name\":\"Deleted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"Cleared\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":true,\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"target\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"isAuthorised\",\"type\":\"bool\"}],\"name\":\"AuthorisationChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"name\":\"indexedKey\",\"type\":\"string\"},{\"indexed\":false,\"name\":\"key\",\"type\":\"string\"}],\"name\":\"TextChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"name\":\"x\",\"type\":\"bytes32\"},{\"indexed\":false,\"name\":\"y\",\"type\":\"bytes32\"}],\"name\":\"PubkeyChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"name\":\"name\",\"type\":\"string\"}],\"name\":\"NameChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":true,\"name\":\"interfaceID\",\"type\":\"bytes4\"},{\"indexed\":false,\"name\":\"implementer\",\"type\":\"address\"}],\"name\":\"InterfaceChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"name\":\"hash\",\"type\":\"bytes\"}],\"name\":\"ContenthashChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"name\":\"a\",\"type\":\"address\"}],\"name\":\"AddrChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":true,\"name\":\"contentType\",\"type\":\"uint256\"}],\"name\":\"ABIChanged\",\"type\":\"event\"}]" +const ContractABI = "[{\"constant\":true,\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceID\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"setDNSRecords\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"string\",\"name\":\"key\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"value\",\"type\":\"string\"}],\"name\":\"setText\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"bytes4\",\"name\":\"interfaceID\",\"type\":\"bytes4\"}],\"name\":\"interfaceImplementer\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"contentTypes\",\"type\":\"uint256\"}],\"name\":\"ABI\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"x\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"y\",\"type\":\"bytes32\"}],\"name\":\"setPubkey\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"hash\",\"type\":\"bytes\"}],\"name\":\"setContenthash\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"addr\",\"outputs\":[{\"internalType\":\"addresspayable\",\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"isAuthorised\",\"type\":\"bool\"}],\"name\":\"setAuthorisation\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"name\",\"type\":\"bytes32\"}],\"name\":\"hasDNSRecords\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"string\",\"name\":\"key\",\"type\":\"string\"}],\"name\":\"text\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"zonehash\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"contentType\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"setABI\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"name\":\"setName\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"coinType\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"a\",\"type\":\"bytes\"}],\"name\":\"setAddr\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"name\",\"type\":\"bytes32\"},{\"internalType\":\"uint16\",\"name\":\"resource\",\"type\":\"uint16\"}],\"name\":\"dnsRecord\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"clearDNSZone\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"contenthash\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"pubkey\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"x\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"y\",\"type\":\"bytes32\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"hash\",\"type\":\"bytes\"}],\"name\":\"setZonehash\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"a\",\"type\":\"address\"}],\"name\":\"setAddr\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"bytes4\",\"name\":\"interfaceID\",\"type\":\"bytes4\"},{\"internalType\":\"address\",\"name\":\"implementer\",\"type\":\"address\"}],\"name\":\"setInterface\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"coinType\",\"type\":\"uint256\"}],\"name\":\"addr\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"authorisations\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contractENS\",\"name\":\"_ens\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"isAuthorised\",\"type\":\"bool\"}],\"name\":\"AuthorisationChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"string\",\"name\":\"indexedKey\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"key\",\"type\":\"string\"}],\"name\":\"TextChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"x\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"y\",\"type\":\"bytes32\"}],\"name\":\"PubkeyChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"name\":\"NameChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes4\",\"name\":\"interfaceID\",\"type\":\"bytes4\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"implementer\",\"type\":\"address\"}],\"name\":\"InterfaceChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint16\",\"name\":\"resource\",\"type\":\"uint16\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"record\",\"type\":\"bytes\"}],\"name\":\"DNSRecordChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"name\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint16\",\"name\":\"resource\",\"type\":\"uint16\"}],\"name\":\"DNSRecordDeleted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"}],\"name\":\"DNSZoneCleared\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"lastzonehash\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"zonehash\",\"type\":\"bytes\"}],\"name\":\"DNSZonehashChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"hash\",\"type\":\"bytes\"}],\"name\":\"ContenthashChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"a\",\"type\":\"address\"}],\"name\":\"AddrChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"coinType\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"newAddress\",\"type\":\"bytes\"}],\"name\":\"AddressChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"node\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"contentType\",\"type\":\"uint256\"}],\"name\":\"ABIChanged\",\"type\":\"event\"}]" // Contract is an auto generated Go binding around an Ethereum contract. type Contract struct { @@ -228,6 +228,32 @@ func (_Contract *ContractCallerSession) Addr(node [32]byte) (common.Address, err return _Contract.Contract.Addr(&_Contract.CallOpts, node) } +// Addr0 is a free data retrieval call binding the contract method 0xf1cb7e06. +// +// Solidity: function addr(bytes32 node, uint256 coinType) constant returns(bytes) +func (_Contract *ContractCaller) Addr0(opts *bind.CallOpts, node [32]byte, coinType *big.Int) ([]byte, error) { + var ( + ret0 = new([]byte) + ) + out := ret0 + err := _Contract.contract.Call(opts, out, "addr0", node, coinType) + return *ret0, err +} + +// Addr0 is a free data retrieval call binding the contract method 0xf1cb7e06. +// +// Solidity: function addr(bytes32 node, uint256 coinType) constant returns(bytes) +func (_Contract *ContractSession) Addr0(node [32]byte, coinType *big.Int) ([]byte, error) { + return _Contract.Contract.Addr0(&_Contract.CallOpts, node, coinType) +} + +// Addr0 is a free data retrieval call binding the contract method 0xf1cb7e06. +// +// Solidity: function addr(bytes32 node, uint256 coinType) constant returns(bytes) +func (_Contract *ContractCallerSession) Addr0(node [32]byte, coinType *big.Int) ([]byte, error) { + return _Contract.Contract.Addr0(&_Contract.CallOpts, node, coinType) +} + // Authorisations is a free data retrieval call binding the contract method 0xf86bc879. // // Solidity: function authorisations(bytes32 , address , address ) constant returns(bool) @@ -282,54 +308,54 @@ func (_Contract *ContractCallerSession) Contenthash(node [32]byte) ([]byte, erro // DnsRecord is a free data retrieval call binding the contract method 0xa8fa5682. // -// Solidity: function dnsRecord(bytes32 _node, bytes32 _name, uint16 _resource) constant returns(bytes) -func (_Contract *ContractCaller) DnsRecord(opts *bind.CallOpts, _node [32]byte, _name [32]byte, _resource uint16) ([]byte, error) { +// Solidity: function dnsRecord(bytes32 node, bytes32 name, uint16 resource) constant returns(bytes) +func (_Contract *ContractCaller) DnsRecord(opts *bind.CallOpts, node [32]byte, name [32]byte, resource uint16) ([]byte, error) { var ( ret0 = new([]byte) ) out := ret0 - err := _Contract.contract.Call(opts, out, "dnsRecord", _node, _name, _resource) + err := _Contract.contract.Call(opts, out, "dnsRecord", node, name, resource) return *ret0, err } // DnsRecord is a free data retrieval call binding the contract method 0xa8fa5682. // -// Solidity: function dnsRecord(bytes32 _node, bytes32 _name, uint16 _resource) constant returns(bytes) -func (_Contract *ContractSession) DnsRecord(_node [32]byte, _name [32]byte, _resource uint16) ([]byte, error) { - return _Contract.Contract.DnsRecord(&_Contract.CallOpts, _node, _name, _resource) +// Solidity: function dnsRecord(bytes32 node, bytes32 name, uint16 resource) constant returns(bytes) +func (_Contract *ContractSession) DnsRecord(node [32]byte, name [32]byte, resource uint16) ([]byte, error) { + return _Contract.Contract.DnsRecord(&_Contract.CallOpts, node, name, resource) } // DnsRecord is a free data retrieval call binding the contract method 0xa8fa5682. // -// Solidity: function dnsRecord(bytes32 _node, bytes32 _name, uint16 _resource) constant returns(bytes) -func (_Contract *ContractCallerSession) DnsRecord(_node [32]byte, _name [32]byte, _resource uint16) ([]byte, error) { - return _Contract.Contract.DnsRecord(&_Contract.CallOpts, _node, _name, _resource) +// Solidity: function dnsRecord(bytes32 node, bytes32 name, uint16 resource) constant returns(bytes) +func (_Contract *ContractCallerSession) DnsRecord(node [32]byte, name [32]byte, resource uint16) ([]byte, error) { + return _Contract.Contract.DnsRecord(&_Contract.CallOpts, node, name, resource) } // HasDNSRecords is a free data retrieval call binding the contract method 0x4cbf6ba4. // -// Solidity: function hasDNSRecords(bytes32 _node, bytes32 _name) constant returns(bool) -func (_Contract *ContractCaller) HasDNSRecords(opts *bind.CallOpts, _node [32]byte, _name [32]byte) (bool, error) { +// Solidity: function hasDNSRecords(bytes32 node, bytes32 name) constant returns(bool) +func (_Contract *ContractCaller) HasDNSRecords(opts *bind.CallOpts, node [32]byte, name [32]byte) (bool, error) { var ( ret0 = new(bool) ) out := ret0 - err := _Contract.contract.Call(opts, out, "hasDNSRecords", _node, _name) + err := _Contract.contract.Call(opts, out, "hasDNSRecords", node, name) return *ret0, err } // HasDNSRecords is a free data retrieval call binding the contract method 0x4cbf6ba4. // -// Solidity: function hasDNSRecords(bytes32 _node, bytes32 _name) constant returns(bool) -func (_Contract *ContractSession) HasDNSRecords(_node [32]byte, _name [32]byte) (bool, error) { - return _Contract.Contract.HasDNSRecords(&_Contract.CallOpts, _node, _name) +// Solidity: function hasDNSRecords(bytes32 node, bytes32 name) constant returns(bool) +func (_Contract *ContractSession) HasDNSRecords(node [32]byte, name [32]byte) (bool, error) { + return _Contract.Contract.HasDNSRecords(&_Contract.CallOpts, node, name) } // HasDNSRecords is a free data retrieval call binding the contract method 0x4cbf6ba4. // -// Solidity: function hasDNSRecords(bytes32 _node, bytes32 _name) constant returns(bool) -func (_Contract *ContractCallerSession) HasDNSRecords(_node [32]byte, _name [32]byte) (bool, error) { - return _Contract.Contract.HasDNSRecords(&_Contract.CallOpts, _node, _name) +// Solidity: function hasDNSRecords(bytes32 node, bytes32 name) constant returns(bool) +func (_Contract *ContractCallerSession) HasDNSRecords(node [32]byte, name [32]byte) (bool, error) { + return _Contract.Contract.HasDNSRecords(&_Contract.CallOpts, node, name) } // InterfaceImplementer is a free data retrieval call binding the contract method 0x124a319c. @@ -384,32 +410,6 @@ func (_Contract *ContractCallerSession) Name(node [32]byte) (string, error) { return _Contract.Contract.Name(&_Contract.CallOpts, node) } -// NameEntriesCount is a free data retrieval call binding the contract method 0x0dee3863. -// -// Solidity: function nameEntriesCount(bytes32 , uint16 , bytes32 ) constant returns(uint16) -func (_Contract *ContractCaller) NameEntriesCount(opts *bind.CallOpts, arg0 [32]byte, arg1 uint16, arg2 [32]byte) (uint16, error) { - var ( - ret0 = new(uint16) - ) - out := ret0 - err := _Contract.contract.Call(opts, out, "nameEntriesCount", arg0, arg1, arg2) - return *ret0, err -} - -// NameEntriesCount is a free data retrieval call binding the contract method 0x0dee3863. -// -// Solidity: function nameEntriesCount(bytes32 , uint16 , bytes32 ) constant returns(uint16) -func (_Contract *ContractSession) NameEntriesCount(arg0 [32]byte, arg1 uint16, arg2 [32]byte) (uint16, error) { - return _Contract.Contract.NameEntriesCount(&_Contract.CallOpts, arg0, arg1, arg2) -} - -// NameEntriesCount is a free data retrieval call binding the contract method 0x0dee3863. -// -// Solidity: function nameEntriesCount(bytes32 , uint16 , bytes32 ) constant returns(uint16) -func (_Contract *ContractCallerSession) NameEntriesCount(arg0 [32]byte, arg1 uint16, arg2 [32]byte) (uint16, error) { - return _Contract.Contract.NameEntriesCount(&_Contract.CallOpts, arg0, arg1, arg2) -} - // Pubkey is a free data retrieval call binding the contract method 0xc8690233. // // Solidity: function pubkey(bytes32 node) constant returns(bytes32 x, bytes32 y) @@ -446,56 +446,30 @@ func (_Contract *ContractCallerSession) Pubkey(node [32]byte) (struct { return _Contract.Contract.Pubkey(&_Contract.CallOpts, node) } -// Records is a free data retrieval call binding the contract method 0x4f96bc00. -// -// Solidity: function records(bytes32 , uint16 , bytes32 , uint16 ) constant returns(bytes) -func (_Contract *ContractCaller) Records(opts *bind.CallOpts, arg0 [32]byte, arg1 uint16, arg2 [32]byte, arg3 uint16) ([]byte, error) { - var ( - ret0 = new([]byte) - ) - out := ret0 - err := _Contract.contract.Call(opts, out, "records", arg0, arg1, arg2, arg3) - return *ret0, err -} - -// Records is a free data retrieval call binding the contract method 0x4f96bc00. -// -// Solidity: function records(bytes32 , uint16 , bytes32 , uint16 ) constant returns(bytes) -func (_Contract *ContractSession) Records(arg0 [32]byte, arg1 uint16, arg2 [32]byte, arg3 uint16) ([]byte, error) { - return _Contract.Contract.Records(&_Contract.CallOpts, arg0, arg1, arg2, arg3) -} - -// Records is a free data retrieval call binding the contract method 0x4f96bc00. -// -// Solidity: function records(bytes32 , uint16 , bytes32 , uint16 ) constant returns(bytes) -func (_Contract *ContractCallerSession) Records(arg0 [32]byte, arg1 uint16, arg2 [32]byte, arg3 uint16) ([]byte, error) { - return _Contract.Contract.Records(&_Contract.CallOpts, arg0, arg1, arg2, arg3) -} - // SupportsInterface is a free data retrieval call binding the contract method 0x01ffc9a7. // -// Solidity: function supportsInterface(bytes4 interfaceId) constant returns(bool) -func (_Contract *ContractCaller) SupportsInterface(opts *bind.CallOpts, interfaceId [4]byte) (bool, error) { +// Solidity: function supportsInterface(bytes4 interfaceID) constant returns(bool) +func (_Contract *ContractCaller) SupportsInterface(opts *bind.CallOpts, interfaceID [4]byte) (bool, error) { var ( ret0 = new(bool) ) out := ret0 - err := _Contract.contract.Call(opts, out, "supportsInterface", interfaceId) + err := _Contract.contract.Call(opts, out, "supportsInterface", interfaceID) return *ret0, err } // SupportsInterface is a free data retrieval call binding the contract method 0x01ffc9a7. // -// Solidity: function supportsInterface(bytes4 interfaceId) constant returns(bool) -func (_Contract *ContractSession) SupportsInterface(interfaceId [4]byte) (bool, error) { - return _Contract.Contract.SupportsInterface(&_Contract.CallOpts, interfaceId) +// Solidity: function supportsInterface(bytes4 interfaceID) constant returns(bool) +func (_Contract *ContractSession) SupportsInterface(interfaceID [4]byte) (bool, error) { + return _Contract.Contract.SupportsInterface(&_Contract.CallOpts, interfaceID) } // SupportsInterface is a free data retrieval call binding the contract method 0x01ffc9a7. // -// Solidity: function supportsInterface(bytes4 interfaceId) constant returns(bool) -func (_Contract *ContractCallerSession) SupportsInterface(interfaceId [4]byte) (bool, error) { - return _Contract.Contract.SupportsInterface(&_Contract.CallOpts, interfaceId) +// Solidity: function supportsInterface(bytes4 interfaceID) constant returns(bool) +func (_Contract *ContractCallerSession) SupportsInterface(interfaceID [4]byte) (bool, error) { + return _Contract.Contract.SupportsInterface(&_Contract.CallOpts, interfaceID) } // Text is a free data retrieval call binding the contract method 0x59d1d43c. @@ -524,51 +498,51 @@ func (_Contract *ContractCallerSession) Text(node [32]byte, key string) (string, return _Contract.Contract.Text(&_Contract.CallOpts, node, key) } -// Versions is a free data retrieval call binding the contract method 0xc7cec7f8. +// Zonehash is a free data retrieval call binding the contract method 0x5c98042b. // -// Solidity: function versions(bytes32 ) constant returns(uint16) -func (_Contract *ContractCaller) Versions(opts *bind.CallOpts, arg0 [32]byte) (uint16, error) { +// Solidity: function zonehash(bytes32 node) constant returns(bytes) +func (_Contract *ContractCaller) Zonehash(opts *bind.CallOpts, node [32]byte) ([]byte, error) { var ( - ret0 = new(uint16) + ret0 = new([]byte) ) out := ret0 - err := _Contract.contract.Call(opts, out, "versions", arg0) + err := _Contract.contract.Call(opts, out, "zonehash", node) return *ret0, err } -// Versions is a free data retrieval call binding the contract method 0xc7cec7f8. +// Zonehash is a free data retrieval call binding the contract method 0x5c98042b. // -// Solidity: function versions(bytes32 ) constant returns(uint16) -func (_Contract *ContractSession) Versions(arg0 [32]byte) (uint16, error) { - return _Contract.Contract.Versions(&_Contract.CallOpts, arg0) +// Solidity: function zonehash(bytes32 node) constant returns(bytes) +func (_Contract *ContractSession) Zonehash(node [32]byte) ([]byte, error) { + return _Contract.Contract.Zonehash(&_Contract.CallOpts, node) } -// Versions is a free data retrieval call binding the contract method 0xc7cec7f8. +// Zonehash is a free data retrieval call binding the contract method 0x5c98042b. // -// Solidity: function versions(bytes32 ) constant returns(uint16) -func (_Contract *ContractCallerSession) Versions(arg0 [32]byte) (uint16, error) { - return _Contract.Contract.Versions(&_Contract.CallOpts, arg0) +// Solidity: function zonehash(bytes32 node) constant returns(bytes) +func (_Contract *ContractCallerSession) Zonehash(node [32]byte) ([]byte, error) { + return _Contract.Contract.Zonehash(&_Contract.CallOpts, node) } // ClearDNSZone is a paid mutator transaction binding the contract method 0xad5780af. // -// Solidity: function clearDNSZone(bytes32 _node) returns() -func (_Contract *ContractTransactor) ClearDNSZone(opts *bind.TransactOpts, _node [32]byte) (*types.Transaction, error) { - return _Contract.contract.Transact(opts, "clearDNSZone", _node) +// Solidity: function clearDNSZone(bytes32 node) returns() +func (_Contract *ContractTransactor) ClearDNSZone(opts *bind.TransactOpts, node [32]byte) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "clearDNSZone", node) } // ClearDNSZone is a paid mutator transaction binding the contract method 0xad5780af. // -// Solidity: function clearDNSZone(bytes32 _node) returns() -func (_Contract *ContractSession) ClearDNSZone(_node [32]byte) (*types.Transaction, error) { - return _Contract.Contract.ClearDNSZone(&_Contract.TransactOpts, _node) +// Solidity: function clearDNSZone(bytes32 node) returns() +func (_Contract *ContractSession) ClearDNSZone(node [32]byte) (*types.Transaction, error) { + return _Contract.Contract.ClearDNSZone(&_Contract.TransactOpts, node) } // ClearDNSZone is a paid mutator transaction binding the contract method 0xad5780af. // -// Solidity: function clearDNSZone(bytes32 _node) returns() -func (_Contract *ContractTransactorSession) ClearDNSZone(_node [32]byte) (*types.Transaction, error) { - return _Contract.Contract.ClearDNSZone(&_Contract.TransactOpts, _node) +// Solidity: function clearDNSZone(bytes32 node) returns() +func (_Contract *ContractTransactorSession) ClearDNSZone(node [32]byte) (*types.Transaction, error) { + return _Contract.Contract.ClearDNSZone(&_Contract.TransactOpts, node) } // SetABI is a paid mutator transaction binding the contract method 0x623195b0. @@ -592,25 +566,46 @@ func (_Contract *ContractTransactorSession) SetABI(node [32]byte, contentType *b return _Contract.Contract.SetABI(&_Contract.TransactOpts, node, contentType, data) } -// SetAddr is a paid mutator transaction binding the contract method 0xd5fa2b00. +// SetAddr is a paid mutator transaction binding the contract method 0x8b95dd71. // -// Solidity: function setAddr(bytes32 node, address addr) returns() -func (_Contract *ContractTransactor) SetAddr(opts *bind.TransactOpts, node [32]byte, addr common.Address) (*types.Transaction, error) { - return _Contract.contract.Transact(opts, "setAddr", node, addr) +// Solidity: function setAddr(bytes32 node, uint256 coinType, bytes a) returns() +func (_Contract *ContractTransactor) SetAddr(opts *bind.TransactOpts, node [32]byte, coinType *big.Int, a []byte) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "setAddr", node, coinType, a) } -// SetAddr is a paid mutator transaction binding the contract method 0xd5fa2b00. +// SetAddr is a paid mutator transaction binding the contract method 0x8b95dd71. // -// Solidity: function setAddr(bytes32 node, address addr) returns() -func (_Contract *ContractSession) SetAddr(node [32]byte, addr common.Address) (*types.Transaction, error) { - return _Contract.Contract.SetAddr(&_Contract.TransactOpts, node, addr) +// Solidity: function setAddr(bytes32 node, uint256 coinType, bytes a) returns() +func (_Contract *ContractSession) SetAddr(node [32]byte, coinType *big.Int, a []byte) (*types.Transaction, error) { + return _Contract.Contract.SetAddr(&_Contract.TransactOpts, node, coinType, a) } -// SetAddr is a paid mutator transaction binding the contract method 0xd5fa2b00. +// SetAddr is a paid mutator transaction binding the contract method 0x8b95dd71. // -// Solidity: function setAddr(bytes32 node, address addr) returns() -func (_Contract *ContractTransactorSession) SetAddr(node [32]byte, addr common.Address) (*types.Transaction, error) { - return _Contract.Contract.SetAddr(&_Contract.TransactOpts, node, addr) +// Solidity: function setAddr(bytes32 node, uint256 coinType, bytes a) returns() +func (_Contract *ContractTransactorSession) SetAddr(node [32]byte, coinType *big.Int, a []byte) (*types.Transaction, error) { + return _Contract.Contract.SetAddr(&_Contract.TransactOpts, node, coinType, a) +} + +// SetAddr0 is a paid mutator transaction binding the contract method 0xd5fa2b00. +// +// Solidity: function setAddr(bytes32 node, address a) returns() +func (_Contract *ContractTransactor) SetAddr0(opts *bind.TransactOpts, node [32]byte, a common.Address) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "setAddr0", node, a) +} + +// SetAddr0 is a paid mutator transaction binding the contract method 0xd5fa2b00. +// +// Solidity: function setAddr(bytes32 node, address a) returns() +func (_Contract *ContractSession) SetAddr0(node [32]byte, a common.Address) (*types.Transaction, error) { + return _Contract.Contract.SetAddr0(&_Contract.TransactOpts, node, a) +} + +// SetAddr0 is a paid mutator transaction binding the contract method 0xd5fa2b00. +// +// Solidity: function setAddr(bytes32 node, address a) returns() +func (_Contract *ContractTransactorSession) SetAddr0(node [32]byte, a common.Address) (*types.Transaction, error) { + return _Contract.Contract.SetAddr0(&_Contract.TransactOpts, node, a) } // SetAuthorisation is a paid mutator transaction binding the contract method 0x3e9ce794. @@ -657,23 +652,23 @@ func (_Contract *ContractTransactorSession) SetContenthash(node [32]byte, hash [ // SetDNSRecords is a paid mutator transaction binding the contract method 0x0af179d7. // -// Solidity: function setDNSRecords(bytes32 _node, bytes _data) returns() -func (_Contract *ContractTransactor) SetDNSRecords(opts *bind.TransactOpts, _node [32]byte, _data []byte) (*types.Transaction, error) { - return _Contract.contract.Transact(opts, "setDNSRecords", _node, _data) +// Solidity: function setDNSRecords(bytes32 node, bytes data) returns() +func (_Contract *ContractTransactor) SetDNSRecords(opts *bind.TransactOpts, node [32]byte, data []byte) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "setDNSRecords", node, data) } // SetDNSRecords is a paid mutator transaction binding the contract method 0x0af179d7. // -// Solidity: function setDNSRecords(bytes32 _node, bytes _data) returns() -func (_Contract *ContractSession) SetDNSRecords(_node [32]byte, _data []byte) (*types.Transaction, error) { - return _Contract.Contract.SetDNSRecords(&_Contract.TransactOpts, _node, _data) +// Solidity: function setDNSRecords(bytes32 node, bytes data) returns() +func (_Contract *ContractSession) SetDNSRecords(node [32]byte, data []byte) (*types.Transaction, error) { + return _Contract.Contract.SetDNSRecords(&_Contract.TransactOpts, node, data) } // SetDNSRecords is a paid mutator transaction binding the contract method 0x0af179d7. // -// Solidity: function setDNSRecords(bytes32 _node, bytes _data) returns() -func (_Contract *ContractTransactorSession) SetDNSRecords(_node [32]byte, _data []byte) (*types.Transaction, error) { - return _Contract.Contract.SetDNSRecords(&_Contract.TransactOpts, _node, _data) +// Solidity: function setDNSRecords(bytes32 node, bytes data) returns() +func (_Contract *ContractTransactorSession) SetDNSRecords(node [32]byte, data []byte) (*types.Transaction, error) { + return _Contract.Contract.SetDNSRecords(&_Contract.TransactOpts, node, data) } // SetInterface is a paid mutator transaction binding the contract method 0xe59d895d. @@ -760,6 +755,27 @@ func (_Contract *ContractTransactorSession) SetText(node [32]byte, key string, v return _Contract.Contract.SetText(&_Contract.TransactOpts, node, key, value) } +// SetZonehash is a paid mutator transaction binding the contract method 0xce3decdc. +// +// Solidity: function setZonehash(bytes32 node, bytes hash) returns() +func (_Contract *ContractTransactor) SetZonehash(opts *bind.TransactOpts, node [32]byte, hash []byte) (*types.Transaction, error) { + return _Contract.contract.Transact(opts, "setZonehash", node, hash) +} + +// SetZonehash is a paid mutator transaction binding the contract method 0xce3decdc. +// +// Solidity: function setZonehash(bytes32 node, bytes hash) returns() +func (_Contract *ContractSession) SetZonehash(node [32]byte, hash []byte) (*types.Transaction, error) { + return _Contract.Contract.SetZonehash(&_Contract.TransactOpts, node, hash) +} + +// SetZonehash is a paid mutator transaction binding the contract method 0xce3decdc. +// +// Solidity: function setZonehash(bytes32 node, bytes hash) returns() +func (_Contract *ContractTransactorSession) SetZonehash(node [32]byte, hash []byte) (*types.Transaction, error) { + return _Contract.Contract.SetZonehash(&_Contract.TransactOpts, node, hash) +} + // ContractABIChangedIterator is returned from FilterABIChanged and is used to iterate over the raw logs and unpacked data for ABIChanged events raised by the Contract contract. type ContractABIChangedIterator struct { Event *ContractABIChanged // Event containing the contract specifics and raw log @@ -901,6 +917,17 @@ func (_Contract *ContractFilterer) WatchABIChanged(opts *bind.WatchOpts, sink ch }), nil } +// ParseABIChanged is a log parse operation binding the contract event 0xaa121bbeef5f32f5961a2a28966e769023910fc9479059ee3495d4c1a696efe3. +// +// Solidity: event ABIChanged(bytes32 indexed node, uint256 indexed contentType) +func (_Contract *ContractFilterer) ParseABIChanged(log types.Log) (*ContractABIChanged, error) { + event := new(ContractABIChanged) + if err := _Contract.contract.UnpackLog(event, "ABIChanged", log); err != nil { + return nil, err + } + return event, nil +} + // ContractAddrChangedIterator is returned from FilterAddrChanged and is used to iterate over the raw logs and unpacked data for AddrChanged events raised by the Contract contract. type ContractAddrChangedIterator struct { Event *ContractAddrChanged // Event containing the contract specifics and raw log @@ -1034,6 +1061,162 @@ func (_Contract *ContractFilterer) WatchAddrChanged(opts *bind.WatchOpts, sink c }), nil } +// ParseAddrChanged is a log parse operation binding the contract event 0x52d7d861f09ab3d26239d492e8968629f95e9e318cf0b73bfddc441522a15fd2. +// +// Solidity: event AddrChanged(bytes32 indexed node, address a) +func (_Contract *ContractFilterer) ParseAddrChanged(log types.Log) (*ContractAddrChanged, error) { + event := new(ContractAddrChanged) + if err := _Contract.contract.UnpackLog(event, "AddrChanged", log); err != nil { + return nil, err + } + return event, nil +} + +// ContractAddressChangedIterator is returned from FilterAddressChanged and is used to iterate over the raw logs and unpacked data for AddressChanged events raised by the Contract contract. +type ContractAddressChangedIterator struct { + Event *ContractAddressChanged // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *ContractAddressChangedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(ContractAddressChanged) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(ContractAddressChanged) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *ContractAddressChangedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ContractAddressChangedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ContractAddressChanged represents a AddressChanged event raised by the Contract contract. +type ContractAddressChanged struct { + Node [32]byte + CoinType *big.Int + NewAddress []byte + Raw types.Log // Blockchain specific contextual infos +} + +// FilterAddressChanged is a free log retrieval operation binding the contract event 0x65412581168e88a1e60c6459d7f44ae83ad0832e670826c05a4e2476b57af752. +// +// Solidity: event AddressChanged(bytes32 indexed node, uint256 coinType, bytes newAddress) +func (_Contract *ContractFilterer) FilterAddressChanged(opts *bind.FilterOpts, node [][32]byte) (*ContractAddressChangedIterator, error) { + + var nodeRule []interface{} + for _, nodeItem := range node { + nodeRule = append(nodeRule, nodeItem) + } + + logs, sub, err := _Contract.contract.FilterLogs(opts, "AddressChanged", nodeRule) + if err != nil { + return nil, err + } + return &ContractAddressChangedIterator{contract: _Contract.contract, event: "AddressChanged", logs: logs, sub: sub}, nil +} + +// WatchAddressChanged is a free log subscription operation binding the contract event 0x65412581168e88a1e60c6459d7f44ae83ad0832e670826c05a4e2476b57af752. +// +// Solidity: event AddressChanged(bytes32 indexed node, uint256 coinType, bytes newAddress) +func (_Contract *ContractFilterer) WatchAddressChanged(opts *bind.WatchOpts, sink chan<- *ContractAddressChanged, node [][32]byte) (event.Subscription, error) { + + var nodeRule []interface{} + for _, nodeItem := range node { + nodeRule = append(nodeRule, nodeItem) + } + + logs, sub, err := _Contract.contract.WatchLogs(opts, "AddressChanged", nodeRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(ContractAddressChanged) + if err := _Contract.contract.UnpackLog(event, "AddressChanged", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseAddressChanged is a log parse operation binding the contract event 0x65412581168e88a1e60c6459d7f44ae83ad0832e670826c05a4e2476b57af752. +// +// Solidity: event AddressChanged(bytes32 indexed node, uint256 coinType, bytes newAddress) +func (_Contract *ContractFilterer) ParseAddressChanged(log types.Log) (*ContractAddressChanged, error) { + event := new(ContractAddressChanged) + if err := _Contract.contract.UnpackLog(event, "AddressChanged", log); err != nil { + return nil, err + } + return event, nil +} + // ContractAuthorisationChangedIterator is returned from FilterAuthorisationChanged and is used to iterate over the raw logs and unpacked data for AuthorisationChanged events raised by the Contract contract. type ContractAuthorisationChangedIterator struct { Event *ContractAuthorisationChanged // Event containing the contract specifics and raw log @@ -1185,126 +1368,15 @@ func (_Contract *ContractFilterer) WatchAuthorisationChanged(opts *bind.WatchOpt }), nil } -// ContractClearedIterator is returned from FilterCleared and is used to iterate over the raw logs and unpacked data for Cleared events raised by the Contract contract. -type ContractClearedIterator struct { - Event *ContractCleared // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *ContractClearedIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(ContractCleared) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(ContractCleared) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *ContractClearedIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *ContractClearedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// ContractCleared represents a Cleared event raised by the Contract contract. -type ContractCleared struct { - Node [32]byte - Raw types.Log // Blockchain specific contextual infos -} - -// FilterCleared is a free log retrieval operation binding the contract event 0xf9c9793a5e1c345ae880b8c5e3b0a241f568d7242dcf6e21a2bea5dfb817d88e. +// ParseAuthorisationChanged is a log parse operation binding the contract event 0xe1c5610a6e0cbe10764ecd182adcef1ec338dc4e199c99c32ce98f38e12791df. // -// Solidity: event Cleared(bytes32 node) -func (_Contract *ContractFilterer) FilterCleared(opts *bind.FilterOpts) (*ContractClearedIterator, error) { - - logs, sub, err := _Contract.contract.FilterLogs(opts, "Cleared") - if err != nil { +// Solidity: event AuthorisationChanged(bytes32 indexed node, address indexed owner, address indexed target, bool isAuthorised) +func (_Contract *ContractFilterer) ParseAuthorisationChanged(log types.Log) (*ContractAuthorisationChanged, error) { + event := new(ContractAuthorisationChanged) + if err := _Contract.contract.UnpackLog(event, "AuthorisationChanged", log); err != nil { return nil, err } - return &ContractClearedIterator{contract: _Contract.contract, event: "Cleared", logs: logs, sub: sub}, nil -} - -// WatchCleared is a free log subscription operation binding the contract event 0xf9c9793a5e1c345ae880b8c5e3b0a241f568d7242dcf6e21a2bea5dfb817d88e. -// -// Solidity: event Cleared(bytes32 node) -func (_Contract *ContractFilterer) WatchCleared(opts *bind.WatchOpts, sink chan<- *ContractCleared) (event.Subscription, error) { - - logs, sub, err := _Contract.contract.WatchLogs(opts, "Cleared") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(ContractCleared) - if err := _Contract.contract.UnpackLog(event, "Cleared", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil + return event, nil } // ContractContenthashChangedIterator is returned from FilterContenthashChanged and is used to iterate over the raw logs and unpacked data for ContenthashChanged events raised by the Contract contract. @@ -1440,9 +1512,20 @@ func (_Contract *ContractFilterer) WatchContenthashChanged(opts *bind.WatchOpts, }), nil } -// ContractDeletedIterator is returned from FilterDeleted and is used to iterate over the raw logs and unpacked data for Deleted events raised by the Contract contract. -type ContractDeletedIterator struct { - Event *ContractDeleted // Event containing the contract specifics and raw log +// ParseContenthashChanged is a log parse operation binding the contract event 0xe379c1624ed7e714cc0937528a32359d69d5281337765313dba4e081b72d7578. +// +// Solidity: event ContenthashChanged(bytes32 indexed node, bytes hash) +func (_Contract *ContractFilterer) ParseContenthashChanged(log types.Log) (*ContractContenthashChanged, error) { + event := new(ContractContenthashChanged) + if err := _Contract.contract.UnpackLog(event, "ContenthashChanged", log); err != nil { + return nil, err + } + return event, nil +} + +// ContractDNSRecordChangedIterator is returned from FilterDNSRecordChanged and is used to iterate over the raw logs and unpacked data for DNSRecordChanged events raised by the Contract contract. +type ContractDNSRecordChangedIterator struct { + Event *ContractDNSRecordChanged // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -1456,7 +1539,7 @@ type ContractDeletedIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *ContractDeletedIterator) Next() bool { +func (it *ContractDNSRecordChangedIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -1465,7 +1548,7 @@ func (it *ContractDeletedIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(ContractDeleted) + it.Event = new(ContractDNSRecordChanged) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1480,7 +1563,7 @@ func (it *ContractDeletedIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(ContractDeleted) + it.Event = new(ContractDNSRecordChanged) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1496,43 +1579,54 @@ func (it *ContractDeletedIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *ContractDeletedIterator) Error() error { +func (it *ContractDNSRecordChangedIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *ContractDeletedIterator) Close() error { +func (it *ContractDNSRecordChangedIterator) Close() error { it.sub.Unsubscribe() return nil } -// ContractDeleted represents a Deleted event raised by the Contract contract. -type ContractDeleted struct { +// ContractDNSRecordChanged represents a DNSRecordChanged event raised by the Contract contract. +type ContractDNSRecordChanged struct { Node [32]byte Name []byte Resource uint16 + Record []byte Raw types.Log // Blockchain specific contextual infos } -// FilterDeleted is a free log retrieval operation binding the contract event 0x133052c72ea386f24d31f74751f618e877370038e43ae5a1571abd4e7039a10b. +// FilterDNSRecordChanged is a free log retrieval operation binding the contract event 0x52a608b3303a48862d07a73d82fa221318c0027fbbcfb1b2329bface3f19ff2b. // -// Solidity: event Deleted(bytes32 node, bytes name, uint16 resource) -func (_Contract *ContractFilterer) FilterDeleted(opts *bind.FilterOpts) (*ContractDeletedIterator, error) { +// Solidity: event DNSRecordChanged(bytes32 indexed node, bytes name, uint16 resource, bytes record) +func (_Contract *ContractFilterer) FilterDNSRecordChanged(opts *bind.FilterOpts, node [][32]byte) (*ContractDNSRecordChangedIterator, error) { - logs, sub, err := _Contract.contract.FilterLogs(opts, "Deleted") + var nodeRule []interface{} + for _, nodeItem := range node { + nodeRule = append(nodeRule, nodeItem) + } + + logs, sub, err := _Contract.contract.FilterLogs(opts, "DNSRecordChanged", nodeRule) if err != nil { return nil, err } - return &ContractDeletedIterator{contract: _Contract.contract, event: "Deleted", logs: logs, sub: sub}, nil + return &ContractDNSRecordChangedIterator{contract: _Contract.contract, event: "DNSRecordChanged", logs: logs, sub: sub}, nil } -// WatchDeleted is a free log subscription operation binding the contract event 0x133052c72ea386f24d31f74751f618e877370038e43ae5a1571abd4e7039a10b. +// WatchDNSRecordChanged is a free log subscription operation binding the contract event 0x52a608b3303a48862d07a73d82fa221318c0027fbbcfb1b2329bface3f19ff2b. // -// Solidity: event Deleted(bytes32 node, bytes name, uint16 resource) -func (_Contract *ContractFilterer) WatchDeleted(opts *bind.WatchOpts, sink chan<- *ContractDeleted) (event.Subscription, error) { +// Solidity: event DNSRecordChanged(bytes32 indexed node, bytes name, uint16 resource, bytes record) +func (_Contract *ContractFilterer) WatchDNSRecordChanged(opts *bind.WatchOpts, sink chan<- *ContractDNSRecordChanged, node [][32]byte) (event.Subscription, error) { - logs, sub, err := _Contract.contract.WatchLogs(opts, "Deleted") + var nodeRule []interface{} + for _, nodeItem := range node { + nodeRule = append(nodeRule, nodeItem) + } + + logs, sub, err := _Contract.contract.WatchLogs(opts, "DNSRecordChanged", nodeRule) if err != nil { return nil, err } @@ -1542,8 +1636,8 @@ func (_Contract *ContractFilterer) WatchDeleted(opts *bind.WatchOpts, sink chan< select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(ContractDeleted) - if err := _Contract.contract.UnpackLog(event, "Deleted", log); err != nil { + event := new(ContractDNSRecordChanged) + if err := _Contract.contract.UnpackLog(event, "DNSRecordChanged", log); err != nil { return err } event.Raw = log @@ -1564,6 +1658,450 @@ func (_Contract *ContractFilterer) WatchDeleted(opts *bind.WatchOpts, sink chan< }), nil } +// ParseDNSRecordChanged is a log parse operation binding the contract event 0x52a608b3303a48862d07a73d82fa221318c0027fbbcfb1b2329bface3f19ff2b. +// +// Solidity: event DNSRecordChanged(bytes32 indexed node, bytes name, uint16 resource, bytes record) +func (_Contract *ContractFilterer) ParseDNSRecordChanged(log types.Log) (*ContractDNSRecordChanged, error) { + event := new(ContractDNSRecordChanged) + if err := _Contract.contract.UnpackLog(event, "DNSRecordChanged", log); err != nil { + return nil, err + } + return event, nil +} + +// ContractDNSRecordDeletedIterator is returned from FilterDNSRecordDeleted and is used to iterate over the raw logs and unpacked data for DNSRecordDeleted events raised by the Contract contract. +type ContractDNSRecordDeletedIterator struct { + Event *ContractDNSRecordDeleted // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *ContractDNSRecordDeletedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(ContractDNSRecordDeleted) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(ContractDNSRecordDeleted) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *ContractDNSRecordDeletedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ContractDNSRecordDeletedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ContractDNSRecordDeleted represents a DNSRecordDeleted event raised by the Contract contract. +type ContractDNSRecordDeleted struct { + Node [32]byte + Name []byte + Resource uint16 + Raw types.Log // Blockchain specific contextual infos +} + +// FilterDNSRecordDeleted is a free log retrieval operation binding the contract event 0x03528ed0c2a3ebc993b12ce3c16bb382f9c7d88ef7d8a1bf290eaf35955a1207. +// +// Solidity: event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource) +func (_Contract *ContractFilterer) FilterDNSRecordDeleted(opts *bind.FilterOpts, node [][32]byte) (*ContractDNSRecordDeletedIterator, error) { + + var nodeRule []interface{} + for _, nodeItem := range node { + nodeRule = append(nodeRule, nodeItem) + } + + logs, sub, err := _Contract.contract.FilterLogs(opts, "DNSRecordDeleted", nodeRule) + if err != nil { + return nil, err + } + return &ContractDNSRecordDeletedIterator{contract: _Contract.contract, event: "DNSRecordDeleted", logs: logs, sub: sub}, nil +} + +// WatchDNSRecordDeleted is a free log subscription operation binding the contract event 0x03528ed0c2a3ebc993b12ce3c16bb382f9c7d88ef7d8a1bf290eaf35955a1207. +// +// Solidity: event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource) +func (_Contract *ContractFilterer) WatchDNSRecordDeleted(opts *bind.WatchOpts, sink chan<- *ContractDNSRecordDeleted, node [][32]byte) (event.Subscription, error) { + + var nodeRule []interface{} + for _, nodeItem := range node { + nodeRule = append(nodeRule, nodeItem) + } + + logs, sub, err := _Contract.contract.WatchLogs(opts, "DNSRecordDeleted", nodeRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(ContractDNSRecordDeleted) + if err := _Contract.contract.UnpackLog(event, "DNSRecordDeleted", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseDNSRecordDeleted is a log parse operation binding the contract event 0x03528ed0c2a3ebc993b12ce3c16bb382f9c7d88ef7d8a1bf290eaf35955a1207. +// +// Solidity: event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource) +func (_Contract *ContractFilterer) ParseDNSRecordDeleted(log types.Log) (*ContractDNSRecordDeleted, error) { + event := new(ContractDNSRecordDeleted) + if err := _Contract.contract.UnpackLog(event, "DNSRecordDeleted", log); err != nil { + return nil, err + } + return event, nil +} + +// ContractDNSZoneClearedIterator is returned from FilterDNSZoneCleared and is used to iterate over the raw logs and unpacked data for DNSZoneCleared events raised by the Contract contract. +type ContractDNSZoneClearedIterator struct { + Event *ContractDNSZoneCleared // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *ContractDNSZoneClearedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(ContractDNSZoneCleared) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(ContractDNSZoneCleared) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *ContractDNSZoneClearedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ContractDNSZoneClearedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ContractDNSZoneCleared represents a DNSZoneCleared event raised by the Contract contract. +type ContractDNSZoneCleared struct { + Node [32]byte + Raw types.Log // Blockchain specific contextual infos +} + +// FilterDNSZoneCleared is a free log retrieval operation binding the contract event 0xb757169b8492ca2f1c6619d9d76ce22803035c3b1d5f6930dffe7b127c1a1983. +// +// Solidity: event DNSZoneCleared(bytes32 indexed node) +func (_Contract *ContractFilterer) FilterDNSZoneCleared(opts *bind.FilterOpts, node [][32]byte) (*ContractDNSZoneClearedIterator, error) { + + var nodeRule []interface{} + for _, nodeItem := range node { + nodeRule = append(nodeRule, nodeItem) + } + + logs, sub, err := _Contract.contract.FilterLogs(opts, "DNSZoneCleared", nodeRule) + if err != nil { + return nil, err + } + return &ContractDNSZoneClearedIterator{contract: _Contract.contract, event: "DNSZoneCleared", logs: logs, sub: sub}, nil +} + +// WatchDNSZoneCleared is a free log subscription operation binding the contract event 0xb757169b8492ca2f1c6619d9d76ce22803035c3b1d5f6930dffe7b127c1a1983. +// +// Solidity: event DNSZoneCleared(bytes32 indexed node) +func (_Contract *ContractFilterer) WatchDNSZoneCleared(opts *bind.WatchOpts, sink chan<- *ContractDNSZoneCleared, node [][32]byte) (event.Subscription, error) { + + var nodeRule []interface{} + for _, nodeItem := range node { + nodeRule = append(nodeRule, nodeItem) + } + + logs, sub, err := _Contract.contract.WatchLogs(opts, "DNSZoneCleared", nodeRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(ContractDNSZoneCleared) + if err := _Contract.contract.UnpackLog(event, "DNSZoneCleared", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseDNSZoneCleared is a log parse operation binding the contract event 0xb757169b8492ca2f1c6619d9d76ce22803035c3b1d5f6930dffe7b127c1a1983. +// +// Solidity: event DNSZoneCleared(bytes32 indexed node) +func (_Contract *ContractFilterer) ParseDNSZoneCleared(log types.Log) (*ContractDNSZoneCleared, error) { + event := new(ContractDNSZoneCleared) + if err := _Contract.contract.UnpackLog(event, "DNSZoneCleared", log); err != nil { + return nil, err + } + return event, nil +} + +// ContractDNSZonehashChangedIterator is returned from FilterDNSZonehashChanged and is used to iterate over the raw logs and unpacked data for DNSZonehashChanged events raised by the Contract contract. +type ContractDNSZonehashChangedIterator struct { + Event *ContractDNSZonehashChanged // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *ContractDNSZonehashChangedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(ContractDNSZonehashChanged) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(ContractDNSZonehashChanged) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *ContractDNSZonehashChangedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ContractDNSZonehashChangedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ContractDNSZonehashChanged represents a DNSZonehashChanged event raised by the Contract contract. +type ContractDNSZonehashChanged struct { + Node [32]byte + Lastzonehash []byte + Zonehash []byte + Raw types.Log // Blockchain specific contextual infos +} + +// FilterDNSZonehashChanged is a free log retrieval operation binding the contract event 0x8f15ed4b723ef428f250961da8315675b507046737e19319fc1a4d81bfe87f85. +// +// Solidity: event DNSZonehashChanged(bytes32 indexed node, bytes lastzonehash, bytes zonehash) +func (_Contract *ContractFilterer) FilterDNSZonehashChanged(opts *bind.FilterOpts, node [][32]byte) (*ContractDNSZonehashChangedIterator, error) { + + var nodeRule []interface{} + for _, nodeItem := range node { + nodeRule = append(nodeRule, nodeItem) + } + + logs, sub, err := _Contract.contract.FilterLogs(opts, "DNSZonehashChanged", nodeRule) + if err != nil { + return nil, err + } + return &ContractDNSZonehashChangedIterator{contract: _Contract.contract, event: "DNSZonehashChanged", logs: logs, sub: sub}, nil +} + +// WatchDNSZonehashChanged is a free log subscription operation binding the contract event 0x8f15ed4b723ef428f250961da8315675b507046737e19319fc1a4d81bfe87f85. +// +// Solidity: event DNSZonehashChanged(bytes32 indexed node, bytes lastzonehash, bytes zonehash) +func (_Contract *ContractFilterer) WatchDNSZonehashChanged(opts *bind.WatchOpts, sink chan<- *ContractDNSZonehashChanged, node [][32]byte) (event.Subscription, error) { + + var nodeRule []interface{} + for _, nodeItem := range node { + nodeRule = append(nodeRule, nodeItem) + } + + logs, sub, err := _Contract.contract.WatchLogs(opts, "DNSZonehashChanged", nodeRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(ContractDNSZonehashChanged) + if err := _Contract.contract.UnpackLog(event, "DNSZonehashChanged", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseDNSZonehashChanged is a log parse operation binding the contract event 0x8f15ed4b723ef428f250961da8315675b507046737e19319fc1a4d81bfe87f85. +// +// Solidity: event DNSZonehashChanged(bytes32 indexed node, bytes lastzonehash, bytes zonehash) +func (_Contract *ContractFilterer) ParseDNSZonehashChanged(log types.Log) (*ContractDNSZonehashChanged, error) { + event := new(ContractDNSZonehashChanged) + if err := _Contract.contract.UnpackLog(event, "DNSZonehashChanged", log); err != nil { + return nil, err + } + return event, nil +} + // ContractInterfaceChangedIterator is returned from FilterInterfaceChanged and is used to iterate over the raw logs and unpacked data for InterfaceChanged events raised by the Contract contract. type ContractInterfaceChangedIterator struct { Event *ContractInterfaceChanged // Event containing the contract specifics and raw log @@ -1706,6 +2244,17 @@ func (_Contract *ContractFilterer) WatchInterfaceChanged(opts *bind.WatchOpts, s }), nil } +// ParseInterfaceChanged is a log parse operation binding the contract event 0x7c69f06bea0bdef565b709e93a147836b0063ba2dd89f02d0b7e8d931e6a6daa. +// +// Solidity: event InterfaceChanged(bytes32 indexed node, bytes4 indexed interfaceID, address implementer) +func (_Contract *ContractFilterer) ParseInterfaceChanged(log types.Log) (*ContractInterfaceChanged, error) { + event := new(ContractInterfaceChanged) + if err := _Contract.contract.UnpackLog(event, "InterfaceChanged", log); err != nil { + return nil, err + } + return event, nil +} + // ContractNameChangedIterator is returned from FilterNameChanged and is used to iterate over the raw logs and unpacked data for NameChanged events raised by the Contract contract. type ContractNameChangedIterator struct { Event *ContractNameChanged // Event containing the contract specifics and raw log @@ -1839,6 +2388,17 @@ func (_Contract *ContractFilterer) WatchNameChanged(opts *bind.WatchOpts, sink c }), nil } +// ParseNameChanged is a log parse operation binding the contract event 0xb7d29e911041e8d9b843369e890bcb72c9388692ba48b65ac54e7214c4c348f7. +// +// Solidity: event NameChanged(bytes32 indexed node, string name) +func (_Contract *ContractFilterer) ParseNameChanged(log types.Log) (*ContractNameChanged, error) { + event := new(ContractNameChanged) + if err := _Contract.contract.UnpackLog(event, "NameChanged", log); err != nil { + return nil, err + } + return event, nil +} + // ContractPubkeyChangedIterator is returned from FilterPubkeyChanged and is used to iterate over the raw logs and unpacked data for PubkeyChanged events raised by the Contract contract. type ContractPubkeyChangedIterator struct { Event *ContractPubkeyChanged // Event containing the contract specifics and raw log @@ -1973,6 +2533,17 @@ func (_Contract *ContractFilterer) WatchPubkeyChanged(opts *bind.WatchOpts, sink }), nil } +// ParsePubkeyChanged is a log parse operation binding the contract event 0x1d6f5e03d3f63eb58751986629a5439baee5079ff04f345becb66e23eb154e46. +// +// Solidity: event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y) +func (_Contract *ContractFilterer) ParsePubkeyChanged(log types.Log) (*ContractPubkeyChanged, error) { + event := new(ContractPubkeyChanged) + if err := _Contract.contract.UnpackLog(event, "PubkeyChanged", log); err != nil { + return nil, err + } + return event, nil +} + // ContractTextChangedIterator is returned from FilterTextChanged and is used to iterate over the raw logs and unpacked data for TextChanged events raised by the Contract contract. type ContractTextChangedIterator struct { Event *ContractTextChanged // Event containing the contract specifics and raw log @@ -2043,22 +2614,26 @@ func (it *ContractTextChangedIterator) Close() error { // ContractTextChanged represents a TextChanged event raised by the Contract contract. type ContractTextChanged struct { Node [32]byte - IndexedKey string + IndexedKey common.Hash Key string Raw types.Log // Blockchain specific contextual infos } // FilterTextChanged is a free log retrieval operation binding the contract event 0xd8c9334b1a9c2f9da342a0a2b32629c1a229b6445dad78947f674b44444a7550. // -// Solidity: event TextChanged(bytes32 indexed node, string indexedKey, string key) -func (_Contract *ContractFilterer) FilterTextChanged(opts *bind.FilterOpts, node [][32]byte) (*ContractTextChangedIterator, error) { +// Solidity: event TextChanged(bytes32 indexed node, string indexed indexedKey, string key) +func (_Contract *ContractFilterer) FilterTextChanged(opts *bind.FilterOpts, node [][32]byte, indexedKey []string) (*ContractTextChangedIterator, error) { var nodeRule []interface{} for _, nodeItem := range node { nodeRule = append(nodeRule, nodeItem) } + var indexedKeyRule []interface{} + for _, indexedKeyItem := range indexedKey { + indexedKeyRule = append(indexedKeyRule, indexedKeyItem) + } - logs, sub, err := _Contract.contract.FilterLogs(opts, "TextChanged", nodeRule) + logs, sub, err := _Contract.contract.FilterLogs(opts, "TextChanged", nodeRule, indexedKeyRule) if err != nil { return nil, err } @@ -2067,15 +2642,19 @@ func (_Contract *ContractFilterer) FilterTextChanged(opts *bind.FilterOpts, node // WatchTextChanged is a free log subscription operation binding the contract event 0xd8c9334b1a9c2f9da342a0a2b32629c1a229b6445dad78947f674b44444a7550. // -// Solidity: event TextChanged(bytes32 indexed node, string indexedKey, string key) -func (_Contract *ContractFilterer) WatchTextChanged(opts *bind.WatchOpts, sink chan<- *ContractTextChanged, node [][32]byte) (event.Subscription, error) { +// Solidity: event TextChanged(bytes32 indexed node, string indexed indexedKey, string key) +func (_Contract *ContractFilterer) WatchTextChanged(opts *bind.WatchOpts, sink chan<- *ContractTextChanged, node [][32]byte, indexedKey []string) (event.Subscription, error) { var nodeRule []interface{} for _, nodeItem := range node { nodeRule = append(nodeRule, nodeItem) } + var indexedKeyRule []interface{} + for _, indexedKeyItem := range indexedKey { + indexedKeyRule = append(indexedKeyRule, indexedKeyItem) + } - logs, sub, err := _Contract.contract.WatchLogs(opts, "TextChanged", nodeRule) + logs, sub, err := _Contract.contract.WatchLogs(opts, "TextChanged", nodeRule, indexedKeyRule) if err != nil { return nil, err } @@ -2107,126 +2686,13 @@ func (_Contract *ContractFilterer) WatchTextChanged(opts *bind.WatchOpts, sink c }), nil } -// ContractUpdatedIterator is returned from FilterUpdated and is used to iterate over the raw logs and unpacked data for Updated events raised by the Contract contract. -type ContractUpdatedIterator struct { - Event *ContractUpdated // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *ContractUpdatedIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(ContractUpdated) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(ContractUpdated) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *ContractUpdatedIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *ContractUpdatedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// ContractUpdated represents a Updated event raised by the Contract contract. -type ContractUpdated struct { - Node [32]byte - Name []byte - Resource uint16 - Raw types.Log // Blockchain specific contextual infos -} - -// FilterUpdated is a free log retrieval operation binding the contract event 0xb09b445b0776998f69b77758912de74d641195b10c8f03062f124495b13ef9f6. +// ParseTextChanged is a log parse operation binding the contract event 0xd8c9334b1a9c2f9da342a0a2b32629c1a229b6445dad78947f674b44444a7550. // -// Solidity: event Updated(bytes32 node, bytes name, uint16 resource) -func (_Contract *ContractFilterer) FilterUpdated(opts *bind.FilterOpts) (*ContractUpdatedIterator, error) { - - logs, sub, err := _Contract.contract.FilterLogs(opts, "Updated") - if err != nil { +// Solidity: event TextChanged(bytes32 indexed node, string indexed indexedKey, string key) +func (_Contract *ContractFilterer) ParseTextChanged(log types.Log) (*ContractTextChanged, error) { + event := new(ContractTextChanged) + if err := _Contract.contract.UnpackLog(event, "TextChanged", log); err != nil { return nil, err } - return &ContractUpdatedIterator{contract: _Contract.contract, event: "Updated", logs: logs, sub: sub}, nil -} - -// WatchUpdated is a free log subscription operation binding the contract event 0xb09b445b0776998f69b77758912de74d641195b10c8f03062f124495b13ef9f6. -// -// Solidity: event Updated(bytes32 node, bytes name, uint16 resource) -func (_Contract *ContractFilterer) WatchUpdated(opts *bind.WatchOpts, sink chan<- *ContractUpdated) (event.Subscription, error) { - - logs, sub, err := _Contract.contract.WatchLogs(opts, "Updated") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(ContractUpdated) - if err := _Contract.contract.UnpackLog(event, "Updated", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil + return event, nil } diff --git a/vendor/github.com/wealdtech/go-ens/v3/dnsresolver.go b/vendor/github.com/wealdtech/go-ens/v3/dnsresolver.go index 78bfcbe8e..6b6c382c3 100644 --- a/vendor/github.com/wealdtech/go-ens/v3/dnsresolver.go +++ b/vendor/github.com/wealdtech/go-ens/v3/dnsresolver.go @@ -107,6 +107,24 @@ func (r *DNSResolver) ClearDNSZone(opts *bind.TransactOpts) (*types.Transaction, return r.Contract.ClearDNSZone(opts, nameHash) } +// Zonehash returns the zone hash of the domain +func (r *DNSResolver) Zonehash() ([]byte, error) { + nameHash, err := NameHash(r.domain) + if err != nil { + return nil, err + } + return r.Contract.Zonehash(nil, nameHash) +} + +// SetZonehash sets the zone hash of the domain +func (r *DNSResolver) SetZonehash(opts *bind.TransactOpts, zonehash []byte) (*types.Transaction, error) { + nameHash, err := NameHash(r.domain) + if err != nil { + return nil, err + } + return r.Contract.SetZonehash(opts, nameHash, zonehash) +} + // DNSWireFormatDomainHash hashes a domain name in wire format func DNSWireFormatDomainHash(domain string) (hash [32]byte) { sha := sha3.NewLegacyKeccak256() diff --git a/vendor/github.com/wealdtech/go-ens/v3/namehash.go b/vendor/github.com/wealdtech/go-ens/v3/namehash.go index c0738618a..2e1b84ffd 100644 --- a/vendor/github.com/wealdtech/go-ens/v3/namehash.go +++ b/vendor/github.com/wealdtech/go-ens/v3/namehash.go @@ -46,7 +46,9 @@ func LabelHash(label string) (hash [32]byte, err error) { } sha := sha3.NewLegacyKeccak256() - sha.Write([]byte(normalizedLabel)) + if _, err = sha.Write([]byte(normalizedLabel)); err != nil { + return + } sha.Sum(hash[:0]) return } @@ -63,18 +65,26 @@ func NameHash(name string) (hash [32]byte, err error) { } parts := strings.Split(normalizedName, ".") for i := len(parts) - 1; i >= 0; i-- { - hash = nameHashPart(hash, parts[i]) + if hash, err = nameHashPart(hash, parts[i]); err != nil { + return + } } return } -func nameHashPart(currentHash [32]byte, name string) (hash [32]byte) { +func nameHashPart(currentHash [32]byte, name string) (hash [32]byte, err error) { sha := sha3.NewLegacyKeccak256() - sha.Write(currentHash[:]) + if _, err = sha.Write(currentHash[:]); err != nil { + return + } nameSha := sha3.NewLegacyKeccak256() - nameSha.Write([]byte(name)) + if _, err = nameSha.Write([]byte(name)); err != nil { + return + } nameHash := nameSha.Sum(nil) - sha.Write(nameHash) + if _, err = sha.Write(nameHash); err != nil { + return + } sha.Sum(hash[:0]) return } diff --git a/vendor/github.com/wealdtech/go-ens/v3/registry.go b/vendor/github.com/wealdtech/go-ens/v3/registry.go index 27ecd074a..8442a3adb 100644 --- a/vendor/github.com/wealdtech/go-ens/v3/registry.go +++ b/vendor/github.com/wealdtech/go-ens/v3/registry.go @@ -135,7 +135,7 @@ func RegistryContractAddress(backend bind.ContractBackend) (common.Address, erro // Instantiate the registry contract if chainID.Cmp(params.MainnetChainConfig.ChainID) == 0 { - return common.HexToAddress("314159265dd8dbb310642f98f50c066173c1259b"), nil + return common.HexToAddress("00000000000C2E074eC69A0dFb2997BA6C7d2e1e"), nil } else if chainID.Cmp(params.TestnetChainConfig.ChainID) == 0 { return common.HexToAddress("112234455c3a32fd11230c42e7bccd4a84e02010"), nil } else if chainID.Cmp(params.RinkebyChainConfig.ChainID) == 0 { diff --git a/vendor/github.com/wealdtech/go-ens/v3/resolver.go b/vendor/github.com/wealdtech/go-ens/v3/resolver.go index 254119e3f..a897ba522 100644 --- a/vendor/github.com/wealdtech/go-ens/v3/resolver.go +++ b/vendor/github.com/wealdtech/go-ens/v3/resolver.go @@ -53,7 +53,7 @@ func NewResolver(backend bind.ContractBackend, domain string) (*Resolver, error) if err != nil { return nil, err } - if bytes.Compare(ownerAddress.Bytes(), UnknownAddress.Bytes()) == 0 { + if bytes.Equal(ownerAddress.Bytes(), UnknownAddress.Bytes()) { return nil, errors.New("unregistered name") } @@ -204,7 +204,7 @@ func resolveName(backend bind.ContractBackend, input string) (address common.Add if err != nil { return UnknownAddress, err } - if bytes.Compare(nameHash[:], zeroHash) == 0 { + if bytes.Equal(nameHash[:], zeroHash) { err = errors.New("Bad name") } else { address, err = resolveHash(backend, input) @@ -223,7 +223,7 @@ func resolveHash(backend bind.ContractBackend, domain string) (address common.Ad if err != nil { return UnknownAddress, err } - if bytes.Compare(address.Bytes(), UnknownAddress.Bytes()) == 0 { + if bytes.Equal(address.Bytes(), UnknownAddress.Bytes()) { return UnknownAddress, errors.New("no address") } @@ -258,7 +258,9 @@ func (r *Resolver) SetABI(opts *bind.TransactOpts, name string, abi string, cont // Zlib-compressed JSON var b bytes.Buffer w := zlib.NewWriter(&b) - w.Write([]byte(abi)) + if _, err := w.Write([]byte(abi)); err != nil { + return nil, err + } w.Close() data = b.Bytes() } else { diff --git a/vendor/github.com/wealdtech/go-ens/v3/reverseresolver.go b/vendor/github.com/wealdtech/go-ens/v3/reverseresolver.go index 72379e2df..4e4fc5d82 100644 --- a/vendor/github.com/wealdtech/go-ens/v3/reverseresolver.go +++ b/vendor/github.com/wealdtech/go-ens/v3/reverseresolver.go @@ -82,7 +82,7 @@ func (r *ReverseResolver) Name(address common.Address) (string, error) { func Format(backend bind.ContractBackend, address common.Address) string { result, err := ReverseResolve(backend, address) if err != nil { - result = fmt.Sprintf("%s", address.Hex()) + result = address.Hex() } return result } diff --git a/vendor/modules.txt b/vendor/modules.txt index be714d0ed..fe848566b 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -18,6 +18,8 @@ github.com/btcsuite/btcd/wire github.com/btcsuite/btcutil github.com/btcsuite/btcutil/base58 github.com/btcsuite/btcutil/bech32 +# github.com/cenkalti/backoff/v3 v3.2.2 +github.com/cenkalti/backoff/v3 # github.com/cespare/xxhash/v2 v2.1.0 github.com/cespare/xxhash/v2 # github.com/coreos/go-semver v0.3.0 @@ -109,7 +111,7 @@ github.com/ethereum/go-ethereum/trie # github.com/fjl/memsize v0.0.0-20180929194037-2a09253e352a github.com/fjl/memsize github.com/fjl/memsize/memsizeui -# github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff +# github.com/gballet/go-libpcsclite v0.0.0-20191108122812-4678299bea08 github.com/gballet/go-libpcsclite # github.com/go-playground/locales v0.13.0 github.com/go-playground/locales @@ -121,7 +123,7 @@ github.com/go-stack/stack # github.com/gogo/protobuf v1.3.1 github.com/gogo/protobuf/io github.com/gogo/protobuf/proto -# github.com/golang-migrate/migrate/v4 v4.6.2 +# github.com/golang-migrate/migrate/v4 v4.8.0 github.com/golang-migrate/migrate/v4 github.com/golang-migrate/migrate/v4/database github.com/golang-migrate/migrate/v4/internal/url @@ -175,9 +177,9 @@ github.com/jbenet/go-temp-err-catcher github.com/jbenet/goprocess github.com/jbenet/goprocess/context github.com/jbenet/goprocess/periodic -# github.com/jinzhu/copier v0.0.0-20190625015134-976e0346caa8 +# github.com/jinzhu/copier v0.0.0-20190924061706-b57f9002281a github.com/jinzhu/copier -# github.com/karalabe/usb v0.0.0-20190819132248-550797b1cad8 +# github.com/karalabe/usb v0.0.0-20191104083709-911d15fe12a9 github.com/karalabe/usb # github.com/koron/go-ssdp v0.0.0-20191105050749-2e1c40ed0b5d github.com/koron/go-ssdp @@ -276,7 +278,7 @@ github.com/libp2p/go-tcp-transport github.com/libp2p/go-ws-transport # github.com/libp2p/go-yamux v1.2.3 github.com/libp2p/go-yamux -# github.com/lucasb-eyer/go-colorful v1.0.2 +# github.com/lucasb-eyer/go-colorful v1.0.3 github.com/lucasb-eyer/go-colorful # github.com/mattn/go-colorable v0.1.1 github.com/mattn/go-colorable @@ -358,7 +360,7 @@ github.com/spaolacci/murmur3 github.com/status-im/doubleratchet # github.com/status-im/go-multiaddr-ethv4 v1.2.0 github.com/status-im/go-multiaddr-ethv4 -# github.com/status-im/keycard-go v0.0.0-20190424133014-d95853db0f48 +# github.com/status-im/keycard-go v0.0.0-20200107115650-f38e9a19958e github.com/status-im/keycard-go/derivationpath # github.com/status-im/migrate/v4 v4.6.2-status.2 github.com/status-im/migrate/v4 @@ -370,42 +372,11 @@ github.com/status-im/migrate/v4/source/go_bindata github.com/status-im/rendezvous github.com/status-im/rendezvous/protocol github.com/status-im/rendezvous/server -# github.com/status-im/status-go/eth-node v1.1.0 => ./eth-node -github.com/status-im/status-go/eth-node/bridge/geth -github.com/status-im/status-go/eth-node/bridge/geth/ens -github.com/status-im/status-go/eth-node/bridge/nimbus -github.com/status-im/status-go/eth-node/core/types -github.com/status-im/status-go/eth-node/crypto -github.com/status-im/status-go/eth-node/crypto/ecies -github.com/status-im/status-go/eth-node/keystore -github.com/status-im/status-go/eth-node/types -github.com/status-im/status-go/eth-node/types/ens -# github.com/status-im/status-go/extkeys v1.1.0 => ./extkeys +# github.com/status-im/status-go/extkeys v1.1.0 github.com/status-im/status-go/extkeys -# github.com/status-im/status-go/protocol v1.1.0 => ./protocol -github.com/status-im/status-go/protocol -github.com/status-im/status-go/protocol/datasync -github.com/status-im/status-go/protocol/datasync/peer -github.com/status-im/status-go/protocol/encryption -github.com/status-im/status-go/protocol/encryption/migrations -github.com/status-im/status-go/protocol/encryption/multidevice -github.com/status-im/status-go/protocol/encryption/publisher -github.com/status-im/status-go/protocol/encryption/sharedsecret -github.com/status-im/status-go/protocol/identity/alias -github.com/status-im/status-go/protocol/identity/identicon -github.com/status-im/status-go/protocol/migrations -github.com/status-im/status-go/protocol/protobuf -github.com/status-im/status-go/protocol/sqlite -github.com/status-im/status-go/protocol/transport -github.com/status-im/status-go/protocol/transport/waku -github.com/status-im/status-go/protocol/transport/waku/migrations -github.com/status-im/status-go/protocol/transport/whisper -github.com/status-im/status-go/protocol/transport/whisper/migrations -github.com/status-im/status-go/protocol/v1 -github.com/status-im/status-go/protocol/zaputil -# github.com/status-im/status-go/waku v1.1.0 => ./waku +# github.com/status-im/status-go/waku v1.2.0 github.com/status-im/status-go/waku -# github.com/status-im/status-go/whisper/v6 v6.1.0 => ./whisper +# github.com/status-im/status-go/whisper/v6 v6.1.0 github.com/status-im/status-go/whisper/v6 # github.com/status-im/tcp-shaker v0.0.0-20191114194237-215893130501 github.com/status-im/tcp-shaker @@ -447,7 +418,7 @@ github.com/vacp2p/mvds/state/migrations github.com/vacp2p/mvds/store github.com/vacp2p/mvds/store/migrations github.com/vacp2p/mvds/transport -# github.com/wealdtech/go-ens/v3 v3.0.9 +# github.com/wealdtech/go-ens/v3 v3.3.0 github.com/wealdtech/go-ens/v3 github.com/wealdtech/go-ens/v3/contracts/auctionregistrar github.com/wealdtech/go-ens/v3/contracts/baseregistrar